Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/height_map.cc @ 7490

Last change on this file since 7490 was 7490, checked in by patrick, 18 years ago

resuming work on the hm

  • Property svn:executable set to *
File size: 18.9 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: bottac@ee.ethz.ch
13
14   review: patrick boenzli, patrick@orxonox.ethz.ch
15*/
16
17#include "height_map.h"
18#include "model.h"
19#include "texture.h"
20#include "vector.h"
21#include "material.h"
22#include "p_node.h"
23#include "state.h"
24#include "util/loading/resource_manager.h"
25#include "debug.h"
26
27// INCLUDING SDL_Image
28#ifdef HAVE_SDL_IMAGE_H
29#include <SDL_image.h>
30#else
31#include <SDL/SDL_image.h>
32#endif
33
34
35/**
36 * default constructor
37 *  @param i1
38 */
39Tile::Tile(int i1, int j1, int i2, int j2, HeightMap* heightMapReference )
40{
41  PRINTF(4)("Tile Constructor\n");
42
43  this->highResModel = new VertexArrayModel();
44  this->lowResModel  = new VertexArrayModel();
45
46  this->heightMapReference = heightMapReference;
47
48  // create high res model
49  this->load(i1, j1, i2, j2, this->highResModel, 4);
50  // create low res model
51  this->load(i1, j1, i2, j2, this->lowResModel, 8);
52}
53
54
55Tile::~Tile()
56{
57  if( highResModel)
58    delete highResModel;
59  if( lowResModel)
60    delete lowResModel;
61}
62
63
64/**
65 * this darws the tile in diefferent resolutions
66 */
67void Tile::draw()
68{
69  // draw the tile depending on the distance from the camera with different LOD (level of details)
70  float cameraDistance = fabs((State::getCameraNode()->getAbsCoor() - Vector(this->x, heightMapReference->offsetY , this->z) ).len());
71
72  if (cameraDistance < HM_LOD_HIGH_RES )
73  {
74    this->drawHighRes();
75  }
76  else if( cameraDistance < HM_LOD_LOW_RES)
77  {
78    this->drawLowRes();
79  }
80}
81
82
83/**
84 * loads a tile
85 */
86void Tile::load(int i1, int j1, int i2, int j2, VertexArrayModel* model, int sampleRate)
87{
88
89// #define heightMap this->heightMapReference->heightMap
90#define colors   this->heightMapReference->colors
91#define scaleX this->heightMapReference->scaleX
92#define scaleY this->heightMapReference->scaleY
93#define scaleZ this->heightMapReference->scaleZ
94#define shiftX this->heightMapReference->shiftX
95#define shiftY this->heightMapReference->shiftY
96#define shiftZ this->heightMapReference->shiftZ
97#define normalVectorField this->heightMapReference->normalVectorField
98
99
100  //FIXME: OLD implementation
101  this->x = this->heightMapReference->offsetX + ( this->heightMapReference->heightMap->h - ((i1 + i2) / 2)) * scaleX;
102  this->z = this->heightMapReference->offsetZ + ((j1 + j2 ) / 2 ) * scaleZ;
103  //NEW:
104  this->setAbsCoor(this->heightMapReference->offsetX + ( this->heightMapReference->heightMap->h - ((i1 + i2) / 2)) * scaleX,
105                   0,
106                   this->heightMapReference->offsetZ + ((j1 + j2 ) / 2 ) * scaleZ);
107
108
109  float height = 0;
110  int offset = 0;
111
112  float r = 0.0;
113  float g = 0.0;
114  float b = 0.0;
115
116
117  //if( this->heightMapReference->heightMap != NULL && this->heightMapReference->heightMap->format->BitsPerPixel == 8 )
118
119  SDL_LockSurface(this->heightMapReference->heightMap);
120  SDL_LockSurface(this->heightMapReference->colorMap);
121
122  for( int i = i1 ; i <= i2  ; i +=sampleRate)
123  {
124    int w = 0;
125
126    // adjust the colors acoring to the color map
127    if( this->heightMapReference->hasColourMap)
128    {
129      r = colors[3 * w + 2 + 3 * i * (this->heightMapReference->heightMap->w)];
130      g = colors[3 * w + 1 + 3 * i * (this->heightMapReference->heightMap->w)];
131      b = colors[3 * w + 0 + 3 * i * (this->heightMapReference->heightMap->w)];
132    }
133
134    w = j1;
135    model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i)+ shiftX,shiftY,scaleZ*(w)+ shiftZ); // Top Right
136    model->addNormal(normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].y,normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].z,normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].x);
137    model->addTexCoor((float)(j1-sampleRate) /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));
138
139    model->addColor(r/255.0,g/255.0,b/255.0);
140
141    for(int j = j1  ; j <= j2    ;  j += sampleRate)
142    {
143
144
145      // To be fixed
146      if(this->heightMapReference->hasColourMap)
147      {
148        r = colors[(3*j+2 + 3*i*(this->heightMapReference->heightMap->w )) ];
149        g =  colors[(3*j+1 + 3*i*(this->heightMapReference->heightMap->w)) ];
150        b =  colors[(3*j+0 + 3*i*(this->heightMapReference->heightMap->w))];
151      }
152      height = (float)(unsigned char) this->heightMapReference->heights[(j +sampleRate+ i*(this->heightMapReference->heightMap->w )) ];
153      height += (float)(unsigned char) this->heightMapReference->heights[(j+ 1 + sampleRate + (i+1)*(this->heightMapReference->heightMap->w )) ];
154      height +=  (float) (unsigned char) this->heightMapReference->heights[(j -1+ sampleRate   + (i+1)*(this->heightMapReference->heightMap->w ))];
155      height +=  (float)(unsigned char)this->heightMapReference->heights[(j +sampleRate+ (i+2)*(this->heightMapReference->heightMap->w )) ];
156      height +=  (float)(unsigned char)this->heightMapReference->heights[(j+sampleRate + (i)*(this->heightMapReference->heightMap->w )) ];
157      height=height/5.0;
158
159      model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX ,((double)(height)*scaleY) + shiftY ,scaleZ*(j) + shiftZ); // Top Right
160      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);
161      model->addTexCoor((float)(j) /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));
162
163      //PRINTF(0)("TexCoord:  %f %f \n",(float)j / 100.0, (float)(i %this->heightMapReference->h)/100.0);
164
165      model->addColor(r/255.0,g/255.0,b/255.0);
166      w = j;
167    }
168
169
170    model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i)+ shiftX,shiftY,scaleZ*(w)+ shiftZ); // Top Right
171    model->addNormal(normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].y,normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].z,normalVectorField[i% this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].x);
172    model->addTexCoor((float)(j2+sampleRate) /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));
173    model->addColor(r/255.0,g/255.0,b/255.0);
174
175  }
176
177
178
179
180
181  SDL_UnlockSurface(this->heightMapReference->heightMap);
182  int cnt = 0;
183  for(int i = i1   ; i < i2  ; i +=sampleRate)
184  {
185
186    for(int j = j1-sampleRate  ; j < j2  + 2*sampleRate  ;  j += sampleRate)
187    {
188
189      model->addIndice(cnt);
190      model->addIndice(cnt  + (j2 -j1 + 3* sampleRate  )/ sampleRate );
191      cnt++;
192
193    }
194
195
196
197    model->newStripe();
198
199
200  }
201  cnt += (j2 -j1 + 3* sampleRate)/ sampleRate;
202
203  for(int j = j1 ; j <= j2    ;  j += sampleRate)
204  {
205    int i = i1;
206
207    // To be fixed
208    if(this->heightMapReference->hasColourMap)
209    {
210      r = (float)colors[(3*j+2 + 3*i*(this->heightMapReference->heightMap->w )) ];
211      g = (float)colors[(3*j+1 + 3*i*(this->heightMapReference->heightMap->w)) ];
212      b = (float)colors[(3*j+0 + 3*i*(this->heightMapReference->heightMap->w))];
213    }
214
215    model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX , shiftY ,scaleZ*(j) + shiftZ); // Top Right
216    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);
217    model->addTexCoor((float)j /(texRate), (float)((i - sampleRate) %this->heightMapReference->heightMap->h)/(texRate));
218    model->addColor(r/255.0,g/255.0,b/255.0);
219
220  }
221
222  for(int j = j1  ; j <= j2    ;  j += sampleRate)
223  {
224    int i = i1;
225    height = (float)(unsigned char) this->heightMapReference->heights[(j +sampleRate+ i*(this->heightMapReference->heightMap->w )) ];
226    height += (float)(unsigned char) this->heightMapReference->heights[(j+ 1 + sampleRate + (i+1)*(this->heightMapReference->heightMap->w )) ];
227    height +=  (float) (unsigned char) this->heightMapReference->heights[(j -1+ sampleRate   + (i+1)*(this->heightMapReference->heightMap->w ))];
228    height +=  (float)(unsigned char)this->heightMapReference->heights[(j +sampleRate+ (i+2)*(this->heightMapReference->heightMap->w )) ];
229    height +=  (float)(unsigned char)this->heightMapReference->heights[(j+sampleRate + (i)*(this->heightMapReference->heightMap->w )) ];
230    height=height/5.0;
231
232    model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX , ((double)(height)*scaleY) +shiftY ,scaleZ*(j) + shiftZ); // Top Right
233    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);
234    model->addTexCoor((float)j /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));
235    model->addColor(r/255.0,g/255.0,b/255.0);
236
237  }
238
239
240
241  for(int j = j1  ; j <= j2    ;  j += sampleRate)
242  {
243    int i = i2;
244
245    // To be fixed
246    if(this->heightMapReference->hasColourMap)
247    {
248      r = (float)colors[3*j+2 + 3*i*(this->heightMapReference->heightMap->w )];
249      g = (float)colors[3*j+1 + 3*i*(this->heightMapReference->heightMap->w)];
250      b = (float)colors[3*j+0 + 3*i*(this->heightMapReference->heightMap->w)];
251    }
252
253    model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX , shiftY ,scaleZ*(j) + shiftZ); // Top Right
254    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);
255    model->addTexCoor((float)j /(texRate), (float)((i+ sampleRate) %this->heightMapReference->heightMap->h)/(texRate));
256    model->addColor(r/255.0,g/255.0,b/255.0);
257
258  }
259
260
261  for(int j = j1 ; j <= j2    ;  j += sampleRate)
262  {
263    int i = i2;
264    height = (float)(unsigned char) this->heightMapReference->heights[(j +sampleRate+ i*(this->heightMapReference->heightMap->w )) ];
265    height += (float)(unsigned char) this->heightMapReference->heights[(j+ 1 + sampleRate + (i+1)*(this->heightMapReference->heightMap->w )) ];
266    height +=  (float) (unsigned char) this->heightMapReference->heights[(j -1+ sampleRate   + (i+1)*(this->heightMapReference->heightMap->w ))];
267    height +=  (float)(unsigned char)this->heightMapReference->heights[(j +sampleRate+ (i+2)*(this->heightMapReference->heightMap->w ))];
268    height +=  (float)(unsigned char)this->heightMapReference->heights[(j+sampleRate + (i)*(this->heightMapReference->heightMap->w )) ];
269    height=height/5.0;
270    model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX , ((double)(height)*scaleY) +shiftY ,scaleZ*(j) + shiftZ); // Top Right
271    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);
272    model->addTexCoor((float)j /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));
273    model->addColor(r/255.0,g/255.0,b/255.0);
274
275  }
276
277
278
279
280  // link Boarder Stripe
281  for(int j = j1-sampleRate  ; j < j2    ;  j += sampleRate)
282  {
283
284    model->addIndice(cnt);
285    model->addIndice(cnt  + (j2 -j1 +  sampleRate  )/ sampleRate );
286    cnt++;
287
288  }
289
290  cnt++;
291
292  model->newStripe();
293
294
295
296
297
298  cnt += (j2-j1)/ sampleRate;
299
300  // link 2nd BoarderStripe
301  for(int j = j1-sampleRate  ; j < j2    ;  j += sampleRate)
302  {
303
304    model->addIndice(cnt);
305    model->addIndice(cnt  + (j2 -j1 +  sampleRate  )/ sampleRate );
306    cnt++;
307
308  }
309
310
311  SDL_UnlockSurface(this->heightMapReference->colorMap);
312
313  model->finalize();
314
315
316
317
318// #undef heightMap
319        #undef colors
320        #undef scaleX
321        #undef scaleY
322        #undef scaleZ
323        #undef shiftX
324        #undef shiftY
325        #undef shiftZ
326        #undef normalVectorField
327
328}
329
330
331HeightMap::HeightMap()
332{
333}
334
335
336HeightMap::HeightMap(const std::string& height_map_name = "")
337    : VertexArrayModel()
338{
339  this->setClassID(CL_HEIGHT_MAP, "HeightMap");
340  heightMap =  IMG_Load(height_map_name.c_str());
341  if(heightMap!=NULL)
342  {
343
344    PRINTF(0)("loading Image %s\n", height_map_name.c_str());
345    PRINTF(0)("width : %i\n", heightMap->w);
346    PRINTF(0)("height : %i\n", heightMap->h);
347    PRINTF(0)("%i Byte(s) per Pixel \n", heightMap->format->BytesPerPixel);
348    PRINTF(0)("Rshift : %i\n", heightMap->format->Rshift);
349    PRINTF(0)("Bshift: %i\n", heightMap->format->Bshift);
350    PRINTF(0)("Gshift: %i\n", heightMap->format->Gshift);
351    PRINTF(0)("Rmask: %i\n", heightMap->format->Rmask);
352    PRINTF(0)("Gmask: %i\n", heightMap->format->Gmask);
353  }
354
355  else
356    PRINTF(4)("oops! couldn't load %s for some reason.\n", height_map_name.c_str());
357
358
359  generateNormalVectorField();
360
361  shiftX = 0;
362  shiftY = 0;
363  shiftZ = 0;
364
365}
366
367HeightMap::HeightMap(const std::string& height_map_name = NULL, const std::string& color_map_name = NULL)
368    : VertexArrayModel()
369{
370  this->setClassID(CL_HEIGHT_MAP, "HeightMap");
371
372  heightMap =  IMG_Load(height_map_name.c_str());
373  if(heightMap!=NULL)
374  {
375
376    PRINTF(0)("loading Image %s\n", height_map_name.c_str());
377    PRINTF(0)("width : %i\n", heightMap->w);
378    PRINTF(0)("height : %i\n", heightMap->h);
379    PRINTF(0)("%i Byte(s) per Pixel \n", heightMap->format->BytesPerPixel);
380    PRINTF(0)("Rshift : %i\n", heightMap->format->Rshift);
381    PRINTF(0)("Bshift: %i\n", heightMap->format->Bshift);
382    PRINTF(0)("Gshift: %i\n", heightMap->format->Gshift);
383    PRINTF(0)("Rmask: %i\n", heightMap->format->Rmask);
384    PRINTF(0)("Gmask: %i\n", heightMap->format->Gmask);
385  }
386
387  else
388    PRINTF(4)("oops! couldn't load %s for some reason.\n", height_map_name.c_str());
389
390
391  generateNormalVectorField();
392
393  colorMap=NULL;
394  if(color_map_name != "")
395  {
396    colorMap = IMG_Load(color_map_name.c_str());
397  }
398
399  if(colorMap != NULL)
400  {
401    PRINTF(0)("loading Image %s\n", color_map_name.c_str());
402    PRINTF(0)("width : %i\n", colorMap->w);
403    PRINTF(0)("height : %i\n", colorMap->h);
404    PRINTF(0)("%i Byte(s) per Pixel \n", colorMap->format->BytesPerPixel);
405    PRINTF(0)("Rshift : %i\n", colorMap->format->Rshift);
406    PRINTF(0)("Bshift: %i\n", colorMap->format->Bshift);
407    PRINTF(0)("Gshift: %i\n", colorMap->format->Gshift);
408    PRINTF(0)("Rmask: %i\n", colorMap->format->Rmask);
409    PRINTF(0)("Gmask: %i\n", colorMap->format->Gmask);
410  }
411  else
412    PRINTF(0)("oops! couldn't load colorMap for some reason.\n");
413
414
415
416  if(colorMap != NULL)
417  {
418    colors = (unsigned char *) colorMap->pixels;
419    hasColourMap = true;
420  }
421  else
422    hasColourMap = false;
423
424
425  heights  = (unsigned char*) heightMap->pixels;
426  shiftX = 0;
427  shiftY = 0;
428  shiftZ = 0;
429}
430
431
432HeightMap::~HeightMap()
433{
434  delete heightMap;
435  delete colorMap;
436
437
438  for(int i=0;i <    heightMap->h/tileSize ; i++)
439  {
440    for(int j = 0; j < heightMap->w/ tileSize; j++)
441    {
442      delete tiles [i][j];
443    }
444  }
445  for(int i=0;i <    heightMap->h/tileSize ; i++)
446    delete[] tiles[i];
447  delete[] tiles;
448
449
450
451
452
453  for(int i=0;i<heightMap->h;i++)
454    delete[] normalVectorField [i];
455  delete[] normalVectorField;
456
457
458
459
460
461
462
463}
464
465void HeightMap::load()
466{
467
468  //Create a Dynamicly sized 2D-Array for Tiles
469  tiles =  new Tile** [heightMap->h/tileSize];
470  for(int i=0;i <    heightMap->h/tileSize ; i++)
471    tiles [i]= new (Tile* [heightMap->w /tileSize ]);
472
473  //SetUp Arrays
474  for(int i = 0; i < (heightMap->)/ tileSize; i ++)
475  {
476    for(int j = 0; j < (heightMap->w )/ tileSize; j ++)
477    {
478
479      tiles[i][j] =    new Tile( i*tileSize ,  j*tileSize , (i+1)*tileSize, (j+1)*tileSize , this ) ;
480    }
481  }
482
483}
484
485
486void HeightMap::draw()
487{
488  const PNode* camera = State::getCameraNode();
489  Vector v = camera->getAbsCoor();
490
491  int i_min = 0;
492  int i_max = (heightMap->h )/ tileSize;
493  int j_min = 0;
494  int j_max= (heightMap->) / tileSize;
495
496
497
498  for(int i = 0; i <  i_max        ; i ++)
499  {
500    for(int j = 0; j < j_max ; j++)
501    {
502      tiles[i][j]->draw();
503    }
504  }
505
506}
507void HeightMap::generateNormalVectorField()
508{
509  int delta = 1;
510  heights  = (unsigned char*) heightMap->pixels;
511
512  //Create a Dynamicly sized 2D-Array to store our normals
513  normalVectorField =  new Vector* [heightMap->h];
514  for(int i=0;i<heightMap->h;i++)
515    normalVectorField [i]= new (Vector [heightMap->w]);
516
517
518
519
520  // Initialize
521  for(int i=0; i< heightMap->h; i++)
522  {
523    for(int j = 0; j> heightMap->w; j++)
524    {
525      Vector v = Vector(0.0, 1.0, 0.0);
526      normalVectorField[i][j] = v;
527    }
528  }
529
530  // !!! Does not yet calculate the normals of some border points!!!!!
531
532  if(heightMap != NULL && heightMap->format->BitsPerPixel == 8 )
533  {
534    SDL_LockSurface(heightMap);
535    for(int i = 0 ; i < heightMap->h - 1  ; i ++)
536    {
537      for(int j = 0; j < heightMap->- 1  ;  j ++)
538      {
539
540
541        delta = (int)heights[j + (i+1)*(heightMap->w )] -  (int) heights[j + i*(heightMap->w )];
542        Vector a =  Vector(-scaleX,(float)delta*scaleY  ,0.0f);
543
544        delta = (int)heights[j+1 + i*(heightMap->w )] - (int)heights[j + i*(heightMap->w )];
545        Vector b =  Vector(0.0f,(float) delta*scaleY ,scaleZ);
546
547
548        normalVectorField[i][j] = b.cross(a);
549        normalVectorField[i][j].normalize();
550
551      }
552    }
553    SDL_UnlockSurface(heightMap);
554
555  }
556
557
558
559
560}
561
562
563void HeightMap::scale(Vector v)
564{
565  scaleX = v.x;
566  scaleY = v.y;
567  scaleZ = v.z;
568  generateNormalVectorField();
569}
570
571void HeightMap::setAbsCoor(Vector v)
572{
573  offsetX = v.x;
574  offsetY = v.y;
575  offsetZ  = v.z;
576}
577
578
579float HeightMap::getHeight(float x, float y)
580{
581
582  x -= offsetX;
583  y -= offsetZ;
584
585
586  int xInt = (int)x / scaleX;
587  x -= (float)((int)x);
588  xInt = heightMap->h - xInt;
589  int yInt = (int)y / scaleZ;
590  y -= (float) ((int) y); /*yInt = heightMap->w - yInt;*/
591
592  //PRINTF(0)("xInt: %i, yInt: %i, x: %f, y: %f\n", xInt, yInt, x, y);
593
594  if(xInt <= 0 || xInt >= heightMap->h || yInt <= 0 || yInt >= heightMap->)
595    return 0;
596  if( y >= 0.5*x)
597  {
598    // Check for ...
599  }
600
601  float height = heights[yInt + (xInt)*heightMap->w]*scaleY;
602
603
604  float a = normalVectorField[(xInt)][yInt].x;
605  float b = normalVectorField [(xInt)][yInt].z;
606  float c = normalVectorField [(xInt)][yInt].y;
607
608  PRINTF(0)("a: %f \n" ,a);
609  PRINTF(0)("b: %f \n" ,b);
610  PRINTF(0)("c: %f \n" ,c);
611
612  height -= ( (a/c)*(x) + (b/c)*(y));
613
614  PRINTF(0)("height: %f \n" ,height );
615  return (height + offsetZ);
616}
Note: See TracBrowser for help on using the repository browser.