Changeset 5684 for anuga_work/development/anugavis/src/height_quantity.cc
- Timestamp:
- Aug 26, 2008, 10:50:42 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anugavis/src/height_quantity.cc
r5636 r5684 16 16 #include <netcdf.h> 17 17 #include "height_quantity.hh" 18 #include "vector.hh" 18 19 19 20 using std::string; … … 63 64 size_t span_2[2] = {1, 0}; 64 65 int ncstatus; 65 int volume;66 int vertex;67 66 int vertIndex; 68 67 if(this->dynamic){ … … 78 77 if(ncstatus != NC_NOERR) throw nc_strerror(ncstatus); 79 78 glNewList(this->display_list, GL_COMPILE); 80 glBegin(GL_TRIANGLES); 81 { 82 83 for(volume = 0 ; volume = this->sww_file->number_of_volumes ; ++volume){ 84 for(vertex = 0 ; vertex < 3 ; ++vertex){ 79 glBegin(GL_TRIANGLES);{ 80 for(int volume = 0 ; volume = this->sww_file->number_of_volumes ; ++volume){ 81 /* Compute normal. */ 82 Vector vs[3]; 83 for(int vertex = 0 ; vertex < 3 ; ++vertex){ 84 int offset = volume * this->sww_file->number_of_vertices + vertex; 85 vertIndex = this->sww_file->volumes[offset]; 86 vs[vertex] = Vector(this->sww_file->x[vertIndex], 87 this->sww_file->y[vertIndex], 88 this->points [vertIndex]); 89 } 90 Vector normal = (vs[1] - vs[0]).cross(vs[2] - vs[0]); 91 if(normal.magnitude() < 0) normal = normal.scale(-1.0); 92 glNormal3f(normal.x, normal.y, normal.z); 93 94 /* Insert vertices. */ 95 for(int vertex = 0 ; vertex < 3 ; ++vertex){ 85 96 vertIndex = this->sww_file->volumes[volume * 86 97 this->sww_file->number_of_vertices + … … 91 102 } 92 103 } 93 } 94 glEnd(); 104 }glEnd(); 95 105 glEndList(); 96 106 }
Note: See TracChangeset
for help on using the changeset viewer.