- Timestamp:
- May 3, 2006, 12:51:13 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/height_map.cc
r7494 r7496 272 272 height += (float)(unsigned char)this->heightMapReference->heights[j + 1 + sampleRate + (i + 1) 273 273 * this->heightMapReference->heightMap->w]; 274 height += (float) (unsigned char) this->heightMapReference->heights[(j -1+ sampleRate + (i+1)*(this->heightMapReference->heightMap->w ))]; 275 height += (float)(unsigned char)this->heightMapReference->heights[(j +sampleRate+ (i+2)*(this->heightMapReference->heightMap->w ))]; 276 height += (float)(unsigned char)this->heightMapReference->heights[(j+sampleRate + (i)*(this->heightMapReference->heightMap->w )) ]; 277 height=height/5.0; 278 model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX , ((double)(height)*scaleY) +shiftY ,scaleZ*(j) + shiftZ); // Top Right 279 model->addNormal(normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].y,normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].z,normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].x); 274 height += (float)(unsigned char)this->heightMapReference->heights[j - 1 + sampleRate + (i + 1) * 275 this->heightMapReference->heightMap->w]; 276 height += (float)(unsigned char)this->heightMapReference->heights[j + sampleRate + (i + 2) * 277 this->heightMapReference->heightMap->w]; 278 height += (float)(unsigned char)this->heightMapReference->heights[j + sampleRate + i * this->heightMapReference->heightMap->w]; 279 height /= 5.0; 280 model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX , 281 ((double)(height)*scaleY) +shiftY , 282 scaleZ*(j) + shiftZ); // Top Right 283 model->addNormal(normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].y, 284 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].z, 285 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].x); 280 286 model->addTexCoor((float)j /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate)); 281 model->addColor(r/255.0,g/255.0,b/255.0); 282 283 } 284 285 286 287 model->addColor(r/255.0f, g/255.0f, b/255.0f); 288 } 287 289 288 290 // link Boarder Stripe 289 for(int j = j1-sampleRate ; j < j2 ; j += sampleRate) 290 { 291 291 for(int j = j1 - sampleRate; j < j2; j += sampleRate) 292 { 292 293 model->addIndice(cnt); 293 model->addIndice(cnt + (j2 -j1 + sampleRate )/ sampleRate );294 model->addIndice(cnt + (j2 - j1 + sampleRate) / sampleRate ); 294 295 cnt++; 295 296 } 297 296 } 298 297 cnt++; 299 298 299 300 300 model->newStripe(); 301 301 302 302 303 304 305 306 303 cnt += (j2-j1)/ sampleRate; 307 308 304 // link 2nd BoarderStripe 309 for(int j = j1-sampleRate ; j < j2 ; j += sampleRate) 310 { 311 305 for(int j = j1-sampleRate; j < j2; j += sampleRate) 306 { 312 307 model->addIndice(cnt); 313 model->addIndice(cnt + (j2 -j1 + sampleRate )/ sampleRate);308 model->addIndice(cnt + (j2 - j1 + sampleRate) / sampleRate); 314 309 cnt++; 315 316 } 317 310 } 318 311 319 312 SDL_UnlockSurface(this->heightMapReference->colorMap); 320 313 321 314 model->finalize(); 322 323 324 325 315 326 316 // #undef heightMap … … 333 323 #undef shiftZ 334 324 #undef normalVectorField 335 336 325 } 337 326
Note: See TracChangeset
for help on using the changeset viewer.