Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2087 - in trunk: Engine/Renderers Model/Primitives


Chronological Thread 
  • From: roni@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2087 - in trunk: Engine/Renderers Model/Primitives
  • Date: Mon, 18 Feb 2008 16:28:43 -0700 (MST)

Author: roni
Date: Mon Feb 18 16:28:42 2008
New Revision: 2087

Modified:
   trunk/Engine/Renderers/NPREdges.cc
   trunk/Model/Primitives/ValuePrimitive.h
Log:
Model/Primitives/ValuePrimitive.h:
  -Added accessors to pull out the hidden primitive.

Engine/Renderers/NPREdges.cc:
  -Added test for ValuePrimitive containing a creased primitive type.
   This is not very robust at all- I'm not sure how to check whether a
   type is a ValuePrimitive<T> for any type T, for example.  I also
   need to check Instances for whether they are creasable types.


Modified: trunk/Engine/Renderers/NPREdges.cc
==============================================================================
--- trunk/Engine/Renderers/NPREdges.cc  (original)
+++ trunk/Engine/Renderers/NPREdges.cc  Mon Feb 18 16:28:42 2008
@@ -11,6 +11,7 @@
 #include <Interface/Scene.h>
 #include <Model/Primitives/Cube.h>
 #include <Model/Primitives/QuadFacedHexahedron.h>
+#include <Model/Primitives/ValuePrimitive.h>
 
 #include <iostream>
 using namespace std;
@@ -226,9 +227,24 @@
         for(int k=i; k<j; k++){
           // TODO(choudhury): check if the primitive is an instance of
           // one of the creased-primitive types.
-          if(!(typeid(*rays.getHitPrimitive(k)) == typeid(Cube) || 
typeid(*rays.getHitPrimitive(k)) == typeid(QuadFacedHexahedron)))
+          const Primitive *hitprim = rays.getHitPrimitive(k);
+
+          if(typeid(*hitprim) == typeid(ValuePrimitive<double>)){
+            const Primitive *prim = dynamic_cast<const 
ValuePrimitive<double> *>(hitprim)->getPrimitive();
+            if(!(typeid(*prim) == typeid(Cube) ||
+                 typeid(*prim) == typeid(QuadFacedHexahedron))){
+
+              std::cout << "ValuePrimitive: " << typeid(*prim).name() << 
std::endl;
+              continue;
+            }
+          }
+          else if(!(typeid(*hitprim) == typeid(Cube) ||
+               typeid(*hitprim) == typeid(QuadFacedHexahedron))){
+            std::cout << "Regular Primitive: " << typeid(*hitprim).name() << 
std::endl;
             continue;
+          }
 
+          // Compute the gradient of the normal field.
           const Vector v1 = normRight.getFFNormal(k) - 
normLeft.getFFNormal(k);
           const Vector v2 = normUp.getFFNormal(k) - normDown.getFFNormal(k);
 

Modified: trunk/Model/Primitives/ValuePrimitive.h
==============================================================================
--- trunk/Model/Primitives/ValuePrimitive.h     (original)
+++ trunk/Model/Primitives/ValuePrimitive.h     Mon Feb 18 16:28:42 2008
@@ -61,6 +61,9 @@
       val = newval;
     }
 
+    const Primitive *getPrimitive() const { return prim; }
+    Primitive *getPrimitive() { return prim; }
+
   private:
     Primitive *prim;
     T val;




  • [Manta] r2087 - in trunk: Engine/Renderers Model/Primitives, roni, 02/18/2008

Archive powered by MHonArc 2.6.16.

Top of page