Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1179 - in trunk: Engine/Control UserInterface scenes
- Date: Tue, 15 Aug 2006 12:32:14 -0600 (MDT)
Author: abe
Date: Tue Aug 15 12:32:09 2006
New Revision: 1179
Modified:
trunk/Engine/Control/RTRT.cc
trunk/Engine/Control/RTRT.h
trunk/UserInterface/XWindowUI.cc
trunk/UserInterface/XWindowUI.h
trunk/scenes/dynlt.cc
Log:
Moved command line parameter parsing for Christiaan's camera path code
to XWindowUI.cc. Removed the get/set methods from MantaInterface. The
functionality can be used from any scene.
The main difference between this code and the existing camera path
code is that the new code allows a user to explicitly place knots for
interpolation and the existing code sampled the camera's position as
the user moved about the scene.
Use the same command line args, just with the UI instead of the scene.
bin/manta -ui "X( -[o]path path.txt )" -scene "....."
M Engine/Control/RTRT.cc
M Engine/Control/RTRT.h
M scenes/dynlt.cc
M UserInterface/XWindowUI.cc
M UserInterface/XWindowUI.h
Modified: trunk/Engine/Control/RTRT.cc
==============================================================================
--- trunk/Engine/Control/RTRT.cc (original)
+++ trunk/Engine/Control/RTRT.cc Tue Aug 15 12:32:09 2006
@@ -1260,16 +1260,6 @@
scenePath = path;
}
-CameraPath* RTRT::getCameraPath(void) const
-{
- return path;
-}
-
-void RTRT::setCameraPath(CameraPath* newPath)
-{
- path=newPath;
-}
-
Group* RTRT::makeGroup(const string& groupSpec)
{
string name;
Modified: trunk/Engine/Control/RTRT.h
==============================================================================
--- trunk/Engine/Control/RTRT.h (original)
+++ trunk/Engine/Control/RTRT.h Tue Aug 15 12:32:09 2006
@@ -30,7 +30,6 @@
using namespace std;
class Camera;
- class CameraPath;
class Image;
class Scene;
@@ -106,10 +105,6 @@
virtual void readStack( const string &name, const vector<string> &args );
virtual void setScenePath(const string& path);
- // Camera Path
- virtual CameraPath* getCameraPath(void) const;
- virtual void setCameraPath(CameraPath* path);
-
// Groups
virtual Group* makeGroup(const string& groupSpec);
virtual void registerObject(const string& name, GroupCreator creator);
@@ -318,7 +313,6 @@
};
typedef vector<Channel*> ChannelListType;
ChannelListType channels;
- CameraPath* path;
// Thread local storage allocator.
ThreadStorage *thread_storage;
Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc (original)
+++ trunk/UserInterface/XWindowUI.cc Tue Aug 15 12:32:09 2006
@@ -10,6 +10,7 @@
#include <Interface/Object.h>
#include <Core/Exceptions/ErrnoException.h>
#include <Core/Exceptions/InternalError.h>
+#include <Core/Exceptions/IllegalArgument.h>
#include <Core/Geometry/AffineTransform.h>
#include <Core/Math/MiscMath.h>
#include <Core/Math/Expon.h>
@@ -63,10 +64,27 @@
ui->removeConnection(fd);
}
-XWindowUI::XWindowUI(const vector<string>& /*args*/, MantaInterface
*rtrt_interface)
+XWindowUI::XWindowUI(const vector<string>& args, MantaInterface
*rtrt_interface)
: rtrt_interface(rtrt_interface), xlock("XWindowUI display lock"),
- xsema("XWindowUI semaphore", 0)
+ xsema("XWindowUI semaphore", 0), path( 0 )
{
+
+ // Parse command line args.
+ for (int i=0;i<args.size();++i) {
+ const string &arg = args[i];
+ if (arg=="-opath") {
+ string fname;
+ if (!getStringArg(i, args, fname))
+ throw IllegalArgument("scene dynplt -path", i, args);
+ path = new CameraPath(rtrt_interface, fname, CameraPath::WriteKnots);
+ } else if (arg=="-path") {
+ string fname;
+ if (!getStringArg(i, args, fname))
+ throw IllegalArgument("scene dynplt -path", i, args);
+ path = new CameraPath(rtrt_interface, fname, CameraPath::ReadKnots);
+ }
+ }
+
fov_speed = 10;
translate_speed = 1;
dolly_speed = 5;
@@ -242,6 +260,18 @@
xfds.erase(remove_if(xfds.begin(), xfds.end(), bind2nd(equal_to<int>(),
fd)));
}
+CameraPath* XWindowUI::getCameraPath(void) const
+{
+ return path;
+}
+
+void XWindowUI::setCameraPath(CameraPath* newPath)
+{
+ path=newPath;
+}
+
+
+
void XWindowUI::lock_x()
{
int token = TOKEN_LOCK;
@@ -525,11 +555,9 @@
void XWindowUI::add_knot(unsigned int, unsigned long, int channel)
{
- CameraPath* path=rtrt_interface->getCameraPath();
if (!path) {
cerr<<"Creating a new CameraPath; writing knots to \"out.path\"\n";
path=new CameraPath(rtrt_interface, "out.path", CameraPath::WriteKnots);
- rtrt_interface->setCameraPath(path);
}
BasicCameraData data;
@@ -539,7 +567,6 @@
void XWindowUI::write_knots(unsigned int, unsigned long, int)
{
- CameraPath* path=rtrt_interface->getCameraPath();
if (!path)
return;
Modified: trunk/UserInterface/XWindowUI.h
==============================================================================
--- trunk/UserInterface/XWindowUI.h (original)
+++ trunk/UserInterface/XWindowUI.h Tue Aug 15 12:32:09 2006
@@ -23,6 +23,7 @@
class MantaInterface;
class TrackBall;
class XWindow;
+ class CameraPath;
class XWindowUI: public UserInterface, public SetupCallback, public
SCIRun::Runnable {
public:
@@ -39,6 +40,10 @@
// From Runnable
virtual void run();
+ // Camera path
+ CameraPath* getCameraPath(void) const;
+ void setCameraPath(CameraPath* path);
+
static UserInterface* create(const vector<string>& args,
MantaInterface *rtrt_interface);
@@ -100,6 +105,8 @@
vector<int> xfds;
int xpipe[2];
+ CameraPath *path;
+
SCIRun::Mutex xlock;
SCIRun::Semaphore xsema;
Modified: trunk/scenes/dynlt.cc
==============================================================================
--- trunk/scenes/dynlt.cc (original)
+++ trunk/scenes/dynlt.cc Tue Aug 15 12:32:09 2006
@@ -121,17 +121,8 @@
static_threads=true;
if (!getIntArg(i, args, nthreads))
throw IllegalArgument("scene dynplt -nthreads", i, args);
- } else if (arg=="-opath") {
- string fname;
- if (!getStringArg(i, args, fname))
- throw IllegalArgument("scene dynplt -path", i, args);
- context.manta_interface->setCameraPath(new
CameraPath(context.manta_interface, fname, CameraPath::WriteKnots));
- } else if (arg=="-path") {
- string fname;
- if (!getStringArg(i, args, fname))
- throw IllegalArgument("scene dynplt -path", i, args);
- context.manta_interface->setCameraPath(new
CameraPath(context.manta_interface, fname, CameraPath::ReadKnots));
- } else if (arg=="-radius") {
+ }
+ else if (arg=="-radius") {
if (!getDoubleArg(i, args, radius))
throw IllegalArgument("scene dynplt -radius", i, args);
} else if (arg=="-ridx") {
- [MANTA] r1179 - in trunk: Engine/Control UserInterface scenes, abe, 08/15/2006
Archive powered by MHonArc 2.6.16.