35 #include <libFreeWRL.h>
37 #include "../vrml_parser/Structs.h"
38 #include "../vrml_parser/CRoutes.h"
39 #include "../main/headers.h"
40 #include "../opengl/Frustum.h"
41 #include "../opengl/Material.h"
42 #include "../opengl/OpenGL_Utils.h"
43 #include "Component_Shape.h"
44 #include "../scenegraph/RenderFuncs.h"
45 #include "../scenegraph/Polyrep.h"
56 if (node->shape != NULL) render_node(node->shape);
78 RETURN_FROM_CHILD_IF_NOT_FOR_ME
82 prep_sibAffectors((
struct X3D_Node*)node,&node->__sibAffectors);
84 normalChildren(node->_sortedChildren);
87 prep_sibAffectors((
struct X3D_Node*)node,&node->__sibAffectors);
92 REINITIALIZE_SORTED_NODES_FIELD(node->children,node->_sortedChildren);
116 for (i=0; i<node->children.n; i++) {
117 if (i >= node->visible.n) render_node(node->children.p[i]);
118 else if (node->visible.p[i]) render_node(node->children.p[i]);
140 if(!renderstate()->render_vp) {
142 if (node->__do_anything) {
147 if (node->__do_trans)
148 FW_GL_TRANSLATE_F(node->translation.c[0],node->translation.c[1],node->translation.c[2]);
151 if (node->__do_center)
152 FW_GL_TRANSLATE_F(node->center.c[0],node->center.c[1],node->center.c[2]);
156 if (node->__do_rotation) {
157 FW_GL_ROTATE_RADIANS(node->rotation.c[3], node->rotation.c[0],node->rotation.c[1],node->rotation.c[2]);
161 if (node->__do_scaleO) {
162 FW_GL_ROTATE_RADIANS(node->scaleOrientation.c[3], node->scaleOrientation.c[0], node->scaleOrientation.c[1],node->scaleOrientation.c[2]);
166 if (node->__do_scale)
167 FW_GL_SCALE_F(node->scale.c[0],node->scale.c[1],node->scale.c[2]);
170 if (node->__do_scaleO)
171 FW_GL_ROTATE_RADIANS(-node->scaleOrientation.c[3], node->scaleOrientation.c[0], node->scaleOrientation.c[1],node->scaleOrientation.c[2]);
174 if (node->__do_center)
175 FW_GL_TRANSLATE_F(-node->center.c[0],-node->center.c[1],-node->center.c[2]);
189 RETURN_FROM_CHILD_IF_NOT_FOR_ME
196 prep_sibAffectors((
struct X3D_Node*)node,&node->__sibAffectors);
204 printf (
"transform - doing normalChildren\n");
207 normalChildren(node->_sortedChildren);
210 printf (
"transform - done normalChildren\n");
214 prep_sibAffectors((
struct X3D_Node*)node,&node->__sibAffectors);
221 node->__do_center = verify_translate ((GLfloat *)node->center.c);
222 node->__do_trans = verify_translate ((GLfloat *)node->translation.c);
223 node->__do_scale = verify_scale ((GLfloat *)node->scale.c);
224 node->__do_rotation = verify_rotate ((GLfloat *)node->rotation.c);
225 node->__do_scaleO = verify_rotate ((GLfloat *)node->scaleOrientation.c);
227 node->__do_anything = (node->__do_center ||
230 node->__do_rotation ||
233 REINITIALIZE_SORTED_NODES_FIELD(node->children,node->_sortedChildren);
240 if(!renderstate()->render_vp) {
241 if (node->__do_anything) {
246 if((node->_renderFlags & VF_Viewpoint) == VF_Viewpoint) {
247 FW_GL_TRANSLATE_F(((node->center).c[0]),((node->center).c[1]),((node->center).c[2])
249 FW_GL_ROTATE_RADIANS(((node->scaleOrientation).c[3]),((node->scaleOrientation).c[0]),((node->scaleOrientation).c[1]),((node->scaleOrientation).c[2])
251 FW_GL_SCALE_F((
float)1.0/(((node->scale).c[0])),(
float)1.0/(((node->scale).c[1])),(
float)1.0/(((node->scale).c[2]))
253 FW_GL_ROTATE_RADIANS(-(((node->scaleOrientation).c[3])),((node->scaleOrientation).c[0]),((node->scaleOrientation).c[1]),((node->scaleOrientation).c[2])
255 FW_GL_ROTATE_RADIANS(-(((node->rotation).c[3])),((node->rotation).c[0]),((node->rotation).c[1]),((node->rotation).c[2])
257 FW_GL_TRANSLATE_F(-(((node->center).c[0])),-(((node->center).c[1])),-(((node->center).c[2]))
259 FW_GL_TRANSLATE_F(-(((node->translation).c[0])),-(((node->translation).c[1])),-(((node->translation).c[2]))
275 COMPILE_POLY_IF_REQUIRED( node->coord, node->fogCoord, node->color, node->normal, node->texCoord)
276 CULL_FACE(node->solid)
277 render_polyrep(node);
288 COMPILE_POLY_IF_REQUIRED(node->coord, node->fogCoord, node->color, node->normal, node->texCoord)
289 CULL_FACE(node->solid)
290 render_polyrep(node);