void processParticle(XSParticle *xsParticle) { if (!xsParticle) { XERCES_STD_QUALIFIER cout << "xsParticle is NULL"; return; } XSParticle::TERM_TYPE termType = xsParticle->getTermType(); if (termType == XSParticle::TERM_ELEMENT) { XSElementDeclaration *xsElement = xsParticle->getElementTerm(); XERCES_STD_QUALIFIER cout << StrX(xsElement->getName()); } else if (termType == XSParticle::TERM_MODELGROUP) { XERCES_STD_QUALIFIER cout << "("; XSModelGroup *xsModelGroup = xsParticle->getModelGroupTerm(); XSModelGroup::COMPOSITOR_TYPE compositorType = xsModelGroup->getCompositor(); XSParticleList *xsParticleList = xsModelGroup->getParticles(); for (unsigned i = 0; i < xsParticleList->size()-1; i++) { processParticle(xsParticleList->elementAt(i)); printCompositorTypeConnector(compositorType); } processParticle(xsParticleList->elementAt(xsParticleList->size()-1)); XERCES_STD_QUALIFIER cout << ")"; } else if (termType == XSParticle::TERM_WILDCARD) { XERCES_STD_QUALIFIER cout << "* (wildcard)"; } }
void PUParticleSystem3D::updator( float elapsedTime ) { bool firstActiveParticle = true; bool firstParticle = true; processParticle(_particlePool, firstActiveParticle, firstParticle, elapsedTime); for (auto &iter : _emittedEmitterParticlePool){ processParticle(iter.second, firstActiveParticle, firstParticle, elapsedTime); } for (auto &iter : _emittedSystemParticlePool){ processParticle(iter.second, firstActiveParticle, firstParticle, elapsedTime); } }
/* Move the particles */ void atmosUpdateSystem( void ) { UDWORD i; UDWORD numberToAdd; Vector3i pos; // we don't want to do any of this while paused. if(!gamePaused() && weather!=WT_NONE) { for(i = 0; i < MAX_ATMOS_PARTICLES; i++) { /* See if it's active */ if(asAtmosParts[i].status == APS_ACTIVE) { processParticle(&asAtmosParts[i]); } } /* This bit below needs to go into a "precipitation function" */ numberToAdd = ((weather==WT_SNOWING) ? 2 : 4); /* Temporary stuff - just adds a few particles! */ for(i=0; i<numberToAdd; i++) { pos.x = player.p.x + ((visibleTiles.x/2)*TILE_UNITS); pos.z = player.p.z + ((visibleTiles.y/2)*TILE_UNITS); pos.x += (((visibleTiles.x/2) - rand()%visibleTiles.x) * TILE_UNITS); pos.z += (((visibleTiles.x/2) - rand()%visibleTiles.x) * TILE_UNITS); pos.y = 1000; /* If we've got one on the grid */ if(pos.x>0 && pos.z>0 && pos.x<(SDWORD)((mapWidth-1)*TILE_UNITS) && pos.z<(SDWORD)((mapHeight-1)*TILE_UNITS) ) { /* On grid, so which particle shall we add? */ switch(weather) { case WT_SNOWING: atmosAddParticle(&pos,AP_SNOW); break; case WT_RAINING: atmosAddParticle(&pos,AP_RAIN); break; case WT_NONE: break; default: break; } } } } }
void processComplexTypeDefinition(XSComplexTypeDefinition *xsComplexTypeDef) { XSTypeDefinition *xsBaseTypeDef = xsComplexTypeDef->getBaseType(); if (xsBaseTypeDef) { XERCES_STD_QUALIFIER cout << "Base:\t\t\t"; XERCES_STD_QUALIFIER cout << StrX(xsBaseTypeDef->getName()) << "\n"; } XERCES_STD_QUALIFIER cout << "Content Model:\t"; XSComplexTypeDefinition::CONTENT_TYPE contentType = xsComplexTypeDef->getContentType(); if (contentType == XSComplexTypeDefinition::CONTENTTYPE_ELEMENT || contentType == XSComplexTypeDefinition::CONTENTTYPE_MIXED) { processParticle(xsComplexTypeDef->getParticle()); XERCES_STD_QUALIFIER cout << XERCES_STD_QUALIFIER endl; } }