Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r879 - trunk/scenes


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r879 - trunk/scenes
  • Date: Wed, 1 Feb 2006 12:04:29 -0700 (MST)

Author: bigler
Date: Wed Feb  1 12:04:29 2006
New Revision: 879

Modified:
   trunk/scenes/cube.cc
Log:

Added license.

Removed tons of dead code.


Modified: trunk/scenes/cube.cc
==============================================================================
--- trunk/scenes/cube.cc        (original)
+++ trunk/scenes/cube.cc        Wed Feb  1 12:04:29 2006
@@ -1,3 +1,30 @@
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005-2006
+  Scientific Computing and Imaging Institute, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
 
 #include <Core/Color/ColorDB.h>
 #include <Core/Geometry/PointVector.h>
@@ -35,120 +62,7 @@
 using namespace Manta;
 using namespace std;
 
-<<<<<<< .mine
-=======
-static const double SCALE = 1./3.;
-static const double BV_RADIUS = 1.0;
-
-static void create_dirs(Vector* objset)
-{
-  double dist=1./sqrt(2.0);
-  Vector dir[3];
-  dir[0]=Vector(dist, dist, 0);
-  dir[1]=Vector(dist, 0, -dist);
-  dir[2]=Vector(0, dist, -dist);
-
-  Vector axis(1, -1, 0);
-  axis.normalize();
-
-  double rot=asin(2.0/sqrt(6.0));
-  AffineTransform t;
-  t.initWithRotation(axis, rot);
-
-  for(int n=0;n<3;n++){
-    dir[n] = t * dir[n];
-  }
-
-  for(int ns=0;ns<3;ns++){
-    AffineTransform t;
-    t.initWithRotation(Vector(0,0,1), ns*2.*M_PI/3.);
-    for(int nv=0;nv<3;nv++){
-      objset[ns*3+nv] = t * dir[nv];
-    }
-  }
-}
-
-static void create_objs(Group* group, const Point& center,
-                       double radius, const Vector& dir, int depth,
-                       Vector* objset, Material* matl)
-{
-  group->add(new Sphere(matl, center, radius));
-
-  // Check if children should be generated
-  if(depth > 0){
-    depth--;
-    
-    // Rotation matrix to new axis from +Z axis
-    AffineTransform mx;
-    mx.initWithIdentity();
-    mx.rotate(Vector(0,0,1), dir);
-    
-    double scale = radius * (1+SCALE);
-    
-    for(int n=0;n<9;n++){
-      Vector child_vec(mx * objset[n]);
-      Point child_pt(center+child_vec*scale);
-      double child_rad=radius*SCALE; Vector child_dir = child_pt-center;
-      child_dir *= 1./scale;
-      create_objs(group, child_pt, child_rad, child_dir, depth, objset, 
matl);
-    }
-  }
-}
-
-static void make_box(Group* group, Material* matl,
-                    const Point& corner, const Vector& x, const Vector& y, 
const Vector& z)
-{
-  // group->add(new Parallelogram(matl, corner, x*2, z*2));
-  // group->add(new Parallelogram(matl, corner+y*2, z*2, x*2));
-  // group->add(new Parallelogram(matl, corner, y*2, z*2));
-  // group->add(new Parallelogram(matl, corner+x*2, z*2, y*2));
-  // group->add(new Parallelogram(matl, corner+z*2, x*2, y*2));
-
-  Point corner1 = corner + x + y + z;
-  
-  group->add( new Cube( matl, corner, corner1 ) );
-}
-
-static void make_obj(Group* world, int size)
-{
-  Vector objset[9];
-  create_dirs(objset);
-  Material* matl0=new Lambertian(Color(RGBColor(.4,.4,.4)));
-  //create_objs(world, Point(0,0,.5), BV_RADIUS/2.0, Vector(0,0,1),
-       //      size, objset, matl0);
-
-       // Just make a box....
-  Material* matl1=new Lambertian(Color(RGBColor(.2,.4,.2)));
-       Material* normal_material = new Flat( new NormalTexture() );
-       
-       // Add a box.
-       Point point( 0.5,0,0 );
-       Vector normal( 1,0,0 );
-       
-       world->add( new CuttingPlane( point, normal, 
-                                                       //new Cube( 
normal_material, Point(-1,-1,-1), Point(1,1,1) ) ) );
-                                                       new Sphere( 
normal_material, Point(0.0,0.0,0.00), 1.0 ) ) );
-       // Make a sphere where we think the box should be
-       // world->add(new Sphere( normal_material, Point(0.0,0.0,0.00), 1.0 ) 
);
-       
-  /*
-  Material* matl3=new MetalMaterial( Color(RGBColor(.7,.7,.7)));
-  world->add(new Sphere(matl3, 
corner+diag1*1.25+diag2*.6+z*2+Vector(0,0,.6), .6));
-  double planesize=15;
-  double scale = 2*planesize;
-  Material* matl2 = new Lambertian(new 
CheckerTexture<Color>(Color(RGBColor(.95,.95,.95)),
-                                                            
Color(RGBColor(.7,.3,.3)),
-                                                            
Vector(1,1.1,0)*scale,
-                                                            
Vector(-1.1,1,0)*scale));
-  Vector edge1(planesize, planesize*1.1, 0);
-  Vector edge2(-planesize*1.1, planesize, 0);
-  Object* obj1=new Parallelogram(matl2, Point(0,0,0)-edge1-edge2, edge1*2, 
edge2*2);
-  world->add(obj1);
-        */
-}
-
->>>>>>> .r875
-extern "C" 
+extern "C"
 Scene* make_scene(const ReadContext& context, const vector<string>& args)
 {
   int argc = static_cast<int>(args.size());
@@ -158,27 +72,27 @@
     if(arg == "-bv"){
       string s;
       if(!getStringArg(i, args, s))
-        throw IllegalArgument("scene 0 -bv", i, args);
+        throw IllegalArgument("cube -bv", i, args);
       world = context.manta_interface->makeGroup(s);
     } else {
-      cerr << "Valid options for scene 0:\n";
-      cerr << " -size n   - Sets depth of sphereflake\n";
-      cerr << " -light r  - Sets radius of light source for soft shadows\n";
-      throw IllegalArgument("scene 0", i, args);
+      cerr << "Valid options for cube:\n";
+      cerr << "-bv <group,bvh,grid>\n";
+      throw IllegalArgument("cube", i, args);
     }
   }
 
   if(!world)
     world = new Group();
-  
-  // Simple Materials
+
+  // You can specify the colors by either using 3 RGB components such
+  // as Color(RGB(0.4, 0.4, 0.4)), or by using the ColorDB with a name
+  // like ColorDB::getNamedColor("gray40")
   Material* matl0=new Lambertian(Color(RGB(.4,.4,.4)));
   Material* matl1=new Lambertian(ColorDB::getNamedColor("sky blue"));
-       
-  // Add a simple box to the scene
-  //world->add( new Cube( matl0, Point(-1,-1,-1), Point(1,1,1) ) );
+
+  // Add a simple sphere to the scene
   world->add(new Sphere( matl1, Point(0.0,0.0,0.00), 1.0 ) );
-       
+
   Scene* scene = new Scene();
   scene->setBackground(new ConstantBackground(ColorDB::getNamedColor("light 
slate gray")));
   scene->setObject(world);




  • [MANTA] r879 - trunk/scenes, bigler, 02/01/2006

Archive powered by MHonArc 2.6.16.

Top of page