Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1517 - in trunk: Core/Math Model/Materials scenes


Chronological Thread 
  • From: brownlee@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1517 - in trunk: Core/Math Model/Materials scenes
  • Date: Fri, 20 Jul 2007 02:13:41 -0600 (MDT)

Author: brownlee
Date: Fri Jul 20 02:13:39 2007
New Revision: 1517

Modified:
   trunk/Core/Math/CheapRNG.h
   trunk/Model/Materials/Lambertian.cc
   trunk/scenes/dynlt.cc
   trunk/scenes/particleCGTTest.cc
   trunk/scenes/pcgt.cc
Log:
minor alterations to CGT/dynlt scene files

Modified: trunk/Core/Math/CheapRNG.h
==============================================================================
--- trunk/Core/Math/CheapRNG.h  (original)
+++ trunk/Core/Math/CheapRNG.h  Fri Jul 20 02:13:39 2007
@@ -53,10 +53,8 @@
 // properties of integer multiplication.
 
 // For the Real type
-#include <MantaTypes.h>
+#include <MantaTypes.h> 
 #include <Interface/RandomNumberGenerator.h>
-#include <MantaSSE.h>
-#include <Core/Math/SSEDefs.h>
 #include <Core/Util/AlignedAllocator.h>
 
 namespace Manta {
@@ -69,49 +67,22 @@
     // members.
     typedef unsigned int uint32;
   protected:
-
+    
     char padding0 [128];
     uint32 val;
-#ifdef MANTA_SSE
-    __m128i val_sse;
-#endif
     char padding1 [128];
   public:
     // Your seed value is up to the fates.  You should call seed.
     CheapRNG() {}
     static void create(RandomNumberGenerator*& rng ) { rng = new CheapRNG(); 
}
-
+      
     virtual void seed(unsigned int seed_val) {
       val = seed_val;
-#ifdef MANTA_SSE
-      // TODO(boulos): Find a better way to seed this.  Normally you
-      // could just call nextInt() but all that will do for this RNG
-      // is make the sequences out of sync by one iteration... So you
-      // want offsets.
-      val_sse = _mm_set_epi32(seed_val,
-                              seed_val + 1,
-                              seed_val,
-                              seed_val + 1);
-#endif
     }
 
     virtual unsigned int nextInt() {
       val = 1664525*val + 1013904223;
       return val;
-    }
-
-    virtual void nextIntPacket(Packet<unsigned int>& results) {
-#ifdef MANTA_SSE
-      for (int i = 0; i < Packet<unsigned int>::MaxSize; i+=4) {
-        val_sse = _mm_add_epi32(_mm_set_epi32(2531011, 10395331, 13737667, 
1),
-                                _mm_mullo_epi32(val_sse, 
_mm_set_epi32(214013, 17405, 214013, 69069)));
-        _mm_store_si128((__m128i*)&results.data[i], val_sse);
-      }
-#else
-      for (int i = 0; i < Packet<unsigned int>::MaxSize; i++) {
-        results.set(i, nextInt());
-      }
-#endif
     }
   }; // end class CheapRNG
 

Modified: trunk/Model/Materials/Lambertian.cc
==============================================================================
--- trunk/Model/Materials/Lambertian.cc (original)
+++ trunk/Model/Materials/Lambertian.cc Fri Jul 20 02:13:39 2007
@@ -29,15 +29,17 @@
 #include <Model/Materials/Lambertian.h>
 #include <Interface/Light.h>
 #include <Interface/LightSet.h>
-#include <Interface/Primitive.h>
+#include <Interface/Primitive.h> 
 #include <Interface/RayPacket.h>
 #include <Interface/AmbientLight.h>
 #include <Interface/Context.h>
 #include <Interface/ShadowAlgorithm.h>
 #include <Model/Textures/Constant.h>
+#include <SCIRun/Core/Exceptions/InternalError.h>
 #include <iostream>
 using namespace Manta;
 using std::cerr;
+using namespace SCIRun;
 
 Lambertian::Lambertian(const Color& color)
 {
@@ -75,6 +77,8 @@
 
   // Compute ambient contributions for all rays
   MANTA_ALIGN(16) ColorArray totalLight;
+  if (! activeLights->getAmbientLight())
+    exit(2);
   activeLights->getAmbientLight()->computeAmbient(context, rays, totalLight);
 
   ShadowAlgorithm::StateBuffer shadowState;

Modified: trunk/scenes/dynlt.cc
==============================================================================
--- trunk/scenes/dynlt.cc       (original)
+++ trunk/scenes/dynlt.cc       Fri Jul 20 02:13:39 2007
@@ -63,6 +63,7 @@
   double lx=10.;
   double ly=10.;
   double lz=10.;
+  int gridType = 1;
 
   int argc=static_cast<int>(args.size());
   for(int i=0; i<argc; ++i) {
@@ -157,6 +158,9 @@
             }
           }
         }
