Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r809 - in branches/vertical: Core/Color Core/Geometry Engine/Control Interface Model/AmbientLights Model/Backgrounds Model/Cameras


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r809 - in branches/vertical: Core/Color Core/Geometry Engine/Control Interface Model/AmbientLights Model/Backgrounds Model/Cameras
  • Date: Wed, 28 Dec 2005 16:42:28 -0700 (MST)

Author: sparker
Date: Wed Dec 28 16:42:26 2005
New Revision: 809

Removed:
   branches/vertical/Interface/HitInfo.cc
   branches/vertical/Interface/HitInfo.h
Modified:
   branches/vertical/Core/Color/ColorSpace.h
   branches/vertical/Core/Color/ColorSpace_fancy.h
   branches/vertical/Core/Geometry/BBox.h
   branches/vertical/Engine/Control/RTRT.h
   branches/vertical/Interface/AmbientLight.h
   branches/vertical/Interface/CMakeLists.txt
   branches/vertical/Interface/Fragment.cc
   branches/vertical/Interface/Light.h
   branches/vertical/Interface/LightSet.h
   branches/vertical/Interface/MantaInterface.h
   branches/vertical/Interface/Parameters.h
   branches/vertical/Interface/RayPacket.h
   branches/vertical/Interface/RenderParameters.h
   branches/vertical/Interface/TexCoordMapper.h
   branches/vertical/Model/AmbientLights/ArcAmbient.cc
   branches/vertical/Model/AmbientLights/ArcAmbient.h
   branches/vertical/Model/AmbientLights/CMakeLists.txt
   branches/vertical/Model/Backgrounds/CMakeLists.txt
   branches/vertical/Model/Backgrounds/LinearBackground.cc
   branches/vertical/Model/Backgrounds/TextureBackground.cc
   branches/vertical/Model/Cameras/CMakeLists.txt
   branches/vertical/Model/Cameras/EnvironmentCamera.cc
   branches/vertical/Model/Cameras/FisheyeCamera.cc
   branches/vertical/Model/Cameras/OrthogonalCamera.cc
Log:
Misc. cleanups and more implementation of vertical raypackets


Modified: branches/vertical/Core/Color/ColorSpace.h
==============================================================================
--- branches/vertical/Core/Color/ColorSpace.h   (original)
+++ branches/vertical/Core/Color/ColorSpace.h   Wed Dec 28 16:42:26 2005
@@ -11,8 +11,7 @@
 #include <sgi_stl_warnings_on.h>
 
 namespace Manta {
-  template<typename Traits>
-  class ColorSpace {
+  template<typename Traits> class ColorSpace {
   public:
     typedef typename Traits::ComponentType ComponentType;
     enum { NumComponents = Traits::NumComponents};
@@ -199,38 +198,40 @@
     // (the implementation) in another header file called
     // ColorSpace_fancy.h.  If you want to use this function include
     // that header file and it will get instantiated properly.
-    std::string toString() const;
-    
+    std::string toString() const;    
+
+    template<typename Scalar>
+    ColorSpace<Traits> Pow(Scalar exponent) const
+    {
+      using SCIRun::Pow;
+      ColorSpace<Traits> returnValue;
+      for (int i=0; i < NumComponents; i++)
+        returnValue.data[i] = SCIRun::Pow(data[i], exponent);
+      return returnValue;
+    }
+
+    ColorSpace<Traits> Log() const
+    {
+      ColorSpace<Traits> returnValue;
+      for (int i=0; i < NumComponents; i++)
+        returnValue.data[i] = log(data[i]);
+      return returnValue;
+    }
+
+    ColorSpace<Traits> attenuate(const ColorSpace<Traits> &scale) const
+    {
+      using SCIRun::Exp;
+      ColorSpace<Traits> returnValue;
+      for(int i=0;i<NumComponents;i++)
+        returnValue.data[i] = Exp(scale.data[i]*data[i]);
+      return returnValue;
+    }
+
+    ComponentType luminance() const
+    {
+      return Traits::luminance(data);
+    }
 
-      template<typename Scalar>
-      ColorSpace<Traits> Pow(Scalar exponent) const
-      {
-          using SCIRun::Pow;
-          ColorSpace<Traits> returnValue;
-          for (int i=0; i < NumComponents; i++)
-              returnValue.data[i] = SCIRun::Pow(data[i], exponent);
-          return returnValue;
-      }
-
-      ColorSpace<Traits> Log() const
-      {
-          ColorSpace<Traits> returnValue;
-          for (int i=0; i < NumComponents; i++)
-              returnValue.data[i] = log(data[i]);
-          return returnValue;
-      }
-
-      ColorSpace<Traits> attenuate(const ColorSpace<Traits> &scale) const {
-        using SCIRun::Exp;
-        ColorSpace<Traits> returnValue;
-        for(int i=0;i<NumComponents;i++)
-          returnValue.data[i] = Exp(scale.data[i]*data[i]);
-        return returnValue;
-      }
-
-      ComponentType luminance() const {
-        return Traits::luminance(data);
-      }
   protected:
     // DO NOT MAKE THIS PUBLIC!
     ComponentType data[NumComponents];

Modified: branches/vertical/Core/Color/ColorSpace_fancy.h
==============================================================================
--- branches/vertical/Core/Color/ColorSpace_fancy.h     (original)
+++ branches/vertical/Core/Color/ColorSpace_fancy.h     Wed Dec 28 16:42:26 
2005
@@ -19,6 +19,3 @@
   }
 
 } // end namespace Manta
-
-
-

Modified: branches/vertical/Core/Geometry/BBox.h
==============================================================================
--- branches/vertical/Core/Geometry/BBox.h      (original)
+++ branches/vertical/Core/Geometry/BBox.h      Wed Dec 28 16:42:26 2005
@@ -24,6 +24,18 @@
     }
     ~BBox() {
     }
