Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1263 - trunk/scenes


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1263 - trunk/scenes
  • Date: Wed, 20 Dec 2006 16:09:58 -0700 (MST)

Author: bigler
Date: Wed Dec 20 16:09:58 2006
New Revision: 1263

Modified:
   trunk/scenes/primtest.cc
Log:
Code to use triangles instead of parallelogram for background polygon.

Modified: trunk/scenes/primtest.cc
==============================================================================
--- trunk/scenes/primtest.cc    (original)
+++ trunk/scenes/primtest.cc    Wed Dec 20 16:09:58 2006
@@ -28,6 +28,7 @@
 #include <Model/Primitives/Hemisphere.h>
 #include <Model/Primitives/Parallelogram.h>
 #include <Model/Primitives/Sphere.h>
+#include <Model/Primitives/Triangle.h>
 #include <Model/Primitives/SuperEllipsoid.h>
 #include <Model/Primitives/Heightfield.h>
 #include <Model/TexCoordMappers/LinearMapper.h>
@@ -400,13 +401,24 @@
     }
   }
   if(bgpoly){
-    Material* bgmatl = new Lambertian(new 
CheckerTexture<Color>(Color(RGB(0.4, 0.4, 0.4)),
-                                                                
Color(RGB(0.2, 0.2, 0.2)),
-                                                                
Vector(1,0,0)*numx*2,
-                                                                
Vector(0,1,0)*numy*2));
-
-    group->add(new Parallelogram(bgmatl, Vector(-scale-1./max, 
-scale-1./max, -1.5/max),
-                                 Vector(scale*2+2./max, 0, 0), Vector(0, 
scale*2+2./max, 0)));
+    Texture<Color>* tex = new CheckerTexture<Color>(Color(RGB(0.4, 0.4, 
0.4)),
+                                                    Color(RGB(0.2, 0.2, 
0.2)),
+                                                    Vector(1,0,0)*numx*2,
+                                                    Vector(0,1,0)*numy*2);
+    //    Material* bgmatl = new Lambertian(tex);
+    Material* bgmatl = new Phong(tex,
+                                 new Constant<Color>(Color(RGB(0.9, 0.9, 
0.9))),
+                                 32, NULL);
+
+    Vector anchor(-scale-1./max, -scale-1./max, -1.5/max);
+    Vector v1(scale*2+2./max, 0, 0);
+    Vector v2(0, scale*2+2./max, 0);
+#if 0
+    group->add(new Triangle(bgmatl, anchor, anchor+v1, anchor+v2));
+    group->add(new Triangle(bgmatl, anchor+v1+v2, anchor+v2, anchor+v1));
+#else
+    group->add(new Parallelogram(bgmatl, anchor, v1, v2));
+#endif
   }
   Scene* scene = new Scene();
   scene->setBackground(new LinearBackground(Color(RGB(0.2, 0.4, 0.9)),




  • [MANTA] r1263 - trunk/scenes, bigler, 12/20/2006

Archive powered by MHonArc 2.6.16.

Top of page