Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2329 - in trunk: Core/Geometry Core/Util Engine/Renderers Model/Groups Model/Groups/BSP Model/Groups/private Model/Primitives include


Chronological Thread 
  • From: "Thiago Ize" < >
  • To:
  • Subject: [Manta] r2329 - in trunk: Core/Geometry Core/Util Engine/Renderers Model/Groups Model/Groups/BSP Model/Groups/private Model/Primitives include
  • Date: Thu, 18 Sep 2008 16:56:40 -0600 (MDT)

Author: thiago
Date: Thu Sep 18 16:56:38 2008
New Revision: 2329

Modified:
   trunk/Core/Geometry/AffineTransform.cc
   trunk/Core/Geometry/AffineTransformT.cc
   trunk/Core/Util/Args.cc
   trunk/Engine/Renderers/NPREdges.cc
   trunk/Model/Groups/BSP/BSH.cc
   trunk/Model/Groups/BSP/aip.h
   trunk/Model/Groups/KDTree.cc
   trunk/Model/Groups/RecursiveGrid.cc
   trunk/Model/Groups/RecursiveGrid.h
   trunk/Model/Groups/private/CGT.cc
   trunk/Model/Primitives/IsosurfaceOctreeVolume.h
   trunk/include/CMakeLists.txt
Log:
Core/Geometry/AffineTransform.cc
Core/Geometry/AffineTransformT.cc :
  -Fix out of bounds array access.

Core/Util/Args.cc:
  -Fix bug where order of tests in argument parsing was wrong. This
   went undetected for so long because it's unlikely that arguments
   would contain new lines or tabs.

Model/Groups/BSP/aip.h
Model/Groups/BSP/BSH.cc
Model/Groups/KDTree.cc
Model/Groups/private/CGT.cc
Model/Primitives/IsosurfaceOctreeVolume.h
Engine/Renderers/NPREdges.cc :
  -Quite gcc 4.3 compiler warnings. Code was technically fine though.



Modified: trunk/Core/Geometry/AffineTransform.cc
==============================================================================
--- trunk/Core/Geometry/AffineTransform.cc      (original)
+++ trunk/Core/Geometry/AffineTransform.cc      Thu Sep 18 16:56:38 2008
@@ -393,7 +393,7 @@
       result[i]  = mat[0][i] * point[0];
       result[i] += mat[1][i] * point[1];
       result[i] += mat[2][i] * point[2];
-      result[i] += mat[3][i]; // point[3] == 1
+      //mat[3] (bottom row) is (0 0 0 1)
     }
     return result;
   }

Modified: trunk/Core/Geometry/AffineTransformT.cc
==============================================================================
--- trunk/Core/Geometry/AffineTransformT.cc     (original)
+++ trunk/Core/Geometry/AffineTransformT.cc     Thu Sep 18 16:56:38 2008
@@ -387,7 +387,7 @@
       result[i]  = mat[0][i] * point[0];
       result[i] += mat[1][i] * point[1];
       result[i] += mat[2][i] * point[2];
-      result[i] += mat[3][i]; // point[3] == 1
+      //mat[3] (bottom row) is (0 0 0 1)
     }
     return result;
   }

Modified: trunk/Core/Util/Args.cc
==============================================================================
--- trunk/Core/Util/Args.cc     (original)
+++ trunk/Core/Util/Args.cc     Thu Sep 18 16:56:38 2008
@@ -126,7 +126,7 @@
     int start = 0;
 
     // Skip leading white space
-    while(start < len && spec[start] == ' ' || spec[start] == '\t' || 
spec[start] == '\n')
+    while(start < len && (spec[start] == ' ' || spec[start] == '\t' || 
spec[start] == '\n'))
       start++;
     int end = start;
 
@@ -135,7 +135,7 @@
       end++;
     end--;
     // Back up to find where name starts
