Changeset 780 for trunk/vizservers
- Timestamp:
- Jul 10, 2007, 7:55:13 AM (17 years ago)
- Location:
- trunk/vizservers/nanovis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vizservers/nanovis/ContourLineFilter.cpp
r776 r780 52 52 53 53 Vector3* vertexSet = (Vector3*) malloc(sizeof(Vector3) * totalNumOfPoints); 54 Vector3* colorSet = (Vector3*) malloc(sizeof(Vector3) * totalNumOfPoints); 54 Vector3* colorSet = 0; 55 if (_colorMap) 56 { 57 colorSet = (Vector3*) malloc(sizeof(Vector3) * totalNumOfPoints); 58 } 55 59 56 60 ContourLineFilter::ContourLineList::iterator iter; … … 68 72 else 69 73 { 70 colorSet[index].set((*iter)->_value, (*iter)->_value, (*iter)->_value);74 //colorSet[index].set((*iter)->_value, (*iter)->_value, (*iter)->_value); 71 75 } 72 76 vertexSet[index] = (*iter2); … … 76 80 R2VertexBuffer* vertexBuffer = new R2VertexBuffer(R2VertexBuffer::POSITION3, totalNumOfPoints, 77 81 totalNumOfPoints * sizeof(Vector3), vertexSet, false); 78 R2VertexBuffer* colorBuffer = new R2VertexBuffer(R2VertexBuffer::COLOR4, totalNumOfPoints, 82 R2VertexBuffer* colorBuffer = 0; 83 R2Geometry* geometry = 0; 84 if (_colorMap) 85 { 86 colorBuffer = new R2VertexBuffer(R2VertexBuffer::COLOR4, totalNumOfPoints, 79 87 totalNumOfPoints * sizeof(Vector3), colorSet, false); 80 R2Geometry* geometry = new R2Geometry(R2Geometry::LINES, vertexBuffer, colorBuffer, 0); 88 } 89 90 geometry = new R2Geometry(R2Geometry::LINES, vertexBuffer, colorBuffer, 0); 81 91 82 92 clear(); -
trunk/vizservers/nanovis/HeightMap.cpp
r779 r780 11 11 HeightMap::HeightMap() 12 12 : _contour(0), _colorMap(0), _indexBuffer(0), _vertexBufferObjectID(0), _vertexCount(0), _textureBufferObjectID(0), 13 _contourVisible(true), _scale(1.0f, 1.0f, 1.0f), _contourColor( 0.0f, 0.0f, 0.0f)13 _contourVisible(true), _scale(1.0f, 1.0f, 1.0f), _contourColor(1.0f, 0.0f, 0.0f) 14 14 { 15 15 _shader = new NvShader(); -
trunk/vizservers/nanovis/HeightMap.h
r776 r780 44 44 bool isVisible() const; 45 45 void setLineContourVisible(bool visible); 46 void setLineContourColor(float r, float g, float b); 46 47 }; 47 48 … … 61 62 } 62 63 64 inline void HeightMap::setLineContourColor(float r, float g, float b) 65 { 66 _contourColor.x = r; 67 _contourColor.y = g; 68 _contourColor.z = b; 69 } 63 70 #endif -
trunk/vizservers/nanovis/R2/src/R2Geometry.cpp
r776 r780 20 20 void R2Geometry::render() 21 21 { 22 //glDisableClientState(GL_NORMAL_ARRAY); 23 //glDisableClientState(GL_TEXTURE_COORD_ARRAY); 22 24 glEnableClientState(GL_VERTEX_ARRAY); 23 25 glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer->getGraphicObjectID()); -
trunk/vizservers/nanovis/nanovis.cpp
r779 r780 1125 1125 srand( (unsigned)time( NULL ) ); 1126 1126 int size = 20 * 20; 1127 float sigma = 5.0f; 1128 float mean = exp(0.0f) / (sigma * sqrt(2.0f)); 1127 1129 float* data = (float*) malloc(sizeof(float) * size); 1130 1131 float x; 1128 1132 for (int i = 0; i < size; ++i) 1129 1133 { 1130 data[i] = rand() * 1.0f / RAND_MAX; 1134 x = - 10 + i%20; 1135 data[i] = exp(- (x * x)/(2 * sigma * sigma)) / (sigma * sqrt(2.0f)) / mean; 1131 1136 } 1132 1137 … … 1195 1200 } 1196 1201 } 1202 return TCL_OK; 1203 } 1204 else if (strcmp(argv[2],"color") == 0) 1205 { 1206 double r, g, b; 1207 if ((Tcl_GetDouble(interp, argv[3], &r) == TCL_OK) && 1208 (Tcl_GetDouble(interp, argv[4], &g) == TCL_OK) && 1209 (Tcl_GetDouble(interp, argv[5], &b) == TCL_OK)) { 1210 r = r / 255.0; 1211 g = g / 255.0; 1212 b = b / 255.0; 1213 } 1214 else 1215 { 1216 return TCL_ERROR; 1217 } 1218 1219 vector<int> indices; 1220 if (GetIndices(interp, argc-6, argv+6, &indices) != TCL_OK) 1221 { 1222 return TCL_ERROR; 1223 } 1224 for (int i = 0; i < indices.size(); ++i) 1225 { 1226 if ((indices[i] < g_heightMap.size()) && (g_heightMap[indices[i]] != NULL)) 1227 { 1228 g_heightMap[indices[i]]->setLineContourColor(r, g, b); 1229 } 1230 } 1231 1197 1232 return TCL_OK; 1198 1233 }
Note: See TracChangeset
for help on using the changeset viewer.