Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r585 - in branches/itanium2: . Engine/Control Engine/Display Engine/PixelSamplers Interface Model/Cameras Model/Groups StandAlone


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r585 - in branches/itanium2: . Engine/Control Engine/Display Engine/PixelSamplers Interface Model/Cameras Model/Groups StandAlone
  • Date: Thu, 29 Sep 2005 20:28:39 -0600 (MDT)

Author: abe
Date: Thu Sep 29 20:28:37 2005
New Revision: 585

Modified:
   branches/itanium2/CMakeLists.txt
   branches/itanium2/Engine/Control/RTRT.cc
   branches/itanium2/Engine/Display/OpenGLDisplay.cc
   branches/itanium2/Engine/Display/OpenGLDisplay.h
   branches/itanium2/Engine/PixelSamplers/SingleSampler.cc
   branches/itanium2/Interface/RayPacket.h
   branches/itanium2/Model/Cameras/PinholeCamera.cc
   branches/itanium2/Model/Cameras/PinholeCamera.h
   branches/itanium2/Model/Groups/KDTree.cc
   branches/itanium2/Model/Groups/KDTreeLoader.cc
   branches/itanium2/Model/Groups/RayTriangleMailbox.h
   branches/itanium2/Model/Groups/TransparentKDTree.cc
   branches/itanium2/StandAlone/manta.cc
Log:

Added stereo support to bin/manta. 

Use -stereo to enable stereo rendering. Only works with pinhole camera. 
Use -offset <distance> as a parameter to pinhole() to specify space between 
eye points.

Modified cmake file so that manta builds in 64 bit mode out of the box on 
Irix.

M    StandAlone/manta.cc
M    Model/Groups/RayTriangleMailbox.h
M    Model/Groups/TransparentKDTree.cc
M    Model/Groups/KDTreeLoader.cc
M    Model/Groups/KDTree.cc
M    Model/Cameras/PinholeCamera.cc
M    Model/Cameras/PinholeCamera.h
M    Interface/RayPacket.h
M    Engine/Control/RTRT.cc
M    Engine/Display/OpenGLDisplay.h
M    Engine/Display/OpenGLDisplay.cc
M    Engine/PixelSamplers/SingleSampler.cc
M    CMakeLists.txt


Modified: branches/itanium2/CMakeLists.txt
==============================================================================
--- branches/itanium2/CMakeLists.txt    (original)
+++ branches/itanium2/CMakeLists.txt    Thu Sep 29 20:28:37 2005
@@ -13,21 +13,97 @@
 INCLUDE (${CMAKE_ROOT}/Modules/FindThreads.cmake)
 INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake)
 
