Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r824 - branches/vertical/Model/Instances


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r824 - branches/vertical/Model/Instances
  • Date: Thu, 5 Jan 2006 13:41:01 -0700 (MST)

Author: sparker
Date: Thu Jan  5 13:41:01 2006
New Revision: 824

Modified:
   branches/vertical/Model/Instances/InstanceRST.cc
   branches/vertical/Model/Instances/InstanceRT.cc
   branches/vertical/Model/Instances/InstanceST.cc
   branches/vertical/Model/Instances/InstanceT.cc
Log:
Simplify logic for propogating unit normals through isntances


Modified: branches/vertical/Model/Instances/InstanceRST.cc
==============================================================================
--- branches/vertical/Model/Instances/InstanceRST.cc    (original)
+++ branches/vertical/Model/Instances/InstanceRST.cc    Thu Jan  5 13:41:01 
2006
@@ -115,8 +115,7 @@
 
   // Try to create a ray packet that all use the same child primitive
   // to compute normals.
-  bool HaveUnitNormals = true; // Used to pass along if the normals
-                               // were normalized.
+  int allUnitNormals = RayPacket::HaveUnitNormals;
   for(int i=rays.begin();i<rays.end();){
     const Primitive* prim = rays.scratchpad<MPT>(i).primitive;
     int end = i+1;
@@ -126,11 +125,11 @@
     prim->computeNormal(context, subPacket);
     // If we ever encounter a case where the normals aren't normalized
     // turn the flag off.
-    HaveUnitNormals &= subPacket.getFlag(RayPacket::HaveUnitNormals);
+    allUnitNormals &= subPacket.getAllFlags();
     i = end;
   }
   // If all the normals were unit length set the parent RayPacket's flag.
-  if (HaveUnitNormals) rays.setFlag(RayPacket::HaveUnitNormals);
+  rays.setFlag(allUnitNormals);
 
   // Put the rays and minT back, scale normal
   for(int i=rays.begin();i<rays.end();i++){

Modified: branches/vertical/Model/Instances/InstanceRT.cc
==============================================================================
--- branches/vertical/Model/Instances/InstanceRT.cc     (original)
+++ branches/vertical/Model/Instances/InstanceRT.cc     Thu Jan  5 13:41:01 
2006
@@ -108,8 +108,7 @@
   }
   rays.resetFlag(RayPacket::HaveHitPositions);
 
-  bool HaveUnitNormals = true; // Used to pass along if the normals
-                               // were normalized.
+  int allUnitNormals = RayPacket::HaveUnitNormals;
   for(int i=rays.begin();i<rays.end();){
     const Primitive* prim = rays.scratchpad<MPT>(i).primitive;
     int end = i+1;
@@ -119,11 +118,11 @@
     prim->computeNormal(context, subPacket);
     // If we ever encounter a case where the normals aren't normalized
     // turn the flag off.
-    HaveUnitNormals &= subPacket.getFlag(RayPacket::HaveUnitNormals);
+    allUnitNormals &= subPacket.getAllFlags();
     i = end;
   }
   // If all the normals were unit length set the parent RayPacket's flag.
-  if (HaveUnitNormals) rays.setFlag(RayPacket::HaveUnitNormals);
+  rays.setFlag(allUnitNormals);
 
   // Put the rays back and fix the normals
   for(int i=rays.begin();i<rays.end();i++){

Modified: branches/vertical/Model/Instances/InstanceST.cc
==============================================================================
--- branches/vertical/Model/Instances/InstanceST.cc     (original)
+++ branches/vertical/Model/Instances/InstanceST.cc     Thu Jan  5 13:41:01 
2006
@@ -148,8 +148,7 @@
   }
   rays.resetFlag(RayPacket::HaveHitPositions);
 
-  bool HaveUnitNormals = true; // Used to pass along if the normals
-                               // were normalized.
+  int allUnitNormals = RayPacket::HaveUnitNormals;
   for(int i=rays.begin();i<rays.end();){
     const Primitive* prim = rays.scratchpad<MPT>(i).primitive;
     int end = i+1;
@@ -159,10 +158,9 @@
     prim->computeNormal(context, subPacket);
     // If we ever encounter a case where the normals aren't normalized
     // turn the flag off.
-    HaveUnitNormals &= subPacket.getFlag(RayPacket::HaveUnitNormals);
+    allUnitNormals &= subPacket.getAllFlags();
     i = end;
-  }
-  
+  }  
   if(uniform_scale){
     // Put the origins and minT back
     for(int i=rays.begin();i<rays.end();i++){
@@ -170,7 +168,7 @@
       rays.overrideMinT(i, old_minT[i]);
     }
     // If all the normals were unit length set the parent RayPacket's flag.
-    if (HaveUnitNormals) rays.setFlag(RayPacket::HaveUnitNormals);
+    rays.setFlag(allUnitNormals);
   } else {
     // Put the origins and minT back, scale normal
     for(int i=rays.begin();i<rays.end();i++){

Modified: branches/vertical/Model/Instances/InstanceT.cc
==============================================================================
--- branches/vertical/Model/Instances/InstanceT.cc      (original)
+++ branches/vertical/Model/Instances/InstanceT.cc      Thu Jan  5 13:41:01 
2006
@@ -75,8 +75,7 @@
   }
   rays.resetFlag(RayPacket::HaveHitPositions);
 
-  bool HaveUnitNormals = true; // Used to pass along if the normals
-                               // were normalized.
+  int allUnitNormals = RayPacket::HaveUnitNormals;
   for(int i=rays.begin();i<rays.end();){
     const Primitive* prim = rays.scratchpad<MPT>(i).primitive;
     int end = i+1;
@@ -86,11 +85,11 @@
     prim->computeNormal(context, subPacket);
     // If we ever encounter a case where the normals aren't normalized
     // turn the flag off.
-    HaveUnitNormals &= subPacket.getFlag(RayPacket::HaveUnitNormals);
+    allUnitNormals &= subPacket.getAllFlags();
     i = end;
   }
   // If all the normals were unit length set the parent RayPacket's flag.
-  if (HaveUnitNormals) rays.setFlag(RayPacket::HaveUnitNormals);
+  rays.setFlag(allUnitNormals);
 
   // Put the origins back
   for(int i=rays.begin();i<rays.end();i++){




  • [MANTA] r824 - branches/vertical/Model/Instances, sparker, 01/05/2006

Archive powered by MHonArc 2.6.16.

Top of page