synfig-core
1.0.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
synfig
mesh.h
Go to the documentation of this file.
1
/* === S Y N F I G ========================================================= */
21
/* ========================================================================= */
22
23
/* === S T A R T =========================================================== */
24
25
#ifndef __SYNFIG_MESH_H
26
#define __SYNFIG_MESH_H
27
28
/* === H E A D E R S ======================================================= */
29
30
#include <vector>
31
#include "
vector.h
"
32
33
/* === M A C R O S ========================================================= */
34
35
/* === T Y P E D E F S ===================================================== */
36
37
/* === C L A S S E S & S T R U C T S ======================================= */
38
39
namespace
synfig {
40
41
class
Mesh
42
{
43
public
:
44
class
Vertex
{
45
public
:
46
Vector
position
;
47
Vector
tex_coords
;
48
inline
Vertex
() { }
49
inline
Vertex
(
const
Vector
&
position
,
const
Vector
&
tex_coords
):
50
position(position), tex_coords(tex_coords) { }
51
};
52
53
class
Triangle
{
54
public
:
55
int
vertices
[3];
56
inline
Triangle
() {
vertices
[0] =
vertices
[1] =
vertices
[2] = 0; }
57
inline
Triangle
(
int
v0,
int
v1,
int
v2) {
vertices
[0] = v0;
vertices
[1] = v1;
vertices
[2] = v2; }
58
};
59
60
typedef
std::vector<Vertex>
VertexList
;
61
typedef
std::vector<Triangle>
TriangleList
;
62
63
VertexList
vertices
;
64
TriangleList
triangles
;
65
66
void
clear
() {
vertices
.clear();
triangles
.clear(); }
67
bool
transform_coord_world_to_texture
(
const
Vector
&src,
Vector
&dest)
const
;
68
bool
transform_coord_texture_to_world
(
const
Vector
&src,
Vector
&dest)
const
;
69
70
static
bool
transform_coord_world_to_texture
(
71
const
Vector
&src,
72
Vector
&dest,
73
const
Vector
&p0,
74
const
Vector
&t0,
75
const
Vector
&p1,
76
const
Vector
&t1,
77
const
Vector
&p2,
78
const
Vector
&t2 );
79
80
inline
static
bool
transform_coord_texture_to_world
(
81
const
Vector
&src,
82
Vector
&dest,
83
const
Vector
&p0,
84
const
Vector
&t0,
85
const
Vector
&p1,
86
const
Vector
&t1,
87
const
Vector
&p2,
88
const
Vector
&t2 )
89
{
90
return
transform_coord_world_to_texture
(src, dest, t0, p0, t1, p1, t2, p2);
91
}
92
};
93
94
};
// END of namespace synfig
95
96
#endif
Generated on Mon Nov 16 2015 15:33:46 for synfig-core by
1.8.1.2