Changeset 1886
- Timestamp:
- 12/13/06 16:36:34 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreColorCubeMapRenderTechnique.h
r1725 r1886 52 52 String environmentMaterial, 53 53 int layer, 54 bool getMinMax, 55 bool attachToTexUnit, 56 String minVariableName, 57 String maxVariableName, 54 58 Pass* pass, 55 59 OgreRenderable* parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.h
r1722 r1886 53 53 String selfMaterial, 54 54 String environmentMaterial, 55 bool getMinMax, 56 bool attachToTexUnit, 57 String minVariableName, 58 String maxVariableName, 55 59 Pass* pass, 56 60 OgreRenderable* parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCubeMapRenderTechnique.h
r1725 r1886 52 52 String environmentMaterial, 53 53 int layer, 54 bool getMinMax, 55 bool attachToTexUnit, 56 String minVariableName, 57 String maxVariableName, 54 58 Pass* pass, 55 59 OgreRenderable* parentRenderable, … … 72 76 String environmentMaterial; 73 77 String texturePostFix; 78 79 bool getMinMax; 80 bool attachToTexUnit; 81 String minVariableName; 82 String maxVariableName; 74 83 75 84 RenderingRun* createCubeMapRun(); … … 104 113 String environmentMaterial; 105 114 int layer; 115 116 bool getMinMax; 117 bool attachToTexUnit; 118 String minVariableName; 119 String maxVariableName; 106 120 }; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDistanceCubeMapRenderTechnique.h
r1725 r1886 52 52 String environmentMaterial, 53 53 int layer, 54 bool getMinMax, 55 bool attachToTexUnit, 56 String minVariableName, 57 String maxVariableName, 54 58 Pass* pass, 55 59 OgreRenderable* parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderingRuns/OgreCubeMapRenderingRun.h
r1725 r1886 49 49 String selfMaterial, 50 50 String environmentMaterial, 51 bool getMinMax, 51 52 RenderingRunType cubemapRunType); 52 53 /** … … 54 55 */ 55 56 String getCubeMapTextureName(){return name;} 57 58 Vector4 getMax(){return max;} 59 Vector4 getMin(){return min;} 56 60 57 61 protected: … … 74 78 bool useEnvMaterial; 75 79 RenderingRunType cubemapRunType; 80 81 Vector4 min; 82 Vector4 max; 83 84 85 bool getMinMax; 76 86 77 87 void getCubeMapMinMax(); 78 88 //inherited 79 89 inline void createCubeMap(); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticCasterRenderTechnique.cpp
r1725 r1886 132 132 true, 133 133 "", 134 false, 134 135 "GameTools/DistanceShader", 135 136 ILLUMRUN_DISTANCE_CUBEMAP); -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreColorCubeMapRenderTechnique.cpp
r1725 r1886 17 17 String environmentMaterial, 18 18 int layer, 19 bool getMinMax, 20 bool attachToTexUnit, 21 String minVariableName, 22 String maxVariableName, 19 23 Pass* pass, 20 24 OgreRenderable* parentRenderable, 21 25 OgreTechniqueGroup* parentTechniqueGroup) 22 :OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, pass, parentRenderable, parentTechniqueGroup),26 :OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, getMinMax, attachToTexUnit, minVariableName, maxVariableName, pass, parentRenderable, parentTechniqueGroup), 23 27 ColorCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 24 28 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), … … 75 79 void OgreColorCubeMapRenderTechnique::colorCubeMapRunChanged(RenderingRun* run) 76 80 { 77 OgreCubeMapRenderingRun* cuberun =(OgreCubeMapRenderingRun*) (run->asOgreRenderingRun()); 81 OgreCubeMapRenderTechnique::cubeMapRunChanged(run); 82 /*OgreCubeMapRenderingRun* cuberun =(OgreCubeMapRenderingRun*) (run->asOgreRenderingRun()); 78 83 String cubemapname = cuberun->getCubeMapTextureName(); 84 85 pass->getTextureUnitState(texID)->setTextureName(cubemapname);*/ 79 86 80 pass->getTextureUnitState(texID)->setTextureName(cubemapname);81 87 } 82 88 … … 113 119 environmentMaterial, 114 120 layer, 121 getMinMax, 122 attachToTexUnit, 123 minVariableName, 124 maxVariableName, 115 125 pass, 116 126 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.cpp
r1725 r1886 18 18 String selfMaterial, 19 19 String environmentMaterial, 20 bool getMinMax, 21 bool attachToTexUnit, 22 String minVariableName, 23 String maxVariableName, 20 24 Pass* pass, 21 25 OgreRenderable* parentRenderable, 22 26 OgreTechniqueGroup* parentTechniqueGroup) 23 27 : 24 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, pass, parentRenderable, parentTechniqueGroup),28 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, getMinMax, attachToTexUnit, minVariableName, maxVariableName, pass, parentRenderable, parentTechniqueGroup), 25 29 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 26 30 ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, parentRenderable, parentTechniqueGroup), … … 127 131 selfMaterial, 128 132 environmentMaterial, 133 getMinMax, 134 attachToTexUnit, 135 minVariableName, 136 maxVariableName, 129 137 pass, 130 138 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCubeMapRenderTechnique.cpp
r1725 r1886 17 17 String environmentMaterial, 18 18 int layer, 19 bool getMinMax, 20 bool attachToTexUnit, 21 String minVariableName, 22 String maxVariableName, 19 23 Pass* pass, 20 24 OgreRenderable* parentRenderable, … … 25 29 RenderTechnique(parentRenderable, parentTechniqueGroup) 26 30 { 31 this->minVariableName = minVariableName; 32 this->maxVariableName = maxVariableName; 33 this->attachToTexUnit = attachToTexUnit; 34 this->getMinMax = getMinMax; 35 27 36 this->texID = texID; 28 37 this->selfMaterial = selfMaterial; … … 50 59 String cubemapname = cuberun->getCubeMapTextureName(); 51 60 52 pass->getTextureUnitState(texID)->setTextureName(cubemapname); 61 if(attachToTexUnit) 62 pass->getTextureUnitState(texID)->setTextureName(cubemapname); 63 if(getMinMax) 64 { 65 if(minVariableName != "") 66 pass->getFragmentProgramParameters()->setNamedConstant(minVariableName, cuberun->getMin()); 67 if(maxVariableName != "") 68 pass->getFragmentProgramParameters()->setNamedConstant(maxVariableName, cuberun->getMax()); 69 } 53 70 } 54 71 … … 69 86 selfMaterial, 70 87 environmentMaterial, 88 getMinMax, 71 89 cubemapLayer); 72 90 } … … 169 187 f->environmentMaterial = params; 170 188 } 189 190 void parseMinVarName(String& params, RenderTechniqueFactory* factory) 191 { 192 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 193 f->minVariableName = params; 194 } 195 void parseMaxVarName(String& params, RenderTechniqueFactory* factory) 196 { 197 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 198 f->maxVariableName = params; 199 } 200 171 201 void parseLayer(String& params, RenderTechniqueFactory* factory) 172 202 { 173 203 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 174 204 f->layer = StringConverter::parseInt(params); 205 } 206 207 void parseGetMinMax(String& params, RenderTechniqueFactory* factory) 208 { 209 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 210 f->getMinMax = StringConverter::parseBool(params); 211 } 212 213 void parseAttachTexUnit(String& params, RenderTechniqueFactory* factory) 214 { 215 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 216 f->attachToTexUnit = StringConverter::parseBool(params); 175 217 } 176 218 … … 196 238 this->attributeParsers.insert(AttribParserList::value_type("env_material", (ILLUM_ATTRIBUTE_PARSER) parseEnvMaterial)); 197 239 this->attributeParsers.insert(AttribParserList::value_type("layer", (ILLUM_ATTRIBUTE_PARSER) parseLayer)); 240 this->attributeParsers.insert(AttribParserList::value_type("get_minmax", (ILLUM_ATTRIBUTE_PARSER) parseGetMinMax)); 241 this->attributeParsers.insert(AttribParserList::value_type("attach_to_texture_unit", (ILLUM_ATTRIBUTE_PARSER) parseAttachTexUnit)); 242 this->attributeParsers.insert(AttribParserList::value_type("min_var_name", (ILLUM_ATTRIBUTE_PARSER) parseMinVarName)); 243 this->attributeParsers.insert(AttribParserList::value_type("max_var_name", (ILLUM_ATTRIBUTE_PARSER) parseMaxVarName)); 198 244 199 245 } … … 215 261 environmentMaterial = ""; 216 262 layer = 0; 263 getMinMax = false; 264 attachToTexUnit = true; 265 minVariableName = ""; 266 maxVariableName = ""; 267 217 268 } 218 269 … … 241 292 environmentMaterial, 242 293 layer, 294 getMinMax, 295 attachToTexUnit, 296 minVariableName, 297 maxVariableName, 243 298 pass, 244 299 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDistanceCubeMapRenderTechnique.cpp
r1725 r1886 17 17 String environmentMaterial, 18 18 int layer, 19 bool getMinMax, 20 bool attachToTexUnit, 21 String minVariableName, 22 String maxVariableName, 19 23 Pass* pass, 20 24 OgreRenderable* parentRenderable, 21 25 OgreTechniqueGroup* parentTechniqueGroup) 22 26 : 23 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, pass, parentRenderable, parentTechniqueGroup),27 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, selfMaterial, environmentMaterial, layer, getMinMax, attachToTexUnit, minVariableName, maxVariableName, pass, parentRenderable, parentTechniqueGroup), 24 28 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), 25 29 DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment, layer, parentRenderable, parentTechniqueGroup), … … 69 73 void OgreDistanceCubeMapRenderTechnique::distanceCubeMapRunChanged(RenderingRun* run) 70 74 { 71 OgreCubeMapRenderingRun* cuberun =(OgreCubeMapRenderingRun*) (run->asOgreRenderingRun()); 75 OgreCubeMapRenderTechnique::cubeMapRunChanged(run); 76 /* OgreCubeMapRenderingRun* cuberun =(OgreCubeMapRenderingRun*) (run->asOgreRenderingRun()); 72 77 String cubemapname = cuberun->getCubeMapTextureName(); 73 78 74 pass->getTextureUnitState(texID)->setTextureName(cubemapname); 79 pass->getTextureUnitState(texID)->setTextureName(cubemapname);*/ 75 80 } 76 81 … … 118 123 environmentMaterial, 119 124 layer, 125 getMinMax, 126 attachToTexUnit, 127 minVariableName, 128 maxVariableName, 120 129 pass, 121 130 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderingRuns/OgreCubeMapRenderingRun.cpp
r1725 r1886 17 17 bool renderEnvironment, 18 18 String selfMaterial, 19 String environmentMaterial, 19 String environmentMaterial, 20 bool getMinMax, 20 21 RenderingRunType cubemapRunType) 21 22 :CubeMapRenderingRun(startFrame, updateInterval, resolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, renderEnvironment) … … 24 25 25 26 { 27 this->getMinMax = getMinMax; 26 28 this->cubemapRunType = cubemapRunType; 27 29 this->sharedRuns = sharedRuns; … … 124 126 root->restoreMaterial(); 125 127 } 128 129 if(facenum == 5 && getMinMax) 130 getCubeMapMinMax(); 131 } 132 133 void OgreCubeMapRenderingRun::getCubeMapMinMax() 134 { 135 unsigned int buffersize = resolution * resolution * 4; 136 float* floatbuffer = new float[buffersize]; 137 PixelBox lockBox(resolution, resolution, 1, PF_FLOAT32_RGBA, floatbuffer); 138 139 float minX = 0; 140 float minY = 0; 141 float minZ = 0; 142 float minW = 0; 143 float maxX = 0; 144 float maxY = 0; 145 float maxZ = 0; 146 float maxW = 0; 147 148 bool first = true; 149 150 for(int iFace = 0; iFace <6 ; iFace++) 151 { 152 this->cubemapTexture->getBuffer(iFace,0)->blitToMemory(lockBox); 153 154 for(unsigned int i = 0; i < buffersize; i+= 4) 155 { 156 float x = floatbuffer[i]; 157 float y = floatbuffer[i + 1]; 158 float z = floatbuffer[i + 2]; 159 float w = floatbuffer[i + 3]; 160 161 if(first) 162 { 163 minX = x; 164 minY = y; 165 minZ = z; 166 minW = w; 167 maxX = x; 168 maxY = y; 169 maxZ = z; 170 maxW = w; 171 172 first = false; 173 } 174 else if( (x * x + y * y + z * z + w * w) != 0) 175 { 176 if(x < minX)minX = x; 177 if(y < minY)minY = y; 178 if(z < minZ)minZ = z; 179 if(w < minW)minW = w; 180 181 if(x > maxX)maxX = x; 182 if(y > maxY)maxY = y; 183 if(z > maxZ)maxZ = z; 184 if(w > maxW)maxW = w; 185 186 } 187 } 188 } 189 190 min.x = minX; min.y = minY; min.z = minZ; min.w = minW; 191 max.x = maxX; max.y = maxY; max.z = maxZ; max.w = maxW; 192 193 194 delete[] floatbuffer; 126 195 } 127 196
Note: See TracChangeset
for help on using the changeset viewer.