#include <K3dVorBsp.h>
Public Member Functions | |
K3dVorBsp (K3dGameData *_pGameData) | |
~K3dVorBsp () | |
K3dPlaneObj * | FindBestDividingPlane (const TVertexArray &_rvVertex, const EVorBspPlane &_ePlane) |
Find best BSP dividing plane. Best plane is such plane, which it has same number of vertices on both plane sides. | |
Private Member Functions | |
void | FindNearestVertex (const EVorBspPlaneSide _ePlaneSide) |
Find nearest vertex on front side. | |
void | MovePlane () |
If wrong weight, move plane to the better position. | |
bool | CheckWeight () |
Check weigh between front and back vertices. | |
void | CalcFrontBackVertices () |
Calculate number of vertices on front and back plane size. | |
void | CalcVertexArrayCentre () |
Calculate centre of vertex array. | |
void | SetPlane () |
Set plane position and normal vector. | |
void | ChangePlaneNormal () |
Change plane normal. | |
Private Attributes | |
K3dGameData * | m_pGameData |
Global game data, data centered game system. | |
TVertexArray | m_vVertex |
Input output vertex array. | |
TVertexArray | m_vFront |
Vertex array on front side of the plane. | |
TVertexArray | m_vBack |
Vertex array on back side of the plane. | |
K3dPlaneObj * | m_pBestDivPlane |
Best dividing plane. | |
K3dVector3Obj * | m_pCentre |
Vertex array centre. | |
EVorBspPlane | m_ePlane |
Enumerator for describing voronoi bsp dividing plane. | |
EVorBspPlaneSide | m_ePlaneSide |
Enumerator for describing plane front side or back side. | |
int | m_iWeigh |
Weigh between front and back vertices. | |
K3dVector3Obj * | m_pNearestVertex |
Nearest vertex to the plane. |
Definition at line 59 of file K3dVorBsp.h.
K3dVorBsp::K3dVorBsp | ( | K3dGameData * | _pGameData | ) |
Definition at line 36 of file K3dVorBsp.cpp.
References K3dGameData::GetVector3SP(), m_iWeigh, m_pBestDivPlane, m_pCentre, m_pGameData, and K3dSafePointer< _T >::New().
K3dVorBsp::~K3dVorBsp | ( | ) |
Definition at line 44 of file K3dVorBsp.cpp.
References K3dSafePointer< _T >::Delete(), K3dGameData::GetVector3SP(), m_pCentre, and m_pGameData.
void K3dVorBsp::FindNearestVertex | ( | const EVorBspPlaneSide | _ePlaneSide | ) | [private] |
Find nearest vertex on front side.
Definition at line 51 of file K3dVorBsp.cpp.
References K3dSceneData::GetIntersection(), K_MAX_SCENE_LENGTH, K_VOR_BSP_PLANE_SIDE_BACK, K_VOR_BSP_PLANE_SIDE_FRONT, m_pBestDivPlane, m_pGameData, m_pNearestVertex, m_vBack, m_vFront, and K3dDistance::PointPlane().
Referenced by MovePlane().
void K3dVorBsp::MovePlane | ( | ) | [private] |
If wrong weight, move plane to the better position.
Definition at line 111 of file K3dVorBsp.cpp.
References K3dPlaneWork::CalcDistance(), FindNearestVertex(), K3dSceneData::GetPlaneWork(), K_VOR_BSP_PLANE_SIDE_BACK, K_VOR_BSP_PLANE_SIDE_FRONT, m_iWeigh, m_pBestDivPlane, m_pGameData, m_pNearestVertex, m_vBack, m_vFront, and K3dPlane::SetPosition().
Referenced by FindBestDividingPlane().
bool K3dVorBsp::CheckWeight | ( | ) | [private] |
Check weigh between front and back vertices.
Definition at line 142 of file K3dVorBsp.cpp.
References m_iWeigh, m_vBack, m_vFront, and K3dMath::Positive().
Referenced by FindBestDividingPlane().
void K3dVorBsp::CalcFrontBackVertices | ( | ) | [private] |
Calculate number of vertices on front and back plane size.
Definition at line 159 of file K3dVorBsp.cpp.
References K3dSceneData::GetIntersection(), m_pBestDivPlane, m_pGameData, m_vBack, m_vFront, m_vVertex, and K3dDistance::PointPlane().
Referenced by FindBestDividingPlane().
void K3dVorBsp::CalcVertexArrayCentre | ( | ) | [private] |
Calculate centre of vertex array.
Definition at line 184 of file K3dVorBsp.cpp.
References m_pCentre, m_vVertex, and K3dVector3::Reset().
Referenced by FindBestDividingPlane().
void K3dVorBsp::SetPlane | ( | ) | [private] |
Set plane position and normal vector.
Definition at line 203 of file K3dVorBsp.cpp.
References K3dPlane::GetNormal(), K3dSceneData::GetPlaneWork(), K3dPlane::GetPosition(), K3dPlaneWork::Init(), K_VOR_BSP_PLANE_X, K_VOR_BSP_PLANE_Y, K_VOR_BSP_PLANE_Z, m_ePlane, m_pBestDivPlane, m_pCentre, m_pGameData, and K3dVector3::Set().
Referenced by ChangePlaneNormal(), and FindBestDividingPlane().
void K3dVorBsp::ChangePlaneNormal | ( | ) | [private] |
Change plane normal.
Definition at line 229 of file K3dVorBsp.cpp.
References K_VOR_BSP_PLANE_X, K_VOR_BSP_PLANE_Y, K_VOR_BSP_PLANE_Z, m_ePlane, and SetPlane().
Referenced by FindBestDividingPlane().
K3dPlaneObj * K3dVorBsp::FindBestDividingPlane | ( | const TVertexArray & | _rvVertex, | |
const EVorBspPlane & | _ePlane | |||
) |
Find best BSP dividing plane. Best plane is such plane, which it has same number of vertices on both plane sides.
Definition at line 254 of file K3dVorBsp.cpp.
References CalcFrontBackVertices(), CalcVertexArrayCentre(), ChangePlaneNormal(), CheckWeight(), K3dPlaneBuild::CreateNewPlaneObj(), K3dSceneData::GetPlaneBuild(), m_ePlane, m_pBestDivPlane, m_pGameData, m_vBack, m_vFront, m_vVertex, MovePlane(), and SetPlane().
K3dGameData* K3dVorBsp::m_pGameData [private] |
Global game data, data centered game system.
Definition at line 61 of file K3dVorBsp.h.
Referenced by CalcFrontBackVertices(), FindBestDividingPlane(), FindNearestVertex(), K3dVorBsp(), MovePlane(), SetPlane(), and ~K3dVorBsp().
TVertexArray K3dVorBsp::m_vVertex [private] |
Input output vertex array.
Definition at line 62 of file K3dVorBsp.h.
Referenced by CalcFrontBackVertices(), CalcVertexArrayCentre(), and FindBestDividingPlane().
TVertexArray K3dVorBsp::m_vFront [private] |
Vertex array on front side of the plane.
Definition at line 63 of file K3dVorBsp.h.
Referenced by CalcFrontBackVertices(), CheckWeight(), FindBestDividingPlane(), FindNearestVertex(), and MovePlane().
TVertexArray K3dVorBsp::m_vBack [private] |
Vertex array on back side of the plane.
Definition at line 64 of file K3dVorBsp.h.
Referenced by CalcFrontBackVertices(), CheckWeight(), FindBestDividingPlane(), FindNearestVertex(), and MovePlane().
K3dPlaneObj* K3dVorBsp::m_pBestDivPlane [private] |
Best dividing plane.
Definition at line 65 of file K3dVorBsp.h.
Referenced by CalcFrontBackVertices(), FindBestDividingPlane(), FindNearestVertex(), K3dVorBsp(), MovePlane(), and SetPlane().
K3dVector3Obj* K3dVorBsp::m_pCentre [private] |
Vertex array centre.
Definition at line 66 of file K3dVorBsp.h.
Referenced by CalcVertexArrayCentre(), K3dVorBsp(), SetPlane(), and ~K3dVorBsp().
EVorBspPlane K3dVorBsp::m_ePlane [private] |
Enumerator for describing voronoi bsp dividing plane.
Definition at line 67 of file K3dVorBsp.h.
Referenced by ChangePlaneNormal(), FindBestDividingPlane(), and SetPlane().
EVorBspPlaneSide K3dVorBsp::m_ePlaneSide [private] |
int K3dVorBsp::m_iWeigh [private] |
Weigh between front and back vertices.
Definition at line 69 of file K3dVorBsp.h.
Referenced by CheckWeight(), K3dVorBsp(), and MovePlane().
K3dVector3Obj* K3dVorBsp::m_pNearestVertex [private] |
Nearest vertex to the plane.
Definition at line 70 of file K3dVorBsp.h.
Referenced by FindNearestVertex(), and MovePlane().