void update_node(struct X3D_Node *node) { int i; #ifdef VERBOSE printf ("update_node for %d %s nparents %d renderflags %x\n",node, stringNodeType(node->_nodeType),node->_nparents, node->_renderFlags); if (node->_nparents == 0) { if (node == rootNode) printf ("...no parents, this IS the rootNode\n"); else printf ("...no parents, this IS NOT the rootNode\n"); } for (i = 0; i < node->_nparents; i++) { struct X3D_Node *n = X3D_NODE(node->_parents[i]); if( n != 0 ) { printf (" parent %u is %s\n",n,stringNodeType(n->_nodeType)); } else { printf (" parent %d is NULL\n",i); } } #endif node->_change ++; /* parentVector here yet?? */ if (node->_parentVector == NULL) { return; } for (i = 0; i < vectorSize(node->_parentVector); i++) { struct X3D_Node *n = vector_get(struct X3D_Node *, node->_parentVector,i); if(n == node) { fprintf(stderr, "Error: self-referential node structure! (node:'%s')\n", stringNodeType(node->_nodeType)); vector_set(struct X3D_Node*, node->_parentVector, i,NULL); } else if( n != 0 ) {
void render_MovieTexture (struct X3D_MovieTexture *node) { #ifdef HAVE_TO_REIMPLEMENT_MOVIETEXTURES /* really simple, the texture number is calculated, then simply sent here. The boundTextureStack field is sent, and, made current */ /* if this is attached to a Sound node, tell it...*/ sound_from_audioclip = FALSE; loadTextureNode(X3D_NODE(node),NULL); gglobal()->RenderFuncs.boundTextureStack[gglobal()->RenderFuncs.textureStackTop] = node->__ctex; /* not multitexture, should have saved to boundTextureStack[0] */ #else /* HAVE_TO_REIMPLEMENT_MOVIETEXTURES */ loadTextureNode(X3D_NODE(node),NULL); #endif gglobal()->RenderFuncs.textureStackTop=1; }
static void loadInline(struct X3D_Inline *me) { resource_item_t *res = NULL; struct Multi_String *url = NULL; resource_item_t *parentPath = NULL; url = &(me->url); parentPath = me->_parentResource; /* printf ("loadInline, we have status of "); switch (me->__loadstatus) { case INLINE_INITIAL_STATE: printf ("INLINE_INITIAL_STATE\n"); break; case INLINE_FETCHING_RESOURCE: printf ("INLINE_FETCHING_RESOURCE\n"); break; case INLINE_PARSING: printf ("INLINE_PARSING\n"); break; case INLINE_STABLE: printf ("INLINE_STABLE\n"); break; }; printf ("url.n %d\n",url->n); printf ("url.p[0] %s\n",url->p[0]->strptr); */ // get the resource pointer from the Inline node. res = me->__loadResource; switch (me->__loadstatus) { case INLINE_INITIAL_STATE: { // starting up here. Is the URL empty? if (me->url.n == 0) { me->__loadstatus = INLINE_STABLE; } else { // create the resource; res = resource_create_multi(url); // save it...; me->__loadResource = res; // Setup parent resource_identify(parentPath, res); res->media_type = resm_image; /* quick hack */ // go to next one me->__loadstatus = INLINE_FETCHING_RESOURCE; } break; } case INLINE_FETCHING_RESOURCE: { bool rv; /* printf ("load_Inline, before resource_fetch, we have type %s status %s\n", resourceTypeToString(res->type), resourceStatusToString(res->status)); */ rv = resource_fetch(res); /* printf ("load_Inline, after resource_fetch, we have type %s status %s\n", resourceTypeToString(res->type), resourceStatusToString(res->status)); */ /* do we try the next url in the multi-url? */ if ((res->status == ress_failed) && (res->m_request != NULL)) { /* printf ("load_Inline, not found, lets try this again\n");*/ res->status = ress_invalid; res->type = rest_multi; /* did we get this one? */ } else if (res->status == ress_downloaded) { res->media_type = resm_unknown; res->whereToPlaceData = X3D_NODE(me); res->offsetFromWhereToPlaceData = (float) offsetof (struct X3D_Inline, __children); //printf ("going to send resource to parser async for res %p\n",res); if (send_resource_to_parser_if_available(res)) { me->__loadstatus = INLINE_PARSING; /* a "do-nothing" approach */ } else { //printf ("have to wait here for parser to finish\n"); } //printf ("done the send resource to parser async for res %p\n",res); } else { if ((res->status == ress_failed) || (res->status == ress_invalid)) { printf ("resource failed to load\n"); me->__loadstatus = INLINE_STABLE; /* a "do-nothing" approach */ } else { printf ("resource Inline in invalid state\n"); me->__loadstatus = INLINE_STABLE; /* a "do-nothing" approach */ } } break; }
void render_ImageTexture (struct X3D_ImageTexture *node) { /* printf ("render_ImageTexture, global Transparency %f\n",getAppearanceProperties()->transparency); */ loadTextureNode(X3D_NODE(node),NULL); gglobal()->RenderFuncs.textureStackTop=1; /* not multitexture - should have saved to boundTextureStack[0] */ }
void render_PixelTexture (struct X3D_PixelTexture *node) { loadTextureNode(X3D_NODE(node),NULL); gglobal()->RenderFuncs.textureStackTop=1; /* not multitexture - should have saved to boundTextureStack[0] */ }
node->__numPoints = 0; /* tell us that it has zero points */ tmpptr_b = node->__points.p; /* old set of points, for freeing later */ node->__points.p = tmpptr_a; /* new points */ node->__numPoints = tmpint; FREE_IF_NZ (tmpptr_b); /* switch completed */ } void render_Arc2D (struct X3D_Arc2D *node) { //OLDCODE DEFAULT_COLOUR_POINTER COMPILE_IF_REQUIRED if (node->__numPoints>0) { /* for BoundingBox calculations */ setExtent( node->EXTENT_MAX_X, node->EXTENT_MIN_X, node->EXTENT_MAX_Y, node->EXTENT_MIN_Y, 0.0f,0.0f,X3D_NODE(node)); //OLDCODE GET_COLOUR_POINTER LIGHTING_OFF DISABLE_CULL_FACE //OLDCODE DO_COLOUR_POINTER FW_GL_DISABLECLIENTSTATE (GL_NORMAL_ARRAY); FW_GL_VERTEX_POINTER (2,GL_FLOAT,0,(GLfloat *)node->__points.p); FW_GL_DRAWARRAYS (GL_LINE_STRIP, 0, node->__numPoints); FW_GL_ENABLECLIENTSTATE (GL_NORMAL_ARRAY); gglobal()->Mainloop.trisThisLoop += node->__numPoints; } } /***********************************************************************************/