Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r791 - in branches/vertical: . Engine/Control Engine/PixelSamplers Engine/Renderers Engine/Shadows Interface Model/AmbientLights Model/Materials Model/Primitives StandAlone tests/perftest


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r791 - in branches/vertical: . Engine/Control Engine/PixelSamplers Engine/Renderers Engine/Shadows Interface Model/AmbientLights Model/Materials Model/Primitives StandAlone tests/perftest
  • Date: Thu, 15 Dec 2005 17:05:17 -0700 (MST)

Author: sparker
Date: Thu Dec 15 17:05:13 2005
New Revision: 791

Modified:
   branches/vertical/Engine/Control/RTRT.cc
   branches/vertical/Engine/Control/RTRT_register.cc
   branches/vertical/Engine/PixelSamplers/SingleSampler.cc
   branches/vertical/Engine/Renderers/Moire.cc
   branches/vertical/Engine/Renderers/NullRenderer.cc
   branches/vertical/Engine/Renderers/Raytracer.cc
   branches/vertical/Engine/Shadows/HardShadows.cc
   branches/vertical/Engine/Shadows/NoShadows.cc
   branches/vertical/Interface/AmbientLight.h
   branches/vertical/Interface/HitInfo.h
   branches/vertical/Interface/RayPacket.h
   branches/vertical/MantaTypes.h
   branches/vertical/Model/AmbientLights/ConstantAmbient.cc
   branches/vertical/Model/AmbientLights/ConstantAmbient.h
   branches/vertical/Model/Materials/CMakeLists.txt
   branches/vertical/Model/Materials/Phong.cc
   branches/vertical/Model/Primitives/Sphere.cc
   branches/vertical/StandAlone/CMakeLists.txt
   branches/vertical/StandAlone/manta.cc
   branches/vertical/tests/perftest/CMakeLists.txt
Log:
Far from working, but it compiles.
Crashes on startup though :(


Modified: branches/vertical/Engine/Control/RTRT.cc
==============================================================================
--- branches/vertical/Engine/Control/RTRT.cc    (original)
+++ branches/vertical/Engine/Control/RTRT.cc    Thu Dec 15 17:05:13 2005
@@ -72,10 +72,12 @@
     ids("RTRT id counter", 1),
     thread_storage( 0 )
 {
+  cerr << "rtrt ctor\n";
   workersWanted=0;
   workersRendering=0;
   workersAnimAndImage=0;
   running=false;
+  cerr << "animstate\n";
   animFrameState.frameNumber = 0;
   animFrameState.frameTime = 0;
   timeMode = MantaInterface::RealTime;
@@ -83,7 +85,9 @@
   frameRate = 15;
   pipelineNeedsSetup = true;
   currentImageCreator = 0;
+  cerr << "register\n";
   registerKnownComponents(this);
+  cerr << "last...\n";
   scene = 0;
   verbose_transactions = false;
   currentPixelSampler = 0;
@@ -1282,7 +1286,7 @@
   currentRenderer->traceEyeRays( render_context, result_rays );
 
   // Check to see if the ray hit anything.
-  if (result_rays.hitInfo(0).wasHit()) {
+  if (result_rays.wasHit(0)){
 
     // Compute hit positions.
     result_rays.computeHitPositions();
@@ -1291,7 +1295,7 @@
     result_rays.computeNormals( render_context );
 
     // Shade.
-    result_rays.hitInfo(0).hitMaterial()->shade( render_context, result_rays 
);
+    result_rays.hitMaterial(0)->shade( render_context, result_rays );
   }
   result_color = result_rays.getResult(0);
 }

Modified: branches/vertical/Engine/Control/RTRT_register.cc
==============================================================================
--- branches/vertical/Engine/Control/RTRT_register.cc   (original)
+++ branches/vertical/Engine/Control/RTRT_register.cc   Thu Dec 15 17:05:13 
2005
@@ -81,10 +81,10 @@
     engine->registerComponent("raytracer", &Raytracer::create);
 
     // Register cameras
-    engine->registerComponent("environment", &EnvironmentCamera::create);
+    //engine->registerComponent("environment", &EnvironmentCamera::create);
     engine->registerComponent("pinhole", &PinholeCamera::create);
-    engine->registerComponent("orthogonal", &OrthogonalCamera::create);
-    engine->registerComponent("fisheye", &FisheyeCamera::create);
+    //engine->registerComponent("orthogonal", &OrthogonalCamera::create);
+    //engine->registerComponent("fisheye", &FisheyeCamera::create);
 
     // Register shadow algorithms
     engine->registerComponent("noshadows", &NoShadows::create);
@@ -102,7 +102,7 @@
 
     // Register groups
     engine->registerObject("group", &Group::create);
-    engine->registerObject("grid", &GriddedGroup::create);
-    engine->registerObject("bvh", &BVH::create);
+    //engine->registerObject("grid", &GriddedGroup::create);
+    //engine->registerObject("bvh", &BVH::create);
   }
 }

Modified: branches/vertical/Engine/PixelSamplers/SingleSampler.cc
==============================================================================
--- branches/vertical/Engine/PixelSamplers/SingleSampler.cc     (original)
+++ branches/vertical/Engine/PixelSamplers/SingleSampler.cc     Thu Dec 15 
17:05:13 2005
@@ -4,6 +4,8 @@
 #include <Interface/Fragment.h>
 #include <Interface/RayPacket.h>
 #include <Interface/Renderer.h>
+#include <iostream>
+using namespace std;
 
 using namespace Manta;
 
@@ -95,6 +97,7 @@
     }
     
     // Trace the rays.  The results will automatically go into the fragment
