Octree scene integration
In order to benefit from the Octree, we must integrate it with the scene as an acceleration structure. The OctreeNode
structure and its helper functions should not be used outside of the Scene
class.
Getting ready
First, we are going to modify the Scene
class to hold an Octree. This means dealing with some dynamic memory, so we also need to add a destructor. The copy constructor and assignment operator will be disabled. If an acceleration structure is present, we should forward operations such as raycasting to the accelerator. Of course, the original code needs to stay in place as the acceleration structure is optional.
How to do it…
Follow these steps to integrate the octree into the scene:
- Modify the
Scene
class declared ...
Get Game Physics Cookbook 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.