Skip to content
SimonIT edited this page Nov 10, 2024 · 5 revisions

Glossary

  • RayHandler is the handler class for all lights. The ray handler manages updating, rendering and disposal of the lights. Ray handler also checks the current OpenGL version and uses the correct mode for rendering. If GLES2.0 is detected: Gaussian blur lights map is enabled and used automatically. GLES2.0 has a larger constant time, but scales better with multiple lights because the lights are rendered to a small FBO instead of the render target and the fragment shader has less work to do.
    • new RayHandler(box2dWorld, fboWidth, fboHeight);

Light Types

  • PointLight is the first concrete class. It's the simplest and most used light. Point lights have meaningful position and distance and all other light attributes. Point lights are always circular.
    • new PointLight(rayHandler, numRays, color, maxDistance, x, y); `.
  • ConeLight is the second concrete class. It's basically a point light, but only a sector of the full circle. Cone lights have direction and cone degree as additional parameters. The cone degree is the aberration of the straight line in both directions. Setting Cone Degree to 180 means that you have a full circle.
    • new ConeLight(rayHandler, numRays, color, maxDistance, x, y, directionDegree, coneDegree);
  • DirectionalLight simulates a light source that is located at infinite distance. This means that direction and intensity are the same everywhere. The -90 direction is straight up. This type of light is good for simulating the sun.
    • new DirectionalLight(rayHandler, numRays, color, directionDegree);

Light Abstract Classes

  • Light is an abstract class that contains common parameters and acts as an "interface" for all lights. A light is made up of a bunch of rays that are tested with raycasting against the box2d geometry, and from this data the light mesh is constructed and rendered into the scene. All lights have meaningful color, number of rays, softShadowLength and some booleans like active, soft, xray, staticLight.
  • PositionalLight is also an abstract class. It contains common parameters between point and cone lights. Positional lights have a position and a finite distance.
Clone this wiki locally