~ubuntu-branches/ubuntu/saucy/blender/saucy-proposed

« back to all changes in this revision

Viewing changes to intern/decimation/intern/LOD_MeshPrimitives.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_MeshPrimitives.h
29
 
 *  \ingroup decimation
30
 
 */
31
 
 
32
 
 
33
 
#ifndef __LOD_MESHPRIMITIVES_H__
34
 
#define __LOD_MESHPRIMITIVES_H__
35
 
 
36
 
#include "MT_Vector3.h"
37
 
#include "CTR_TaggedIndex.h"
38
 
#include "CTR_UHeap.h"
39
 
#include <vector>
40
 
 
41
 
typedef CTR_TaggedIndex<24,0x00ffffff> LOD_VertexInd;
42
 
typedef CTR_TaggedIndex<24,0x00ffffff> LOD_EdgeInd;
43
 
typedef CTR_TaggedIndex<24,0x00ffffff> LOD_FaceInd;
44
 
typedef CTR_TaggedIndex<24,0x00ffffff> LOD_HeapInd;
45
 
 
46
 
class LOD_Vertex {
47
 
public :
48
 
        MT_Vector3 pos;
49
 
        std::vector<LOD_EdgeInd> m_edges;
50
 
        bool m_select_tag;
51
 
 
52
 
        LOD_Vertex(
53
 
        );
54
 
 
55
 
                bool
56
 
        RemoveEdge(
57
 
                LOD_EdgeInd e
58
 
        );      
59
 
 
60
 
                void
61
 
        AddEdge(
62
 
                LOD_EdgeInd e
63
 
        );
64
 
 
65
 
                void
66
 
        SwapEdge(
67
 
                LOD_EdgeInd e_old,
68
 
                LOD_EdgeInd e_new
69
 
        );
70
 
 
71
 
                bool
72
 
        SelectTag(
73
 
        ) const; 
74
 
 
75
 
                void
76
 
        SetSelectTag(
77
 
                bool tag        
78
 
        );
79
 
 
80
 
                bool
81
 
        Degenerate(
82
 
        );
83
 
 
84
 
                void
85
 
        CopyPosition(
86
 
                float *float_ptr
87
 
        );
88
 
 
89
 
private :
90
 
 
91
 
 
92
 
};
93
 
 
94
 
class LOD_Edge : public CTR_UHeapable  {
95
 
public :
96
 
        LOD_VertexInd   m_verts[2];
97
 
        LOD_FaceInd             m_faces[2];
98
 
 
99
 
        LOD_Edge (
100
 
        );
101
 
                        
102
 
        bool operator == (
103
 
                LOD_Edge & rhs
104
 
        );
105
 
 
106
 
        // Elementary helper methods
107
 
        ////////////////////////////
108
 
 
109
 
                LOD_FaceInd
110
 
        OpFace(
111
 
                LOD_FaceInd f
112
 
        ) const;
113
 
 
114
 
                void
115
 
        SwapFace(
116
 
                LOD_FaceInd old_f,
117
 
                LOD_FaceInd new_f
118
 
        );
119
 
 
120
 
 
121
 
        // return the half edge face - the half edge is defined
122
 
        // by the {vertex,edge} tuple. 
123
 
 
124
 
                LOD_FaceInd
125
 
        HalfEdgeFace(
126
 
                LOD_VertexInd vi
127
 
        );      
128
 
        
129
 
 
130
 
                LOD_VertexInd
131
 
        OpVertex(
132
 
                LOD_VertexInd vi
133
 
        );
134
 
 
135
 
        // replace the vertex v_old with vertex v_new
136
 
        // error if v_old is not one of the original vertices
137
 
 
138
 
                void
139
 
        SwapVertex(
140
 
                LOD_VertexInd v_old,
141
 
                LOD_VertexInd v_new
142
 
        );
143
 
 
144
 
                bool
145
 
        SelectTag(
146
 
        ) const;
147
 
 
148
 
                void
149
 
        SetSelectTag(
150
 
                bool tag
151
 
        );
152
 
        
153
 
                int
154
 
        OpenTag(
155
 
        ) const;
156
 
 
157
 
                void
158
 
        SetOpenTag(
159
 
                int tag
160
 
        );
161
 
 
162
 
                bool
163
 
        Degenerate(
164
 
        ) const;
165
 
 
166
 
                bool
167
 
        BoundaryEdge(
168
 
        ) const {
169
 
                return (m_faces[0].IsEmpty() || m_faces[1].IsEmpty());
170
 
        };
171
 
        
172
 
 
173
 
};
174
 
 
175
 
class LOD_TriFace {
176
 
public:
177
 
 
178
 
        LOD_VertexInd m_verts[3];
179
 
 
180
 
        LOD_TriFace(
181
 
        );
182
 
 
183
 
        // Elementary helper methods
184
 
        ////////////////////////////
185
 
 
186
 
                void
187
 
        SwapVertex(
188
 
                LOD_VertexInd old_v,
189
 
                LOD_VertexInd new_v
190
 
        );
191
 
 
192
 
                bool
193
 
        SelectTag(
194
 
        ) const;
195
 
 
196
 
                void
197
 
        SetSelectTag(
198
 
                bool tag
199
 
        );
200
 
 
201
 
                int
202
 
        OpenTag(
203
 
        );
204
 
                void
205
 
        SetOpenTag(
206
 
                int tag
207
 
        );
208
 
 
209
 
                bool
210
 
        Degenerate(
211
 
        );
212
 
 
213
 
                void
214
 
        CopyVerts(
215
 
                int * index_ptr
216
 
        );
217
 
 
218
 
};
219
 
        
220
 
#endif
221