-    while(end > 0 && spec[end] == ' ' || spec[end] == '\t' || spec[end] == 
'\n')
+    while(end > 0 && (spec[end] == ' ' || spec[end] == '\t' || spec[end] == 
'\n'))
       end--;
     end++;
     // Name is the stuff after the whitespace and before '(' (if it exists).
@@ -160,13 +160,13 @@
     }
     len--;
     while(paren < len){
-      while(paren < len && spec[paren] == ' ' || spec[paren] == '\t' || 
spec[paren] == '\n')
+      while(paren < len && (spec[paren] == ' ' || spec[paren] == '\t' || 
spec[paren] == '\n'))
         paren++;
       int to = paren+1;
-      while(to < len && spec[to] != ' ' && spec[to] != '\t' && spec[to] != 
'\n' && spec[to] != '(')
+      while(to < len && (spec[to] != ' ' && spec[to] != '\t' && spec[to] != 
'\n' && spec[to] != '('))
         to++;
       int to2 = to;
-      while(to2 < len && spec[to2] == ' ' || spec[to2] == '\t' || spec[to2] 
== '\n')
+      while(to2 < len && (spec[to2] == ' ' || spec[to2] == '\t' || spec[to2] 
== '\n'))
         to2++;
       if(spec[to2] == '('){
         // Skip to the matching paren
@@ -204,8 +204,8 @@
     while(start < len) {
       if (arg_debug) cout << "start = "<<start<<endl;
       // Skip leading white space
-      while(start < len && input[start] == ' ' || input[start] == '\t' ||
-            input[start] == '\n')
+      while(start < len && (input[start] == ' ' || input[start] == '\t' ||
+                            input[start] == '\n'))
         start++;
       int end = start;
       if (arg_debug) cout << "After whitespace skip, start = "<<start<<", 
end = "<<end<<endl;

Modified: trunk/Engine/Renderers/NPREdges.cc
==============================================================================
--- trunk/Engine/Renderers/NPREdges.cc  (original)
+++ trunk/Engine/Renderers/NPREdges.cc  Thu Sep 18 16:56:38 2008
@@ -41,7 +41,7 @@
         throw IllegalArgument("NPREdges -width", i, args);
     }
     else if(arg == "-normal-threshold"){
-      Real val;
+      Real val=0;
       if(!getArg(i, args, val))
         throw IllegalArgument("NPREdges -normal-threshold", i, args);
 

Modified: trunk/Model/Groups/BSP/BSH.cc
==============================================================================
--- trunk/Model/Groups/BSP/BSH.cc       (original)
+++ trunk/Model/Groups/BSP/BSH.cc       Thu Sep 18 16:56:38 2008
@@ -299,7 +299,7 @@
       }
       else
         negSide[0].tri[negCount++] = p;
-    else if (p_d > 0)
+    else if (p_d > 0) {
       if (posCount == 3) {
         posSide[1].tri[0] = posSide[0].tri[0];
         posSide[1].tri[1] = posSide[0].tri[2];
@@ -308,6 +308,7 @@
       }
       else
         posSide[0].tri[posCount++] = p;
+    }
     s=p;
   }
 

Modified: trunk/Model/Groups/BSP/aip.h
==============================================================================
--- trunk/Model/Groups/BSP/aip.h        (original)
+++ trunk/Model/Groups/BSP/aip.h        Thu Sep 18 16:56:38 2008
@@ -146,7 +146,7 @@
     while (c-- > 0) {
       if (Q[c].rx.mn < p.x && p.x < Q[c].rx.mx) {
         bool sgn = 0 < area(p, Q[c].ip, Q[c + 1].ip);
-        s += (sgn != Q[c].ip.x < Q[c + 1].ip.x) ? 0 : (sgn ? -1 : 1);
+        s += (sgn != (Q[c].ip.x < Q[c + 1].ip.x)) ? 0 : (sgn ? -1 : 1);
       }
     }
     for (int j = 0; j < cP; ++j) {
@@ -189,11 +189,11 @@
           hp a1 = -area(ipa[j].ip, ipb[k].ip, ipb[k + 1].ip);
           hp a2 = area(ipa[j + 1].ip, ipb[k].ip, ipb[k + 1].ip);
           bool o = a1 < 0;
-          if (o == a2 < 0) {
+          if (o == (a2 < 0)) {
             hp a3 = area(ipb[k].ip, ipa[j].ip, ipa[j + 1].ip);
             hp a4 = -area(ipb[k + 1].ip, ipa[j].ip,
                             ipa[j + 1].ip);
-            if (a3 < 0 == a4 < 0) {
+            if ((a3 < 0) == (a4 < 0)) {
               if (o)
                 cross(ipa[j], ipa[j + 1], ipb[k], ipb[k + 1],
                       a1, a2, a3, a4);

Modified: trunk/Model/Groups/KDTree.cc
==============================================================================
--- trunk/Model/Groups/KDTree.cc        (original)
+++ trunk/Model/Groups/KDTree.cc        Thu Sep 18 16:56:38 2008
@@ -113,7 +113,7 @@
 
 bool operator<(const Event &a, const Event &b)
 {
-  return a.pos < b.pos || a.pos == b.pos && a.type < b.type;
+  return a.pos < b.pos || (a.pos == b.pos && a.type < b.type);
 }
 
 
@@ -292,7 +292,7 @@
     {
       switch (event[bestDim][i].type) {
       case Event::tri_planar:
-        if (event[bestDim][i].pos == bestSplit && bestCommonToTheLeft ||
+        if ((event[bestDim][i].pos == bestSplit && bestCommonToTheLeft) ||
             event[bestDim][i].pos <  bestSplit)
           is_r[event[bestDim][i].tri] = false;
         else

Modified: trunk/Model/Groups/RecursiveGrid.cc
==============================================================================
--- trunk/Model/Groups/RecursiveGrid.cc (original)
+++ trunk/Model/Groups/RecursiveGrid.cc Thu Sep 18 16:56:38 2008
@@ -50,6 +50,13 @@
   subGridList.resize(0,0,0,0);
 }
 
+void RecursiveGrid::transformToLattice(const Vector& v,
+                                      int& x, int& y, int& z) const
+{
+  const Vector s = (v-min)*inv_cellsize;
+  x = Floor(s.x()); y = Floor(s.y()); z = Floor(s.z());
+}
+
 void RecursiveGrid::transformToLattice(const BBox& box,
                                       int& sx, int& sy, int& sz,
                                       int& ex, int& ey, int& ez) const

Modified: trunk/Model/Groups/RecursiveGrid.h
==============================================================================
--- trunk/Model/Groups/RecursiveGrid.h  (original)
+++ trunk/Model/Groups/RecursiveGrid.h  Thu Sep 18 16:56:38 2008
@@ -73,8 +73,10 @@
 
     int numLevels;
 
+    void transformToLattice(const Vector& v, int& x, int& y, int& z) const;
     void transformToLattice(const BBox& box,
-                          int& sx, int& sy, int& sz, int& ex, int& ey, int& 
ez) const;
+                            int& sx, int& sy, int& sz,
+                            int& ex, int& ey, int& ez) const;
 
   };
 }

Modified: trunk/Model/Groups/private/CGT.cc
==============================================================================
--- trunk/Model/Groups/private/CGT.cc   (original)
+++ trunk/Model/Groups/private/CGT.cc   Thu Sep 18 16:56:38 2008
@@ -597,7 +597,7 @@
         s_furthest_k = add4(load44(&ray.getOrigin(b-4,K)),
                             mul4(load44(&ray.getMinT(b-4)),
                                  load44(&ray.getDirection(b-4,K))));
-        for(int j=0; j<i&4; ++j)
+        for(int j=0; j<(i&4); ++j)
           ((float4&)s_furthest_k)[j] = ((float4&)s_furthest_k)[3];
       }
       // Do the aligned in the middle
@@ -636,7 +636,7 @@
         s_furthest_k = add4(load44(&ray.getOrigin(b-4,K)),
                             mul4(load44(&ray.getMinT(b-4)),
                                  load44(&ray.getDirection(b-4,K))));
-        for(int j=0; j<i&4; ++j)
+        for(int j=0; j<(i&4); ++j)
           ((float4&)s_furthest_k)[j] = ((float4&)s_furthest_k)[3];
       }
       // Do the aligned in the middle
@@ -1018,7 +1018,7 @@
               s_furthest_k = add4(load44(&ray.getOrigin(b-4,K)),
                                   mul4(load44(&ray.getMinT(b-4)),
                                        load44(&ray.getDirection(b-4,K))));
-              for(int j=0; j<i&4; ++j)
+              for(int j=0; j<(i&4); ++j)
                 ((float4&)s_furthest_k)[j] = ((float4&)s_furthest_k)[3];
             }
             // Do the aligned in the middle
@@ -1056,7 +1056,7 @@
               s_furthest_k = add4(load44(&ray.getOrigin(b-4,K)),
                                   mul4(load44(&ray.getMinT(b-4)),
                                        load44(&ray.getDirection(b-4,K))));
-              for(int j=0; j<i&4; ++j)
+              for(int j=0; j<(i&4); ++j)
                 ((float4&)s_furthest_k)[j] = ((float4&)s_furthest_k)[3];
             }
             // Do the aligned in the middle

Modified: trunk/Model/Primitives/IsosurfaceOctreeVolume.h
==============================================================================
--- trunk/Model/Primitives/IsosurfaceOctreeVolume.h     (original)
+++ trunk/Model/Primitives/IsosurfaceOctreeVolume.h     Thu Sep 18 16:56:38 
2008
@@ -109,7 +109,7 @@
                     boxmax[axis] = set4(max[axis]);
                 }
 
