- Timestamp:
- 06/26/06 09:52:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreSharedRuns.cpp
r949 r1055 1 1 #include "..\include\OgreSharedRuns.h" 2 2 #include "OgreIlluminationManager.h" 3 4 void OgreSharedRuns::runChanged(RenderingRunType runType, RenderingRun* run) 5 { 6 if(child1 != 0) child1->runChanged(runType, run); 7 if(child2 != 0) child2->runChanged(runType, run); 8 9 std::vector<TechniqueGroup*>::iterator it = childTechniqueGroups.begin(); 10 std::vector<TechniqueGroup*>::iterator itend = childTechniqueGroups.end(); 11 12 while(it != itend) 13 { 14 (*it)->runChanged(runType, run); 15 it++; 16 } 17 } 18 19 void OgreSharedRuns::runUpdated(RenderingRunType runType, RenderingRun* run) 20 { 21 if(child1 != 0) child1->runUpdated(runType, run); 22 if(child2 != 0) child2->runUpdated(runType, run); 23 24 25 std::vector<TechniqueGroup*>::iterator it = childTechniqueGroups.begin(); 26 std::vector<TechniqueGroup*>::iterator itend = childTechniqueGroups.end(); 27 28 while(it != itend) 29 { 30 (*it)->runUpdated(runType, run); 31 it++; 32 } 33 } 3 34 4 35 RenderingRun* OgreSharedRuns::getRun(RenderingRunType runType) … … 108 139 { 109 140 runChanged( (*it).first, (*it).second ); 110 runChanged( (*it).first, (*it).second );111 141 it++; 112 142 } … … 135 165 } 136 166 137 bool OgreSharedRuns::haveCommonRuns(SharedRuns* r1, SharedRuns* r2 )167 bool OgreSharedRuns::haveCommonRuns(SharedRuns* r1, SharedRuns* r2, std::vector<RenderingRunType>& commonruns) 138 168 { 139 169 OgreSharedRuns* run1 = (OgreSharedRuns*) r1; … … 143 173 std::map<RenderingRunType, RenderingRun*>::iterator itend = run1->sharedRuns.end(); 144 174 175 bool returnvalue = false; 145 176 while(it != itend) 146 177 { 147 178 if( run2->hasOwnRun((*it).first)) 148 return true; 149 it++; 150 } 151 152 return false; 179 { 180 if( run1->getRun((*it).first)->asOgreRenderingRun()-> 181 canJoin( run2->getRun((*it).first)->asOgreRenderingRun() ) 182 ) 183 { 184 returnvalue = true; 185 commonruns.push_back((*it).first); 186 } 187 } 188 it++; 189 } 190 191 return returnvalue; 153 192 } 154 193 155 194 bool OgreSharedRuns::canJoin(SharedRuns* r1, SharedRuns* r2) 156 195 { 196 std::vector<RenderingRunType> commonruns; 157 197 //check if they have common resources 158 if(!haveCommonRuns(r1, r2 ))198 if(!haveCommonRuns(r1, r2, commonruns)) 159 199 return false; 160 200 201 float MAXRAD = 0xffffffff; 161 202 //check bounds 162 float MAXRAD = OgreIlluminationManager::getSingleton().getMaxJoinRadius(); 203 for(int i = 0; i < commonruns.size(); i++) 204 { 205 206 RenderingRunType type = commonruns.at(i); 207 float marad = OgreIlluminationManager::getSingleton().getMaxJoinRadius(type); 208 209 MAXRAD = std::min(MAXRAD, marad); 210 } 163 211 164 212 Sphere bSphere1 = ((OgreSharedRuns*) r1)->getBoundingSphere();
Note: See TracChangeset
for help on using the changeset viewer.