Skip to main content

A lightweight C++ 3D rendering library with Python bindings.

Project description

CRender

A customised 3D rendering library designed for quick 3D renders without the setup pipeline required by OpenGL. Optimised for easy Python integration — in essence a 3-dimensional Pygame with more efficient shape drawing methods. Note that this does not open a window, you will have to use an extra library to do this, this is to allow more control over visuals, this will only output the frame data.

Note: This package is currently in early development and may not be stable.

Installation

pip install crender

Usage

To display outputs, you will need to use an external library such as opencv like so

import numpy as np
import cv2

buf = engine.get_framebuffer()
frame = np.frombuffer(buf, dtype=np.uint8).reshape(height, width, 4)
cv2.imshow("Renderer", frame)

To have the display auto update, simply set autoupdate to true and define the desired framerate:

from crender import Engine

engine = Engine()
engine.init(autoupdate=True, fps=60)

For manual updates, set autoupdate to false and call update() yourself:

engine = Engine()
engine.init(autoupdate=False, fps=60)  # fps is negligible when autoupdate is False

while True:
    engine.update()

Adding Shapes

Load a shape from an OBJ file and position it in the scene:

from crender import Engine, create_point

engine = Engine()
sofa = engine.add_shape("sofa.obj", create_point(0, 0, 0), width=1, height=1)
sofa.move_shape(10, 0, 0)

Camera

Update the camera position and angle:

from crender import create_point

position = create_point(1, 1, 1)
engine.update_camera(position, angleX=0, angleY=0, angleZ=0)

Preview

Preview

License

BSD 3-Clause "New" or "Revised" License. View LICENSE for more details

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

crender-0.0.2-cp314-cp314-win_amd64.whl (98.2 kB view details)

Uploaded CPython 3.14Windows x86-64

File details

Details for the file crender-0.0.2-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: crender-0.0.2-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 98.2 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for crender-0.0.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 fd66b65b77d16b79c6c73a5b15ebc469f01b3dc267326b93ebd0477f8da45658
MD5 f074b62a65187ab4dcabc0d287d93a98
BLAKE2b-256 aa2cd15ceca300f3ff2580da0791b9e2cd59f13764bf50076d0afc98c669e90c

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