Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1136 - in trunk: Model/Primitives scenes


Chronological Thread 
  • From: knolla@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1136 - in trunk: Model/Primitives scenes
  • Date: Mon, 3 Jul 2006 15:45:47 -0600 (MDT)

Author: knolla
Date: Mon Jul  3 15:45:46 2006
New Revision: 1136

Modified:
   trunk/Model/Primitives/OctreeVolume.h
   trunk/scenes/gridisovol.cc
   trunk/scenes/octisovol.cc
Log:
added command-line isovalue changing functionality.

Modified: trunk/Model/Primitives/OctreeVolume.h
==============================================================================
--- trunk/Model/Primitives/OctreeVolume.h       (original)
+++ trunk/Model/Primitives/OctreeVolume.h       Mon Jul  3 15:45:46 2006
@@ -186,6 +186,13 @@
                 isoval++;
         }
         
+        inline void set_isovalue(double isovalue)
+        {
+            isoval = (ST)isovalue;
+            isoval = MAX(datamin, isoval);
+            isoval = MIN(datamax, isoval);
+        }
+        
         inline int get_isovalue() const
         {
             return isoval;

Modified: trunk/scenes/gridisovol.cc
==============================================================================
--- trunk/scenes/gridisovol.cc  (original)
+++ trunk/scenes/gridisovol.cc  Mon Jul  3 15:45:46 2006
@@ -98,7 +98,9 @@
     //NOTE: this will create a light directly "above" the volume in the +up 
direction.
     //  Some volumes (e.g. heptane) will require us to change this to a -
        LightSet *lights = new LightSet();
-    lights->add( new PointLight( Vector(lookat + (10.f * lookat.length()) * 
up ), Color(RGBColor(1,1,1)) ) );
+    float ldist = 10.f * (lookat-eye).length();
+
+    lights->add( new PointLight( Vector(lookat + ldist*up), 
Color(RGBColor(1,1,1)) ) );
        lights->setAmbientLight( new ConstantAmbient( 
Color(RGBColor(0.4,0.5,0.5) ) ));
        scene->setLights(lights);
 

Modified: trunk/scenes/octisovol.cc
==============================================================================
--- trunk/scenes/octisovol.cc   (original)
+++ trunk/scenes/octisovol.cc   Mon Jul  3 15:45:46 2006
@@ -48,6 +48,7 @@
     int mres_levels = 0;
     double isomin = 0;
     double isomax = 255;
+    double isovalue = 100;
        
        // Parse args.i
        for (int i=0;i<args.size();++i) {
@@ -87,6 +88,10 @@
                        if (!getDoubleArg(i, args, isomin))
                                throw IllegalArgument("octisovol -isomax 
<isomax>", i, args);
                }           
+        else if (args[i] == "-isovalue") {
+                       if (!getDoubleArg(i, args, isovalue))
+                               throw IllegalArgument("octisovol -isovalue 
<isovalue>", i, args);
+               }                   
                else {
                        cerr << "Read built octree volume:" << endl;
                        cerr << "-file <filename>"             << endl;
@@ -100,6 +105,7 @@
                        cerr << "  -mres_levels <mres_levels>" << endl;
                        cerr << "  -isomin <isomin>" << endl;
                        cerr << "  -isomax <isomax>" << endl;
+            cerr << "  -isovalue <isovalue>" << endl;
                        throw IllegalArgument( "octisovol", i, args );
                }
        }
@@ -126,15 +132,21 @@
         throw InputError( "octisovol: No volume source specified. Use either 
-file or -buildfrom.");
     }
     
+    ov->set_isovalue(isovalue);
+    
     // Create the scene.
        Scene *scene = new Scene();
        Group *group = new Group();
 
-       Manta::BBox bounds; 
-    
-    //Material* mat1 = new Phong(Color(RGBColor(0.05f, 0.3f, 0.6f)), 
Color(RGBColor(1.f, 1.f, 1.f)), 50);
+       Manta::BBox bounds;
+
+    //Material* mat1 = new Phong(Color(RGBColor(0.05f, 0.3f, 0.6f)), 
Color(RGBColor(1.f, 1.f, 1.f)), 50);    
+//#define H300
+#ifdef H300    
+    Material* mat1 = new Lambertian(Color(RGBColor(0.8f, 0.4f, 1.f)));      
//purple   
+#else
     Material* mat1 = new Lambertian(Color(RGBColor(0.05f, 0.3f, 0.6f)));     
 //blue
-    //Material* mat1 = new Lambertian(Color(RGBColor(0.8f, 0.4f, 1.f)));     
 //purple   
+#endif
     IsosurfaceOctreeVolume* iov = new IsosurfaceOctreeVolume(ov, mat1);
     bounds = iov->getBounds();
     group->add(iov);
@@ -157,15 +169,22 @@
     //  Some volumes (e.g. heptane) will require us to change this to a -
        LightSet *lights = new LightSet();
     float ldist = 10.f * (lookat-eye).length();
-    //lights->add( new PointLight( Vector(lookat + ldist*(eye - 2*up)), 
Color(RGBColor(0.8,0.8,0.8)) ) );
+
+#ifdef H300    
+    lights->add( new PointLight( Vector(lookat + ldist*(eye - 2*up)), 
Color(RGBColor(0.8,0.8,0.8)) ) );
+#else    
     lights->add( new PointLight( Vector(lookat + ldist*up), 
Color(RGBColor(1,1,1)) ) );
+#endif    
        lights->setAmbientLight( new ConstantAmbient( 
Color(RGBColor(0.4,0.5,0.5) ) ));
        scene->setLights(lights);
 
        
        // Background.
+#ifdef H300
+    scene->setBackground( new ConstantBackground( Color(RGB(0,0,0)) ) );
+#else    
     scene->setBackground( new ConstantBackground( Color(RGB(.96, 0.96, 
0.97)) ) );
-    //scene->setBackground( new ConstantBackground( Color(RGB(0,0,0)) ) );
+#endif
        
        return scene;
 }




  • [MANTA] r1136 - in trunk: Model/Primitives scenes, knolla, 07/03/2006

Archive powered by MHonArc 2.6.16.

Top of page