-                for(char smd=first; smd<=last; smd++)
+                for(int smd=first; smd<=last; smd++)
                 {
                     sse_t t0 = zero4();
                     sse_t t1 = srp.minT[smd];
@@ -158,7 +158,7 @@
                     boxmax[axis] = set4(max[axis]);
                 }
 
-                for(char smd=last; smd>=first; smd--)
+                for(int smd=last; smd>=first; smd--)
                 {
                     sse_t t0 = zero4();
                     sse_t t1 = srp.minT[smd];
@@ -214,7 +214,7 @@
 
                 newlast = first;
                 newfirst = last+1;
-                for(char smd=first; smd<=last; smd++)
+                for(int smd=first; smd<=last; smd++)
                 {
                     tenter[smd] = zero4();
                     texit[smd] = srp.minT[smd];

Modified: trunk/include/CMakeLists.txt
==============================================================================
--- trunk/include/CMakeLists.txt        (original)
+++ trunk/include/CMakeLists.txt        Thu Sep 18 16:56:38 2008
@@ -115,7 +115,7 @@
 ## Configure DynBVH_Parameters.h
 
 SET(MANTA_USE_DYNBVH_PORTS OFF CACHE BOOL "Use templated DynBVH Code")
-SET(MANTA_USE_DYNBVH_APPROXIMATE ON CACHE BOOL "Use approximate DynBVH 
Build")
+SET(MANTA_USE_DYNBVH_APPROXIMATE OFF CACHE BOOL "Use approximate DynBVH 
Build")
 
 IF(MANTA_USE_DYNBVH_PORTS)
   SET(MANTA_USE_DYNBVH_PORTS_DEF "1")


  • [Manta] r2329 - in trunk: Core/Geometry Core/Util Engine/Renderers Model/Groups Model/Groups/BSP Model/Groups/private Model/Primitives include, Thiago Ize, 09/18/2008

Archive powered by MHonArc 2.6.16.

Top of page