General Concept of a Scene Graph
What is a Scene Graph
cgSceneGraph is a scene graph developed in Javascript.
Hence, like a tree, it maintains a hierarchy of "nodes".
In cgSceneGraph, a node is named "CGSGNode" (the name of each
class of the framework begins
with "CGSG").
A node is an item (visual or not) in the graph and encapsulates its own properties (SRT
transformation, isDraggable, isResizable, isVisible, children, ...).
The CGSGNode does not render anything (its "render" method is empty). To render something,
you have to use a class that inherit from CGSGNode.
It's very easy to create your own node by extending CGSGNode and the framework already
provides some extensions:
- Image (CGSGNodeImage)
- Animated Sprite (CGSGNodeSprite)
- Text (CGSGNodeText)
- WebView (CGSGNodeWebview)
- Square (CGSGNodeSquare)
- Circle (CGSGNodeCircle)
- Ellipse (CGSGNodeEllipse)
- Button (CGSGNodeButton)
- ...
Inheritance in a Scene Graph
So, each node encapsulates its own properties but some will inherit from its parent.
Example with the scale attribute:
Here is an example with 2 nodes : a cloud having a tree as child node.

In the same way, the scale, rotation, translation and "isVisible" attributes will
be impacted by the ones of their hierarchy.
However, every other properties (globalAlpha, isDraggable, isResizable, ...) will override
the ones defined in the parent hierarchy.
