K3dVorBsp.h

Go to the documentation of this file.
00001 
00013 /***************************************************************************
00014  *   Copyright (C) 2007 by Jan Koci   *
00015  *   honza.koci@email.cz   *
00016  *   http://kengine.sourceforge.net/tutorial/
00017  *                                                                         *
00018  *   This program is free software; you can redistribute it and/or modify  *
00019  *   it under the terms of the GNU General Public License as published by  *
00020  *   the Free Software Foundation; either version 2 of the License, or     *
00021  *   (at your option) any later version.                                   *
00022  *                                                                         *
00023  *   This program is distributed in the hope that it will be useful,       *
00024  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00025  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00026  *   GNU General Public License for more details.                          *
00027  *                                                                         *
00028  *   You should have received a copy of the GNU General Public License     *
00029  *   along with this program; if not, write to the                         *
00030  *   Free Software Foundation, Inc.,                                       *
00031  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00032  ***************************************************************************/
00033 
00034 #pragma once
00035 
00036 #include "../Geometry/K3dVorLeafObj.h"
00037 #include "../MathCore/K3dDistance.h"
00038 #include "../System/K3dDefines.h"
00039 #include "../Geometry/K3dPlaneObj.h"
00040 #include "../Geometry/K3dVertexObj.h"
00041 #include "../System/Builder/K3dPlaneBuild.h"
00042 
00043 
00045 enum EVorBspPlane
00046 {
00047         K_VOR_BSP_PLANE_X=0,
00048         K_VOR_BSP_PLANE_Y,
00049         K_VOR_BSP_PLANE_Z
00050 };
00051 
00053 enum EVorBspPlaneSide
00054 {
00055         K_VOR_BSP_PLANE_SIDE_FRONT=0,
00056         K_VOR_BSP_PLANE_SIDE_BACK,
00057 };
00058 
00059 class K3dVorBsp
00060 {
00061                 K3dGameData *m_pGameData;                       
00062                 TVertexArray m_vVertex; 
00063                 TVertexArray m_vFront; 
00064                 TVertexArray m_vBack; 
00065                 K3dPlaneObj *m_pBestDivPlane;   
00066                 K3dVector3Obj *m_pCentre;       
00067                 EVorBspPlane m_ePlane;  
00068                 EVorBspPlaneSide m_ePlaneSide;  
00069                 int m_iWeigh;   
00070                 K3dVector3Obj *m_pNearestVertex;        
00071 
00072                 void FindNearestVertex ( const EVorBspPlaneSide _ePlaneSide );
00073                 void MovePlane();
00074                 bool CheckWeight();
00075                 void CalcFrontBackVertices();
00076                 void CalcVertexArrayCentre();
00077                 void SetPlane();
00078                 void ChangePlaneNormal();
00079         public:
00080                 K3dVorBsp ( K3dGameData *_pGameData );
00081                 ~K3dVorBsp();
00082 
00083                 K3dPlaneObj *FindBestDividingPlane ( const TVertexArray &_rvVertex, const EVorBspPlane &_ePlane );
00084 };

Generated on Thu Aug 16 23:53:29 2007 for K3dEngine by  doxygen 1.5.0