D:/Zythum/DinoKod/Bsp/Bsp.h

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : Bsp.h
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 07/09/2002
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #ifndef __BSP_H__
00012 #define __BSP_H__
00013 
00014 #include "Bsp/BspDll.h"
00015 #include "Common/Vertex.h"
00016 #include "Bsp/BspLoader.h"
00017 
00018 class KBezierPatch;
00019 class KRenderFace;
00020 class KCollisionData;
00021 class KPhysicsCollisionData;
00022 
00023 #define BSP_COLL_RAY            0
00024 #define BSP_COLL_SPHERE         1
00025 
00026 //---------------------------------------------------------------------------------------------------------------------
00027 class BSP_API KBspCollisionData
00028 {
00029 public:
00030         KVector         m_Start;
00031         KVector         m_End;
00032         u8                      m_ObjectType;
00033         float           m_MoveOffset;
00034         float           m_Fraction;                     // How long has the trace move (0 no move, 1 complete move or not collision)
00035         KVector         m_EndPoint;                     // Where we collide if we did it? Return the Target if not collision occur
00036         KVector         m_CollisionNormal;      // Store the normal of the plane we collide with
00037         bool            m_StartOut;                     // True if the ray segment starts outside of a solid volume.
00038         bool            m_AllSolid;                     // True if the line segment is completely enclosed in a solid volume.
00039 };
00040 
00041 //---------------------------------------------------------------------------------------------------------------------
00042 class BSP_API KBspComputedFace : public KBspFace
00043 {
00044 public:
00045         u32                                                     m_FaceId;
00046         s64                                                     m_SortId;
00047 };
00048 
00049 //---------------------------------------------------------------------------------------------------------------------
00050 class BSP_API KBsp : public KBspLoader
00051 {
00052 protected:
00053         KBezierPatch*                           m_pBezierPatches;
00054 #if _DEBUG
00055         u32                                                     m_DebugCollFace;
00056 #endif _DEBUG
00057         s32                                                     m_TestLeaf;
00058 
00059         KLVertex2*                                      m_pComputedVertices;
00060 
00061         u32                                                     FindLeaf( u32 NodeId, KVector& Position );
00062 
00063         void                                            ComputeVertices();
00064         void                                            ComputeBezier();
00065 
00066         bool                                            CheckLeafSphereCollision( u32 NodeId, KPhysicsCollisionData* pData );
00067 
00068 public:
00069                                                                 KBsp();
00070         virtual                                         ~KBsp();
00071                                                                                                                                 
00072         virtual s32                                     LoadBSP( const char* pFileName );
00073         virtual s32                                     CloseBSP();
00074                                                                 
00075         void                                            CheckSphereCollision( u32 LeafId, KPhysicsCollisionData* pData );
00076 
00077         KBspCollisionData                       CheckRayMove( KVector& vStart, KVector& vEnd );
00078         KBspCollisionData                       CheckSphereMove( KVector& vStart, KVector& vEnd, float Radius );
00079         void                                            CheckMoveByNode( s32 NodeId, float StartFraction, float EndFraction, KVector& vStart, KVector vEnd, KBspCollisionData& CollisionData );
00080         void                                            CheckTouchBrush( KBspBrush* pBrush, KBspCollisionData& CollisionData );
00081 };
00082 
00083 #endif  __BSP_H__

Generated on Sun Mar 25 20:02:10 2007 for Zythum Project by  doxygen 1.5.1-p1