Exemplo n.º 1
0
 SceneTree::SceneTree( dp::sg::core::SceneSharedPtr const & scene )
   : m_scene( scene )
   , m_rootNode( scene->getRootNode() )
   , m_dirty( false )
   , m_switchObserver( SwitchObserver::create() )
 {
 }
Exemplo n.º 2
0
      SceneTree::SceneTree( dp::sg::core::SceneSharedPtr const & scene )
        : m_scene( scene )
        , m_rootNode( scene->getRootNode() )
        , m_dirty( false )
        , m_switchObserver( SwitchObserver::create() )
      {
        m_objectObserver = ObjectObserver::create( this );
        m_geoNodeObserver = GeoNodeObserver::create( this );
        m_transformObserver = TransformObserver::create( this );
        m_sceneObserver = SceneObserver::create( this );

        // push an identity transform onto the transform tree so objects without transforms get the identity
        TransformTreeNode TransformTreeSentinel;
        setIdentity( TransformTreeSentinel.m_worldMatrix );
        setIdentity( TransformTreeSentinel.m_localMatrix );
        TransformTreeIndex transformTreeSentinel = m_transformTree.insertNode( TransformTreeSentinel, ~0, ~0 );

        ObjectTreeNode objectTreeSentinel;
        objectTreeSentinel.m_clipPlaneGroup = ClipPlaneGroup::create();
        m_objectTreeSentinel = m_objectTree.insertNode( objectTreeSentinel, ~0, ~0 );

        m_objectTree[m_objectTreeSentinel].m_transformIndex = transformTreeSentinel;
        m_transformTree[transformTreeSentinel].m_objectTreeIndex = m_objectTreeSentinel;

        SceneTreeGenerator rlg( this );
        rlg.setCurrentTransformTreeData( transformTreeSentinel, ~0 );
        rlg.setCurrentObjectTreeData( m_objectTreeSentinel, ~0 );
        rlg.apply( scene );

        // root node is first child below sentinel
        m_objectTreeRootNode = m_objectTree[m_objectTreeSentinel].m_firstChild;
      }