+    cerr << "trace fragment: " << rays.getImageCoordinates(0, 0) << " " << 
rays.getImageCoordinates(0, 1) << "\n";
     context.renderer->traceEyeRays(context, rays);
 
     for(int i=0;i<size;i++){

Modified: branches/vertical/Engine/Renderers/Moire.cc
==============================================================================
--- branches/vertical/Engine/Renderers/Moire.cc (original)
+++ branches/vertical/Engine/Renderers/Moire.cc Thu Dec 15 17:05:13 2005
@@ -2,6 +2,7 @@
 #include <Engine/Renderers/Moire.h>
 #include <Core/Color/GrayColor.h>
 #include <Core/Exceptions/IllegalArgument.h>
+#include <Core/Math/Trig.h>
 #include <Core/Util/Args.h>
 #include <Core/Util/Assert.h>
 #include <Interface/Context.h>
@@ -56,10 +57,11 @@
   double phase = context.frameState->frameTime * M_PI;
   double cycles = 100;
   for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& p = rays.get(i);
-    double dist2 = p.imageX*p.imageX + p.imageY*p.imageY;
-    double val = cos(dist2*2*M_PI*cycles+phase)/2+0.5;
-    p.color = Color(GrayColor(val));
+    Real ix = rays.getImageCoordinates(i, 0);
+    Real iy = rays.getImageCoordinates(i, 1);
+    Real dist2 = ix*ix + iy*iy;
+    Real val = Cos(dist2*2*M_PI*cycles+phase)/2+0.5;
+    rays.setResult(i, Color(GrayColor(val)));
   }
 }
 

Modified: branches/vertical/Engine/Renderers/NullRenderer.cc
==============================================================================
--- branches/vertical/Engine/Renderers/NullRenderer.cc  (original)
+++ branches/vertical/Engine/Renderers/NullRenderer.cc  Thu Dec 15 17:05:13 
2005
@@ -39,15 +39,13 @@
 {
   ASSERT(rays.getFlag(RayPacket::HaveImageCoordinates));
   for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& p = rays.get(i);
-    p.color = color;
+    rays.setResult(i, color);
   }
 }
 
 void NullRenderer::traceRays(const RenderContext&, RayPacket& rays)
 {
   for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& p = rays.get(i);
-    p.color = color;
+    rays.setResult(i, color);
   }
 }

Modified: branches/vertical/Engine/Renderers/Raytracer.cc
==============================================================================
--- branches/vertical/Engine/Renderers/Raytracer.cc     (original)
+++ branches/vertical/Engine/Renderers/Raytracer.cc     Thu Dec 15 17:05:13 
2005
@@ -8,6 +8,8 @@
 #include <Interface/RayPacket.h>
 #include <Interface/Scene.h>
 #include <Core/Util/Assert.h>
+#include <iostream>
+using namespace std;
 
 using namespace Manta;
 
