3 * ***** BEGIN GPL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20 * All rights reserved.
22 * The Original Code is: all of this file.
24 * Contributor(s): none yet.
26 * ***** END GPL LICENSE BLOCK *****
29 #ifndef NAN_INCLUDED_BSP_CSGMesh_h
30 #define NAN_INCLUDED_BSP_CSGMesh_h
32 #include "BSP_MeshPrimitives.h"
33 #include "MEM_SmartPtr.h"
34 #include "MEM_RefCountPtr.h"
35 #include "MEM_NonCopyable.h"
36 #include "../extern/CSG_BooleanOps.h"
42 public MEM_NonCopyable,
43 public MEM_RefCountable
55 std::vector<BSP_MVertex> *verts
64 // assumes that the face already has a plane equation
71 // Allocate and build the mesh edges.
72 ////////////////////////////////////
78 // Clean the mesh of edges. and edge pointers
79 // This removes the circular connectivity information
80 /////////////////////////////////////////////
86 // return a new separate copy of the
87 // mesh allocated on the heap.
94 // Reverse the winding order of every polygon
95 // in the mesh and swap the planes around.
105 std::vector<BSP_MVertex> &
109 std::vector<BSP_MFace> &
113 std::vector<BSP_MEdge> &
120 // local geometry queries.
121 /////////////////////////
128 const BSP_FaceInd & f,
129 std::vector<BSP_VertexInd> &output
134 const BSP_FaceInd & f,
135 std::vector<BSP_EdgeInd> &output
143 const BSP_EdgeInd & e,
144 std::vector<BSP_VertexInd> &output
149 const BSP_EdgeInd & e,
150 std::vector<BSP_FaceInd> &output
158 const BSP_VertexInd & v,
159 std::vector<BSP_EdgeInd> &output
164 const BSP_VertexInd & v,
165 std::vector<BSP_FaceInd> &output
168 // Returns the edge index of the edge from v1 to v2.
169 // Does this by searching the edge sets of v1 - but not v2.
170 // If you are paranoid you should check both and make sure the
171 // indices are the same. If the edge doe not exist edgeInd is empty.
175 const BSP_VertexInd &v1,
176 const BSP_VertexInd &v2
184 // make sure the edge faces have a pointer to f
192 * Return the face plane equation
197 const BSP_FaceInd &fi
202 * Recompute Face plane equations.
203 * essential if you have been messing with the object.
211 * Count the number of trinagles in the mesh.
212 * This is not the same as the number of polygons.
223 const BSP_VertexInd &v1,
224 const BSP_VertexInd &v2,
225 const BSP_FaceInd &f,
226 std::vector<BSP_EdgeInd> &new_edges
230 // Private to insure heap instantiation.
235 std::vector<BSP_MVertex> *m_verts;
236 std::vector<BSP_MFace> *m_faces;
237 std::vector<BSP_MEdge> *m_edges;
239 MT_Vector3 m_bbox_min;
240 MT_Vector3 m_bbox_max;