Changeset 1190


Ignore:
Timestamp:
08/09/06 13:41:12 (18 years ago)
Author:
szydlowski
Message:

refined visualization a little
discovered camera node SNAFU, hack to fix it, solution required

Location:
GTP/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp

    r1187 r1190  
    495495 
    496496        mSceneMgr->setOption("PrepareVisualization", &showViz); 
    497         mSceneMgr->setOption("SkyBoxEnabled", &nShowViz); 
    498         //mSceneMgr->setOption("SkyPlaneEnabled", &showViz); 
     497        SceneNode * skybox = mSceneMgr->getSkyBoxNode(); 
     498        if (skybox != 0) 
     499                mSceneMgr->setOption("SkyBoxEnabled", &nShowViz); 
     500        //if ((SceneNode * skyplane = mSceneMgr->getSkyPlaneNode()) != 0) 
     501        //      mSceneMgr->setOption("SkyPlaneEnabled", &showViz); 
    499502 
    500503        RenderTargetListener::preViewportUpdate(evt); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h

    r1187 r1190  
    232232                                        if (mLevel == level) 
    233233                                        { 
    234                                                 //mWBB->setMaterial("BaseGreenNoLighting"); 
    235                                                 mWBB->setMaterial("aabbHiLite"); 
     234                                                mWBB->setMaterial("KdTree/BoxHiLite"); 
    236235                                                return mWBB; 
    237236                                        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp

    r1187 r1190  
    311311        mShowNodeAABB(true) 
    312312        { 
    313 #ifdef KDTREE_DEBUG 
    314                 MaterialPtr mp = MaterialManager::getSingleton().getByName("aabbHiLite"); 
    315                 if (mp.isNull()) 
    316                 { 
    317                         ColourValue cv(0.0, 1.0, 0.0); 
    318                         MaterialPtr mp = MaterialManager::getSingleton().create("aabbHiLite","General"); 
    319                         mp->setSelfIllumination(cv); 
    320                         mp->setDiffuse(cv); 
    321                 } 
    322 #endif 
     313                MaterialPtr mphi = MaterialManager::getSingleton().getByName("KdTree/BoxHiLite"); 
     314                if (mphi.isNull()) 
     315                { 
     316                        ColourValue green(0, 1, 0); 
     317                        mphi = MaterialManager::getSingleton().create("KdTree/BoxHiLite", "General"); 
     318                        mphi->setAmbient(green); 
     319                        mphi->setDiffuse(green); 
     320                        mphi->setSelfIllumination(ColourValue::Black); 
     321                        mphi->setLightingEnabled(true); 
     322                        mphi->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
     323                } 
     324 
     325                MaterialPtr mpviz = MaterialManager::getSingleton().getByName("KdTree/BoxViz"); 
     326                if (mpviz.isNull()) 
     327                { 
     328                        ColourValue yellow(1, 1, 0); 
     329                        mpviz = MaterialManager::getSingleton().create("KdTree/BoxViz", "General"); 
     330                        mpviz->setAmbient(yellow); 
     331                        mpviz->setDiffuse(yellow); 
     332                        mpviz->setSelfIllumination(ColourValue::Black); 
     333                        mpviz->setLightingEnabled(true); 
     334                        mpviz->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
     335                } 
     336 
    323337                try 
    324338                { 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1187 r1190  
    590590        } 
    591591 
    592         mVisibleNodes.clear(); 
     592        mVisibleNodes.clear();   
    593593} 
    594594 
     
    951951                // ignore 
    952952        } 
    953         // add bounding boxes of rendered objects 
    954         //if (0) 
    955                 //for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
    956                 //{ 
    957                 //      getRenderQueue()->addRenderable(*it); 
    958                 //} 
    959953 
    960954        if (mRenderNodesForViz || mRenderNodesContentForViz) 
    961955        { 
    962956                // HACK: change node material so it is better suited for visualization 
    963                 MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 
    964                 nodeMat->setAmbient(1, 1, 0); 
    965                 nodeMat->setLightingEnabled(true); 
    966                 nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates(); 
     957                //MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 
    967958 
    968959                for (KdTree::NodeList::iterator it = mVisibleNodes.begin(); it != mVisibleNodes.end(); ++it) 
     
    970961                        if (mRenderNodesForViz) 
    971962                        { 
    972                                 //KdTreeSceneNode * node = static_cast<KdTreeSceneNode *>(*it); 
    973                                 //// render the leaf nodes 
    974                                 //if (node->numAttachedObjects() &&  
    975                                 //      !node->numChildren() &&  
    976                                 //      (node->getAttachedObject(0)->getMovableType() == "Entity") && 
    977                                 //      node->getAttachedObject(0)->isVisible()) 
    978                                 //{ 
    979                                 //      //getRenderQueue()->addRenderable(node); 
    980                                 //      node->_addBoundingBoxToQueue(getRenderQueue()); 
    981                                 //} 
    982  
    983                                 /*** TODO: fix this ... maybe revert to original state, not quite happy now! ***/ 
    984  
    985                                 // addbounding boxes instead of node itself 
    986                                 //(*it)->_addBoundingBoxToQueue(getRenderQueue()); 
     963                                WireBoundingBox * wirebox = (*it)->getWireBoundingBox(); 
     964                                if (wirebox) 
     965                                        getRenderQueue()->addRenderable(wirebox); 
    987966                        } 
    988967                        // add renderables itself 
    989968                        if (mRenderNodesContentForViz)  
    990969                        { 
    991                                 //(*it)->queueObjects(cam, getRenderQueue(), false); 
    992970                                (*it)->queueVisibleObjects(mHierarchyInterface->GetFrameId(),  
    993                                         cam, getRenderQueue(), false, mShowBoxes); 
     971                                        cam, getRenderQueue(), false, true); 
    994972                        } 
    995973                } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneNode.cpp

    r1187 r1190  
    3939        void KdTreeSceneNode::computeScene(PlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren) 
    4040        { 
     41                /**************************************************************************************/ 
     42                /* HACK: do not include camera node, FUCKS UP world AABB really BAD, dunno why        */ 
     43                /* TODO: find a generic solution where MOVABLE nodes are NOT INSERTED into the KDTREE */ 
     44                /**************************************************************************************/ 
     45                if (mName == "PlayerCamNode") 
     46                        return; 
     47 
    4148                // first compute nodes AABB 
    4249                mWorldAABB.setNull(); 
Note: See TracChangeset for help on using the changeset viewer.