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.1-cp314-cp314-win_amd64.whl (97.2 kB view details)

Uploaded CPython 3.14Windows x86-64

File details

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

File metadata

  • Download URL: crender-0.0.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 97.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.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 30c2b3a64d18dd1ab6fb916533c60358aaeb37c7c602a98b2088272d6c50187c
MD5 c2025329707cefbb7d74e39a96aabebb
BLAKE2b-256 9e29f7343c56a40ba4f2a12c45517e61ea5ef1473d1a8fbb2b4432b49fe7edb5

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