Changeset 1114
- Timestamp:
- 07/11/06 13:10:27 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Geom/Demo_LodStrips
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Geom/Demo_LodStrips/main.cpp
r1113 r1114 192 192 distance =dist.length(); 193 193 194 DumpDataToOgreBuffers(ogreMesh,myStrips);195 196 194 float lodfactor = (float)(distance - dist_min) / (float)(dist_max - dist_min); 197 195 lodfactor = 1.0f - lodfactor; 198 196 199 if (lodfactor >= 0.0f && lodfactor <= 1.0f) 197 if (lodfactor<0.0f) 198 lodfactor=0.0f; 199 if (lodfactor>1.0f) 200 lodfactor=1.0f; 201 202 /* if (lodfactor >= 0.0f && lodfactor <= 1.0f) 203 {*/ 204 static float lodfactorBefore = -1.0f; 205 if (fabsf(lodfactorBefore-lodfactor)>0.05f || 206 (lodfactorBefore>0.0f && lodfactor==0.0f) || 207 (lodfactorBefore<1.0f && lodfactor==1.0f)) 200 208 { 201 209 myStrips->GoToLod(lodfactor); 202 203 /* diflods = 10.0f;//myStrips->MaxLod()-myStrips->MinLod();204 inc2=diflods/difdist; 205 i nc2++;206 207 d = distance - dist_min;208 209 nlod = d*inc2;*/210 211 // if ((nlod!=myStrips->mCurrentLod)&&(nlod>=myStrips->MinLod())&&(nlod<=myStrips->MaxLod())) 212 //{213 if (lodfactor < 0.333f)210 DumpDataToOgreBuffers(ogreMesh,myStrips); 211 lodfactorBefore=lodfactor; 212 213 if (lodfactor < 0.333f) 214 { 215 color.r=0.0; 216 color.g=(lodfactor)*3.0f;//nlod*1.0/(diflods/3); 217 color.b=(0.3f-lodfactor)*3.0f;//(nlod*1.0/(diflods/3)); 218 } 219 else 220 { 221 if (lodfactor<0.666f) 214 222 { 215 color.r= 0.0;216 color.g= (lodfactor)*3.0f;//nlod*1.0/(diflods/3);217 color.b= (0.3f-lodfactor)*3.0f;//(nlod*1.0/(diflods/3));223 color.r=(lodfactor-0.333f)*3.0f;//(nlod-diflods/3)*1.0/(diflods/3); 224 color.g=1.0; 225 color.b=0.0; 218 226 } 219 227 else 220 228 { 221 if (lodfactor<0.666f) 222 { 223 color.r=(lodfactor-0.333f)*3.0f;//(nlod-diflods/3)*1.0/(diflods/3); 224 color.g=1.0; 225 color.b=0.0; 226 } 227 else 228 { 229 color.r=1.0; 230 color.g=(0.3f-lodfactor)*3.0f;//(nlod-(2*diflods/3))*1.0/(diflods/3); 231 color.b=0.0; 232 } 229 color.r=1.0; 230 color.g=(0.3f-lodfactor)*3.0f;//(nlod-(2*diflods/3))*1.0/(diflods/3); 231 color.b=0.0; 233 232 } 234 mat[0]->setDiffuse(color);235 // }233 } 234 mat[0]->setDiffuse(color); 236 235 } 237 else236 /* else 238 237 { 239 238 if ((distance > dist_max)) 240 239 { 241 // myStrips->GoToLod(1.0f);242 243 240 color.r=0.0; 244 241 color.g=0.0; … … 251 248 if ((distance < dist_min)) 252 249 { 253 // myStrips->GoToLod(0.0f);254 255 250 color.r=1.0; 256 251 color.g=0.0; … … 260 255 } 261 256 } 262 257 */ 263 258 // Move the node 264 259 if(mInputDevice->isKeyDown(Ogre::KC_UP)) … … 324 319 mInfo->setCaption(cadena); 325 320 326 if (lodfactor<0.0f)327 lodfactor=0.0f;328 if (lodfactor>1.0f)329 lodfactor=1.0f;330 321 sprintf(cadena,"LOD factor: %f",lodfactor); 331 322
Note: See TracChangeset
for help on using the changeset viewer.