4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
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.
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
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
/*****************************************
20
* face_python.h : wrapper for python
21
* Copyright (C) 2002 Bertrand 'blam' LAMY
22
*****************************************/
25
#define P3_face PyObject
26
#define P3_vertex PyObject
28
P3_face* P3_face_new (P3_world*, P3_material*, int nb_v, ...);
29
P3_material* P3_face_get_material (PyObject* face);
30
//int P3_face_get_option (PyObject* face);
31
P3_coordsys* P3_face_get_coordsys (PyObject* face);
32
void P3_face_get_box (PyObject* face, GLfloat* box, int* edited);
33
int P3_face_is_smoothlit (P3_face*);
34
int P3_face_is_double_sided (P3_face*);
35
int P3_face_is_solid (P3_face*);
36
int P3_face_is_alpha (P3_face*);
37
int P3_face_is_colored (P3_face*);
38
//int P3_face_is_static_lit (P3_face*);
39
int P3_face_can_be_lit (P3_face*);
40
//int P3_face_cell_shading (P3_face*);
41
int P3_face_get_vertices_number (P3_face*);
42
P3_vertex* P3_face_get_vertex (P3_face*, int index);
43
void P3_face_set_smoothlit (P3_face*, int);
44
void P3_face_set_double_sided (P3_face*, int);
45
void P3_face_set_solid (P3_face*, int);
46
void P3_face_set_can_be_lit (P3_face*, int);
47
//void P3_face_set_static_lit (P3_face*, int);
48
//void P3_face_set_cell_shading (P3_face*, int);
50
void P3_face_add_vertex (P3_face* face, P3_vertex* vertex);
53
#define P3_face_set_smoothlit(face, value) \
54
PyObject_SetAttrString (face, "smooth_lit", PyInt_FromLong (value))
55
#define P3_face_set_double_sided(face, value) \
56
PyObject_SetAttrString (face, "double_sided", PyInt_FromLong (value))
57
#define P3_face_set_solid(face, value) \
58
PyObject_SetAttrString (face, "solid", PyInt_FromLong (value))
59
#define P3_face_set_static_lit(face, value) \
60
PyObject_SetAttrString (face, "static_lit", PyInt_FromLong (value))
61
#define P3_face_set_can_be_lit(face, value) \
62
PyObject_SetAttrString (face, "lit", PyInt_FromLong (value))
65
P3_vertex* P3_vertex_new (P3_world*, GLfloat, GLfloat, GLfloat);
66
P3_coordsys* P3_vertex_get_coordsys (P3_vertex*);
67
void P3_vertex_get_coord (P3_vertex*, GLfloat*);
68
void P3_vertex_get_texcoord (P3_vertex*, GLfloat*);
69
void P3_vertex_get_diffuse (P3_vertex*, GLfloat*);
70
void P3_vertex_get_emissive (P3_vertex*, GLfloat*);
71
void P3_vertex_set_texcoord (P3_vertex*, GLfloat*);
72
void P3_vertex_set_diffuse (P3_vertex*, GLfloat*);
73
void P3_vertex_set_emissive (P3_vertex*, GLfloat*);
75
int P3_vertex_is_morphing (P3_vertex* v);
76
P3_material* P3_vertex_get_material (P3_vertex* v);
79
#define P3_vertex_set_texcoord(vertex, uv) \
80
PyObject_SetAttrString (vertex, "tex_x", PyFloat_FromDouble ((double) (uv)[0])); \
81
PyObject_SetAttrString (vertex, "tex_y", PyFloat_FromDouble ((double) (uv)[1]))
84
#define P3_vertex_set_material(vertex, value) \
85
PyObject_SetAttrString (vertex, "material", (PyObject*) value)
88
#define P3_vertex_get_r(vertex) \
89
(GLfloat) PyFloat_AS_DOUBLE (PyObject_GetAttrString (vertex, "r"))
90
#define P3_vertex_get_g(vertex) \
91
(GLfloat) PyFloat_AS_DOUBLE (PyObject_GetAttrString (vertex, "g"))
92
#define P3_vertex_get_b(vertex) \
93
(GLfloat) PyFloat_AS_DOUBLE (PyObject_GetAttrString (vertex, "b"))
94
#define P3_vertex_get_a(vertex) \
95
(GLfloat) PyFloat_AS_DOUBLE (PyObject_GetAttrString (vertex, "a"))
100
#define P3_vertex_get_x(vertex) \
101
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "coord"), 0))
102
#define P3_vertex_get_y(vertex) \
103
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "coord"), 1))
104
#define P3_vertex_get_z(vertex) \
105
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "coord"), 2))
106
#define P3_vertex_get_r(vertex) \
107
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "color"), 0))
108
#define P3_vertex_get_g(vertex) \
109
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "color"), 1))
110
#define P3_vertex_get_b(vertex) \
111
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "color"), 2))
112
#define P3_vertex_get_a(vertex) \
113
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "color"), 3))
114
#define P3_vertex_get_u(vertex) \
115
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "texcoord"), 0))
116
#define P3_vertex_get_v(vertex) \
117
(GLfloat) PyFloat_AS_DOUBLE (PySequence_Fast_GET_ITEM (PyObject_GetAttrString (face, "texcoord"), 1))