Changeset 1725 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Timestamp:
- 11/08/06 14:04:22 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/OgreRenderingRun.cpp
r1670 r1725 110 110 v->setOverlaysEnabled(false); 111 111 rt->setAutoUpdated(false); 112 112 v->setBackgroundColour(clearColor); 113 113 114 Root::getSingleton().getRenderSystem()->_setViewport(v); 114 115 Root::getSingleton().getRenderSystem()->clearFrameBuffer( FBT_COLOUR, clearColor); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticCasterRenderTechnique.cpp
r1722 r1725 132 132 true, 133 133 "", 134 "GameTools/DistanceShader"); 134 "GameTools/DistanceShader", 135 ILLUMRUN_DISTANCE_CUBEMAP); 135 136 136 137 } -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreColorCubeMapRenderTechnique.cpp
r1722 r1725 16 16 String selfMaterial, 17 17 String environmentMaterial, 18 int layer, 18 19 Pass* pass, 19 20 OgreRenderable* parentRenderable, 20 21 OgreTechniqueGroup* parentTechniqueGroup) 21 :OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, pass, parentRenderable, parentTechniqueGroup),22 ColorCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup),23 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup),22 :OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, pass, parentRenderable, parentTechniqueGroup), 23 ColorCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 24 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 24 25 RenderTechnique(parentRenderable, parentTechniqueGroup) 25 26 { 26 texturePostFix = "_COLORCUBEMAP"; 27 switch(layer) 28 { 29 case 0: 30 texturePostFix = "_COLORCUBEMAP"; 31 break; 32 case 1: 33 texturePostFix = "_COLORCUBEMAP_L1"; 34 break; 35 case 2: 36 texturePostFix = "_COLORCUBEMAP_L2"; 37 break; 38 case 3: 39 texturePostFix = "_COLORCUBEMAP_L3"; 40 break; 41 case 4: 42 texturePostFix = "_COLORCUBEMAP_L4"; 43 break; 44 case 5: 45 texturePostFix = "_COLORCUBEMAP_L5"; 46 break; 47 case 6: 48 texturePostFix = "_COLORCUBEMAP_L6"; 49 break; 50 } 27 51 28 if(sharedRuns->getRun( ILLUMRUN_COLOR_CUBEMAP) == 0)29 sharedRuns->addRun( ILLUMRUN_COLOR_CUBEMAP, createCubeMapRun());52 if(sharedRuns->getRun(cubemapLayer) == 0) 53 sharedRuns->addRun(cubemapLayer, createCubeMapRun()); 30 54 31 colorCubeMapRunChanged(sharedRuns->getRun( ILLUMRUN_COLOR_CUBEMAP));55 colorCubeMapRunChanged(sharedRuns->getRun(cubemapLayer)); 32 56 } 33 57 … … 57 81 } 58 82 59 60 61 62 83 ///Technique factory 63 84 OgreColorCubeMapRenderTechniqueFactory::OgreColorCubeMapRenderTechniqueFactory() 64 85 { 65 typeName = "ColorCubeMap"; 86 typeName = "ColorCubeMap"; 66 87 } 67 88 … … 91 112 selfMaterial, 92 113 environmentMaterial, 114 layer, 93 115 pass, 94 116 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.cpp
r1722 r1725 22 22 OgreTechniqueGroup* parentTechniqueGroup) 23 23 : 24 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, pass, parentRenderable, parentTechniqueGroup),25 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup),24 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, pass, parentRenderable, parentTechniqueGroup), 25 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 26 26 ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup), 27 27 RenderTechnique(parentRenderable, parentTechniqueGroup) -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCubeMapRenderTechnique.cpp
r1722 r1725 16 16 String selfMaterial, 17 17 String environmentMaterial, 18 int layer, 18 19 Pass* pass, 19 20 OgreRenderable* parentRenderable, … … 21 22 bool createCubeRun) 22 23 :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 23 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup),24 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 24 25 RenderTechnique(parentRenderable, parentTechniqueGroup) 25 26 { … … 67 68 renderEnvironment, 68 69 selfMaterial, 69 environmentMaterial); 70 environmentMaterial, 71 cubemapLayer); 70 72 } 71 73 … … 167 169 f->environmentMaterial = params; 168 170 } 171 void parseLayer(String& params, RenderTechniqueFactory* factory) 172 { 173 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 174 f->layer = StringConverter::parseInt(params); 175 } 176 169 177 } 170 178 ///Technique factory 171 179 OgreCubeMapRenderTechniqueFactory::OgreCubeMapRenderTechniqueFactory() 172 180 { 173 181 typeName = "CubeMap"; 182 174 183 using namespace CubemapParsers; 175 184 … … 186 195 this->attributeParsers.insert(AttribParserList::value_type("self_material", (ILLUM_ATTRIBUTE_PARSER) parseSelfMaterial)); 187 196 this->attributeParsers.insert(AttribParserList::value_type("env_material", (ILLUM_ATTRIBUTE_PARSER) parseEnvMaterial)); 197 this->attributeParsers.insert(AttribParserList::value_type("layer", (ILLUM_ATTRIBUTE_PARSER) parseLayer)); 188 198 189 199 } … … 204 214 selfMaterial = ""; 205 215 environmentMaterial = ""; 216 layer = 0; 206 217 } 207 218 … … 229 240 selfMaterial, 230 241 environmentMaterial, 242 layer, 231 243 pass, 232 244 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDistanceCubeMapRenderTechnique.cpp
r1722 r1725 16 16 String selfMaterial, 17 17 String environmentMaterial, 18 int layer, 18 19 Pass* pass, 19 20 OgreRenderable* parentRenderable, 20 21 OgreTechniqueGroup* parentTechniqueGroup) 21 22 : 22 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, pass, parentRenderable, parentTechniqueGroup),23 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup),24 DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup),23 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, pass, parentRenderable, parentTechniqueGroup), 24 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 25 DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 25 26 RenderTechnique(parentRenderable, parentTechniqueGroup) 26 27 { 27 texturePostFix = "_DISTANCECUBEMAP"; 28 switch(layer) 29 { 30 case 0: 31 texturePostFix = "_DISTANCECUBEMAP"; 32 break; 33 case 1: 34 texturePostFix = "_DISTANCECUBEMAP_L1"; 35 break; 36 case 2: 37 texturePostFix = "_DISTANCECUBEMAP_L2"; 38 break; 39 case 3: 40 texturePostFix = "_DISTANCECUBEMAP_L3"; 41 break; 42 case 4: 43 texturePostFix = "_DISTANCECUBEMAP_L4"; 44 break; 45 case 5: 46 texturePostFix = "_DISTANCECUBEMAP_L5"; 47 break; 48 case 6: 49 texturePostFix = "_DISTANCECUBEMAP_L6"; 50 break; 51 } 52 if(sharedRuns->getRun(cubemapLayer) == 0) 53 sharedRuns->addRun(cubemapLayer, createCubeMapRun()); 28 54 29 if(sharedRuns->getRun(ILLUMRUN_DISTANCE_CUBEMAP) == 0) 30 sharedRuns->addRun(ILLUMRUN_DISTANCE_CUBEMAP, createCubeMapRun()); 31 32 distanceCubeMapRunChanged(sharedRuns->getRun(ILLUMRUN_DISTANCE_CUBEMAP)); 55 distanceCubeMapRunChanged(sharedRuns->getRun(cubemapLayer)); 33 56 } 34 57 … … 55 78 { 56 79 GpuProgramParametersSharedPtr fpParams = pass->getFragmentProgramParameters(); 57 Vector3 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition( ILLUMRUN_DISTANCE_CUBEMAP);80 Vector3 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition(cubemapLayer); 58 81 fpParams->setNamedConstant("lastCenter",center); 59 82 } … … 94 117 selfMaterial, 95 118 environmentMaterial, 119 layer, 96 120 pass, 97 121 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreCubeMapRenderingRun.cpp
r1722 r1725 17 17 bool renderEnvironment, 18 18 String selfMaterial, 19 String environmentMaterial) 19 String environmentMaterial, 20 RenderingRunType cubemapRunType) 20 21 :CubeMapRenderingRun(startFrame, updateInterval, resolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment) 21 22 , OgreRenderingRun(startFrame, updateInterval) … … 23 24 24 25 { 26 this->cubemapRunType = cubemapRunType; 25 27 this->sharedRuns = sharedRuns; 26 28 this->name = name; … … 44 46 void OgreCubeMapRenderingRun::createCubeMap() 45 47 { 48 ColourValue clearColor = ColourValue::Black; 49 clearColor.a = 0.0; 46 50 cubemapTexture = createCubeRenderTexture(name, 47 51 sharedRuns->getRootPosition(), … … 49 53 PF_FLOAT16_RGBA, 50 54 //PF_R8G8B8A8, 51 0); 55 0, 56 clearColor); 52 57 } 53 58 54 59 void OgreCubeMapRenderingRun::updateCubeFace(int facenum) 55 60 { 56 OgreSharedRuns* root = (OgreSharedRuns*) sharedRuns->getRoot( ILLUMRUN_COLOR_CUBEMAP);61 OgreSharedRuns* root = (OgreSharedRuns*) sharedRuns->getRoot(cubemapRunType); 57 62 SceneManager* sm = Ogre::Root::getSingleton()._getCurrentSceneManager(); 58 63 RenderQueue* rq = sm->getRenderQueue(); … … 60 65 RenderTarget* rt = cubemapTexture->getBuffer(facenum, 0).getPointer()->getRenderTarget(); 61 66 Camera* cam = rt->getViewport(0)->getCamera(); 62 Vector3 center = sharedRuns->getRootPosition( ILLUMRUN_COLOR_CUBEMAP);67 Vector3 center = sharedRuns->getRootPosition(cubemapRunType); 63 68 cam->setPosition(center); 64 69 … … 94 99 if(renderSelf) 95 100 { 96 sharedRuns->getRoot(ILLUMRUN_COLOR_CUBEMAP)->restoreVisibility();101 root->restoreVisibility(); 97 102 if(useSelfMaterial) 98 103 root->setMaterial(selfMaterial); … … 105 110 rt->update(); 106 111 107 //rt->writeContentsToFile( "cubbe" +StringConverter::toString(facenum) + ".dds");112 //rt->writeContentsToFile( "cubeLayer" + StringConverter::toString(cubemapRunType)+ "face" + StringConverter::toString(facenum) + ".dds"); 108 113 109 114 if(!renderAllwithOwnColor) … … 132 137 if(useDistCalc) 133 138 { 134 Vector3 cubemapPosition = sharedRuns->getRootPosition( ILLUMRUN_COLOR_CUBEMAP);135 float objradius = sharedRuns->getRootBoundingSphere( ILLUMRUN_COLOR_CUBEMAP).getRadius();139 Vector3 cubemapPosition = sharedRuns->getRootPosition(cubemapRunType); 140 float objradius = sharedRuns->getRootBoundingSphere(cubemapRunType).getRadius(); 136 141 float fov = mainCamera->getFOVy().valueRadians() / 2.0; 137 142 float dist = (cubemapPosition - mainCamera->getPosition()).length();
Note: See TracChangeset
for help on using the changeset viewer.