@@ -52,18 +54,18 @@
   // Go through the ray packet and shade them.  Group rays that hit the
   // same object and material to shade with a single shade call
   for(int i = 0;i<rays.getSize();){
-    if(rays.hitInfo(i).wasHit()){
-      const Material* hit_matl = rays.hitInfo(i).hitMaterial();
+    if(rays.wasHit(i)){
+      const Material* hit_matl = rays.hitMaterial(i);
       int end = i+1;
-      while(end < rays.getSize() && rays.hitInfo(end).wasHit() &&
-            rays.hitInfo(end).hitMaterial() == hit_matl)
+      while(end < rays.getSize() && rays.wasHit(end) &&
+            rays.hitMaterial(end) == hit_matl)
        end++;
       RayPacket subPacket(rays, i, end);
       hit_matl->shade(context, subPacket);
       i=end;
     } else {
       int end = i+1;
-      while(end < rays.getSize() && !rays.hitInfo(end).wasHit())
+      while(end < rays.getSize() && !rays.wasHit(end))
        end++;
       RayPacket subPacket(rays, i, end);
       context.scene->getBackground()->shade(context, subPacket);

Modified: branches/vertical/Engine/Shadows/HardShadows.cc
==============================================================================
--- branches/vertical/Engine/Shadows/HardShadows.cc     (original)
+++ branches/vertical/Engine/Shadows/HardShadows.cc     Thu Dec 15 17:05:13 
2005
@@ -83,47 +83,49 @@
 
   int sidx = 0;
   int end = start;
+#if 0
   while(end < rays.getSize() && sidx+nlights <= RayPacket::MaxSize){
 
     RayPacket::Element& e = rays.get(end++);
 
-               // Specify the beginning index for this ray in the shadow 
packet.
+    // Specify the beginning index for this ray in the shadow packet.
     e.shadowBegin = sidx;
 
-               // Iterate over the lights and create shadow rays.
+    // Iterate over the lights and create shadow rays.
     for(int l=0;l<nlights;l++){
                
-                       Vector dir;
-                       Color  color;
+      Vector dir;
+      Color  color;
                
-                 // Compute the contribution for this light.
-                       lights->getLight(l)->computeLight( color, dir, 
context, e );
+      // Compute the contribution for this light.
+      lights->getLight(l)->computeLight( color, dir, context, e );
       
-                       // Check to see if the light is on the front face.
+      // Check to see if the light is on the front face.
       if(Dot(dir, e.normal) > 0) {
                        
-                               // If so normalize and compute length.
-                               Real length = dir.normalize();
-                       
-                               // Populate the shadow ray.
-                               RayPacket::Element& s = 
shadow_rays.get(sidx++);
-                               s.ray.set( e.hitPosition, dir );
-                               s.light = color;
-                               s.hitInfo.reset( length );
+        // If so normalize and compute length.
+        Real length = dir.normalize();
+       
+        // Populate the shadow ray.
+        RayPacket::Element& s = shadow_rays.get(sidx++);
+        s.ray.set( e.hitPosition, dir );
+        s.light = color;
+        s.hitInfo.reset( length );
       }
     }
     e.shadowEnd = sidx;
   }
+#endif
        
-       // Send the shadow rays.
+  // Send the shadow rays.
   shadow_rays.setFlag( 
RayPacket::NormalizedDirections|RayPacket::HaveHitRecords );
   shadow_rays.resize ( sidx );
        
-       // Check to see if all of the shadow rays start from the same input 
ray.
+  // Check to see if all of the shadow rays start from the same input ray.
   if(end == start+1)
     shadow_rays.setFlag( RayPacket::ConstantOrigin );
   
-       context.scene->getObject()->intersect(context, shadow_rays);
+  context.scene->getObject()->intersect(context, shadow_rays);
        
   return end;
 }

Modified: branches/vertical/Engine/Shadows/NoShadows.cc
==============================================================================
--- branches/vertical/Engine/Shadows/NoShadows.cc       (original)
+++ branches/vertical/Engine/Shadows/NoShadows.cc       Thu Dec 15 17:05:13 
2005
@@ -25,30 +25,33 @@
 {
   int nlights = lights->numLights();
   rays.computeHitPositions();
-       
+
   int sidx = 0;
+#if 0
   while(start < rays.getSize() && sidx+nlights < RayPacket::MaxSize){
     RayPacket::Element& e = rays.get(start++);
     e.shadowBegin = sidx;
     for(int l = 0;l<nlights;l++){
-                       Color color;
-                       Vector dir;
+      Color color;
+      Vector dir;
                
-                       // Compute the direction & color of this light.
-                       
lights->getLight(l)->computeLight(color,dir,context,e);
+      // Compute the direction & color of this light.
+      lights->getLight(l)->computeLight(color,dir,context,e);
                
-                       // Construct the shadow ray.
+      // Construct the shadow ray.
       RayPacket::Element& s = shadowRays.get(sidx);
                        
       if(Dot(dir, e.normal)  > 0){
-                               sidx++;
+        sidx++;
         // Be sure to normalize the normals
-                               s.ray.setDirection(dir.normal());
-                               s.light = color;
+        s.ray.setDirection(dir.normal());
+        s.light = color;
       }
     }
     e.shadowEnd = sidx;
   }
+#endif
+
   // We already normalized the rays, so indicate that so we don't do
   // redundant work.
   shadowRays.setFlag( RayPacket::NormalizedDirections );

Modified: branches/vertical/Interface/AmbientLight.h
==============================================================================
--- branches/vertical/Interface/AmbientLight.h  (original)
+++ branches/vertical/Interface/AmbientLight.h  Thu Dec 15 17:05:13 2005
@@ -2,9 +2,11 @@
 #ifndef Manta_Interface_AmbientLight_h
 #define Manta_Interface_AmbientLight_h
 
+#include <MantaTypes.h>
 #include <sgi_stl_warnings_off.h>
 #include <string>
 #include <sgi_stl_warnings_on.h>
+#include <Interface/RayPacket.h>
 
 namespace Manta {
   class PreprocessContext;
@@ -16,7 +18,7 @@
     virtual ~AmbientLight();
 
     virtual void preprocess(const PreprocessContext& context) = 0;
-    virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays) const = 0;
+    virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays, ColorArray result) const = 0;
 
     // This function will return a newly allocated pointer of a string
     // representation of the object.  You should delete it yourself.

Modified: branches/vertical/Interface/HitInfo.h
==============================================================================
--- branches/vertical/Interface/HitInfo.h       (original)
+++ branches/vertical/Interface/HitInfo.h       Thu Dec 15 17:05:13 2005
@@ -82,12 +82,12 @@
     }
     void scaleT(Real scale) {
       if(hitMatl != 0)
-                               min_t *= scale;
+        min_t *= scale;
     }
     void overrideT(Real new_mint) {
       min_t = new_mint;
     }
-               
+
     bool hit(Real t, const Material* matl, const Primitive* prim,
                                                 const TexCoordMapper* tex) {
       if(t < (Real)T_EPSILON)

Modified: branches/vertical/Interface/RayPacket.h
==============================================================================
--- branches/vertical/Interface/RayPacket.h     (original)
+++ branches/vertical/Interface/RayPacket.h     Thu Dec 15 17:05:13 2005
@@ -12,11 +12,11 @@
 
 namespace Manta {
   class RayPacketData {
+  public:
     enum {
       MaxScratchpadSize = 128,
       Size            = 32
     };
-  public:
     RayPacketData()
       {
       }
@@ -40,8 +40,8 @@
     Real texCoords[3][Size];
 
     // Color-based arrays
-    Real color[Color::NumComponents][Size];
-    Real importance[Color::NumComponents][Size];
+    Color::ComponentType color[Color::NumComponents][Size];
+    Color::ComponentType importance[Color::NumComponents][Size];
 
     // Int-based arrays
     int whichEye[Size];
@@ -50,6 +50,8 @@
     char scratchpad_data[Size][MaxScratchpadSize];
   };
 
+  typedef Color::ComponentType 
ColorArray[Color::NumComponents][RayPacketData::Size];
+
 #if 0
     struct Element {
       Point   texCoords;
@@ -91,16 +93,17 @@
       ConstantSigns         = 0x1000
     };
 
-    RayPacket(RayPacketData& data, int size, int depth, int flags);
+    RayPacket(RayPacketData& data, int size, int depth, int flags)
+      : data(&data), start(0), end(size), depth(depth), flags(flags)
+      {
+      }
 
     // Create a subset of another raypacket
-    RayPacket(RayPacket& parent, int start, int end);
-#if 0
-      : data(parent.data+start), size(end-start), depth(parent.depth),
-        flags(parent.flags)
+    RayPacket(RayPacket& parent, int start, int end)
+      : data(parent.data), start(parent.start+start), end(parent.start+end),
+        depth(parent.depth), flags(parent.flags)
       {
       }
-#endif
 
     ~RayPacket()
     {
@@ -127,10 +130,10 @@
       flags &= ~flag;
     }
     int getSize() const {
-      return size;
+      return end-start;
     }
     void resetHit() {
-      for(int i=0;i<size;i++){
+      for(int i=start;i<end;i++){
         data->hitMatl[i] = 0;
         data->minT[i] = MAXT;
       }
@@ -139,7 +142,7 @@
 
     void resize(int newSize)
     {
-      size = newSize;
+      start = 0; end = newSize;
     }
 
     void setPixel(int which, int whichEye, Real imageX, Real imageY)
@@ -159,6 +162,13 @@
       for(int i=0;i<Color::NumComponents;i++)
         data->importance[i][which] = importance[i];
     }
+    Color getImportance(int which)
+    {
+      Color result;
+      for(int i=0;i<Color::NumComponents;i++)
+        result[i] = data->importance[i][which];
+      return result;
+    }
 
     Real getImageCoordinates(int which, int dim)
     {
@@ -246,20 +256,27 @@
 #     endif
       return *(T*)data->scratchpad_data[which];
     }
-#if 0
     Color getResult(int which) const
     {
-      return data[which].color;
+      Color result;
+      for(int i=0;i<Color::NumComponents;i++)
+        result[i] = data->color[i][which];
+      return result;
+    }
+    Color getColor(int which) const
+    {
+      Color result;
+      for(int i=0;i<Color::NumComponents;i++)
+        result[i] = data->color[i][which];
+      return result;
     }
-#endif
-
     void normalizeDirections()
     {
       if(flags & NormalizedDirections)
         return;
 
       if(flags & HaveHitRecords){
-        for(int i=0;i<size;i++){
+        for(int i=start;i<end;i++){
           Real sum = 0;
           for(int j=0;j<3;j++)
             sum += data->direction[j][i] * data->direction[j][i];
@@ -271,7 +288,7 @@
             data->direction[j][i] *= scale;
         }
       } else {
-        for(int i=0;i<size;i++){
+        for(int i=start;i<end;i++){
           Real sum = 0;
           for(int j=0;j<3;j++)
             sum += data->direction[j][i] * data->direction[j][i];
@@ -287,7 +304,7 @@
     {
       if(flags & HaveHitPositions)
         return;
-      for(int i=0;i<size;i++) {
+      for(int i=start;i<end;i++) {
         for(int j=0;j<3;j++)
           data->hitPosition[j][i] = data->origin[j][i] + 
data->direction[j][i] * data->minT[i];
       }
@@ -326,16 +343,12 @@
     }
 #endif
 
-    void computeTextureCoordinates2(const RenderContext& context);
-    void computeTextureCoordinates3(const RenderContext& context);
-#if 0
+    // These aren't right - the texture object may not be consecutive
     void computeTextureCoordinates2(const RenderContext& context)
     {
       if(flags & (HaveTexture2|HaveTexture3))
         return;
-      not right - shouldnt we make sure it is consecutive
-      Element& e0 = data[0];
-      const TexCoordMapper* tex = e0.hitInfo.hitTexCoordMapper();
+      const TexCoordMapper* tex = data->hitTex[start];
       tex->computeTexCoords2(context, *this);
       flags |= HaveTexture2;
     }
@@ -343,12 +356,10 @@
     {
       if(flags & HaveTexture3)
         return;
-      Element& e0 = data[0];
-      const TexCoordMapper* tex = e0.hitInfo.hitTexCoordMapper();
+      const TexCoordMapper* tex = data->hitTex[start];
       tex->computeTexCoords3(context, *this);
       flags |= HaveTexture2|HaveTexture3;
     }
-#endif
 #if 0
     void computeFrame(const RenderContext& context)
     {
@@ -367,14 +378,14 @@
         return;
       
       // Compute normals
-      for(int i=0;i<size;){
+      for(int i=start;i<end;){
         const Primitive* prim = data->hitPrim[i];
-        int end = i+1;
-        while(end < size && data->hitPrim[end] == prim)
-          end++;
-        RayPacket subPacket(*this, i, end);
+        int tend = i+1;
+        while(tend < end && data->hitPrim[tend] == prim)
+          tend++;
+        RayPacket subPacket(*this, i, tend);
         prim->computeNormal(context, subPacket);
-        i=end;
+        i=tend;
       }
       
       flags |= HaveNormals;
@@ -395,19 +406,27 @@
       return depth;
     }
 
-#if 0
     void initializeImportance()
     {
-      for(int i=0;i<size;i++)
-        data[i].importance = Color::white();
+      for(int j=0;j<Color::NumComponents;j++)
+        for(int i=start;i<end;i++)
+          data->importance[j][i] = 1;
+    }
+    bool wasHit(int which)
+    {
+      return data->hitMatl[which] != 0;
+    }
+    const Material* hitMaterial(int which)
+    {
+      return data->hitMatl[which];
     }
-#endif
   private:
     RayPacket(const RayPacket&);
     RayPacket& operator=(const RayPacket&);
 
     RayPacketData* data;
-    int size;
+    int start;
+    int end;
     int depth;
     int flags;
   };

Modified: branches/vertical/MantaTypes.h
==============================================================================
--- branches/vertical/MantaTypes.h      (original)
+++ branches/vertical/MantaTypes.h      Thu Dec 15 17:05:13 2005
@@ -56,6 +56,7 @@
   // Transforms - forward declarations
   template<typename T> class AffineTransformT;
   typedef AffineTransformT<Real> AffineTransform;
+
 }
 
 #endif

Modified: branches/vertical/Model/AmbientLights/ConstantAmbient.cc
==============================================================================
--- branches/vertical/Model/AmbientLights/ConstantAmbient.cc    (original)
+++ branches/vertical/Model/AmbientLights/ConstantAmbient.cc    Thu Dec 15 
17:05:13 2005
@@ -24,13 +24,11 @@
 }
 
 void ConstantAmbient::computeAmbient(const RenderContext&,
-                                    RayPacket& rays) const
+                                    RayPacket& rays, ColorArray result) const
 {
-  NOT_FINISHED("computeAmbient");
-#if 0
-  for(int i=0;i<rays.getSize();i++)
-    rays.get(i).ambientLight = color;
-#endif
+  for(int j=0;j<Color::NumComponents;j++)
+    for(int i=0;i<rays.getSize();i++)
+      result[j][i] = color[j];
 }
 
 string ConstantAmbient::toString() const {

Modified: branches/vertical/Model/AmbientLights/ConstantAmbient.h
==============================================================================
--- branches/vertical/Model/AmbientLights/ConstantAmbient.h     (original)
+++ branches/vertical/Model/AmbientLights/ConstantAmbient.h     Thu Dec 15 
17:05:13 2005
@@ -16,7 +16,7 @@
     virtual ~ConstantAmbient();
 
     virtual void preprocess(const PreprocessContext&);
-    virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays) const;
+    virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays, ColorArray result) const;
 
     virtual std::string toString() const;
   private:

Modified: branches/vertical/Model/Materials/CMakeLists.txt
==============================================================================
--- branches/vertical/Model/Materials/CMakeLists.txt    (original)
+++ branches/vertical/Model/Materials/CMakeLists.txt    Thu Dec 15 17:05:13 
2005
@@ -10,8 +10,8 @@
      #Materials/Flat.cc
      #Materials/Lambertian.h
      #Materials/Lambertian.cc
-     #Materials/LitMaterial.h
-     #Materials/LitMaterial.cc
+     Materials/LitMaterial.h
+     Materials/LitMaterial.cc
      #Materials/MetalMaterial.h
      #Materials/MetalMaterial.cc
      #Materials/NormalMaterial.h

Modified: branches/vertical/Model/Materials/Phong.cc
==============================================================================
--- branches/vertical/Model/Materials/Phong.cc  (original)
+++ branches/vertical/Model/Materials/Phong.cc  Thu Dec 15 17:05:13 2005
@@ -11,6 +11,7 @@
 #include <Interface/Scene.h>
 #include <Interface/ShadowAlgorithm.h>
 #include <Model/Textures/Constant.h>
+#include <Core/Util/NotFinished.h>
 
 using namespace Manta;
 
@@ -62,7 +63,8 @@
   rays.computeNormals(context);
 
   // Compute ambient contributions for all rays
-  activeLights->getAmbientLight()->computeAmbient(context, rays);
+  ColorArray ambientLight;
+  activeLights->getAmbientLight()->computeAmbient(context, rays, 
ambientLight);
 
   // We normalized directions for proper dot product computation.
   rays.normalizeDirections();
@@ -70,6 +72,7 @@
   RayPacketData data;
   int start = 0;
 
+#if 0
   do {
     RayPacket shadowRays(data, 0, rays.getDepth(), 0);
     int end = context.shadowAlgorithm->computeShadows(context, activeLights,
@@ -80,8 +83,12 @@
 
     for(int i=start;i<end;i++){
       // Initialize with the ambient contribution.
-      Color totalDiffuse(e.ambientLight);
+      Color totalDiffuse;
+      for(int j=0;j<Color::NumComponents;j++)
+        totalDiffuse[j] = ambientLight[j][i];
       Color totalSpecular = Color::black();
+      NOT_FINISHED("Phong lighting");
+#if 0
       for(int j=e.shadowBegin;j<e.shadowEnd;j++){
         RayPacket::Element& s = shadowRays.get(j);
         if(!s.hitInfo.wasHit()){
@@ -96,10 +103,12 @@
           }
         }
       }
+#endif
       rays.setResult(i, diffuse[i]*totalDiffuse+specular[i]*totalSpecular);
     }
     start = end;
   } while(start < rays.getSize());
+#endif
 
   // Compute reflections
   if(do_refl && rays.getDepth() < 
context.scene->getRenderParameters().maxDepth){

Modified: branches/vertical/Model/Primitives/Sphere.cc
==============================================================================
--- branches/vertical/Model/Primitives/Sphere.cc        (original)
+++ branches/vertical/Model/Primitives/Sphere.cc        Thu Dec 15 17:05:13 
2005
@@ -60,22 +60,20 @@
   case RayPacket::ConstantOrigin|RayPacket::NormalizedDirections:
     {
       // Rays of constant origin and normalized directions
-      RayPacket::Element& e0 = rays.get(0);
-      Vector O(e0.ray.origin()-center);
+      Vector O(rays.getOrigin(0)-center);
       Real C = Dot(O, O) - radius*radius;
       for(int i = 0;i<rays.getSize();i++){
-        RayPacket::Element& e = rays.get(i);
-        const Vector& D(e.ray.direction());
+        Vector D(rays.getDirection(i));
         Real B = Dot(O, D);
         Real disc = B*B-C;
         if(disc >= 0){
           Real r = Sqrt(disc);
           Real t0 = -(r+B);
           if(t0 > T_EPSILON){
-            e.hitInfo.hit(t0, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t0, getMaterial(), this, getTexCoordMapper());
           } else {
             Real t1 = r-B;
-            e.hitInfo.hit(t1, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t1, getMaterial(), this, getTexCoordMapper());
           }
         }
       }
@@ -84,12 +82,10 @@
   case RayPacket::ConstantOrigin:
     {
       // Rays of constant origin for not normalized directions
-      RayPacket::Element& e0 = rays.get(0);
-      Vector O(e0.ray.origin()-center);
+      Vector O(rays.getOrigin(0)-center);
       Real C = Dot(O, O) - radius*radius;
       for(int i = 0;i<rays.getSize();i++){
-        RayPacket::Element& e = rays.get(i);
-        const Vector& D(e.ray.direction());
+        Vector D(rays.getDirection(i));
         Real A = Dot(D, D);
         Real B = Dot(O, D);
         Real disc = B*B-A*C;
@@ -97,10 +93,10 @@
           Real r = Sqrt(disc);
           Real t0 = -(r+B)/A;
           if(t0 > T_EPSILON){
-            e.hitInfo.hit(t0, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t0, getMaterial(), this, getTexCoordMapper());
           } else {
             Real t1 = (r-B)/A;
-            e.hitInfo.hit(t1, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t1, getMaterial(), this, getTexCoordMapper());
           }
         }
       }
@@ -110,9 +106,8 @@
     {
       // Rays of non-constant origin and normalized directions
       for(int i = 0;i<rays.getSize();i++){
-        RayPacket::Element& e = rays.get(i);
-        Vector O(e.ray.origin()-center);
-        const Vector& D(e.ray.direction());
+        Vector O(rays.getOrigin(i)-center);
+        Vector D(rays.getDirection(i));
         Real B = Dot(O, D);
         Real C = Dot(O, O) - radius*radius;
         Real disc = B*B-C;
@@ -120,10 +115,10 @@
           Real r = Sqrt(disc);
           Real t0 = -(r+B);
           if(t0 > T_EPSILON){
-            e.hitInfo.hit(t0, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t0, getMaterial(), this, getTexCoordMapper());
           } else {
             Real t1 = r-B;
-            e.hitInfo.hit(t1, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t1, getMaterial(), this, getTexCoordMapper());
           }
         }
       }
@@ -133,9 +128,8 @@
     {
       // Rays of non-constant origin and non-normalized directions
       for(int i = 0;i<rays.getSize();i++){
-        RayPacket::Element& e = rays.get(i);
-        Vector O(e.ray.origin()-center);
-        const Vector& D(e.ray.direction());
+        Vector O(rays.getOrigin(i)-center);
+        Vector D(rays.getDirection(i));
         Real A = Dot(D, D);
         Real B = Dot(O, D);
         Real C = Dot(O, O) - radius*radius;
@@ -144,10 +138,10 @@
           Real r = Sqrt(disc);
           Real t0 = -(r+B)/A;
           if(t0 > T_EPSILON){
-            e.hitInfo.hit(t0, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t0, getMaterial(), this, getTexCoordMapper());
           } else {
             Real t1 = (r-B)/A;
-            e.hitInfo.hit(t1, getMaterial(), this, getTexCoordMapper());
+            rays.hit(i, t1, getMaterial(), this, getTexCoordMapper());
           }
         }
       }
@@ -161,9 +155,9 @@
 {
   rays.computeHitPositions();
   for(int i = 0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    e.normal = e.hitPosition-center;
-    e.normal*=inv_radius;
+    Vector n = rays.getHitPosition(i) - center;
+    n *= inv_radius;
+    rays.setNormal(i, n);
   }
   rays.setFlag(RayPacket::HaveUnitNormals);
 }
@@ -173,16 +167,13 @@
 {
   rays.computeHitPositions();
   for(int i = 0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    Vector n = (e.hitPosition-center)*inv_radius;
+    Vector n = (rays.getHitPosition(i)-center)*inv_radius;
     Real angle = Clamp(n.z(), (Real)-1, (Real)1);
     Real theta = Acos(angle);
     Real phi = Atan2(n.x(), n.y());
     Real x = (phi+(Real)M_PI)*((Real)0.5*(Real)M_1_PI);
     Real y = theta*(Real)M_1_PI;
-    e.texCoords = Point(x,
-                        y,
-                        0);
+    rays.setTexCoords(i, Point(x, y, 0));
   }
   rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
 }
@@ -192,14 +183,13 @@
 {
   rays.computeHitPositions();
   for(int i = 0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    Vector n = (e.hitPosition-center)*inv_radius;
+    Vector n = (rays.getHitPosition(i)-center)*inv_radius;
     Real angle = Clamp(n.z(), (Real)-1, (Real)1);
     Real theta = Acos(angle);
     Real phi = Atan2(n.x(), n.y());
-    e.texCoords = Point((phi+(Real)M_PI)*((Real)0.5*(Real)M_1_PI),
-                        theta*(Real)M_1_PI,
-                        0);
+    rays.setTexCoords(i, Point((phi+(Real)M_PI)*((Real)0.5*(Real)M_1_PI),
+                               theta*(Real)M_1_PI,
+                               0));
   }
   rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
 }

Modified: branches/vertical/StandAlone/CMakeLists.txt
==============================================================================
--- branches/vertical/StandAlone/CMakeLists.txt (original)
+++ branches/vertical/StandAlone/CMakeLists.txt Thu Dec 15 17:05:13 2005
@@ -19,16 +19,16 @@
 TARGET_LINK_LIBRARIES(barrier_test SCIRun_Core
                                   ${CMAKE_THREAD_LIBS_INIT})
 
-ADD_EXECUTABLE(frust-test frust-test.cc)
-TARGET_LINK_LIBRARIES(frust-test Manta_Engine
-                                 Manta_UserInterface
-                                 Manta_Model
-                                 Manta_Image
-                                 Manta_Interface
-                                 Manta_Core
-                                 SCIRun_Core
-                                 ${CMAKE_THREAD_LIBS_INIT}
-                                 )
+#ADD_EXECUTABLE(frust-test frust-test.cc)
+#TARGET_LINK_LIBRARIES(frust-test Manta_Engine
+#                                 Manta_UserInterface
+#                                 Manta_Model
+#                                 Manta_Image
+#                                 Manta_Interface
+#                                 Manta_Core
+#                                 SCIRun_Core
+#                                 ${CMAKE_THREAD_LIBS_INIT}
+#                                 )
 
 SET (BUILD_V3C1_TOOLS 0 CACHE BOOL "Include .v3c1 tools")
 IF (BUILD_V3C1_TOOLS) 

Modified: branches/vertical/StandAlone/manta.cc
==============================================================================
--- branches/vertical/StandAlone/manta.cc       (original)
+++ branches/vertical/StandAlone/manta.cc       Thu Dec 15 17:05:13 2005
@@ -123,11 +123,14 @@
     args.push_back(argv[i]);
        
   try {
+    cerr << "create\n";
     MantaInterface* rtrt = createManta();
+    cerr << "setscenpath\n";
     if(getenv("MANTA_SCENEPATH"))
       rtrt->setScenePath(getenv("MANTA_SCENEPATH"));
     else
       rtrt->setScenePath(".:../scenes");
+    cerr << "changenumworkers\n";
     rtrt->changeNumWorkers(1);
     if(!rtrt->selectImageType("rgba8"))
       throw InternalError("default image not found", __FILE__, __LINE__);
@@ -173,15 +176,15 @@
         rtrt->addOneShotCallback(MantaInterface::Absolute, warmup+numFrames,
                                  Callback::create(b, &BenchHelper::stop));
       } else if(arg == "-camera"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               currentCamera = rtrt->createCamera(s);
-                               if(!currentCamera){
-                                       cerr << "Error creating camera: " << 
s << ", available cameras are:\n";
-                                       printList(cerr, rtrt->listCameras());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        currentCamera = rtrt->createCamera(s);
+        if(!currentCamera){
+          cerr << "Error creating camera: " << s << ", available cameras 
are:\n";
+          printList(cerr, rtrt->listCameras());
+          exit(1);
+        }
       } else if(arg == "-bbcamera"){
         compute_bb_camera = true;
       } else if(arg == "-idlemode"){
@@ -194,115 +197,115 @@
           exit(1);
         }
       } else if(arg == "-imagedisplay"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->createChannel(s, currentCamera, 
stereo, xres, yres)){
-                                       cerr << "Invalid image display: " << 
s << ", available image displays are:\n";
-                                       printList(cerr, 
rtrt->listImageDisplays());
-                                       exit(1);
-                               }
-                               channelCreated=true;
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->createChannel(s, currentCamera, stereo, xres, yres)){
+          cerr << "Invalid image display: " << s << ", available image 
displays are:\n";
+          printList(cerr, rtrt->listImageDisplays());
+          exit(1);
+        }
+        channelCreated=true;
       } else if(arg == "-imagetraverser"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->selectImageTraverser(s)){
-                                       cerr << "Invalid image traverser: " 
<< s << ", available image traversers are:\n";
-                                       printList(cerr, 
rtrt->listImageTraversers());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->selectImageTraverser(s)){
+          cerr << "Invalid image traverser: " << s << ", available image 
traversers are:\n";
+          printList(cerr, rtrt->listImageTraversers());
+          exit(1);
+        }
       } else if(arg == "-imagetype"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->selectImageType(s)){
-                                       cerr << "Invalid image type: " << s 
<< ", available image types are:\n";
-                                       printList(cerr, 
rtrt->listImageTypes());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->selectImageType(s)){
+          cerr << "Invalid image type: " << s << ", available image types 
are:\n";
+          printList(cerr, rtrt->listImageTypes());
+          exit(1);
+        }
       } else if(arg == "-loadbalancer"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->selectLoadBalancer(s)){
-                                       cerr << "Invalid load balancer: " << 
s << ", available load balancers are:\n";
-                                       printList(cerr, 
rtrt->listLoadBalancers());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->selectLoadBalancer(s)){
+          cerr << "Invalid load balancer: " << s << ", available load 
balancers are:\n";
+          printList(cerr, rtrt->listLoadBalancers());
+          exit(1);
+        }
       } else if(arg == "-np"){
-                               long np;
-                               if(!getLongArg(i, args, np))
-                                       usage(rtrt);
-                               rtrt->changeNumWorkers(static_cast<int>(np));
+        long np;
+        if(!getLongArg(i, args, np))
+          usage(rtrt);
+        rtrt->changeNumWorkers(static_cast<int>(np));
       } else if(arg == "-pixelsampler"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->selectPixelSampler(s)){
-                                       cerr << "Invalid pixel sampler: " << 
s << ", available pixel samplers are:\n";
-                                       printList(cerr, 
rtrt->listPixelSamplers());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->selectPixelSampler(s)){
+          cerr << "Invalid pixel sampler: " << s << ", available pixel 
samplers are:\n";
+          printList(cerr, rtrt->listPixelSamplers());
+          exit(1);
+        }
       } else if(arg == "-renderer"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->selectRenderer(s)){
-                                       cerr << "Invalid renderer: " << s << 
", available renderers are:\n";
-                                       printList(cerr, 
rtrt->listRenderers());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->selectRenderer(s)){
+          cerr << "Invalid renderer: " << s << ", available renderers 
are:\n";
+          printList(cerr, rtrt->listRenderers());
+          exit(1);
+        }
       } else if(arg == "-res"){
-                               if(!getResolutionArg(i, args, xres, yres)){
-                                       cerr << "Error parsing resolution: " 
<< args[i+1] << '\n';
-                                       usage(rtrt);
-                               }
+        if(!getResolutionArg(i, args, xres, yres)){
+          cerr << "Error parsing resolution: " << args[i+1] << '\n';
+          usage(rtrt);
+        }
       } else if(arg == "-stereo") {
         stereo = true;
         
       } else if(arg == "-scene"){
-                               if(rtrt->haveScene())
-                                       cerr << "WARNING: multiple scenes 
specified, will use last one\n";
-                               string scene;
-                               if(!getStringArg(i, args, scene))
-                                       usage(rtrt);
-                               if(!rtrt->readScene(scene)){
-                                       cerr << "Error reading scene: " << 
scene << '\n';
-                                       exit(1);
-                               }
+        if(rtrt->haveScene())
+          cerr << "WARNING: multiple scenes specified, will use last one\n";
+        string scene;
+        if(!getStringArg(i, args, scene))
+          usage(rtrt);
+        if(!rtrt->readScene(scene)){
+          cerr << "Error reading scene: " << scene << '\n';
+          exit(1);
+        }
       } else if(arg == "-shadows"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               if(!rtrt->selectShadowAlgorithm(s)){
-                                       cerr << "Invalid shadow algorithm: " 
<< s << ", available shadow algorithms are:\n";
-                                       printList(cerr, 
rtrt->listShadowAlgorithms());
-                                       exit(1);
-                               }
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        if(!rtrt->selectShadowAlgorithm(s)){
+          cerr << "Invalid shadow algorithm: " << s << ", available shadow 
algorithms are:\n";
+          printList(cerr, rtrt->listShadowAlgorithms());
+          exit(1);
+        }
       } else if(arg == "-ui"){
-                               string s;
-                               if(!getStringArg(i, args, s))
-                                       usage(rtrt);
-                               UserInterface* ui = 
rtrt->createUserInterface(s);
-                               if(!ui){
-                                       cerr << "Unknown user interface: " << 
s << ", available user interfaces are:\n";
-                                       printList(cerr, 
rtrt->listUserInterfaces());
-                                       exit(1);
-                               }
-                               ui->startup();
-                               haveUI = true;
+        string s;
+        if(!getStringArg(i, args, s))
+          usage(rtrt);
+        UserInterface* ui = rtrt->createUserInterface(s);
+        if(!ui){
+          cerr << "Unknown user interface: " << s << ", available user 
interfaces are:\n";
+          printList(cerr, rtrt->listUserInterfaces());
+          exit(1);
+        }
+        ui->startup();
+        haveUI = true;
       } else {
-                               cerr << "Unknown argument: " << arg << '\n';
-                               usage(rtrt);
+        cerr << "Unknown argument: " << arg << '\n';
+        usage(rtrt);
       }
     }
     if(!haveUI){
       UserInterface* ui = rtrt->createUserInterface("X");
       if(!ui){
-                               cerr << "Cannot find default user interface: 
X, available user interfaces are:\n";
-                               printList(cerr, rtrt->listUserInterfaces());
-                               exit(1);
+        cerr << "Cannot find default user interface: X, available user 
interfaces are:\n";
+        printList(cerr, rtrt->listUserInterfaces());
+        exit(1);
       }
       ui->startup();
     }
