From 2890c2a9ea38c4731b55916a685bc154825fbd6a Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Tue, 26 Nov 2013 10:21:20 +0100 Subject: [PATCH] Added beginning of Octree class. --- Code/GamePhysics/GamePhysics.vcxproj | 1 + Code/GamePhysics/Implementation/Octree.h | 57 ++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 Code/GamePhysics/Implementation/Octree.h diff --git a/Code/GamePhysics/GamePhysics.vcxproj b/Code/GamePhysics/GamePhysics.vcxproj index 03af535d..ddc37cf4 100644 --- a/Code/GamePhysics/GamePhysics.vcxproj +++ b/Code/GamePhysics/GamePhysics.vcxproj @@ -149,6 +149,7 @@ + diff --git a/Code/GamePhysics/Implementation/Octree.h b/Code/GamePhysics/Implementation/Octree.h new file mode 100644 index 00000000..22385dc6 --- /dev/null +++ b/Code/GamePhysics/Implementation/Octree.h @@ -0,0 +1,57 @@ +#ifndef OCTREE_H +#define OCTREE_H + +#include +#include +#include "Sphere.h" +#include "BoxAxisAligned.h" +#include "Utilities.h" +#include "../PhysicsAPI.h" + +namespace Oyster +{ + namespace Physics + { + class Octree + { + public: + struct Data + { + Data* prev; + Data* next; + + Collision3D::Sphere container; + + Utility::DynamicMemory::UniquePointer< ICustomBody > customBodyRef; + + unsigned int queueRef; + }; + + struct OctreeNode + { + + }; + + Octree(unsigned int bufferSize, unsigned char numLayers, Math::Float3 worldSize); + virtual ~Octree(); + + void AddObject(Utility::DynamicMemory::UniquePointer< ICustomBody > customBodyRef); + + void MoveToUpdateQueue(Utility::DynamicMemory::UniquePointer< ICustomBody > customBodyRef); + + void Update(); + + void DestroyObject(Utility::DynamicMemory::UniquePointer< ICustomBody > customBodyRef); + + void Sample(Collision3D::ICollideable& collideable); + private: + std::vector < Data > leafData; + + std::map< ICustomBody*, unsigned int > mapReferences; + + }; + } + +} + +#endif \ No newline at end of file