Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r623 - in branches/itanium2: . Core/Color Core/Geometry Core/Math Core/Shm Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/PixelSamplers Image Interface Model/Cameras Model/Groups Model/Lights Model/Materials Model/MiscObjects Model/Primitives Model/Readers/glm Model/TexCoordMappers Readers/BART StandAlone UserInterface fox scenes


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r623 - in branches/itanium2: . Core/Color Core/Geometry Core/Math Core/Shm Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/PixelSamplers Image Interface Model/Cameras Model/Groups Model/Lights Model/Materials Model/MiscObjects Model/Primitives Model/Readers/glm Model/TexCoordMappers Readers/BART StandAlone UserInterface fox scenes
  • Date: Thu, 13 Oct 2005 14:24:02 -0600 (MDT)

Author: bigler
Date: Thu Oct 13 14:23:54 2005
New Revision: 623

Modified:
   branches/itanium2/Core/Color/ColorSpace.h
   branches/itanium2/Core/Geometry/AffineTransform.cc
   branches/itanium2/Core/Math/Noise.cc
   branches/itanium2/Core/Shm/MFStreamData.cc
   branches/itanium2/Engine/Control/RTRT.cc
   branches/itanium2/Engine/Display/GLXImageDisplay.cc
   branches/itanium2/Engine/IdleModes/ZoomIdleMode.cc
   branches/itanium2/Engine/IdleModes/ZoomIdleMode.h
   branches/itanium2/Engine/ImageTraversers/FramelessImageTraverser.cc
   branches/itanium2/Engine/PixelSamplers/HammersleySampler.cc
   branches/itanium2/Engine/PixelSamplers/HammersleySampler.h
   branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.cc
   branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.h
   branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.cc
   branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.h
   branches/itanium2/Engine/PixelSamplers/NRooksSampler.cc
   branches/itanium2/Engine/PixelSamplers/NRooksSampler.h
   branches/itanium2/Engine/PixelSamplers/Sample.cc
   branches/itanium2/Engine/PixelSamplers/SingleSampler.cc
   branches/itanium2/Engine/PixelSamplers/SingleSampler.h
   branches/itanium2/Image/TGAFile.cc
   branches/itanium2/Interface/Camera.h
   branches/itanium2/Interface/RayPacket.h
   branches/itanium2/MantaTypes.h
   branches/itanium2/Model/Cameras/EnvironmentCamera.cc
   branches/itanium2/Model/Cameras/EnvironmentCamera.h
   branches/itanium2/Model/Cameras/FisheyeCamera.cc
   branches/itanium2/Model/Cameras/FisheyeCamera.h
   branches/itanium2/Model/Cameras/OrthogonalCamera.cc
   branches/itanium2/Model/Cameras/OrthogonalCamera.h
   branches/itanium2/Model/Cameras/PinholeCamera.cc
   branches/itanium2/Model/Cameras/PinholeCamera.h
   branches/itanium2/Model/Cameras/StereoPinholeCamera.cc
   branches/itanium2/Model/Cameras/StereoPinholeCamera.h
   branches/itanium2/Model/Groups/FrustumKDTree.cc
   branches/itanium2/Model/Groups/KDTree.cc
   branches/itanium2/Model/Groups/KDTree.h
   branches/itanium2/Model/Groups/KDTreeLoader.cc
   branches/itanium2/Model/Groups/RealisticBvh.cc
   branches/itanium2/Model/Groups/TransparentKDTree.cc
   branches/itanium2/Model/Lights/HeadLight.cc
   branches/itanium2/Model/Lights/PointLight.cc
   branches/itanium2/Model/Materials/Checker.cc
   branches/itanium2/Model/Materials/CopyColorMaterial.cc
   branches/itanium2/Model/Materials/Dielectric.cc
   branches/itanium2/Model/Materials/Dielectric.h
   branches/itanium2/Model/Materials/LambertianAlt.cc
   branches/itanium2/Model/Materials/MetalMaterial.cc
   branches/itanium2/Model/Materials/Phong.cc
   branches/itanium2/Model/Materials/Phong.h
   branches/itanium2/Model/MiscObjects/CuttingPlane.cc
   branches/itanium2/Model/Primitives/BvhTriangleMesh.cc
   branches/itanium2/Model/Primitives/Cone.cc
   branches/itanium2/Model/Primitives/Cone.h
   branches/itanium2/Model/Primitives/Disk.cc
   branches/itanium2/Model/Primitives/Disk.h
   branches/itanium2/Model/Primitives/HeavyTriangle.cc
   branches/itanium2/Model/Primitives/Heightfield.cc
   branches/itanium2/Model/Primitives/Heightfield.h
   branches/itanium2/Model/Primitives/Hemisphere.cc
   branches/itanium2/Model/Primitives/Hemisphere.h
   branches/itanium2/Model/Primitives/PrimitiveCommon.cc
   branches/itanium2/Model/Primitives/Sphere.cc
   branches/itanium2/Model/Primitives/Sphere.h
   branches/itanium2/Model/Primitives/SuperEllipsoid.cc
   branches/itanium2/Model/Primitives/SuperEllipsoid.h
   branches/itanium2/Model/Primitives/TexTriangle.cc
   branches/itanium2/Model/Primitives/Triangle.cc
   branches/itanium2/Model/Primitives/Triangle.h
   branches/itanium2/Model/Readers/glm/glm.cc
   branches/itanium2/Model/TexCoordMappers/SphericalMapper.cc
   branches/itanium2/Model/TexCoordMappers/SphericalMapper.h
   branches/itanium2/Readers/BART/parse.cc
   branches/itanium2/StandAlone/barrier_test.cc
   branches/itanium2/StandAlone/manta.cc
   branches/itanium2/StandAlone/mf_stream_test.cc
   branches/itanium2/UserInterface/CameraPathAutomator.cc
   branches/itanium2/UserInterface/CameraPathAutomator.h
   branches/itanium2/UserInterface/XWindowUI.cc
   branches/itanium2/UserInterface/XWindowUI.h
   branches/itanium2/fox/dm_demo.cc
   branches/itanium2/scenes/boeing777.cc
   branches/itanium2/scenes/objviewer.cc
   branches/itanium2/scenes/primtest.cc
Log:

This is a bunch of updates to accommodate Real == float.  There are
also some other minor changes to reduce warnings, but shouldn't create
symantic differences.  Some of the code that used trig functions now
use the SCIRun versions Sin instead of sin.  These make explict use of
either double or float versions of these functions.

This code should work as before with Real == double, but benchmarks
are soon to follow.

Changes not related to the Real == float update are as follows.

Core/Color/ColorSpace.h

  Make Mean function use ComponentType instead of hard coded double.

Image/TGAFile.cc
  
  Changed the name of readShort and writeShort to read16bit and
  write16bit respectively.

Model/Cameras/EnvironmentCamera.cc
Model/Cameras/EnvironmentCamera.h

  Moved reset to .cc file.
  
Model/Materials/Dielectric.h

  Constructor that took references to Reals now just takes Reals.
  
Core/Color/ColorSpace.h
Core/Geometry/AffineTransform.cc
Core/Math/Noise.cc
Core/Shm/MFStreamData.cc
Engine/Control/RTRT.cc
Engine/Display/GLXImageDisplay.cc
Engine/IdleModes/ZoomIdleMode.cc
Engine/IdleModes/ZoomIdleMode.h
Engine/ImageTraversers/FramelessImageTraverser.cc
Engine/PixelSamplers/HammersleySampler.cc
Engine/PixelSamplers/HammersleySampler.h
Engine/PixelSamplers/InterLeaveSampler.cc
Engine/PixelSamplers/InterLeaveSampler.h
Engine/PixelSamplers/MultiJitterSampler.cc
Engine/PixelSamplers/MultiJitterSampler.h
Engine/PixelSamplers/NRooksSampler.cc
Engine/PixelSamplers/NRooksSampler.h
Engine/PixelSamplers/Sample.cc
Engine/PixelSamplers/SingleSampler.cc
Engine/PixelSamplers/SingleSampler.h
Image/TGAFile.cc
Interface/Camera.h
Interface/RayPacket.h
MantaTypes.h
Model/Cameras/EnvironmentCamera.cc
Model/Cameras/EnvironmentCamera.h
Model/Cameras/FisheyeCamera.cc
Model/Cameras/FisheyeCamera.h
Model/Cameras/OrthogonalCamera.cc
Model/Cameras/OrthogonalCamera.h
Model/Cameras/PinholeCamera.cc
Model/Cameras/PinholeCamera.h
Model/Cameras/StereoPinholeCamera.cc
Model/Cameras/StereoPinholeCamera.h
Model/Groups/FrustumKDTree.cc
Model/Groups/KDTree.cc
Model/Groups/KDTree.h
Model/Groups/KDTreeLoader.cc
Model/Groups/RealisticBvh.cc
Model/Groups/TransparentKDTree.cc
Model/Lights/HeadLight.cc
Model/Lights/PointLight.cc
Model/Materials/Checker.cc
Model/Materials/CopyColorMaterial.cc
Model/Materials/Dielectric.cc
Model/Materials/Dielectric.h
Model/Materials/LambertianAlt.cc
Model/Materials/MetalMaterial.cc
Model/Materials/Phong.cc
Model/Materials/Phong.h
Model/MiscObjects/CuttingPlane.cc
Model/Primitives/BvhTriangleMesh.cc
Model/Primitives/Cone.cc
Model/Primitives/Cone.h
Model/Primitives/Disk.cc
Model/Primitives/Disk.h
Model/Primitives/HeavyTriangle.cc
Model/Primitives/Heightfield.cc
Model/Primitives/Heightfield.h
Model/Primitives/Hemisphere.cc
Model/Primitives/Hemisphere.h
Model/Primitives/PrimitiveCommon.cc
Model/Primitives/Sphere.cc
Model/Primitives/Sphere.h
Model/Primitives/SuperEllipsoid.cc
Model/Primitives/SuperEllipsoid.h
Model/Primitives/TexTriangle.cc
Model/Primitives/Triangle.cc
Model/Primitives/Triangle.h
Model/Readers/glm/glm.cc
Model/TexCoordMappers/SphericalMapper.cc
Model/TexCoordMappers/SphericalMapper.h
Readers/BART/parse.cc
StandAlone/barrier_test.cc
StandAlone/manta.cc
StandAlone/mf_stream_test.cc
UserInterface/CameraPathAutomator.cc
UserInterface/CameraPathAutomator.h
UserInterface/XWindowUI.cc
UserInterface/XWindowUI.h
fox/dm_demo.cc
scenes/boeing777.cc
scenes/objviewer.cc
scenes/primtest.cc

Lots of the general warning fixes and Real == double fixes as
described above.


Modified: branches/itanium2/Core/Color/ColorSpace.h
==============================================================================
--- branches/itanium2/Core/Color/ColorSpace.h   (original)
+++ branches/itanium2/Core/Color/ColorSpace.h   Thu Oct 13 14:23:54 2005
@@ -146,13 +146,13 @@
       return *this;
     }
 
