Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1624 - in trunk: Core/Geometry Interface Model/Materials Model/Primitives Model/Readers scenes/galileo


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1624 - in trunk: Core/Geometry Interface Model/Materials Model/Primitives Model/Readers scenes/galileo
  • Date: Fri, 10 Aug 2007 11:49:41 -0600 (MDT)

Author: bigler
Date: Fri Aug 10 11:49:39 2007
New Revision: 1624

Modified:
   trunk/Core/Geometry/Vector.h
   trunk/Interface/RayPacket.cc
   trunk/Interface/RayPacket.h
   trunk/Model/Materials/OrenNayar.cc
   trunk/Model/Primitives/GridSpheres.cc
   trunk/Model/Primitives/WaldTriangle.cc
   trunk/Model/Readers/IW.cc
   trunk/Model/Readers/V3C1.cc
   trunk/scenes/galileo/grparse.y
Log:
Core/Geometry/Vector.h

  Inline all vector code (operator!=).

Interface/RayPacket.cc
Interface/RayPacket.h

  Remove side[].  After looking at this more, I think this is a
  dangerous idea.

Model/Materials/OrenNayar.cc

  Fix code to work without use of RayPacket::side[].

Model/Primitives/GridSpheres.cc
Model/Primitives/WaldTriangle.cc
Model/Readers/IW.cc
Model/Readers/V3C1.cc
scenes/galileo/grparse.y

  Warning bashing.


