Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1749 - trunk/scenes


Chronological Thread 
  • From: arobison@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1749 - trunk/scenes
  • Date: Mon, 1 Oct 2007 13:37:03 -0600 (MDT)

Author: arobison
Date: Mon Oct  1 13:37:02 2007
New Revision: 1749

Modified:
   trunk/scenes/complexitytest.cc
Log:
Adding support for CGT as the top-level acceleration structure.


Modified: trunk/scenes/complexitytest.cc
==============================================================================
--- trunk/scenes/complexitytest.cc      (original)
+++ trunk/scenes/complexitytest.cc      Mon Oct  1 13:37:02 2007
@@ -1,4 +1,31 @@
 
+/*
+  Adding a new scene designed to stress acceleration structures. 
+
+  The scene creates a number of instanced objects randomly distributed 
throughout a cube.
+  It takes the following options:
+  
+  -num - number of objects to render
+  -type - type of objects to render [sphere, cone, disk, box]
+  -model - load this mesh instead of using a builtin primitive [OBJ or PLY]
+  -object_scale - scale the rendered objects by this amount
+  -cube_scale - scale the bounding cube the primitives are rendered into
+  -material - use a named shader instead of a constant color [lambertian, 
constant, null]
+  -DynBVH - use DynBVH as the acceleration structure [default]
+  -CGT - use CGT as the acceleration structure
+  
+  Here are some example command lines:
+
+  -Visualize the BVH
+  bin/manta -scene "lib/libscene_complexitytest.dylib(-num 500 -material 
null)" -imagetraverser "tiled(-tilesize 1x1)" -t
+
+  -Load a bunch of bunnies
+  bin/manta -scene "lib/libscene_complexitytest.dylib(-num 20 -object_scale 
2 -material lambertian -model bun_zipper.ply)"
+  
+  -Big cubes
+  bin/manta -scene "lib/libscene_complexitytest.dylib (-type box 
-object_scale 10 -cube_scale 3)"
+*/
+
 #include <Model/Textures/ImageTexture.h>
 #include <Image/TGAFile.h>
 #include <Core/Exceptions/IllegalArgument.h>
@@ -58,9 +85,34 @@
 #include <iostream>
 #include <sgi_stl_warnings_on.h>
 
+#include "UsePrivateCode.h"
+#ifdef USE_PRIVATE_CODE
+#include <Model/Groups/private/CGT.h>
+#include <fstream>
+#endif
+
 using namespace Manta;
 using namespace std;
 
+AccelerationStructure* getAS(string type) 
+{
+  if(type == "DynBVH")
+    return new DynBVH();
+
+#ifdef USE_PRIVATE_CODE
+  if(type == "CGT")
+    return new Grid();
+#endif
+
+  static bool already_warned = false;
+  if(!already_warned) {
+    cerr << "Warning: unknown acceleration structure type, defaulting to 
DynBVH" << endl;
+    already_warned = true;
+  }
+
+  return new DynBVH();
+}
+
 Material* getMaterial(string type, Color c)
 {
   if(type == "lambertian")
@@ -90,6 +142,7 @@
   string mesh_name = "";
   string object_type = "sphere";
   string object_material = "constant";
+  string acc_struct = "DynBVH";
 
   for(size_t i = 0; i < args.size(); ++i) {
     string arg = args[i];
@@ -113,6 +166,10 @@
     } else if (arg == "-material") {
       if(!getStringArg(i, args, object_material))
         throw IllegalArgument("scene complexitytest -material", i, args);
+    } else if (arg == "-DynBVH") {
+      acc_struct = "DynBVH";
+    } else if (arg == "-CGT") {
+      acc_struct = "CGT";
     } else {
       cerr << "Valid options for complexitytest:\n"
            << "  -num - number of objects to render\n"
@@ -196,10 +253,9 @@
   scene->setBackground(new LinearBackground(Color(RGB(0.2, 0.4, 0.9)),
                                             Color(RGB(0.0,0.0,0.0)),
                                             Vector(0,1,0)));
-
-  DynBVH* bvh = new DynBVH();
-  bvh->setGroup(group);
-  scene->setObject(bvh);
+  AccelerationStructure* as = getAS(acc_struct);
+  as->setGroup(group);
+  scene->setObject(as);
 
   LightSet* lights = new LightSet();
   lights->add(new PointLight(Vector(-2,4,-8), Color(RGB(1,1,1))*1));




  • [Manta] r1749 - trunk/scenes, arobison, 10/01/2007

Archive powered by MHonArc 2.6.16.

Top of page