Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1702 - in trunk/Model: Groups Primitives Readers Textures


Chronological Thread 
  • From: thiago@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1702 - in trunk/Model: Groups Primitives Readers Textures
  • Date: Sun, 2 Sep 2007 16:36:31 -0600 (MDT)

Author: thiago
Date: Sun Sep  2 16:36:30 2007
New Revision: 1702

Removed:
   trunk/Model/Groups/RealisticBvh.cc
   trunk/Model/Groups/RealisticBvh.h
   trunk/Model/Primitives/HeavyTriangle.cc
   trunk/Model/Primitives/HeavyTriangle.h
   trunk/Model/Primitives/TexTriangle.cc
   trunk/Model/Primitives/TexTriangle.h
   trunk/Model/Primitives/Triangle.cc
   trunk/Model/Primitives/Triangle.h
   trunk/Model/Primitives/VertexColoredTriangle.cc
   trunk/Model/Primitives/VertexColoredTriangle.h
   trunk/Model/Textures/TriVerTexture.cc
   trunk/Model/Textures/TriVerTexture.h
Modified:
   trunk/Model/Groups/CMakeLists.txt
   trunk/Model/Primitives/CMakeLists.txt
   trunk/Model/Primitives/KenslerShirleyTriangle.cc
   trunk/Model/Primitives/TessellatedCylinder.cc
   trunk/Model/Primitives/TessellatedCylinder.h
   trunk/Model/Readers/PlyReader.cc
   trunk/Model/Textures/CMakeLists.txt
   trunk/Model/Textures/NormalTexture.cc
   trunk/Model/Textures/NormalTexture.h
Log:
Model/Groups/RealisticBvh: Removed because DynBVH is better BVH which
can also do single ray code.

Model/Primitives/HeavyTriangle
Model/Primitives/Triangle
Model/Primitives/VertexColoredTriangle.h
Model/Primitives/TexTriangle.h: 
Don't use these triangle classes anymore. Just use the Mesh based ones
instead which are faster, more robust (some of these have serious
epsilon issues), and have more features.

Model/Textures/TriVerTexture: Removed this. If we want this, we should
reimplement to use Mesh. This was hardcoded to use
VertexColoredTriangle

Model/Textures/NormalTexture: Removed references to HeavyTriangle
which no longer exists.

Model/Readers/PlyReader.cc: We no longer have a triangle class that
supports vertex colors.

Model/Primitives/TessellatedCylinder: Changed to use a Mesh.

Model/Primitives/KenslerShirleyTriangle.cc: Use local points instead
of having to look it up in the Mesh. Hopefully this is more efficient
(but I haven't tested).


Modified: trunk/Model/Groups/CMakeLists.txt
==============================================================================
--- trunk/Model/Groups/CMakeLists.txt   (original)
+++ trunk/Model/Groups/CMakeLists.txt   Sun Sep  2 16:36:30 2007
@@ -12,8 +12,6 @@
      Groups/Group.h
      Groups/Mesh.cc
      Groups/Mesh.h
-     Groups/RealisticBvh.cc
-     Groups/RealisticBvh.h
      Groups/ObjGroup.h
      Groups/ObjGroup.cc
 )

Modified: trunk/Model/Primitives/CMakeLists.txt
==============================================================================
--- trunk/Model/Primitives/CMakeLists.txt       (original)
+++ trunk/Model/Primitives/CMakeLists.txt       Sun Sep  2 16:36:30 2007
@@ -10,8 +10,6 @@
      Primitives/Disk.h
      Primitives/GridSpheres.cc
      Primitives/GridSpheres.h
-     Primitives/HeavyTriangle.cc
-     Primitives/HeavyTriangle.h
      Primitives/Heightfield.cc
      Primitives/Heightfield.h
      Primitives/Hemisphere.cc
@@ -38,12 +36,6 @@
      Primitives/SuperEllipsoid.h
      Primitives/TessellatedCylinder.cc
      Primitives/TessellatedCylinder.h
-     Primitives/TexTriangle.cc
-     Primitives/TexTriangle.h
-     Primitives/Triangle.cc
-     Primitives/Triangle.h
-     Primitives/VertexColoredTriangle.cc
-     Primitives/VertexColoredTriangle.h
      Primitives/WaldTriangle.h
      Primitives/WaldTriangle.cc
      Primitives/BumpPrimitive.h

