Changeset 175 for trunk/VUT/Ogre


Ignore:
Timestamp:
07/14/05 20:54:07 (19 years ago)
Author:
mattausch
Message:

added trees

Location:
trunk/VUT/Ogre
Files:
6 edited

Legend:

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

    r174 r175  
    7575                @returns occlusion query for this node 
    7676        */ 
    77         GtpVisibility::OcclusionQuery *IssueOcclusionQuery( 
     77        GtpVisibility::OcclusionQuery *IssueNodeOcclusionQuery( 
    7878                GtpVisibility::HierarchyNode *node, const bool wasVisible); 
    7979 
    8080        /** Issue a occlusion query for this mesh. 
    81                 @param node the current mesh 
    82                 @returns occlusion query for this node 
     81                @param mesh the mesh for which an occlusion query is issued. 
     82                @returns occlusion query for this mesh. 
    8383        */ 
    84         GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::Mesh *mesh); 
     84        GtpVisibility::OcclusionQuery *IssueMeshOcclusionQuery(GtpVisibility::Mesh *mesh); 
    8585 
    8686        /** If true, the interface finds and renders only objects which are marked as shadow casters. 
     
    106106    bool IsBoundingBoxQuery(); 
    107107 
    108         GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::Patch *patch); 
     108        GtpVisibility::OcclusionQuery *IssuePatchOcclusionQuery(GtpVisibility::Patch *patch); 
    109109 
    110110protected: 
    111         /** Renders geometry  
     111        /** Renders the given geometry  
    112112        */ 
    113113        void RenderGeometry(GtpVisibility::Mesh *geom); 
    114  
    115         /** Renders a patch  
     114         
     115        /** Renders the given patch  
    116116        */ 
    117117        void RenderPatch(GtpVisibility::Patch *patch); 
  • trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp

    r174 r175  
    6868 
    6969        //-- render scene with item buffer (i.e., objects with their id as color codes) 
     70//mItemBufferMode = 0; 
    7071        if ((mItemBufferMode && mQueryModes) != 0) 
    7172        { 
     
    104105    GtpVisibility::HierarchyNodeList nodeList; 
    105106 
    106         if (mQueryModes && NODE_VISIBILITY) 
     107        if (mQueryModes & NODE_VISIBILITY) 
    107108        { 
    108109                for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt) 
     
    118119         
    119120        // store geometry of the hierarchy nodes in a geometry list 
    120         if (mQueryModes && GEOMETRY_VISIBILITY) 
     121        if (mQueryModes & GEOMETRY_VISIBILITY) 
    121122        {        
    122123                for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt)         
     
    133134 
    134135        // store patchges of the geometries in a patch list 
    135         if (mQueryModes && PATCH_VISIBILITY) 
     136        if (mQueryModes & PATCH_VISIBILITY) 
    136137        { 
    137138                for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt)         
     
    159160        // for relative visibility we need 2 rendering passes 
    160161        int n = relativeVisibility ? 2 : 1; 
    161          
     162        if (mItemBufferMode > 0) 
     163                LogManager::getSingleton().logMessage("item buffer"); 
     164 
    162165        for (int i = 0; i < n; ++i) 
    163166        { 
     
    166169                { 
    167170                        // TODO: DELETE QUERIES FROM PREVIOUS RENDER 
    168                         queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*nodeIt, false)); 
     171                        queryList[i].push_back(mHierarchyInterface->IssueNodeOcclusionQuery(*nodeIt, false)); 
    169172                } 
    170173 
    171174                //-- queries for geometry: if item buffer, capture only projected visibility 
    172175                if ((mItemBufferMode != GEOMETRY_VISIBILITY) || (i == 1)) 
    173                 { 
     176                {                        
    174177                        for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 
    175178                        { 
    176                                 queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*geometryIt)); 
     179                                queryList[i].push_back(pfHierarchyInterface->IssueMeshOcclusionQuery(*geometryIt)); 
    177180                        } 
    178181                } 
     
    183186                        for (patchIt = patchList.begin(); patchIt != patchIt_end; ++patchIt) 
    184187                        { 
    185                                 queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*patchIt)); 
     188                                queryList[i].push_back(pfHierarchyInterface->IssuePatchOcclusionQuery(*patchIt)); 
    186189                        } 
    187190                } 
     
    199202 
    200203 
    201  
    202204        // collect occlusion queries for geometry 
    203205        if ((mItemBufferMode == GEOMETRY_VISIBILITY) && relativeVisibility) 
     
    207209                CollectRelativeGeometryVisibilityForItemBuffer(projQueryIt, &geometryList, visibleGeometry); 
    208210        } 
    209         else 
     211        else if (mItemBufferMode != GEOMETRY_VISIBILITY) 
    210212        { 
    211213                CollectGeometryVisibility(visQueryIt, projQueryIt, &geometryList, visibleGeometry,  
     
    219221                CollectRelativePatchVisibilityForItemBuffer(projQueryIt, &patchList, visiblePatches); 
    220222        } 
    221         else 
     223        else if (mItemBufferMode != PATCH_VISIBILITY) 
    222224        { 
    223225                CollectPatchVisibility(visQueryIt, projQueryIt, &patchList, visiblePatches, relativeVisibility); 
     
    244246                visibleGeometry, visiblePatches, relativeVisibility); 
    245247 
    246         // remove duplicates (duplicates occur if an object is on the edge of the viewport) 
    247         // before duplicates can be deleted we have to add up their visibility 
     248        // adds up their visibility and removes duplicates  
     249        // (duplicates occur if an object is on the edge of the viewport) 
    248250        RemoveDuplicateNodes(visibleNodes); 
    249251         
     
    258260        } 
    259261} 
    260 //----------------------------------------------------------------------- 
     262//------j----------------------------------------------------------------- 
    261263void  OcclusionQueriesQueryManager::CollectNodeVisibility( 
    262264                                                GtpVisibility::QueryList::iterator &visQueryIt,  
  • trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp

    r174 r175  
    165165} 
    166166//----------------------------------------------------------------------- 
    167 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 
     167GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueNodeOcclusionQuery( 
    168168        GtpVisibility::HierarchyNode *node, const bool wasVisible)  
    169169{ 
     
    200200} 
    201201//----------------------------------------------------------------------- 
    202 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 
     202GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssuePatchOcclusionQuery( 
    203203        GtpVisibility::Patch *patch) 
    204204{ 
     
    216216} 
    217217//----------------------------------------------------------------------- 
    218 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 
     218GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueMeshOcclusionQuery( 
    219219        GtpVisibility::Mesh *mesh) 
    220220{ 
     
    287287void PlatformHierarchyInterface::RenderPatch(GtpVisibility::Patch *patch) 
    288288{ 
    289         Pass *pass = patch->getTechnique()->getPass(0); 
    290         mSceneManager->setPass(pass); 
    291         mSceneManager->renderSingleObject(patch, pass, false); 
     289        mSceneManager->_renderSingleRenderable(patch); 
    292290} 
    293291//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp

    r160 r175  
    2929void SceneContentGenerator::GenerateScene(int numObjects, const String &objName) 
    3030{ 
    31         // initialise random generator 
    32         srand (time(0)); 
    33          
    34         Vector3 rotationRatio; 
    35         Vector3 translationRatio; 
    36  
    3731        int new_size = GetObjectCount() + numObjects; 
    3832        int failed_attempts = 0; // counter used to avoid invinite loop 
     
    4236                   (failed_attempts < MAX_FAILED_ATTEMPTS)) 
    4337        { 
    44                 rotationRatio.x = rand() / (float) RAND_MAX; 
    45                 rotationRatio.y = rand() / (float) RAND_MAX; 
    46                 rotationRatio.z = rand() / (float) RAND_MAX; 
    47  
    48                 translationRatio.x = rand() / (float) RAND_MAX; 
    49                 translationRatio.y = rand() / (float) RAND_MAX; 
    50                 translationRatio.z = rand() / (float) RAND_MAX; 
    51  
    5238                // Setup the ray scene query 
    53                 Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle); 
    54                 Vector3 position = mMinPos + translationRatio * (mMaxPos - mMinPos); 
     39                Vector3 rotation = Vector3(Math::RangeRandom(mMinAngle.x, mMaxAngle.x), 
     40                                                                   Math::RangeRandom(mMinAngle.y, mMaxAngle.y), 
     41                                                                   Math::RangeRandom(mMinAngle.z, mMaxAngle.z)); 
     42 
     43                Vector3 position = Vector3(Math::RangeRandom(mMinPos.x, mMaxPos.x), 
     44                                                                   Math::RangeRandom(mMinPos.y, mMaxPos.y), 
     45                                                                   Math::RangeRandom(mMinPos.z, mMaxPos.z)); 
    5546 
    5647                // failed to generate new object 
    5748                if (!GenerateSceneObject(position, rotation, objName)) 
    58                         ++failed_attempts;  
     49                        ++ failed_attempts;  
    5950        } 
    6051} 
     
    6859                 
    6960        Entity *ent = mSceneMgr->createEntity(name, objName + ".mesh"); 
    70                  
     61        ent->setCastShadows(true); 
     62 
    7163        SceneNode *node = mSceneMgr->getRootSceneNode()-> 
    7264                createChildSceneNode(String(name) + "Node", position); 
     
    8072        mSceneNodes.push_back(node); 
    8173        mEntities.push_back(ent); 
    82  
     74         
    8375        return node; 
    8476} 
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r174 r175  
    237237void VisibilityOctreeSceneManager::_renderVisibleObjects() 
    238238{ 
     239        InitDepthPass();          // create material for depth pass 
     240        InitItemBufferPass(); // create material for item buffer pass 
     241 
    239242        // save ambient light to reset later 
    240243        ColourValue savedAmbient = mAmbientLight; 
     
    629632void VisibilityOctreeSceneManager::InitVisibilityCulling(Camera *cam) 
    630633{ 
    631         InitDepthPass();          // create material for depth pass 
    632         InitItemBufferPass(); // create material for item buffer pass 
    633  
    634634        // reset culling manager stats 
    635635        mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r174 r175  
    240240void VisibilityTerrainSceneManager::_renderVisibleObjects() 
    241241{ 
     242        InitDepthPass();          // create material for depth pass 
     243        InitItemBufferPass(); // create material for item buffer pass 
     244 
    242245        // save ambient light to reset later 
    243246        ColourValue savedAmbient = mAmbientLight; 
     
    629632void VisibilityTerrainSceneManager::InitVisibilityCulling(Camera *cam) 
    630633{ 
    631         InitDepthPass();          // create material for depth pass 
    632         InitItemBufferPass(); // create material for item buffer pass 
    633  
    634634        // reset culling manager stats 
    635635        mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 
Note: See TracChangeset for help on using the changeset viewer.