Added beginning of Octree class.

This commit is contained in:
Robin Engman 2013-11-26 10:21:20 +01:00
parent 26e5fde8b0
commit 2890c2a9ea
2 changed files with 58 additions and 0 deletions

View File

@ -149,6 +149,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Implementation\Octree.h" />
<ClInclude Include="Implementation\PhysicsAPI_Impl.h" />
<ClInclude Include="Implementation\SimpleRigidBody.h" />
<ClInclude Include="PhysicsAPI.h" />

View File

@ -0,0 +1,57 @@
#ifndef OCTREE_H
#define OCTREE_H
#include <vector>
#include <map>
#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