Skip to main content

A module to render 3D graphics.

Project description

PopcornGL

A Python module based on my custom graphics engine.

This project is in open Alpha, and will improve depending on the attention it gets.

Requirements

Python versions tested: 3.9.6

Python modules needed:

  • operator
  • math
  • copy

How to Install

To install PopcornGL you need to run the command pip install popcorngl in your command prompt. If the command does not work, create an issue relating the problem and I'll see if I can help you.

Documentation

Classes

Camera(x_rotation, y_rotation, z_rotation, fov, center, distance)

This class is responsible for the camera in the scene.

Class Functions:
rotate_x(amount): rotates the camera a certain amount on the X axis around the center of the scene.
rotate_y(amount): rotates the camera a certain amount on the Y axis around the center of the scene.
rotate_z(amount): rotates the camera a certain amount on the Z axis around the center of the scene.
change_distance(amount): moves the camera further away from the object by a certain amount.

Class Variables:
x_rotation: the cameras rotation on the X axis.
y_rotation: the cameras rotation on the Y axis.
z_rotation: the cameras rotation on the Z axis.
fov: the cameras fov. (not actually the FOV I just didnt know what else to call it)
center: the center of the screen.
distance: the distance from the object in the scene.

Light(position, intensity, radius)

This class is responsible for the lighting in the scene. It's not necessary if you're not going to use it.

Class Variables:
position: The position of the light in the scene.
intensity: The intensity of the light.
radius: The range of the light.

Engine()

This class is responsible for functions that do math.

Class Functions:
do_3d_math(points, camera): This function returns the X and Y values of the points with 3D coords passed in it.
do_light_math(faces, points, light): This function returns the faces list with modification to the color based on the light.
sort_faces(faces): This function returns a sorted list of faces based on the depth of them in the scene (for painter's algorithm).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

popcorngl-1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

popcorngl-1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file popcorngl-1.tar.gz.

File metadata

  • Download URL: popcorngl-1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for popcorngl-1.tar.gz
Algorithm Hash digest
SHA256 c197182ff024e11aa77ceea03ef7f4a87800ee39f006c953c6d69b9e72e3dece
MD5 d4f2bdedd65ab570e78bc7a54aaa5c1b
BLAKE2b-256 b65019e79ca72c9ded1736472801c3fad3b29d09834e4544ecf74e22a1ad2241

See more details on using hashes here.

File details

Details for the file popcorngl-1-py3-none-any.whl.

File metadata

  • Download URL: popcorngl-1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for popcorngl-1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb08baee2a263e31bd85d7ebcee001a81e79a64c8b8d6784210a80922087f042
MD5 b34dd96e1a2371208b7cc57283cae781
BLAKE2b-256 4443191eed8e81eb83c7c8d62f620946cd9c9bc8cc40b163facfd5fe775d1618

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page