Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7496 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
May 3, 2006, 12:51:13 AM (19 years ago)
Author:
patrick
Message:

resuming work on the hm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/height_map.cc

    r7494 r7496  
    272272    height += (float)(unsigned char)this->heightMapReference->heights[j + 1 + sampleRate + (i + 1)
    273273                                                                      * 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);
    280286    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  }
    287289
    288290  // 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  {
    292293    model->addIndice(cnt);
    293     model->addIndice(cnt  + (j2 -j1 +  sampleRate  )/ sampleRate );
     294    model->addIndice(cnt + (j2 - j1 + sampleRate) / sampleRate );
    294295    cnt++;
    295 
    296   }
    297 
     296  }
    298297  cnt++;
    299298
     299
    300300  model->newStripe();
    301301
    302302
    303 
    304 
    305 
    306303  cnt += (j2-j1)/ sampleRate;
    307 
    308304  // 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  {
    312307    model->addIndice(cnt);
    313     model->addIndice(cnt  + (j2 -j1 +  sampleRate  )/ sampleRate );
     308    model->addIndice(cnt + (j2 - j1 + sampleRate) / sampleRate);
    314309    cnt++;
    315 
    316   }
    317 
     310  }
    318311
    319312  SDL_UnlockSurface(this->heightMapReference->colorMap);
    320313
    321314  model->finalize();
    322 
    323 
    324 
    325315
    326316// #undef heightMap
     
    333323        #undef shiftZ
    334324        #undef normalVectorField
    335 
    336325}
    337326
Note: See TracChangeset for help on using the changeset viewer.