Esempio n. 1
0
void SceneManager::update(double t, double dt)
{
    this->t = t;
    this->dt = dt;

    if (root != NULL) {
        root->updateLocalToWorld(NULL);
        mat4d cameraToScreen = getCameraToScreen();
        worldToScreen = cameraToScreen * getCameraNode()->getWorldToLocal();
        root->updateLocalToCamera(getCameraNode()->getWorldToLocal(), cameraToScreen);
        getFrustumPlanes(worldToScreen, worldFrustumPlanes);
        computeVisibility(root, PARTIALLY_VISIBLE);
    }
}
SceneNode* SceneManager::getSceneNode(const string& name) {
    // Early termination for camera node.
    SceneNode* node = getCameraNode(name);
    if (node) {
        return node;
    }

    SceneNodeIterator iter(getRootSceneNode());
    while(iter.hasNext()) {
        SceneNode& node = *iter;
        const string& nodeName = node.getName();
        const NodeID& nodeID = node.getID();
        if (nodeName == node.createName(nodeID, name)) {
            return iter.current();
        }
        iter.advance();
    }
    return NULL;
}