~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/decimation/intern/LOD_ManMesh2.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * ***** BEGIN GPL LICENSE BLOCK *****
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software Foundation,
16
 
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
 
 *
18
 
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19
 
 * All rights reserved.
20
 
 *
21
 
 * The Original Code is: all of this file.
22
 
 *
23
 
 * Contributor(s): none yet.
24
 
 *
25
 
 * ***** END GPL LICENSE BLOCK *****
26
 
 */
27
 
 
28
 
/** \file decimation/intern/LOD_ManMesh2.h
29
 
 *  \ingroup decimation
30
 
 */
31
 
 
32
 
 
33
 
#ifndef __LOD_MANMESH2_H__
34
 
#define __LOD_MANMESH2_H__
35
 
 
36
 
#include "LOD_MeshPrimitives.h"
37
 
#include "MEM_SmartPtr.h"
38
 
#include <vector>
39
 
 
40
 
template <class HeapType> class CTR_UHeap;
41
 
 
42
 
class LOD_ExternBufferEditor;
43
 
 
44
 
class LOD_ManMesh2 // Manifold 2 dimensional mesh
45
 
{
46
 
 
47
 
public:
48
 
 
49
 
        static
50
 
                LOD_ManMesh2 *
51
 
        New(
52
 
        );
53
 
 
54
 
        // take ownership of the vertices.
55
 
 
56
 
                bool    
57
 
        SetVertices(
58
 
                MEM_SmartPtr<std::vector<LOD_Vertex> > verts
59
 
        );      
60
 
                
61
 
        // Add a triangle to the mesh
62
 
 
63
 
                void
64
 
        AddTriangle(
65
 
                int verts[3]
66
 
        );      
67
 
 
68
 
                void
69
 
        ConnectTriangle(
70
 
                LOD_FaceInd fi,
71
 
                std::vector<LOD_EdgeInd> & new_edges
72
 
        );
73
 
        
74
 
        // geometry access
75
 
        //////////////////
76
 
 
77
 
                std::vector<LOD_Vertex> &
78
 
        VertexSet(
79
 
        ) const;
80
 
 
81
 
                std::vector<LOD_TriFace> &
82
 
        FaceSet(
83
 
        ) const;
84
 
 
85
 
                std::vector<LOD_Edge> &
86
 
        EdgeSet(
87
 
        ) const;
88
 
 
89
 
        ~LOD_ManMesh2(
90
 
        );
91
 
 
92
 
        // local geometry queries
93
 
        /////////////////////////
94
 
 
95
 
        // face queries
96
 
        ///////////////
97
 
 
98
 
                void
99
 
        FaceVertices(
100
 
                LOD_FaceInd f,
101
 
                std::vector<LOD_VertexInd> &output
102
 
        );
103
 
        
104
 
                void
105
 
        FaceEdges(
106
 
                LOD_FaceInd f,
107
 
                std::vector<LOD_EdgeInd> &output
108
 
        );      
109
 
 
110
 
        // edge queries
111
 
        ///////////////
112
 
 
113
 
                void
114
 
        EdgeVertices(
115
 
                LOD_EdgeInd e,
116
 
                std::vector<LOD_VertexInd> &output
117
 
        );
118
 
 
119
 
                void
120
 
        EdgeFaces(
121
 
                LOD_EdgeInd e,
122
 
                std::vector<LOD_FaceInd> &output
123
 
        );
124
 
 
125
 
        // vertex queries
126
 
        /////////////////
127
 
 
128
 
                void
129
 
        VertexEdges(
130
 
                LOD_VertexInd v,
131
 
                std::vector<LOD_EdgeInd> &output
132
 
        );
133
 
        
134
 
                void
135
 
        VertexFaces(
136
 
                LOD_VertexInd v,
137
 
                std::vector<LOD_FaceInd> &output
138
 
        );
139
 
 
140
 
                void
141
 
        SetBBox(
142
 
                MT_Vector3 bbox_min,
143
 
                MT_Vector3 bbox_max
144
 
        );
145
 
 
146
 
                MT_Vector3
147
 
        BBoxMin(
148
 
        ) const {
149
 
                return m_bbox_min;
150
 
        };
151
 
 
152
 
                MT_Vector3
153
 
        BBoxMax(
154
 
        ) const {
155
 
                return m_bbox_max;
156
 
        };
157
 
 
158
 
        // Remove a primitive from the mesh
159
 
        ///////////////////////////////////
160
 
 
161
 
        // These methods assume you have correctly
162
 
        // tidied up the index pointers in other primitives,
163
 
        // so that nothing refers to this object any more
164
 
 
165
 
        // These methods exchange the primitive with the 
166
 
        // last primitive in the vector. It modifies everything 
167
 
        // pointing to the last primitive correctly.
168
 
 
169
 
        // FIXME refactor extern editor out of primitive deletion
170
 
        // insead return a vector of primitives that need to be
171
 
        // modified and do this externally
172
 
 
173
 
                void
174
 
        DeleteVertex(
175
 
                LOD_ExternBufferEditor & extern_editor,
176
 
                LOD_VertexInd v
177
 
        );
178
 
 
179
 
                void
180
 
        DeleteEdge(
181
 
                LOD_EdgeInd e,
182
 
                CTR_UHeap<LOD_Edge> *heap
183
 
        );
184
 
 
185
 
                void
186
 
        DeleteFace(
187
 
                LOD_ExternBufferEditor & extern_editor,
188
 
                LOD_FaceInd f
189
 
        );
190
 
 
191
 
        // Sanity Check routines
192
 
        ////////////////////////
193
 
 
194
 
        // Make sure the edge sets and the vertex sets are
195
 
        // consistent
196
 
 
197
 
                void
198
 
        SC_TriFace(
199
 
                LOD_FaceInd f
200
 
        );
201
 
 
202
 
        // basic sanity checking of an edge list bails out if there are more than 1024
203
 
        // edges
204
 
        
205
 
                void
206
 
        SC_EdgeList(
207
 
                LOD_EdgeInd e
208
 
        );
209
 
 
210
 
 
211
 
        // Check to see that the edges of v1 and v2 are unique.
212
 
 
213
 
                bool
214
 
        SC_UniqueEdge(
215
 
                LOD_EdgeInd e
216
 
        );
217
 
 
218
 
 
219
 
private :
220
 
 
221
 
 
222
 
        // Returns the edge index of the edge from v1 to v2. 
223
 
        // Does this by searching the edge sets of v1 - but not v2.
224
 
        // If you are paranoid you should check both and make sure the 
225
 
        // indices are the same. If the edge doe not exist edgeInd is empty.
226
 
 
227
 
                LOD_EdgeInd
228
 
        FindEdge(
229
 
                const LOD_VertexInd v1,
230
 
                const LOD_VertexInd v2
231
 
        );
232
 
 
233
 
        // Insert an edge into the mesh
234
 
        // Tie up the ptrs and create space for the edge
235
 
        // returns manifold errors - need to sort out memory edges
236
 
 
237
 
                bool
238
 
        InsertEdge(
239
 
                const LOD_VertexInd v1,
240
 
                const LOD_VertexInd v2,
241
 
                const LOD_FaceInd f,
242
 
                std::vector<LOD_EdgeInd> &new_edges
243
 
        );
244
 
 
245
 
 
246
 
private :
247
 
 
248
 
        LOD_ManMesh2(
249
 
        );
250
 
 
251
 
        MEM_SmartPtr< std::vector<LOD_Vertex> > m_verts;
252
 
        MEM_SmartPtr< std::vector<LOD_TriFace> > m_faces;
253
 
        MEM_SmartPtr< std::vector<LOD_Edge> > m_edges;
254
 
 
255
 
        // not sure of these descrtiptions of the mesh should
256
 
        // reside in this class coz may lead to very bloated interface.
257
 
 
258
 
        MT_Vector3 m_bbox_min;
259
 
        MT_Vector3 m_bbox_max;
260
 
 
261
 
 
262
 
};
263
 
 
264
 
#endif
265