Text archives Help
- From: thiago@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1610 - trunk/scenes
- Date: Fri, 3 Aug 2007 18:27:16 -0600 (MDT)
Author: thiago
Date: Fri Aug 3 18:27:15 2007
New Revision: 1610
Modified:
trunk/scenes/triangleSceneViewer.cc
Log:
improved the argument error handling
Modified: trunk/scenes/triangleSceneViewer.cc
==============================================================================
--- trunk/scenes/triangleSceneViewer.cc (original)
+++ trunk/scenes/triangleSceneViewer.cc Fri Aug 3 18:27:15 2007
@@ -30,6 +30,22 @@
using namespace Manta;
using namespace std;
+void argumentError(int i, const vector<string>& args) {
+ cerr << "Valid options for scene meshViewer:\n";
+ cerr << " -DynBVH - use DynBVH acceleration structure\n";
+#ifdef USE_PRIVATE_CODE
+ cerr << " -CGT - use Coherent Grid Traversal acceleration
structure\n";
+#endif
+ cerr << " -model - Required. The file to load (obj or ply file)\n";
+ cerr << " Can call this multiple times to load an
animation.\n";
+ cerr << " -animationLength - Number of seconds animation takes\n";
+ cerr << " -interpolateNormals - creates vertex normals if the data does"
+ << " not already contain vertex normals.\n";
+ cerr << " -useFaceNormals - force to use only face normals\n";
+ cerr << " -smoothAnimation - interpolates between keyframes.\n";
+ throw IllegalArgument("scene primtest", i, args);
+}
+
extern "C"
Scene* make_scene(const ReadContext&, const vector<string>& args)
{
@@ -72,24 +88,13 @@
smoothAnimation = true;
}
else {
- if(arg[0] == '-' || !setModel) {
- cerr << "Valid options for scene meshViewer:\n";
- cerr << " -DynBVH - use DynBVH acceleration structure\n";
-#ifdef USE_PRIVATE_CODE
- cerr << " -CGT - use Coherent Grid Traversal acceleration
structure\n";
-#endif
- cerr << " -model - The file to load (obj or ply file)\n";
- cerr << " Can call this multiple times to load an
animation.\n";
- cerr << " -animationLength - Number of seconds animation takes\n";
- cerr << " -interpolateNormals - creates vertex normals if the data
does"
- << " not already contain vertex normals.\n";
- cerr << " -useFaceNormals - force to use only face normals\n";
- cerr << " -smoothAnimation - interpolates between keyframes.\n";
- throw IllegalArgument("scene primtest", i, args);
- }
+ argumentError(i, args);
}
}
+ if (args.empty() || !setModel)
+ argumentError(0, args);
+
Group* group = new Group();
KeyFrameAnimation *animation = new KeyFrameAnimation();
@@ -125,12 +130,12 @@
else if (!strncmp(modelName.c_str()+modelName.length()-4, ".obj", 4)) {
frame = new ObjGroup(modelName.c_str());
}
+ if (useFaceNormals) {
+ frame->discardVertexNormals();
+
if (interpolateNormals && !frame->hasVertexNormals())
frame->interpolateNormals();
- if (useFaceNormals) {
- frame->normal_indices.clear();
- frame->vertexNormals.clear();
}
animation->push_back(frame);
}
- [MANTA] r1610 - trunk/scenes, thiago, 08/03/2007
Archive powered by MHonArc 2.6.16.