Skip to content
PDeveloper edited this page Oct 29, 2012 · 8 revisions

hxDynaLight is a geometry based lighting engine.

I guess that's a fancy way of saying that you have to define a polygon or a circle, and it will cast shadows from that object rather than being based on Sprites or Movieclips.

The main class in this kerfuffle is the LightEngine. You can add Light and ILightOccluder objects to the light engine, and then lightEngine.render( myBitmapData) all the pretty lights.

com.pdev.lighting.tools.LightTool holds 2 static functions. 1 for creating radial gradients as light maps for lights, and another for creating a paletteMap that will translate lightmap values to actual colour values.

I suggest checking out Main.hx to see an example of how to set things up. The same code should apply to as3 users too.

Dependencies

Polygonal Data structures. If you are using the .swc for as3, then you don't need to worry about this, the required classes should all be included in the .swc

If you are using haxe, just run the following command from commandline: haxelib install polygonal-ds

Clone this wiki locally