- Timestamp:
- 12/13/06 16:36:34 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.