void MScene::drawObjectsBehaviors(void) { unsigned int i; unsigned int oSize = getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = getObjectByIndex(i); if(! object->isActive()) continue; object->drawBehaviors(); } }
void MFixedRenderer::updateVisibility(MScene * scene, MOCamera * camera) { // make frustum camera->getFrustum()->makeVolume(camera); // compute object visibility unsigned int i; unsigned int oSize = scene->getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = scene->getObjectByIndex(i); if(object->isActive()) object->updateVisibility(camera); } }
void MScene::update(void) { // update objects unsigned int i; unsigned int oSize = getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = getObjectByIndex(i); if(object->isActive()) object->update(); } // update current frame m_currentFrame++; }
void MScene::updateObjectsMatrices(void) { unsigned int i; unsigned int oSize = getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = getObjectByIndex(i); if(! object->isActive()) continue; if(! object->hasParent()) { if(object->needToUpdate()) object->computeLocalMatrix(); object->computeChildsMatrices(); } } }
void MGame::update(void) { MEngine * engine = MEngine::getInstance(); // run script if(engine->getScriptContext()) engine->getScriptContext()->callFunction("onSceneUpdate"); // get level MLevel * level = MEngine::getInstance()->getLevel(); if(! level) return; // get current scene MScene * scene = level->getCurrentScene(); if(! scene) return; // update behaviors unsigned int i; unsigned int oSize = scene->getObjectsNumber(); for(i=0; i<oSize; i++) { MObject3d * object = scene->getObjectByIndex(i); if(! object->isActive()) continue; object->updateBehaviors(); } // update scene scene->update(); // update physics scene->updatePhysics(); // update objects matrices scene->updateObjectsMatrices(); // flush input engine->getInputContext()->flush(); }