+    BBox(const BBox& copy)
+    {
+      bounds[0] = copy.bounds[0];
+      bounds[1] = copy.bounds[1];
+    }
+    BBox& operator=(const BBox& copy)
+    {
+      bounds[0] = copy.bounds[0];
+      bounds[1] = copy.bounds[1];
+      return *this;
+    }
+
                
     // This resets min and max to an uninitialized state that will
     // accept new bounds [MAX, -MAX].
@@ -107,9 +119,6 @@
     inline const Point &operator[] (int i) const { return bounds[i]; }
     
   private:
-    // BBox(const BBox&);
-    // BBox& operator=(const BBox&);
-
     Point bounds[2];
   };
 }

Modified: branches/vertical/Engine/Control/RTRT.h
==============================================================================
--- branches/vertical/Engine/Control/RTRT.h     (original)
+++ branches/vertical/Engine/Control/RTRT.h     Wed Dec 28 16:42:26 2005
@@ -41,8 +41,8 @@
     // Image Modes (opengl, file, mpeg, etc.)
     virtual int createChannel(const string& modespec, Camera* camera,
                              bool stereo, int xres, int yres);
-               virtual int createChannel(ImageDisplay *image_display, 
Camera* camera,
-                                                                             
                                          bool stereo, int xres, int yres);
+    virtual int createChannel(ImageDisplay *image_display, Camera* camera,
+                              bool stereo, int xres, int yres);
     virtual void registerComponent(const string& name, ImageDisplayCreator 
display);
     virtual listType listImageDisplays() const;
     virtual Camera* getCamera(int channel) const;

Modified: branches/vertical/Interface/AmbientLight.h
==============================================================================
--- branches/vertical/Interface/AmbientLight.h  (original)
+++ branches/vertical/Interface/AmbientLight.h  Wed Dec 28 16:42:26 2005
@@ -20,8 +20,6 @@
     virtual void preprocess(const PreprocessContext& context) = 0;
     virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays, ColorArray ambient) const = 0;
 
-    // This function will return a newly allocated pointer of a string
-    // representation of the object.  You should delete it yourself.
     virtual std::string toString() const = 0;
   private:
     AmbientLight(const AmbientLight&);