Modified: trunk/Model/Primitives/KenslerShirleyTriangle.cc
==============================================================================
--- trunk/Model/Primitives/KenslerShirleyTriangle.cc    (original)
+++ trunk/Model/Primitives/KenslerShirleyTriangle.cc    Sun Sep  2 16:36:30 
2007
@@ -337,6 +337,9 @@
 Vector KenslerShirleyTriangle::getVertex(unsigned int which)
 {
   ASSERT(which < 3);
-  const unsigned int index = myID*3;
-  return mesh->vertices[mesh->vertex_indices[index+which]];
+  switch(which) {
+  case 0: return p0;
+  case 1: return p1;
+  default: return p2;
+  };
 }

Modified: trunk/Model/Primitives/TessellatedCylinder.cc
==============================================================================
--- trunk/Model/Primitives/TessellatedCylinder.cc       (original)
+++ trunk/Model/Primitives/TessellatedCylinder.cc       Sun Sep  2 16:36:30 
2007
@@ -1,5 +1,5 @@
 #include <Model/Primitives/TessellatedCylinder.h>
-#include <Model/Primitives/Triangle.h>
+#include <Model/Primitives/KenslerShirleyTriangle.h>
 #include <Core/Geometry/AffineTransform.h>
 #include <assert.h>
 
@@ -14,34 +14,53 @@
   AffineTransform t;
   t.initWithRotation(axis, Vector(0,1,0));
 
+  materials.push_back(mat);
+
   //generate vertices
-  Vector verticesTop[tessellation+1];
-  Vector verticesBottom[tessellation+1];
+
+  // The first half is the top, second half bottom vertices of cylinder
+  vertices.resize( (tessellation+1)*2 );
+
   const float angleIncr = M_PI*2 / tessellation; 
   for (int i=0; i < tessellation; ++i) {
     Real x = radius * cos(angleIncr*i);
     Real y = radius * sin(angleIncr*i);
     
-    verticesTop[i]    = t.multiply_point(Vector(x, y, height)) + center;
-    verticesBottom[i] = t.multiply_point(Vector(x, y, 0)) + center;
+    vertices[i]    = t.multiply_point(Vector(x, y, height)) + center;
+    vertices[i+tessellation+1] = t.multiply_point(Vector(x, y, 0)) + center;
   }
-  verticesTop[tessellation] = verticesTop[0];
-  verticesBottom[tessellation] = verticesBottom[0];
+  vertices[tessellation] = vertices[0];
+  vertices[tessellation+1 + tessellation] = vertices[tessellation+1];
 
   //make disks
   for (int i=0; i < tessellation-2; ++i) {
-    objs.push_back(new Triangle(mat, verticesTop[tessellation-1],
-                                verticesTop[i], verticesTop[i+1]));
-    objs.push_back(new Triangle(mat, verticesBottom[tessellation-1],
-                                verticesBottom[i], verticesBottom[i+1]));
+
+    vertex_indices.push_back(tessellation-1);
+    vertex_indices.push_back(i);
+    vertex_indices.push_back(i+1);
+    addTriangle(new KenslerShirleyTriangle(this, size()));
+    face_material.push_back(0);
+
+    vertex_indices.push_back(tessellation+1 + tessellation-1);
+    vertex_indices.push_back(tessellation+1 + i);
+    vertex_indices.push_back(tessellation+1 + i+1);
+    addTriangle(new KenslerShirleyTriangle(this, size()));
+    face_material.push_back(0);
   }
   
   //make actual cylinder part
   for (int i=0; i < tessellation; ++i) {
-    objs.push_back(new Triangle(mat, verticesTop[i], verticesTop[i+1],
-                                verticesBottom[i]));
-    objs.push_back(new Triangle(mat, verticesTop[i+1],
-                                verticesBottom[i+1], verticesBottom[i]));
+    vertex_indices.push_back(i);
+    vertex_indices.push_back(i+1);
+    vertex_indices.push_back(tessellation+1 + i);
+    addTriangle(new KenslerShirleyTriangle(this, size()));
+    face_material.push_back(0);
+
+    vertex_indices.push_back(i+1);
+    vertex_indices.push_back(tessellation+1 + i+1);
+    vertex_indices.push_back(tessellation+1 + i);
+    addTriangle(new KenslerShirleyTriangle(this, size()));
+    face_material.push_back(0);
   }
 }
 

Modified: trunk/Model/Primitives/TessellatedCylinder.h
==============================================================================
--- trunk/Model/Primitives/TessellatedCylinder.h        (original)
+++ trunk/Model/Primitives/TessellatedCylinder.h        Sun Sep  2 16:36:30 
2007
@@ -2,14 +2,14 @@
 #ifndef Manta_Model_TessellatedCylinder_h
 #define Manta_Model_TessellatedCylinder_h
 