-# Do we have sproc?  For now this is forced.
+
+# #################################################################
+# ###   ADD_CXX_FLAGS(flags)                                    ###
+# ### flags will be added to CMAKE_CXX_FLAGS, but only once     ###
+# ### This only works for CMake 2.0 and above.                  ###
+# #################################################################
+# MACRO(FORCE_ADD_CXX_FLAGS)
+#   FOREACH(arg ${ARGN})
+#     SET(TMP ${arg}) #elsewise the Seperate command doesn't work)
+#     SEPARATE_ARGUMENTS(TMP)
+#     FOREACH(option ${TMP})
+#       STRING(REGEX REPLACE " ${option}" "" CMAKE_CXX_FLAGS
+# "${CMAKE_CXX_FLAGS}")
+#       STRING(REGEX REPLACE "${option}" "" CMAKE_CXX_FLAGS
+# "${CMAKE_CXX_FLAGS}")
+#       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${option}" CACHE STRING
+# "common C++ build flags" FORCE)
+#     ENDFOREACH(option ${TMP})  
+#   ENDFOREACH(arg ${ARGN})
+# ENDMACRO(FORCE_ADD_CXX_FLAGS)
+
+# This MACRO is designed to set variables to default values only on
+# the first configure.  Subsequent configures will produce no ops.
+MACRO(FIRST_TIME_SET VARIABLE VALUE TYPE COMMENT)
+  IF(NOT PASSED_FIRST_CONFIGURE)
+    SET(${VARIABLE} ${VALUE} CACHE ${TYPE} ${COMMENT} FORCE)
+  ENDIF(NOT PASSED_FIRST_CONFIGURE)
+ENDMACRO(FIRST_TIME_SET)
+  
+
+######################################################################
+# Check for SGI Linux.
+IF   (CMAKE_SYSTEM MATCHES "Linux.*sgi")
+     
+  SET(SGI_LINUX TRUE)
+
+  # Warn if the compiler is not icc
+  IF   (CMAKE_C_COMPILER MATCHES "icc$")
+    FIRST_TIME_SET(CMAKE_C_FLAGS_RELEASE "-O3 -IPO -g" CACHE STRING "Release 
 Flags" FORCE)
+    FIRST_TIME_SET(CMAKE_C_FLAGS_DEBUG   "-O0 -g" CACHE STRING "Debug Flags" 
FORCE)
+
+  ELSE (CMAKE_C_COMPILER MATCHES "icc$")
+         MESSAGE("Intel Compilers recommended on ia64. setenv CC icc before 
running cmake.")
+         FIRST_TIME_SET(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math 
-funroll-loops -g" CACHE STRING "Release Flags" FORCE)
+         FIRST_TIME_SET(CMAKE_C_FLAGS_DEBUG   "-O0 -g" CACHE STRING "Debug 
Flags" FORCE)
+  ENDIF(CMAKE_C_COMPILER MATCHES "icc$")
+
+  IF   (CMAKE_CXX_COMPILER MATCHES "icpc$")
+         FIRST_TIME_SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -IPO -g" CACHE STRING 
"Release Flags" FORCE)
+         FIRST_TIME_SET(CMAKE_CXX_FLAGS_DEBUG   "-O0 -g" CACHE STRING "Debug 
Flags" FORCE)
+  ELSE (CMAKE_CXX_COMPILER MATCHES "icpc$")
+         MESSAGE("Intel Compilers recommended on ia64.  setenv CXX icpc 
before running cmake.")
+         FIRST_TIME_SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math 
-funroll-loops -g" CACHE STRING "Release Flags" FORCE)
+         FIRST_TIME_SET(CMAKE_CXX_FLAGS_DEBUG   "-O0 -g" CACHE STRING "Debug 
Flags" FORCE)
+  ENDIF(CMAKE_CXX_COMPILER MATCHES "icpc$")
+
+ENDIF(CMAKE_SYSTEM MATCHES "Linux.*sgi")
+
+
+######################################################################
+# Check for SGI Irix
 IF(CMAKE_SYSTEM MATCHES IRIX)
+
+  # For now force sproc on IRIX systems.
+  #  MESSAGE("Forcing Irix Threads")
   SET(CMAKE_USE_SPROC_INIT 1)
   SET(CMAKE_USE_PTHREADS_INIT 0)
   SET(CMAKE_THREAD_LIBS_INIT -lfetchop)
-  MESSAGE("Forcing Irix Threads")
+
+  # Check for CC compiler and add -LANG:std to it
+  IF(CMAKE_CXX_COMPILER MATCHES "CC")
+    FIRST_TIME_SET(CMAKE_CXX_FLAGS "-64 -LANG:std" STRING "Standard CXX 
flags")
+    FIRST_TIME_SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -OPT:IEEE_arithmetic=3" 
STRING "Optimized Flags")
+  ENDIF(CMAKE_CXX_COMPILER MATCHES "CC")
+
+  IF(CMAKE_C_COMPILER MATCHES "cc")
+    FIRST_TIME_SET(CMAKE_C_FLAGS "-64" STRING "Standard CC flags")
+    FIRST_TIME_SET(CMAKE_SHARED_LINKER_FLAGS "-64" STRING "Standard Linker 
flags")
+  ENDIF(CMAKE_C_COMPILER MATCHES "cc")
+
 ELSE(CMAKE_SYSTEM MATCHES IRIX)
 #  MESSAGE("IRIX not found")
 ENDIF(CMAKE_SYSTEM MATCHES IRIX)
 
-
-
+######################################################################
+# Check for Mac OS
 IF (APPLE)
-  SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -fgcse-sm -funroll-loops 
-fstrict-aliasing -fsched-interblock -falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-ffast-math -freorder-blocks -mpowerpc-gpopt -force_cpusubtype_ALL -mtune=G5 
-mcpu=G5 -mpowerpc64 -faltivec -mabi=altivec -mpowerpc-gfxopt" CACHE STRING 
"Optimized Flags" FORCE)
+  FIRST_TIME_SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -fgcse-sm -funroll-loops 
-fstrict-aliasing -fsched-interblock -falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-ffast-math -freorder-blocks -mpowerpc-gpopt -force_cpusubtype_ALL -mtune=G5 
-mcpu=G5 -mpowerpc64 -faltivec -mabi=altivec -mpowerpc-gfxopt" STRING 
"Optimized Flags")
 ENDIF (APPLE)
+
+
 
 IF (OPENGL_INCLUDE_PATH)
   INCLUDE_DIRECTORIES (${OPENGL_INCLUDE_PATH})

Modified: branches/itanium2/Engine/Control/RTRT.cc
==============================================================================
--- branches/itanium2/Engine/Control/RTRT.cc    (original)
+++ branches/itanium2/Engine/Control/RTRT.cc    Thu Sep 29 20:28:37 2005
@@ -719,8 +719,8 @@
       if(!creator)
                                 creator = currentImageCreator;
       channel->images[which] = (creator)(currentImageCreatorArgs,
-                                                                             
                                                                              
      channel->stereo,
-                                                                             
                                                                              
      channel->xres, channel->yres);
+                                         channel->stereo,
+                                         channel->xres, channel->yres);
     } else {
       if (channel->pipelineDepth > 1)
         channel->images[which]->setValid(false);

Modified: branches/itanium2/Engine/Display/OpenGLDisplay.cc
==============================================================================
--- branches/itanium2/Engine/Display/OpenGLDisplay.cc   (original)
+++ branches/itanium2/Engine/Display/OpenGLDisplay.cc   Thu Sep 29 20:28:37 
2005
@@ -16,7 +16,7 @@
 #include <Core/Util/NotFinished.h>
 
 #include <X11/Xutil.h>
-#include <GL/glu.h>
+
 
 #include <sgi_stl_warnings_off.h>
 #include <typeinfo>
@@ -77,7 +77,7 @@
   int xres, yres;
   context.getResolution(stereo, xres, yres);
   if(!windowOpen){
-    createWindow(xres, yres, context.masterWindow);
+    createWindow(stereo, xres, yres, context.masterWindow);
     old_xres = xres;
     old_yres = yres;
   } else if(old_xres != xres || old_yres != yres){
@@ -87,7 +87,7 @@
   }
 }
 
-void OpenGLDisplay::createWindow(int xres, int yres, XWindow* masterWindow)
+void OpenGLDisplay::createWindow(bool stereo, int xres, int yres, XWindow* 
masterWindow)
 {
   // Open the display and make sure it has opengl
   dpy = XOpenDisplay(NULL);
@@ -109,6 +109,12 @@
   attribList.push_back(GLX_BLUE_SIZE); attribList.push_back(1);
   attribList.push_back(GLX_ALPHA_SIZE); attribList.push_back(0);
   attribList.push_back(GLX_DEPTH_SIZE); attribList.push_back(0);
+
+  // Require stereo.
+  if (stereo) {
+    attribList.push_back(GLX_STEREO);
+  }
+  
   attribList.push_back(GLX_DOUBLEBUFFER); // This must be the last one
   attribList.push_back(None);
 
@@ -230,30 +236,53 @@
   if(typeid(*image) == typeid(SimpleImage<RGBA8Pixel>)){
     const SimpleImage<RGBA8Pixel>* si = dynamic_cast<const 
SimpleImage<RGBA8Pixel>*>(image);
     if(stereo){
+      gl_print_error(__FILE__,__LINE__);
+      
       glDrawBuffer(GL_BACK_LEFT);
+      gl_print_error(__FILE__,__LINE__);
+      
       glRasterPos2i(0,0);
+      gl_print_error(__FILE__,__LINE__);
+      
       glDrawPixels(xres, yres, GL_RGBA, GL_UNSIGNED_BYTE, si->getRaw(0));
-      glDrawBuffer(GL_BACK_RIGHT);
-      glRasterPos2i(0,0);
+      gl_print_error(__FILE__,__LINE__);
+      
+      glDrawBuffer(GL_BACK_RIGHT); 
+      gl_print_error(__FILE__,__LINE__);
+      
+      glRasterPos2i(0,0); gl_print_error(__FILE__,__LINE__);
+      gl_print_error(__FILE__,__LINE__);
+      
       glDrawPixels(xres, yres, GL_RGBA, GL_UNSIGNED_BYTE, si->getRaw(1));
+      gl_print_error(__FILE__,__LINE__);
+
+      
+      
     } else {
       glDrawBuffer(GL_BACK);
       glRasterPos2i(0,0);
       glDrawPixels(xres, yres, GL_RGBA, GL_UNSIGNED_BYTE, si->getRaw(0));
+
+      gl_print_error(__FILE__,__LINE__);
     }
   } else if(typeid(*image) == typeid(SimpleImage<RGB8Pixel>)){
     const SimpleImage<RGB8Pixel>* si = dynamic_cast<const 
SimpleImage<RGB8Pixel>*>(image);
     if(stereo){
+
       glDrawBuffer(GL_BACK_LEFT);
       glRasterPos2i(0,0);
       glDrawPixels(xres, yres, GL_RGB, GL_UNSIGNED_BYTE, si->getRaw(0));
       glDrawBuffer(GL_BACK_RIGHT);
       glRasterPos2i(0,0);
       glDrawPixels(xres, yres, GL_RGB, GL_UNSIGNED_BYTE, si->getRaw(1));
+      
+      gl_print_error(__FILE__,__LINE__);
     } else {
       glDrawBuffer(GL_BACK);
       glRasterPos2i(0,0);
       glDrawPixels(xres, yres, GL_RGB, GL_UNSIGNED_BYTE, si->getRaw(0));
+
+      gl_print_error(__FILE__,__LINE__);
     }
   } else if(typeid(*image) == typeid(SimpleImage<RGBAfloatPixel>)){
     const SimpleImage<RGBAfloatPixel>* si = dynamic_cast<const 
SimpleImage<RGBAfloatPixel>*>(image);
@@ -291,9 +320,7 @@
   last_frame_time = currentTime;
   
   glXSwapBuffers(dpy, win);
-  GLenum errcode = glGetError();
-  if(errcode != GL_NO_ERROR)
-    cerr << "OpenGLDisplay: Error code from OpenGL: " << 
gluErrorString(errcode) << '\n';
+  gl_print_error(__FILE__,__LINE__);
 
   // Suck up X events to keep opengl happy
   while (XPending(dpy)) {

Modified: branches/itanium2/Engine/Display/OpenGLDisplay.h
==============================================================================
--- branches/itanium2/Engine/Display/OpenGLDisplay.h    (original)
+++ branches/itanium2/Engine/Display/OpenGLDisplay.h    Thu Sep 29 20:28:37 
2005
@@ -5,8 +5,10 @@
 #include <Interface/ImageDisplay.h>
 #include <X11/Xlib.h>
 #include <GL/glx.h>
+#include <GL/glu.h>
 #include <sgi_stl_warnings_off.h>
 #include <string>
+#include <iostream>
 #include <vector>
 #include <sgi_stl_warnings_on.h>
 
@@ -24,7 +26,7 @@
     OpenGLDisplay(const OpenGLDisplay&);
     OpenGLDisplay& operator=(const OpenGLDisplay&);
 
-    void createWindow(int xres, int yres, XWindow* masterWindow);
+    void createWindow(bool stereo, int xres, int yres, XWindow* 
masterWindow);
     Window parentWindow;
     Window win;
     Display* dpy;
@@ -45,6 +47,18 @@
 
     // Used to display the frame rate on the screen
     void display_frame_rate(double framerate);
+
+    inline void gl_print_error(const char *file, int line) {
+      
+      GLenum errcode = glGetError();
+      if(errcode != GL_NO_ERROR)
+        std::cerr << "OpenGLDisplay: "
+             << file << ":"
+             << line << " error: "
+             << gluErrorString(errcode) << std::endl;
+    }
+
+
   };
 }
 

Modified: branches/itanium2/Engine/PixelSamplers/SingleSampler.cc
==============================================================================
--- branches/itanium2/Engine/PixelSamplers/SingleSampler.cc     (original)
+++ branches/itanium2/Engine/PixelSamplers/SingleSampler.cc     Thu Sep 29 
20:28:37 2005
@@ -47,7 +47,7 @@
 }
 
 void SingleSampler::renderFragment(const RenderContext& context,
-                                  Fragment& fragment)
+                                   Fragment& fragment)
 {
   ChannelInfo& ci = channelInfo[context.channelIndex];
   int flags = RayPacket::HaveImageCoordinates;
@@ -67,24 +67,33 @@
     RayPacketData raydata;
     RayPacket rays(raydata, size, depth, flags);
 
+    // Check to see if the fragment is consecutive in x.
     if(fragment.getFlags() & Fragment::ConsecutiveX){
+
+      // If so place each pixel in the ray packet relative to the first
+      // fragment.
       Fragment::Element& fe0 = fragment.get(f);
-      double px = fe0.x*ci.xscale+ci.xoffset;
-      double py = fe0.y*ci.yscale+ci.yoffset;
+      Real px = fe0.x*ci.xscale+ci.xoffset;
+      Real py = fe0.y*ci.yscale+ci.yoffset;
+      
       for(int i=0;i<size;i++){
-       Fragment::Element& fe = fragment.get(f+i);
-       rays.setPixel(i, 0, px, py, &fe.color);
-       px += ci.xscale;
+        Fragment::Element& fe = fragment.get(f+i);
+        rays.setPixel(i, fe.which_eye, px, py, &fe.color);
+        px += ci.xscale;
       }
-    } else {
+
+    }
+
+    // Otherwise, set each pixel individually.
+    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;
-       rays.setPixel(i, 1, px, py, &fe.color);
+        Fragment::Element& fe = fragment.get(f+i);
+        double px = fe.x*ci.xscale+ci.xoffset;
+        double py = fe.y*ci.yscale+ci.yoffset;
+        rays.setPixel(i, fe.which_eye, px, py, &fe.color);
       }
     }
-
+    
     // Trace the rays.  The results will automatically go into the fragment
     context.renderer->traceEyeRays(context, rays);
   }