Modified: branches/vertical/Interface/CMakeLists.txt
==============================================================================
--- branches/vertical/Interface/CMakeLists.txt  (original)
+++ branches/vertical/Interface/CMakeLists.txt  Wed Dec 28 16:42:26 2005
@@ -8,7 +8,6 @@
         Camera.cc
         Context.h
         Fragment.h
-        HitInfo.h
         IdleMode.h
         IdleMode.cc
         Image.h

Modified: branches/vertical/Interface/Fragment.cc
==============================================================================
--- branches/vertical/Interface/Fragment.cc     (original)
+++ branches/vertical/Interface/Fragment.cc     Wed Dec 28 16:42:26 2005
@@ -4,18 +4,3 @@
 
 using namespace Manta;
 
-#if 0
-
-Fragment::Fragment(int y, int xstart, int xend)
-{
-  int nx = xend-xstart;
-  ASSERTRANGE(nx, 0, MaxFragmentSize+1);
-  for(int i=0; i< nx;i++){
-    data[i].x = i+xstart;
-    data[i].y = y;
-  }
-  flags = ConsecutiveX;
-  size = nx;
-}
-
-#endif

Modified: branches/vertical/Interface/Light.h
==============================================================================
--- branches/vertical/Interface/Light.h (original)
+++ branches/vertical/Interface/Light.h Wed Dec 28 16:42:26 2005
@@ -17,8 +17,6 @@
     virtual ~Light();
                
     virtual void preprocess( const PreprocessContext& context ) = 0;
-    // virtual const Point& getCenter() const = 0;
-    // virtual const Color& getColor() const = 0;
 
     // This method is called on the light by the shadow algorithm. The color 
and direction 
     // produced by the light may change for each ray in the packet, and may 
change based 

Modified: branches/vertical/Interface/LightSet.h
==============================================================================
--- branches/vertical/Interface/LightSet.h      (original)
+++ branches/vertical/Interface/LightSet.h      Wed Dec 28 16:42:26 2005
@@ -38,7 +38,7 @@
     // Combine two light sets.
     static LightSet* merge(LightSet* l1, LightSet* l2);
 
-               // Calls preprocess on each light.
+    // Calls preprocess on each light.
     void preprocess(const PreprocessContext&);
 
     string toString();

Modified: branches/vertical/Interface/MantaInterface.h
==============================================================================
--- branches/vertical/Interface/MantaInterface.h        (original)
+++ branches/vertical/Interface/MantaInterface.h        Wed Dec 28 16:42:26 
2005
@@ -39,14 +39,14 @@
     virtual int createChannel(const string& modespec, Camera* camera,
                              bool stereo, int xres, int yres) = 0;
                                                
-               // Create a channel given a pointer to the ImageDisplay for 
the channel.
-               virtual int createChannel( ImageDisplay *image_display, 
Camera *camera,
-                                               bool stereo, int xres, int 
yres) = 0;
+    // Create a channel given a pointer to the ImageDisplay for the channel.
+    virtual int createChannel( ImageDisplay *image_display, Camera *camera,
+                               bool stereo, int xres, int yres) = 0;
                                                
     virtual void registerComponent(const string& name, ImageDisplayCreator 
display) = 0;
     virtual listType listImageDisplays() const = 0;
     virtual Camera* getCamera(int channel) const = 0;
-               virtual void    setCamera(int channel, Camera *camera ) = 0;
+    virtual void    setCamera(int channel, Camera *camera ) = 0;
     virtual void getResolution(int channel, bool& stereo, int& xres, int& 
yres) = 0;
     // You can change the resolution of the rendered image without
     // having to change the pipeline.  If you want the pipeline

Modified: branches/vertical/Interface/Parameters.h
==============================================================================
--- branches/vertical/Interface/Parameters.h    (original)
+++ branches/vertical/Interface/Parameters.h    Wed Dec 28 16:42:26 2005
@@ -4,5 +4,7 @@
 
 #define MAXCACHELINESIZE 128
 #define T_EPSILON 1.e-3
+#define MAXT 1.e19
+
 
 #endif

