Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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.

Release History

This version
History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
lightvolume-0.1.3.tar.gz
(166.9 kB) Copy SHA256 Hash SHA256
Source Oct 22, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting