be able to operate on many objects as a single unit. This single unit is a Group object, which has many Object objects
you cannot "render" a Group object
a scene has at least one Layer
a Scene has many Layer objects which can be squashed together on a render loop.
a Layer of a scene has a stack order (e.g. z-index)
Marking things as dirty
The Layer bounding-box is its associated canvas size (width and height)
A Layer becomes dirty when an object is both dirty and is visible within its bounding box
Operations on Group may affect its children to become dirty. if an object of the Group becomes dirty, and it is visible in any of its parent Layers, then mark those Layers as dirty.
When processing a Scene, process only the dirty Layers. Any non-dirty Layers created in the previous render loop are reused, unless configured otherwise.
(needs optimization) if a layer is dirty, all its objects are dirty
rationale
Group
to form aLayer
Layer
has manyObject
objectsGroup
object, which has manyObject
objectsGroup
objectLayer
Scene
has manyLayer
objects which can be squashed together on a render loop.Layer
of a scene has a stack order (e.g. z-index)Marking things as dirty
Layer
bounding-box is its associated canvas size (width and height)Layer
becomes dirty when an object is both dirty and is visible within its bounding boxGroup
may affect its children to become dirty. if an object of the Group becomes dirty, and it is visible in any of its parent Layers, then mark those Layers as dirty.Layers
. Any non-dirtyLayers
created in the previous render loop are reused, unless configured otherwise.