Modified: branches/vertical/Interface/RayPacket.h
==============================================================================
--- branches/vertical/Interface/RayPacket.h     (original)
+++ branches/vertical/Interface/RayPacket.h     Wed Dec 28 16:42:26 2005
@@ -5,12 +5,14 @@
 #include <Core/Color/Color.h>
 #include <Core/Geometry/Ray.h>
 #include <Core/Math/Expon.h>
-#include <Interface/HitInfo.h>
+#include <Core/Util/Assert.h>
+#include <Interface/Parameters.h>
 #include <Interface/Primitive.h>
 #include <Interface/TexCoordMapper.h>
 #include <algorithm>
 
 namespace Manta {
+  class Material;
   class RenderContext;
   class RayPacketData {
   public:
@@ -184,6 +186,11 @@
       for(int i=0;i<3;i++)
         data->texCoords[i][which] = tc[i];
     }
+    void setTexCoords(int which, const PointT<Real, 2>& tc)
+    {
+      for(int i=0;i<2;i++)
+        data->texCoords[i][which] = tc[i];
+    }
 
     Point getTexCoords(int which) const
     {
@@ -216,6 +223,11 @@
     {
       return Point(data->hitPosition[0][which], data->hitPosition[1][which], 
data->hitPosition[2][which]);
     }
+    Point setHitPosition(int which, const Point& hit) const
+    {
+      for(int i=0;i<3;i++)
+        data->hitPosition[i][which] = hit[which];
+    }
 
     bool hit(int which, Real t, const Material* matl, const Primitive* prim,
              const TexCoordMapper* tex) {
@@ -230,7 +242,11 @@
       } else {
         return false;
       }
-    }    
+    }
+    void setTexCoordMapper(int which, const TexCoordMapper* tex)
+    {
+      data->hitTex[which] = tex;
+    }
 
     // Scratchpad isn't quite "vertical" yet...
     template<class T> T& scratchpad(int which) {
@@ -303,38 +319,6 @@
       }
       flags |= HaveHitPositions;
     }
-#if 0
-    void computeInverseDirections()
-    {
-      if(flags & HaveInverseDirections)
-        return;
-      for(int i=0;i<size;i++)
-        data[i].inverseDirection = Vector(1./data[i].ray.direction().x(),
-                                          1./data[i].ray.direction().y(),
-                                          1./data[i].ray.direction().z());
-      flags |= HaveInverseDirections;
-    }
-
-    void computeSigns()
-    {
-      if(flags & HaveSigns)
-        return;
-      for(int i=0;i<size;i++)
-      {
-        data[i].sign[0] = data[i].ray.direction().x()<0.0;
-        data[i].sign[1] = data[i].ray.direction().y()<0.0;
-        data[i].sign[2] = data[i].ray.direction().z()<0.0;
-      }
-      flags |= HaveInverseDirections;
-      flags &= ~ConstantSigns;
-      for(int i=1;i<size;i++)
-          if (data[i].sign[0]!=data[i-1].sign[0]||
-              data[i].sign[1]!=data[i-1].sign[1]||
-              data[i].sign[2]!=data[i-1].sign[2])
-              return;
-      flags |= ConstantSigns;
-    }
-#endif
 
     // These aren't right - the texture object may not be consecutive
     void computeTextureCoordinates2(const RenderContext& context)
@@ -353,17 +337,6 @@
       tex->computeTexCoords3(context, *this);
       flags |= HaveTexture2|HaveTexture3;
     }
-#if 0
-    void computeFrame(const RenderContext& context)
-    {
-      if(flags & HaveFrame)
-        return;
-      Element& e0 = data[0];
-      const UVMapping* uv = e0.hitInfo.hitPrimitive()->getUVMapping();
-      uv->computeFrame(context, *this);
-      flags |= HaveFrame;
-    }
-#endif
 
     void computeNormals(const RenderContext& context)
     {

Modified: branches/vertical/Interface/RenderParameters.h
==============================================================================
--- branches/vertical/Interface/RenderParameters.h      (original)
+++ branches/vertical/Interface/RenderParameters.h      Wed Dec 28 16:42:26 
2005
@@ -8,6 +8,7 @@
   class RenderParameters {
   public:
     RenderParameters() {
+      // These are default values.  The scene can override them.
       maxDepth = 15;
       importanceCutoff = 0.01;
     }

Modified: branches/vertical/Interface/TexCoordMapper.h
==============================================================================
--- branches/vertical/Interface/TexCoordMapper.h        (original)
+++ branches/vertical/Interface/TexCoordMapper.h        Wed Dec 28 16:42:26 
2005
@@ -16,8 +16,8 @@
     virtual void computeTexCoords3(const RenderContext& context,
                                   RayPacket& rays) const = 0;
   private:
-    // TexCoordMapper(const TexCoordMapper&);
-    // TexCoordMapper& operator=(const TexCoordMapper&);
+    TexCoordMapper(const TexCoordMapper&);
+    TexCoordMapper& operator=(const TexCoordMapper&);
   };
 }
 