Modified: branches/itanium2/Interface/RayPacket.h
==============================================================================
--- branches/itanium2/Interface/RayPacket.h     (original)
+++ branches/itanium2/Interface/RayPacket.h     Thu Sep 29 20:28:37 2005
@@ -53,7 +53,7 @@
 
     bool getFlags( int flag ) const { return (flags & flag) == flag; };
 
-    int setFlags(int new_flags)
+    void setFlags(int new_flags)
     {
       flags = new_flags;
     }

Modified: branches/itanium2/Model/Cameras/PinholeCamera.cc
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.cc    (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.cc    Thu Sep 29 20:28:37 
2005
@@ -21,11 +21,25 @@
   bool gotLookat = false;
   bool gotFov = false;
   bool gotUp = false;
+  bool gotStereo = false;
   normalizeRays = false;
+
+  stereo_offset = 0.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;
+  
   int argc = static_cast<int>(args.size());
   for(int i=0; i< argc; i++){
     string arg = args[i];
-    if(arg == "-eye"){
+    if (arg == "-offset") {
+      if(!getArg(i, args, stereo_offset))
+        throw IllegalArgument("PinholeCamera -offset", i, args);
+      gotStereo = true;
+    } else if(arg == "-eye"){
       if(!getPointArg(i, args, eye))
         throw IllegalArgument("PinholeCamera -eye", i, args);
       gotEye = true;
@@ -47,8 +61,7 @@
       throw IllegalArgument("PinholeCamera", i, args);
     }
   }
-  if(!gotEye || !gotLookat || !gotUp || !gotFov)
-    throw IllegalArgument("PinholeCamera needs -eye -lookat -up and -fov", 
0, args);
+
   setup();
 }
 
@@ -108,22 +121,33 @@
 {
   ASSERT(rays.getFlags() & RayPacket::HaveImageCoordinates);
   rays.setFlag(RayPacket::ConstantOrigin);
-  if(normalizeRays){
+
+  Point stereo_eye[2];
+  stereo_eye[0] = (eye - (v*stereo_offset));
+  stereo_eye[1] = (eye + (v*stereo_offset));
+  
+  if(normalizeRays){    
     for(int i=0;i<rays.getSize();i++){
       RayPacket::Element& e = rays.get(i);
       Vector raydir(v*e.imageX+u*e.imageY+direction);
       raydir.normalize();
-      e.ray.set(eye, raydir);
+      e.ray.set(stereo_eye[e.whichEye], raydir);
       e.importance = 1.0;
     }
     rays.setFlag(RayPacket::NormalizedDirections);
+
+
   } else {
     for(int i=0;i<rays.getSize();i++){
       RayPacket::Element& e = rays.get(i);
+
       Vector raydir(v*e.imageX+u*e.imageY+direction);
-      e.ray.set(eye, raydir);
+
+      e.ray.set(stereo_eye[e.whichEye], raydir);
       e.importance = 1.0;
     }
+
+
   }
 }
 

Modified: branches/itanium2/Model/Cameras/PinholeCamera.h
==============================================================================
--- branches/itanium2/Model/Cameras/PinholeCamera.h     (original)
+++ branches/itanium2/Model/Cameras/PinholeCamera.h     Thu Sep 29 20:28:37 
2005
@@ -15,7 +15,7 @@
   class PinholeCamera : public Camera {
   public:
                PinholeCamera( const Point &eye_, const Point &lookat_, const 
Vector &up_, Real fov_ ) :
-                       eye( eye_ ), lookat( lookat_ ), up( up_ ), hfov( fov_ 
) { setup(); }
+                       eye( eye_ ), lookat( lookat_ ), up( up_ ), hfov( fov_ 
), stereo_offset( 0.0 ) { setup(); }
     PinholeCamera(const vector<string>& args);
     virtual ~PinholeCamera();
     virtual void makeRays(RayPacket&) const;
@@ -42,7 +42,8 @@
     Point  eye;
     Point  lookat;
     Vector up;
-    double hfov, vfov, width, height, nearZ; // x and y field of view, 
+    Real  stereo_offset;
+    Real  hfov, vfov, width, height, nearZ; // x and y field of view, 
                                             // width and height of image 
plane
                                             // distance from eye to image 
plane
     bool   normalizeRays;

Modified: branches/itanium2/Model/Groups/KDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/KDTree.cc    (original)
+++ branches/itanium2/Model/Groups/KDTree.cc    Thu Sep 29 20:28:37 2005
@@ -118,7 +118,7 @@
 
     // Insert mailbox check here.
     // if (intersectTriangle3Edge( direction, origin, tri.edge1, tri.edge2, 
tri[0], t, u, v )) {
-    if (mailbox.not_mapped( ray, triIdx )) {
+    if (mailbox.not_mapped( (RayTriangleMailbox::RayNumber)ray, triIdx )) {
       
       
       if(/*mailbox.not_mapped( ray, triIdx ) &&*/ intersect_triangle3_edge( 
&origin, &direction, &tri[0], &t, &u, &v, &tri.edge1, &tri.edge2 )) {
@@ -232,7 +232,10 @@
   Vectorf direction = ray->direction();
   
   // Keep a stack of entry and exit positions into the traversal nodes.
-       __declspec(align(128)) TravStackEntry travStack[128];
+#ifdef __ia64__
+       __declspec(align(128))
+#endif
+    TravStackEntry travStack[128];
 
        // Initialize the first two entries on the stack.
        entryPos = 0;

Modified: branches/itanium2/Model/Groups/KDTreeLoader.cc
==============================================================================
--- branches/itanium2/Model/Groups/KDTreeLoader.cc      (original)
+++ branches/itanium2/Model/Groups/KDTreeLoader.cc      Thu Sep 29 20:28:37 
2005
@@ -197,7 +197,11 @@
        
        // Allocate input buffer.
        float *rawData = new float [fileSize / 4];
-       
+
+  if (rawData == 0) {
+    std::cerr << "Could not allocate " << (fileSize/4) << " bytes." << 
std::endl;
+  }
+  
        // Allocate triangles.
        *tris = new VArray<Triangle> (nTris);
        (*tris)->setLen(nTris);

Modified: branches/itanium2/Model/Groups/RayTriangleMailbox.h
==============================================================================
--- branches/itanium2/Model/Groups/RayTriangleMailbox.h (original)
+++ branches/itanium2/Model/Groups/RayTriangleMailbox.h Thu Sep 29 20:28:37 
2005
@@ -40,10 +40,12 @@
     
////////////////////////////////////////////////////////////////////////////
     template< int SizePowerOf2 >
     class RayTriangleMailboxT {
-    private:
-      typedef Ray * RayNumber;
+    public:
+            typedef Ray * RayNumber;
       typedef int   TriangleNumber;
 
+
+    private:
       enum { Size      =  (1 << (SizePowerOf2)),
              TableMask = ~(0xffffffff << SizePowerOf2) };
 

Modified: branches/itanium2/Model/Groups/TransparentKDTree.cc
==============================================================================
--- branches/itanium2/Model/Groups/TransparentKDTree.cc (original)
+++ branches/itanium2/Model/Groups/TransparentKDTree.cc Thu Sep 29 20:28:37 
2005
@@ -277,7 +277,10 @@
   Vectorf direction = ray->direction();
   
   // Keep a stack of entry and exit positions into the traversal nodes.
-       __declspec(align(128)) TravStackEntry travStack[128];
+#ifdef __ia64__
+       __declspec(align(128))
+#endif
+    TravStackEntry travStack[128];
        
        // Initialize the first two entries on the stack.
        entryPos = 0;
@@ -362,7 +365,7 @@
                                        
                                        // Copy the normal into the scratch 
pad.
                                        // Used for shootOneRay type queries.
-                                       
e.hitInfo.scratchpad<TransparentKDTree::TransparentKDTree::ScratchPadInfo>().normal
 = 
+                                       
e.hitInfo.scratchpad<TransparentKDTree::ScratchPadInfo>().normal = 
                                                
normals[isectData.rayHitTriIndex];
                                        
                                        first_leaf = false;

Modified: branches/itanium2/StandAlone/manta.cc
==============================================================================
--- branches/itanium2/StandAlone/manta.cc       (original)
+++ branches/itanium2/StandAlone/manta.cc       Thu Sep 29 20:28:37 2005
@@ -138,6 +138,7 @@
       throw InternalError("cannot create default camera", __FILE__, __LINE__ 
);
     int xres = 512, yres = 512;
     bool channelCreated=false;
+    bool stereo = false;
     bool haveUI = false;
                
     int argc = static_cast<int>(args.size());
@@ -181,7 +182,7 @@
                                string s;
                                if(!getStringArg(i, args, s))
                                        usage(rtrt);
-                               if(!rtrt->createChannel(s, currentCamera, 
false, xres, yres)){
+                               if(!rtrt->createChannel(s, currentCamera, 
stereo, xres, yres)){
                                        cerr << "Invalid image display: " << 
s << ", available image displays are:\n";
                                        printList(cerr, 
rtrt->listImageDisplays());
                                        exit(1);
@@ -242,6 +243,9 @@
                                        cerr << "Error parsing resolution: " 
<< args[i+1] << '\n';
                                        usage(rtrt);
                                }
+      } else if(arg == "-stereo") {
+        stereo = true;
+        
       } else if(arg == "-scene"){
                                if(rtrt->haveScene())
                                        cerr << "WARNING: multiple scenes 
specified, will use last one\n";
@@ -288,7 +292,7 @@
       ui->startup();
     } 
     if(!channelCreated){
-      rtrt->createChannel("opengl", currentCamera, false, xres, yres);
+      rtrt->createChannel("opengl", currentCamera, stereo, xres, yres);
     }
     if(!rtrt->haveScene()){
       rtrt->setScene(createDefaultScene());




  • [MANTA] r585 - in branches/itanium2: . Engine/Control Engine/Display Engine/PixelSamplers Interface Model/Cameras Model/Groups StandAlone, abe, 09/29/2005

Archive powered by MHonArc 2.6.16.

Top of page