Creating the Shadow Caster Object

As mentioned, creating a Renderable object to pair with the ShadowCasterShader object would allow game clients to create and manipulate shadow casters as game objects. However, shadow casters and the associated geometries are implicitly computed based on the associated shadow receiver and light sources. For this reason, shadow casters cannot be directly manipulated by the game clients.

Instead of the familiar Renderable object hierarchy, the ShadowCaster object is defined to encapsulate the implicitly defined shadow caster geometry functionality. A ShadowCaster object represents a Renderable game object that will cast shadow on a shadow receiver, another Renderable game object. To support receiving shadows on ...

Get Build Your Own 2D Game Engine and Create Great Web Games: Using HTML5, JavaScript, and WebGL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.