Modified: branches/vertical/Model/AmbientLights/ArcAmbient.cc
==============================================================================
--- branches/vertical/Model/AmbientLights/ArcAmbient.cc (original)
+++ branches/vertical/Model/AmbientLights/ArcAmbient.cc Wed Dec 28 16:42:26 
2005
@@ -27,12 +27,12 @@
 }
 
 void ArcAmbient::computeAmbient(const RenderContext& context,
-                               RayPacket& rays) const
+                                RayPacket& rays,
+                                ColorArray ambient) const
 {
   rays.computeNormals(context);
-  for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    Real cosine = Dot(e.normal, up);
+  for(int i=rays.begin();i<rays.end();i++){
+    Real cosine = Dot(rays.getNormal(i), up);
     Real sine = SCIRun::Sqrt(1-cosine*cosine);
     // So we want to do the computation for w0 and w1 as type Real,
     // because that is what all the other computation will be done,
@@ -46,7 +46,9 @@
       w1= sine/2;
       w0= (1 -  w1);
     }
-    rays.get(i).ambientLight = cup*w1 + cdown*w0;
+    Color ambientLight = cup*w1 + cdown*w0;
+    for(int j=0;j<Color::NumComponents;j++)
+      ambient[j][i] = ambientLight[j];
   }
 }
 

Modified: branches/vertical/Model/AmbientLights/ArcAmbient.h
==============================================================================
--- branches/vertical/Model/AmbientLights/ArcAmbient.h  (original)
+++ branches/vertical/Model/AmbientLights/ArcAmbient.h  Wed Dec 28 16:42:26 
2005
@@ -19,7 +19,7 @@
     virtual ~ArcAmbient();
 
     virtual void preprocess(const PreprocessContext&);
-    virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays) const;
+    virtual void computeAmbient(const RenderContext& context, RayPacket& 
rays, ColorArray ambient) const;
 
     virtual std::string toString() const;
   private:

Modified: branches/vertical/Model/AmbientLights/CMakeLists.txt
==============================================================================
--- branches/vertical/Model/AmbientLights/CMakeLists.txt        (original)
+++ branches/vertical/Model/AmbientLights/CMakeLists.txt        Wed Dec 28 
16:42:26 2005
@@ -1,5 +1,5 @@
 
 SET (Manta_AmbientLights_SRCS
      AmbientLights/ConstantAmbient.cc
-     #AmbientLights/ArcAmbient.cc
+     AmbientLights/ArcAmbient.cc
     )

Modified: branches/vertical/Model/Backgrounds/CMakeLists.txt
==============================================================================
--- branches/vertical/Model/Backgrounds/CMakeLists.txt  (original)
+++ branches/vertical/Model/Backgrounds/CMakeLists.txt  Wed Dec 28 16:42:26 
2005
@@ -1,6 +1,6 @@
 
 SET (Manta_Backgrounds_SRCS
      Backgrounds/ConstantBackground.cc
-     #Backgrounds/LinearBackground.cc
-     #Backgrounds/TextureBackground.cc
+     Backgrounds/LinearBackground.cc
+     Backgrounds/TextureBackground.cc
      )

