Changeset 154 for trunk/VUT/Ogre


Ignore:
Timestamp:
07/04/05 17:57:51 (19 years ago)
Author:
mattausch
Message:

added item buffer queries.

Location:
trunk/VUT/Ogre
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/Ogre/include/OgreBspHierarchyInterface.h

    r87 r154  
    4343        */ 
    4444        AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node); 
    45          
    46         unsigned int mNumOctreeNodes; 
    4745}; 
    4846} // namespace Ogre 
  • trunk/VUT/Ogre/include/OgreItemBufferQueryManager.h

    r153 r154  
    2222                            bool relativeVisibility = false); 
    2323     
    24     /**  
    25         Uses the specified point to execute the visibility query in all directions.  
    26         @sa ComputeCameraVisibility() 
    27     */ 
    28     void ComputeFromPointVisibility(const Vector3 &point, 
    29                                InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 
    30                                InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 
    31                                bool relativeVisibility = false); 
    32      
    3324        bool ShootRay(const Ray &ray, std::vector<Mesh *> *visibleMeshes, bool isGlobalLine = false);   
    3425         
     
    3627        void InitItemBuffer( InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 
    3728                            InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry); 
    38         bool mWasInitialised; 
     29         
    3930}; 
    4031 
  • trunk/VUT/Ogre/include/OgreOctreeHierarchyInterface.h

    r130 r154  
    2525                See setOption 
    2626        */ 
    27         //bool getOption( const String &, void * ); 
    28         //bool getOptionKeys( StringVector &refKeys ); 
    2927        void PullUpVisibility(GtpVisibility::HierarchyNode *node); 
     28         
    3029        /** Traverses given node. 
    3130                @param node current node 
     
    5049                                                        InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,  
    5150                                                        bool includeChildren = false);*/ 
     51 
    5252        void GetGeometry(GtpVisibility::HierarchyNode *node, 
    5353                                         GtpVisibility::GeometryList *geometryList,  
    5454                                         bool includeChildren); 
     55 
     56        void SetNodeId(GtpVisibility::HierarchyNode *node, int id); 
     57         
     58        int GetNodeId(GtpVisibility::HierarchyNode *node); 
    5559 
    5660protected: 
     
    6569        */ 
    6670        Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const; 
    67         /** number of octree hierarchy nodes */ 
    68         unsigned int mNumOctreeNodes; 
    6971}; 
    7072} // namespace Ogre 
  • trunk/VUT/Ogre/include/OgrePlatformQueryManager.h

    r144 r154  
    2020     
    2121    /**  
    22         Computes restricted visibility from point by using an explicit camera to execute 
    23         the visibility query. 
    24         @param camera The camera to be used 
    25  
    26         @param visibleNodes Pointer to the container where visible nodes should be added. 
    27         This set is formed of visible leafs or fully visible interior nodes. 
    28         If NULL no visible nodes are not evaluated. 
    29  
    30         @param visibleGeometry Pointer to the container where visible meshes should be added. 
    31         If NULL no visible meshes are not evaluated. 
    32  
    33         @param projectedPixels If true the visibility member for 
    34         NodeInfo and MeshInfo represent relative visibility; i.e. the number of visible 
    35         pixels divided by the the number of projected pixels. 
    36  
    37         @return true if the corresponding PVS exists. 
    38     */ 
    39     virtual void 
    40     ComputeCameraVisibility(const Camera &camera, 
    41                             InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 
    42                             InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 
    43                             bool relativeVisibility = false 
    44                             ); 
    45      
    46     /**  
    4722        Uses the specified point to execute the visibility query in all directions.  
    4823        @sa ComputeCameraVisibility() 
    4924    */ 
    50     virtual void 
    51     ComputeFromPointVisibility(const Vector3 &point, 
     25    void ComputeFromPointVisibility(const Vector3 &point, 
    5226                               InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 
    5327                               InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 
    54                                bool relativeVisibility = false 
    55                                ); 
     28                               bool relativeVisibility = false); 
    5629     
    5730  /**  
     
    7952protected: 
    8053        Viewport *mViewport; 
     54        bool mWasInitialised; 
    8155}; 
    8256 
  • trunk/VUT/Ogre/include/OgreSceneNodeHierarchyInterface.h

    r130 r154  
    4949                                         GtpVisibility::GeometryList *geometryList,  
    5050                                         bool includeChildren); 
     51 
     52        void SetNodeId(GtpVisibility::HierarchyNode *node, int id); 
     53         
     54        int GetNodeId(GtpVisibility::HierarchyNode *node); 
    5155}; 
    5256 
  • trunk/VUT/Ogre/scripts/Plugin_VisibilitySceneManager.vcproj

    r150 r154  
    195195                                </File> 
    196196                                <File 
     197                                        RelativePath="..\include\OgreOcclusionQueriesQueryManager.h"> 
     198                                </File> 
     199                                <File 
    197200                                        RelativePath="..\include\OgrePlatformHierarchyInterface.h"> 
    198201                                </File> 
     
    227230                                <File 
    228231                                        RelativePath="..\src\OgreItemBufferQueryManager.cpp"> 
     232                                </File> 
     233                                <File 
     234                                        RelativePath="..\src\OgreOcclusionQueriesQueryManager.cpp"> 
    229235                                </File> 
    230236                                <File 
  • trunk/VUT/Ogre/src/OgreItemBufferQueryManager.cpp

    r153 r154  
    88//-----------------------------------------------------------------------  
    99ItemBufferQueryManager::ItemBufferQueryManager(PlatformHierarchyInterface *hierarchyInterface, Viewport *vp): 
    10 PlatformQueryManager(hierarchyInterface, vp), mWasInitialised(false) 
     10PlatformQueryManager(hierarchyInterface, vp) 
    1111{ 
    1212} 
     
    2323                            bool relativeVisibility) 
    2424{ 
    25         // initialise item buffer if necessary 
     25        // initialise item buffer (if not already initialised) 
    2626        InitItemBuffer(visibleNodes, visibleGeometry); 
    2727 
     
    4545        sm->setOption("UseItemBuffer", &useItemBuffer); 
    4646         
    47         // clear background with black 
     47        // clear background with black (i.e., not a valid item id) 
    4848        ColourValue bg = mViewport->getBackgroundColour(); 
    4949        mViewport->setBackgroundColour(ColourValue(0, 0, 0, 0)); 
     
    7070        uchar *buf = mViewport->getTarget()->getBufferContents(dimx, dimy); 
    7171 
     72         
    7273        // loop through frame buffer & collect visible pixels 
    7374        for (int idx = 0; idx < dimy * dimx * 3; idx += 3) 
    7475        { 
     76                // -- decode color code to receive id 
    7577                int id = buf[idx] << 16; 
    7678                id += buf[idx + 1] << 8; 
    7779                id += buf[idx + 2]; 
    7880 
    79                 // if valid id <= add visibility 
    80                 if ((id >= 0) && (id < (int)visibleGeometry->size())) 
     81                // if valid id <= add visibility (id values start at 1 
     82                if ((id > 0) && (id < (int)visibleGeometry->size())) 
    8183                { 
    8284                        ((*visibleGeometry)[id]).AddVisibility(1, 1); 
    8385                } 
    84         /*      else 
    85                 {  
    86                         std::stringstream d;  
    87                         d << "id: " << id << ", buf 1: " << (int)buf[idx] << ", buf 2: " << (int)buf[idx + 1] << ", buf 3: " << (int)buf[idx + 2]; 
    88                         LogManager::getSingleton().logMessage(d.str()); 
    89                 }*/ 
     86                /*else {        std::stringstream d;  
     87                        d << "adding pixel to geometry with id: " << id << ", buf 1: " << (int)buf[idx] << ", buf 2: " << (int)buf[idx + 1] << ", buf 3: " << (int)buf[idx + 2]; 
     88                        LogManager::getSingleton().logMessage(d.str()); }*/ 
    9089        } 
    9190 
     
    104103        mWasInitialised = true; 
    105104 
    106         SceneManager::EntityIterator it = dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)-> 
     105        SceneManager::EntityIterator it =  
     106                dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface)-> 
    107107                GetSceneManager()->getEntityIterator(); 
    108108 
    109109        // TODO: make this more efficient 
    110110        visibleGeometry->clear(); 
     111        visibleNodes->clear(); 
    111112 
    112113        while (it.hasMoreElements()) 
     
    115116        } 
    116117} 
    117 //----------------------------------------------------------------------- 
    118 void ItemBufferQueryManager::ComputeFromPointVisibility(const Vector3 &point, 
    119                                InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 
    120                                InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 
    121                                bool relativeVisibility) 
    122 { 
    123         SceneManager *sm = dynamic_cast<PlatformHierarchyInterface *> 
    124                 (mHierarchyInterface)->GetSceneManager(); 
    125  
    126         Camera *cam = sm->createCamera("PointQueryCam");         
    127  
    128         //save old camera 
    129         Camera *savedCam = mViewport->getCamera(); 
    130          
    131         // --- initialise new camera 
    132         mViewport->setCamera(cam); 
    133         cam->setPosition(point); 
    134  
    135         cam->setNearClipDistance(savedCam->getNearClipDistance()); 
    136         cam->setFarClipDistance(savedCam->getFarClipDistance()); 
    137  
    138         // set frustum to 45 degrees so all the scene can be captured with 6 shots 
    139         cam->setAspectRatio(1.0); 
    140         cam->setFOVy(Radian(Math::HALF_PI)); 
    141  
    142         int sign = -1; 
    143          
    144         // ---- capture visibility from all 6 directions 
    145         for (int i=0; i < 6; i++)        
    146         { 
    147                 sign *= -1; 
    148                  
    149                 // Print camera details 
    150         std::stringstream d; 
    151                 d << "Point query camera: " + StringConverter::toString(cam->getDerivedPosition()) +  
    152                         " " + "O: " + StringConverter::toString(cam->getDerivedOrientation()); 
    153                 LogManager::getSingleton().logMessage(d.str()); 
    154  
    155                 // prevent from initialising array again 
    156                 if (i > 0) 
    157                         mWasInitialised = true; 
    158                  
    159                 // compute camera visibility for this direction 
    160                 ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, relativeVisibility); 
    161  
    162                 //mViewport->getTarget()->update(); for(int j=0; j<10000000; j++)       printf("wait"); // HACK: DISPLAY CAMERA VIEW 
    163  
    164                 // --- permute directions 
    165                 Vector3 dir(0,0,0); 
    166                 dir[i/2] = sign; 
    167  
    168                 cam->setDirection(dir); 
    169         } 
    170          
    171         // reset camera 
    172         mViewport->setCamera(savedCam); 
    173 } 
    174  
    175118} // namespace Ogre 
  • trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp

    r139 r154  
    5555} 
    5656//----------------------------------------------------------------------- 
    57 void OctreeHierarchyInterface::SetNumOctreeNodes(unsigned int num) 
    58 { 
    59         mNumOctreeNodes = num; 
    60 } 
    61 //----------------------------------------------------------------------- 
    6257float OctreeHierarchyInterface::GetSquaredDistance(GtpVisibility::HierarchyNode *node) const 
    6358{ 
     
    173168                SceneNodeHierarchyInterface::GetGeometry(*nodeIt, geometryList, includeChildren); 
    174169        } 
     170} 
     171//----------------------------------------------------------------------- 
     172void OctreeHierarchyInterface::SetNodeId(GtpVisibility::HierarchyNode *node, int id) 
     173{ 
     174        static_cast<Octree *>(node)->setId(id); 
     175} 
     176//----------------------------------------------------------------------- 
     177int OctreeHierarchyInterface::GetNodeId(GtpVisibility::HierarchyNode *node) 
     178{ 
     179        return static_cast<Octree *>(node)->getId(); 
    175180} 
    176181//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp

    r153 r154  
    1010//-----------------------------------------------------------------------  
    1111PlatformQueryManager::PlatformQueryManager(PlatformHierarchyInterface *hierarchyInterface, Viewport *vp): 
    12 QueryManager(hierarchyInterface), mViewport(vp) 
     12QueryManager(hierarchyInterface), mViewport(vp), mWasInitialised(false) 
    1313{ 
    1414} 
     
    1818    // run OGRE ray shooting query 
    1919    return false; 
    20 } 
    21 //----------------------------------------------------------------------- 
    22 void PlatformQueryManager::ComputeCameraVisibility(const Camera &camera, 
    23                             InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, 
    24                             InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry, 
    25                             bool relativeVisibility) 
    26 { 
    27         // we need access to the scene manager and the rendersystem 
    28         PlatformHierarchyInterface *pfHierarchyInterface =  
    29                 dynamic_cast<PlatformHierarchyInterface *>(mHierarchyInterface); 
    30  
    31         //-- Render scene to get conservative visibility and fill depth buffer  
    32  
    33         // const_cast allowed because camera is not changed in renderScene 
    34         Camera *pCam = const_cast<Camera *>(&camera);  
    35  
    36         // disable overlays, reset them later 
    37         bool overlayEnabled = mViewport->getOverlaysEnabled(); 
    38         mViewport->setOverlaysEnabled(false); 
    39  
    40         //-- render the scene once to update depth buffer 
    41         pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 
    42  
    43         /*  
    44                 Two query lists for projected pixels and for visibile pixels: 
    45                 We test queries after a rendering pass  
    46                 to get exact visibility with regard to the current camera. 
    47                 We issue all queries at once to avoid starvation & stalls. 
    48         */ 
    49         GtpVisibility::QueryList queryList[2]; 
    50          
    51         // get rendered hierarchy nodes 
    52         GtpVisibility::HierarchyNodeList *nodeList = mHierarchyInterface->GetRenderedNodes(); 
    53         // vector for storing entities of meshes 
    54         GtpVisibility::GeometryList geometryList; 
    55          
    56         GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end(); 
    57         // geometry list has still do be built 
    58         GtpVisibility::GeometryList::iterator geometryIt, geometryIt_end; 
    59  
    60         // to obtain the correct number of projected pixels, depth write must be disabled 
    61         bool enableDepthWrite = false; 
    62  
    63         // this option must be provided by the scene manager 
    64         pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 
    65  
    66         /* relative visiblity: 
    67                 1) get visible pixels count of objects 
    68                 2) clear frame buffer 
    69                 3) get projected visible pixels count: 
    70                    test all objects again without depth write (set as option in scene manager) 
    71                 4) calculate ratio between visible vs. projected pixels 
    72         */ 
    73         // for relative visibility we need 2 rendering passes 
    74         int n = relativeVisibility ? 2 : 1; 
    75          
    76         for (int i=0; i<n; ++i) 
    77         { 
    78                 //-- queries for hierarchy nodes 
    79                 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt)                 
    80                 { 
    81                         // TODO: DELETE QUERIES FROM PREVIOUS RENDER 
    82                         queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*nodeIt, false)); 
    83                          
    84                         // store geometry of the hierarchy node in a geometry list (only once!) 
    85                         if (i == 0) 
    86                         { 
    87                                 mHierarchyInterface->GetGeometry(*nodeIt, &geometryList, false); 
    88                         } 
    89                 } 
    90  
    91                 geometryIt_end = geometryList.end(); 
    92  
    93                 //-- add queries for geometry 
    94                 for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 
    95                 { 
    96                         queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*geometryIt)); 
    97                 } 
    98  
    99          
    100                 pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_DEPTH); 
    101         } 
    102  
    103         enableDepthWrite = true; 
    104         // this option must be provided by the scene manager 
    105         pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 
    106         // reset old overlay status 
    107         mViewport->setOverlaysEnabled(overlayEnabled); 
    108  
    109         //---- collect results 
    110         GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; 
    111  
    112         visQueryIt = queryList[0].begin(); 
    113         projQueryIt = queryList[1].begin(); 
    114  
    115          
    116         for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 
    117         { 
    118                 unsigned int visiblePixels = 0; 
    119                 (*visQueryIt)->GetQueryResult(visiblePixels, true); 
    120          
    121                 unsigned int projectedPixels = 0; 
    122  
    123                 if (relativeVisibility) 
    124                 { 
    125                         (*projQueryIt)->GetQueryResult(projectedPixels, true); 
    126                  
    127                         ++projQueryIt; 
    128                 } 
    129  
    130                 ++visQueryIt; 
    131                  
    132                 // node with visibilty 0 in queue (e.g., if node is intersected by near plane) 
    133                 if (visiblePixels > 0) 
    134                 { 
    135                         visibleNodes->push_back(GtpVisibility::NodeInfo(*nodeIt, visiblePixels, projectedPixels)); 
    136                 } 
    137         } 
    138  
    139         //---- queries for geometry 
    140         geometryIt_end = geometryList.end(); 
    141          
    142         for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 
    143         { 
    144                 unsigned int visiblePixels = 0; 
    145                 (*visQueryIt)->GetQueryResult(visiblePixels, true); 
    146                  
    147                 unsigned int projectedPixels = 0; 
    148  
    149                 if (relativeVisibility) 
    150                 { 
    151                         (*projQueryIt)->GetQueryResult(projectedPixels, true); 
    152  
    153                         ++projQueryIt; 
    154                 } 
    155  
    156                 ++visQueryIt; 
    157  
    158                 // approximate depth ordering during rendering =>  
    159                 // geometry maybe occluded 
    160                 if (visiblePixels > 0) 
    161                 {                         
    162                         visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, visiblePixels,  
    163                                 projectedPixels)); 
    164                 } 
    165         } 
    166  
    167 } 
    168 //----------------------------------------------------------------------- 
    169 inline bool nodeinfo_eq(const GtpVisibility::NodeInfo &info1, const GtpVisibility::NodeInfo &info2)  
    170 {  
    171         return info1.GetNode() == info2.GetNode();  
    172 } 
    173 //----------------------------------------------------------------------- 
    174 inline bool meshinfo_eq(const GtpVisibility::MeshInfo &info1, const GtpVisibility::MeshInfo &info2)  
    175 {  
    176         return info1.GetMesh() == info2.GetMesh();  
    177 } 
    178 //----------------------------------------------------------------------- 
    179 inline bool nodeinfo_lower(const GtpVisibility::NodeInfo &info1, const GtpVisibility::NodeInfo &info2)  
    180 {  
    181         return info1.GetNode() < info2.GetNode();  
    182 } 
    183 //----------------------------------------------------------------------- 
    184 inline bool meshinfo_lower(const GtpVisibility::MeshInfo &info1, const GtpVisibility::MeshInfo &info2)  
    185 {  
    186         return info1.GetMesh() < info2.GetMesh();  
    18720} 
    18821//----------------------------------------------------------------------- 
     
    22255                LogManager::getSingleton().logMessage(d.str()); 
    22356 
     57                // prevent from initialising geometry / node array again 
     58                if (i > 0) 
     59                        mWasInitialised = true; 
     60 
    22461                ComputeCameraVisibility(*cam, visibleNodes, visibleGeometry, relativeVisibility); 
    22562                 
     
    23572        // reset camera 
    23673        mViewport->setCamera(savedCam); 
    237  
    238         // --- remove duplicates (duplicates occur if an object is on the edge of the viewport) 
    239  
    240         // before duplicates can be deleted we have to add up their visibility 
    241  
    242         // --- visible nodes 
    243         sort(visibleNodes->begin(), visibleNodes->end(), nodeinfo_lower); 
    244         InfoContainer<GtpVisibility::NodeInfo>::iterator visibleNodesIt, 
    245                 visibleNodesIt_end = visibleNodes->end(); 
    246          
    247         GtpVisibility::NodeInfo *nodeInfo = NULL; 
    248  
    249         for (visibleNodesIt = visibleNodes->begin(); visibleNodesIt != visibleNodesIt_end;  
    250                 ++visibleNodesIt) 
    251         { 
    252                 if (!nodeInfo || (nodeInfo->GetNode() != (*visibleNodesIt).GetNode())) 
    253                 { 
    254                         nodeInfo = &(*visibleNodesIt); 
    255                 } 
    256                 else // add visibility 
    257                 {                        
    258                         nodeInfo->AddVisibility(*visibleNodesIt); 
    259                 } 
    260  
    261         } 
    262          
    263         // physically delete duplicates 
    264         visibleNodes->erase( std::unique(visibleNodes->begin(),  
    265                 visibleNodes->end(), nodeinfo_eq), visibleNodes->end()); 
    266  
    267         // --- visible geometry 
    268         sort(visibleGeometry->begin(), visibleGeometry->end(), meshinfo_lower); 
    269         InfoContainer<GtpVisibility::MeshInfo>::iterator visibleGeomIt, 
    270                 visibleGeomIt_end = visibleGeometry->end(); 
    271  
    272         GtpVisibility::MeshInfo *geomInfo = NULL; 
    273  
    274         int i=0; 
    275         for (visibleGeomIt = visibleGeometry->begin(); visibleGeomIt != visibleGeomIt_end;  
    276                 ++visibleGeomIt) 
    277         { 
    278                 if (!geomInfo || (geomInfo->GetMesh() != (*visibleGeomIt).GetMesh())) 
    279                 { 
    280                         geomInfo = &(*visibleGeomIt); 
    281                 } 
    282                 else // info points to same mesh, just add visibility 
    283                 { 
    284                         geomInfo->AddVisibility(*visibleGeomIt); 
    285                 } 
    286         } 
    287  
    288         // physically delete duplicates 
    289         visibleGeometry->erase(std::unique(visibleGeometry->begin(), visibleGeometry->end(),  
    290                 meshinfo_eq), visibleGeometry->end()); 
    291          
    29274} 
    29375//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp

    r139 r154  
    147147                MovableObject *movable = objIt.getNext(); 
    148148                 
    149                 // we are interested only in the entities, i.e., intances of geometry 
     149                // we are interested only in the entities, i.e., instances of geometry 
    150150                if (movable->getMovableType() == "Entity") 
    151151                { 
     
    156156    } 
    157157} 
     158//----------------------------------------------------------------------- 
     159void SceneNodeHierarchyInterface::SetNodeId(GtpVisibility::HierarchyNode *node, int id) 
     160{ 
     161        static_cast<SceneNode *>(node)->setId(id); 
     162} 
     163//----------------------------------------------------------------------- 
     164int SceneNodeHierarchyInterface::GetNodeId(GtpVisibility::HierarchyNode *node) 
     165{ 
     166        return static_cast<SceneNode *>(node)->getId(); 
     167} 
    158168} // namespace Ogre      
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r139 r154  
    259259        mHierarchyInterface->SetRenderSystem(mDestRenderSystem); 
    260260 
    261 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    262     mHierarchyInterface->SetNumOctreeNodes(mNumOctreeNodes); 
    263 #endif 
    264261        OctreeSceneManager::_updateSceneGraph(cam); 
    265262} 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r153 r154  
    2424mUseDepthPass(false), 
    2525mRenderDepthPass(false), 
    26 //mUseItemBuffer(false), 
    27 mUseItemBuffer(true), 
     26mUseItemBuffer(false), 
     27//mUseItemBuffer(true), 
    2828mRenderItemBuffer(false), 
    29 mCurrentEntityId(0), 
     29mCurrentEntityId(1), 
    3030mEnableDepthWrite(true), 
    3131mSkipTransparents(false), 
     
    327327                 
    328328        // set the new render level index afterwards => new level in the next frame  
    329         int levelIdx = (TerrainRenderable::getCurrentRenderLevelIndex() + 1) % 10; 
     329        int levelIdx = TerrainRenderable::getCurrentRenderLevelIndex() + 1; 
    330330        TerrainRenderable::setCurrentRenderLevelIndex(levelIdx); 
    331331 
     
    343343        mHierarchyInterface->SetRenderSystem(mDestRenderSystem); 
    344344 
    345 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    346     mHierarchyInterface->SetNumOctreeNodes(mNumOctreeNodes); 
    347 #endif 
    348345        TerrainSceneManager::_updateSceneGraph(cam); 
    349346} 
     
    567564        int col[4]; 
    568565         
     566        // -- create color code out of object id 
    569567        col[0] = (rend->getId() >> 16) & 255; 
    570568        col[1] = (rend->getId() >> 8) & 255; 
     
    599597 
    600598        Pass *usedPass = setPass(mItemBufferPass);  
    601         //Pass *usedPass = setPass(pass); 
    602          
    603         if (rend->getId() > 0) 
     599         
     600        /*if (rend->getId() > 0) 
    604601        { 
    605602                std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col[0] << 
    606603                        " " << col[1] << " " << col[2] << " " << col[3]; 
    607604                LogManager::getSingleton().logMessage(d.str()); 
    608         } 
     605        }*/ 
    609606 
    610607        // Render a single object, this will set up auto params if required 
    611608        renderSingleObject(rend, usedPass, false, &nullLightList); 
    612  
    613         // reset colour 
    614         //mDestRenderSystem->setColour(255, 255, 255, 255); 
    615609} 
    616610//----------------------------------------------------------------------- 
     
    630624        } 
    631625 
     626        // increase counter of entity id values 
    632627        ++ mCurrentEntityId; 
    633628 
Note: See TracChangeset for help on using the changeset viewer.