recp / gkern

🎥 Graphics Kernel: flexible, highly configurable, extensible render engine (realtime + offline)
GNU Lesser General Public License v3.0
98 stars 11 forks source link

SceneGraph: Node hierarchy re-design #7

Closed recp closed 6 years ago

recp commented 6 years ago

The current implementation of node hierarchy can be improved by making graph linear (I don't know if this is the right word)

Current impl:

Randomly allocated nodes:

    Scene
      |
     Node
    /   \
Node      Node
           \
           ....

Considered impl:

Array:

Scene  -  [ Node | Node | Node | ... ]

Currently I'm working on frustum culling; accessing nodes recursively for every operation or in every render frame is not what I want, also it is not effective because you need to switch to another function due to recursion... Maybe making this linear / array would also make exec faster because of cache locality and less memory consumption

recp commented 6 years ago

Now we have NodePage term. Each NodePage stores nodes as gk_nodesPerPage count, but this parameter may be dynamic to scene in the future

 NodePage 0                    ->    NodePage 1        -> ...

Node 0 | Node 1 ...              Node65 | Node 66