-#include <Model/Groups/Group.h>
+#include <Model/Groups/Mesh.h>
 #include <Core/Geometry/Vector.h>
 #include <Interface/Material.h>
 namespace Manta
 {
   //Creates a cylinder made of triangles.
   //Only use this over the normal Cylinder if you must have only triangles.
-  class TessellatedCylinder : public Group {
+  class TessellatedCylinder : public Mesh {
   public:
     //tessellation*2 is the number of vertices of cylinder.
     TessellatedCylinder(Material* mat, const Vector& axis, const Vector& 
center,

Modified: trunk/Model/Readers/PlyReader.cc
==============================================================================
--- trunk/Model/Readers/PlyReader.cc    (original)
+++ trunk/Model/Readers/PlyReader.cc    Sun Sep  2 16:36:30 2007
@@ -3,8 +3,6 @@
 
 #include <Model/Primitives/WaldTriangle.h>
 #include <Model/Primitives/KenslerShirleyTriangle.h>
-// #include <Model/Primitives/VertexColoredTriangle.h>
-#include <Model/Textures/TriVerTexture.h>
 #include <Model/Materials/Lambertian.h>
 #include <Core/Geometry/Vector.h>
 #include <Core/Color/Color.h>
@@ -178,6 +176,8 @@
 
      if (property) 
      {
+       //TODO: get vertex colored triangles working again
+       /*
          //TODO: we might not want to overwrite the matl passed in to us...
          defaultMaterial = new Lambertian(new TriVerTexture());
         coloredTriangleMode = true;
@@ -200,6 +200,7 @@
                  break;
              }
          }
+       */
      }
 
      ply_set_read_cb(ply, "face", "vertex_indices", face_cb, mesh, 0);

Modified: trunk/Model/Textures/CMakeLists.txt
==============================================================================
--- trunk/Model/Textures/CMakeLists.txt (original)
+++ trunk/Model/Textures/CMakeLists.txt Sun Sep  2 16:36:30 2007
@@ -23,8 +23,6 @@
      Textures/OakTexture.h
      Textures/TexCoordTexture.cc
      Textures/TexCoordTexture.h
-     Textures/TriVerTexture.cc
-     Textures/TriVerTexture.h
      Textures/WoodTexture.cc
      Textures/WoodTexture.h
      )

Modified: trunk/Model/Textures/NormalTexture.cc
==============================================================================
--- trunk/Model/Textures/NormalTexture.cc       (original)
+++ trunk/Model/Textures/NormalTexture.cc       Sun Sep  2 16:36:30 2007
@@ -98,31 +98,3 @@
   }
   
 }
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-// WIREFRAME  WIREFRAME  WIREFRAME  WIREFRAME  WIREFRAME  WIREFRAME  
WIREFRAME
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-// Implementations for specialized versions of the functions
-
-namespace Manta {
-  
-  template<>
-  void WireframeTexture<HeavyTriangle::TriangleHit,Color>::
-  getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real 
&c ) const
-  {
-
-    HeavyTriangle::TriangleHit &th =
-      rays.scratchpad<HeavyTriangle::TriangleHit>(which);
-  
-    a = th.a;
-    b = th.b;
-    c = ((Real)1.0 - th.a - th.b);
-  }
-
-} // end namespace Manta
-

Modified: trunk/Model/Textures/NormalTexture.h
==============================================================================
--- trunk/Model/Textures/NormalTexture.h        (original)
+++ trunk/Model/Textures/NormalTexture.h        Sun Sep  2 16:36:30 2007
@@ -33,7 +33,6 @@
 #include <Interface/Texture.h>
 #include <Interface/RayPacket.h>
 #include <Model/Textures/Constant.h>
-#include <Model/Primitives/HeavyTriangle.h>
 
 // Abe Stephens
 
@@ -94,11 +93,6 @@
     Texture<ValueType> *texture;
     ValueType wire_value;
   };
-
-  // Specialized versions of functions
-  template<>
-  void 
WireframeTexture<HeavyTriangle::TriangleHit,Color>::getBarycentricCoords( 
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const;
-  
 
   // Non specialized template functions
   template<class ScratchPadInfo, class ValueType>




  • [Manta] r1702 - in trunk/Model: Groups Primitives Readers Textures, thiago, 09/02/2007

Archive powered by MHonArc 2.6.16.

Top of page