Modified: trunk/Core/Geometry/Vector.h
==============================================================================
--- trunk/Core/Geometry/Vector.h        (original)
+++ trunk/Core/Geometry/Vector.h        Fri Aug 10 11:49:39 2007
@@ -299,7 +299,9 @@
     }
 
     bool operator!=(const Vector& right) const {
-      return !(*this == right); 
+      return (data[0] != right.data[0] &&
+              data[1] != right.data[1] &&
+              data[2] != right.data[2]);
     }
 
     Real length() const {

Modified: trunk/Interface/RayPacket.cc
==============================================================================
--- trunk/Interface/RayPacket.cc        (original)
+++ trunk/Interface/RayPacket.cc        Fri Aug 10 11:49:39 2007
@@ -182,14 +182,10 @@
   for(int i = rayBegin; i < rayEnd; ++i) {
     // Compute the dot product
     Vector normal(getNormal(i));
-    side[i] = Dot(normal, getDirection(i));
-    data->side[i]=side[i];
-    if (side[i] <= 0)
+    if (Dot(normal, getDirection(i)) <= 0) {
       setFFNormal(i,  normal);
-    else {
+    } else {
       setFFNormal(i, -normal);
-      side[i]=-side[i];
-      data->side[i]=side[i];
     }
   }
 

Modified: trunk/Interface/RayPacket.h
==============================================================================
--- trunk/Interface/RayPacket.h (original)
+++ trunk/Interface/RayPacket.h Fri Aug 10 11:49:39 2007
@@ -97,7 +97,6 @@
     MANTA_ALIGN(16) Real direction[3][MaxSize];
     MANTA_ALIGN(16) Real inverseDirection[3][MaxSize];
     MANTA_ALIGN(16) Real minT[MaxSize];
-               MANTA_ALIGN(16) Real side[MaxSize]; //To store dot product 
values
 
     MANTA_ALIGN(16) Real image[2][MaxSize];
     MANTA_ALIGN(16) Real normal[3][MaxSize];
@@ -153,6 +152,8 @@
       HaveCornerRays        = 0x4000,
 
       DebugPacket           = 0x8000
+
+      // Use 8 digits to represent new ones (i.e. 0x00010000)
     };
 
     enum PacketShape {
@@ -162,14 +163,17 @@
     // Create a "toplevel" raypacket.  You need to call resetHits or
     // resetHit for every data element in the ray packet before you
     // start intersecting.  This will initialize minT and hitMatl.
-    RayPacket(RayPacketData& data, PacketShape shape, int rayBegin, int 
rayEnd, int depth, int flags)
-    : data(&data), shape(shape), rayBegin(rayBegin), rayEnd(rayEnd), 
depth(depth), flags(flags)
+    RayPacket(RayPacketData& data, PacketShape shape,
+              int rayBegin, int rayEnd, int depth, int flags)
+    : data(&data), shape(shape), rayBegin(rayBegin), rayEnd(rayEnd),
+      depth(depth), flags(flags)
     {
     }
 
     // Create a subset of another raypacket
     RayPacket(RayPacket& parent, int rayBegin, int rayEnd)
-    : data(parent.data), rayBegin(rayBegin), rayEnd(rayEnd), 
depth(parent.depth), flags(parent.flags)
+    : data(parent.data), rayBegin(rayBegin), rayEnd(rayEnd),
+      depth(parent.depth), flags(parent.flags)
     {
       shape = parent.shape;
       if(shape == SquarePacket){
@@ -818,7 +822,6 @@
     int rayEnd;
     int depth;
     int flags;
-    Real side[MaxSize]; //To store dot product values
   };
 
   typedef MANTA_ALIGN(16) Color::ComponentType 
ColorArray[Color::NumComponents][RayPacket::MaxSize];

Modified: trunk/Model/Materials/OrenNayar.cc
==============================================================================
--- trunk/Model/Materials/OrenNayar.cc  (original)
+++ trunk/Model/Materials/OrenNayar.cc  Fri Aug 10 11:49:39 2007
@@ -78,7 +78,6 @@
   // Compute normals
   
   rays.computeFFNormals(context);
-  Real* cos_theta=rays.side; //To store dot product values
   
   // Compute ambient contributions for all rays
   MANTA_ALIGN(16) ColorArray totalLight;
@@ -105,7 +104,7 @@
         Vector shadowdir = shadowRays.getDirection(i);
         ColorComponent cos_phi = Dot(shadowdir, normal);
         Color light = shadowRays.getColor(i);
-        Real theta=acos(cos_theta[i]);
+        Real theta=acos(Dot(rays.getNormal(i), rays.getDirection(i)));
         Real phi=acos(cos_phi);
     
         Real alpha, beta;

Modified: trunk/Model/Primitives/GridSpheres.cc
==============================================================================
--- trunk/Model/Primitives/GridSpheres.cc       (original)
+++ trunk/Model/Primitives/GridSpheres.cc       Fri Aug 10 11:49:39 2007
@@ -370,7 +370,7 @@
 
 #ifdef USE_OPTIMIZED_FCNS
   // Determine appropriate sphere intersection function for this ray packet
-  SphereIntersectFcn intersectSphere;
+  SphereIntersectFcn intersectSphere = &GridSpheres::intersectSphereDefault;
 
   switch (rays.getAllFlags() & (RayPacket::ConstantOrigin |
                                 RayPacket::NormalizedDirections)) {

Modified: trunk/Model/Primitives/WaldTriangle.cc
==============================================================================
--- trunk/Model/Primitives/WaldTriangle.cc      (original)
+++ trunk/Model/Primitives/WaldTriangle.cc      Fri Aug 10 11:49:39 2007
@@ -231,7 +231,11 @@
     const sse_t sse_c_nv = set4(c_nv);
     const sse_t sse_c_d  = set4(c_d);
 
-    sse_t org_k, org_ku, org_kv, f0;
+    // Initialized to quiet warnings
+    sse_t org_k  = zero4();
+    sse_t org_ku = zero4();
+    sse_t org_kv = zero4();
+    sse_t f0     = zero4();
     if (HasCommonOrigin) {
       org_k  = set4(data->origin[axis][ray_begin]);
       org_ku = set4(data->origin[ku][ray_begin]);
@@ -278,7 +282,10 @@
       const Real* const dir_ku = data->direction[ku];
       const Real* const dir_kv = data->direction[kv];
 
-      float org_k, org_ku, org_kv, f0;
+      float org_k  = 0;
+      float org_ku = 0;
+      float org_kv = 0;
+      float f0     = 0;
 
       const bool RaysConstantOrigin = rays.getAllFlags() & 
RayPacket::ConstantOrigin;
 
@@ -385,7 +392,11 @@
       const Real* const dir_ku = data->direction[ku];
       const Real* const dir_kv = data->direction[kv];
 
-      float org_k, org_ku, org_kv, f0;
+      // Initialized to quiet warnings
+      float org_k  = 0;
+      float org_ku = 0;
+      float org_kv = 0;
+      float f0     = 0;
 
       const bool RaysConstantOrigin = rays.getAllFlags() & 
RayPacket::ConstantOrigin;
 

Modified: trunk/Model/Readers/IW.cc
==============================================================================
--- trunk/Model/Readers/IW.cc   (original)
+++ trunk/Model/Readers/IW.cc   Fri Aug 10 11:49:39 2007
@@ -249,7 +249,7 @@
 //     fprintf (stderr, "line(%u): %s\n", bline_len, bline);
     // Check the first token
     char token[2];
-    int num = sscanf(line.c_str(), "%1s", token);
+    //    int num = sscanf(line.c_str(), "%1s", token);
     //    fprintf(stderr, "num = %d, token = %s\n", num, token);
     if (strcmp(token, "N") == 0) {
       num_nodes ++;
@@ -320,7 +320,7 @@
         num_empty_nodes++;
       }
     } else {
-      fprintf(stderr, "Unrecongnized token (%c)\n", token);
+      fprintf(stderr, "Unrecongnized token (%c)\n", token[0]);
     }
     getline(bspf, line);
   }

Modified: trunk/Model/Readers/V3C1.cc
==============================================================================
--- trunk/Model/Readers/V3C1.cc (original)
+++ trunk/Model/Readers/V3C1.cc Fri Aug 10 11:49:39 2007
@@ -99,7 +99,7 @@
   // Check endianness and flip if necessary.
   if (is_big_endian()) {
 
-    for (int i=0;i<array_size;++i) {
+    for (size_t i=0;i<array_size;++i) {
       array[i] = endian_swap( array[i] );
     }
   }
@@ -125,7 +125,7 @@
       long long toRead = remaining>chunkSize?chunkSize:remaining;
       long long result;
       if ((result = fread(ptr, toRead, 1, stream)) != 1) {
-        fprintf(stderr, "read error: %ld != %ld",
+        fprintf(stderr, "read error: %lld != %lld",
                 toRead, result);
         return 0;
       }

Modified: trunk/scenes/galileo/grparse.y
==============================================================================
--- trunk/scenes/galileo/grparse.y      (original)
+++ trunk/scenes/galileo/grparse.y      Fri Aug 10 11:49:39 2007
@@ -596,10 +596,10 @@
                   NUM NUM NUM NUM
                   NUM NUM NUM NUM
 {
-    float trans[16] = { $2,  $3,  $4,  $5,
-                        $6,  $7,  $8,  $9,
-                       $10, $11, $12, $13,
-                       $14, $15, $16, $17};
+/*   float trans[16] = { $2,  $3,  $4,  $5, */
+/*                       $6,  $7,  $8,  $9, */
+/*                       $10, $11, $12, $13, */
+/*                       $14, $15, $16, $17}; */
 #if 0
     grConcatTransform(trans);
 #endif
@@ -819,7 +819,7 @@
   if (material != materials.end()) {
     current_material = (*material).second;
   } else {
-    fprintf(stderr, "Can't find named material s()", $2);
+    fprintf(stderr, "Can't find named material %s", $2);
     exit(2);
   }
 }
@@ -866,10 +866,10 @@
             NUM NUM NUM NUM
             NUM NUM NUM NUM
 {
-    float trans[16] = { $2,  $3,  $4,  $5,
-                        $6,  $7,  $8,  $9,
-                       $10, $11, $12, $13,
-                       $14, $15, $16, $17};
+/*   float trans[16] = { $2,  $3,  $4,  $5, */
+/*                       $6,  $7,  $8,  $9, */
+/*                       $10, $11, $12, $13, */
+/*                       $14, $15, $16, $17}; */
 #if 0
     grTransform(trans);
 #endif




  • [MANTA] r1624 - in trunk: Core/Geometry Interface Model/Materials Model/Primitives Model/Readers scenes/galileo, bigler, 08/10/2007

Archive powered by MHonArc 2.6.16.

Top of page