Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1453 - in trunk: DynLT scenes


Chronological Thread 
  • From: cgribble@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1453 - in trunk: DynLT scenes
  • Date: Fri, 6 Jul 2007 16:28:45 -0600 (MDT)

Author: cgribble
Date: Fri Jul  6 16:28:45 2007
New Revision: 1453

Modified:
   trunk/DynLT/DynLTWorker.cc
   trunk/scenes/dynlt.cc
Log:
Slight modifications to resurrect the DynLT code; appears to be working on my 
laptop

Modified: trunk/DynLT/DynLTWorker.cc
==============================================================================
--- trunk/DynLT/DynLTWorker.cc  (original)
+++ trunk/DynLT/DynLTWorker.cc  Fri Jul  6 16:28:45 2007
@@ -414,42 +414,35 @@
                        RayPacket::HaveUnitNormals);
 
           // Compute direct lighting at current hit positions
+          ShadowAlgorithm::StateBuffer shadowState;
+          int debugFlag = rays.getAllFlags() & RayPacket::DebugPacket;
           const LightSet* activeLights=grid->getActiveLights();
-          ShadowAlgorithm::StateBuffer stateBuffer;
-          bool firstTime=true;
-          bool done;
           do {
             RayPacketData shadowData;
             RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0,
-                                 rays.getDepth(), 0);
+                                 rays.getDepth(), debugFlag);
 
-            // Call the shadow algorithm (SA) to generate shadow rays.  We
-            // may not be able to compute all of them, so we pass along a
-            // buffer for the SA object to store it's state.  The firstTime
-            // flag tells the SA to fill in the state rather than using
-            // anything in the state buffer.  Most SAs will only need to
-            // store an int or two in the statebuffer.
-            done=rctx.shadowAlgorithm->computeShadows(rctx, activeLights,
-                                                      rays, shadowRays,
-                                                      firstTime,
-                                                      stateBuffer);
-              
-            // Normalize directions for proper dot product computation
+            // Call the shadowalgorithm(sa) to generate shadow rays.
+            // We may not be able to compute all of them, so we pass
+            // along a buffer for the sa object to store it's state.
+            rctx.shadowAlgorithm->computeShadows(rctx, shadowState,
+                                                 activeLights, rays,
+                                                 shadowRays);
+
+            // We need normalized directions for proper dot product 
computation
             shadowRays.normalizeDirections();
 
-            for (int i=shadowRays.begin(); i<shadowRays.end(); ++i) {
-              if (!shadowRays.wasHit(i)) {
-                // Not in shadow, so compute the direct contribution
-                Vector normal=rays.getNormal(i);
-                Vector shadowdir=shadowRays.getDirection(i);
-                Real cos_theta=Dot(shadowdir, normal);
-                Color light=shadowRays.getColor(i);
+            for(int i=shadowRays.begin(); i < shadowRays.end(); i++){
+              if(!shadowRays.wasHit(i)){
+                // Not in shadow, so compute the direct lighting 
contributions.
+                Vector normal = rays.getFFNormal(i);
+                Vector shadowdir = shadowRays.getDirection(i);
+                ColorComponent cos_theta = Dot(shadowdir, normal);
+                Color light = shadowRays.getColor(i);
                 diffuse += atten.get(i)*light.luminance()*cos_theta;
               }
             }
-              
-            firstTime=false;
-          } while(!done);
+          } while(!shadowState.done());
 
           // Don't fill/trace ray packet if it's not going to contribute
           if (d >= max_depth - 1)