Modified: branches/vertical/Model/Backgrounds/LinearBackground.cc
==============================================================================
--- branches/vertical/Model/Backgrounds/LinearBackground.cc     (original)
+++ branches/vertical/Model/Backgrounds/LinearBackground.cc     Wed Dec 28 
16:42:26 2005
@@ -23,13 +23,12 @@
 void LinearBackground::shade(const RenderContext&, RayPacket& rays) const
 {
   rays.normalizeDirections();
-  for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
+  for(int i=rays.begin();i<rays.end();i++){
     // So we want to do the computation for t as type Real, because
     // that is what all the other computation will be done, but we
     // would like to cast that to type ColorComponent, because we will
     // do operations on the color with this value.
-    ColorComponent t = (Real)0.5 * (1 + Dot(e.ray.direction(), up));
+    ColorComponent t = (Real)0.5 * (1 + Dot(rays.getDirection(i), up));
     rays.setResult(i, cup*t+cdown*(1-t));
   }
 }

Modified: branches/vertical/Model/Backgrounds/TextureBackground.cc
==============================================================================
--- branches/vertical/Model/Backgrounds/TextureBackground.cc    (original)
+++ branches/vertical/Model/Backgrounds/TextureBackground.cc    Wed Dec 28 
16:42:26 2005
@@ -58,15 +58,14 @@
                                           RayPacket& rays) const
 {
   rays.computeHitPositions();
-  for(int i = 0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    Point n = e.hitPosition;
+  for(int i = rays.begin();i<rays.end();i++){
+    Point n = rays.getHitPosition(i);
     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, PointT<Real, 2>(x, y));
   }
 }
 
@@ -77,12 +76,11 @@
 
   // Copy the ray directions and set the TexCoordMapper pointer back
   // to this class for each ray.
-  for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
+  for(int i=rays.begin();i<rays.end();i++){
     // Set the TexCoordMapper pointer.
-    e.hitInfo.set_hit(0,0,0, mapper);
+    rays.setTexCoordMapper(i, mapper);
     // Copy the direction from old ray to the new one.
-    e.hitPosition = Point(e.ray.direction());
+    rays.setHitPosition(i, Point(rays.getDirection(i)));
   }
   // Tell the RayPacket that we have the hit positions since we just
   // fed them in there.
@@ -93,8 +91,7 @@
   colortex->mapValues(context, rays, bg_color);
 
   // Copy the colors over.
-  for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
+  for(int i=rays.begin();i<rays.end();i++){
     rays.setResult(i, bg_color[i]);
   }
 }

Modified: branches/vertical/Model/Cameras/CMakeLists.txt
==============================================================================
--- branches/vertical/Model/Cameras/CMakeLists.txt      (original)
+++ branches/vertical/Model/Cameras/CMakeLists.txt      Wed Dec 28 16:42:26 
2005
@@ -1,11 +1,11 @@
 
 SET (Manta_Cameras_SRCS
-     #Cameras/EnvironmentCamera.h
-     #Cameras/EnvironmentCamera.cc
+     Cameras/EnvironmentCamera.h
+     Cameras/EnvironmentCamera.cc
      Cameras/PinholeCamera.h
      Cameras/PinholeCamera.cc
-     #Cameras/OrthogonalCamera.h
-     #Cameras/OrthogonalCamera.cc
-     #Cameras/FisheyeCamera.h
-     #Cameras/FisheyeCamera.cc
+     Cameras/OrthogonalCamera.h
+     Cameras/OrthogonalCamera.cc
+     Cameras/FisheyeCamera.h
+     Cameras/FisheyeCamera.cc
      )

