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/K3dPolyObj.h" 00037 #include "../MathCore/K3dIntersection.h" 00038 #include "../Geometry/K3dPolyPlane.h" 00039 #include "../System/Builder/K3dPolyBuild.h" 00040 #include "../System/Builder/K3dLineBuild.h" 00041 #include "../System/Builder/K3dPolyPlaneBuild.h" 00042 #include "../System/Worker/K3dVertexWork.h" 00043 #include "../System/Worker/K3dPlaneWork.h" 00044 #include "../System/Worker/K3dPolyWork.h" 00045 #include "../System/Worker/K3dLineWork.h" 00046 00047 class K3dConvex 00048 { 00049 K3dGameData *m_pGameData; 00050 TPolyPlaneArray m_vPolyPlane; 00051 TLineArray m_vEdge; 00052 TVertexArray m_vVertex; 00053 K3dPolyPlane *m_pPolyPlane; 00054 K3dPlaneObj *m_pEdgePlane; 00055 00056 bool CheckConvexPlane(); 00057 void CreateConvexPlane ( const K3dVector3Obj &_rkV0,const K3dVector3Obj &_rkV1,const K3dVector3Obj &_rkV2 ); 00058 void CheckEdge ( const K3dVector3Obj *_pV0,const K3dVector3Obj *_pV1 ); 00059 void CreateOnPlaneEdges(); 00060 void CreateEdgesFromVertexArray(); 00061 void CreateResultVertexArray(); 00062 00063 public: 00064 K3dConvex ( K3dGameData *_pGameData ); 00065 ~K3dConvex(); 00066 00067 void InitConvex(); 00068 K3dPolyObj *CreatePolyFromVertexArray ( const TVertexArray &_rvVertex ); 00069 00070 K3dPlaneObj *GetEdgePlane() 00071 { 00072 return m_pEdgePlane; 00073 } 00074 }; 00075 00076 00077