Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1430 - trunk/Model/Groups


Chronological Thread 
  • From: thiago@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1430 - trunk/Model/Groups
  • Date: Wed, 27 Jun 2007 16:19:04 -0600 (MDT)

Author: thiago
Date: Wed Jun 27 16:19:02 2007
New Revision: 1430

Modified:
   trunk/Model/Groups/Group.cc
   trunk/Model/Groups/ObjGroup.cc
Log:
ObjGroup.cc: Added texture caching so that the same texture doesn't
get loaded over and over again.

Group.cc: Turns out we do in fact need a barrier at the end of the parallel 
interpolate.



Modified: trunk/Model/Groups/Group.cc
==============================================================================
--- trunk/Model/Groups/Group.cc (original)
+++ trunk/Model/Groups/Group.cc Wed Jun 27 16:19:02 2007
@@ -97,6 +97,7 @@
 
   //XXXX: should we have a barrier here to make sure everything is
   //fully interpolated before other things get access to new data?
+  barrier.wait(numProc);
 
   return worstError;
 }

Modified: trunk/Model/Groups/ObjGroup.cc
==============================================================================
--- trunk/Model/Groups/ObjGroup.cc      (original)
+++ trunk/Model/Groups/ObjGroup.cc      Wed Jun 27 16:19:02 2007
@@ -14,8 +14,10 @@
 #include <Model/Primitives/TexTriangle.h>
 #include <Model/Primitives/HeavyTriangle.h>
 #include <Model/Primitives/WaldTriangle.h>
+#include <Model/Primitives/Triangle.h>
 
 #include <iostream>
+#include <map>
 
 using namespace Manta;
 using namespace Glm;
@@ -25,6 +27,12 @@
                                    const string &file_name,
                                    const Color &constant_color,
                                    const float* map_scaling ) {
+  static std::map<string, Texture<Color>*> texture_cache;
+
+  map<string, Texture<Color>*>::iterator iter = 
+    texture_cache.find(path_name + file_name);
+  if (iter != texture_cache.end())
+    return iter->second;
 
     Texture<Color> *texture = 0;
 
@@ -40,6 +48,7 @@
             it->setInterpolationMethod(ImageTexture<Color>::Bilinear);
           }
           texture = it;
+          texture_cache[path_name+file_name] = texture;
         }
         catch (SCIRun::Exception &e) {
             std::cerr << "Could not load diffuse map: "
@@ -254,6 +263,8 @@
                                         normal[0], normal[1], normal[2]);
         } else {
           triangle = new WaldTriangle( material,
+//           triangle = new Triangle( material,
+//           triangle = new HeavyTriangle( material,
                                         vertex[0], vertex[1], vertex[2]);
         }
       }




  • [MANTA] r1430 - trunk/Model/Groups, thiago, 06/27/2007

Archive powered by MHonArc 2.6.16.

Top of page