Text archives Help
- From: cgribble@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1559 - in trunk: DynLT scenes
- Date: Thu, 26 Jul 2007 10:42:47 -0600 (MDT)
Author: cgribble
Date: Thu Jul 26 10:42:46 2007
New Revision: 1559
Modified:
trunk/DynLT/DynLTGridSpheres.h
trunk/scenes/pnrrd.cc
Log:
Adding -gridtype flags to pnrrd scene
Modified: trunk/DynLT/DynLTGridSpheres.h
==============================================================================
--- trunk/DynLT/DynLTGridSpheres.h (original)
+++ trunk/DynLT/DynLTGridSpheres.h Thu Jul 26 10:42:46 2007
@@ -18,8 +18,8 @@
using namespace SCIRun;
-#define XRES 2
-#define YRES 2
+#define XRES 16
+#define YRES 16
namespace Manta {
class DynLTContext;
@@ -51,7 +51,8 @@
DynLTGridSpheres(DynLTQueue* queue, float* spheres,
int nspheres, int nvars, int ncells, int depth,
- Real radius, int ridx, RegularColorMap* cmap, int cidx,
int textureMode);
+ Real radius, int ridx, RegularColorMap* cmap, int cidx,
+ int textureMode);
~DynLTGridSpheres(void);
void shade(const RenderContext& context, RayPacket& rays) const;
Modified: trunk/scenes/pnrrd.cc
==============================================================================
--- trunk/scenes/pnrrd.cc (original)
+++ trunk/scenes/pnrrd.cc Thu Jul 26 10:42:46 2007
@@ -9,6 +9,7 @@
#include <Model/AmbientLights/ConstantAmbient.h>
#include <Model/Backgrounds/ConstantBackground.h>
#include <Model/Backgrounds/EnvMapBackground.h>
+#include <Model/Groups/private/ParticleCGT.h>
#include <Model/Groups/TimeSteppedParticles.h>
#include <Model/Lights/PointLight.h>
#include <Model/Materials/Lambertian.h>
@@ -28,6 +29,7 @@
{
int argc=static_cast<int>(args.size());
int cidx=0;
+ string gridType = "gspheres";
string env_fname="";
string fname="";
int depth=1;
@@ -41,14 +43,6 @@
for(int i=0; i<argc; ++i) {
string arg=args[i];
-#if 0
- if (arg=="-bv") {
- string s;
- if (!getStringArg(i, args, s))
- throw IllegalArgument("scene pnrrd -bv", i, args);
- world=context.manta_interface->makeGroup(s);
- } else
-#endif
if (arg=="-cidx") {
if (!getIntArg(i, args, cidx))
throw IllegalArgument("scene pnrrd -cidx", i, args);
@@ -58,6 +52,9 @@
} else if (arg=="-envmap") {
if (!getStringArg(i, args, env_fname))
throw IllegalArgument("scene pnrrd -envmap", i, args);
+ } else if (arg=="-gridtype") {
+ if (!getStringArg(i, args, gridType))
+ throw IllegalArgument("scene pnrrd -gridtype", i, args);
} else if (arg=="-i") {
if (!getStringArg(i, args, fname))
throw IllegalArgument("scene pnrrd -i", i, args);
@@ -83,33 +80,52 @@
cerr<<" -cidx <int> data value index for color mapping\n";
cerr<<" -depth <int> grid depth\n";
cerr<<" -envmap <string> environment map filename\n";
- cerr<<" -ncells <int> grid resolution\n";
+ cerr<<" -gridtype <string> type of grid { gspheres | pcgt }";
cerr<<" -i <string> filename\n";
+ cerr<<" -ncells <int> grid resolution\n";
cerr<<" -radius <float> particle radius\n";
cerr<<" -ridx <int> radius index\n";
throw IllegalArgument("scene pnrrd", i, args);
}
}
+ if (gridType != "gspheres" && gridType != "pcgt") {
+ gridType = "gspheres";
+ cerr<<"Invalid grid type: using GridSpheres\n";
+ }
+
if (!world)
world=new Group();
- // Create color map
- unsigned int type=RegularColorMap::parseType("InvRainbowIso");
- RegularColorMap* cmap=new RegularColorMap(type);
-
- // Load particle data, add particles to group
- TimeSteppedParticles* tsteps=new TimeSteppedParticles(fname, ncells, depth,
- radius, ridx, cmap,
- cidx);
-
// Create scene
- Scene* scene=new Scene();
+ Scene* scene = new Scene();
+
+ if (gridType == "gspheres") {
+ // Create color map
+ unsigned int type=RegularColorMap::parseType("InvRainbowIso");
+ RegularColorMap* cmap=new RegularColorMap(type);
+
+ // Load particle data, add particles to group
+ TimeSteppedParticles* tsteps=new TimeSteppedParticles(fname, ncells,
depth,
+ radius, ridx, cmap,
+ cidx);
+ scene->setObject(tsteps);
+
+ cerr<<"Using GridSpheres\n";
+ } else if (gridType == "pcgt") {
+ // Read particle data and create grid
+ ParticleNRRD pnrrd(fname);
+ ParticleGrid* grid = new ParticleGrid(pnrrd, radius, ridx, cidx);
+ scene->setObject(grid);
+
+ cerr<<"Using ParticleCGT\n";
+ }
+
+ // Set background
if (env_fname != "")
scene->setBackground(new EnvMapBackground(env_fname));
else
scene->setBackground(new ConstantBackground(Color(RGB(0, 0, 0))));
- scene->setObject(tsteps);
LightSet* lights=new LightSet();
lights->add(new PointLight(Vector(lx, ly, lz), Color(RGB(1, 1, 1))));
- [MANTA] r1559 - in trunk: DynLT scenes, cgribble, 07/26/2007
Archive powered by MHonArc 2.6.16.