Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r826 - in branches/vertical: Interface Model/Primitives


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r826 - in branches/vertical: Interface Model/Primitives
  • Date: Thu, 5 Jan 2006 15:44:01 -0700 (MST)

Author: bigler
Date: Thu Jan  5 15:44:00 2006
New Revision: 826

Modified:
   branches/vertical/Interface/RayPacket.h
   branches/vertical/Model/Primitives/Parallelogram.cc
Log:

Interface/RayPacket.h

  Changed order of const to make it more clear that hitPrim is an
  array of pointers to const Primitives and such.

  Fixed precedence for evaluating the HaveUnitNormals flag.

Model/Primitives/Parallelogram.cc

  Set the HaveUnitNormals flag in computeNormal.


Modified: branches/vertical/Interface/RayPacket.h
==============================================================================
--- branches/vertical/Interface/RayPacket.h     (original)
+++ branches/vertical/Interface/RayPacket.h     Thu Jan  5 15:44:00 2006
@@ -29,9 +29,9 @@
       }
 
     // Pointer-based arrays
-    const Primitive* hitPrim[Size];
-    const Material* hitMatl[Size];
-    const TexCoordMapper* hitTex[Size];
+    Primitive const* hitPrim[Size];
+    Material const* hitMatl[Size];
+    TexCoordMapper const* hitTex[Size];
 
     // Real-based arrays
     Real image[2][Size];
@@ -428,7 +428,8 @@
           tend++;
         RayPacket subPacket(*this, i, tend);
         prim->computeNormal(context, subPacket);
-        if (subPacket.flags & HaveUnitNormals == 0) {
+        // BTW, == has higher precedence than &, so mind the ()'s.
+        if ((subPacket.flags & HaveUnitNormals) == 0) {
           // Normalize the normals if they haven't been.
           for(int s=i;s<tend;++s){
             Real sum = 0;

Modified: branches/vertical/Model/Primitives/Parallelogram.cc
==============================================================================
--- branches/vertical/Model/Primitives/Parallelogram.cc (original)
+++ branches/vertical/Model/Primitives/Parallelogram.cc Thu Jan  5 15:44:00 
2006
@@ -38,6 +38,8 @@
 {
   for(int i=rays.begin();i<rays.end();i++)
     rays.setNormal(i, normal);
+  // We know the normal is unit length, so let the RayPacket know too.
+  rays.setFlag(RayPacket::HaveUnitNormals);
 }
 
 void Parallelogram::intersect(const RenderContext&, RayPacket& rays) const




  • [MANTA] r826 - in branches/vertical: Interface Model/Primitives, bigler, 01/05/2006

Archive powered by MHonArc 2.6.16.

Top of page