Modified: trunk/scenes/dynlt.cc
==============================================================================
--- trunk/scenes/dynlt.cc       (original)
+++ trunk/scenes/dynlt.cc       Fri Jul  6 16:28:45 2007
@@ -71,7 +71,7 @@
     if (arg=="-bv") {
       string s;
       if (!getStringArg(i, args, s))
-        throw IllegalArgument("scene dynplt -bv", i, args);
+        throw IllegalArgument("scene dynlt -bv", i, args);
       world=context.manta_interface->makeGroup(s);
 #endif
       if (arg=="-cidx") {
@@ -79,7 +79,7 @@
           throw IllegalArgument("scene pnrrd -cidx", i, args);
       } else if (arg=="-depth") {
         if (!getIntArg(i, args, depth))
-          throw IllegalArgument("scene dynplt -depth", i, args);
+          throw IllegalArgument("scene dynlt -depth", i, args);
       } else if (arg=="-dilate") {
         dilate=true;
       } else if (arg=="-fifo") {
@@ -88,59 +88,59 @@
       } else if (arg=="-envmap") {
         string s;
         if (!getStringArg(i, args, s))
-          throw IllegalArgument("scene dynplt -envmap", i, args);
+          throw IllegalArgument("scene dynlt -envmap", i, args);
 
         if (s[0] != '-') {
           if (s=="bg") {
             use_envmap=true;
             if (!getStringArg(i, args, env_fname))
-              throw IllegalArgument("scene dynplt -envmap", i, args);
+              throw IllegalArgument("scene dynlt -envmap", i, args);
           } else {
             env_fname=s;
           }
         } else {
-          throw IllegalArgument("scene dynplt -envmap", i, args);
+          throw IllegalArgument("scene dynlt -envmap", i, args);
         }
       } else if (arg=="-i") {
         if (!getStringArg(i, args, fname))
-          throw IllegalArgument("scene dynplt -i", i, args);
+          throw IllegalArgument("scene dynlt -i", i, args);
       } else if (arg=="-lifo") {
         fifo=false;
         lifo=true;
       } else if (arg=="-light") {
         if (!getDoubleArg(i, args, lx))
-          throw IllegalArgument("scene dynplt -light", i, args);
+          throw IllegalArgument("scene dynlt -light", i, args);
         if (!getDoubleArg(i, args, ly))
-          throw IllegalArgument("scene dynplt -light", i, args);
+          throw IllegalArgument("scene dynlt -light", i, args);
         if (!getDoubleArg(i, args, lz))
-          throw IllegalArgument("scene dynplt -light", i, args);
+          throw IllegalArgument("scene dynlt -light", i, args);
       } else if (arg=="-nbounces") {
         if (!getIntArg(i, args, max_depth))
-          throw IllegalArgument("scene dynplt -nbounces", i, args);
+          throw IllegalArgument("scene dynlt -nbounces", i, args);
         ++max_depth;
       } else if (arg=="-ncells") {
         if (!getIntArg(i, args, ncells))
-          throw IllegalArgument("scene dynplt -ncells", i, args);
+          throw IllegalArgument("scene dynlt -ncells", i, args);
       } else if (arg=="-ngroups") {
         if (!getIntArg(i, args, ngroups))
-          throw IllegalArgument("scene dynplt -ngroups", i, args);
+          throw IllegalArgument("scene dynlt -ngroups", i, args);
       } else if (arg=="-nsamples") {
         if (!getIntArg(i, args, nsamples))
-          throw IllegalArgument("scene dynplt -nsamples", i, args);
+          throw IllegalArgument("scene dynlt -nsamples", i, args);
       } else if (arg=="-nthreads") {
         static_threads=true;
         if (!getIntArg(i, args, nthreads))
-          throw IllegalArgument("scene dynplt -nthreads", i, args);
+          throw IllegalArgument("scene dynlt -nthreads", i, args);
       } 
       else if (arg=="-radius") {
         if (!getDoubleArg(i, args, radius))
-          throw IllegalArgument("scene dynplt -radius", i, args);
+          throw IllegalArgument("scene dynlt -radius", i, args);
       } else if (arg=="-ridx") {
         if (!getIntArg(i, args, ridx))
-          throw IllegalArgument("scene dynplt -ridx", i, args);
+          throw IllegalArgument("scene dynlt -ridx", i, args);
       } else if (arg=="-qsize") {
         if (!getIntArg(i, args, qsize))
-          throw IllegalArgument("scene dynplt -qsize", i, args);
+          throw IllegalArgument("scene dynlt -qsize", i, args);
 #ifdef USE_STATS_COLLECTOR
       } else if (arg=="-stats") {
         stats=true;
@@ -153,12 +153,12 @@
             if (getStringArg(i, args, s)) {
               minproc=atoi(s.c_str());
               if (!getIntArg(i, args, maxproc))
-                throw IllegalArgument("scene dynplt -nthreads", i, args);
+                throw IllegalArgument("scene dynlt -nthreads", i, args);
             }
           }
         }
       } else {
-        cerr<<"Valid options for scene dynplt:\n";
+        cerr<<"Valid options for scene dynlt:\n";
         // cerr<<"  -bv <string>                     bounding volume 
{bvh|grid|group}\n";
         cerr<<"  -cidx <int>                       data value index for 
color mapping\n";
         cerr<<"  -depth <int>                      grid depth\n";
@@ -172,7 +172,7 @@
         cerr<<"  -ncells <int>                     grid resolution\n";
         cerr<<"  -ngroups <int>                    number of sample 
groups\n";
         cerr<<"  -nsamples <int>                   number of 
samples/texel\n";
-        cerr<<"  -nthreads <int>                   number of static dynplt 
workers\n";
+        cerr<<"  -nthreads <int>                   number of static dynlt 
workers\n";
         cerr<<"  -qsize <int>                      maximum queue qsize\n";
         cerr<<"  -radius <float>                   particle radius\n";
         cerr<<"  -ridx <int>                       radius index\n";
@@ -180,7 +180,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 dynplt", i, args);
+        throw IllegalArgument("scene dynlt", i, args);
       }
     }
 




  • [MANTA] r1453 - in trunk: DynLT scenes, cgribble, 07/06/2007

Archive powered by MHonArc 2.6.16.

Top of page