Changeset 1000 for trunk/vizservers/nanovis/HeightMap.cpp
- Timestamp:
- May 5, 2008, 3:05:29 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vizservers/nanovis/HeightMap.cpp
r932 r1000 20 20 double HeightMap::valueMax = 1.0; 21 21 22 #define TOPCONTOUR 22 23 HeightMap::HeightMap() : 23 24 _vertexBufferObjectID(0), … … 25 26 _vertexCount(0), 26 27 _contour(0), 28 _topContour(0), 27 29 _colorMap(0), 28 30 _indexBuffer(0), 29 31 _indexCount(0), 30 32 _contourColor(1.0f, 0.0f, 0.0f), 31 _contourVisible(true), 33 _contourVisible(false), 34 _topContourVisible(true), 32 35 _visible(false), 33 36 _scale(1.0f, 1.0f, 1.0f), … … 92 95 93 96 if (_colorMap) { 97 // PUT vertex program here 98 // 99 // 100 94 101 cgGLBindProgram(_shader->getFP()); 95 102 cgGLEnableProfile(CG_PROFILE_FP30); … … 110 117 ::glTexCoordPointer(3, GL_FLOAT, 12, 0); 111 118 119 #define _TRIANGLES_ 120 #ifdef _TRIANGLES_ 112 121 glDrawElements(GL_TRIANGLES, _indexCount, GL_UNSIGNED_INT, 113 122 _indexBuffer); 123 #else 124 glDrawElements(GL_QUADS, _indexCount, GL_UNSIGNED_INT, 125 _indexBuffer); 126 #endif 127 114 128 glBindBuffer(GL_ARRAY_BUFFER, 0); 115 129 … … 126 140 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 127 141 128 if (_contour && _contourVisible) { 129 glDisable(GL_BLEND); 130 glDisable(GL_TEXTURE_2D); 131 glColor4f(_contourColor.x, _contourColor.y, _contourColor.z, 1.0f); 132 glDepthRange (0.0, 0.999); 133 _contour->render(); 134 glDepthRange (0.0, 1.0); 142 if (_contour) { 143 if (_contourVisible) { 144 glDisable(GL_BLEND); 145 glDisable(GL_TEXTURE_2D); 146 glColor4f(_contourColor.x, _contourColor.y, _contourColor.z, 1.0f); 147 glDepthRange (0.0, 0.999); 148 _contour->render(); 149 glDepthRange (0.0, 1.0); 150 } 151 152 #ifdef TOPCONTOUR 153 if (_topContourVisible) { 154 glDisable(GL_BLEND); 155 glDisable(GL_TEXTURE_2D); 156 glColor4f(_contourColor.x, _contourColor.y, _contourColor.z, 1.0f); 157 //glDepthRange (0.0, 0.999); 158 _topContour->render(); 159 //glDepthRange (0.0, 1.0); 160 } 161 #endif 135 162 } 136 163 glPopMatrix(); … … 149 176 int boundaryHeight = zCount - 1; 150 177 int* ptr = indexBuffer; 151 int index1, index2, index3, index4;178 int index1, index2, index3, index4; 152 179 bool index1Valid, index2Valid, index3Valid, index4Valid; 153 180 index1Valid = index2Valid = index3Valid = index4Valid = true; … … 166 193 if (isnan(heights[index4])) index4Valid = false; 167 194 195 #ifdef _TRIANGLES_ 168 196 if (index1Valid && index2Valid && index3Valid) { 169 197 *ptr = index1; ++ptr; … … 178 206 ++ic; 179 207 } 208 #else 209 if (index1Valid && index2Valid && index3Valid && index4Valid) { 210 *ptr = index1; ++ptr; 211 *ptr = index2; ++ptr; 212 *ptr = index3; ++ptr; 213 *ptr = index4; ++ptr; 214 ++ic; 215 } 216 #endif 180 217 } 181 218 } … … 266 303 _contour = lineFilter.create(0.0f, 1.0f, 10, heights, xCount, yCount); 267 304 305 #ifdef TOPCONTOUR 306 ContourLineFilter topLineFilter; 307 topLineFilter.setHeightTop(true); 308 _topContour = topLineFilter.create(0.0f, 1.0f, 10, heights, xCount, yCount); 309 #endif 310 268 311 //if (heightMap) 269 312 //{ … … 336 379 _contour = lineFilter.create(0.0f, 1.0f, 10, heightMap, xCount, yCount); 337 380 381 #ifdef TOPCONTOUR 382 ContourLineFilter topLineFilter; 383 topLineFilter.setHeightTop(true); 384 _topContour = topLineFilter.create(0.0f, 1.0f, 10, heightMap, xCount, yCount); 385 #endif 386 387 338 388 //if (heightMap) 339 389 //{
Note: See TracChangeset
for help on using the changeset viewer.