Text archives Help
- From: brownlee@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r2155 - in trunk: SwigInterface scenes/csafe/python scenes/csafe/src
- Date: Fri, 28 Mar 2008 07:52:46 -0600 (MDT)
Author: brownlee
Date: Fri Mar 28 07:52:45 2008
New Revision: 2155
Modified:
trunk/SwigInterface/manta.i
trunk/scenes/csafe/python/csafe_demo.py
trunk/scenes/csafe/src/CDTest.h
Log:
fixed compile erros with SWIG/CSAFE demo. Added ability to reload datasets
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Fri Mar 28 07:52:45 2008
@@ -301,6 +301,9 @@
%ignore Manta::DynBVH::parallelComputeBins;
%ignore Manta::DynBVH::parallelComputeBinsReduction;
%ignore Manta::DynBVH::splitBuild;
+%ignore Manta::DynBVH::beginParallelPreprocess;
+%ignore Manta::DynBVH::parallelPreprocess;
+%ignore Manta::DynBVH::finishParallelPreprocess;
%include <Model/Groups/KDTree.h>
%include <Model/Groups/DynBVH.h>
Modified: trunk/scenes/csafe/python/csafe_demo.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.py (original)
+++ trunk/scenes/csafe/python/csafe_demo.py Fri Mar 28 07:52:45 2008
@@ -221,9 +221,11 @@
self.test.addVolNrrd(self.scene.nrrdFiles2[i])
for i in range(0, len(self.scene.nrrdFiles)):
self.test.addSphereNrrd(self.scene.nrrdFiles[i])
- self.test.loadSphereNrrds()
+ #self.test.loadSphereNrrds()
+ self.test.reloadData()
self.test.setVolCMinMax(300, 2100)
- self.test.loadVolNrrds()
+ #self.test.loadVolNrrds()
+
self.BuildHistograms()
self.slider.SetRange(1, int(max(len(self.scene.nrrdFiles),
len(self.scene.nrrdFiles2))))
Modified: trunk/scenes/csafe/src/CDTest.h
==============================================================================
--- trunk/scenes/csafe/src/CDTest.h (original)
+++ trunk/scenes/csafe/src/CDTest.h Fri Mar 28 07:52:45 2008
@@ -17,7 +17,6 @@
#include <Interface/MantaInterface.h>
#include <Model/Groups/Group.h>
#include <Model/Lights/PointLight.h>
-#include <Model/Groups/GriddedGroup.h>
#include "CDGridSpheres.h"
#include <Engine/Factory/Factory.h>
#include <Model/MiscObjects/CuttingPlane.h>
@@ -63,6 +62,9 @@
*/
CDTest(Scene* scene, MantaInterface* interface)
{
+ _sphereAnimation=NULL;
+ _volCMap=NULL;
+ _volAnimation = NULL;
_scene = scene;
_ridx = 6;
_cidx = 4;
@@ -99,7 +101,11 @@
_scene->setLights(lights);
Group* group = new Group();
Primitive* prim = new Cube( new
Lambertian(Color(RGBColor(1,0,0))), Vector(-0.1, -0.1, 0.4)*0, Vector(0.1,
0.1, 0.7)*0);
+ if (_sphereAnimation)
+ delete _sphereAnimation;
_sphereAnimation= new KeyFrameAnimation();
+ if (_volAnimation)
+ delete _volAnimation;
_volAnimation = new KeyFrameAnimation();
Primitive* prim2 = new Cube( new
Lambertian(Color(RGBColor(0,0,1))), Vector(-0.1, -0.1, 0.4), Vector(0.1, 0.1,
.7));
group->add(prim);
@@ -132,9 +138,10 @@
slices.push_back(ColorSlice(0.85f,
RGBAColor(Color(RGB(255, 247, 120)) * div, 0.43*a)));
slices.push_back(ColorSlice(0.92f,
RGBAColor(Color(RGB(255, 255, 180)) * div, 0.47*a)));
slices.push_back(ColorSlice(1.0f,
RGBAColor(Color(RGB(255, 255, 255)) * div, 0.5*a)));
+ if (_volCMap)
+ delete _volCMap;
_volCMap = new RGBAColorMap(slices, 64);
-
}
//! add a sphere file to be loaded
@@ -277,6 +284,28 @@
if (_clipFrames && _endFrame < int(_vols.size()))
_volAnimation->clipFrames(_startFrame,
_endFrame);
}
+
+ //! calls destructors on all loaded data, then reloads sphere and
volume files
+ /*!
+ */
+ void reloadData(void* callback)
+ {
+ _scene = new Scene();
+ //TODO: i don't delete the old scene object... I don't want to
to do a recursive delete
+ _manta_interface->setScene(_scene);
+ initScene();
+ _volsOld = _vols;
+ _sphereGridsOld = _sphereGrids;
+ _spherePNrrdsOld = _spherePNrrds;
+ _vols.clear();
+ _spherePNrrds.clear();
+ _sphereGrids.clear();
+ loadSphereNrrds();
+ loadVolNrrds();
+ _manta_interface->addOneShotCallback(MantaInterface::Relative,
2, Callback::create(this, &CDTest::reloadDataHelper));
+ }
+
+
//! update the frame cieling
/*!
@@ -589,7 +618,23 @@
\return color index
*/
int getCidx() { return _cidx; }
-
+
+protected:
+ //! called by reloadData
+ /*!
+ */
+ void reloadDataHelper(int, int)
+ {
+ for (vector<Volume<float>*>::iterator itr = _volsOld.begin();
itr != _volsOld.end(); itr++)
+ delete *itr;
+ _volsOld.clear();
+ for (vector<CDGridSpheres*>::iterator itr =
_sphereGridsOld.begin(); itr != _sphereGridsOld.end(); itr++)
+ delete *itr;
+ _sphereGridsOld.clear();
+ for (vector<ParticleNRRD*>::iterator itr =
_spherePNrrdsOld.begin(); itr != _spherePNrrdsOld.end(); itr++)
+ delete *itr;
+ _spherePNrrdsOld.clear();
+ }
MantaInterface* _manta_interface;
RGBAColorMap* _volCMap;
@@ -610,6 +655,9 @@
vector<ParticleNRRD*> _spherePNrrds;
vector<CDGridSpheres*> _sphereGrids;
vector<Volume<float>*> _vols;
+ vector<ParticleNRRD*> _spherePNrrdsOld;
+ vector<CDGridSpheres*> _sphereGridsOld;
+ vector<Volume<float>*> _volsOld;
vector<float> _sphereMins;
vector<float> _sphereMaxs;
Group* _world;
- [Manta] r2155 - in trunk: SwigInterface scenes/csafe/python scenes/csafe/src, brownlee, 03/28/2008
Archive powered by MHonArc 2.6.16.