+      } else if (arg=="-gridtype") {
+       if (!getIntArg(i, args, gridType))
+         throw IllegalArgument("scene dynlt -gridtype", i, args);
       } else {
         cerr<<"Valid options for scene dynlt:\n";
         // cerr<<"  -bv <string>                     bounding volume 
{bvh|grid|group}\n";
@@ -180,7 +184,7 @@
         cerr<<"  -stats                            dump summary stats on 
exit\n";
 #endif
         cerr<<"  -timed [<double> [<int> <int>]]   texgen thread range and 
runtime (in seconds)\n";
-        throw IllegalArgument("scene dynlt", i, args);
+       cerr<<"  -gridtype <int>                   1 for default, 2 for CGT";
       }
     }
     
@@ -252,12 +256,19 @@
     // Create color map
     unsigned int type=RegularColorMap::parseType("InvRainbowIso");
     RegularColorMap* cmap=new RegularColorMap(type);
+    Object* tsteps = NULL;
 
+    if (gridType == 1) //Default grid
+      {
     // Load particle data, add particles to group
-    DynLTParticles* tsteps=new DynLTParticles(fname, ncells, depth, radius,
+    tsteps=new DynLTParticles(fname, ncells, depth, radius,
                                               ridx, cmap, cidx, queue);
-    queue->resizeHeapIdx(tsteps->getNParticles(0));
-
+    queue->resizeHeapIdx(((DynLTParticles*)tsteps)->getNParticles(0));
+    }
+    else //CGT
+   {
+     //TODO: insert CGT grid stuff here
+   }
     // Initialize the scene
     if (env_fname != "" && use_envmap)
       scene->setBackground(bg);

Modified: trunk/scenes/particleCGTTest.cc
==============================================================================
--- trunk/scenes/particleCGTTest.cc     (original)
+++ trunk/scenes/particleCGTTest.cc     Fri Jul 20 02:13:39 2007
@@ -101,7 +101,7 @@
        grid->rebuild(pGroup);
        world->add(grid);
        //world->add(pGroup);
-       world->add(new Sphere(lam, Vector(0,0,0), 0.001f));
+       //world->add(new Sphere(lam, Vector(0,0,0), 0.001f));
 
        scene->setObject(world);
        LightSet* lights = new LightSet();

Modified: trunk/scenes/pcgt.cc
==============================================================================
--- trunk/scenes/pcgt.cc        (original)
+++ trunk/scenes/pcgt.cc        Fri Jul 20 02:13:39 2007
@@ -32,7 +32,7 @@
   int cidx = 0;
   string env_fname = "";
   string fname = "";
-  double radius = 1.;
+  double radius = 0.001; //Carson: radius must be smaller than a certain 
value based on the dispersion of the spheres or else the sphere_center method 
doesn't work with macrocells apparently ....  
   int ridx = -1;
   double lx = 10.;
   double ly = 10.;
@@ -82,16 +82,16 @@
   RegularColorMap* cmap = new RegularColorMap(type);
 
   // XXX(cpg) - There are some problems here:
-  //   1.  Get bus error without the random, manually added sphere at (0, 0, 
0)
+  //   1.  Get bus error without the random, manually added sphere at (0, 0, 
0)  //Carson: fixed
   //   2.  I don't understand the scene <- world <- particles <- data 
mapping.
   //       Why so many layers of groups?  It seems to me that ParticleGrid 
should
   //       be the scene's primary object, unless we're loading multiple time 
steps
-  //       (see pnrrd.cc).
-  //   3.  Doesn't support variable radii
-  //   3.  Doesn't support run time color mapping
+  //       (see pnrrd.cc).  //Carson:  I was using multiple objects in the 
scene, it has been changed.  The world group doesn't really add any overhead 
that I'm aware of, just a container to add stuff to.
+  //   3.  Doesn't support variable radii  //Carson:  ParticleCGT does 
support variable radii as it uses the Sphere intersection test, you just need 
it in the data file or specify some kind of random radius when you build the 
group of spheres.
+  //   3.  Doesn't support run time color mapping // Carson: a colormapped 
material can be added to the spheres
 
   // ***** begin copy (more or less) from ParticleCGTTest.cc *****
-  Group* world = new Group;
+  //Group* world = new Group;
   Group* particles = new Group;
 
   Material* material = new Lambertian(Color(RGB(1, 0, 0)));
@@ -105,9 +105,9 @@
 
   ParticleGrid* grid = new ParticleGrid;
   grid->rebuild(particles);
-  world->add(grid);
-  world->add(new Sphere(material, Vector(0,0,0), radius));
-  scene->setObject(world);
+  //world->add(grid);
+  //world->add(new Sphere(material, Vector(0,0,0), radius));
+  scene->setObject(grid);
   // ***** end copy *****
 
   // Set background




  • [MANTA] r1517 - in trunk: Core/Math Model/Materials scenes, brownlee, 07/20/2007

Archive powered by MHonArc 2.6.16.

Top of page