Skip to main content

A python library purposed as a simple 3D display engine

Project description

This first ever python library that can function as a simple 3D engine for the usage of displaying and rotating of Objects. This library allows for you to use any library in addition to this one and display whatever object any way that you want. The purpose of this library is allow the user to quickly and efficiently display 3D objects without the use of complex libraries. This library is still in its alpha stages and is being rapidly updated/altered with new features, improved efficiency, less bugs and more stability.

Installation

pip install Lobster

Dependencies

python (built-in) math library :: sin, cos, tan, sqrt, pi

Usage

IMPORTING

from Lobster import Object, Camera, init, display

Displaying a Rotating Cube using the Pygame Library

from Lobster import Object, Camera, init, display
import pygame

pygame.init()
clock = pygame.time.Clock()
screen_width, screen_height = 600, 600
displayScreen = True
screen = pygame.display.set_mode((screen_width, screen_height))
init(screen_width, screen_height, 3.141592653 / 2, 0.1, 50)

cube = Object(
    vertices=((1, 1, 1), (1, 1, -1), (1, -1, 1), (1, -1, -1), 
              (-1, 1, 1), (-1, 1, -1), (-1, -1, 1), (-1, -1, -1)),
    position=[0, 0, 5],
    faces=((0, 4, 6, 2), (3, 2, 6, 7), (7, 6, 4, 5), (5, 1, 3, 7), (1, 0, 2, 3), (5, 4, 0, 1)),
    colors=((255, 0, 255), (255, 0, 0), (100, 150, 1), (233, 223, 15), (13, 150, 225), (13, 223, 125))
)
player = Camera(position=[0, 0, 0], rotation=[0, 0, 0])

while displayScreen:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            displayScreen = False

    screen.fill((255, 255, 255))

    player.rotation[0] += 0.03
    player.rotation[1] += 0.01
    player.rotation[2] += 0.02

    for (points, z_len, color) in display(cube, player):
        pygame.draw.polygon(screen, color, points)

    pygame.display.set_caption(str(clock.get_fps()))
    clock.tick(60)
    pygame.display.update()

Uninstallation

pip uninstall Lobster

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

Lobster-3dEngine-0.0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

Lobster_3dEngine-0.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file Lobster-3dEngine-0.0.1.tar.gz.

File metadata

  • Download URL: Lobster-3dEngine-0.0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

File hashes

Hashes for Lobster-3dEngine-0.0.1.tar.gz
Algorithm Hash digest
SHA256 79b8daabb979053b713ab57a86506759591264fc721c6083779b12f0bb1dbef6
MD5 917cfa0214379f20154c82ce1c605828
BLAKE2b-256 db43a8a5d724ff807cc35d015920f33493aa4ce60b53d0a344d7a81254598f39

See more details on using hashes here.

File details

Details for the file Lobster_3dEngine-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: Lobster_3dEngine-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

File hashes

Hashes for Lobster_3dEngine-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fecd80adb226aa063d7f592ea17a471d0388000de024eb2d1a2a784051adec19
MD5 691a060d0d3531570037d50e147146d4
BLAKE2b-256 240208bad010f05418bc9b06ac86332c350bd9fa17de0a9a53752bebd646bd02

See more details on using hashes here.

Supported by

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