Changeset 3492 for trunk/packages/vizservers/nanovis/ContourLineFilter.cpp
- Timestamp:
- Mar 13, 2013, 9:57:03 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/ContourLineFilter.cpp
r3465 r3492 15 15 16 16 using namespace nv::graphics; 17 using namespace vrmath; 17 18 18 19 ContourLineFilter::ContourLineFilter() … … 34 35 Geometry * 35 36 ContourLineFilter::create(float min, float max, int linecount, 36 Vector3 * vertices, int width, int height)37 Vector3f* vertices, int width, int height) 37 38 { 38 39 _lines.clear(); … … 53 54 } 54 55 } 55 Vector3 * vertexSet = (Vector3 *)malloc(sizeof(Vector3) * totalPoints);56 Vector3 * colorSet = NULL;56 Vector3f* vertexSet = (Vector3f *)malloc(sizeof(Vector3f) * totalPoints); 57 Vector3f* colorSet = NULL; 57 58 if (_colorMap) { 58 colorSet = (Vector3 *)malloc(sizeof(Vector3) * totalPoints);59 colorSet = (Vector3f *)malloc(sizeof(Vector3f) * totalPoints); 59 60 } 60 61 ContourLineFilter::ContourLineList::iterator iter; 61 62 unsigned int index = 0, colorIndex = 0; 62 63 for (iter = _lines.begin(); iter != _lines.end(); ++iter, ++colorIndex) { 63 std::list<Vector3 >& lines = (*iter)->_points;64 std::list<Vector3 >::iterator iter2;64 std::list<Vector3f>& lines = (*iter)->_points; 65 std::list<Vector3f>::iterator iter2; 65 66 for (iter2 = lines.begin(); iter2 != lines.end(); ++iter2, ++index) { 66 67 if (_colorMap && (colorIndex < _colorMap->size())) { … … 74 75 VertexBuffer *vertexBuffer = 75 76 new VertexBuffer(VertexBuffer::POSITION3, totalPoints, 76 totalPoints * sizeof(Vector3 ), vertexSet, false);77 totalPoints * sizeof(Vector3f), vertexSet, false); 77 78 VertexBuffer *colorBuffer = NULL; 78 79 if (_colorMap) { 79 80 colorBuffer = 80 81 new VertexBuffer(VertexBuffer::COLOR4, totalPoints, 81 totalPoints * sizeof(Vector3 ), colorSet, false);82 totalPoints * sizeof(Vector3f), colorSet, false); 82 83 } 83 84 Geometry *geometry = new Geometry(Geometry::LINES, vertexBuffer, colorBuffer, 0); … … 88 89 Geometry * 89 90 ContourLineFilter::create(float min, float max, int linecount, 90 Vector4 * vertices, int width, int height)91 Vector4f* vertices, int width, int height) 91 92 { 92 93 _lines.clear(); … … 108 109 } 109 110 } 110 Vector3 * vertexSet = (Vector3 *)malloc(sizeof(Vector3) * totalPoints);111 Vector3 * colorSet = (Vector3 *)malloc(sizeof(Vector3) * totalPoints);111 Vector3f* vertexSet = (Vector3f *)malloc(sizeof(Vector3f) * totalPoints); 112 Vector3f* colorSet = (Vector3f *)malloc(sizeof(Vector3f) * totalPoints); 112 113 113 114 ContourLineFilter::ContourLineList::iterator iter; 114 115 unsigned int index = 0, colorIndex = 0; 115 116 for (iter = _lines.begin(); iter != _lines.end(); ++iter, ++colorIndex) { 116 std::list<Vector3 >& lines = (*iter)->_points;117 std::list<Vector3 >::iterator iter2;117 std::list<Vector3f>& lines = (*iter)->_points; 118 std::list<Vector3f>::iterator iter2; 118 119 for (iter2 = lines.begin(); iter2 != lines.end(); ++iter2, ++index) { 119 120 if (_colorMap && (colorIndex < _colorMap->size())) { … … 128 129 VertexBuffer *vertexBuffer = 129 130 new VertexBuffer(VertexBuffer::POSITION3, totalPoints, 130 totalPoints * sizeof(Vector3 ), vertexSet, false);131 totalPoints * sizeof(Vector3f), vertexSet, false); 131 132 VertexBuffer *colorBuffer = 132 133 new VertexBuffer(VertexBuffer::COLOR4, totalPoints, 133 totalPoints * sizeof(Vector3 ), colorSet, false);134 totalPoints * sizeof(Vector3f), colorSet, false); 134 135 Geometry *geometry = 135 136 new Geometry(Geometry::LINES, vertexBuffer, colorBuffer, 0); … … 147 148 int 148 149 ContourLineFilter::ContourLine::createLine(int width, int height, 149 Vector3 * vertices, bool top)150 Vector3f* vertices, bool top) 150 151 { 151 152 _points.clear(); … … 182 183 int 183 184 ContourLineFilter::ContourLine::createLine(int width, int height, 184 Vector4 * vertices, bool top)185 Vector4f* vertices, bool top) 185 186 { 186 187 _points.clear(); … … 218 219 void 219 220 ContourLineFilter::ContourLine::getContourPoint(int vertexIndex1, 220 int vertexIndex2, Vector3 * vertices, int width, bool top)221 int vertexIndex2, Vector3f* vertices, int width, bool top) 221 222 { 222 223 float diff = vertices[vertexIndex2].y - vertices[vertexIndex1].y; … … 226 227 } 227 228 228 Vector3 p;229 Vector3f p; 229 230 p.x = vertices[vertexIndex1].x + t * 230 231 (vertices[vertexIndex2].x - vertices[vertexIndex1].x); … … 247 248 void 248 249 ContourLineFilter::ContourLine::getContourPoint(int vertexIndex1, 249 int vertexIndex2, Vector4 * vertices, int width, bool top)250 int vertexIndex2, Vector4f* vertices, int width, bool top) 250 251 { 251 252 float diff = vertices[vertexIndex2].y - vertices[vertexIndex1].y; … … 255 256 } 256 257 257 Vector3 p;258 Vector3f p; 258 259 p.x = vertices[vertexIndex1].x + 259 260 t * (vertices[vertexIndex2].x - vertices[vertexIndex1].x); … … 275 276 276 277 void 277 ContourLineFilter::setColorMap(Vector3 Array* colorMap)278 ContourLineFilter::setColorMap(Vector3fArray* colorMap) 278 279 { 279 280 if (colorMap == _colorMap) { … … 289 290 290 291 if (colorMap && colorMap->size()) { 291 _colorMap = new Vector3 Array(colorMap->size());292 _colorMap = new Vector3fArray(colorMap->size()); 292 293 _colorMap->assign(colorMap->begin(), colorMap->end()); 293 294 } else {
Note: See TracChangeset
for help on using the changeset viewer.