Text archives Help
- From: thiago@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1441 - trunk/scenes
- Date: Mon, 2 Jul 2007 11:47:49 -0600 (MDT)
Author: thiago
Date: Mon Jul 2 11:47:48 2007
New Revision: 1441
Modified:
trunk/scenes/objviewer.cc
Log:
adding a texture cache like I did for ObjGroup. I haven't actually tested
this code in this class though. Hopefully it will work...
Modified: trunk/scenes/objviewer.cc
==============================================================================
--- trunk/scenes/objviewer.cc (original)
+++ trunk/scenes/objviewer.cc Mon Jul 2 11:47:48 2007
@@ -45,6 +45,7 @@
#include <Model/Primitives/Triangle.h>
#include <Model/Primitives/HeavyTriangle.h>
#include <Model/Primitives/TexTriangle.h>
+#include <Model/Primitives/WaldTriangle.h>
#include <Model/Primitives/Parallelogram.h>
#include <Model/Primitives/Cube.h>
#include <Model/Materials/Lambertian.h>
@@ -71,6 +72,7 @@
#include <sgi_stl_warnings_off.h>
#include <vector>
#include <string>
+#include <map>
#include <sgi_stl_warnings_on.h>
@@ -284,6 +286,12 @@
// Check to see if the specified file can be loaded, otherwise use the
specified color.
Texture<Color> *check_for_texture( const string &path_name, 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;
@@ -304,6 +312,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: "
@@ -588,7 +597,8 @@
cerr << "Creating HeavyTriangle( "<<material_index<<",\n"
<< " "<<vertex[0]<<",
"<<vertex[1]<<", "<<vertex[2]<<");\n";
}
- triangle = new HeavyTriangle( material,
+// triangle = new HeavyTriangle( material,
+ triangle = new WaldTriangle( material,
vertex[0], vertex[1],
vertex[2]);
}
}
- [MANTA] r1441 - trunk/scenes, thiago, 07/02/2007
Archive powered by MHonArc 2.6.16.