Modified: branches/vertical/Model/Cameras/EnvironmentCamera.cc
==============================================================================
--- branches/vertical/Model/Cameras/EnvironmentCamera.cc        (original)
+++ branches/vertical/Model/Cameras/EnvironmentCamera.cc        Wed Dec 28 
16:42:26 2005
@@ -89,30 +89,28 @@
   ASSERT(rays.getAllFlags() & RayPacket::HaveImageCoordinates);
   rays.setFlag(RayPacket::ConstantOrigin);
   if (normalizeRays) {
-    for (int i=0; i<rays.getSize(); i++) {
-      RayPacket::Element& e=rays.get(i);
-      Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * e.imageY);
-      Real phi = (Real)M_PI * e.imageX + (Real)M_PI;
+    for (int i=rays.begin(); i<rays.end(); i++) {
+      Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * 
rays.getImageCoordinates(i, 1));
+      Real phi = (Real)M_PI * rays.getImageCoordinates(i, 0) + (Real)M_PI;
       Vector xyz(Sin(theta)*Cos(phi), Sin(theta)*Sin(phi),
                  Cos(theta));
       Vector raydir(Dot(xyz, v),
                     Dot(xyz, n),
                     Dot(xyz, u));
       raydir.normalize();
-      e.ray.set(eye, raydir);
+      rays.setRay(i, eye, raydir);
     }
     rays.setFlag(RayPacket::NormalizedDirections);
   } else {
-    for (int i=0; i<rays.getSize(); i++) {
-      RayPacket::Element& e=rays.get(i);
-      Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * e.imageY);
-      Real phi = (Real)M_PI * e.imageX + (Real)M_PI;
+    for (int i=rays.begin(); i<rays.end(); i++) {
+      Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * 
rays.getImageCoordinates(i, 1));
+      Real phi = (Real)M_PI * rays.getImageCoordinates(i, 0) + (Real)M_PI;
       Vector xyz(Sin(theta)*Cos(phi), Sin(theta)*Sin(phi),
                  Cos(theta));
       Vector raydir(Dot(xyz, v),
                     Dot(xyz, n),
                     Dot(xyz, u));
-      e.ray.set(eye, raydir);
+      rays.setRay(i, eye, raydir);
     }
   }
 }

Modified: branches/vertical/Model/Cameras/FisheyeCamera.cc
==============================================================================
--- branches/vertical/Model/Cameras/FisheyeCamera.cc    (original)
+++ branches/vertical/Model/Cameras/FisheyeCamera.cc    Wed Dec 28 16:42:26 
2005
@@ -83,15 +83,16 @@
 {
   ASSERT(rays.getFlag(RayPacket::HaveImageCoordinates) );
   rays.setFlag(RayPacket::ConstantOrigin|RayPacket::NormalizedDirections);
-  for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    Real z = Sqrt( 2 - e.imageX * e.imageX - e.imageY * e.imageY );
-    Real theta = Atan2( e.imageY, e.imageX );
+  for(int i=rays.begin();i<rays.end();i++){
+    Real imageX = rays.getImageCoordinates(i, 0);
+    Real imageY = rays.getImageCoordinates(i, 1);
+    Real z = Sqrt( 2 - imageX * imageX - imageY * imageY );
+    Real theta = Atan2( imageY, imageX );
     Real phi = Acos( z * (Real)M_SQRT1_2 ) * hfov;
     Real x = Cos( theta ) * Sin( phi );
     Real y = Sin( theta ) * Sin( phi );
     z = Cos( phi );
-    e.ray.set(eye, v*x+u*y+n*z);
+    rays.setRay(i, eye, v*x+u*y+n*z);
   }
 }
 

Modified: branches/vertical/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- branches/vertical/Model/Cameras/OrthogonalCamera.cc (original)
+++ branches/vertical/Model/Cameras/OrthogonalCamera.cc Wed Dec 28 16:42:26 
2005
@@ -78,10 +78,9 @@
 {
   ASSERT(rays.getFlag(RayPacket::HaveImageCoordinates));
 
-  for(int i=0;i<rays.getSize();i++){
-    RayPacket::Element& e = rays.get(i);
-    Point rayposition(eye+v*e.imageX+u*e.imageY);
-    e.ray.set(rayposition, direction);
+  for(int i=rays.begin();i<rays.end();i++){
+    Point rayposition(eye+v*rays.getImageCoordinates(i, 
0)+u*rays.getImageCoordinates(i, 1));
+    rays.setRay(i, rayposition, direction);
   }
   rays.setFlag(RayPacket::NormalizedDirections);
 }




  • [MANTA] r809 - in branches/vertical: Core/Color Core/Geometry Engine/Control Interface Model/AmbientLights Model/Backgrounds Model/Cameras, sparker, 12/28/2005

Archive powered by MHonArc 2.6.16.

Top of page