Text archives Help
- From: hansong@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r474 - branches/itanium2/scenes
- Date: Tue, 16 Aug 2005 11:00:06 -0600 (MDT)
Author: hansong
Date: Tue Aug 16 11:00:04 2005
New Revision: 474
Modified:
branches/itanium2/scenes/volume.cc
Log:
handle 16-bit data
Modified: branches/itanium2/scenes/volume.cc
==============================================================================
--- branches/itanium2/scenes/volume.cc (original)
+++ branches/itanium2/scenes/volume.cc Tue Aug 16 11:00:04 2005
@@ -1,5 +1,4 @@
-
// Manta Test Scene for volume rendering
// Hansong Zhang and Abe Stephens
// hansong@sgi.com abe@sgi.com
@@ -93,16 +92,35 @@
Scene *scene = new Scene();
Group *group = new Group();
+ Manta::AABox3f bounds;
+ TransferFunction *tf = new TransferFunction();
+ tf->load( tf_name.c_str() );
+ VolumeRenderingParams *vrp = new VolumeRenderingParams(tf);
+
+ VolumeDescription vd;
+ vd.load(file_name.c_str());
+if (vd.comp_size == 1) {
+
VolumeGrid<unsigned char> *vg = new VolumeGrid<unsigned char>;
vg->load(file_name.c_str(), 128, false, 0);
group->add(vg);
+ vg->setVolumeRenderingParams(vrp);
+
+ bounds = vg->getBound();
+} else {
TransferFunction *tf = new TransferFunction();
tf->load( tf_name.c_str() );
-
- VolumeRenderingParams *vrp = new VolumeRenderingParams(tf);
+
+ VolumeGrid<short> *vg = new VolumeGrid<short>;
+ vg->load(file_name.c_str(), 128, false, 0);
+ group->add(vg);
+
vg->setVolumeRenderingParams(vrp);
+ bounds = vg->getBound();
+}
+
LightSet *lights = new LightSet();
lights->add( new HeadLight( 2.0, Color(RGB(1.0,1.0,1.0)) ));
@@ -112,12 +130,11 @@
// Add the tree to the scene.
scene->setObject( group );
- const Manta::AABox3f &bounds = vg->getBound();
// Set other important scene properties.
PinholeCamera *camera = new PinholeCamera(
- PointT<Real,3>(30, 30, 256),
- PointT<Real,3>(30, 30, 0),
- Vector(0,1,0), 40.0 );
+ PointT<Real,3>(bounds.max[0]/2, bounds.max[1]/2,
bounds.max[2]*2),
+ PointT<Real,3>(bounds.max[0]/2, bounds.max[1]/2, 0),
+ Vector(0,1,0), 50.0 );
// Background.
scene->setBackground( new ConstantBackground( Color(RGB(0.8, 0.8,
0.8)) ) );
- [MANTA] r474 - branches/itanium2/scenes, hansong, 08/16/2005
Archive powered by MHonArc 2.6.16.