-      double Mean() const
-      {
-          double sum = 0.0;
-          for (int i = 0; i < NumComponents; i++)
-              sum += (double)data[i];
-          return sum*(1./double(NumComponents));
-      }
+    ComponentType Mean() const
+    {
+      ComponentType sum = 0;
+      for (int i = 0; i < NumComponents; i++)
+        sum += data[i];
+      return sum*(1/ComponentType(NumComponents));
+    }
 
     // Apply functor
     ColorSpace<Traits> attenuate(ComponentType scale) const {

Modified: branches/itanium2/Core/Geometry/AffineTransform.cc
==============================================================================
--- branches/itanium2/Core/Geometry/AffineTransform.cc  (original)
+++ branches/itanium2/Core/Geometry/AffineTransform.cc  Thu Oct 13 14:23:54 
2005
@@ -92,10 +92,10 @@
 
     VectorT<T, 3> v = Cross(from, to);
     T e = Dot(from, to);
-    if(e > 1.0-1.e-9){
+    if(e > 1-(T)(1.e-9)){
       // No rotation
       return;
-    } else if (e < -1.0+1.e-9){
+    } else if (e < -1+(T)(1.e-9)){
       // 180 degree rotation
       VectorT<T, 3> x = v.absoluteValue();
       int largest = x.indexOfMaxComponent();
@@ -112,11 +112,11 @@
         for(int j = 0; j < 3; j++){
           mtx[i][j] = -c1 * u[i] * u[j] + c2 * v[i] * v[j] + c3 * v[i] * 
u[j];
         }
-        mtx[i][i] += 1.0;
+        mtx[i][i] += 1;
       }
       pre_multiply(mtx);
     } else {
-      T h = 1.0/(1.0 + e);      /* optimization by Gottfried Chen */
+      T h = (T)1/(1 + e);      /* optimization by Gottfried Chen */
       T mtx[3][3];
       mtx[0][0] = e + h * v[0] * v[0];
       mtx[0][1] = h * v[0] * v[1] - v[2];
@@ -225,7 +225,7 @@
 
     T denom = c*d*h-c*e*g-b*d*i+b*f*g+a*e*i-a*f*h;
 
-    T inv_denom = 1./denom;
+    T inv_denom = (T)(1)/denom;
     mat[0][0] = (e*i-f*h)*inv_denom;
     mat[0][1] = (c*h-b*i)*inv_denom;
     mat[0][2] = (b*f-c*e)*inv_denom;
@@ -235,9 +235,11 @@
     mat[2][0] = (d*h-e*g)*inv_denom;
     mat[2][1] = (b*g-a*h)*inv_denom;
     mat[2][2] = (a*e-b*d)*inv_denom;
-    double x = mat[0][3];
-    double y = mat[1][3];
-    double z = mat[2][3];
+    // These were double, but I changed them to type T.  Do they need
+    // to be double for some reason?
+    T x = mat[0][3];
+    T y = mat[1][3];
+    T z = mat[2][3];
     mat[0][3] = -(mat[0][0]*x + mat[0][1]*y + mat[0][2]*z);
     mat[1][3] = -(mat[1][0]*x + mat[1][1]*y + mat[1][2]*z);
     mat[2][3] = -(mat[2][0]*x + mat[2][1]*y + mat[2][2]*z);

Modified: branches/itanium2/Core/Math/Noise.cc
==============================================================================
--- branches/itanium2/Core/Math/Noise.cc        (original)
+++ branches/itanium2/Core/Math/Noise.cc        Thu Oct 13 14:23:54 2005
@@ -1,5 +1,6 @@
 #include <Core/Geometry/PointVector.h>
 #include <Core/Math/MiscMath.h>
+#include <Core/Math/Noise.h>
 
 using namespace SCIRun;
 using namespace std;
@@ -10,7 +11,7 @@
    * This is the table of permutations required by the noise functions to
    * hash their input to generate the X coordinates.
    */
-  int NoiseXPermutationTable[] = {
+  static int NoiseXPermutationTable[] = {
     76, 97, 84, 215, 37, 4, 251, 48, 100, 174, 161, 125, 136, 99, 139, 19,
     101, 158, 202, 165, 138, 129, 144, 180, 232, 196, 155, 252, 182, 173,
     55, 201, 189, 14, 225, 31, 171, 46, 79, 146, 217, 127, 41, 92, 191, 82,
@@ -34,7 +35,7 @@
    * This is the table of permutations required by the noise functions to
    * hash their input to generate the Y coordinates.
    */
-  int NoiseYPermutationTable[] = {
+  static int NoiseYPermutationTable[] = {
     105, 76, 135, 3, 66, 169, 252, 41, 40, 69, 26, 141, 91, 88, 75, 191,
     118, 184, 126, 110, 172, 64, 185, 142, 157, 85, 39, 113, 56, 192, 70,
     111, 170, 87, 177, 100, 186, 216, 127, 94, 136, 182, 200, 37, 241, 251,
@@ -58,7 +59,7 @@
    * This is the table of permutations required by the noise functions to
    * hash their input to generate the Z coordinates.
    */
-  int NoiseZPermutationTable[] = {
+  static int NoiseZPermutationTable[] = {
     228, 169, 108, 236, 15, 208, 250, 147, 72, 76, 155, 10, 186, 3, 187,
     87, 1, 37, 19, 239, 123, 235, 70, 181, 122, 30, 125, 175, 221, 165,
     167, 231, 58, 211, 154, 38, 191, 130, 64, 206, 197, 114, 54, 40, 220,
@@ -83,7 +84,7 @@
    * The values in the noise permutation tables can be used to index into
    * this table to get the gradients for the noise.
    */
-  double Noise1DValueTable[] = {
+  static double Noise1DValueTable[] = {
     0.47451, 0.482353, 0.670588, 0.545098, 0.803922, -0.443137, -0.678431,
     0.32549, 0.45098, 0.396078, 0.905882, -0.0666667, -0.466667, 0.733333,
     0.87451, 0.568627, 0.921569, -0.584314, 0.262745, -0.670588, 0.254902,
@@ -133,7 +134,7 @@
    * permutation tables can be used to index into this table to get the
    * gradients for the noise.
    */
-  double Noise3DValueTable[][ 3 ] = {
+  static double Noise3DValueTable[][ 3 ] = {
     { -0.439336, 0.540416, 0.71759 }, { 0.183348, 0.923971, 0.33565 },
     { -0.15203, -0.392751, -0.906991 }, { 0.707649, 0.112768, 0.697507 },
     { 0.136611, -0.456018, 0.879423 }, { -0.414372, -0.868792, -0.271103 },

Modified: branches/itanium2/Core/Shm/MFStreamData.cc
==============================================================================
--- branches/itanium2/Core/Shm/MFStreamData.cc  (original)
+++ branches/itanium2/Core/Shm/MFStreamData.cc  Thu Oct 13 14:23:54 2005
@@ -53,7 +53,7 @@
 
 
 
-void *MFStreamData::operator new( size_t bytes, int key_, int flag ) {
+void *MFStreamData::operator new( size_t /*bytes*/, int key_, int flag ) {
 
   int id;
   

Modified: branches/itanium2/Engine/Control/RTRT.cc
==============================================================================
--- branches/itanium2/Engine/Control/RTRT.cc    (original)
+++ branches/itanium2/Engine/Control/RTRT.cc    Thu Oct 13 14:23:54 2005
@@ -53,14 +53,11 @@
 
 namespace Manta {
   RTRTInterface* createRTRT()
-{
+  {
     return new RTRT();
-}
+  }
 
-bool bool_or(const bool& b1, const bool& b2) {
-        return b1 || b2;
-}
-void registerKnownComponents(RTRTInterface* rtrt);
+  extern void registerKnownComponents(RTRTInterface* rtrt);
 }
 
 RTRT::RTRT()
@@ -846,7 +843,7 @@
 
 void RTRT::setPixelSampler( PixelSampler *sampler_ ) {
         currentPixelSampler = sampler_;
-};
+}
 
 bool RTRT::selectPixelSampler(const string& spec)
 {

Modified: branches/itanium2/Engine/Display/GLXImageDisplay.cc
==============================================================================
--- branches/itanium2/Engine/Display/GLXImageDisplay.cc (original)
+++ branches/itanium2/Engine/Display/GLXImageDisplay.cc Thu Oct 13 14:23:54 
2005
@@ -139,7 +139,7 @@
                        }
                        
                        // Determine scale and bias.
-                       float scale = 1.0 / (max_p - min_p);
+                       float scale = 1 / (max_p - min_p);
                        
                        for (int i=0;i<total_size;++i) {
                                float v = (pixel[i].r - min_p) * scale;

Modified: branches/itanium2/Engine/IdleModes/ZoomIdleMode.cc
==============================================================================
--- branches/itanium2/Engine/IdleModes/ZoomIdleMode.cc  (original)
+++ branches/itanium2/Engine/IdleModes/ZoomIdleMode.cc  Thu Oct 13 14:23:54 
2005
@@ -40,13 +40,13 @@
       // Save old resolution and shrink the image
       channeldata[channel].xres = xres;
       channeldata[channel].yres = yres;
-      xres = Max((int)(xres/factor+0.5), 0);
-      yres = Max((int)(yres/factor+0.5), 0);
+      xres = Max((int)(xres/factor+(Real)0.5), 0);
+      yres = Max((int)(yres/factor+(Real)0.5), 0);
     } else {
       if(channeldata[channel].xres == -1){
         // Grow it - we don't know what the old res was
-        xres = Max((int)(xres*factor+0.5), 0);
-        yres = Max((int)(yres*factor+0.5), 0);
+        xres = Max((int)(xres*factor+(Real)0.5), 0);
+        yres = Max((int)(yres*factor+(Real)0.5), 0);
       } else {
         // Restore old resolution
         xres = channeldata[channel].xres;

Modified: branches/itanium2/Engine/IdleModes/ZoomIdleMode.h
==============================================================================
--- branches/itanium2/Engine/IdleModes/ZoomIdleMode.h   (original)
+++ branches/itanium2/Engine/IdleModes/ZoomIdleMode.h   Thu Oct 13 14:23:54 
2005
@@ -2,6 +2,7 @@
 #ifndef Manta_Engine_ZoomIdleMode_h
 #define Manta_Engine_ZoomIdleMode_h
 
+#include <MantaTypes.h>
 #include <Interface/IdleMode.h>
 #include <sgi_stl_warnings_off.h>
 #include <string>
@@ -29,7 +30,7 @@
     };
     vector<ChannelData> channeldata;
 
-    double factor;
+    Real factor;
   };
 }
 

Modified: branches/itanium2/Engine/ImageTraversers/FramelessImageTraverser.cc
==============================================================================
--- branches/itanium2/Engine/ImageTraversers/FramelessImageTraverser.cc 
(original)
+++ branches/itanium2/Engine/ImageTraversers/FramelessImageTraverser.cc Thu 
Oct 13 14:23:54 2005
@@ -188,16 +188,16 @@
     for(int i=0;i<size;i++) {
       Fragment::Element& fe = fragment.get(f+i);
       // normalized
-      double px, py;
+      Real px, py;
       if(xres>yres) // let the smaller dimension be mapped to [-1,1]
         {
-          px = (double)(-1.0 + 2.0*(double)(fe.x+0.5)/(double)yres); 
-          py = (double)(-1.0 + 2.0*(double)(fe.y+0.5)/(double)yres);
+          px = -1 + 2*(fe.x+(Real)0.5)/yres;
+          py = -1 + 2*(fe.y+(Real)0.5)/yres;
         }
       else
         {
-          px = (double)(-1.0 + 2.0*(double)(fe.x+0.5)/(double)xres); 
-          py = (double)(-1.0 + 2.0*(double)(fe.y+0.5)/(double)xres);
+          px = -1 + 2*(fe.x+(Real)0.5)/xres;
+          py = -1 + 2*(fe.y+(Real)0.5)/xres;
         }  
       //printf("%f, %f\n", (float)px, (float)py);
       rays.setPixel(i, 0, px, py, &fe.color);

Modified: branches/itanium2/Engine/PixelSamplers/HammersleySampler.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/HammersleySampler.cc (original)
+++ branches/itanium2/Engine/PixelSamplers/HammersleySampler.cc Thu Oct 13 
14:23:54 2005
@@ -113,7 +113,7 @@
       int i = 0;
       int count = 0;
       
-      double px, py;
+      Real px, py;
 
      
       while(i < size){
@@ -144,7 +144,7 @@
       int i = 0;
       int count = 0;
       
-      double px, py;
+      Real px, py;
       while(i < size){
        Fragment::Element& fe0 = fragment.get(f+i);
        

Modified: branches/itanium2/Engine/PixelSamplers/HammersleySampler.h
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/HammersleySampler.h  (original)
+++ branches/itanium2/Engine/PixelSamplers/HammersleySampler.h  Thu Oct 13 
14:23:54 2005
@@ -29,10 +29,10 @@
     HammersleySampler& operator=(const HammersleySampler&);
     int num_samples;
     struct ChannelInfo {
-      double xscale;
-      double xoffset;
-      double yscale;
-      double yoffset;
+      Real xscale;
+      Real xoffset;
+      Real yscale;
+      Real yoffset;
     };
 
     vector2d *samples;

Modified: branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.cc (original)
+++ branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.cc Thu Oct 13 
14:23:54 2005
@@ -82,10 +82,10 @@
   context.getResolution(stereo, xres, yres);
 
   // Set up the scale from -1 to 1
-  ci.xscale = 2./xres;
+  ci.xscale = (Real)2/xres;
   ci.yscale = ci.xscale;
-  ci.xoffset = (-xres/2.+0.5)*ci.xscale; // Offset to pixel center
-  ci.yoffset = (-yres/2.+0.5)*ci.yscale;
+  ci.xoffset = (-xres/(Real)2+(Real)0.5)*ci.xscale; // Offset to pixel center
+  ci.yoffset = (-yres/(Real)2+(Real)0.5)*ci.yscale;
   context.renderer->setupDisplayChannel(context);
 }
 
@@ -124,7 +124,7 @@
       int i = 0;
       int count = 0;
       
-      double px, py;
+      Real px, py;
       while(i < size){
        for(int x = 0; x < num_samples; x++)
          {
@@ -149,7 +149,7 @@
       int i = 0;
       int count = 0;
       
-      double px, py;
+      Real px, py;
       while(i < size){
        Fragment::Element& fe0 = fragment.get(f+i);
        for(int x = 0; x < num_samples; x++)

Modified: branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.h
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.h  (original)
+++ branches/itanium2/Engine/PixelSamplers/InterLeaveSampler.h  Thu Oct 13 
14:23:54 2005
@@ -32,10 +32,10 @@
     int num_grid;
     int num_samples;
     struct ChannelInfo {
-      double xscale;
-      double xoffset;
-      double yscale;
-      double yoffset;
+      Real xscale;
+      Real xoffset;
+      Real yscale;
+      Real yoffset;
     };
     vector2d ** interLeavedSamples;
     MT_RNG *random;

Modified: branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.cc        
(original)
+++ branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.cc        Thu 
Oct 13 14:23:54 2005
@@ -71,10 +71,10 @@
   context.getResolution(stereo, xres, yres);
 
   // Set up the scale from -1 to 1
-  ci.xscale = 2./xres;
+  ci.xscale = (Real)2/xres;
   ci.yscale = ci.xscale;
-  ci.xoffset = (-xres/2.+0.5)*ci.xscale; // Offset to pixel center
-  ci.yoffset = (-yres/2.+0.5)*ci.yscale;
+  ci.xoffset = (-xres/(Real)2+(Real)0.5)*ci.xscale; // Offset to pixel center
+  ci.yoffset = (-yres/(Real)2+(Real)0.5)*ci.yscale;
   context.renderer->setupDisplayChannel(context);
 }
 
@@ -113,15 +113,15 @@
 
       int i = 0;
       int count = 0;
-      double px, py;
+      Real px, py;
       while(i < size){
 
        Sample::multiJitter(samples, num_samples, random[thd_num]);
        
        for(int x = 0; x < num_samples; x++)
          {
-           px = 
((fe0.x+((samples[x][0]*2.0)-1.0))*ci.xscale+ci.xoffset)+count*ci.xscale;
-           py = (fe0.y+((samples[x][1]*2.0)-1.0))*ci.yscale+ci.yoffset;
+           px = 
((fe0.x+((samples[x][0]*2)-1))*ci.xscale+ci.xoffset)+count*ci.xscale;
+           py = (fe0.y+((samples[x][1]*2)-1))*ci.yscale+ci.yoffset;
            rays.setPixel(i, 0, px, py, &result[i]);
            
            i++;
@@ -141,7 +141,7 @@
       int i = 0;
       int count = 0;
       
-      double px, py;
+      Real px, py;
       while(i < size){
        Fragment::Element& fe0 = fragment.get(f+i);
        

Modified: branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.h
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.h (original)
+++ branches/itanium2/Engine/PixelSamplers/MultiJitterSampler.h Thu Oct 13 
14:23:54 2005
@@ -29,10 +29,10 @@
     MultiJitterSampler& operator=(const MultiJitterSampler&);
     int num_samples;
     struct ChannelInfo {
-      double xscale;
-      double xoffset;
-      double yscale;
-      double yoffset;
+      Real xscale;
+      Real xoffset;
+      Real yscale;
+      Real yoffset;
     };
 
     vector2d *samples;

Modified: branches/itanium2/Engine/PixelSamplers/NRooksSampler.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/NRooksSampler.cc     (original)
+++ branches/itanium2/Engine/PixelSamplers/NRooksSampler.cc     Thu Oct 13 
14:23:54 2005
@@ -71,10 +71,10 @@
   context.getResolution(stereo, xres, yres);
 
   // Set up the scale from -1 to 1
-  ci.xscale = 2./xres;
+  ci.xscale = (Real)2/xres;
   ci.yscale = ci.xscale;
-  ci.xoffset = (-xres/2.+0.5)*ci.xscale; // Offset to pixel center
-  ci.yoffset = (-yres/2.+0.5)*ci.yscale;
+  ci.xoffset = (-xres/(Real)2+(Real)0.5)*ci.xscale; // Offset to pixel center
+  ci.yoffset = (-yres/(Real)2+(Real)0.5)*ci.yscale;
   context.renderer->setupDisplayChannel(context);
 }
 
@@ -113,7 +113,7 @@
 
       int i = 0;
       int count = 0;
-      double px, py;
+      Real px, py;
 
 
      
@@ -144,7 +144,7 @@
       int i = 0;
       int count = 0;
       
-      double px, py;
+      Real px, py;
       while(i < size){
        Fragment::Element& fe0 = fragment.get(f+i);
        

Modified: branches/itanium2/Engine/PixelSamplers/NRooksSampler.h
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/NRooksSampler.h      (original)
+++ branches/itanium2/Engine/PixelSamplers/NRooksSampler.h      Thu Oct 13 
14:23:54 2005
@@ -29,10 +29,10 @@
     NRooksSampler& operator=(const NRooksSampler&);
     int num_samples;
     struct ChannelInfo {
-      double xscale;
-      double xoffset;
-      double yscale;
-      double yoffset;
+      Real xscale;
+      Real xoffset;
+      Real yscale;
+      Real yoffset;
     };
 
     vector2d *samples;

Modified: branches/itanium2/Engine/PixelSamplers/Sample.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/Sample.cc    (original)
+++ branches/itanium2/Engine/PixelSamplers/Sample.cc    Thu Oct 13 14:23:54 
2005
@@ -1,5 +1,6 @@
 
 #include <Engine/PixelSamplers/Sample.h>
+#include <Core/Math/Trig.h>
 
 #include <stdlib.h>
 #include <math.h>
@@ -53,7 +54,7 @@
 void Sample::multiJitter(vector2d *samples, int num_samples, MT_RNG seed)
 {
 
-  int sqrt_samples = (int)(sqrt(float(num_samples)));
+  int sqrt_samples = (int)(sqrtf(float(num_samples)));
   float subcell_width = 1.0f/(float(num_samples));
 
   
@@ -113,7 +114,7 @@
 {
   for (int i = num_samples - 2; i >= 0; i--)
     {
-      int target = int(seed.genRealRand<Real>() * (double)i);
+      int target = int(seed.genRealRand<Real>() * (Real)i);
       vector2d temp = samples[i+1];
       samples[i+1] = samples[target];
       samples[target] = temp;
@@ -139,14 +140,14 @@
     {
       Real x = samples[i].x();
       Real y = samples[i].y();
-      if (x < 0.5f)
-        samples[i][0] = (Real)sqrt(2.0*(Real)x) - 1.0f;
+      if (x < (Real)0.5)
+        samples[i][0] = Sqrt(2*(Real)x) - 1;
       else
-        samples[i][0] = 1.0f - (Real)sqrt(2.0 - 2.0 * x);
-      if (y < 0.5f)
-        samples[i][1] = (Real)sqrt(2.0*(Real)y) - 1.0f;
+        samples[i][0] = 1 - Sqrt(2 - (Real)2 * x);
+      if (y < (Real)0.5)
+        samples[i][1] = Sqrt(2*(Real)y) - 1;
       else
-        samples[i][1] = 1.0f - (Real)sqrt(2.0 - 2.0 * y);
+        samples[i][1] = 1 - Sqrt(2 - 2 * (Real)y);
     }
 }
 
@@ -169,7 +170,7 @@
 {
   for(int i = 0; i < num_samples; i++)
     {
-      samples[i] = (double)drand48();
+      samples[i] = drand48();
     }
 }
 
@@ -194,7 +195,7 @@
 
 void Sample::nearest_square_finder(const int size, int &nx, int &ny) {
   int x,y;
-  x = y = (int) sqrt((double)size);
+  x = y = (int) Sqrt((Real)size);
   // now we are basically looking for a pair of multiples that are closest to
   // the square root.
   while ((x * y) != size) {

Modified: branches/itanium2/Engine/PixelSamplers/SingleSampler.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/SingleSampler.cc     (original)
+++ branches/itanium2/Engine/PixelSamplers/SingleSampler.cc     Thu Oct 13 
14:23:54 2005
@@ -34,10 +34,10 @@
   context.getResolution(stereo, xres, yres);
 
   // Set up the scale from -1 to 1
-  ci.xscale = 2./xres;
+  ci.xscale = (Real)2/xres;
   ci.yscale = ci.xscale;
-  ci.xoffset = (-xres/2.+0.5)*ci.xscale; // Offset to pixel center
-  ci.yoffset = (-yres/2.+0.5)*ci.yscale;
+  ci.xoffset = (-xres/(Real)2+(Real)0.5)*ci.xscale; // Offset to pixel center
+  ci.yoffset = (-yres/(Real)2+(Real)0.5)*ci.yscale;
   context.renderer->setupDisplayChannel(context);
 }
 
@@ -88,8 +88,8 @@
     else {
       for(int i=0;i<size;i++){
         Fragment::Element& fe = fragment.get(f+i);
-        double px = fe.x*ci.xscale+ci.xoffset;
-        double py = fe.y*ci.yscale+ci.yoffset;
+        Real px = fe.x*ci.xscale+ci.xoffset;
+        Real py = fe.y*ci.yscale+ci.yoffset;
         rays.setPixel(i, fe.which_eye, px, py, &fe.color);
       }
     }

Modified: branches/itanium2/Engine/PixelSamplers/SingleSampler.h
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/SingleSampler.h      (original)
+++ branches/itanium2/Engine/PixelSamplers/SingleSampler.h      Thu Oct 13 
14:23:54 2005
@@ -2,6 +2,7 @@
 #ifndef Manta_Engine_SingleSampler_h
 #define Manta_Engine_SingleSampler_h
 
+#include <MantaTypes.h>
 #include <Interface/PixelSampler.h>
 #include <sgi_stl_warnings_off.h>
 #include <string>
@@ -26,10 +27,10 @@
     SingleSampler& operator=(const SingleSampler&);
 
     struct ChannelInfo {
-      double xscale;
-      double xoffset;
-      double yscale;
-      double yoffset;
+      Real xscale;
+      Real xoffset;
+      Real yscale;
+      Real yoffset;
     };
     vector<ChannelInfo> channelInfo;
   };

Modified: branches/itanium2/Image/TGAFile.cc
==============================================================================
--- branches/itanium2/Image/TGAFile.cc  (original)
+++ branches/itanium2/Image/TGAFile.cc  Thu Oct 13 14:23:54 2005
@@ -1,11 +1,15 @@
 
-#include <fstream>
 #include <Core/Exceptions/IllegalArgument.h>
 #include <Core/Exceptions/InternalError.h>
 #include <Core/Util/NotFinished.h>
 #include <Image/NullImage.h>
 #include <Image/Pixel.h>
 #include <Image/SimpleImage.h>
+#include <Image/TGAFile.h>
+
+#include <sgi_stl_warnings_off.h>
+#include <fstream>
+#include <sgi_stl_warnings_on.h>
 
 using namespace std;
 using SCIRun::IllegalValue;
@@ -14,7 +18,7 @@
 namespace Manta
 {
 
-  static inline void writeShort(
+  static inline void write16bit(
     ofstream &out,
     int const value )
   {
@@ -22,7 +26,8 @@
     out.put( ( value >> 8 ) & 0xFF );
   }
 
-  static inline void writeLong(
+  // This function should be removed, because it isn't used.
+  static inline void write32bit(
     ofstream &out,
     int const value )
   {
@@ -43,16 +48,16 @@
     out.put( 0 );                 // ID length: 0
     out.put( 0 );                 // Color map type: None
     out.put( 2 );                 // Image type: uncompressed, true-color 
image
-    writeShort( out, 0 );         // Color map first entry index
-    writeShort( out, 0 );         // Color map length
+    write16bit( out, 0 );         // Color map first entry index
+    write16bit( out, 0 );         // Color map length
     out.put( 0 );                 // Color map entry size
-    writeShort( out, 0 );         // X-origin of image (left)
-    writeShort( out, 0 );         // Y-origin of image (bottom)
+    write16bit( out, 0 );         // X-origin of image (left)
+    write16bit( out, 0 );         // Y-origin of image (bottom)
     bool stereo;
     int xres, yres;
     image->getResolution( stereo, xres, yres );
-    writeShort( out, xres );      // Image width
-    writeShort( out, yres );      // Image height
+    write16bit( out, xres );      // Image width
+    write16bit( out, yres );      // Image height
     if ( typeid( *image ) == typeid( SimpleImage< RGBA8Pixel > ) ) {
       out.put( 32 );              // Pixel depth: 32bpp
       out.put( 8 );               // Image descriptor: 8 bits of alpha, 
bottom-left origin
@@ -129,7 +134,7 @@
     }
   }
 
-  static inline int readShort(
+  static inline int read16bit(
     ifstream &in )
   {
     int byte_1 = in.get();
@@ -137,14 +142,15 @@
     return byte_1 | ( byte_2 << 8 );
   }
 
-  static inline int readLong(
+  // This function should be removed, because it isn't used.
+  static inline int read32bit(
     ifstream &in )
   {
     int byte_1 = in.get();
     int byte_2 = in.get();
     int byte_3 = in.get();
     int byte_4 = in.get();
-    return byte_1 | ( byte_2 << 8 ) | ( byte_2 << 16 ) | ( byte_2 << 24 );
+    return byte_1 | ( byte_2 << 8 ) | ( byte_3 << 16 ) | ( byte_4 << 24 );
   }
 
   Image *readTGA(
@@ -160,13 +166,13 @@
     int image_type = in.get();
     if ( image_type != 2 )
       throw InternalError( "Only uncompressed true-color TGA files currently 
supported", __FILE__, __LINE__  );
-    int color_map_first_entry_index = readShort( in );
-    int color_map_length = readShort( in );
+    int color_map_first_entry_index = read16bit( in );
+    int color_map_length = read16bit( in );
     int color_map_entry_size = in.get();
-    int x_origin = readShort( in );
-    int y_origin = readShort( in );
-    int width = readShort( in );
-    int height = readShort( in );
+    int x_origin = read16bit( in );
+    int y_origin = read16bit( in );
+    int width = read16bit( in );
+    int height = read16bit( in );
     int pixel_depth = in.get();
     int image_descriptor = in.get();
     in.ignore( id_length );
@@ -178,9 +184,9 @@
           RGB8Pixel *offset = ( buffer +
                                 ( image_descriptor & 32 ? height - y : y ) * 
width +
                                 ( image_descriptor & 16 ? width - x : x ) );
-          offset->b = in.get();
-          offset->g = in.get();
-          offset->r = in.get();
+          offset->b = static_cast<unsigned char>(in.get());
+          offset->g = static_cast<unsigned char>(in.get());
+          offset->r = static_cast<unsigned char>(in.get());
         }
       return si;
     } else if ( pixel_depth == 32 && ( image_descriptor & 15 ) == 8 ) {
@@ -191,10 +197,10 @@
           RGBA8Pixel *offset = ( buffer +
                                  ( image_descriptor & 32 ? height - y : y ) 
* width +
                                  ( image_descriptor & 16 ? width - x : x ) );
-          offset->b = in.get();
-          offset->g = in.get();
-          offset->r = in.get();
-          offset->a = in.get();
+          offset->b = static_cast<unsigned char>(in.get());
+          offset->g = static_cast<unsigned char>(in.get());
+          offset->r = static_cast<unsigned char>(in.get());
+          offset->a = static_cast<unsigned char>(in.get());
         }
       return si;
     }

Modified: branches/itanium2/Interface/Camera.h
==============================================================================
--- branches/itanium2/Interface/Camera.h        (original)
+++ branches/itanium2/Interface/Camera.h        Thu Oct 13 14:23:54 2005
@@ -15,9 +15,9 @@
     virtual void makeRays(RayPacket&) const = 0;
 
     // Camera manipulation
-    virtual void scaleFOV(double) = 0;
+    virtual void scaleFOV(Real) = 0;
     virtual void translate(Vector v) = 0; // Translate in image plane 
coordinates.
-    virtual void dolly(double) = 0;
+    virtual void dolly(Real) = 0;
                
                // Accessors
                virtual Point  getPosition() const = 0; // This method is 
called to get the eye point by HeadLight etc.
@@ -35,7 +35,7 @@
       Origin
     };
     virtual void transform(AffineTransform t, TransformCenter) = 0;
-    virtual void autoview(double fov) = 0;
+    virtual void autoview(Real fov) = 0;
                virtual void output( std::ostream &os ) { /* Default does 
nothing. */ }; // Output a text description of the camera's state.
   private:
     Camera(const Camera&);

Modified: branches/itanium2/Interface/RayPacket.h
==============================================================================
--- branches/itanium2/Interface/RayPacket.h     (original)
+++ branches/itanium2/Interface/RayPacket.h     Thu Oct 13 14:23:54 2005
@@ -80,8 +80,8 @@
     struct Element {
       Color   localColor;
       Color*  color;
-      double  imageX;
-      double  imageY;
+      Real    imageX;
+      Real    imageY;
       Ray     ray;
       HitInfo hitInfo;
       Vector  normal;
@@ -92,7 +92,7 @@
       Color   ambientLight;
       Color   light;
 
-      double importance; // for ray pruning
+      Real    importance; // for ray pruning
 
       int shadowBegin, shadowEnd;
       int whichEye;
@@ -108,7 +108,7 @@
     Element& get(int which) {
       return data[which];
     }
-    void setPixel(int which, int whichEye, double imageX, double imageY,
+    void setPixel(int which, int whichEye, Real imageX, Real imageY,
                   Color* color) {
       data[which].color = color;
       data[which].imageX = imageX;
@@ -135,7 +135,7 @@
 
       if(flags & HaveHitRecords){
         for(int i=0;i<size;i++){
-          double length = data[i].ray.normalizeDirection();
+          Real length = data[i].ray.normalizeDirection();
           data[i].hitInfo.scaleT(length);
         }
       } else {

Modified: branches/itanium2/MantaTypes.h
==============================================================================
--- branches/itanium2/MantaTypes.h      (original)
+++ branches/itanium2/MantaTypes.h      Thu Oct 13 14:23:54 2005
@@ -5,8 +5,14 @@
 namespace Manta {
   // Scalars
   typedef double Real;
+  //  typedef float Real;
 
   // Colors - forward declarations only
+
+  // Note about this component type.  It should be a floating point
+  // type and not an integral type.  If you wish to make it an
+  // integral type, you should go through the code and make sure
+  // function like ColorSpace::Mean do the right thing.
   typedef float ColorComponent;
   class RGBTraits;
   template<typename T> class ColorSpace;

Modified: branches/itanium2/Model/Cameras/EnvironmentCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/EnvironmentCamera.cc        (original)
+++ branches/itanium2/Model/Cameras/EnvironmentCamera.cc        Thu Oct 13 
14:23:54 2005
@@ -27,15 +27,15 @@
     string arg=args[i];
     if (arg=="-eye") {
       if (!getPointArg(i, args, eye))
-       throw IllegalArgument("EnvironmentCamera -eye", i, args);
+        throw IllegalArgument("EnvironmentCamera -eye", i, args);
       gotEye=true;
     } else if (arg=="-lookat") {
       if (!getPointArg(i, args, lookat))
-       throw IllegalArgument("EnvironmentCamera -lookat", i, args);
+        throw IllegalArgument("EnvironmentCamera -lookat", i, args);
       gotLookat=true;
     } else if (arg=="-up") {
       if (!getVectorArg(i, args, up))
-       throw IllegalArgument("EnvironmentCamera -up", i, args);
+        throw IllegalArgument("EnvironmentCamera -up", i, args);
       gotUp=true;
     } else if (arg=="-normalizeRays") {
       normalizeRays=true;
@@ -57,9 +57,17 @@
   return new EnvironmentCamera(args);
 }
 
+void EnvironmentCamera::reset( const Point &eye_, const Vector &up_,
+                               const Point &lookat_ )
+{
+  eye = eye_;
+  up = up_;
+  lookat = lookat_;
+  setup();
+}
+
 void EnvironmentCamera::setup()
 {
-  int i;
   direction=lookat - eye;
   n=direction;
   n.normalize();
@@ -83,10 +91,10 @@
   if (normalizeRays) {
     for (int i=0; i<rays.getSize(); i++) {
       RayPacket::Element& e=rays.get(i);
-      double theta=0.5*(M_PI - M_PI*e.imageY);
-      double phi=M_PI*e.imageX + M_PI;
-      Vector xyz(sin(theta)*cos(phi), sin(theta)*sin(phi),
-                 cos(theta));
+      Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * e.imageY);
+      Real phi = (Real)M_PI * e.imageX + (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));
@@ -97,10 +105,10 @@
   } else {
     for (int i=0; i<rays.getSize(); i++) {
       RayPacket::Element& e=rays.get(i);
-      double theta=0.5*(M_PI - M_PI*e.imageY);
-      double phi=M_PI*e.imageX + M_PI;
-      Vector xyz(sin(theta)*cos(phi), sin(theta)*sin(phi),
-                 cos(theta));
+      Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * e.imageY);
+      Real phi = (Real)M_PI * e.imageX + (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));
@@ -109,7 +117,7 @@
   }
 }
 
-void EnvironmentCamera::scaleFOV(double scale)
+void EnvironmentCamera::scaleFOV(Real /*scale*/)
 {
   // This functionality doesn't make much sense with the environment camera
 }
@@ -123,7 +131,7 @@
   setup();
 }
 
-void EnvironmentCamera::dolly(double scale)
+void EnvironmentCamera::dolly(Real scale)
 {
   Vector dir=lookat - eye;
   eye += dir*scale;
@@ -146,7 +154,6 @@
   }
 
   Vector lookdir(eye - lookat);
-  double length=lookdir.length();
 
   AffineTransform frame;
   frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
@@ -161,13 +168,13 @@
   setup();
 }
 
-void EnvironmentCamera::autoview(double new_fov)
+void EnvironmentCamera::autoview(Real /*new_fov*/)
 {
   // This functionality doesn't make much sense with the environment camera
 }
 
-Point EnvironmentCamera::project(const Point &point) const 
+Point EnvironmentCamera::project(const Point& /*point*/) const 
 {
   // NOT FINISHED
-  return Point(0., 0., 0.);
+  return Point(0, 0, 0);
 }

Modified: branches/itanium2/Model/Cameras/EnvironmentCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/EnvironmentCamera.h (original)
+++ branches/itanium2/Model/Cameras/EnvironmentCamera.h Thu Oct 13 14:23:54 
2005
@@ -15,27 +15,28 @@
   class EnvironmentCamera : public Camera {
   public:
     EnvironmentCamera(const vector<string>& args);
-               EnvironmentCamera( const Point &eye_, const Point &lookat_, 
const Vector &up_ ) :
+               EnvironmentCamera(const Point &eye_, const Point &lookat_,
+                      const Vector &up_ ) :
                        eye( eye_ ), lookat( lookat_ ), up( up_ ) { setup(); }
     virtual ~EnvironmentCamera();
     virtual void makeRays(RayPacket&) const;
 
     // Camera manipulation
-    virtual void scaleFOV(double);
+    virtual void scaleFOV(Real);
     virtual void translate(Vector);
-    virtual void dolly(double);
+    virtual void dolly(Real);
     virtual void transform(AffineTransform t, TransformCenter);
-    virtual void autoview(double fov);
+    virtual void autoview(Real fov);
     virtual Point project(const Point &point) const;  // project a 3D point 
to the camera image plane
     static Camera* create(const vector<string>& args);
-               
+
                virtual Point  getPosition() const { return eye; }
                virtual Point  getLookAt()   const { return lookat; };
                virtual Vector getUp()       const { return up; };
-               
-               virtual void reset( const Point &eye_, const Vector &up_, 
const Point &lookat_ ) {
-                       eye = eye_; up = up_; lookat = lookat_; setup(); };
-                       
+
+               virtual void reset( const Point &eye_, const Vector &up_,
+                        const Point &lookat_ );
+
   private:
     void setup();
     Point  eye;

Modified: branches/itanium2/Model/Cameras/FisheyeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/FisheyeCamera.cc    (original)
+++ branches/itanium2/Model/Cameras/FisheyeCamera.cc    Thu Oct 13 14:23:54 
2005
@@ -15,8 +15,6 @@
 using namespace std;
 using SCIRun::Clamp;
 
-static const double sqrt_two = 1.4142135623730951;
-
 FisheyeCamera::FisheyeCamera(const vector<string>& args)
 {
   bool gotEye = false;
@@ -28,19 +26,19 @@
     string arg = args[i];
     if(arg == "-eye"){
       if(!getPointArg(i, args, eye))
-       throw IllegalArgument("FisheyeCamera -eye", i, args);
+        throw IllegalArgument("FisheyeCamera -eye", i, args);
       gotEye = true;
     } else if(arg == "-lookat"){
       if(!getPointArg(i, args, lookat))
-       throw IllegalArgument("FisheyeCamera -lookat", i, args);
+        throw IllegalArgument("FisheyeCamera -lookat", i, args);
       gotLookat = true;
     } else if(arg == "-up"){
       if(!getVectorArg(i, args, up))
-       throw IllegalArgument("FisheyeCamera -up", i, args);
+        throw IllegalArgument("FisheyeCamera -up", i, args);
       gotUp = true;
     } else if(arg == "-fov"){
-      if(!getDoubleArg(i, args, hfov))
-       throw IllegalArgument("FisheyeCamera -fov", i, args);
+      if(!getArg<Real>(i, args, hfov))
+        throw IllegalArgument("FisheyeCamera -fov", i, args);
       gotFov = true;
     } else {
       throw IllegalArgument("FisheyeCamera", i, args);
@@ -49,7 +47,7 @@
   if(!gotEye || !gotLookat || !gotUp || !gotFov)
     throw IllegalArgument("FisheyeCamera needs -eye -lookat -up and -fov", 
0, args);
   setup();
-  hfov = hfov / 90.0;
+  hfov /= 90;
 }
 
 FisheyeCamera::~FisheyeCamera()
@@ -96,20 +94,20 @@
   rays.setFlag(RayPacket::ConstantOrigin|RayPacket::NormalizedDirections);
   for(int i=0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
-    double z = sqrt( 2.0 - e.imageX * e.imageX - e.imageY * e.imageY );
-    double theta = atan2( e.imageY, e.imageX );
-    double phi = acos( z / sqrt_two ) * hfov;
-    double x = cos( theta ) * sin( phi );
-    double y = sin( theta ) * sin( phi );
-    z = cos( phi );
+    Real z = Sqrt( 2 - e.imageX * e.imageX - e.imageY * e.imageY );
+    Real theta = Atan2( e.imageY, e.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);
   }
 }
 
-void FisheyeCamera::scaleFOV(double scale)
+void FisheyeCamera::scaleFOV(Real scale)
 {
-  double fov_min = 0;
-  double fov_max = 4.0;
+  Real fov_min = 0;
+  Real fov_max = 4;
   hfov = scale*hfov;
   hfov = Clamp(hfov, fov_min, fov_max);
   vfov = scale*vfov;
@@ -125,7 +123,7 @@
   setup();
 }
 
-void FisheyeCamera::dolly(double scale)
+void FisheyeCamera::dolly(Real scale)
 {
   Vector dir = lookat - eye;
   eye += dir*scale;
@@ -148,7 +146,6 @@
   }
 
   Vector lookdir(eye-lookat);
-  double length = lookdir.length();
 
   AffineTransform frame;
   frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
@@ -163,24 +160,23 @@
   setup();
 }
 
-void FisheyeCamera::autoview(double new_fov)
+void FisheyeCamera::autoview(Real new_fov)
 {
   BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
-  //  double ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
   hfov = new_fov;
   vfov = new_fov;
   Vector diag(bbox.diagonal());
-  double w=diag.length();
+  Real w=diag.length();
   Vector lookdir(eye-lookat);
   lookdir.normalize();
-  double scale = 1.0/(2*tan(DtoR(hfov/2.0)));
-  double length = w*scale;
+  Real scale = 1/(2*tan(DtoR(hfov/2)));
+  Real length = w*scale;
   lookat = bbox.center();
   eye = lookat+lookdir*length;
   setup();
 }
 
-Point FisheyeCamera::project(const Point &point) const
+Point FisheyeCamera::project(const Point& /*point*/) const
 {
   // NOT FINISHED
   return Point(0,0,0); // just a placeholder

Modified: branches/itanium2/Model/Cameras/FisheyeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/FisheyeCamera.h     (original)
+++ branches/itanium2/Model/Cameras/FisheyeCamera.h     Thu Oct 13 14:23:54 
2005
@@ -24,11 +24,11 @@
     virtual void makeRays(RayPacket&) const;
 
     // Camera manipulation
-    virtual void scaleFOV(double);
+    virtual void scaleFOV(Real);
     virtual void translate(Vector);
-    virtual void dolly(double);
+    virtual void dolly(Real);
     virtual void transform(AffineTransform t, TransformCenter);
-    virtual void autoview(double fov);
+    virtual void autoview(Real fov);
     virtual Point project(const Point &point) const;  // project a 3D point 
to the camera image plane
     static Camera* create(const vector<string>& args);
 
@@ -43,15 +43,16 @@
     Point  eye;
     Point  lookat;
     Vector up;
-    double hfov, vfov, width, height, nearZ; // x and y field of view,
-                                            // width and height of image 
plane
-                                            // distance from eye to image 
plane
+    Real hfov, vfov, width, height, nearZ; // x and y field of view,
+                                           // width and height of
+                                           // image plane distance
+                                           // from eye to image plane
 
     Vector direction;
     Vector u,v,n;
 
-       // for projection we maintain a uvn rotation matrix
-    double uvn[3][3];
+    // for projection we maintain a uvn rotation matrix
+    Real uvn[3][3];
   };
 }
 

Modified: branches/itanium2/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/OrthogonalCamera.cc (original)
+++ branches/itanium2/Model/Cameras/OrthogonalCamera.cc Thu Oct 13 14:23:54 
2005
@@ -24,19 +24,19 @@
     string arg = args[i];
     if(arg == "-eye"){
       if(!getPointArg(i, args, eye))
-       throw IllegalArgument("OrthogonalCamera -eye", i, args);
+        throw IllegalArgument("OrthogonalCamera -eye", i, args);
       gotEye = true;
     } else if(arg == "-lookat"){
       if(!getPointArg(i, args, lookat))
-       throw IllegalArgument("OrthogonalCamera -lookat", i, args);
+        throw IllegalArgument("OrthogonalCamera -lookat", i, args);
       gotLookat = true;
     } else if(arg == "-up"){
       if(!getVectorArg(i, args, up))
-       throw IllegalArgument("OrthogonalCamera -up", i, args);
+        throw IllegalArgument("OrthogonalCamera -up", i, args);
       gotUp = true;
     } else if(arg == "-scale"){
-      if(!getDoubleArg(i, args, hscale))
-       throw IllegalArgument("OrthogonalCamera -scale", i, args);
+      if(!getArg<Real>(i, args, hscale))
+        throw IllegalArgument("OrthogonalCamera -scale", i, args);
       gotScale = true;
     } else {
       throw IllegalArgument("OrthogonalCamera", i, args);
@@ -89,7 +89,7 @@
 // FOV doesn't quite make sense here - orthogonal cameras don't have FOV's.
 // But in the context of the camera interface, adjusting the scale makes
 // the most sense, so we'll do that.
-void OrthogonalCamera::scaleFOV(double scale)
+void OrthogonalCamera::scaleFOV(Real scale)
 {
   hscale *= scale;
   vscale *= scale;
@@ -105,7 +105,7 @@
   setup();
 }
 
-void OrthogonalCamera::dolly(double scale)
+void OrthogonalCamera::dolly(Real scale)
 {
   Vector dir = lookat - eye;
   eye += dir*scale;
@@ -128,7 +128,8 @@
   }
 
   Vector lookdir(eye-lookat);
-  double length = lookdir.length();
+  Real length = lookdir.length();
+
   AffineTransform frame;
   frame.initWithBasis(v.normal()*length, u.normal()*length, lookdir, cen);
 
@@ -143,14 +144,13 @@
   setup();
 }
 
-void OrthogonalCamera::autoview(double new_fov)
+void OrthogonalCamera::autoview(Real new_fov)
 {
   BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
-  //  double ratio = tan(DtoR(vscale/2))/tan(DtoR(hscale/2));
   hscale = new_fov;
   vscale = new_fov;
   Vector diag(bbox.diagonal());
-  double w=diag.length();
+  Real w=diag.length();
   Vector lookdir(eye-lookat);
   lookdir.normalize();
   lookat = bbox.center();
@@ -158,8 +158,8 @@
   setup();
 }
 
-Point OrthogonalCamera::project(const Point &point) const
+Point OrthogonalCamera::project(const Point& /*point*/) const
 {
-       // NOT FINISHED
-       return Point(0,0,0); // just a placeholder
+  // NOT FINISHED
+  return Point(0,0,0); // just a placeholder
 }

Modified: branches/itanium2/Model/Cameras/OrthogonalCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/OrthogonalCamera.h  (original)
+++ branches/itanium2/Model/Cameras/OrthogonalCamera.h  Thu Oct 13 14:23:54 
2005
@@ -20,11 +20,11 @@
     virtual void makeRays(RayPacket&) const;
 
     // Camera manipulation
-    virtual void scaleFOV(double);
+    virtual void scaleFOV(Real);
     virtual void translate(Vector);
-    virtual void dolly(double);
+    virtual void dolly(Real);
     virtual void transform(AffineTransform t, TransformCenter);
-    virtual void autoview(double fov);
+    virtual void autoview(Real fov);
          virtual Point project(const Point &point) const;
     static Camera* create(const vector<string>& args);
                
@@ -40,7 +40,7 @@
     Point eye;
     Point lookat;
     Vector up;
-    double hscale, vscale;
+    Real hscale, vscale;
 
     Vector direction;
     Vector u,v;

Modified: branches/itanium2/Model/Cameras/PinholeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.cc    (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.cc    Thu Oct 13 14:23:54 
2005
@@ -24,13 +24,13 @@
   bool gotStereo = false;
   normalizeRays = false;
 
-  stereo_offset = 0.0;
+  stereo_offset = 0;
 
   // pinhole(-eye 3 3 2 -lookat 0 0 0.3 -up 0 0 1 -fov 60
-  eye    = Point ( 3.0, 3.0, 2.0 );
-  lookat = Point ( 0.0, 0.0, 0.3 );
-  up     = Vector( 0.0, 0.0, 1.0 );
-  hfov    = 60.0;
+  eye    = Point ( 3, 3, 2 );
+  lookat = Point ( 0, 0, (Real)0.3 );
+  up     = Vector( 0, 0, 1 );
+  hfov    = 60;
   
   int argc = static_cast<int>(args.size());
   for(int i=0; i< argc; i++){
@@ -52,7 +52,7 @@
         throw IllegalArgument("PinholeCamera -up", i, args);
       gotUp = true;
     } else if(arg == "-fov"){
-      if(!getDoubleArg(i, args, hfov))
+      if(!getArg<Real>(i, args, hfov))
         throw IllegalArgument("PinholeCamera -fov", i, args);
       gotFov = true;
     } else if(arg == "-normalizeRays"){
@@ -111,9 +111,9 @@
   for(i=0; i<3; i++)
     uvn[0][i] = u[i];
 
-  height=nearZ*tan(vfov*0.5*M_PI/180.0);
+  height=nearZ*tan(vfov*(Real)(0.5*M_PI/180.0));
   u*=height;
-  width=nearZ*tan(hfov*0.5*M_PI/180.0);
+  width=nearZ*tan(hfov*(Real)(0.5*M_PI/180.0));
   v*=width;
 }
 
@@ -151,13 +151,13 @@
   }
 }
 
-void PinholeCamera::scaleFOV(double scale)
+void PinholeCamera::scaleFOV(Real scale)
 {
-  double fov_min = 0;
-  double fov_max = 180;
-  hfov = RtoD(2*atan(scale*tan(DtoR(hfov/2.))));
+  Real fov_min = 0;
+  Real fov_max = 180;
+  hfov = RtoD(2*atan(scale*tan(DtoR(hfov/2))));
   hfov = Clamp(hfov, fov_min, fov_max);
-  vfov = RtoD(2*atan(scale*tan(DtoR(vfov/2.))));
+  vfov = RtoD(2*atan(scale*tan(DtoR(vfov/2))));
   vfov = Clamp(vfov, fov_min, fov_max);
   setup();
 }
@@ -171,7 +171,7 @@
   setup();
 }
 
-void PinholeCamera::dolly(double scale)
+void PinholeCamera::dolly(Real scale)
 {
   Vector d = (lookat - eye) * scale;
   eye    += d;
@@ -195,7 +195,6 @@
   }
 
   Vector lookdir(eye-lookat);
-  double length = lookdir.length();
 
   AffineTransform frame;
   frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
@@ -210,18 +209,18 @@
   setup();
 }
 
-void PinholeCamera::autoview(double new_fov)
+void PinholeCamera::autoview(Real new_fov)
 {
   BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
-  //  double ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
+  //  Real ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
   hfov = new_fov;
   vfov = RtoD(2*atan(tan(DtoR(hfov/2))));
   Vector diag(bbox.diagonal());
-  double w=diag.length();
+  Real w=diag.length();
   Vector lookdir(eye-lookat);
   lookdir.normalize();
-  double scale = 1.0/(2*tan(DtoR(hfov/2.0)));
-  double length = w*scale;
+  Real scale = 1/(2*tan(DtoR(hfov/2)));
+  Real length = w*scale;
   lookat = bbox.center();
   eye = lookat+lookdir*length;
   setup();

Modified: branches/itanium2/Model/Cameras/PinholeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.h     (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.h     Thu Oct 13 14:23:54 
2005
@@ -21,11 +21,11 @@
     virtual void makeRays(RayPacket&) const;
 
     // Camera manipulation
-    virtual void scaleFOV(double);
+    virtual void scaleFOV(Real);
     virtual void translate(Vector);
-    virtual void dolly(double);
+    virtual void dolly(Real);
     virtual void transform(AffineTransform t, TransformCenter);
-    virtual void autoview(double fov);
+    virtual void autoview(Real fov);
                virtual void output( std::ostream &os );
          virtual Point project(const Point &point) const;  // project a 3D 
point to the camera image plane
     static Camera* create(const vector<string>& args);
@@ -52,7 +52,7 @@
     Vector u,v;
   
        // for projection we maintain a uvn rotation matrix
-    double uvn[3][3];
+    Real uvn[3][3];
   };
 }
 

Modified: branches/itanium2/Model/Cameras/StereoPinholeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/StereoPinholeCamera.cc      (original)
+++ branches/itanium2/Model/Cameras/StereoPinholeCamera.cc      Thu Oct 13 
14:23:54 2005
@@ -19,15 +19,15 @@
 {
   normalizeRays = false;
 
-  eye_distance   = 1.0;
-  focus_distance = 10.0; 
+  eye_distance   = 1;
+  focus_distance = 10;
 
   // Parameters for the default scene.
   // pinhole(-eye 3 3 2 -lookat 0 0 0.3 -up 0 0 1 -fov 60
-  eye    = Point ( 3.0, 3.0, 2.0 );
-  lookat = Point ( 0.0, 0.0, 0.3 );
-  up     = Vector( 0.0, 0.0, 1.0 );
-  hfov    = 60.0;
+  eye    = Point ( 3, 3,       2 );
+  lookat = Point ( 0, 0, (Real)0.3 );
+  up     = Vector( 0, 0,       1 );
+  hfov    = 60;
   
   int argc = static_cast<int>(args.size());
   for(int i=0; i< argc; i++){
@@ -50,7 +50,7 @@
       if(!getVectorArg(i, args, up))
         throw IllegalArgument("StereoPinholeCamera -up", i, args);
     } else if(arg == "-fov"){
-      if(!getDoubleArg(i, args, hfov))
+      if(!getArg<Real>(i, args, hfov))
         throw IllegalArgument("StereoPinholeCamera -fov", i, args);
     } else if(arg == "-normalizeRays"){
       normalizeRays = true;
@@ -96,8 +96,8 @@
   camera_direction.normalize();
 
   vfov = hfov;  
-  height = nearZ * tan( vfov*0.5*M_PI/180.0 );
-  width  = nearZ * tan( hfov*0.5*M_PI/180.0 );
+  height = nearZ * tan( vfov*(Real)(0.5*M_PI/180) );
+  width  = nearZ * tan( hfov*(Real)(0.5*M_PI/180) );
 
   // Compute right vector.
   Vector right = Cross( camera_direction, up );
@@ -188,13 +188,13 @@
   }
 }
 
-void StereoPinholeCamera::scaleFOV(double scale)
+void StereoPinholeCamera::scaleFOV(Real scale)
 {
-  double fov_min = 0;
-  double fov_max = 180;
-  hfov = RtoD(2*atan(scale*tan(DtoR(hfov/2.))));
+  Real fov_min = 0;
+  Real fov_max = 180;
+  hfov = RtoD(2*atan(scale*tan(DtoR(hfov/2))));
   hfov = Clamp(hfov, fov_min, fov_max);
-  vfov = RtoD(2*atan(scale*tan(DtoR(vfov/2.))));
+  vfov = RtoD(2*atan(scale*tan(DtoR(vfov/2))));
   vfov = Clamp(vfov, fov_min, fov_max);
   setup();
 }
@@ -208,7 +208,7 @@
   setup();
 }
 
-void StereoPinholeCamera::dolly(double scale)
+void StereoPinholeCamera::dolly(Real scale)
 {
   Vector d = (lookat - eye) * scale;
   eye    += d;
@@ -232,7 +232,6 @@
   }
 
   Vector lookdir(eye-lookat);
-  double length = lookdir.length();
 
   AffineTransform frame;
   frame.initWithBasis(camera_v.normal(), camera_u.normal(), 
lookdir.normal(), cen );
@@ -248,18 +247,17 @@
   setup();
 }
 
-void StereoPinholeCamera::autoview(double new_fov)
+void StereoPinholeCamera::autoview(Real new_fov)
 {
   BBox bbox(Point(-1,-1,0.2), Point(1,1,2.2));
-  //  double ratio = tan(DtoR(vfov/2))/tan(DtoR(hfov/2));
   hfov = new_fov;
   vfov = RtoD(2*atan(tan(DtoR(hfov/2))));
   Vector diag(bbox.diagonal());
-  double w=diag.length();
+  Real w=diag.length();
   Vector lookdir(eye-lookat);
   lookdir.normalize();
-  double scale = 1.0/(2*tan(DtoR(hfov/2.0)));
-  double length = w*scale;
+  Real scale = 1/(2*tan(DtoR(hfov/2)));
+  Real length = w*scale;
   lookat = bbox.center();
   eye = lookat+lookdir*length;
   setup();
@@ -282,10 +280,10 @@
   // and is visible to camera, else it is not
   // It is not a sufficient condition though, the x and y coordinates should 
lie within the
   // width and height of the image, so returned coordinates are in the 
normalized space [-1,1]
-  if(fabs(p2.z())<0.0001) // check for inconsistencies
+  if(fabs(p2.z()) < (Real)(0.0001)) // check for inconsistencies
     return Point(0,0,0);
   else
-    return Point((p2.x()*nearZ/p2.z())/(width/2.0),
-                 (p2.y()*nearZ/p2.z())/(height/2.0),
+    return Point((p2.x()*nearZ/p2.z())/(width/2),
+                 (p2.y()*nearZ/p2.z())/(height/2),
                   p2.z()/nearZ);
 }

Modified: branches/itanium2/Model/Cameras/StereoPinholeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/StereoPinholeCamera.h       (original)
+++ branches/itanium2/Model/Cameras/StereoPinholeCamera.h       Thu Oct 13 
14:23:54 2005
@@ -22,8 +22,8 @@
 
       hfov( fov_ ),
 
-      eye_distance( 1.0 ),
-      focus_distance( 10.0 )  { setup(); }
+      eye_distance( 1 ),
+      focus_distance( 10 )  { setup(); }
 
     StereoPinholeCamera( const Point &eye_, const Point &lookat_, const 
Vector &up_, Real fov_,
                          Real eye_distance_, Real focus_distance_ ) :
@@ -39,11 +39,11 @@
     virtual void makeRays(RayPacket&) const;
 
     // Camera manipulation
-    virtual void scaleFOV(double);
+    virtual void scaleFOV(Real);
     virtual void translate(Vector);
-    virtual void dolly(double);
+    virtual void dolly(Real);
     virtual void transform(AffineTransform t, TransformCenter);
-    virtual void autoview(double fov);
+    virtual void autoview(Real fov);
                virtual void output( std::ostream &os );
          virtual Point project(const Point &point) const;  // project a 3D 
point to the camera image plane
 
@@ -93,7 +93,7 @@
     Vector v[2];
   
        // for projection we maintain a uvn rotation matrix
-    double uvn[3][3];
+    Real uvn[3][3];
   };
 }
 

Modified: branches/itanium2/Model/Groups/FrustumKDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/FrustumKDTree.cc     (original)
+++ branches/itanium2/Model/Groups/FrustumKDTree.cc     Thu Oct 13 14:23:54 
2005
@@ -157,7 +157,8 @@
   KDTreeNode *candidate = 0;
   
   // Traversal bounds.
-  BBox node_bounds = initial_bounds;
+  // This variable wasn't being used, because of scoping rules.
+  //  BBox node_bounds = initial_bounds;
   
   
/////////////////////////////////////////////////////////////////////////////
   // Main EP search loop.
@@ -293,7 +294,7 @@
 
     // t = dot((point-origin),normal) / dot(direction,normal)
     // Determine dn (1/ray direction)
-    Real direction_rcp = 1.0 / frustum.bound(i)[axis];
+    Real direction_rcp = (Real)1 / frustum.bound(i)[axis];
 
     // Compute the necessary component of ao = (plane point - origin)
     Real t = ((Real)node->split() - frustum.origin()[axis]) * direction_rcp;

Modified: branches/itanium2/Model/Groups/KDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/KDTree.cc    (original)
+++ branches/itanium2/Model/Groups/KDTree.cc    Thu Oct 13 14:23:54 2005
@@ -51,7 +51,7 @@
 
 #define SHOW_DUPLICATES 0
 
-unsigned long global_counter = 0;
+//static unsigned long global_counter = 0;
 
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
@@ -59,23 +59,26 @@
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
 
-int intersect_triangle3(const float orig[3], 
-                                                                             
                  const float dir[3],
-                                                                             
                  const float vert0[3], const float vert1[3], const float 
vert2[3],
-                                                                             
                  float *t, float *u, float *v );
+static int
+intersect_triangle3(const float orig[3], 
+                    const float dir[3],
+                    const float vert0[3], const float vert1[3], const float 
vert2[3],
+                    float *t, float *u, float *v );
 
 // Currently this routine is the fastest.
 // This is a C version of the ray triangle intersection edge form.
-int intersect_triangle3_edge(     const float orig[3], 
-                                                                             
                                                          const float dir[3],
-                                                                             
                                                          const float 
vert0[3],
-                                                                             
                                                          float *t, float *u, 
float *v,
-                                                                             
                                                          const float *edge1, 
const float *edge2);
+static inline int
+intersect_triangle3_edge(const float orig[3], 
+                         const float dir[3],
+                         const float vert0[3],
+                         float *t, float *u, float *v,
+                         const float *edge1, const float *edge2);
 
 // This is a C++ version of the above routine.
-int intersectTriangle3Edge(const Vectorf &direction, const Pointf &origin, 
-                           const Vectorf &edge1, Vectorf &edge2, Pointf &p0,
-                                                                             
                           float &t, float &u, float &v );
+static int
+intersectTriangle3Edge(const Vectorf &direction, const Pointf &origin, 
+                       const Vectorf &edge1, Vectorf &edge2, Pointf &p0,
+                       float &t, float &u, float &v );
 
 
 
///////////////////////////////////////////////////////////////////////////////
@@ -86,12 +89,12 @@
 int KDTree::intersectTriangles(const Ray* ray,
                                unsigned int listBegin, int listSize,
                                float maxDist, void *userData,
-                               const RenderContext &context,
+                               const RenderContext& /*context*/,
                                RayTriangleMailbox &mailbox ) const
 {
        int i;
        RayTriIntersectUserData *ud = (RayTriIntersectUserData*)userData;
-       float nearest_u, nearest_v;
+  //   float nearest_u, nearest_v;
        int nearest_tri = -1;
 
        Vectorf direction = ray->direction();
@@ -175,7 +178,7 @@
                                                                              
                                                                          
e.inverseDirection )) {
                        
                        // Determine the actual minimum distance.
-                       minDist = SCIRun::Max( minDist, T_EPSILON );
+                       minDist = SCIRun::Max( minDist, (Real)T_EPSILON );
                        maxDist = SCIRun::Min( maxDist, e.hitInfo.minT() );
                        
                        // Send the ray to the _intersect function.
@@ -190,7 +193,8 @@
 
///////////////////////////////////////////////////////////////////////////////
 // This function performs the KD-Tree Traversal.
 
///////////////////////////////////////////////////////////////////////////////
-void KDTree::computeNormal(const RenderContext& context, RayPacket& rays) 
const {
+void KDTree::computeNormal(const RenderContext& /*context*/,
+                           RayPacket& rays) const {
        
        // Copy the normal out of the KDTree::ScratchPadInfo structure.
        for (int i=0;i<rays.getSize();++i) {
@@ -225,7 +229,6 @@
        KDTreeNode *nearNode, *farNode;
        float split;
        int axis, entryPos, exitPos;
-       bool foundIntersection = false;
        int tmp;
 
   Pointf  origin    = ray->origin();
@@ -373,7 +376,7 @@
 
 /********************************************************/
 /* AABB-triangle overlap test code                      */
-/* by Tomas Akenine-Mˆller                              */
+/* by Tomas Akenine-Moller                              */
 /* Function: int triBoxOverlap(float boxcenter[3],      */
 /*          float boxhalfsize[3],float triverts[3][3]); */
 /* History:                                             */
@@ -592,13 +595,14 @@
 // KDTree Texture.
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
-void KDTreeTexture::mapValues(const RenderContext& context, RayPacket& rays, 
Color results[]) const {
+void KDTreeTexture::mapValues(const RenderContext& /*context*/,
+                              RayPacket& rays, Color results[]) const {
 
        for (int i=0;i<rays.getSize();++i) {
                RayPacket::Element &e = rays.get(i);
                results[i] = 
e.hitInfo.scratchpad<Kdtree::KDTree::ScratchPadInfo>().payload;
        }
-};
+}
 
 
 

Modified: branches/itanium2/Model/Groups/KDTree.h
==============================================================================
--- branches/itanium2/Model/Groups/KDTree.h     (original)
+++ branches/itanium2/Model/Groups/KDTree.h     Thu Oct 13 14:23:54 2005
@@ -333,7 +333,8 @@
       // Primitive Interface.
       virtual void intersect(const RenderContext& context, RayPacket& rays) 
const;
       void computeNormal (const RenderContext& context, RayPacket& rays) 
const;
-      void computeBounds (const PreprocessContext &context, BBox &box_ ) 
const
+      void computeBounds (const PreprocessContext& /*context*/,
+                          BBox &box_ ) const
       {
         box_.extendByBox( bbox );
       }

Modified: branches/itanium2/Model/Groups/KDTreeLoader.cc
==============================================================================
--- branches/itanium2/Model/Groups/KDTreeLoader.cc      (original)
+++ branches/itanium2/Model/Groups/KDTreeLoader.cc      Thu Oct 13 14:23:54 
2005
@@ -86,7 +86,7 @@
        virtual void run() {
        
                // Touch all of the buffers assigned to this thread.
-               for (int i=begin_offset;i<end_offset;++i) {
+               for (long i=begin_offset;i<end_offset;++i) {
                
                        (**tris)[i][0][0] = 0.0;
                        (*perVertNormals)[i][0] = 0.0;
@@ -177,7 +177,9 @@
 
///////////////////////////////////////////////////////////////////////////////
 
 // Load a binary v3c1 file containing the triangles.
-int LoadBin_V3C1(const char *filename, VArray<Triangle> **tris, /*Vectorf 
**perVertNormals,*/ Vectorf **perVertNormals, BBox &bounds, int np ) {
+static int LoadBin_V3C1(const char *filename, VArray<Triangle> **tris,
+                        /*Vectorf **perVertNormals,*/ Vectorf 
**perVertNormals,
+                        BBox &bounds, int np ) {
        
        FILE *f;
        if ((f=fopen(filename, "r")) == NULL) {
@@ -193,8 +195,7 @@
        
/////////////////////////////////////////////////////////////////////////////
        // Determine the amount of memory needed.
        long nTris = fileSize / (12*sizeof(float));
-       int nFloats = fileSize/4;
-       
+
        // Allocate input buffer.
        float *rawData = new float [fileSize / 4];
 
@@ -219,7 +220,7 @@
        CacheAlignedBBox *worker_box = new CacheAlignedBBox[ np ];
        Barrier v3c1_barrier( "v3c1_barrier" );
        
-       int work_per_thread = nTris / np;
+       long work_per_thread = nTris / np;
        
        long begin = 0;
        long end   = work_per_thread;
@@ -311,7 +312,7 @@
        Pointf min, max;
 };
 
-float endianness_swap( float in ) {
+static float endianness_swap( float in ) {
        float out;
        char *ci = (char *)&in;
        char *co = (char *)&out;

Modified: branches/itanium2/Model/Groups/RealisticBvh.cc
==============================================================================
--- branches/itanium2/Model/Groups/RealisticBvh.cc      (original)
+++ branches/itanium2/Model/Groups/RealisticBvh.cc      Thu Oct 13 14:23:54 
2005
@@ -64,7 +64,7 @@
                array[i]->computeBounds( context, bounds );
                
                // Find the centroid of those bounds.
-               Real centroid = (bounds[0][axis] + bounds[1][axis]) * 0.5;
+               Real centroid = (bounds[0][axis] + bounds[1][axis]) * 
(Real)0.5;
                
                if (centroid < pivot) {
                        Object *tmp = array[i];
@@ -157,7 +157,8 @@
                child[1]->preprocess( context );
 }
 
-void RealisticBvh::computeBounds(const PreprocessContext& context, BBox& 
bbox) const {
+void RealisticBvh::computeBounds(const PreprocessContext& /*context*/,
+                                 BBox& bbox) const {
 
        // Bound the bvh.
        bbox.extendByBox( bounds );
@@ -178,7 +179,7 @@
                Real min_t, max_t;
                bbox_intersect[i] = Intersection::intersectAaBox( bounds, 
min_t, max_t, e.ray, 
                                                                              
                                                                              
                                                      e.signMask, 
e.inverseDirection,
-                                                                             
                                                                              
                                                            0.0,
+                                                                             
                                                                              
                                                            (Real)0,
                                                                              
                                                                              
                                                            e.hitInfo.minT() 
);
        }
        

Modified: branches/itanium2/Model/Groups/TransparentKDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/TransparentKDTree.cc (original)
+++ branches/itanium2/Model/Groups/TransparentKDTree.cc Thu Oct 13 14:23:54 
2005
@@ -53,21 +53,24 @@
 using std::endl;
 using std::sort;
 
-// From Tomas Akenine-Mˆller's code, included below in this file.
-int intersect_triangle3(const float orig[3], 
-                                                                             
                  const float dir[3],
-                                                                             
                  const float vert0[3], const float vert1[3], const float 
vert2[3],
-                                                                             
                  float *t, float *u, float *v );
-
-int intersect_triangle3_edge(     const float orig[3], 
-                                                                             
                                                          const float dir[3],
-                                                                             
                                                          const float 
vert0[3],
-                                                                             
                                                          float *t, float *u, 
float *v,
-                                                                             
                                                          const float *edge1, 
const float *edge2);
-
-int intersectTriangle3Edge(const Vectorf &direction, const Pointf &origin, 
-                           const Vectorf &edge1, Vectorf &edge2, Pointf &p0,
-                                                                             
                           float &t, float &u, float &v );
+// From Tomas Akenine-Moller's code, included below in this file.
+static int
+intersect_triangle3(const float orig[3],
+                    const float dir[3],
+                    const float vert0[3], const float vert1[3], const float 
vert2[3],
+                    float *t, float *u, float *v );
+
+static inline int
+intersect_triangle3_edge(const float orig[3],
+                         const float dir[3],
+                         const float vert0[3],
+                         float *t, float *u, float *v,
+                         const float *edge1, const float *edge2);
+
+static int
+intersectTriangle3Edge(const Vectorf &direction, const Pointf &origin,
+                       const Vectorf &edge1, Vectorf &edge2, Pointf &p0,
+                       float &t, float &u, float &v );
 
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
@@ -97,8 +100,6 @@
 {
        int i;
        RayTriIntersectUserData *ud = (RayTriIntersectUserData*)userData;
-       float nearest_u, nearest_v;
-       int nearest_tri = -1;
 
        Vectorf direction = ray->direction();
        Pointf  origin    = ray->origin();      
@@ -170,18 +171,18 @@
                Real sample_alpha__ = sample_alpha;
                
                // combine  color and opacity 
-               for (int i=0; (i<isectbuf->getLen()) && (ray_alpha < 0.95); 
i++) {
+               for (int i=0; (i<isectbuf->getLen()) && (ray_alpha < 
(Real)0.95); i++) {
                        
                        Color &triangle_color = tris->get( array[i].triIdx 
).payload;
                         
                        Real scale = Abs(Dot( normals[array[i].triIdx], 
direction ));
-                       scale *= 0.75;
-                       scale += 0.25;
+                       scale *= (Real)0.75;
+                       scale += (Real)0.25;
                        
                        Color sample_color = (triangle_color * scale);
                         
-                       ray_color += (sample_color*sample_alpha__) * (1.0 - 
ray_alpha);
-                       ray_alpha += sample_alpha__ * (1.0 - ray_alpha);
+                       ray_color += (sample_color*sample_alpha__) * (1 - 
ray_alpha);
+                       ray_alpha += sample_alpha__ * (1 - ray_alpha);
                }
                
                // Update sample t to the last triangle composited.
@@ -222,7 +223,7 @@
                                                                              
                                                                          
e.inverseDirection )) {
                        
                        // Determine the actual minimum distance.
-                       minDist = SCIRun::Max( minDist, T_EPSILON );
+                       minDist = SCIRun::Max( minDist, (Real)T_EPSILON );
                        maxDist = SCIRun::Min( maxDist, e.hitInfo.minT() );
                        
                        // Send the ray to the _intersect function.
@@ -236,7 +237,8 @@
 
///////////////////////////////////////////////////////////////////////////////
 // This function performs the KD-Tree Traversal.
 
///////////////////////////////////////////////////////////////////////////////
-void TransparentKDTree::computeNormal(const RenderContext& context, 
RayPacket& rays) const {
+void TransparentKDTree::computeNormal(const RenderContext& /*context*/,
+                                      RayPacket& rays) const {
        
        // Copy the normal out of the TransparentKDTree::ScratchPadInfo 
structure.
        for (int i=0;i<rays.getSize();++i) {
@@ -270,7 +272,6 @@
        KDTreeNode *nearNode, *farNode;
        float split;
        int axis, entryPos, exitPos;
-       bool foundIntersection = false;
        int tmp;
        
   Pointf  origin    = ray->origin();

Modified: branches/itanium2/Model/Lights/HeadLight.cc
==============================================================================
--- branches/itanium2/Model/Lights/HeadLight.cc (original)
+++ branches/itanium2/Model/Lights/HeadLight.cc Thu Oct 13 14:23:54 2005
@@ -7,17 +7,18 @@
 using namespace Manta;
 
 void HeadLight::computeLight( Color &resultColor, Vector &lightDirection,
-                                                                        
const RenderContext &context, RayPacket::Element &e ) const {
-                                                                        
-       // Determine the camera position.
-       Point camera = context.camera->getPosition();
-       Vector up    = context.camera->getUp();
-       
-       // Determine light position.
-       Point position = camera + (up * offset);
-       
-       // Finally compute light direction.
-       lightDirection = position - e.hitPosition;
-       
-       resultColor = color;
-}
\ No newline at end of file
+                              const RenderContext &context,
+                              RayPacket::Element &e ) const {
+
+  // Determine the camera position.
+  Point camera = context.camera->getPosition();
+  Vector up    = context.camera->getUp();
+
+  // Determine light position.
+  Point position = camera + (up * offset);
+
+  // Finally compute light direction.
+  lightDirection = position - e.hitPosition;
+
+  resultColor = color;
+}

Modified: branches/itanium2/Model/Lights/PointLight.cc
==============================================================================
--- branches/itanium2/Model/Lights/PointLight.cc        (original)
+++ branches/itanium2/Model/Lights/PointLight.cc        Thu Oct 13 14:23:54 
2005
@@ -16,7 +16,9 @@
 {
 }
 
-void PointLight::computeLight( Color &resultColor, Vector &lightDirection, 
const RenderContext &context, RayPacket::Element &e ) const {
+void PointLight::computeLight( Color &resultColor, Vector &lightDirection,
+                               const RenderContext &/*context*/,
+                               RayPacket::Element &e ) const {
 
        // Specify the color.
        resultColor = color;

Modified: branches/itanium2/Model/Materials/Checker.cc
==============================================================================
--- branches/itanium2/Model/Materials/Checker.cc        (original)
+++ branches/itanium2/Model/Materials/Checker.cc        Thu Oct 13 14:23:54 
2005
@@ -31,8 +31,8 @@
   else
     rays.computeTextureCoordinates2(context);
   RayPacket::Element& e0 = rays.get(0);
-  double vv1 = Dot(e0.texCoords, v1);
-  double vv2 = Dot(e0.texCoords, v2);
+  Real vv1 = Dot(e0.texCoords, v1);
+  Real vv2 = Dot(e0.texCoords, v2);
   if(vv1<0)
     vv1=-vv1+1;
   if(vv2<0)
@@ -49,12 +49,12 @@
     int which = which0;
     while(stop < rays.getSize()){
       RayPacket::Element& e = rays.get(stop);
-      double vv1 = Dot(e.texCoords, v1);
-      double vv2 = Dot(e.texCoords, v2);
+      Real vv1 = Dot(e.texCoords, v1);
+      Real vv2 = Dot(e.texCoords, v2);
       if(vv1<0)
-       vv1=-vv1+1;
+        vv1=-vv1+1;
       if(vv2<0)
-       vv2=-vv2+1;
+        vv2=-vv2+1;
       int i1 = (int)vv1;
       int i2 = (int)vv2;
       which = (i1+i2)%2;

Modified: branches/itanium2/Model/Materials/CopyColorMaterial.cc
==============================================================================
--- branches/itanium2/Model/Materials/CopyColorMaterial.cc      (original)
+++ branches/itanium2/Model/Materials/CopyColorMaterial.cc      Thu Oct 13 
14:23:54 2005
@@ -14,7 +14,8 @@
 
 using namespace Manta;
 
-void KDTreeCopyColorMaterial::shade(const RenderContext& context, RayPacket& 
rays) const {
+void KDTreeCopyColorMaterial::shade(const RenderContext& /*context*/,
+                                    RayPacket& rays) const {
        
        for (int i=0;i<rays.getSize();i++) {
                RayPacket::Element& e = rays.get(i);
@@ -24,7 +25,8 @@
        }
 }
 
-void CopyColorMaterial::shade(const RenderContext& context, RayPacket& rays) 
const {
+void CopyColorMaterial::shade(const RenderContext& /*context*/,
+                              RayPacket& rays) const {
        
        for (int i=0;i<rays.getSize();i++) {
                RayPacket::Element& e = rays.get(i);

Modified: branches/itanium2/Model/Materials/Dielectric.cc
==============================================================================
--- branches/itanium2/Model/Materials/Dielectric.cc     (original)
+++ branches/itanium2/Model/Materials/Dielectric.cc     Thu Oct 13 14:23:54 
2005
@@ -37,11 +37,13 @@
 #include <Interface/Renderer.h>
 #include <Interface/Scene.h>
 #include <Interface/ShadowAlgorithm.h>
+#include <Core/Math/Trig.h>
 
 using namespace Manta;
 
-Dielectric::Dielectric(const Texture<Real>* n, const Texture<Real>* nt, 
const Texture<Color>* sigma_a)
-    : n(n), nt(nt), sigma_a(sigma_a)
+Dielectric::Dielectric(const Texture<Real>* n, const Texture<Real>* nt,
+                       const Texture<Color>* sigma_a)
+  : n(n), nt(nt), sigma_a(sigma_a)
 {
 
 }
@@ -75,8 +77,8 @@
       exit(-1);
   }
 
-  double n_values[RayPacket::MaxSize];
-  double nt_values[RayPacket::MaxSize];
+  Real n_values[RayPacket::MaxSize];
+  Real nt_values[RayPacket::MaxSize];
   Color sigma_a_values[RayPacket::MaxSize];
 
   n->mapValues(context, rays, n_values);
@@ -85,9 +87,9 @@
 
   Vector refl_dirs[RayPacket::MaxSize];
   Vector refr_dirs[RayPacket::MaxSize];
-  float fresnel_coeffs[RayPacket::MaxSize]; // might be better to compute
+  Real fresnel_coeffs[RayPacket::MaxSize]; // might be better to compute
   Color beers_colors[RayPacket::MaxSize];
-  double beers_coeffs[RayPacket::MaxSize];
+  Real beers_coeffs[RayPacket::MaxSize];
   bool internally_reflected[RayPacket::MaxSize];
   bool apply_beers[RayPacket::MaxSize];
   bool kill_ray[RayPacket::MaxSize];
@@ -99,7 +101,7 @@
   {
       RayPacket::Element& e = rays.get(i);
 
-      if ( e.importance < 0.05 )
+      if ( e.importance < (Real)0.05 )
       {
           kill_ray[i] = true;
           continue;
@@ -110,50 +112,51 @@
       }
 
       Vector N = e.normal;
-      double n_dot_v = Dot(N, e.ray.direction());
-      double eta_tmp;
-      double eta_tmp_inv;
+      Real n_dot_v = Dot(N, e.ray.direction());
+      Real eta_tmp;
+      Real eta_tmp_inv;
       bool was_incoming = ( n_dot_v < 0 );
       if ( was_incoming )
       {
           eta_tmp = n_values[i]/nt_values[i];
-          eta_tmp_inv = 1.0 / eta_tmp;
+          eta_tmp_inv = 1 / eta_tmp;
           n_dot_v = -n_dot_v;
           apply_beers[i] = false;
-          beers_coeffs[i] = 1.0;// allows blind multiplication
+          beers_coeffs[i] = 1;// allows blind multiplication
       }
       else
       {
           N = -N;
           eta_tmp = nt_values[i]/n_values[i];
-          eta_tmp_inv = 1.0 / eta_tmp;
+          eta_tmp_inv = 1 / eta_tmp;
           apply_beers[i] = true;
           beers_colors[i] = sigma_a_values[i].Pow(e.hitInfo.minT());
           beers_coeffs[i] = beers_colors[i].Mean();
       }
 
-      double cosine = 1.0 + (n_dot_v*n_dot_v - 
1.0)*(eta_tmp_inv*eta_tmp_inv);
-      if ( cosine <= 0.0 )
+      Real cosine = 1 + (n_dot_v*n_dot_v - 1) * (eta_tmp_inv*eta_tmp_inv);
+      if ( cosine <= 0 )
       {
           // total internal reflection
-          Vector refl_dir = e.ray.direction() + 2.0*n_dot_v*N;
+          Vector refl_dir = e.ray.direction() + 2*n_dot_v*N;
           internally_reflected[i] = true;
           refl_dirs[i] = refl_dir;
           num_internal++;
       }
       else
       {
-          cosine = (cosine > 0) ? sqrt(cosine) : 0;
-          double cos_min = ( cosine > n_dot_v ) ? n_dot_v : cosine;
-          float k = 1 - cosine;
+          cosine = (cosine > 0) ? Sqrt(cosine) : 0;
+          //          Real cos_min = ( cosine > n_dot_v ) ? n_dot_v : cosine;
+          Real k = 1 - cosine;
           k*=k*k*k*k;
 
-          double r0 = (n_values[i] - nt_values[i]) / (n_values[i] + 
nt_values[i]);
+          Real r0 = (n_values[i] - nt_values[i]) / (n_values[i] + 
nt_values[i]);
           r0 *= r0;
-          float R = r0*(1-k) + k;
+          Real R = r0*(1-k) + k;
 
-          Vector refr_dir = e.ray.direction()*eta_tmp_inv + 
(n_dot_v*eta_tmp_inv - cosine) * N;
-          Vector refl_dir = e.ray.direction() + 2.0*n_dot_v*N;
+          Vector refr_dir = (e.ray.direction()*eta_tmp_inv +
+                             (n_dot_v*eta_tmp_inv - cosine) * N);
+          Vector refl_dir = e.ray.direction() + 2*n_dot_v*N;
 
           internally_reflected[i] = false;
           num_branch++;
@@ -201,7 +204,7 @@
           refl.importance = e.importance * fresnel_coeffs[i] * 
beers_coeffs[i];
           RayPacket::Element& refr = refracted_rays.get(branch_counter);
           refr.ray.set(e.hitPosition, refr_dirs[i]);
-          refr.importance = e.importance * (1. - fresnel_coeffs[i]) * 
beers_coeffs[i];
+          refr.importance = e.importance * (1 - fresnel_coeffs[i]) * 
beers_coeffs[i];
           branch_counter++;
       }
   }
@@ -236,7 +239,7 @@
           RayPacket::Element& refr = refracted_rays.get(branch_counter);
 
           rays.setResult(i, (Color::white()*fresnel_coeffs[i])*(*refl.color) 
+
-                       (Color::white()*(1.-fresnel_coeffs[i]))*(*refr.color) 
);
+                       (Color::white()*(1-fresnel_coeffs[i]))*(*refr.color) 
);
 
           branch_counter++;
       }

Modified: branches/itanium2/Model/Materials/Dielectric.h
==============================================================================
--- branches/itanium2/Model/Materials/Dielectric.h      (original)
+++ branches/itanium2/Model/Materials/Dielectric.h      Thu Oct 13 14:23:54 
2005
@@ -42,17 +42,21 @@
   class Dielectric : public LitMaterial
   {
   public:
-                       Dielectric(const Real &n, const Real &nt, const Color 
&sigma_a)
-                        : n(new Constant<Real>(n)), nt(new 
Constant<Real>(nt)), sigma_a(new Constant<Color>(sigma_a)) { }
-       
-      Dielectric(const Texture<Real>* n, const Texture<Real>* nt, const 
Texture<Color>* sigma_a);
+                       Dielectric(const Real n, const Real nt, const Color 
&sigma_a)
+                        : n(new Constant<Real>(n)),
+         nt(new Constant<Real>(nt)),
+         sigma_a(new Constant<Color>(sigma_a))
+    { }
+
+      Dielectric(const Texture<Real>* n, const Texture<Real>* nt,
+                 const Texture<Color>* sigma_a);
       ~Dielectric();
 
       void shade(const RenderContext& context, RayPacket& rays) const;
                        
   private:
-      const Texture<double>* n;
-      const Texture<double>* nt;
+      const Texture<Real>* n;
+      const Texture<Real>* nt;
       const Texture<Color>* sigma_a;
   };
 }

Modified: branches/itanium2/Model/Materials/LambertianAlt.cc
==============================================================================
--- branches/itanium2/Model/Materials/LambertianAlt.cc  (original)
+++ branches/itanium2/Model/Materials/LambertianAlt.cc  Thu Oct 13 14:23:54 
2005
@@ -16,7 +16,8 @@
 
 using namespace SCIRun;
 
-void LambertianAlt::shade(const RenderContext& context, RayPacket& rays) 
const {
+void LambertianAlt::shade(const RenderContext& /*context*/,
+                          RayPacket& rays) const {
 
 #if 0
        for (int i=0;i<rays.getSize();i++) {

Modified: branches/itanium2/Model/Materials/MetalMaterial.cc
==============================================================================
--- branches/itanium2/Model/Materials/MetalMaterial.cc  (original)
+++ branches/itanium2/Model/Materials/MetalMaterial.cc  Thu Oct 13 14:23:54 
2005
@@ -59,9 +59,9 @@
        RayPacket::Element& r = refl_rays.get(i);
 
        // compute Schlick Fresnel approximation
-       double cosine = -Dot(e.normal, e.ray.direction());
+       Real cosine = -Dot(e.normal, e.ray.direction());
        if(cosine < 0) cosine =-cosine;
-       float k = 1 - cosine;
+       Real k = 1 - cosine;
        k*=k*k*k*k;
 
         Color R = specular[i] * (1-k) + Color::white()*k;

Modified: branches/itanium2/Model/Materials/Phong.cc
==============================================================================
--- branches/itanium2/Model/Materials/Phong.cc  (original)
+++ branches/itanium2/Model/Materials/Phong.cc  Thu Oct 13 14:23:54 2005
@@ -15,23 +15,23 @@
 using namespace Manta;
 
 Phong::Phong(const Color& diffuse, const Color& specular, int specpow,
-            double refl)
+            Real refl)
   : specpow(specpow)
 {
   diffusetex = new Constant<Color>(diffuse);
   speculartex = new Constant<Color>(specular);
-  refltex = new Constant<double>(refl);
+  refltex = new Constant<Real>(refl);
   do_refl = (refl != 0);
 }
 
 Phong::Phong(const Texture<Color>* diffusetex,
             const Texture<Color>* speculartex,
-            int specpow, const Texture<double>* refltex)
+            int specpow, const Texture<Real>* refltex)
   : diffusetex(diffusetex), speculartex(speculartex), refltex(refltex),
     specpow(specpow)
 {
   do_refl=true;
-  const Constant<double>* rtest = dynamic_cast<const 
Constant<double>*>(refltex);
+  const Constant<Real>* rtest = dynamic_cast<const Constant<Real>*>(refltex);
   if(rtest && rtest->getValue() == 0)
     do_refl =false;
 }
@@ -52,7 +52,7 @@
   diffusetex->mapValues(context, rays, diffuse);
   Color specular[RayPacket::MaxSize];
   speculartex->mapValues(context, rays, specular);
-  double refl[RayPacket::MaxSize];
+  Real refl[RayPacket::MaxSize];
   refltex->mapValues(context, rays, refl);
 
   // Compute normals
@@ -76,12 +76,12 @@
        for(int j=e.shadowBegin;j<e.shadowEnd;j++){
          RayPacket::Element& s = shadowRays.get(j);
          if(!s.hitInfo.wasHit()){
-           double cos_theta = Dot(s.ray.direction(), e.normal);
+           Real cos_theta = Dot(s.ray.direction(), e.normal);
            totalDiffuse += s.light*cos_theta;
            Vector H = s.ray.direction()-e.ray.direction();
-           double cos_alpha = Dot(H, e.normal);
+           Real cos_alpha = Dot(H, e.normal);
            if(cos_alpha > 0){
-             double length = H.length();
+             Real length = H.length();
              totalSpecular += s.light * ipow(cos_alpha/length, specpow);
            }
          }

Modified: branches/itanium2/Model/Materials/Phong.h
==============================================================================
--- branches/itanium2/Model/Materials/Phong.h   (original)
+++ branches/itanium2/Model/Materials/Phong.h   Thu Oct 13 14:23:54 2005
@@ -2,6 +2,7 @@
 #ifndef Manta_Model_Phong_h
 #define Manta_Model_Phong_h
 
+#include <MantaTypes.h>
 #include <Model/Materials/LitMaterial.h>
 #include <Core/Color/Color.h>
 #include <Interface/Texture.h>
@@ -13,15 +14,15 @@
   public:
        
                // Note if refl == 0 the phong shader won't cast a reflected 
ray.
-    Phong(const Color& diffuse, const Color& specular, int specpow, double 
refl = 0.0);
-    Phong(const Texture<Color>* diffuse, const Texture<Color>* specular, int 
specpow, const Texture<double>* refl);
+    Phong(const Color& diffuse, const Color& specular, int specpow, Real 
refl = 0);
+    Phong(const Texture<Color>* diffuse, const Texture<Color>* specular, int 
specpow, const Texture<Real>* refl);
     virtual ~Phong();
 
     virtual void shade(const RenderContext& context, RayPacket& rays) const;
   private:
     const Texture<Color>* diffusetex;
     const Texture<Color>* speculartex;
-    const Texture<double>* refltex;
+    const Texture<Real>* refltex;
     int specpow;
     bool do_refl;
   };

Modified: branches/itanium2/Model/MiscObjects/CuttingPlane.cc
==============================================================================
--- branches/itanium2/Model/MiscObjects/CuttingPlane.cc (original)
+++ branches/itanium2/Model/MiscObjects/CuttingPlane.cc Thu Oct 13 14:23:54 
2005
@@ -10,7 +10,7 @@
 void CuttingPlane::movePlaneAlongNormal( Real distance ) { 
 
        plane_point = initial_point + (plane_normal * distance * 100.0);
-};
+}
 
 // Preprocess the internal object and compute its bounds.
 void CuttingPlane::preprocess( const PreprocessContext &context ) {
@@ -23,7 +23,7 @@
 
        // Determine how far away the edges of the bounding box are from the 
        // initial point.
-       movement_scale = bounds.diagonal().length() * 0.5;
+       movement_scale = bounds.diagonal().length() * (Real)0.5;
 }
 
 void CuttingPlane::intersect(const RenderContext& context, RayPacket& rays) 
const {

Modified: branches/itanium2/Model/Primitives/BvhTriangleMesh.cc
==============================================================================
--- branches/itanium2/Model/Primitives/BvhTriangleMesh.cc       (original)
+++ branches/itanium2/Model/Primitives/BvhTriangleMesh.cc       Thu Oct 13 
14:23:54 2005
@@ -37,7 +37,7 @@
 BvhTriangleMesh::Node::Node( int triangle_index_ ) : triangle_index( 
triangle_index_ ) { 
 
        child[0] = child[1] = 0; 
-};
+}
 
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
@@ -45,7 +45,9 @@
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
 
-void BvhTriangleMesh::intersect_leaf(Node *node, const RenderContext 
&context, RayPacket &rays ) const {
+void BvhTriangleMesh::intersect_leaf(Node *node,
+                                     const RenderContext& /*context*/,
+                                     RayPacket& rays ) const {
 
        // Determine the triangle index.
        int index = node->triangle_index;
@@ -97,7 +99,7 @@
                 
                                                                              
                                                                              
                                                            min_t, max_t, 
e.ray, 
                                                                              
                                                                              
                                                      e.signMask, 
e.inverseDirection,
-                                                                             
                                                                              
                                                            0.0,
+                                                                             
                                                                              
                                                            (Real)0,
                                                                              
                                                                              
                                                            e.hitInfo.minT() 
);
        }
        
@@ -165,7 +167,7 @@
                compute_bounds( bounds, array[i] );
                
                // Find the centroid of those bounds.
-               Real centroid = (bounds[0][axis] + bounds[1][axis]) * 0.5;
+               Real centroid = (bounds[0][axis] + bounds[1][axis]) * 
(Real)0.5;
                
                if (centroid < pivot) {
                        int tmp = array[i];
@@ -270,13 +272,15 @@
 }
 
 // Public interface.
-void BvhTriangleMesh::computeBounds(const PreprocessContext& context, BBox& 
bbox) const {
+void BvhTriangleMesh::computeBounds(const PreprocessContext& /*context*/,
+                                    BBox& bbox) const {
        
        // The root node contains the bounds for the entire model.
        bbox.extendByBox( root->bounds );
 }
 
-void BvhTriangleMesh::computeNormal(const RenderContext& context, RayPacket& 
rays) const {
+void BvhTriangleMesh::computeNormal(const RenderContext& /*context*/,
+                                    RayPacket& rays) const {
 
        rays.computeHitPositions();
 
@@ -289,7 +293,7 @@
                Hit &hit = e.hitInfo.scratchpad<Hit>();
                
                // Interpolate normals across the face.
-               Real ab = 1.0 - (hit.a + hit.b);
+               Real ab = 1 - (hit.a + hit.b);
                
                e.normal = (normal_array[ hit.tri.n0 ] * hit.a) + 
                           (normal_array[ hit.tri.n1 ] * hit.b) + 

Modified: branches/itanium2/Model/Primitives/Cone.cc
==============================================================================
--- branches/itanium2/Model/Primitives/Cone.cc  (original)
+++ branches/itanium2/Model/Primitives/Cone.cc  Thu Oct 13 14:23:54 2005
@@ -3,12 +3,12 @@
 #include <Interface/RayPacket.h>
 #include <Core/Geometry/BBox.h>
 #include <Core/Util/NotFinished.h>
-#include <math.h>
+#include <Core/Math/Trig.h>
 
 using namespace Manta;
 using namespace std;
 
-Cone::Cone(Material* mat, const Point& bottom, const Point& top, double Rb, 
double Rt)
+Cone::Cone(Material* mat, const Point& bottom, const Point& top, Real Rb, 
Real Rt)
   : PrimitiveCommon(mat, this), bottom(bottom), top(top), Rb(Rb), Rt(Rt)
 {
 }
@@ -30,106 +30,106 @@
   if(rays.getFlags() & RayPacket::ConstantOrigin) {
     RayPacket::Element& e0 = rays.get(0);
     Point Pa = bottom + Rb * (top - bottom) / (Rb-Rt);
-    double btx = (top.x()-bottom.x())*(top.x()-bottom.x());
-    double bty = (top.y()-bottom.y())*(top.y()-bottom.y());
-    double btz = (top.z()-bottom.z())*(top.z()-bottom.z());
-    double lbt = sqrt(btx+bty+btz);
-    double RbRt = Rb-Rt;
-    double hyp = sqrt(lbt*lbt + RbRt*RbRt);
+    Real btx = (top.x()-bottom.x())*(top.x()-bottom.x());
+    Real bty = (top.y()-bottom.y())*(top.y()-bottom.y());
+    Real btz = (top.z()-bottom.z())*(top.z()-bottom.z());
+    Real lbt = Sqrt(btx+bty+btz);
+    Real RbRt = Rb-Rt;
+    Real hyp = Sqrt(lbt*lbt + RbRt*RbRt);
     
     Vector Va = (top-bottom) / lbt;
-    //    double tgAlpha = (Rb-Rt) / lbt;
-    double cosA = RbRt/hyp;
-    double sinA = lbt/hyp;
-    double cosA2 = cosA*cosA;
-    double sinA2 = sinA*sinA;
+    //    Real tgAlpha = (Rb-Rt) / lbt;
+    Real cosA = RbRt/hyp;
+    Real sinA = lbt/hyp;
+    Real cosA2 = cosA*cosA;
+    Real sinA2 = sinA*sinA;
     Point P(xform * e0.ray.origin());
     Vector dP(P - Pa);
     for(int i=0; i<rays.getSize(); i++) {
       RayPacket::Element& e = rays.get(i);
       Vector V(xform * e.ray.direction());
       Vector tv = V;
-      double dist_scale = tv.normalize();
-      double a = (cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
-       (sinA2*Dot(V,Va)*Dot(V,Va));
-      double b = 2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
-       2*sinA2*Dot(V,Va)*Dot(dP,Va);
-      double c = cosA2*Dot(dP-Dot(dP,Va)*Va,
-                          dP-Dot(dP,Va)*Va)-
-       sinA2*Dot(dP,Va)*Dot(dP,Va);
-      
-      double d = sqrt(b*b-4*a*c);
-      
+      Real dist_scale = tv.normalize();
+      Real a = ((cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
+                (sinA2*Dot(V,Va)*Dot(V,Va)));
+      Real b = (2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
+                2*sinA2*Dot(V,Va)*Dot(dP,Va));
+      Real c = (cosA2*Dot(dP-Dot(dP,Va)*Va,
+                          dP-Dot(dP,Va)*Va)-
+                sinA2*Dot(dP,Va)*Dot(dP,Va));
+
+      Real d = Sqrt(b*b-4*a*c);
+
       if(d > 0.0) {
-       double t1 = (-b+d)/(2*a);
-       double t2 = (-b-d)/(2*a);
-       
-       if(t1 < t2) {
-         double temp = t1;
-         t1 = t2;
-         t2 = temp;
-       }
-       
-       double z1 = P.z()+t1*V.z();
-       double z2 = P.z()+t2*V.z();
-       if(t1>0 && z1 > 0.0 && z1 < 1.0) {
-         e.hitInfo.hit(t1/dist_scale, material, this, tex);
-       }
-       if(t2>0 && z2 > 0.0 && z2 < 1.0) {
-         e.hitInfo.hit(t2/dist_scale, material, this, tex);
-       }
+        Real t1 = (-b+d)/(2*a);
+        Real t2 = (-b-d)/(2*a);
+
+        if(t1 < t2) {
+          Real temp = t1;
+          t1 = t2;
+          t2 = temp;
+        }
+
+        Real z1 = P.z()+t1*V.z();
+        Real z2 = P.z()+t2*V.z();
+        if(t1>0 && z1 > 0 && z1 < 1) {
+          e.hitInfo.hit(t1/dist_scale, material, this, tex);
+        }
+        if(t2>0 && z2 > 0 && z2 < 1) {
+          e.hitInfo.hit(t2/dist_scale, material, this, tex);
+        }
       }
     }
   }
   else {
     Point Pa = bottom + Rb * (top - bottom) / (Rb-Rt);
-    double btx = (top.x()-bottom.x())*(top.x()-bottom.x());
-    double bty = (top.y()-bottom.y())*(top.y()-bottom.y());
-    double btz = (top.z()-bottom.z())*(top.z()-bottom.z());
-    double lbt = sqrt(btx+bty+btz);
-    double RbRt = Rb-Rt;
-    double hyp = sqrt(lbt*lbt + RbRt*RbRt);
-    
+    Real btx = (top.x()-bottom.x())*(top.x()-bottom.x());
+    Real bty = (top.y()-bottom.y())*(top.y()-bottom.y());
+    Real btz = (top.z()-bottom.z())*(top.z()-bottom.z());
+    Real lbt = Sqrt(btx+bty+btz);
+    Real RbRt = Rb-Rt;
+    Real hyp = Sqrt(lbt*lbt + RbRt*RbRt);
+
     Vector Va = (top-bottom) / lbt;
-    //    double tgAlpha = (Rb-Rt) / lbt;
-    double cosA = RbRt/hyp;
-    double sinA = lbt/hyp;
-    double cosA2 = cosA*cosA;
-    double sinA2 = sinA*sinA;
+    //    Real tgAlpha = (Rb-Rt) / lbt;
+    Real cosA = RbRt/hyp;
+    Real sinA = lbt/hyp;
+    Real cosA2 = cosA*cosA;
+    Real sinA2 = sinA*sinA;
     for(int i=0; i<rays.getSize(); i++) {
       RayPacket::Element& e = rays.get(i);
       Point P(xform * e.ray.origin());
       Vector dP(P - Pa);
       Vector V(xform * e.ray.direction());
       Vector tv = V;
-      double dist_scale = tv.normalize();
-      double a = (cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
-       (sinA2*Dot(V,Va)*Dot(V,Va));
-      double b = 2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
-       2*sinA2*Dot(V,Va)*Dot(dP,Va);
-      double c = cosA2*Dot(dP-Dot(dP,Va)*Va, dP-Dot(dP,Va)*Va)-
-       sinA2*Dot(dP,Va)*Dot(dP,Va);
-      
-      double d = sqrt(b*b-4*a*c);
-      
-      if(d > 0.0) {
-       double t1 = (-b+d)/(2*a);
-       double t2 = (-b-d)/(2*a);
-       
-       if(t1 < t2) {
-         double temp = t1;
-         t1 = t2;
-         t2 = temp;
-       }
-       
-       double z1 = P.z()+t1*V.z();
-       double z2 = P.z()+t2*V.z();
-       if(t1>0 && z1 > 0.0 && z1 < 1.0) {
-         e.hitInfo.hit(t1/dist_scale, material, this, tex);
-       }
-       if(t2>0 && z2 > 0.0 && z2 < 1.0) {
-         e.hitInfo.hit(t2/dist_scale, material, this, tex);
-       }
+      Real dist_scale = tv.normalize();
+      Real a = ((cosA2*Dot(V-Dot(V,Va)*Va, V-Dot(V,Va)*Va))-
+                (sinA2*Dot(V,Va)*Dot(V,Va)));
+      Real b = (2*cosA2*Dot(V-Dot(V,Va)*Va, dP-Dot(dP,Va)*Va)-
+                2*sinA2*Dot(V,Va)*Dot(dP,Va));
+      Real c = (cosA2*Dot(dP-Dot(dP,Va)*Va, dP-Dot(dP,Va)*Va)-
+                sinA2*Dot(dP,Va)*Dot(dP,Va));
+
+      Real d = Sqrt(b*b-4*a*c);
+
+      if(d > 0) {
+        Real t1 = (-b+d)/(2*a);
+        Real t2 = (-b-d)/(2*a);
+
+        if(t1 < t2) {
+          Real temp = t1;
+          t1 = t2;
+          t2 = temp;
+        }
+
+        Real z1 = P.z()+t1*V.z();
+        Real z2 = P.z()+t2*V.z();
+        if(t1>0 && z1 > 0 && z1 < 1) {
+          e.hitInfo.hit(t1/dist_scale, material, this, tex);
+        }
+        if(t2>0 && z2 > 0 && z2 < 1) {
+          e.hitInfo.hit(t2/dist_scale, material, this, tex);
+        }
       }
     }
   }
@@ -143,7 +143,7 @@
     RayPacket::Element& e = rays.get(i);
 #if 0
     Vector xn(xform.project(e.hitPosition).asVector());
-    xn.z(0.0);
+    xn.z(0);
     Vector v=ixform.project(xn);
     v.normalize();
     e.normal = v;

Modified: branches/itanium2/Model/Primitives/Cone.h
==============================================================================
--- branches/itanium2/Model/Primitives/Cone.h   (original)
+++ branches/itanium2/Model/Primitives/Cone.h   Thu Oct 13 14:23:54 2005
@@ -12,7 +12,7 @@
 
   class Cone : public PrimitiveCommon, public TexCoordMapper {
   public:
-    Cone(Material* mat, const Point& bottom, const Point& top, double Rb, 
double Rt);
+    Cone(Material* mat, const Point& bottom, const Point& top, Real Rb, Real 
Rt);
     virtual ~Cone();
     
     virtual void computeBounds(const PreprocessContext& context,
@@ -26,7 +26,7 @@
     
   private:
     Point bottom, top;
-    double Rb, Rt;
+    Real Rb, Rt;
     AffineTransform xform, ixform;
   };
 }

Modified: branches/itanium2/Model/Primitives/Disk.cc
==============================================================================
--- branches/itanium2/Model/Primitives/Disk.cc  (original)
+++ branches/itanium2/Model/Primitives/Disk.cc  Thu Oct 13 14:23:54 2005
@@ -5,13 +5,13 @@
 using namespace Manta;
 using namespace std;
 
-Disk::Disk(Material* mat, const Point& center, const Vector& n, double 
radius, const Vector& axis) : PrimitiveCommon(mat, this), _c(center), _n(n), 
_r(radius), _partial(false), _minTheta(0.0), _maxTheta(2.0 * M_PI) {
+Disk::Disk(Material* mat, const Point& center, const Vector& n, Real radius, 
const Vector& axis) : PrimitiveCommon(mat, this), _c(center), _n(n), 
_r(radius), _partial(false), _minTheta(0.0), _maxTheta(2.0 * M_PI) {
   _n.normalize();
   _d = -Dot(_n, _c);
   setupAxes(axis);
 }
 
-Disk::Disk(Material* mat, const Point& center, const Vector& n, double 
radius, const Vector& axis, double minTheta, double maxTheta) : 
PrimitiveCommon(mat, this), _c(center), _n(n), _r(radius), _partial(true), 
_minTheta(minTheta), _maxTheta(maxTheta) {
+Disk::Disk(Material* mat, const Point& center, const Vector& n, Real radius, 
const Vector& axis, Real minTheta, Real maxTheta) : PrimitiveCommon(mat, 
this), _c(center), _n(n), _r(radius), _partial(true), _minTheta(minTheta), 
_maxTheta(maxTheta) {
   _n.normalize();
   _d = -Dot(_n, _c);
   setupAxes(axis);
@@ -20,20 +20,22 @@
 Disk::~Disk() {
 }
 
-void Disk::computeBounds(const PreprocessContext& context, BBox& bbox) const 
{
+void Disk::computeBounds(const PreprocessContext& /*context*/,
+                         BBox& bbox) const
+{
   bbox.extendByDisc(_c, _n, _r);
 }
 
-void Disk::intersect(const RenderContext& context, RayPacket& rays) const {
+void Disk::intersect(const RenderContext& /*context*/, RayPacket& rays) 
const {
   int i, numRays(rays.getSize());
-  const static double EPSILON(1.0e-6);
+  static const Real EPSILON(1.0e-6);
   Point rayO;
   Vector rayD;
-  double denom, t;
+  Real denom, t;
 
   if (rays.getFlags() & RayPacket::ConstantOrigin) {
     rayO = rays.get(0).ray.origin();
-    double nDotO(Dot(_n, rayO));
+    Real nDotO(Dot(_n, rayO));
 
     for (i = 0; i < numRays; i++) {
       RayPacket::Element& e(rays.get(i));
@@ -41,10 +43,10 @@
       denom = Dot(_n, rayD);
 
       if ((denom < -EPSILON) || (denom > EPSILON)) {
-       t = -(_d + nDotO) / denom;
-       if (checkBounds(rayO + t * rayD)) {
-         e.hitInfo.hit(t, material, this, tex);
-       }
+        t = -(_d + nDotO) / denom;
+        if (checkBounds(rayO + t * rayD)) {
+          e.hitInfo.hit(t, material, this, tex);
+        }
       }
     }
   } else {
@@ -55,17 +57,18 @@
       denom = Dot(_n, rayD);
 
       if ((denom < -EPSILON) || (denom > EPSILON)) {
-       t = -(_d + Dot(_n, rayO)) / denom;
-       if (checkBounds(rayO + t * rayD)) {
-         e.hitInfo.hit(t, material, this, tex);
-       }
+        t = -(_d + Dot(_n, rayO)) / denom;
+        if (checkBounds(rayO + t * rayD)) {
+          e.hitInfo.hit(t, material, this, tex);
+        }
       }
     }
   }
 }
 
 
-void Disk::computeNormal(const RenderContext& context, RayPacket& rays) 
const {
+void Disk::computeNormal(const RenderContext& /*context*/,
+                         RayPacket& rays) const {
   int i, numRays(rays.getSize());
   
   for (i = 0; i < numRays; i++) {
@@ -77,7 +80,8 @@
   rays.setFlag(RayPacket::HaveNormals & RayPacket::HaveUnitNormals);
 }
 
-void Disk::computeTexCoords2(const RenderContext& context, RayPacket& rays) 
const {
+void Disk::computeTexCoords2(const RenderContext& /*context*/,
+                             RayPacket& rays) const {
   int i, numRays(rays.getSize());
   Point p;
 
@@ -97,7 +101,8 @@
   rays.setFlag(RayPacket::HaveTexture2);
 }
 
-void Disk::computeTexCoords3(const RenderContext& context, RayPacket& rays) 
const {
+void Disk::computeTexCoords3(const RenderContext& /*context*/,
+                             RayPacket& rays) const {
   int i, numRays(rays.getSize());
   Point p;
 
@@ -124,16 +129,16 @@
  **/
 bool Disk::checkBounds(const Point& p) const {
   Vector dir(p - _c);
-  double dist(dir.normalize());
+  Real dist(dir.normalize());
 
   if (dist > _r)
     return false;
 
   if (_partial) {
-    double theta(atan2(Dot(_v, dir), Dot(_u, dir)));
+    Real theta(atan2(Dot(_v, dir), Dot(_u, dir)));
 
-    if (theta < 0.0)
-      theta = 2.0 * M_PI + theta;
+    if (theta < 0)
+      theta = 2 * (Real)M_PI + theta;
     if ((theta < _minTheta) || (theta > _maxTheta))
       return false;
   }
@@ -151,7 +156,7 @@
  * given vector.
  **/
 void Disk::setupAxes(const Vector& axis) {
-  const static double EPSILON(1.0e-6);
+  static const Real EPSILON(1.0e-6);
 
   _u = axis;
   _u.normalize();
@@ -176,13 +181,13 @@
  **/
 void Disk::getTexCoords(Point& p) const {
   Vector dir(p - _c);
-  double dist(dir.normalize()), theta;
+  Real dist(dir.normalize()), theta;
 
   theta = atan2(Dot(_v, dir), Dot(_u, dir));
   if (theta < 0.0)
-    theta = 2.0 * M_PI + theta;
+    theta = 2 * (Real)M_PI + theta;
   
-  p = Point(dist / _r, (theta - _minTheta) / (_maxTheta - _minTheta), 0.0);
+  p = Point(dist / _r, (theta - _minTheta) / (_maxTheta - _minTheta), 0);
 }
 
 

Modified: branches/itanium2/Model/Primitives/Disk.h
==============================================================================
--- branches/itanium2/Model/Primitives/Disk.h   (original)
+++ branches/itanium2/Model/Primitives/Disk.h   Thu Oct 13 14:23:54 2005
@@ -9,8 +9,8 @@
 namespace Manta {
   class Disk : public PrimitiveCommon, public TexCoordMapper {
   public:
-    Disk(Material* mat, const Point& center, const Vector& n, double radius, 
const Vector& axis);
-    Disk(Material* mat, const Point& center, const Vector& n, double radius, 
const Vector& axis, double minTheta, double maxTheta);
+    Disk(Material* mat, const Point& center, const Vector& n, Real radius, 
const Vector& axis);
+    Disk(Material* mat, const Point& center, const Vector& n, Real radius, 
const Vector& axis, Real minTheta, Real maxTheta);
     virtual ~Disk();
     
     virtual void computeBounds(const PreprocessContext& context, BBox& bbox) 
const;
@@ -24,7 +24,7 @@
     bool _partial;
     Point _c;
     Vector _n, _u, _v;
-    double _d, _r, _minTheta, _maxTheta;
+    Real _d, _r, _minTheta, _maxTheta;
 
     bool checkBounds(const Point& p) const;
     void setupAxes(const Vector& axis);

Modified: branches/itanium2/Model/Primitives/HeavyTriangle.cc
==============================================================================
--- branches/itanium2/Model/Primitives/HeavyTriangle.cc (original)
+++ branches/itanium2/Model/Primitives/HeavyTriangle.cc Thu Oct 13 14:23:54 
2005
@@ -29,23 +29,23 @@
     RayPacket::Element& e = rays.get(i);
     const Vector& dir(e.ray.direction());
     Vector o(p1 - e.ray.origin());
-    
-    double det=Dot(n,dir);
-    if(det>1.e-9 || det < -1.e-9) {
-      double idet = 1./det;
+
+    Real det=Dot(n,dir);
+    if(det > (Real)1.e-9 || det < (Real)-1.e-9) {
+      Real idet = 1/det;
 
       Vector DX(Cross(dir, o));
-      double A=-Dot(DX, e2)*idet;
-      if(A>0.0 && A<1.0) {
-       double B=Dot(DX, e1)*idet;
-       if(B>0.0 && A+B<1.0) {
-         double t=Dot(n, o)*idet;
-         if (e.hitInfo.hit(t, material, this, tex)){
+      Real A=-Dot(DX, e2)*idet;
+      if( A>0 && A<1 ) {
+        Real B=Dot(DX, e1)*idet;
+        if( B>0 && A+B<1 ) {
+          Real t=Dot(n, o)*idet;
+          if (e.hitInfo.hit(t, material, this, tex)){
              TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
              th.a = A;
              th.b = B;
           }
-       }
+        }
       }
     }
   }

Modified: branches/itanium2/Model/Primitives/Heightfield.cc
==============================================================================
--- branches/itanium2/Model/Primitives/Heightfield.cc   (original)
+++ branches/itanium2/Model/Primitives/Heightfield.cc   Thu Oct 13 14:23:54 
2005
@@ -41,7 +41,7 @@
 // 
--------------------------------------------------------------------------------------
 // --- Constructor
 // 
--------------------------------------------------------------------------------------
-Heightfield::Heightfield(Material * material, char * fileName, const Point & 
minBound, const Point & maxBound, double scale)
+Heightfield::Heightfield(Material * material, char * fileName, const Point & 
minBound, const Point & maxBound, Real scale)
   : PrimitiveCommon(material), m_Box(minBound, maxBound)
 {
   readHeightfieldFile(fileName, &m_Nx, &m_Ny, &m_Data);
@@ -61,7 +61,8 @@
 // 
--------------------------------------------------------------------------------------
 // --- Get the Bounding Box
 // 
--------------------------------------------------------------------------------------
-void Heightfield::computeBounds(const PreprocessContext & context, BBox & 
bbox) const
+void Heightfield::computeBounds(const PreprocessContext& /*context*/,
+                                BBox & bbox) const
 {
   bbox.extendByPoint(m_Box.getMin());
   bbox.extendByPoint(m_Box.getMax());
@@ -71,13 +72,14 @@
 // 
--------------------------------------------------------------------------------------
 // --- Test whether the ray intersects the Heightfield or not
 // 
--------------------------------------------------------------------------------------
-void Heightfield::intersect(const RenderContext & context, RayPacket & rays) 
const
+void Heightfield::intersect(const RenderContext& /*context*/,
+                            RayPacket& rays) const
 {
   Vector diagonal;
   Point hitPoint;
   int hitLattice[2], stop[2], di[2], ind;
-  double tnext[2], dtd[2], far[2], zm[2], datam[2], cellSize[2];
-  double tnear, tfar, zenter, texit, zexit;
+  Real tnext[2], dtd[2], far[2], zm[2], datam[2], cellSize[2];
+  Real tnear, tfar, zenter, texit, zexit;
   bool validtcells[2];
 
   if (!(rays.getFlags() & RayPacket::NormalizedDirections))
@@ -111,8 +113,8 @@
       tnear = 0.0;
 
     diagonal = m_Box.diagonal();
-    cellSize[0] = diagonal.x() / (double)m_Nx;
-    cellSize[1] = diagonal.y() / (double)m_Ny;
+    cellSize[0] = diagonal.x() / (Real)m_Nx;
+    cellSize[1] = diagonal.y() / (Real)m_Ny;
 
     hitPoint = ray.origin() + (ray.direction() * tnear);
     hitLattice[0] = (int)((hitPoint.x() - m_Box.getMin().x()) / cellSize[0]);
@@ -131,15 +133,15 @@
     dtd[0] = fabs(cellSize[0] / ray.direction().x());
     dtd[1] = fabs(cellSize[1] / ray.direction().y());
 
-    if (di[0] == 1) far[0] = m_Box.getMin().x() + cellSize[0] * 
(double)(hitLattice[0] + 1);
-    else            far[0] = m_Box.getMin().x() + cellSize[0] * 
(double)(hitLattice[0]    );
-    if (di[1] == 1) far[1] = m_Box.getMin().y() + cellSize[1] * 
(double)(hitLattice[1] + 1);
-    else            far[1] = m_Box.getMin().y() + cellSize[1] * 
(double)(hitLattice[1]    );
+    if (di[0] == 1) far[0] = m_Box.getMin().x() + cellSize[0] * 
(Real)(hitLattice[0] + 1);
+    else            far[0] = m_Box.getMin().x() + cellSize[0] * 
(Real)(hitLattice[0]    );
+    if (di[1] == 1) far[1] = m_Box.getMin().y() + cellSize[1] * 
(Real)(hitLattice[1] + 1);
+    else            far[1] = m_Box.getMin().y() + cellSize[1] * 
(Real)(hitLattice[1]    );
 
     tnext[0] = (far[0] - ray.origin().x()) / ray.direction().x();
     tnext[1] = (far[1] - ray.origin().y()) / ray.direction().y();
 
-    while(true)
+    for(;;)
     {
       zenter = ray.origin().z() + (tnear * ray.direction().z());
       texit  = Min(tnext[0], tnext[1]);
@@ -154,14 +156,14 @@
 
       if (!(zm[0] > datam[1] || zm[1] < datam[0]))
       {
-        double a, b, c;
-        double sx, dx, sy, dy;
+        Real a, b, c;
+        Real sx, dx, sy, dy;
         Point pe;
-        double ce[2], z[4];
+        Real ce[2], z[4];
 
         pe = ray.origin() + ray.direction() * tnear;
-        ce[0] = pe.x() - (m_Box.getMin().x() + cellSize[0] * 
(double)(hitLattice[0]));
-        ce[1] = pe.y() - (m_Box.getMin().y() + cellSize[1] * 
(double)(hitLattice[1]));
+        ce[0] = pe.x() - (m_Box.getMin().x() + cellSize[0] * 
(Real)(hitLattice[0]));
+        ce[1] = pe.y() - (m_Box.getMin().y() + cellSize[1] * 
(Real)(hitLattice[1]));
 
         sx = ce[0] / cellSize[0];
         sy = ce[1] / cellSize[1];
@@ -179,7 +181,7 @@
 
         if (a == 0.0)
         {
-          double tcell, u, v;
+          Real tcell, u, v;
 
           tcell = -c / b;
           u = sx + tcell * dx;
@@ -194,13 +196,13 @@
         }
         else
         {
-          double delta = b*b - 4.0*a*c;
+          Real delta = b*b - 4*a*c;
           if (delta >= 0.0)
           {
-            double tcells[2], a2, u, v, tcell;
+            Real tcells[2], a2, u, v, tcell;
 
             delta = sqrt(delta);
-            a2 = 2.0 * a;
+            a2 = 2 * a;
 
             tcells[0] = (-b - delta) / a2;
             tcells[1] = (-b + delta) / a2;
@@ -243,7 +245,8 @@
 // 
--------------------------------------------------------------------------------------
 // --- Set the normals
 // 
--------------------------------------------------------------------------------------
-void Heightfield::computeNormal(const RenderContext & context, RayPacket & 
rays) const
+void Heightfield::computeNormal(const RenderContext& /*context*/,
+                                RayPacket& rays) const
 {
   int i, numRays(rays.getSize());
   
@@ -263,13 +266,13 @@
 // --- Rescale the height of the data to fit the Box
 // --- according to the given percentage of the size of the box to which the 
data should be rescaled
 // 
--------------------------------------------------------------------------------------
-void Heightfield::rescaleDataHeight(double scale)
+void Heightfield::rescaleDataHeight(Real scale)
 {
   using SCIRun::Min;
   using SCIRun::Max;
 
   unsigned int i, j;
-  double min, max, factor, margin;
+  Real min, max, factor, margin;
 
   min = m_Data[0][0];
   max = min;
@@ -281,7 +284,7 @@
     }
 
   factor = m_Box.getMax().z() - m_Box.getMin().z();
-  margin = factor * (1.0 - scale) * 0.5;
+  margin = factor * (1 - scale) * (Real)0.5;
   factor *= scale / (max - min);
 
   for(i=0; i<=m_Nx; i++)
@@ -293,9 +296,9 @@
 // 
--------------------------------------------------------------------------------------
 // --- Read the given file and returns nx, ny and the data
 // 
--------------------------------------------------------------------------------------
-void Heightfield::readHeightfieldFile(char * fileName, unsigned int * pnx, 
unsigned int * pny, double *** pdata)
+void Heightfield::readHeightfieldFile(char * fileName, unsigned int * pnx, 
unsigned int * pny, Real *** pdata)
 {
-  double minz, maxz;
+  Real minz, maxz;
   int nx, ny, i, j;
   float ** data;
 
@@ -324,10 +327,10 @@
 
   *pnx = nx;
   *pny = ny;
-  ALLOCATE2DARRAY(*pdata, nx+1, ny+1, double);
+  ALLOCATE2DARRAY(*pdata, nx+1, ny+1, Real);
   for(i=0; i<=nx; i++)
     for(j=0; j<=ny; j++)
-      (*pdata)[i][j] = (double)data[i][j];
+      (*pdata)[i][j] = (Real)data[i][j];
 
   //  DELETE2DARRAY(data, nx+1);
 }

Modified: branches/itanium2/Model/Primitives/Heightfield.h
==============================================================================
--- branches/itanium2/Model/Primitives/Heightfield.h    (original)
+++ branches/itanium2/Model/Primitives/Heightfield.h    Thu Oct 13 14:23:54 
2005
@@ -14,21 +14,21 @@
 
     public:
 
-                   Heightfield(Material * material, char * fileName, const 
Point & minBound, const Point & maxBound, double scale = 0.95);
+                   Heightfield(Material * material, char * fileName, const 
Point & minBound, const Point & maxBound, Real scale = 0.95);
       virtual      ~Heightfield();
 
       virtual void computeBounds(const PreprocessContext & context, BBox & 
bbox) const;
       virtual void intersect(const RenderContext & context, RayPacket & 
rays) const;
       virtual void computeNormal(const RenderContext & context, RayPacket & 
rays) const;
-      virtual void rescaleDataHeight(double scale);
-      virtual void readHeightfieldFile(char * fileName, unsigned int * pnx, 
unsigned int * pny, double *** pdata);
+      virtual void rescaleDataHeight(Real scale);
+      virtual void readHeightfieldFile(char * fileName, unsigned int * pnx, 
unsigned int * pny, Real *** pdata);
 
     private:
 
       BBox         m_Box;
       unsigned int m_Nx;
       unsigned int m_Ny;
-      double **    m_Data;
+      Real **    m_Data;
   };
 }
 

Modified: branches/itanium2/Model/Primitives/Hemisphere.cc
==============================================================================
--- branches/itanium2/Model/Primitives/Hemisphere.cc    (original)
+++ branches/itanium2/Model/Primitives/Hemisphere.cc    Thu Oct 13 14:23:54 
2005
@@ -9,7 +9,7 @@
 using namespace Manta;
 using namespace std;
 
-Hemisphere::Hemisphere(Material* material, const Point& center, double 
radius, const Vector& normal)
+Hemisphere::Hemisphere(Material* material, const Point& center, Real radius, 
const Vector& normal)
   : PrimitiveCommon(material, this), _c(center), _r(radius), _n(normal) {
   setupAxes();
 }
@@ -24,7 +24,7 @@
 void Hemisphere::intersect(const RenderContext&, RayPacket& rays) const {
   int i, numRays(rays.getSize()),
     rpFlags(rays.getFlags() & (RayPacket::ConstantOrigin | 
RayPacket::NormalizedDirections));
-  double a, b, c, disc, r, t;
+  Real a, b, c, disc, r, t;
   Point rayO;
   Vector rayD, tRayO;
 
@@ -139,7 +139,8 @@
   }
 }
 
-void Hemisphere::computeNormal(const RenderContext& context, RayPacket& 
rays) const {
+void Hemisphere::computeNormal(const RenderContext& /*context*/,
+                               RayPacket& rays) const {
   int i, numRays(rays.getSize());
 
   if (!(rays.getFlags() & RayPacket::HaveHitPositions))
@@ -157,7 +158,7 @@
 void Hemisphere::computeTexCoords2(const RenderContext& context, RayPacket& 
rays) const {
   int i, numRays(rays.getSize());
   Vector n;
-  double theta, phi;
+  Real theta, phi;
 
   if (!(rays.getFlags() & RayPacket::HaveUnitNormals))
     computeNormal(context, rays);
@@ -199,12 +200,12 @@
 }
 
 void Hemisphere::setupAxes() {
-  const static double EPSILON(1.0e-6);
+  static const Real EPSILON(1.0e-6);
 
-  _u = Vector(1.0, 0.0, 0.0);
+  _u = Vector(1, 0, 0);
   _v = Cross(_n, _u);
   if (_v.length2() < EPSILON) {
-    _u = Vector(0.0, 1.0, 0.0);
+    _u = Vector(0, 1, 0);
     _v = Cross(_n, _u);
   }
   _v.normalize();

Modified: branches/itanium2/Model/Primitives/Hemisphere.h
==============================================================================
--- branches/itanium2/Model/Primitives/Hemisphere.h     (original)
+++ branches/itanium2/Model/Primitives/Hemisphere.h     Thu Oct 13 14:23:54 
2005
@@ -8,7 +8,7 @@
 namespace Manta {
   class Hemisphere : public PrimitiveCommon, public TexCoordMapper {
   public:
-    Hemisphere(Material* material, const Point& center, double radius, const 
Vector& normal);
+    Hemisphere(Material* material, const Point& center, Real radius, const 
Vector& normal);
     virtual ~Hemisphere();
 
     virtual void computeBounds(const PreprocessContext& context, BBox& bbox) 
const;
@@ -20,7 +20,7 @@
 
   private:
     Point _c;
-    double _r;
+    Real _r;
     Vector _n, _u, _v;
 
     bool checkBounds(const Point& p) const;

Modified: branches/itanium2/Model/Primitives/PrimitiveCommon.cc
==============================================================================
--- branches/itanium2/Model/Primitives/PrimitiveCommon.cc       (original)
+++ branches/itanium2/Model/Primitives/PrimitiveCommon.cc       Thu Oct 13 
14:23:54 2005
@@ -5,7 +5,7 @@
 
 using namespace Manta;
 
-UniformMapper default_map;
+static UniformMapper default_map;
 
 PrimitiveCommon::PrimitiveCommon(Material* material,
                                 const TexCoordMapper* in_tex)

Modified: branches/itanium2/Model/Primitives/Sphere.cc
==============================================================================
--- branches/itanium2/Model/Primitives/Sphere.cc        (original)
+++ branches/itanium2/Model/Primitives/Sphere.cc        Thu Oct 13 14:23:54 
2005
@@ -3,15 +3,16 @@
 #include <Interface/RayPacket.h>
 #include <Core/Geometry/BBox.h>
 #include <Core/Math/MiscMath.h>
+#include <Core/Math/Trig.h>
 
 using namespace Manta;
 using namespace std;
 using SCIRun::Clamp;
 
-Sphere::Sphere(Material* material, const Point& center, double radius)
+Sphere::Sphere(Material* material, const Point& center, Real radius)
 : PrimitiveCommon(material, this), center(center), radius(radius)
 {
-  inv_radius = 1./radius;
+  inv_radius = 1/radius;
 }
 
 Sphere::~Sphere()
@@ -30,24 +31,24 @@
   for(int i = 0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
     Vector OC=center-e.ray.origin();
-    double tca=Dot(OC, e.ray.direction());
-    double l2oc=OC.length2();
-    double rad2=radius*radius;
+    Real tca=Dot(OC, e.ray.direction());
+    Real l2oc=OC.length2();
+    Real rad2=radius*radius;
     if(l2oc <= rad2){
       // Inside the sphere
-      double t2hc=rad2-l2oc+tca*tca;
-      double thc=sqrt(t2hc);
-      double t=tca+thc;
+      Real t2hc=rad2-l2oc+tca*tca;
+      Real thc=Sqrt(t2hc);
+      Real t=tca+thc;
       e.hitInfo.hit(t, material, this, tex);
     } else {
-      if(tca < 0.0){
+      if(tca < 0){
                                // Behind ray, no intersections...
       } else {
-                               double t2hc=rad2-l2oc+tca*tca;
-                               if(t2hc <= 0.0){
+                         Real t2hc=rad2-l2oc+tca*tca;
+                               if(t2hc <= 0){
                                        // Ray misses, no intersections
                                } else {
-                                       double thc=sqrt(t2hc);
+                                       Real thc=Sqrt(t2hc);
                                        e.hitInfo.hit(tca-thc, material, 
this, tex);
                                        e.hitInfo.hit(tca+thc, material, 
this, tex);
                                }
@@ -62,19 +63,19 @@
       // Rays of constant origin and normalized directions
       RayPacket::Element& e0 = rays.get(0);
       Vector O(e0.ray.origin()-center);
-      double C = Dot(O, O) - radius*radius;
+      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());
-                               double B = Dot(O, D);
-                               double disc = B*B-C;
+                               Real B = Dot(O, D);
+                               Real disc = B*B-C;
                                if(disc >= 0){
-                                       double r = sqrt(disc);
-                                       double t0 = -(r+B);
+                                       Real r = Sqrt(disc);
+                                       Real t0 = -(r+B);
                                        if(t0 > 0){
                                                e.hitInfo.hit(t0, material, 
this, tex);
                                        } else {
-                                               double t1 = r-B;
+                                               Real t1 = r-B;
                                                e.hitInfo.hit(t1, material, 
this, tex);
                                        }
                                }
@@ -86,20 +87,20 @@
       // Rays of constant origin for not normalized directions
       RayPacket::Element& e0 = rays.get(0);
       Vector O(e0.ray.origin()-center);
-      double C = Dot(O, O) - radius*radius;
+      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());
-                               double A = Dot(D, D);
-                               double B = Dot(O, D);
-                               double disc = B*B-A*C;
+                               Real A = Dot(D, D);
+                               Real B = Dot(O, D);
+                               Real disc = B*B-A*C;
                                if(disc >= 0){
-                                       double r = sqrt(disc);
-                                       double t0 = -(r+B)/A;
+                                       Real r = Sqrt(disc);
+                                       Real t0 = -(r+B)/A;
                                        if(t0 > 0){
                                                e.hitInfo.hit(t0, material, 
this, tex);
                                        } else {
-                                               double t1 = (r-B)/A;
+                                               Real t1 = (r-B)/A;
                                                e.hitInfo.hit(t1, material, 
this, tex);
                                        }
                                }
@@ -113,16 +114,16 @@
                                RayPacket::Element& e = rays.get(i);
                                Vector O(e.ray.origin()-center);
                                const Vector& D(e.ray.direction());
-                               double B = Dot(O, D);
-                               double C = Dot(O, O) - radius*radius;
-                               double disc = B*B-C;
+                               Real B = Dot(O, D);
+                               Real C = Dot(O, O) - radius*radius;
+                               Real disc = B*B-C;
                                if(disc >= 0){
-                                       double r = sqrt(disc);
-                                       double t0 = -(r+B);
+                                       Real r = Sqrt(disc);
+                                       Real t0 = -(r+B);
                                        if(t0 > 0){
                                                e.hitInfo.hit(t0, material, 
this, tex);
                                        } else {
-                                               double t1 = r-B;
+                                               Real t1 = r-B;
                                                e.hitInfo.hit(t1, material, 
this, tex);
                                        }
                                }
@@ -136,17 +137,17 @@
                                RayPacket::Element& e = rays.get(i);
                                Vector O(e.ray.origin()-center);
                                const Vector& D(e.ray.direction());
-                               double A = Dot(D, D);
-                               double B = Dot(O, D);
-                               double C = Dot(O, O) - radius*radius;
-                               double disc = B*B-A*C;
+                               Real A = Dot(D, D);
+                               Real B = Dot(O, D);
+                               Real C = Dot(O, O) - radius*radius;
+                               Real disc = B*B-A*C;
                                if(disc >= 0){
-                                       double r = sqrt(disc);
-                                       double t0 = -(r+B)/A;
+                                       Real r = Sqrt(disc);
+                                       Real t0 = -(r+B)/A;
                                        if(t0 > 0){
                                                e.hitInfo.hit(t0, material, 
this, tex);
                                        } else {
-                                               double t1 = (r-B)/A;
+                                               Real t1 = (r-B)/A;
                                                e.hitInfo.hit(t1, material, 
this, tex);
                                        }
                                }
@@ -174,9 +175,9 @@
   for(int i = 0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
     Vector n = (e.hitPosition-center)*inv_radius;
-    double angle = Clamp(n.z(), -1.0, 1.0);
-    double theta = acos(angle);
-    double phi = atan2(n.x(), n.y());
+    Real angle = Clamp(n.z(), (Real)-1, (Real)1);
+    Real theta = Acos(angle);
+    Real phi = Atan2(n.x(), n.y());
     e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), 0);
   }
   rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
@@ -189,9 +190,9 @@
   for(int i = 0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
     Vector n = (e.hitPosition-center)*inv_radius;
-    double angle = Clamp(n.z(), -1.0, 1.0);
-    double theta = acos(angle);
-    double phi = atan2(n.x(), n.y());
+    Real angle = Clamp(n.z(), (Real)-1, (Real)1);
+    Real theta = Acos(angle);
+    Real phi = Atan2(n.x(), n.y());
     e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), 0);
   }
   rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);

Modified: branches/itanium2/Model/Primitives/Sphere.h
==============================================================================
--- branches/itanium2/Model/Primitives/Sphere.h (original)
+++ branches/itanium2/Model/Primitives/Sphere.h Thu Oct 13 14:23:54 2005
@@ -9,7 +9,7 @@
 namespace Manta {
   class Sphere : public PrimitiveCommon, public TexCoordMapper {
   public:
-    Sphere(Material* material, const Point& center, double radius);
+    Sphere(Material* material, const Point& center, Real radius);
     virtual ~Sphere();
 
     virtual void computeBounds(const PreprocessContext& context,
@@ -22,8 +22,8 @@
                                   RayPacket& rays) const;
   private:
     Point center;
-    double radius;
-    double inv_radius;
+    Real radius;
+    Real inv_radius;
   };
 }
 

Modified: branches/itanium2/Model/Primitives/SuperEllipsoid.cc
==============================================================================
--- branches/itanium2/Model/Primitives/SuperEllipsoid.cc        (original)
+++ branches/itanium2/Model/Primitives/SuperEllipsoid.cc        Thu Oct 13 
14:23:54 2005
@@ -3,28 +3,29 @@
 #include <Core/Geometry/BBox.h>
 #include <Core/Math/MinMax.h>
 #include <Core/Math/MiscMath.h>
+#include <Core/Math/Trig.h>
 
 using namespace Manta;
 using namespace std;
 using SCIRun::Clamp;
 
-#define GOLDENMEAN 0.61803398874989484820
-#define BRACKETWIDTH 1.e-6
+#define GOLDENMEAN (Real)0.61803398874989484820
+#define BRACKETWIDTH (Real)1.e-6
 #define MAXNEWTONITER 25
 
 SuperEllipsoid::SuperEllipsoid(
   Material *material,
   Point const &center,
-  double radius,
-  double alpha,
-  double beta )
+  Real radius,
+  Real alpha,
+  Real beta )
   : PrimitiveCommon( material, this ),
     center( center ),
     radius( radius )
 {
-  inv_radius = 1. / radius;
-  two_over_alpha = 2. / alpha;
-  two_over_beta = 2. / beta;
+  inv_radius = 1 / radius;
+  two_over_alpha = 2 / alpha;
+  two_over_beta = 2 / beta;
   alpha_over_beta = alpha / beta;
 }
 
@@ -32,41 +33,42 @@
 {
 }
 
-inline double SuperEllipsoid::functionValue(
+inline Real SuperEllipsoid::functionValue(
   Vector const &location ) const
 {
-  double x_power = pow( fabs( location.x() ), two_over_alpha );
-  double y_power = pow( fabs( location.y() ), two_over_alpha );
-  double z_power = pow( fabs( location.z() ), two_over_beta );
-  return pow( x_power + y_power, alpha_over_beta ) + z_power - 1.;
+  Real x_power = pow( fabs( location.x() ), two_over_alpha );
+  Real y_power = pow( fabs( location.y() ), two_over_alpha );
+  Real z_power = pow( fabs( location.z() ), two_over_beta );
+  return pow( x_power + y_power, alpha_over_beta ) + z_power - 1;
 }
 
-inline Vector const SuperEllipsoid::functionGradient(
+inline Vector SuperEllipsoid::functionGradient(
   Vector const &location,
-  double &value ) const
+  Real &value ) const
 {
-  double x_power = pow( fabs(location.x() ), two_over_alpha );
-  double y_power = pow( fabs(location.y() ), two_over_alpha );
-  double z_power = pow( fabs(location.z() ), two_over_beta );
-  double x_and_y_power = pow( x_power + y_power, alpha_over_beta - 1. );
-  value = x_and_y_power * ( x_power + y_power ) + z_power - 1.;
+  Real x_power = pow( fabs(location.x() ), two_over_alpha );
+  Real y_power = pow( fabs(location.y() ), two_over_alpha );
+  Real z_power = pow( fabs(location.z() ), two_over_beta );
+  Real x_and_y_power = pow( x_power + y_power, alpha_over_beta - 1 );
+  value = x_and_y_power * ( x_power + y_power ) + z_power - 1;
   return Vector( two_over_beta * x_and_y_power * x_power / location.x(),
                  two_over_beta * x_and_y_power * y_power / location.y(),
                  two_over_beta * z_power / location.z() );
 }
 
-inline Vector const SuperEllipsoid::logarithmFunctionGradient(
+inline Vector SuperEllipsoid::logarithmFunctionGradient(
   Vector const &location,
-  double &value ) const
+  Real &value ) const
 {
-  double x_power = pow( fabs(location.x() ), two_over_alpha );
-  double y_power = pow( fabs(location.y() ), two_over_alpha );
-  double z_power = pow( fabs(location.z() ), two_over_beta );
-  double x_and_y_power = pow( x_power + y_power, 1. - alpha_over_beta ) * 
z_power + x_power + y_power;
+  Real x_power = pow( fabs(location.x() ), two_over_alpha );
+  Real y_power = pow( fabs(location.y() ), two_over_alpha );
+  Real z_power = pow( fabs(location.z() ), two_over_beta );
+  Real x_and_y_power = (pow( x_power + y_power, 1 - alpha_over_beta )
+                        * z_power + x_power + y_power);
   value = log( pow( x_power + y_power, alpha_over_beta ) + z_power );
   return Vector( two_over_beta * x_power / ( location.x() * x_and_y_power ),
                  two_over_beta * y_power / ( location.y() * x_and_y_power ),
-                 two_over_beta / ( location.z() * ( 1. + pow( x_power + 
y_power, alpha_over_beta ) / z_power ) ) );
+                 two_over_beta / ( location.z() * ( 1 + pow( x_power + 
y_power, alpha_over_beta ) / z_power ) ) );
 }
 
 void SuperEllipsoid::computeBounds(
@@ -89,11 +91,11 @@
     // First check if the ray hits the bounding box and whether it could
     // remotely produce a hit of interest.
     // TODO: Maybe factor this out into a common routine?
-    double tnear, tfar, t1, t2;
+    Real tnear, tfar, t1, t2;
     t1 = ( -radius - offset_center.x() ) * e.inverseDirection.x();
     t2 = ( radius - offset_center.x() ) * e.inverseDirection.x();
     if( t1 > t2 ) {
-      double temp = t1;
+      Real temp = t1;
       t1 = t2;
       t2 = temp;
     }
@@ -102,7 +104,7 @@
     t1 = ( -radius - offset_center.y() ) * e.inverseDirection.y();
     t2 = ( radius - offset_center.y() ) * e.inverseDirection.y();
     if( t1 > t2 ) {
-      double temp = t1;
+      Real temp = t1;
       t1 = t2;
       t2 = temp;
     }
@@ -113,54 +115,54 @@
     t1 = ( -radius - offset_center.z() ) * e.inverseDirection.z();
     t2 = ( radius - offset_center.z() ) * e.inverseDirection.z();
     if( t1 > t2 ) {
-      double temp = t1;
+      Real temp = t1;
       t1 = t2;
       t2 = temp;
     }
-    tnear = Max( Max( t1, tnear ), T_EPSILON );
+    tnear = Max( Max( t1, tnear ), (Real)T_EPSILON );
     tfar = Min( Min( t2, tfar ), e.hitInfo.minT() );
 
-    if ( tfar < T_EPSILON || tnear >= e.hitInfo.minT() )
+    if ( tfar < (Real)T_EPSILON || tnear >= e.hitInfo.minT() )
       continue;
 
     // A few preliminary early exit tests...
-    double near_value, far_value;
-    double near_deriv = Dot( functionGradient(
+    Real near_value, far_value;
+    Real near_deriv = Dot( functionGradient(
                                  ( offset_center + tnear * e.ray.direction() 
) * inv_radius,
                                  near_value ),
                              e.ray.direction() );
-    double far_deriv = Dot( functionGradient(
+    Real far_deriv = Dot( functionGradient(
                                 ( offset_center + tfar * e.ray.direction() ) 
* inv_radius,
                                 far_value ),
                             e.ray.direction() );
-    if ( ( near_value < T_EPSILON && far_value < T_EPSILON ) ||
-         ( near_value * far_value > 0. && near_deriv * far_deriv > 0. ) )
+    if ( ( near_value < (Real)T_EPSILON && far_value < (Real)T_EPSILON ) ||
+         ( near_value * far_value > 0 && near_deriv * far_deriv > 0 ) )
       continue;
 
     // Try to find the minimum of the super ellipsoid function using the
     // Golden Section Search.  We'll use this to bracket the root.
     if ( near_deriv * far_deriv <= 0 ) {
-      double a_bracket = tnear;
-      double b_bracket = tfar;
-      double left = GOLDENMEAN * a_bracket + ( 1. - GOLDENMEAN ) * b_bracket;
-      double left_value = functionValue(
+      Real a_bracket = tnear;
+      Real b_bracket = tfar;
+      Real left = GOLDENMEAN * a_bracket + ( 1 - GOLDENMEAN ) * b_bracket;
+      Real left_value = functionValue(
         ( offset_center + left * e.ray.direction() ) * inv_radius );
-      double right = ( 1. - GOLDENMEAN ) * a_bracket + GOLDENMEAN * 
b_bracket;
-      double right_value = functionValue(
+      Real right = ( 1 - GOLDENMEAN ) * a_bracket + GOLDENMEAN * b_bracket;
+      Real right_value = functionValue(
         ( offset_center + right * e.ray.direction() ) * inv_radius );
       while( fabs( b_bracket - a_bracket ) > BRACKETWIDTH ) {
         if ( left_value < right_value ) {
           b_bracket = right;
           right = left;
           right_value = left_value;
-          left = GOLDENMEAN * a_bracket + ( 1. - GOLDENMEAN ) * b_bracket;
+          left = GOLDENMEAN * a_bracket + ( 1 - GOLDENMEAN ) * b_bracket;
           left_value = functionValue(
             ( offset_center + left * e.ray.direction() ) * inv_radius );
         } else {
           a_bracket = left;
           left = right;
           left_value = right_value;
-          right = ( 1. - GOLDENMEAN ) * a_bracket + GOLDENMEAN * b_bracket;
+          right = ( 1 - GOLDENMEAN ) * a_bracket + GOLDENMEAN * b_bracket;
           right_value = functionValue(
             ( offset_center + right * e.ray.direction() ) * inv_radius );
         }
@@ -168,11 +170,11 @@
 
       // If our minimum is positive, we missed the superquadric - it
       // couldn't have crossed zero.
-      if ( right_value >= T_EPSILON )
+      if ( right_value >= (Real)T_EPSILON )
         continue;
 
       // Narrow the range with the location of the minimum found
-      if ( right_value * near_value < 0. ) {
+      if ( right_value * near_value < 0 ) {
         tfar = right;
         far_value = right_value;
       } else {
@@ -186,19 +188,19 @@
     // search on the logarithm of the super ellipsoid function to find the
     // root.  If Newton's method flies off, we just reset it with a
     // bisection step.
-    if ( near_value * far_value >= 0. )
+    if ( near_value * far_value >= 0 )
       continue;
-    double troot = ( tnear + tfar ) * 0.5;
-    double root_value;
-    double root_deriv = Dot( logarithmFunctionGradient(
+    Real troot = ( tnear + tfar ) * (Real)0.5;
+    Real root_value;
+    Real root_deriv = Dot( logarithmFunctionGradient(
                                  ( offset_center + troot * e.ray.direction() 
) * inv_radius,
                                  root_value ),
                              e.ray.direction() );
     int iterations = 0;
-    while ( fabs( tfar - tnear ) >= T_EPSILON &&
-            fabs( root_value ) >= T_EPSILON &&
+    while ( fabs( tfar - tnear ) >= (Real)T_EPSILON &&
+            fabs( root_value ) >= (Real)T_EPSILON &&
             ++iterations < MAXNEWTONITER ) {
-      if ( root_value * near_value < 0. ) {
+      if ( root_value * near_value < 0 ) {
         tfar = troot;
         far_value = root_value;
       } else {
@@ -207,7 +209,7 @@
       }
       troot = troot - root_value / root_deriv;
       if ( troot <= tnear || troot >= tfar )
-        troot = ( tnear + tfar ) * 0.5;
+        troot = ( tnear + tfar ) * (Real)0.5;
       root_deriv = Dot( logarithmFunctionGradient(
                             ( offset_center + troot * e.ray.direction() ) * 
inv_radius,
                             root_value ),
@@ -227,7 +229,7 @@
 {
   // FIXME: Calculate proper normal once intersection code works - sphere
   // normal close enough for now...
-  double ignored;
+  Real ignored;
   rays.computeHitPositions();
   for( int i = 0; i < rays.getSize(); i++ ) {
     RayPacket::Element &e( rays.get( i ) );
@@ -243,11 +245,11 @@
   for( int i = 0; i < rays.getSize(); i++ ) {
     RayPacket::Element &e( rays.get( i ) );
     Vector n = ( e.hitPosition - center ) * inv_radius;
-    double angle = Clamp( n.z(), -1.0, 1.0 );
-    double theta = acos( angle );
-    double phi = atan2( n.x(), n.y() );
-    e.texCoords = Point( ( phi + M_PI ) * ( 1. / ( 2 * M_PI ) ),
-                         theta * ( 1. / M_PI ),
+    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 * M_1_PI ),
+                         theta * (Real)M_1_PI,
                          0 );
   }
   rays.setFlag( RayPacket::HaveTexture2 | RayPacket::HaveTexture3 );
@@ -261,11 +263,11 @@
   for( int i = 0; i < rays.getSize(); i++ ) {
     RayPacket::Element &e = rays.get( i );
     Vector n = ( e.hitPosition - center ) * inv_radius;
-    double angle = Clamp( n.z(), -1.0, 1.0 );
-    double theta = acos( angle );
-    double phi = atan2( n.x(), n.y() );
-    e.texCoords = Point( ( phi + M_PI ) * ( 1. / ( 2 * M_PI ) ),
-                         theta * ( 1. / M_PI ),
+    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 * M_1_PI ),
+                         theta * (Real)M_1_PI,
                          0 );
   }
   rays.setFlag( RayPacket::HaveTexture2 | RayPacket::HaveTexture3 );

Modified: branches/itanium2/Model/Primitives/SuperEllipsoid.h
==============================================================================
--- branches/itanium2/Model/Primitives/SuperEllipsoid.h (original)
+++ branches/itanium2/Model/Primitives/SuperEllipsoid.h Thu Oct 13 14:23:54 
2005
@@ -9,7 +9,8 @@
 namespace Manta {
   class SuperEllipsoid : public PrimitiveCommon, public TexCoordMapper {
   public:
-    SuperEllipsoid(Material* material, const Point& center, double radius, 
double alpha, double beta);
+    SuperEllipsoid(Material* material, const Point& center, Real radius,
+                   Real alpha, Real beta);
     virtual ~SuperEllipsoid();
 
     virtual void computeBounds(const PreprocessContext& context,
@@ -21,15 +22,15 @@
     virtual void computeTexCoords3(const RenderContext& context,
                                    RayPacket& rays) const;
   private:
-    double functionValue(const Vector& location) const;
-    Vector const functionGradient(const Vector& location, double& value ) 
const;
-    Vector const logarithmFunctionGradient(const Vector& location, double& 
value ) const;
+    Real functionValue(const Vector& location) const;
+    inline Vector functionGradient(const Vector& location, Real& value ) 
const;
+    inline Vector logarithmFunctionGradient(const Vector& location, Real& 
value ) const;
     Point center;
-    double radius;
-    double inv_radius;
-    double two_over_alpha;
-    double two_over_beta;
-    double alpha_over_beta;
+    Real radius;
+    Real inv_radius;
+    Real two_over_alpha;
+    Real two_over_beta;
+    Real alpha_over_beta;
   };
 }
 

Modified: branches/itanium2/Model/Primitives/TexTriangle.cc
==============================================================================
--- branches/itanium2/Model/Primitives/TexTriangle.cc   (original)
+++ branches/itanium2/Model/Primitives/TexTriangle.cc   Thu Oct 13 14:23:54 
2005
@@ -44,7 +44,8 @@
 }
 
 //Performs the exact same operation as computeTexCoords3
-void TexTriangle::computeTexCoords2(const RenderContext& context, RayPacket& 
rays) const
+void TexTriangle::computeTexCoords2(const RenderContext& /*context*/,
+                                    RayPacket& rays) const
 {
   int nrays = rays.getSize();
   for(int i=0; i<nrays; i++) {
@@ -60,7 +61,8 @@
 }
 
 
-void TexTriangle::computeTexCoords3(const RenderContext& context, RayPacket& 
rays) const
+void TexTriangle::computeTexCoords3(const RenderContext& /*context*/,
+                                    RayPacket& rays) const
 {
   int nrays = rays.getSize();
   for(int i=0; i<nrays; i++) {

Modified: branches/itanium2/Model/Primitives/Triangle.cc
==============================================================================
--- branches/itanium2/Model/Primitives/Triangle.cc      (original)
+++ branches/itanium2/Model/Primitives/Triangle.cc      Thu Oct 13 14:23:54 
2005
@@ -35,37 +35,37 @@
 
   Vector _e1 = p2-p1;
   Vector _e2 = p3-p1;
-  Vector _n = Cross(_e1, _e2);
+  //  Vector _n = Cross(_e1, _e2);
 
   for(int i=0; i<rays.getSize(); i++) {
     RayPacket::Element& e = rays.get(i);
-    const Vector& dir(e.ray.direction());
     Vector o(p1 - e.ray.origin());

-       #if 0      
-    double det=Dot(_n,dir);
+
+#if 0
+    const Vector& dir(e.ray.direction());
+    Real det=Dot(_n,dir);
     if(det>1.e-9 || det < -1.e-9) {
-      double idet = 1./det;
+      Real idet = 1./det;
 
       Vector DX(Cross(dir, o));
-      double A =-Dot(DX, _e2)*idet;
+      Real A =-Dot(DX, _e2)*idet;
       if(A>0.0 && A<1.0) {
-       double B = Dot(DX, _e1)*idet;
-       if(B>0.0 && A+B<1.0) {
-         double t=Dot(_n, o)*idet;
-       #endif
-       
-               Real t, A, B;
-       
-               bool h = Intersection::intersectTriangleEdge( t, A, B, e.ray, 
_e1, _e2, p1 );
-       
-         if (h && e.hitInfo.hit(t, material, this, tex)){
-             TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
-             th.a = A;
-             th.b = B;
+        Real B = Dot(DX, _e1)*idet;
+        if(B>0.0 && A+B<1.0) {
+          Real t=Dot(_n, o)*idet;
+#endif
+
+          Real t, A, B;
+
+          bool h = Intersection::intersectTriangleEdge( t, A, B, e.ray, _e1, 
_e2, p1 );
+
+          if (h && e.hitInfo.hit(t, material, this, tex)){
+            TriangleHit& th = e.hitInfo.scratchpad<TriangleHit>();
+            th.a = A;
+            th.b = B;
           }
 #if 0
-       }
+        }
       }
     }
 #endif

Modified: branches/itanium2/Model/Primitives/Triangle.h
==============================================================================
--- branches/itanium2/Model/Primitives/Triangle.h       (original)
+++ branches/itanium2/Model/Primitives/Triangle.h       Thu Oct 13 14:23:54 
2005
@@ -11,7 +11,7 @@
   class Triangle : public PrimitiveCommon {
   public:
     struct TriangleHit{
-      double a,b;
+      Real a,b;
     };
 
                Triangle() {  };

Modified: branches/itanium2/Model/Readers/glm/glm.cc
==============================================================================
--- branches/itanium2/Model/Readers/glm/glm.cc  (original)
+++ branches/itanium2/Model/Readers/glm/glm.cc  Thu Oct 13 14:23:54 2005
@@ -106,10 +106,10 @@
   assert(n);
 
   /* normalize */
-  l = (float)sqrt(n[X] * n[X] + n[Y] * n[Y] + n[Z] * n[Z]);
-  n[0] /= l;
-  n[1] /= l;
-  n[2] /= l;
+  l = 1.0f/sqrtf(n[X] * n[X] + n[Y] * n[Y] + n[Z] * n[Z]);
+  n[0] *= l;
+  n[1] *= l;
+  n[2] *= l;
 }
 
 /* _glmEqual: compares two vectors and returns true if they are
@@ -139,7 +139,7 @@
  * epsilon    - maximum difference between vectors 
  *
  */
-float*
+static float*
 _glmWeldVectors(float* vectors, unsigned int* numvectors, float epsilon)
 {
   float* copies;
@@ -176,7 +176,7 @@
 
 /* _glmFindGroup: Find a group in the model
  */
-GLMgroup*
+static GLMgroup*
 _glmFindGroup(GLMmodel* model, char* name)
 {
   GLMgroup* group;
@@ -195,7 +195,7 @@
 
 /* _glmAddGroup: Add a group to the model
  */
-GLMgroup*
+static GLMgroup*
 _glmAddGroup(GLMmodel* model, char* name)
 {
   GLMgroup* group;
@@ -217,7 +217,7 @@
 
 /* _glmFindGroup: Find a material in the model
  */
-unsigned int
+static unsigned int
 _glmFindMaterial(GLMmodel* model, char* name)
 {
   unsigned int i;
@@ -862,12 +862,12 @@
   d = _glmAbs(maxz) + _glmAbs(minz);
 
   /* calculate center of the model */
-  cx = (maxx + minx) / 2.0;
-  cy = (maxy + miny) / 2.0;
-  cz = (maxz + minz) / 2.0;
+  cx = (maxx + minx) / 2.0f;
+  cy = (maxy + miny) / 2.0f;
+  cz = (maxz + minz) / 2.0f;
 
   /* calculate unitizing scale factor */
-  scale = 2.0 / _glmMax(_glmMax(w, h), d);
+  scale = 2.0f / _glmMax(_glmMax(w, h), d);
 
   /* translate around center then scale */
   for (i = 1; i <= model->numvertices; i++) {
@@ -1111,7 +1111,7 @@
   assert(model->facetnorms);
 
   /* calculate the cosine of the angle (in degrees) */
-  cos_angle = cos(angle * M_PI / 180.0);
+  cos_angle = cosf(angle * (float)M_PI / 180.0f);
 
   /* nuke any previous normals */
   if (model->normals)
@@ -1243,7 +1243,7 @@
   }
   free(normals);
 
-  printf("glmVertexNormals(): %d normals generated\n", model->numnormals);
+  printf("glmVertexNormals(): %u normals generated\n", model->numnormals);
 }
 
 
@@ -1269,15 +1269,15 @@
   model->texcoords=(float*)malloc(sizeof(float)*2*(model->numtexcoords+1));
   
   glmDimensions(model, dimensions);
-  scalefactor = 2.0 / 
+  scalefactor = 2.0f / 
     _glmAbs(_glmMax(_glmMax(dimensions[0], dimensions[1]), dimensions[2]));
 
   /* do the calculations */
   for(i = 1; i <= model->numvertices; i++) {
     x = model->vertices[3 * i + 0] * scalefactor;
     y = model->vertices[3 * i + 2] * scalefactor;
-    model->texcoords[2 * i + 0] = (x + 1.0) / 2.0;
-    model->texcoords[2 * i + 1] = (y + 1.0) / 2.0;
+    model->texcoords[2 * i + 0] = (x + 1.0f) / 2.0f;
+    model->texcoords[2 * i + 1] = (y + 1.0f) / 2.0f;
   }
   
   /* go through and put texture coordinate indices in all the triangles */
@@ -1328,33 +1328,33 @@
     z = model->normals[3 * i + 0];     /* re-arrange for pole distortion */
     y = model->normals[3 * i + 1];
     x = model->normals[3 * i + 2];
-    r = sqrt((x * x) + (y * y));
-    rho = sqrt((r * r) + (z * z));
+    r = sqrtf((x * x) + (y * y));
+    rho = sqrtf((r * r) + (z * z));
       
-    if(r == 0.0) {
-      theta = 0.0;
-      phi = 0.0;
+    if(r == 0.0f) {
+      theta = 0.0f;
+      phi = 0.0f;
     } else {
       if(z == 0.0)
-       phi = 3.14159265 / 2.0;
+        phi = 3.14159265f / 2.0f;
       else
-       phi = acos(z / rho);
+        phi = acosf(z / rho);
       
 #if WE_DONT_NEED_THIS_CODE
-      if(x == 0.0)
-       theta = 3.14159265 / 2.0;       /* asin(y / r); */
+      if(x == 0.0f)
+        theta = 3.14159265f / 2.0f;    /* asin(y / r); */
       else
-       theta = acos(x / r);
+        theta = acosf(x / r);
 #endif
       
-      if(y == 0.0)
-       theta = 3.141592365 / 2.0;      /* acos(x / r); */
+      if(y == 0.0f)
+        theta = 3.141592365f / 2.0f;   /* acos(x / r); */
       else
-       theta = asin(y / r) + (3.14159265 / 2.0);
+        theta = asinf(y / r) + (3.14159265f / 2.0f);
     }
     
-    model->texcoords[2 * i + 0] = theta / 3.14159265;
-    model->texcoords[2 * i + 1] = phi / 3.14159265;
+    model->texcoords[2 * i + 0] = theta / 3.14159265f;
+    model->texcoords[2 * i + 1] = phi / 3.14159265f;
   }
   
   /* go through and put texcoord indices in all the triangles */
@@ -1566,7 +1566,7 @@
 
   /* spit out the vertices */
   fprintf(file, "\n");
-  fprintf(file, "# %d vertices\n", model->numvertices);
+  fprintf(file, "# %u vertices\n", model->numvertices);
   for (i = 1; i <= model->numvertices; i++) {
     fprintf(file, "v %f %f %f\n", 
            model->vertices[3 * i + 0],
@@ -1618,7 +1618,7 @@
       fprintf(file, "usemtl %s\n", model->materials[group->material].name);
     for (i = 0; i < group->numtriangles; i++) {
       if (mode & GLM_SMOOTH && mode & GLM_TEXTURE) {
-       fprintf(file, "f %d/%d/%d %d/%d/%d %d/%d/%d\n",
+       fprintf(file, "f %u/%u/%u %u/%u/%u %u/%u/%u\n",
                T(group->triangles[i]).vindices[0], 
                T(group->triangles[i]).nindices[0], 
                T(group->triangles[i]).tindices[0],
@@ -1629,7 +1629,7 @@
                T(group->triangles[i]).nindices[2],
                T(group->triangles[i]).tindices[2]);
       } else if (mode & GLM_FLAT && mode & GLM_TEXTURE) {
-       fprintf(file, "f %d/%d %d/%d %d/%d\n",
+       fprintf(file, "f %u/%u %u/%u %u/%u\n",
                T(group->triangles[i]).vindices[0],
                T(group->triangles[i]).findex,
                T(group->triangles[i]).vindices[1],
@@ -1637,7 +1637,7 @@
                T(group->triangles[i]).vindices[2],
                T(group->triangles[i]).findex);
       } else if (mode & GLM_TEXTURE) {
-       fprintf(file, "f %d/%d %d/%d %d/%d\n",
+       fprintf(file, "f %u/%u %u/%u %u/%u\n",
                T(group->triangles[i]).vindices[0],
                T(group->triangles[i]).tindices[0],
                T(group->triangles[i]).vindices[1],
@@ -1645,7 +1645,7 @@
                T(group->triangles[i]).vindices[2],
                T(group->triangles[i]).tindices[2]);
       } else if (mode & GLM_SMOOTH) {
-       fprintf(file, "f %d//%d %d//%d %d//%d\n",
+       fprintf(file, "f %u//%u %u//%u %u//%u\n",
                T(group->triangles[i]).vindices[0],
                T(group->triangles[i]).nindices[0],
                T(group->triangles[i]).vindices[1],
@@ -1653,7 +1653,7 @@
                T(group->triangles[i]).vindices[2], 
                T(group->triangles[i]).nindices[2]);
       } else if (mode & GLM_FLAT) {
-       fprintf(file, "f %d//%d %d//%d %d//%d\n",
+       fprintf(file, "f %u//%u %u//%u %u//%u\n",
                T(group->triangles[i]).vindices[0], 
                T(group->triangles[i]).findex,
                T(group->triangles[i]).vindices[1],
@@ -1661,7 +1661,7 @@
                T(group->triangles[i]).vindices[2],
                T(group->triangles[i]).findex);
       } else {
-       fprintf(file, "f %d %d %d\n",
+       fprintf(file, "f %u %u %u\n",
                T(group->triangles[i]).vindices[0],
                T(group->triangles[i]).vindices[1],
                T(group->triangles[i]).vindices[2]);
@@ -1696,7 +1696,7 @@
   vectors    = model->vertices;
   copies = _glmWeldVectors(vectors, &numvectors, epsilon);
 
-  printf("glmWeld(): %d redundant vertices.\n", 
+  printf("glmWeld(): %u redundant vertices.\n", 
         model->numvertices - numvectors - 1);
 
   for (i = 0; i < model->numtriangles; i++) {
@@ -1870,4 +1870,4 @@
 }
 #endif
 
-};
+}

Modified: branches/itanium2/Model/TexCoordMappers/SphericalMapper.cc
==============================================================================
--- branches/itanium2/Model/TexCoordMappers/SphericalMapper.cc  (original)
+++ branches/itanium2/Model/TexCoordMappers/SphericalMapper.cc  Thu Oct 13 
14:23:54 2005
@@ -2,14 +2,15 @@
 #include <Model/TexCoordMappers/SphericalMapper.h>
 #include <Interface/RayPacket.h>
 #include <Core/Math/MiscMath.h>
+#include <Core/Math/Trig.h>
 
 using namespace Manta;
 using SCIRun::Clamp;
 
-SphericalMapper::SphericalMapper(const Point& center, double radius)
+SphericalMapper::SphericalMapper(const Point& center, Real radius)
   : center(center), radius(radius)
 {
-  inv_radius = 1./radius;
+  inv_radius = 1/radius;
 }
 
 SphericalMapper::~SphericalMapper()
@@ -23,11 +24,13 @@
   for(int i = 0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
     Vector n = e.hitPosition-center;
-    double w = n.normalize() * inv_radius;
-    double angle = Clamp(n.z(), -1.0, 1.0);
-    double theta = acos(angle);
-    double phi = atan2(n.x(), n.y());
-    e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), w);
+    Real w = n.normalize() * 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*M_1_PI),
+                        theta*(Real)M_1_PI,
+                        w);
   }
   rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
 }
@@ -39,11 +42,13 @@
   for(int i = 0;i<rays.getSize();i++){
     RayPacket::Element& e = rays.get(i);
     Vector n = e.hitPosition-center;
-    double w = n.normalize() * inv_radius;
-    double angle = Clamp(n.z(), -1.0, 1.0);
-    double theta = acos(angle);
-    double phi = atan2(n.x(), n.y());
-    e.texCoords = Point((phi+M_PI)*(1./(2*M_PI)), theta*(1./M_PI), w);
+    Real w = n.normalize() * 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*M_1_PI),
+                        theta*(Real)M_1_PI,
+                        w);
   }
   rays.setFlag(RayPacket::HaveTexture2|RayPacket::HaveTexture3);
 }

Modified: branches/itanium2/Model/TexCoordMappers/SphericalMapper.h
==============================================================================
--- branches/itanium2/Model/TexCoordMappers/SphericalMapper.h   (original)
+++ branches/itanium2/Model/TexCoordMappers/SphericalMapper.h   Thu Oct 13 
14:23:54 2005
@@ -9,7 +9,7 @@
 
   class SphericalMapper : public TexCoordMapper {
   public:
-    SphericalMapper(const Point& center, double radius);
+    SphericalMapper(const Point& center, Real radius);
     virtual ~SphericalMapper();
 
     virtual void computeTexCoords2(const RenderContext& context,
@@ -21,8 +21,8 @@
     SphericalMapper& operator=(const SphericalMapper&);
 
     Point center;
-    double radius;
-    double inv_radius;
+    Real radius;
+    Real inv_radius;
   };
 }
 

Modified: branches/itanium2/Readers/BART/parse.cc
==============================================================================
--- branches/itanium2/Readers/BART/parse.cc     (original)
+++ branches/itanium2/Readers/BART/parse.cc     Thu Oct 13 14:23:54 2005
@@ -53,11 +53,11 @@
 using namespace Manta;
 
 //global holders created when BARTReader.cc calls parsefile
-Scene *myScene;
-Group *myGroup;
-LightSet *myLights;
+static Scene *myScene;
+static Group *myGroup;
+static LightSet *myLights;
 
-Material *currentMaterial = new Flat(Color(RGB(0.5,0.5,0.5)));
+static Material *currentMaterial = new Flat(Color(RGB(0.5,0.5,0.5)));
 
 /*----------------------------------------------------------------------
   parseComment()
@@ -334,7 +334,7 @@
        }
        currentMaterial = new Phong(Color(RGB(dif[X],dif[Y],dif[Z])),
                                   Color(RGB(spc[X],spc[Y],spc[Z])), //assume 
white spec
-                                  int(4.0*phong_pow),
+                                  int(4*phong_pow),
                                   t);
        NOT_FINISHED("WARNING: Material ambient ignored" );
        NOT_FINISHED("WARNING: Material index of refraction ignored");
@@ -354,7 +354,7 @@
        }
        currentMaterial = new Phong(Color(RGB(kd*col[X],kd*col[Y],kd*col[Z])),
                                   Color(RGB(ks*1.0,ks*1.0,ks*1.0)), //assume 
white spec
-                                  int(4.0*phong_pow),
+                                  int(4*phong_pow),
                                   t);
        NOT_FINISHED("WARNING: Material index of refraction ignored");
     }
@@ -928,7 +928,6 @@
    PositionKey* PKeys;
    RotationKey* RKeys;
    Animation* animation=0;
-   struct AnimationList* animationlist;
 
    if(fscanf(fp,"%s",name)!=1)
    {
@@ -943,9 +942,10 @@
       exit(1);
    }
    
-   /* insert a new animation in the AnimationList */
-   animationlist= 
-      (struct AnimationList*) calloc(1, sizeof(struct AnimationList));
+//    struct AnimationList* animationlist;
+//    /* insert a new animation in the AnimationList */
+//    animationlist= 
+//       (struct AnimationList*) calloc(1, sizeof(struct AnimationList));
 
    /* put the newly allocated a list somewhere,
     * e.g., 

Modified: branches/itanium2/StandAlone/barrier_test.cc
==============================================================================
--- branches/itanium2/StandAlone/barrier_test.cc        (original)
+++ branches/itanium2/StandAlone/barrier_test.cc        Thu Oct 13 14:23:54 
2005
@@ -94,7 +94,7 @@
 
       std::cout << "np: " << params->np << " "
                << n_barriers << " in " << (end_time-start_time) << " 
seconds. " 
-               << (double)n_barriers/(end_time-start_time) << " barriers per 
second." << std::endl;
+               << n_barriers/(end_time-start_time) << " barriers per 
second." << std::endl;
 
       Thread::exitAll( 0 );
       exit(0);

Modified: branches/itanium2/StandAlone/manta.cc
==============================================================================
--- branches/itanium2/StandAlone/manta.cc       (original)
+++ branches/itanium2/StandAlone/manta.cc       Thu Oct 13 14:23:54 2005
@@ -23,9 +23,10 @@
 #include <ieeefp.h>
 #endif
 
-Scene* createDefaultScene();
+static Scene* createDefaultScene();
 
-void printList(ostream& out, const RTRTInterface::listType& list, int 
spaces=0)
+static void
+printList(ostream& out, const RTRTInterface::listType& list, int spaces=0)
 {
   for(int i=0;i<spaces;i++)
     out << ' ';
@@ -38,7 +39,7 @@
   out << "\n";
 }
 
-void usage(RTRTInterface* rtrt)
+static void usage(RTRTInterface* rtrt)
 {
   cerr << "Usage: manta [options]\n";
   cerr << "Valid options are:\n";
@@ -94,7 +95,7 @@
 void BenchHelper::stop(int, int)
 {
   double dt = Time::currentSeconds()-startTime;
-  double fps = static_cast<double>(numFrames)/dt;
+  double fps = numFrames/dt;
   // cout << "Benchmark completed in " << dt << " seconds (" << numFrames << 
" frames, " << fps << " frames per second)\n";
   std::cout << fps << std::endl;
        rtrt->finish();
@@ -345,9 +346,10 @@
                                                                              
                                                                              
                                                                              
       Vector(0,1,0)),
                                                                              
                                                           new 
Constant<Color>(Color(RGBColor(.6,.6,.6))),
                                                                              
                                                           32,
-                                                                             
                                                           new 
CheckerTexture<double>(0.2, 0.5,
-                                                                             
                                                                              
                                                                              
              Vector(1,0,0),
-                                                                             
                                                                              
                                                                              
              Vector(0,1,0)));
+                                                                             
                                                           new 
CheckerTexture<Real>((Real)0.2,
+                                                            (Real)0.5,
+                                                            Vector(1,0,0),
+                                                            Vector(0,1,0)));
        
        
   Group* world = new Group();

Modified: branches/itanium2/StandAlone/mf_stream_test.cc
==============================================================================
--- branches/itanium2/StandAlone/mf_stream_test.cc      (original)
+++ branches/itanium2/StandAlone/mf_stream_test.cc      Thu Oct 13 14:23:54 
2005
@@ -17,13 +17,12 @@
 using namespace SCIRun;
 
 
-Window parent;
-Window win;
-Display* dpy;
-int screen;
-GLXContext cx;
+static Window parent;
+static Window win;
+static Display* dpy;
+static GLXContext cx;
 
-void createWindow( MFStreamData *stream_data ) {
+static void createWindow( MFStreamData *stream_data ) {
 
   // Open the display and make sure it has opengl
   dpy = XOpenDisplay(NULL);
@@ -109,9 +108,9 @@
   glClear(GL_COLOR_BUFFER_BIT);
   glXSwapBuffers(dpy, win);
   glFinish();
-};
+}
 
-void closeWindow() {
+static void closeWindow() {
   
   if(win) {
     XDestroyWindow(dpy, win);
@@ -121,7 +120,7 @@
   }
 }
 
-void display( MFStreamData *stream_data ) {
+static void display( MFStreamData *stream_data ) {
 
   int xres, yres;
   xres = stream_data->xres;
@@ -204,7 +203,7 @@
     if (use_x) {
       createWindow( stream_data );
 
-      while (1) {
+      for(;;) {
         display( stream_data );
         SCIRun::Time::waitUntil( SCIRun::Time::currentSeconds()+0.05 );
       };
@@ -230,4 +229,4 @@
   }
 
   return 1;
-};
+}

Modified: branches/itanium2/UserInterface/CameraPathAutomator.cc
==============================================================================
--- branches/itanium2/UserInterface/CameraPathAutomator.cc      (original)
+++ branches/itanium2/UserInterface/CameraPathAutomator.cc      Thu Oct 13 
14:23:54 2005
@@ -41,12 +41,11 @@
 #include <Core/Util/Args.h>
 
 #include <stdio.h>
+#include <errno.h>
 
 using namespace Manta;
 using namespace SCIRun;
 
-extern int errno;
-
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
 // SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP 
SETU
@@ -329,7 +328,7 @@
   int first_point = SCIRun::Max(1,SCIRun::Min(interval_start,last_point));
   
   int start_frame = getMantaInterface()->getCurrentFrame();
-  Real start_seconds = SCIRun::Time::currentSeconds();
+  double start_seconds = SCIRun::Time::currentSeconds();
   
   std::cerr << "Beginning camera path " << total_points 
             << " control points. Using interval " << first_point << ":" << 
last_point << std::endl;
@@ -389,8 +388,6 @@
     
     std::cerr << "Path complete. "    << total_frames
               << " frames. Avg fps: " << average_fps << std::endl;
-
-
   }
 
   // Check to see if we should continue looping.
@@ -419,10 +416,10 @@
   // Wait for either the renderer thread or the camera path thread.
   synchronize_barrier.wait( 2 );
 
-  Real current_sync_seconds = SCIRun::Time::currentSeconds();
+  double current_sync_seconds = SCIRun::Time::currentSeconds();
   int  current_sync_frame   = getMantaInterface()->getCurrentFrame();
 
-  Real elapse_seconds = current_sync_seconds - last_sync_seconds;
+  double elapse_seconds = current_sync_seconds - last_sync_seconds;
   int  elapse_frame   = current_sync_frame   - last_sync_frame;
 
   last_sync_seconds = current_sync_seconds;
@@ -433,8 +430,8 @@
             << issue_transaction << " "
             << elapse_frame << " "
             << elapse_seconds << " "
-            << ((Real)elapse_frame/elapse_seconds) << std::endl;
-};
+            << elapse_frame/elapse_seconds << std::endl;
+}
 
 
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////

Modified: branches/itanium2/UserInterface/CameraPathAutomator.h
==============================================================================
--- branches/itanium2/UserInterface/CameraPathAutomator.h       (original)
+++ branches/itanium2/UserInterface/CameraPathAutomator.h       Thu Oct 13 
14:23:54 2005
@@ -69,7 +69,7 @@
     // Synchronization barrier.
     Barrier synchronize_barrier;
 
-    Real last_sync_seconds;
+    double last_sync_seconds;
     int  last_sync_frame;
 
     // Number of frames between synchronization points.

Modified: branches/itanium2/UserInterface/XWindowUI.cc
==============================================================================
--- branches/itanium2/UserInterface/XWindowUI.cc        (original)
+++ branches/itanium2/UserInterface/XWindowUI.cc        Thu Oct 13 14:23:54 
2005
@@ -178,7 +178,8 @@
       int token;
       ssize_t s = read(xpipe[0], &token, sizeof(token));
       if(s != sizeof(token))
-       throw ErrnoException("XWindowUI read pipe", errno, __FILE__, __LINE__ 
);
+        throw ErrnoException("XWindowUI read pipe", errno,
+                             __FILE__, __LINE__ );
       switch(token){
       case TOKEN_NOOP:
        break;
@@ -188,14 +189,15 @@
        xlock.lock();
        break;
       default:
-       throw InternalError("XWindowUI::Unknown token in pipe", __FILE__, 
__LINE__ );
+        throw InternalError("XWindowUI::Unknown token in pipe",
+                            __FILE__, __LINE__ );
       }
     }
     bool have_some = false;
     for(vector<int>::iterator iter = xfds.begin(); iter != xfds.end(); 
iter++){
       if(FD_ISSET(*iter, &readfds)){
-       XProcessInternalConnection(dpy, *iter);
-       have_some = true;
+        XProcessInternalConnection(dpy, *iter);
+        have_some = true;
       }
     }
     if(have_some){
@@ -475,9 +477,9 @@
   } else {
     // Zoom in/out.
     XWindow* window = windows[channel];
-    double xmotion= double(ias.last_x - mouse_x)/window->xres;
-    double ymotion= double(ias.last_y - mouse_y)/window->yres;
-    double scale;
+    Real xmotion= Real(ias.last_x - mouse_x)/window->xres;
+    Real ymotion= Real(ias.last_y - mouse_y)/window->yres;
+    Real scale;
     if (Abs(xmotion) > Abs(ymotion))
       scale = xmotion;
     else
@@ -504,8 +506,8 @@
 {
   InteractionState& ias = interactions[channel];
   XWindow* window = windows[channel];
-  double xpos = 2.0*mouse_x/window->xres - 1.0;
-  double ypos = 1.0 - 2.0*mouse_y/window->yres;
+  Real xpos = (Real)2*mouse_x/window->xres - 1;
+  Real ypos = 1 - (Real)2*mouse_y/window->yres;
   if(event == ButtonPress){
     ias.rotate_from = projectToSphere(xpos, ypos, trackball_radius);
   } else {
@@ -534,8 +536,8 @@
     ias.last_y = mouse_y;
   } else {
     XWindow* window = windows[channel];
-    double xmotion =  double(ias.last_x-mouse_x)/window->xres;
-    double ymotion = -double(ias.last_y-mouse_y)/window->yres;
+    Real xmotion =  Real(ias.last_x-mouse_x)/window->xres;
+    Real ymotion = -Real(ias.last_y-mouse_y)/window->yres;
     Vector translation(xmotion*translate_speed, ymotion*translate_speed, 0);
 
     Camera* camera = rtrt_interface->getCamera(channel);
@@ -556,10 +558,10 @@
     ias.last_y = mouse_y;
   } else {
     XWindow* window = windows[channel];
-    double xmotion = -double(ias.last_x-mouse_x)/window->xres;
-    double ymotion = double(ias.last_y-mouse_y)/window->yres;
+    Real xmotion = -Real(ias.last_x-mouse_x)/window->xres;
+    Real ymotion =  Real(ias.last_y-mouse_y)/window->yres;
 
-    double scale;
+    Real scale;
     if (Abs(xmotion)>Abs(ymotion))
       scale=xmotion;
     else
@@ -729,18 +731,18 @@
   }
 }
 
-Vector XWindowUI::projectToSphere(double x, double y, double radius) const
+Vector XWindowUI::projectToSphere(Real x, Real y, Real radius) const
 {
   x /= radius;
   y /= radius;
-  double rad2 = x*x+y*y;
+  Real rad2 = x*x+y*y;
   if(rad2 > 1){
-    double rad = sqrt(rad2);
+    Real rad = Sqrt(rad2);
     x /= rad;
     y /= rad;
     return Vector(x,y,0);
   } else {
-    double z = sqrt(1-rad2);
+    Real z = Sqrt(1-rad2);
     return Vector(x,y,z);
   }
 }

Modified: branches/itanium2/UserInterface/XWindowUI.h
==============================================================================
--- branches/itanium2/UserInterface/XWindowUI.h (original)
+++ branches/itanium2/UserInterface/XWindowUI.h Thu Oct 13 14:23:54 2005
@@ -80,7 +80,7 @@
     void animation_callback(int, int, bool&);
 
     // Utility functions
-    Vector projectToSphere(double x, double y, double radius) const;
+    Vector projectToSphere(Real x, Real y, Real radius) const;
 
     // This is a pointer to the interface we will use to interact with manta.
     RTRTInterface *rtrt_interface;
@@ -126,12 +126,12 @@
     vector<InteractionState> interactions;
 
     // Interaction parameters
-    double fov_speed;
-    double translate_speed;
-    double dolly_speed;
-    double rotate_speed;
-    double autoview_fov;
-    double trackball_radius;
+    Real fov_speed;
+    Real translate_speed;
+    Real dolly_speed;
+    Real rotate_speed;
+    Real autoview_fov;
+    Real trackball_radius;
 
     XWindowUI(const XWindowUI&);
     XWindowUI& operator=(const XWindowUI&);

Modified: branches/itanium2/fox/dm_demo.cc
==============================================================================
--- branches/itanium2/fox/dm_demo.cc    (original)
+++ branches/itanium2/fox/dm_demo.cc    Thu Oct 13 14:23:54 2005
@@ -389,7 +389,8 @@
                                                                              
                                                                              
                                                                              
       Vector(0,1,0)),
                                                                              
                                                           new 
Constant<Color>(Color(RGBColor(.6,.6,.6))),
                                                                              
                                                           32,
-                                                                             
                                                           new 
CheckerTexture<double>(0.2, 0.5,
+                                                                             
                                                           new 
CheckerTexture<Real>((Real)0.2,
+                                                            (Real)0.5,
                                                                              
                                                                              
                                                                              
              Vector(1,0,0),
                                                                              
                                                                              
                                                                              
              Vector(0,1,0)));
        

Modified: branches/itanium2/scenes/boeing777.cc
==============================================================================
--- branches/itanium2/scenes/boeing777.cc       (original)
+++ branches/itanium2/scenes/boeing777.cc       Thu Oct 13 14:23:54 2005
@@ -89,11 +89,11 @@
        
   MtlType material_type = MTL_PHONG;
   
-       double alpha = 1.0;
-  double ambient_dist = 5.0;
+       Real alpha = 1;
+  Real ambient_dist = 5;
   int    ambient_rays = 16;
   int    phong_exp = 512;
-  double phong_reflect = 0.0;
+  Real phong_reflect = 0;
   
   bool use_transparency = false;
   
@@ -113,7 +113,7 @@
       // Note this just specifies that a TransparentKDTree should be created 
as well.
     
                        use_transparency = true;
-                       if (!getDoubleArg(i, args, alpha ))
+                       if (!getArg<Real>(i, args, alpha ))
                                throw IllegalArgument("boeing777 -alpha 
<alpha>", i, args);
                }
     else if (args[i] == "-lambertianalt") {
@@ -121,13 +121,13 @@
     }
     else if (args[i] == "-phong") {
       material_type = MTL_PHONG;
-      if (!getIntArg(i, args, phong_exp) || !getDoubleArg(i, args, 
phong_reflect)) {
+      if (!getIntArg(i, args, phong_exp) || !getArg<Real>(i, args, 
phong_reflect)) {
         throw IllegalArgument("boeing777 -phong <exp> <reflection>", i, 
args);
       }
     }
     else if (args[i] == "-ambient") {
       material_type = MTL_AMBIENT;
-      if (!getDoubleArg(i, args, ambient_dist) || !getIntArg(i, args, 
ambient_rays)) {
+      if (!getArg<Real>(i, args, ambient_dist) || !getIntArg(i, args, 
ambient_rays)) {
         throw IllegalArgument("boeing777 -ambient <max dist> <secondary 
rays>", i, args);
       }
     }
@@ -176,7 +176,7 @@
     kd_material = new Phong( new KDTreeTexture, 
                              new Constant<Color>(Color::white()),
                              phong_exp,
-                             new Constant<double>(phong_reflect) );
+                             new Constant<Real>(phong_reflect) );
     break;
   };
        
@@ -240,8 +240,7 @@
        scene->setObject( root_object );
        
        // Set other important scene properties.
-       PinholeCamera *camera = new PinholeCamera( bounds[1], bounds[0], 
Vector(0,1,0), 40.0 );
-       
+
        // Background.
        scene->setBackground( new ConstantBackground( Color(RGB(0.8, 0.8, 
0.8)) ) );
        

Modified: branches/itanium2/scenes/objviewer.cc
==============================================================================
--- branches/itanium2/scenes/objviewer.cc       (original)
+++ branches/itanium2/scenes/objviewer.cc       Thu Oct 13 14:23:54 2005
@@ -39,17 +39,17 @@
 using namespace SCIRun;
 using namespace Glm;
   
-Object *create_single_bvh( GLMmodel *model );
-Object *create_bvh_meshs ( GLMmodel *model );
+static Object *create_single_bvh( GLMmodel *model );
+static Object *create_bvh_meshs ( GLMmodel *model );
 
-BBox bounds;
+static BBox bounds;
 
 
 ///////////////////////////////////////////////////////////////////////////
 // This function loads a specified .obj file into a runtime acceleration
 // structure for rendering.
 extern "C" 
-Scene* make_scene(const ReadContext& context, const vector<string>& args) {
+Scene* make_scene(const ReadContext& /*context*/, const vector<string>& 
args) {
 
        string file_name;
        bool use_single_bvh = false;
@@ -94,21 +94,10 @@
        lights->setAmbientLight( new ConstantAmbient( Color(RGB(0.2,0.2,0.2) 
) ));
        scene->setLights( lights );
        
-       Material* red=new Lambertian(Color(RGBColor(.6,0,0)));
+  //   Material* red=new Lambertian(Color(RGBColor(.6,0,0)));
        Material* yellow=new Lambertian(Color(RGBColor(.6,.6,0)));
        
        
-       // Add a checkerboard floor.
-       Material* plane_matl = new Phong(new 
CheckerTexture<Color>(Color(RGBColor(.6,.6,0)),
-                                                                             
                                                                              
                                                                              
       Color(RGBColor(0,0,0)),
-                                                                             
                                                                              
                                                                              
       Vector(1,0,0),
-                                                                             
                                                                              
                                                                              
       Vector(0,1,0)),
-                                                                             
                                                           new 
Constant<Color>(Color(RGBColor(.6,.6,.6))),
-                                                                             
                                                           32,
-                                                                             
                                                           new 
CheckerTexture<double>(0.2, 0.5,
-                                                                             
                                                                              
                                                                              
              Vector(1,0,0),
-                                                                             
                                                                              
                                                                              
              Vector(0,1,0)));
-       
   Parallelogram* floor = new Parallelogram(yellow, 
Point(-20,-20,bounds[0][2]),
                                                                              
                                                                           
Vector(40,0,0), Vector(0,40,0));
        Group *manta_group = new Group();
@@ -125,9 +114,9 @@
        return scene;
 }
 
-Material **material_array = 0;
+static Material **material_array = 0;
 
-void create_materials( GLMmodel *model ) {
+static void create_materials( GLMmodel *model ) {
 
        material_array = new Material *[ model->nummaterials ];
 
@@ -147,17 +136,17 @@
                
                        // Note that the first material added by blender is 
always an
                        // unused default material..
-                       material_array[i-1] = new Dielectric( 1.1, 1.0, 
diffuse );
+                       material_array[i-1] = new Dielectric( (Real)1.1, 
(Real)1.0, diffuse );
                        // material_array[i-1] = new Dielectric( diffuse, 
Color(RGB(0.6,0.6,0.6)), Color(RGB(log(c0),log(c1),log(c2))), 28, 1.3, 1.0 );
                }
                else {
                        // material_array[i-1] = new Lambertian( diffuse );
-                       material_array[i-1] = new Phong( diffuse, 
Color(RGB(1.0,1.0,1.0)), 32, 0.0 );
+                       material_array[i-1] = new Phong( diffuse, 
Color(RGB(1,1,1)), 32, 0 );
                }
 // #endif              
                // material_array[i-1] = new Lambertian( diffuse );
        }
-};
+}
 
 
 
///////////////////////////////////////////////////////////////////////////////
@@ -247,7 +236,7 @@
        return bvh;
 }
 
-Object *create_many_bvh( GLMmodel *model ) {
+static Object *create_many_bvh( GLMmodel *model ) {
        
        Triangle *triangle_array;
        

Modified: branches/itanium2/scenes/primtest.cc
==============================================================================
--- branches/itanium2/scenes/primtest.cc        (original)
+++ branches/itanium2/scenes/primtest.cc        Thu Oct 13 14:23:54 2005
@@ -49,8 +49,8 @@
 {
   std::cout << "Make_scene args: " << args.size() << std::endl;
 
-  double scale = 1;
-  double texscale = 20;
+  Real scale = 1;
+  Real texscale = 20;
   int numx = 8;
   int numy = 8;
   string primtype = "sphere";
@@ -63,10 +63,10 @@
   for(int i=0;i<argc;i++){
     string arg = args[i];
     if(arg == "-scale"){
-      if(!getDoubleArg(i, args, scale))
+      if(!getArg<Real>(i, args, scale))
         throw IllegalArgument("scene primtest -scale", i, args);
     } else if(arg == "-texscale"){
-      if(!getDoubleArg(i, args, texscale))
+      if(!getArg<Real>(i, args, texscale))
         throw IllegalArgument("scene primtest -texscale", i, args);
     } else if(arg == "-num"){
       if(!getResolutionArg(i, args, numx, numy))
@@ -111,7 +111,7 @@
                                                Vector(0,1,0)*texscale),
                      new Constant<Color>(Color(RGB(.6,.6,.6))),
                      32,
-                     new Constant<double>(0));
+                     new Constant<Real>(0));
   else if(material == "checker2")
     matl = new Phong(new CheckerTexture<Color>(Color(RGB(.6,.6,.6)),
                                                Color(RGB(.6,0,0)),
@@ -119,7 +119,7 @@
                                                Vector(0,1,0)*texscale),
                      new Constant<Color>(Color(RGB(.6,.6,.6))),
                      32,
-                     new CheckerTexture<double>(0.2, 0.5,
+                     new CheckerTexture<Real>(0.2, 0.5,
                                                 Vector(1,0,0)*texscale,
                                                 Vector(0,1,0)*texscale));
   else if(material == "checker3")
@@ -134,7 +134,7 @@
                10.0, 1.0, 15.0, 6, 2.0, 0.6 ),
                      new Constant<Color>(Color(RGB(.6,.6,.6))),
                      32,
-                     new Constant<double>(0));
+                     new Constant<Real>(0));
     mapr = new UniformMapper();
   }
   else if(material == "wood")
@@ -161,9 +161,9 @@
     for(int i=0;i<numx;i++){
       for(int j=0;j<numy;j++){
         int idx = j*numx+i;
-        double radius = (idx+1)/static_cast<double>(numx*numy)*scale/max;
-        Point p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+        Real radius = (idx+1)/((numx*numy)*scale/max);
+        Point p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                 0);
   Primitive* prim = new Sphere( matl, p, radius );
   if ( mapr )
@@ -175,11 +175,11 @@
     for(int i=0;i<numx;i++){
       for(int j=0;j<numy;j++){
         int idx = j*numx+i;
-        double radius = (idx+1)/static_cast<double>(numx*numy)*scale/max;
-        double alpha = (i+1)/static_cast<double>(numx)*2.;
-        double beta = (j+1)/static_cast<double>(numy)*2.;
-        Point p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+        Real radius = (idx+1)/((numx*numy)*scale/max);
+        Real alpha = (i+1)/static_cast<Real>(numx)*2;
+        Real beta = (j+1)/static_cast<Real>(numy)*2;
+        Point p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                 0);
         Primitive* prim = new SuperEllipsoid( matl, p, radius, alpha, beta );
         if ( mapr )
@@ -191,8 +191,8 @@
     Vector p2(scale/max, scale/max, scale/max);
     for(int i=0;i<numx;i++){
       for(int j=0;j<numy;j++){
-        Point p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+        Point p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                 0);
   Primitive* prim = new Cube( matl, p-p2, p2.x()*1.156, p2.y()*1.156, 
p2.z()*1.156 );
   if ( mapr )
@@ -223,7 +223,7 @@
     Point p2(scale/max/1.414, scale/max/1.414, scale/max/1.414);
     Primitive* o1 = new Cube(matl, Point(-p2.x(), -p2.y(), -p2.z()), 
p2.x()*2, p2.y()*2, p2.z()*2);
     Primitive* o2 = new Sphere(matl, Point(0,0,0), scale/max);
-    double s = scale/max/1.414*2*(1+1.e-10);
+    Real s = scale/max/(Real)1.414*2*(Real)(1+1.e-10);
     LinearMapper* map = new LinearMapper(Point(0,0,0),
                                          Vector(s,0,0),
                                          Vector(0,s,0),
@@ -261,11 +261,11 @@
     if(arraytype == "spin"){
       for(int i=0;i<numx;i++){
         for(int j=0;j<numy;j++){
-          Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                   (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+          Vector p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                   (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                    0);
-          double a1 = i/static_cast<double>(numx-1)*M_PI*2;
-          double a2 = j/static_cast<double>(numy-1)*M_PI*2;
+          Real a1 = i/static_cast<Real>(numx-1)*(Real)M_PI*2;
+          Real a2 = j/static_cast<Real>(numy-1)*(Real)M_PI*2;
           AffineTransform t;
           t.initWithIdentity();
           t.rotate(Vector(0,1,0), a1);
@@ -277,8 +277,8 @@
     } else if(arraytype == "shift"){
       for(int i=0;i<numx;i++){
         for(int j=0;j<numy;j++){
-          Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                   (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+          Vector p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                   (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                    0);
           group->add(new InstanceT(spinprim, p));
         }
@@ -286,35 +286,35 @@
     } else if(arraytype == "scale"){
       for(int i=0;i<numx;i++){
         for(int j=0;j<numy;j++){
-          Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                   (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+          Vector p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                   (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                    0);
           int idx = j*numx+i;
-          double scale = (idx+1)/static_cast<double>(numx*numy);
+          Real scale = (idx+1)/static_cast<Real>(numx*numy);
           group->add(new InstanceST(spinprim, Vector(scale, scale, scale), 
p));
         }
       }
     } else if(arraytype == "nuscale"){
       for(int i=0;i<numx;i++){
         for(int j=0;j<numy;j++){
-          Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                   (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+          Vector p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                   (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                    0);
-          double xscale = (i+1)/static_cast<double>(numx);
-          double yscale = (j+1)/static_cast<double>(numy);
+          Real xscale = (i+1)/static_cast<Real>(numx);
+          Real yscale = (j+1)/static_cast<Real>(numy);
           group->add(new InstanceST(spinprim, Vector(xscale, yscale, 1), p));
         }
       }
     } else if(arraytype == "spinscale"){
       for(int i=0;i<numx;i++){
         for(int j=0;j<numy;j++){
-          Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                   (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+          Vector p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                   (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                    0);
-          double a1 = i/static_cast<double>(numx-1)*M_PI*2;
-          double a2 = j/static_cast<double>(numy-1)*M_PI*2;
+          Real a1 = i/static_cast<Real>(numx-1)*(Real)M_PI*2;
+          Real a2 = j/static_cast<Real>(numy-1)*(Real)M_PI*2;
           int idx = j*numx+i;
-          double scale = (idx+1)/static_cast<double>(numx*numy);
+          Real scale = (idx+1)/static_cast<Real>(numx*numy);
           AffineTransform t;
           t.initWithIdentity();
           t.scale(Vector(scale, scale, scale));
@@ -327,13 +327,13 @@
     } else if(arraytype == "spinscale2"){
       for(int i=0;i<numx;i++){
         for(int j=0;j<numy;j++){
-          Vector p((i/static_cast<double>(numx-1) - 0.5)*scale*2,
-                   (j/static_cast<double>(numy-1) - 0.5)*scale*2,
+          Vector p((i/static_cast<Real>(numx-1) - (Real)0.5)*scale*2,
+                   (j/static_cast<Real>(numy-1) - (Real)0.5)*scale*2,
                    0);
-          double a1 = i/static_cast<double>(numx-1)*M_PI*2;
-          double a2 = j/static_cast<double>(numy-1)*M_PI*2;
+          Real a1 = i/static_cast<Real>(numx-1)*(Real)M_PI*2;
+          Real a2 = j/static_cast<Real>(numy-1)*(Real)M_PI*2;
           int idx = j*numx+i;
-          double scale = (idx+1)/static_cast<double>(numx*numy);
+          Real scale = (idx+1)/static_cast<Real>(numx*numy);
           AffineTransform t;
           t.initWithIdentity();
           t.scale(Vector(scale, scale, scale));




  • [MANTA] r623 - in branches/itanium2: . Core/Color Core/Geometry Core/Math Core/Shm Engine/Control Engine/Display Engine/IdleModes Engine/ImageTraversers Engine/PixelSamplers Image Interface Model/Cameras Model/Groups Model/Lights Model/Materials Model/MiscObjects Model/Primitives Model/Readers/glm Model/TexCoordMappers Readers/BART StandAlone UserInterface fox scenes, bigler, 10/13/2005

Archive powered by MHonArc 2.6.16.

Top of page