00001 00012 /*************************************************************************** 00013 * Copyright (C) 2007 by Jan Koci * 00014 * honza.koci@email.cz * 00015 * http://kengine.sourceforge.net/tutorial/ 00016 * * 00017 * This program is free software; you can redistribute it and/or modify * 00018 * it under the terms of the GNU General Public License as published by * 00019 * the Free Software Foundation; either version 2 of the License, or * 00020 * (at your option) any later version. * 00021 * * 00022 * This program is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00025 * GNU General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU General Public License * 00028 * along with this program; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00031 ***************************************************************************/ 00032 00033 #pragma once 00034 00035 #include "../Geometry/K3dPolyObj.h" 00036 #include "../MathCore/K3dIntrLinePlane.h" 00037 #include "../System/Builder/K3dBoxBuild.h" 00038 #include "../Geometry/K3dPlaneObj.h" 00039 #include "../System/Builder/K3dObjectBuild.h" 00040 #include "../System/Worker/K3dBoxWork.h" 00041 #include "K3dCutEdge.h" 00042 00043 00044 00045 #define K3D_CUTPOLY_SIZE 50 00046 00047 class K3dCutPoly: 00048 public K3dCutEdge 00049 { 00050 K3dGameData *m_pGameData; 00051 K3dPlaneBuild *m_pPlaneBuild; 00052 K3dBoxWork *m_pBoxWork; 00053 K3dIntersection *m_pIntersection; 00054 K3dBoxBuild *m_pBoxBuild; 00055 K3dPoly *m_pPoly; 00056 K3dPlaneObj *m_pPlane; 00057 K3dPlaneObj *m_pEdgePlane; 00058 K3dPolyObj *m_pPolyFront; 00059 K3dPolyObj *m_pPolyBack; 00060 TVector3Array m_vVertex; 00061 TLineArray m_vEdge; 00062 bool m_bPlaneIntersectPoly; 00063 int m_iTestVertex; 00064 int m_iNumEdges; //< Number of new edges 00065 00066 bool CalcNewEdges(); 00067 void DeleteOpositePlane ( const bool _bIsFrontPoly ); 00068 void DeleteOpositeEdges ( const bool _bIsFrontPoly ); 00069 void AddNewPlane ( const bool _bIsFrontPoly ); 00070 public: 00071 K3dCutPoly ( K3dGameData *_pGameData ); 00072 ~K3dCutPoly(); 00073 00074 void InitCutPoly(); 00075 K3dPolyObj *Cut ( K3dPolyObj *_pPoly, K3dPlaneObj *_pPlane ); 00076 }; 00077 00078