@@ -347,9 +350,9 @@
 #include <Model/Lights/PointLight.h>
 #include <Model/Textures/Constant.h>
 #include <Model/Textures/CheckerTexture.h>
-#include <Model/Textures/MarbleTexture.h>
+//#include <Model/Textures/MarbleTexture.h>
 #include <Model/Materials/Phong.h>
-#include <Model/Materials/Flat.h>
+//#include <Model/Materials/Flat.h>
 #include <Model/Groups/Group.h>
 #include <Model/Primitives/Parallelogram.h>
 #include <Model/Primitives/Sphere.h>
@@ -357,6 +360,7 @@
 
 Scene* createDefaultScene()
 {
+  cerr << "createDefaultScene\n";
   // Create a default scene.  This scene is used for benchmarks, so
   // please do not change it.  Please create a new scene instead
   Scene* scene = new Scene();
@@ -416,5 +420,6 @@
   lights->setAmbientLight(new ConstantAmbient(Color::black()));
   scene->setLights(lights);
   scene->getRenderParameters().maxDepth = 5;
+  cerr << "madescene\n";
   return scene;
 }

Modified: branches/vertical/tests/perftest/CMakeLists.txt
==============================================================================
--- branches/vertical/tests/perftest/CMakeLists.txt     (original)
+++ branches/vertical/tests/perftest/CMakeLists.txt     Thu Dec 15 17:05:13 
2005
@@ -1,5 +1,5 @@
 
-ADD_EXECUTABLE(perftest1 perftest1.cc)
-TARGET_LINK_LIBRARIES(perftest1 Manta_Engine Manta_Model)
-
-TARGET_LINK_LIBRARIES(perftest1 ${CMAKE_THREAD_LIBS_INIT})
+#ADD_EXECUTABLE(perftest1 perftest1.cc)
+#TARGET_LINK_LIBRARIES(perftest1 Manta_Engine Manta_Model)
+#
+#TARGET_LINK_LIBRARIES(perftest1 ${CMAKE_THREAD_LIBS_INIT})




  • [MANTA] r791 - in branches/vertical: . Engine/Control Engine/PixelSamplers Engine/Renderers Engine/Shadows Interface Model/AmbientLights Model/Materials Model/Primitives StandAlone tests/perftest, sparker, 12/15/2005

Archive powered by MHonArc 2.6.16.

Top of page