Changeset 837 for trunk/vizservers/nanovis/HeightMap.cpp
- Timestamp:
- Jan 2, 2008 11:00:15 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vizservers/nanovis/HeightMap.cpp
r835 r837 15 15 16 16 HeightMap::HeightMap() 17 : _contour(0), _colorMap(0), _indexBuffer(0), _vertexBufferObjectID(0), _vertexCount(0), _textureBufferObjectID(0), 18 _contourVisible(true), _scale(1.0f, 1.0f, 1.0f), _contourColor(1.0f, 0.0f, 0.0f) 17 : _contour(0), _colorMap(0), _indexBuffer(0), _indexCount(0), _vertexBufferObjectID(0), _vertexCount(0), 18 _textureBufferObjectID(0), _contourVisible(true), _scale(1.0f, 1.0f, 1.0f), _contourColor(1.0f, 0.0f, 0.0f), _visible(false), 19 _vmin(0.0f), _vmax(0.0f), _centerPoint(0.0f, 0.0f, 0.0f) 19 20 { 20 21 _shader = new NvShader(); … … 42 43 { 43 44 glPushMatrix(); 44 glScalef(_scale.x, _scale.y, _scale.z); 45 glTranslatef(-0.5f, -0.5f, -0.5f); 45 46 if (_scale.x != 0) 47 { 48 glScalef(1 / _scale.x, 1 / _scale.x , 1 / _scale.x); 49 } 50 51 glTranslatef(-_centerPoint.x, - _centerPoint.y, - _centerPoint.z); 52 46 53 if (_contour) 47 54 { … … 208 215 if (_vmin > heights[i].y) { 209 216 _vmin = heights[i].y; 210 } else if (_vmax < heights[i].y) { 217 } 218 if (_vmax < heights[i].y) { 211 219 _vmax = heights[i].y; 212 220 } 213 221 } 222 223 _scale.x = 1.0f; 224 _scale.z = _vmax - _vmin; 225 _scale.y = 1.0f; 226 227 _centerPoint.set(_scale.x * 0.5, _scale.z * 0.5 + _vmin, _scale.y * 0.5); 214 228 215 229 Vector3* texcoord = (Vector3*) malloc(count * sizeof(Vector3)); … … 259 273 { 260 274 _vertexCount = xCount * yCount; 275 261 276 reset(); 262 277 … … 266 281 if (_vmin > heights[i]) { 267 282 _vmin = heights[i]; 268 } else if (_vmax < heights[i]) { 283 } 284 285 if (_vmax < heights[i]) { 269 286 _vmax = heights[i]; 270 287 } 271 288 } 272 //_scale.x = endX - startX; 273 //_scale.y = (endY - startY) / _scale.x; 274 //_scale.z = max / _scale.z; 289 290 _scale.x = endX - startX; 291 _scale.y = _vmax - _vmin; 292 _scale.z = endY - startY; 293 294 _centerPoint.set(_scale.x * 0.5 + startX, _scale.y * 0.5 + _vmin, _scale.z * 0.5 + startY); 275 295 276 296 Vector3* texcoord = (Vector3*) malloc(count * sizeof(Vector3)); 277 for (int i = 0; i < count; ++i) { 297 for (int i = 0; i < count; ++i) 298 { 278 299 texcoord[i].set(0, 0, heights[i]); 279 300 }
Note: See TracChangeset
for help on using the changeset viewer.