True Axis Physics SDK 1.2.0.1 Beta Documentation
www.trueaxis.com

CollisionCOctree.h

00001 //---------------------------------------------------------------------------------
00002 // File Name: CollisionCOctree.h
00003 // Description: 
00004 //
00005 // Copyright (C) 2005 True Axis Pty Ltd, Australia. 
00006 // All Rights Reserved.
00007 //
00008 // History:
00009 //      Created File.
00010 //---------------------------------------------------------------------------------
00011 
00012 #if 0
00013 
00014 #ifndef TA_COLLISIONCOCTTREE_H
00015 #define TA_COLLISIONCOCTTREE_H
00016 
00017 #ifndef TA_POOL_H
00018 #include "../Common/Pool.h"
00019 #endif // TA_POOL_H
00020 
00021 #ifndef TA_AABB_H
00022 #include "../Common/AABB.h"
00023 #endif // TA_AABB_H
00024 
00025 #ifndef TA_SPACEDIVISION_H
00026 #include "SpaceDivision.h"
00027 #endif // TA_SPACEDIVISION_H
00028 
00029 namespace TA
00030 {
00031 
00032 struct AABB;
00033 
00034 class TAPHYSICS_CLASS CollisionCOctree : public SpaceDivision
00035 {
00036 public:
00037     struct Node
00038     {
00039         Node();
00040         u32 nPos[3];
00041         u32 nSplitValue;
00042 
00043         SpaceDivisionObject* pObjectList;
00044         Node* pParent;
00045         Node* pHi;
00046         Node* pLo;
00047     };
00048 
00049     CollisionCOctree();
00050     ~CollisionCOctree();
00051 
00052     void Initialise(
00053         const AABB& aabb);
00054     void Finalise();
00055 
00056     void Add(SpaceDivisionObject& object);
00057     void Remove(SpaceDivisionObject& object);
00058 
00059     void AddInternalNode(Node& node);
00060     void RemoveInternalNode(Node& node);
00061 
00062     void ForAllIntersections(
00063         const AABB& aabb,
00064         void (TAC_CALL *callBack)(SpaceDivisionObject& object, void* pData),
00065         void* pCallBackData);
00066     
00067     void ForAllIntersectionsWithLineSegment(
00068         const Vec3& v3Start,
00069         const Vec3& v3End,
00070         void (TAC_CALL *callBack)(SpaceDivisionObject& object, void* pData),
00071         void* pCallBackData);   
00072 
00073 private:
00074     struct FindRecursiveData
00075     {
00076         AABB aabb;
00077         int nX;
00078         int nY;
00079         int nZ;
00080         int nExtentX;
00081         int nExtentY;
00082         int nExtentZ;
00083         void (TAC_CALL *callBack)(SpaceDivisionObject& object, void* pData);
00084         void* pCallBackData;
00085     };
00086     struct FindForLineRecursiveData
00087     {
00088         CollisionCOctree* pThis;
00089         void (TAC_CALL *callBack)(SpaceDivisionObject& object, void* pData);
00090         void* pCallBackData;
00091     };  
00092 
00093     Node m_parent;
00094 
00095 };
00096 
00097 };
00098 
00099 #endif // TA_COLLISIONCOCTTREE_H
00100 
00101 #endif


© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.