aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/mimesh/libg3d-0.0.8/include/g3d/face.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/mimesh/libg3d-0.0.8/include/g3d/face.h')
-rw-r--r--src/others/mimesh/libg3d-0.0.8/include/g3d/face.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/include/g3d/face.h b/src/others/mimesh/libg3d-0.0.8/include/g3d/face.h
new file mode 100644
index 0000000..b94b5cf
--- /dev/null
+++ b/src/others/mimesh/libg3d-0.0.8/include/g3d/face.h
@@ -0,0 +1,98 @@
1/* $Id$ */
2
3/*
4 libg3d - 3D object loading library
5
6 Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21*/
22
23#ifndef _G3D_FACE_H
24#define _G3D_FACE_H
25
26#include <g3d/types.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* ifdef __cplusplus */
31
32/**
33 * SECTION:face
34 * @short_description: Face manipulation
35 * @include: g3d/face.h
36 *
37 * A face is plane bordered by at least 3 vertices.
38 */
39
40
41/**
42 * g3d_face_free:
43 * @face: the face to free
44 *
45 * Frees all memory allocated for this face.
46 */
47EAPI
48void g3d_face_free(G3DFace *face);
49
50/**
51 * g3d_face_get_normal:
52 * @face: face to calculate normal of
53 * @object: object containing vertices of face
54 * @nx: x component of resulting normal
55 * @ny: y component of resulting normal
56 * @nz: z component of resulting normal
57 *
58 * calculates the normal of a face.
59 *
60 * Returns: TRUE on success, FALSE else
61 */
62EAPI
63gboolean g3d_face_get_normal(G3DFace *face, G3DObject *object,
64 G3DFloat *nx, G3DFloat *ny, G3DFloat *nz);
65
66/**
67 * g3d_face_new_tri:
68 * @material: material to use for face
69 * @i1: index of first vertex
70 * @i2: index of second vertex
71 * @i3: index of third vertex
72 *
73 * creates a new triangle face.
74 *
75 * Returns: a new face
76 */
77_G3D_STATIC_INLINE G3DFace *g3d_face_new_tri(G3DMaterial *material,
78 guint32 i1, guint32 i2, guint32 i3)
79{
80 G3DFace *face;
81
82 face = g_new0(G3DFace, 1);
83 face->material = material;
84 face->vertex_count = 3;
85 face->vertex_indices = g_new0(guint32, 3);
86 face->vertex_indices[0] = i1;
87 face->vertex_indices[1] = i2;
88 face->vertex_indices[2] = i3;
89
90 return face;
91}
92
93#ifdef __cplusplus
94}
95#endif /* ifdef __cplusplus */
96
97#endif /* _G3D_FACE_H */
98