- Timestamp:
- Jul 9, 2007, 4:55:19 PM (17 years ago)
- Location:
- trunk/vizservers/nanovis
- Files:
-
- 15 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vizservers/nanovis/Makefile.in
r750 r776 39 39 NvLoadFile.o NvDefaultTFData.o NvColorTableShader.o NvColorTableRenderer.o NvParticleAdvectionShader.o \ 40 40 NvEventLog.o NvParticleRenderer.o NvLIC.o NvZincBlendeReconstructor.o NvStdVertexShader.o \ 41 R2string.o R2FilePath.o R2Fonts.o R2Object.o 41 ContourLineFilter.o HeightMap.o Grid.o \ 42 R2string.o R2FilePath.o R2Fonts.o R2Object.o R2Geometry.o R2IndexBuffer.o R2VertexBuffer.o 42 43 43 44 all: nanovis … … 97 98 R2Object.o: R2/src/R2Object.cpp $(R2INC)/R2/R2Object.h 98 99 $(CC) $(CFLAGS) -o $@ -c $< 99 100 100 R2Geometry.o: R2/src/R2Geometry.cpp $(R2INC)/R2/graphics/R2Geometry.h 101 $(CC) $(CFLAGS) -o $@ -c $< 102 R2VertexBuffer.o: R2/src/R2VertexBuffer.cpp $(R2INC)/R2/graphics/R2VertexBuffer.h 103 $(CC) $(CFLAGS) -o $@ -c $< 104 R2IndexBuffer.o: R2/src/R2IndexBuffer.cpp $(R2INC)/R2/graphics/R2IndexBuffer.h 105 $(CC) $(CFLAGS) -o $@ -c $< 101 106 102 107 NvStdVertexShader.o: NvStdVertexShader.cpp NvStdVertexShader.h 108 ContourLineFilter.o: ContourLineFilter.cpp ContourLineFilter.h 109 HeightMap.o: HeightMap.cpp HeightMap.h 110 Grid.o: Grid.cpp Grid.h 103 111 NvLoadFile.o: NvLoadFile.cpp NvLoadFile.h 104 112 NvParticleAdvectionShader.o: NvParticleAdvectionShader.cpp NvParticleAdvectionShader.h -
trunk/vizservers/nanovis/Nv.cpp
r755 r776 5 5 #include "NvEventLog.h" 6 6 #include "VolumeRenderer.h" 7 #include "Grid.h" 7 8 #include <R2/R2FilePath.h> 8 9 #include <stdio.h> … … 16 17 VolumeRenderer* g_vol_render; 17 18 R2Fonts* g_fonts; 19 Grid* g_grid; 18 20 19 21 //query opengl information … … 130 132 131 133 g_fonts = new R2Fonts(); 132 // INSOO 133 //g_fonts->addFont("verdana", "verdana.fnt"); 134 //g_fonts->setFont("verdana"); 134 g_fonts->addFont("verdana", "verdana.fnt"); 135 g_fonts->setFont("verdana"); 135 136 136 137 //g_color_table_renderer = new NvColorTableRenderer(); 137 138 // INSOO 138 139 //g_color_table_renderer->setFonts(g_fonts); 140 141 g_grid = new Grid(); 142 g_grid->setFont(g_fonts); 139 143 140 144 NvInitVolumeRenderer(); -
trunk/vizservers/nanovis/NvShader.cpp
r580 r776 1 1 #include "NvShader.h" 2 #include <stdio.h> 2 3 3 4 CGcontext g_context = 0; … … 17 18 } 18 19 20 void NvShader::loadVertexProgram(const char* fileName, const char* entryPoint) 21 { 22 resetPrograms(); 23 24 printf("[%s] loading\n", fileName); 25 _cgVP = cgCreateProgramFromFile(g_context, CG_SOURCE, fileName, CG_PROFILE_VP30, 26 entryPoint, NULL); 27 28 cgGLLoadProgram(_cgVP); 29 } 30 31 void NvShader::loadFragmentProgram(const char* fileName, const char* entryPoint) 32 { 33 printf("[%s] loading\n", fileName); 34 _cgFP = cgCreateProgramFromFile(g_context, CG_SOURCE, fileName, CG_PROFILE_FP30, 35 entryPoint, NULL); 36 37 cgGLLoadProgram(_cgFP); 38 } 39 40 void NvShader::resetPrograms() 41 { 42 if (_cgVP != 0) 43 { 44 cgDestroyProgram(_cgVP); 45 } 46 47 if (_cgFP != 0) 48 { 49 cgDestroyProgram(_cgFP); 50 } 51 } -
trunk/vizservers/nanovis/NvShader.h
r580 r776 10 10 CGprogram _cgFP; 11 11 12 p rotected:12 public : 13 13 NvShader(); 14 14 15 15 public : 16 16 virtual ~NvShader(); 17 18 protected : 19 void resetPrograms(); 20 public : 21 /** 22 * @brief create a Cg vertex program and load it 23 * @param fileName the name of Cg program file 24 * @param entryPoint a entry point of the Cg program 25 */ 26 void loadVertexProgram(const char* fileName, const char* entryPoint); 27 28 /** 29 * @brief create a Cg fragment program and load it 30 * @param fileName the name of Cg program file 31 * @param entryPoint a entry point of the Cg program 32 */ 33 void loadFragmentProgram(const char* fileName, const char* entryPoint); 34 35 CGparameter getNamedParameterFromFP(const char* paramName); 36 CGparameter getNamedParameterFromVP(const char* paramName); 37 38 CGprogram getVP() const; 39 CGprogram getFP() const; 17 40 }; 18 41 19 42 extern CGcontext g_context; 20 43 44 inline CGparameter NvShader::getNamedParameterFromFP(const char* paramName) 45 { 46 if (_cgFP) 47 { 48 return cgGetNamedParameter(_cgFP, paramName); 49 } 50 51 return 0; 52 } 53 54 inline CGparameter NvShader::getNamedParameterFromVP(const char* paramName) 55 { 56 if (_cgVP) 57 { 58 return cgGetNamedParameter(_cgVP, paramName); 59 } 60 61 return 0; 62 } 63 64 inline CGprogram NvShader::getVP() const 65 { 66 return _cgVP; 67 } 68 69 inline CGprogram NvShader::getFP() const 70 { 71 return _cgFP; 72 } 73 21 74 #endif // 22 75 -
trunk/vizservers/nanovis/TransferFunction.h
r380 r776 31 31 ~TransferFunction(); 32 32 void update(float* data); 33 Texture1D* getTexture(); 33 34 }; 34 35 36 inline Texture1D* TransferFunction::getTexture() 37 { 38 return tex; 39 } 35 40 36 41 #endif -
trunk/vizservers/nanovis/Volume.cpp
r524 r776 20 20 Volume::Volume(float x, float y, float z, 21 21 int w, int h, int d, float s, 22 int n, float* data, double v0, double v1 ):22 int n, float* data, double v0, double v1, double nz_min): 23 23 width(w), 24 24 height(h), … … 27 27 n_components(n), 28 28 vmin(v0), 29 vmax(v1), 29 vmax(v1), 30 nonzero_min(nz_min), 30 31 enabled(true), 31 32 n_slice(256), // default value -
trunk/vizservers/nanovis/Volume.h
r580 r776 44 44 45 45 class Volume{ 46 47 48 46 public: 49 47 int volume_type; //cubic or zincblende … … 53 51 54 52 Texture3D* tex; //OpenGL texture storing the volume 55 double vmin; //minimum (unscaled) value in data 56 double vmax; //maximum (unscaled) value in data 53 double vmin; //minimum (unscaled) value in data 54 double vmax; //maximum (unscaled) value in data 55 double nonzero_min; 57 56 58 57 float specular; //specular lighting parameter … … 89 88 Volume(float x, float y, float z, 90 89 int width, int height, int depth, float size, 91 int n_component, float* data, double vmin, double vmax );90 int n_component, float* data, double vmin, double vmax, double nonzero_min); 92 91 ~Volume(); 93 92 … … 100 99 double range_min() { return vmin; } 101 100 double range_max() { return vmax; } 101 double range_nzero_min() { return nonzero_min; } 102 102 103 103 void set_n_slice(int val); //set number of slices -
trunk/vizservers/nanovis/ZincBlendeVolume.cpp
r617 r776 22 22 int w, int h, int d, float s, int n, 23 23 float* dataVolumeA, float* dataVolumeB, 24 double v0, double v1, const Vector3& cellSize)25 : Volume(x, y, z, w, h, d, s, n, dataVolumeA, v0, v1 ), cell_size(cellSize)24 double v0, double v1, double non_zeromin, const Vector3& cellSize) 25 : Volume(x, y, z, w, h, d, s, n, dataVolumeA, v0, v1, non_zeromin), cell_size(cellSize) 26 26 { 27 27 //label it as zincblende -
trunk/vizservers/nanovis/ZincBlendeVolume.h
r580 r776 36 36 int width, int height, int depth, float size, int n_component, 37 37 float* dataVolumeA, float* dataVolumeB, 38 double vmin, double vmax, const Vector3& cellSize);38 double vmin, double vmax, double non_zeromin, const Vector3& cellSize); 39 39 40 40 ~ZincBlendeVolume(); -
trunk/vizservers/nanovis/nanovis.cpp
r755 r776 48 48 #include "NvEventLog.h" 49 49 #include "NvZincBlendeReconstructor.h" 50 #include "HeightMap.h" 51 #include "Grid.h" 50 52 51 53 // R2 headers … … 57 59 extern VolumeRenderer* g_vol_render; 58 60 extern NvColorTableRenderer* g_color_table_renderer; 61 extern Grid* g_grid; 59 62 PlaneRenderer* plane_render; 60 63 Camera* cam; … … 107 110 108 111 int render_window; //the handle of the render window; 112 bool axis_on = true; 109 113 110 114 // forward declarations … … 112 116 void get_slice_vectors(); 113 117 Rappture::Outcome load_volume_stream(int index, std::iostream& fin); 114 void load_volume(int index, int width, int height, int depth, int n_component, float* data, double vmin, double vmax); 118 void load_volume(int index, int width, int height, int depth, int n_component, float* data, double vmin, double vmax, 119 double nzero_min); 115 120 TransferFunction* get_transfunc(char *name); 116 121 void resize_offscreen_buffer(int w, int h); … … 140 145 vector<Volume*> volume; 141 146 147 vector<HeightMap*> g_heightMap; 148 142 149 // maps transfunc name to TransferFunction object 143 150 Tcl_HashTable tftable; … … 196 203 static int PlaneEnableCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 197 204 205 static int GridCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 206 static int AxisCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])); 207 198 208 static int GetVolumeIndices _ANSI_ARGS_((Tcl_Interp *interp, int argc, CONST84 char *argv[], vector<int>* vectorPtr)); 209 static int GetIndices(Tcl_Interp *interp, int argc, CONST84 char *argv[], vector<int>* vectorPtr); 199 210 static int GetAxis _ANSI_ARGS_((Tcl_Interp *interp, char *str, int *valPtr)); 200 211 static int GetColor _ANSI_ARGS_((Tcl_Interp *interp, char *str, float *rgbPtr)); … … 318 329 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 319 330 320 // INSOO 321 // TBD 322 //bmp_write("nv>screenshot -bytes"); 323 bmp_write_to_file(); 331 bmp_write("nv>screenshot -bytes"); 324 332 325 333 resize_offscreen_buffer(old_win_width, old_win_height); … … 756 764 return TCL_OK; 757 765 } 766 758 767 Tcl_AppendResult(interp, "bad option \"", argv[2], 759 768 "\": should be label", (char*)NULL); … … 833 842 if (!strcmp(header, "<HDR>")) 834 843 { 844 printf("HDR stream is in\n"); 835 845 std::stringstream fdata(std::ios_base::out|std::ios_base::in|std::ios_base::binary); 836 846 fdata.write(buf.bytes(),buf.size()); … … 1100 1110 volume[1]->disable_data(); 1101 1111 volume[1]->disable(); 1112 return TCL_OK; 1113 } 1114 1115 Tcl_AppendResult(interp, "bad option \"", argv[1], 1116 "\": should be data, outline, shading, or state", (char*)NULL); 1117 return TCL_ERROR; 1118 } 1119 1120 int HeightMapCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])) 1121 { 1122 if (argc < 2) 1123 { 1124 { 1125 srand( (unsigned)time( NULL ) ); 1126 int size = 20 * 20; 1127 float* data = (float*) malloc(sizeof(float) * size); 1128 for (int i = 0; i < size; ++i) 1129 { 1130 data[i] = rand() * 1.0f / RAND_MAX; 1131 } 1132 1133 HeightMap* heightMap = new HeightMap(); 1134 heightMap->setHeight(0, 0, 1, 1, 20, 20, data); 1135 heightMap->setColorMap(get_transfunc("default")); 1136 heightMap->setVisible(true); 1137 heightMap->setLineContourVisible(true); 1138 g_heightMap.push_back(heightMap); 1139 } 1140 1141 return TCL_OK; 1142 } 1143 1144 char c = *argv[1]; 1145 if (c == 'd' && strcmp(argv[1],"data") == 0) 1146 { 1147 //bytes 1148 vector<int> indices; 1149 if (strcmp(argv[2],"on") == 0) 1150 { 1151 if (GetVolumeIndices(interp, argc-2, argv+2, &indices) != TCL_OK) 1152 { 1153 return TCL_ERROR; 1154 } 1155 1156 for (int i = 0; i < indices.size(); ++i) 1157 { 1158 if ((indices[i] < g_heightMap.size()) && (g_heightMap[indices[i]] != NULL)) 1159 { 1160 g_heightMap[indices[i]]->setVisible(true); 1161 } 1162 } 1163 return TCL_OK; 1164 } 1165 else if (strcmp(argv[2],"off") == 0) 1166 { 1167 if (GetVolumeIndices(interp, argc-2, argv+2, &indices) != TCL_OK) 1168 { 1169 return TCL_ERROR; 1170 } 1171 1172 for (int i = 0; i < indices.size(); ++i) 1173 { 1174 if ((indices[i] < g_heightMap.size()) && (g_heightMap[indices[i]] != NULL)) 1175 { 1176 g_heightMap[indices[i]]->setVisible(false); 1177 } 1178 } 1179 return TCL_OK; 1180 } 1181 1182 1183 1184 } 1185 else if (c == 'l' && (strcmp(argv[1], "linecontour") == 0)) 1186 { 1187 //bytes 1188 vector<int> indices; 1189 if (strcmp(argv[2],"on") == 0) 1190 { 1191 if (GetVolumeIndices(interp, argc-3, argv+3, &indices) != TCL_OK) 1192 { 1193 return TCL_ERROR; 1194 } 1195 1196 for (int i = 0; i < indices.size(); ++i) 1197 { 1198 if ((indices[i] < g_heightMap.size()) && (g_heightMap[indices[i]] != NULL)) 1199 { 1200 g_heightMap[indices[i]]->setLineContourVisible(true); 1201 } 1202 } 1203 return TCL_OK; 1204 } 1205 else if (strcmp(argv[2],"off") == 0) 1206 { 1207 if (GetVolumeIndices(interp, argc-3, argv+3, &indices) != TCL_OK) 1208 { 1209 return TCL_ERROR; 1210 } 1211 1212 for (int i = 0; i < indices.size(); ++i) 1213 { 1214 if ((indices[i] < g_heightMap.size()) && (g_heightMap[indices[i]] != NULL)) 1215 { 1216 g_heightMap[indices[i]]->setLineContourVisible(false); 1217 } 1218 } 1219 return TCL_OK; 1220 } 1221 1222 return TCL_OK; 1223 } 1224 else if (c == 't' && (strcmp(argv[1], "transfunc") == 0)) 1225 { 1226 TransferFunction *tf = get_transfunc((char*)argv[3]); 1227 if (tf == NULL) { 1228 Tcl_AppendResult(interp, "transfer function \"", argv[3], 1229 "\" is not defined", (char*)NULL); 1230 return TCL_ERROR; 1231 } 1232 1233 vector<int> indices; 1234 if (GetVolumeIndices(interp, argc - 3, argv + 3, &indices) != TCL_OK) 1235 { 1236 for (int i = 0; i < indices.size(); ++i) 1237 { 1238 if ((indices[i] < g_heightMap.size()) && (g_heightMap[indices[i]] != NULL)) 1239 { 1240 g_heightMap[indices[i]]->setColorMap(tf); 1241 } 1242 } 1243 } 1244 return TCL_OK; 1245 } 1246 1247 Tcl_AppendResult(interp, "bad option \"", argv[1], 1248 "\": should be data, outline, shading, or state", (char*)NULL); 1249 return TCL_ERROR; 1250 } 1251 1252 int GridCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])) 1253 { 1254 char c = *argv[1]; 1255 if (c == 'v' && strcmp(argv[1],"visible") == 0) 1256 { 1257 if (strcmp(argv[2],"on") == 0) 1258 { 1259 g_grid->setVisible(true); 1260 return TCL_OK; 1261 } 1262 else if (strcmp(argv[2],"off") == 0) 1263 { 1264 g_grid->setVisible(false); 1265 return TCL_OK; 1266 } 1267 } 1268 else if (c == 'l' && strcmp(argv[1],"linecount") == 0) 1269 { 1270 int x, y, z; 1271 1272 if ((Tcl_GetInt(interp, argv[2], &x) == TCL_OK) && 1273 (Tcl_GetInt(interp, argv[3], &y) == TCL_OK) && 1274 (Tcl_GetInt(interp, argv[4], &z) == TCL_OK)) { 1275 1276 if (g_grid) g_grid->setGridLineCount(x, y, z); 1277 1278 return TCL_OK; 1279 } 1280 } 1281 else if (c == 'a' && strcmp(argv[1],"axiscolor") == 0) 1282 { 1283 int r, g, b; 1284 if ((Tcl_GetInt(interp, argv[2], &r) == TCL_OK) && 1285 (Tcl_GetInt(interp, argv[3], &g) == TCL_OK) && 1286 (Tcl_GetInt(interp, argv[4], &b) == TCL_OK)) { 1287 1288 if (g_grid) g_grid->setAxisColor(r / 255.0f, g / 255.0f, b / 255.0f); 1289 return TCL_OK; 1290 } 1291 } 1292 else if (c == 'l' && strcmp(argv[1],"linecolor") == 0) 1293 { 1294 int r, g, b; 1295 if ((Tcl_GetInt(interp, argv[2], &r) == TCL_OK) && 1296 (Tcl_GetInt(interp, argv[3], &g) == TCL_OK) && 1297 (Tcl_GetInt(interp, argv[4], &b) == TCL_OK)) { 1298 1299 if (g_grid) g_grid->setGridLineColor(r / 255.0f, g / 255.0f, b / 255.0f); 1300 return TCL_OK; 1301 } 1302 } 1303 else if (c == 'm') 1304 { 1305 if (strcmp(argv[1],"minmax") == 0) 1306 { 1307 double x1, y1, z1, x2, y2, z2; 1308 if ((Tcl_GetDouble(interp, argv[2], &x1) == TCL_OK) && 1309 (Tcl_GetDouble(interp, argv[3], &y1) == TCL_OK) && 1310 (Tcl_GetDouble(interp, argv[4], &z1) == TCL_OK) && 1311 (Tcl_GetDouble(interp, argv[5], &x2) == TCL_OK) && 1312 (Tcl_GetDouble(interp, argv[6], &y2) == TCL_OK) && 1313 (Tcl_GetDouble(interp, argv[7], &z2) == TCL_OK)) { 1314 1315 if (g_grid) g_grid->setMinMax(Vector3(x1, y1, z1), Vector3(x2, y2, z2)); 1316 1317 return TCL_OK; 1318 } 1319 } 1320 } 1321 else if (c == 'a' && strcmp(argv[1],"axisname") == 0) 1322 { 1323 int axisID; 1324 if ((Tcl_GetInt(interp, argv[2], &axisID) == TCL_OK)) 1325 { 1326 if (g_grid) g_grid->setAxisName(axisID, argv[3]); 1327 return TCL_OK; 1328 } 1329 } 1330 1331 Tcl_AppendResult(interp, "bad option \"", argv[1], 1332 "\": should be data, outline, shading, or state", (char*)NULL); 1333 return TCL_ERROR; 1334 } 1335 1336 int AxisCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[])) 1337 { 1338 if (argc < 2) { 1339 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], 1340 " option arg arg...\"", (char*)NULL); 1341 return TCL_ERROR; 1342 } 1343 1344 char c = *argv[1]; 1345 if (c == 'v' && strcmp(argv[1],"visible") == 0) 1346 { 1347 if (strcmp(argv[2],"on") == 0) 1348 { 1349 axis_on = true; 1350 } 1351 else if (strcmp(argv[2],"off") == 0) 1352 { 1353 axis_on = false; 1354 } 1355 1102 1356 return TCL_OK; 1103 1357 } … … 1145 1399 vectorPtr->push_back(ivol); 1146 1400 } 1401 } 1402 } 1403 return TCL_OK; 1404 } 1405 1406 static int 1407 GetIndices(Tcl_Interp *interp, int argc, CONST84 char *argv[], 1408 vector<int>* vectorPtr) 1409 { 1410 int ivol; 1411 for (int n=0; n < argc; n++) 1412 { 1413 if (Tcl_GetInt(interp, argv[n], &ivol) != TCL_OK) { 1414 return TCL_ERROR; 1415 } 1416 if (ivol < 0 || ivol >= volume.size()) { 1417 Tcl_AppendResult(interp, "bad volume index \"", argv[n], 1418 "\"", (char*)NULL); 1419 return TCL_ERROR; 1147 1420 } 1148 1421 } … … 1475 1748 double vmin = 0.0; 1476 1749 double vmax = 0.0; 1750 double nzero_min = 0.0; 1477 1751 int ngen = 0; 1478 1752 for (int iz=0; iz < nz; iz++) { … … 1493 1767 if (vm < vmin) { vmin = vm; } 1494 1768 if (vm > vmax) { vmax = vm; } 1769 if (vm != 0.0f && vm < nzero_min) 1770 { 1771 nzero_min = vm; 1772 } 1495 1773 1496 1774 data[ngen++] = vx; … … 1506 1784 } 1507 1785 1508 load_volume(index, nx, ny, nz, 3, data, vmin, vmax );1786 load_volume(index, nx, ny, nz, 3, data, vmin, vmax, nzero_min); 1509 1787 delete [] data; 1510 1788 } else { … … 1565 1843 for (int i=0; i < nxy; i++) { 1566 1844 ftmp << xymesh.atNode(i).x() << " " << xymesh.atNode(i).y() << std::endl; 1845 1567 1846 } 1568 1847 ftmp.close(); … … 1691 1970 // generate the uniformly sampled data that we need for a volume 1692 1971 int ngen = 0; 1972 double nzero_min = 0.0; 1693 1973 for (int iz=0; iz < nz; iz++) { 1694 1974 double zval = z0 + iz*dmin; … … 1699 1979 double v = field.value(xval,yval,zval); 1700 1980 1981 if (v != 0.0f && v < nzero_min) 1982 { 1983 nzero_min = v; 1984 } 1985 1701 1986 // scale all values [0-1], -1 => out of bounds 1702 1987 v = (isnan(v)) ? -1.0 : (v - vmin)/dv; 1988 1703 1989 data[ngen] = v; 1704 1990 ngen += 4; … … 1746 2032 1747 2033 load_volume(index, nx, ny, nz, 4, data, 1748 field.valueMin(), field.valueMax() );2034 field.valueMin(), field.valueMax(), nzero_min); 1749 2035 1750 2036 delete [] data; … … 1805 2091 // generate the uniformly sampled data that we need for a volume 1806 2092 int ngen = 0; 2093 double nzero_min = 0.0; 1807 2094 for (iz=0; iz < nz; iz++) { 1808 2095 double zval = z0 + iz*dmin; … … 1813 2100 double v = field.value(xval,yval,zval); 1814 2101 2102 if (v != 0.0f && v < nzero_min) 2103 { 2104 nzero_min = v; 2105 } 1815 2106 // scale all values [0-1], -1 => out of bounds 1816 2107 v = (isnan(v)) ? -1.0 : (v - vmin)/dv; … … 1861 2152 1862 2153 load_volume(index, nx, ny, nz, 4, data, 1863 field.valueMin(), field.valueMax() );2154 field.valueMin(), field.valueMax(), nzero_min); 1864 2155 1865 2156 delete [] data; … … 1888 2179 */ 1889 2180 void load_volume(int index, int width, int height, int depth, 1890 int n_component, float* data, double vmin, double vmax )2181 int n_component, float* data, double vmin, double vmax, double nzero_min) 1891 2182 { 1892 2183 while (n_volumes <= index) { … … 1901 2192 1902 2193 volume[index] = new Volume(0.f, 0.f, 0.f, width, height, depth, 1., 1903 n_component, data, vmin, vmax );2194 n_component, data, vmin, vmax, nzero_min); 1904 2195 assert(volume[index]!=0); 1905 2196 } … … 1990 2281 win_width = w; 1991 2282 win_height = h; 2283 2284 if (g_fonts) 2285 { 2286 g_fonts->resize(w, h); 2287 } 1992 2288 1993 2289 //fprintf(stderr, "screen_buffer size: %d\n", sizeof(screen_buffer)); … … 2212 2508 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 2213 2509 2510 Tcl_CreateCommand(interp, "axis", AxisCmd, 2511 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 2512 2513 Tcl_CreateCommand(interp, "grid", GridCmd, 2514 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 2515 2516 Tcl_CreateCommand(interp, "heightmap", HeightMapCmd, 2517 (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); 2518 2214 2519 // get screenshot 2215 2520 Tcl_CreateCommand(interp, "screenshot", ScreenShotCmd, … … 2975 3280 2976 3281 //now render things in the scene 2977 draw_3d_axis(); 3282 if (axis_on) 3283 { 3284 draw_3d_axis(); 3285 } 3286 3287 if (g_grid->isVisible()) 3288 { 3289 g_grid->render(); 3290 } 2978 3291 2979 3292 //lic->render(); //display the line integral convolution result … … 2988 3301 g_vol_render->render_all(); 2989 3302 perf->disable(); 3303 3304 for (int ii = 0; ii < g_heightMap.size(); ++ii) 3305 { 3306 if (g_heightMap[ii]->isVisible()) 3307 g_heightMap[ii]->render(); 3308 } 2990 3309 2991 3310 glPopMatrix(); … … 3243 3562 */ 3244 3563 3564 void removeAllData() 3565 { 3566 // 3567 } 3245 3568 3246 3569 … … 3308 3631 glutMainLoop(); 3309 3632 3633 removeAllData(); 3634 3310 3635 NvExit(); 3311 3636 -
trunk/vizservers/nanovis/shaders/one_volume.cg
r524 r776 56 56 float normal_dot_half = max(dot(normal, half_vector), 0); 57 57 58 float ambient = 0.8; 58 //float ambient = 0.8; 59 float ambient = 0.2; 59 60 float diffuse = normal_dot_light * renderParameters.z; 60 61 float specular = pow(normal_dot_half, renderParameters.w)*(1-ambient-diffuse);
Note: See TracChangeset
for help on using the changeset viewer.