Text archives Help
- From: cgribble@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1511 - in trunk/scenes: . private
- Date: Thu, 19 Jul 2007 12:18:02 -0600 (MDT)
Author: cgribble
Date: Thu Jul 19 12:18:01 2007
New Revision: 1511
Added:
trunk/scenes/private/
trunk/scenes/private/CMakeLists.txt
trunk/scenes/private/particleCGTTest.cc
trunk/scenes/private/pcgt.cc
Removed:
trunk/scenes/particleCGTTest.cc
trunk/scenes/pcgt.cc
Modified:
trunk/scenes/CMakeLists.txt
Log:
An attempt to fix the snafu with code from Manta-auth breaking regular build
Modified: trunk/scenes/CMakeLists.txt
==============================================================================
--- trunk/scenes/CMakeLists.txt (original)
+++ trunk/scenes/CMakeLists.txt Thu Jul 19 12:18:01 2007
@@ -54,12 +54,6 @@
TARGET_LINK_LIBRARIES(scene_ParticleBVHTest ${MANTA_SCENE_LINK})
ENDIF(SCENE_PARTICLEBVHTEST)
-SET(SCENE_PARTICLECGTTEST 0 CACHE BOOL "Particle Coherent Grid Traversal
Test")
-IF(SCENE_PARTICLECGTTEST)
- ADD_LIBRARY(scene_particleCGTTest particleCGTTest.cc)
- TARGET_LINK_LIBRARIES(scene_particleCGTTest ${MANTA_SCENE_LINK})
-ENDIF(SCENE_PARTICLECGTTEST)
-
# Boeing 777 Test Scene.
SET(SCENE_BOEING777 0 CACHE BOOL "Boeing 777 Test Scene")
IF(SCENE_BOEING777)
@@ -120,12 +114,6 @@
TARGET_LINK_LIBRARIES(scene_pnrrd ${MANTA_SCENE_LINK})
ENDIF(BUILD_NRRDPARTICLES)
-# Viewer for NRRD particle datasets using PCGT algorithm
-IF(BUILD_NRRDPARTICLES)
- ADD_LIBRARY(scene_pcgt pcgt.cc)
- TARGET_LINK_LIBRARIES(scene_pcgt ${MANTA_SCENE_LINK})
-ENDIF(BUILD_NRRDPARTICLES)
-
# Lazily evaluated LTs for NRRD particle datasets
IF(BUILD_DYNLT)
ADD_LIBRARY(scene_dynlt dynlt.cc)
@@ -140,3 +128,15 @@
ADD_LIBRARY(scene_vorpal vorpal.cc)
TARGET_LINK_LIBRARIES(scene_vorpal ${MANTA_SCENE_LINK})
ENDIF(SCENE_VORPAL)
+
+# Include private code if available
+IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/private )
+ INCLUDE (private/CMakeLists.txt)
+ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/private)
+ SET(USE_PRIVATE_CODE_DEF "0" CACHE INTERNAL "Disable use of private code")
+ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/private)
+
+CONFIGURE_FILE(
+ ${CMAKE_SOURCE_DIR}/include/UsePrivateCode.h.CMakeTemplate
+ ${CMAKE_BINARY_DIR}/include/UsePrivateCode.h
+)
Added: trunk/scenes/private/CMakeLists.txt
==============================================================================
--- (empty file)
+++ trunk/scenes/private/CMakeLists.txt Thu Jul 19 12:18:01 2007
@@ -0,0 +1,16 @@
+
+# Viewer for NRRD particle datasets using PCGT algorithm
+IF(BUILD_NRRDPARTICLES)
+ ADD_LIBRARY(scene_pcgt private/pcgt.cc)
+ TARGET_LINK_LIBRARIES(scene_pcgt ${MANTA_SCENE_LINK})
+
+ SET(SCENE_PARTICLECGTTEST 0 CACHE BOOL "Particle CGT Test")
+ IF(SCENE_PARTICLECGTTEST)
+ ADD_LIBRARY(scene_particleCGTTest private/particleCGTTest.cc)
+ TARGET_LINK_LIBRARIES(scene_particleCGTTest ${MANTA_SCENE_LINK})
+ ENDIF(SCENE_PARTICLECGTTEST)
+
+ SET(USE_PRIVATE_CODE_DEF "1" CACHE INTERNAL "Enable use of private code")
+ELSE (BUILD_NRRDPARTICLES)
+ SET(USE_PRIVATE_CODE_DEF "0" CACHE INTERNAL "Disable use of private code")
+ENDIF(BUILD_NRRDPARTICLES)
Added: trunk/scenes/private/particleCGTTest.cc
==============================================================================
--- (empty file)
+++ trunk/scenes/private/particleCGTTest.cc Thu Jul 19 12:18:01 2007
@@ -0,0 +1,116 @@
+#include <Interface/MantaInterface.h>
+#include <Interface/Scene.h>
+#include <Model/Groups/Group.h>
+#include <Core/Geometry/Vector.h>
+#include <Interface/LightSet.h>
+#include <Interface/Context.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/AmbientLights/ArcAmbient.h>
+#include <Core/Color/ColorDB.h>
+#include <Core/Color/Color.h>
+#include <Core/Geometry/Vector.h>
+#include <Core/Exceptions/IllegalArgument.h>
+#include <Core/Util/Args.h>
+#include <Interface/Context.h>
+#include <Interface/LightSet.h>
+#include <Interface/MantaInterface.h>
+#include <Interface/Scene.h>
+#include <Model/Readers/PlyReader.h>
+#include <Model/AmbientLights/ArcAmbient.h>
+#include <Model/Backgrounds/LinearBackground.h>
+#include <Model/Backgrounds/ConstantBackground.h>
+#include <Model/Groups/Group.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Materials/Lambertian.h>
+#include <Model/Materials/MetalMaterial.h>
+#include <Model/Materials/Phong.h>
+#include <Model/Materials/Checker.h>
+#include <Model/Materials/Flat.h>
+#include <Model/Primitives/Parallelogram.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/Primitives/Cube.h>
+#include <Model/Primitives/Disk.h>
+#include <Model/Primitives/Parallelogram.h>
+#include <Model/Primitives/SuperEllipsoid.h>
+#include <Model/Primitives/Heightfield.h>
+#include <Model/Primitives/Hemisphere.h>
+#include <Model/MiscObjects/Intersection.h>
+#include <Model/MiscObjects/Difference.h>
+#include <Model/Textures/CheckerTexture.h>
+#include <Model/Textures/MarbleTexture.h>
+//#include <Model/Textures/NormalTexture.h>
+#include <Model/Textures/WoodTexture.h>
+#include <Model/Textures/OakTexture.h>
+#include <Model/TexCoordMappers/UniformMapper.h>
+#include <Model/TexCoordMappers/SphericalMapper.h>
+#include <Model/TexCoordMappers/LinearMapper.h>
+#include <Core/Geometry/AffineTransform.h>
+#include <Core/Util/NotFinished.h>
+#include <Model/Groups/GriddedGroup.h>
+#include <Model/Instances/InstanceRT.h>
+#include <Model/Instances/InstanceT.h>
+#include <Model/Instances/InstanceST.h>
+#include <Model/Instances/InstanceRST.h>
+#include <Model/Instances/Instance.h>
+#include <Model/Cameras/PinholeCamera.h>
+
+#include <Model/Groups/private/ParticleCGT.h>
+#include <Model/Readers/ParticleNRRD.h>
+
+#include <sgi_stl_warnings_off.h>
+#include <iostream>
+#include <sgi_stl_warnings_on.h>
+
+using namespace Manta;
+using namespace SCIRun;
+using namespace std;
+
+extern "C"
+Scene* make_scene(ReadContext const& context, vector<string> const& args)
+{
+ /************ SKELETON FILE **********************/
+ Group* world = new Group();
+ Group* pGroup = new Group();
+ Scene* scene = new Scene();
+ scene->setBackground(new LinearBackground(Color(RGB(0.2, 0.4, 0.9)),
+ Color(RGB(0.0,0.0,0.0)),
+ Vector(0,1,0)));
+
+ Material* lam = new Lambertian(Color(RGB(1,0,0)));
+ Primitive* prim = new Cube(lam, Vector(-0.4, -0.3, 0.2),
Vector(0.41, 0.3, 1.0));
+ ParticleNRRD reader;
+ reader.readFile("/home/collab/brownlee/2300.nrrd");
+ cout << "NVars: " << reader.getNVars() << endl;
+ int nvars = reader.getNVars();
+ cout << "num particles: " << reader.getNParticles() << endl;
+ for(int i = 0; i < reader.getNParticles(); i++)
+ {
+ float* data = reader.getParticleData() + i*nvars;
+ Vector pos(data[0], data[1], data[2]);
+ pGroup->add(new Sphere(lam, pos, 0.001f));
+ }
+
+ //world->add(prim);
+
+ ParticleGrid* grid = new ParticleGrid();
+ //KeyFrameAnimaction* animation = new KeyFrameAnimation();
+ //animation->useAccelerationStructure(grid);
+ //world->add(grid);
+ //world->add(pGroup);
+ //pGroup->useAccelerationStructure(grid);
+ grid->rebuild(pGroup);
+ world->add(grid);
+ //world->add(pGroup);
+ world->add(new Sphere(lam, Vector(0,0,0), 0.001f));
+
+ scene->setObject(world);
+ LightSet* lights = new LightSet();
+ lights->add(new PointLight(Vector(5,5,8), Color(RGB(1,1,1))*2));
+ Color cup(RGB(0.1, 0.3, 0.8));
+ Color cdown(RGB(0.82, 0.62, 0.62));
+ Vector up(0,1,0);
+ lights->setAmbientLight(new ArcAmbient(cup, cdown, up));
+ scene->setLights(lights);
+ return scene;
+}
+
Added: trunk/scenes/private/pcgt.cc
==============================================================================
--- (empty file)
+++ trunk/scenes/private/pcgt.cc Thu Jul 19 12:18:01 2007
@@ -0,0 +1,126 @@
+
+#include <Core/Color/RegularColorMap.h>
+#include <Core/Exceptions/IllegalArgument.h>
+#include <Core/Geometry/Vector.h>
+#include <Core/Util/Args.h>
+#include <Interface/Context.h>
+#include <Interface/LightSet.h>
+#include <Interface/MantaInterface.h>
+#include <Interface/Scene.h>
+#include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/Backgrounds/ConstantBackground.h>
+#include <Model/Backgrounds/EnvMapBackground.h>
+#include <Model/Groups/TimeSteppedParticles.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Materials/Lambertian.h>
+#include <Model/Primitives/GridSpheres.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/Readers/ParticleNRRD.h>
+#include <Model/Groups/private/ParticleCGT.h>
+
+#include <sgi_stl_warnings_off.h>
+#include <iostream>
+#include <sgi_stl_warnings_on.h>
+
+using namespace Manta;
+using namespace std;
+
+extern "C"
+Scene* make_scene(ReadContext const& context, vector<string> const& args)
+{
+ int argc = static_cast<int>(args.size());
+ int cidx = 0;
+ string env_fname = "";
+ string fname = "";
+ double radius = 1.;
+ int ridx = -1;
+ double lx = 10.;
+ double ly = 10.;
+ double lz = 10.;
+
+ for(int i = 0; i < argc; ++i) {
+ string arg = args[i];
+ if (arg == "-cidx") {
+ if (!getIntArg(i, args, cidx))
+ throw IllegalArgument("scene pcgt -cidx", i, args);
+ } else if (arg == "-envmap") {
+ if (!getStringArg(i, args, env_fname))
+ throw IllegalArgument("scene pcgt -envmap", i, args);
+ } else if (arg == "-i") {
+ if (!getStringArg(i, args, fname))
+ throw IllegalArgument("scene pcgt -i", i, args);
+ } else if (arg == "-light") {
+ if (!getDoubleArg(i, args, lx))
+ throw IllegalArgument("scene pcgt -light", i, args);
+ if (!getDoubleArg(i, args, ly))
+ throw IllegalArgument("scene pcgt -light", i, args);
+ if (!getDoubleArg(i, args, lz))
+ throw IllegalArgument("scene pcgt -light", i, args);
+ } else if (arg == "-radius") {
+ if (!getDoubleArg(i, args, radius))
+ throw IllegalArgument("scene pcgt -radius", i, args);
+ } else if (arg == "-ridx") {
+ if (!getIntArg(i, args, ridx))
+ throw IllegalArgument("scene pcgt -ridx", i, args);
+ } else {
+ cerr<<"Valid options for scene pcgt:\n";
+ cerr<<" -cidx <int> data value index for color mapping\n";
+ cerr<<" -envmap <string> environment map filename\n";
+ cerr<<" -ncells <int> grid resolution\n";
+ cerr<<" -i <string> filename\n";
+ cerr<<" -radius <float> particle radius\n";
+ cerr<<" -ridx <int> radius index\n";
+ throw IllegalArgument("scene pcgt", i, args);
+ }
+ }
+
+ // Create scene
+ Scene* scene = new Scene();
+
+ // Create color map
+ unsigned int type = RegularColorMap::parseType("InvRainbowIso");
+ RegularColorMap* cmap = new RegularColorMap(type);
+
+ // XXX(cpg) - There are some problems here:
+ // 1. Get bus error without the random, manually added sphere at (0, 0,
0)
+ // 2. I don't understand the scene <- world <- particles <- data
mapping.
+ // Why so many layers of groups? It seems to me that ParticleGrid
should
+ // be the scene's primary object, unless we're loading multiple time
steps
+ // (see pnrrd.cc).
+ // 3. Doesn't support variable radii
+ // 3. Doesn't support run time color mapping
+
+ // ***** begin copy (more or less) from ParticleCGTTest.cc *****
+ Group* world = new Group;
+ Group* particles = new Group;
+
+ Material* material = new Lambertian(Color(RGB(1, 0, 0)));
+ ParticleNRRD pnrrd(fname);
+ unsigned int nvars = pnrrd.getNVars();
+ for (unsigned int i = 0; i < pnrrd.getNParticles(); i++) {
+ float* data = pnrrd.getParticleData() + i*nvars;
+ Vector position(data[0], data[1], data[2]);
+ particles->add(new Sphere(material, position, radius));
+ }
+
+ ParticleGrid* grid = new ParticleGrid;
+ grid->rebuild(particles);
+ world->add(grid);
+ world->add(new Sphere(material, Vector(0,0,0), radius));
+ scene->setObject(world);
+ // ***** end copy *****
+
+ // Set background
+ if (env_fname != "")
+ scene->setBackground(new EnvMapBackground(env_fname));
+ else
+ scene->setBackground(new ConstantBackground(Color(RGB(0, 0, 0))));
+
+ // Add lights
+ LightSet* lights=new LightSet();
+ lights->add(new PointLight(Vector(lx, ly, lz), Color(RGB(1, 1, 1))));
+ lights->setAmbientLight(new ConstantAmbient(Color(RGB(0.4, 0.4, 0.4))));
+ scene->setLights(lights);
+
+ return scene;
+}
- [MANTA] r1511 - in trunk/scenes: . private, cgribble, 07/19/2007
Archive powered by MHonArc 2.6.16.