- Timestamp:
- 05/16/07 08:37:09 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreDepthShadowMapRenderingRun.cpp
r2375 r2379 75 75 } 76 76 77 bool OgreDepthShadowMapRenderingRun::renderableQueued (Renderable *rend, uint8 groupID, ushort priority, Technique **ppTech) 78 { 79 OgreTechniqueGroup* TG = (OgreTechniqueGroup*) rend->getRenderTechniqueGroup(); 80 if(TG) 81 { 82 String materialToSet = materialName; 83 String triggeredMaterial = TG->getMaterialNameForTrigger(triggerName); 84 if(triggeredMaterial != "")//a trigger is associated 85 materialToSet = triggeredMaterial; 86 Technique* techn = ((Material*)MaterialManager::getSingleton().getByName( materialToSet ).getPointer())->getTechnique(0); 87 *ppTech = techn; 88 } 89 return true; 90 } 91 77 92 void OgreDepthShadowMapRenderingRun::updateFrame(unsigned long frameNum) 78 93 { 79 94 refreshLight(frameNum); 80 95 96 RenderQueue* rq = Root::getSingleton()._getCurrentSceneManager()->getRenderQueue(); 97 rq->setRenderableListener(this); 98 81 99 if(light->getType() == Light::LT_POINT) 82 { 83 //static int currentFace = 0; 84 //updateDepthCubeFace(currentFace); 85 //currentFace = (currentFace+1)%6; 100 { 86 101 87 88 //Timer* t = Root::getSingleton().getTimer();89 //unsigned long start = t->getMicroseconds();90 //setMaterialForRenderables(materialName, true);91 //unsigned long end = t->getMicroseconds();92 //double elapsed = (double) (end - start) / 1000.0;93 //LogManager::getSingleton().logMessage(String("MaterialSetTime: ") + name + " : " + StringConverter::toString(Real(elapsed)) + " ms");94 //visibleObjects.clear();95 96 102 for(int i = 0; i < 6 ; i++) 97 updateDepthCubeFace(i); 98 99 //start = t->getMicroseconds(); 100 101 restoreMaterials(); 102 103 //end = t->getMicroseconds(); 104 //elapsed = (double) (end - start) / 1000000.0; 105 //LogManager::getSingleton().logMessage(String("MaterialRestoreTime: ") + name + " : " + StringConverter::toString(Real(elapsed)) + " ms"); 103 updateDepthCubeFace(i); 104 105 //restoreMaterials(); 106 106 } 107 107 else … … 109 109 updateDepthMap(); 110 110 } 111 112 rq->setRenderableListener(0); 111 113 } 112 114 … … 114 116 { 115 117 Vector3 lightpos = light->getDerivedPosition(); 116 String triggerName = "ILLUM_TRIGGER_SM_POINT";117 118 118 119 RenderTarget* rt = depthMapTexture->getBuffer(facenum, 0).getPointer()->getRenderTarget(); … … 122 123 123 124 124 setMaterialForVisibles(materialName, cam, true, false, triggerName);125 //setMaterialForVisibles(materialName, cam, true, false, triggerName); 125 126 126 127 rt->update(); … … 144 145 void OgreDepthShadowMapRenderingRun::updateDepthMap() 145 146 { 146 String triggerName; 147 switch(light->getType()) 148 { 149 case Light::LT_DIRECTIONAL: 150 triggerName = "ILLUM_TRIGGER_SM_DIRECTIONAL"; 151 break; 152 case Light::LT_SPOTLIGHT: 153 triggerName = "ILLUM_TRIGGER_SM_SPOT"; 154 break; 155 } 156 setMaterialForVisibles(materialName, depthMapCamera, true, false, triggerName); 147 157 148 RenderTarget* rt = depthMapTexture->getBuffer().getPointer()->getRenderTarget(); 158 149 Viewport* vp = rt->getViewport(0); 159 150 151 //setMaterialForVisibles(materialName, depthMapCamera, true, false, triggerName); 152 160 153 rt->update(); 161 restoreMaterials(); 154 155 //restoreMaterials(); 162 156 163 157 if(OgreIlluminationManager::getSingleton().getBlurShadowMap(light->getType())) … … 184 178 void OgreDepthShadowMapRenderingRun::refreshLight(unsigned long frameNum) 185 179 { 186 187 180 if(light!= 0) 188 181 { … … 191 184 if(light->getType() == Light::LT_DIRECTIONAL) 192 185 { 186 triggerName = "ILLUM_TRIGGER_SM_DIRECTIONAL"; 193 187 Camera* viewcam = OgreIlluminationManager::getSingleton().getMainCamera(); 194 188 … … 296 290 else if(light->getType() == Light::LT_SPOTLIGHT) 297 291 { 292 triggerName = "ILLUM_TRIGGER_SM_SPOT"; 298 293 Camera* viewcam = OgreIlluminationManager::getSingleton().getMainCamera(); 299 294 … … 428 423 { 429 424 lightFarPlane = light->getAttenuationRange(); 425 triggerName = "ILLUM_TRIGGER_SM_POINT"; 430 426 //no other adjustment needed 431 427 } -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreSceneCameraDepthRenderingRun.cpp
r2355 r2379 1 1 #include "OgreSceneCameraDepthRenderingRun.h" 2 #include "OgreTechniqueGroup.h" 2 3 3 4 … … 40 41 } 41 42 43 bool OgreSceneCameraDepthRenderingRun::renderableQueued (Renderable *rend, uint8 groupID, ushort priority, Technique **ppTech) 44 { 45 if((*ppTech)->isTransparent()) 46 return false; 47 48 OgreTechniqueGroup* TG = (OgreTechniqueGroup*) rend->getRenderTechniqueGroup(); 49 if(TG) 50 { 51 String materialToSet = String("GTP/Basic/CameraDepth"); 52 String triggeredMaterial = TG->getMaterialNameForTrigger("ILLUM_TRIGGER_CAMERADEPTH"); 53 if(triggeredMaterial != "")//a trigger is associated 54 materialToSet = triggeredMaterial; 55 Technique* techn = ((Material*)MaterialManager::getSingleton().getByName( materialToSet ).getPointer())->getTechnique(0); 56 *ppTech = techn; 57 } 58 return true; 59 } 60 42 61 void OgreSceneCameraDepthRenderingRun::updateFrame(unsigned long frameNum) 43 62 { 44 63 45 setMaterialForVisibles(String("GTP/Basic/CameraDepth"), playerCamera, false, true, "ILLUM_TRIGGER_CAMERADEPTH"); 46 64 //setMaterialForVisibles(String("GTP/Basic/CameraDepth"), playerCamera, false, true, "ILLUM_TRIGGER_CAMERADEPTH"); 65 RenderQueue* rq = Root::getSingleton()._getCurrentSceneManager()->getRenderQueue(); 66 rq->setRenderableListener(this); 67 47 68 RenderTarget* rt = depthTexture->getBuffer().getPointer()->getRenderTarget(); 48 69 … … 60 81 //rt->writeContentsToFile("cameraDepth.bmp"); 61 82 62 restoreMaterials();83 //restoreMaterials(); 63 84 64 85 sharedRuns->getRoot()->restoreVisibility(); 86 rq->setRenderableListener(0); 65 87 } 66 88
Note: See TracChangeset
for help on using the changeset viewer.