HeapsIO / heaps

Heaps : Haxe Game Framework
http://heaps.io
MIT License
3.22k stars 340 forks source link

Add current camera instance tracking to 2D RenderContext #1201

Closed Yanrishatum closed 7 months ago

Yanrishatum commented 7 months ago

The h2d.Camera instance is now tracked via RenderContext.currentCamera variable. This allows for much more flexible camera visibility filtering other than top-level layer filtering, as objects nested deep in the object tree now will be able to check which camera they are being rendered by during drawRec call and alter/prevent rendering when needed.

Motivation: While filtering by top-level layers works reasonably well, when more complex cases arise, like camera-specific effects nested in the object tree or camera-specific parameters for rendering like tint or alpha - it becomes clear that a way to check current active camera is required.

Additionally updated Camera2D sample: