Light volume calculation and rendering with OpenGL
Project description
This package provides the module lightvolume, which offers a CFFI binding to trylock/visibility. This, in turn, is a C++ implementation of the visibility algorithm documented in detail (with awesome interactive demos) on the Red Blob Games website.
API
First, import lightvolume:
import lightvolume
Then, we can create a number of shadow-casting bodies:
objects = [ lightvolume.rect(0, 0, 500, 500), # outer bounds - this is needed lightvolume.rect(20, 30, 10, 20), lightvolume.rect(290, 300, 100, 300), ]
Finally, we can render the lit area cast by a light in this scene (an OpenGL context must already have been created and appropriate GL state set):
light = 90, 200 lightvolume.draw_light(light, objects)
This module is intended to be used with appropriate shaders to provide attenuation, surface interactions such as bump mapping, and so on.
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
File details
Details for the file lightvolume-0.1.1.tar.gz
.
File metadata
- Download URL: lightvolume-0.1.1.tar.gz
- Upload date:
- Size: 85.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 082cd21707278c50fd4c73eccecf8221ef02d445c827fc5322069824a9cfafd3 |
|
MD5 | eea6bad499e5e2a1bdba8bd85495a3e7 |
|
BLAKE2b-256 | 2be6ce47d07229f7f84b859d05f1ae14844b0b59a5dfb9a5e54226002a9204be |