Text archives Help
- From: cgribble@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1184 - in trunk: Interface UserInterface scenes
- Date: Thu, 17 Aug 2006 17:44:25 -0600 (MDT)
Author: cgribble
Date: Thu Aug 17 17:44:24 2006
New Revision: 1184
Modified:
trunk/Interface/CameraPath.cc
trunk/Interface/CameraPath.h
trunk/UserInterface/XWindowUI.cc
trunk/scenes/dynlt.cc
Log:
Slight tweaking on the CameraPath behavior (looping and exiting)
Modified: trunk/Interface/CameraPath.cc
==============================================================================
--- trunk/Interface/CameraPath.cc (original)
+++ trunk/Interface/CameraPath.cc Thu Aug 17 17:44:24 2006
@@ -10,12 +10,16 @@
using namespace Manta;
CameraPath::CameraPath(MantaInterface* interface, string const& fname,
- Mode mode, bool loop, int offset) :
- interface(interface), fname(fname), loop(loop), offset(offset), handle(0),
+ IOMode mode, LoopMode loop, int max_count, int
offset) :
+ interface(interface), fname(fname), loop(loop), max_count(max_count),
offset(offset), handle(0),
frame(0), max_frame(0), anim(false)
{
- if (mode==ReadKnots)
+ if (mode==ReadKnots) {
readKnots();
+ anim=true;
+ handle=interface->registerSerialAnimationCallback(Callback::create(this,
&CameraPath::interpolate));
+ count=0;
+ }
}
CameraPath::~CameraPath(void)
@@ -29,10 +33,12 @@
void CameraPath::interpolate(int, int, bool&)
{
- if (loop && frame >= max_frame)
+ if (loop==Loop && count < max_count - 1 && frame >= max_frame) {
+ ++count;
frame=0;
+ }
- if (frame<max_frame) {
+ if (frame < max_frame) {
Camera* camera=interface->getCamera(0);
camera->reset(eyes.interpolate(frame), ups.interpolate(frame),
lookats.interpolate(frame), fovs.interpolate(frame));
@@ -40,7 +46,12 @@
} else {
anim=false;
interface->unregisterCallback(handle);
- cerr<<"Reached end of camera path\n";
+ cerr<<"Reached end of camera path";
+ if (loop==Quit) {
+ cerr<<"... quitting\n";
+ interface->finish();
+ } else
+ cerr<<'\n';
}
}
@@ -56,10 +67,6 @@
void CameraPath::addKnot(Real const frame, BasicCameraData const& data)
{
- Knot knot;
- knot.frame=frame;
- knot.data=data;
-
// Force a control point at frame zero (prevents camera from going berzerk
// on playback)
if (knots.size() == 0) {
@@ -69,6 +76,9 @@
knots.push_back(first);
}
+ Knot knot;
+ knot.frame=frame;
+ knot.data=data;
knots.push_back(knot);
}
Modified: trunk/Interface/CameraPath.h
==============================================================================
--- trunk/Interface/CameraPath.h (original)
+++ trunk/Interface/CameraPath.h Thu Aug 17 17:44:24 2006
@@ -17,10 +17,12 @@
class CameraPath
{
public:
- typedef enum { ReadKnots, WriteKnots } Mode;
+ typedef enum { ReadKnots, WriteKnots } IOMode;
+ typedef enum { NoLoop, Loop, Quit } LoopMode;
CameraPath(MantaInterface* interface, string const& fname,
- Mode mode=WriteKnots, bool loop=false, int offset=0);
+ IOMode mode=WriteKnots, LoopMode loop=NoLoop,
+ int max_count=INT_MAX, int offset=0);
~CameraPath(void);
void interpolate(int, int, bool&);
@@ -34,7 +36,9 @@
private:
MantaInterface* interface;
std::string fname;
- bool loop;
+ LoopMode loop;
+ int max_count;
+ int count;
int offset;
CallbackHandle* handle;
bool anim;
@@ -43,7 +47,7 @@
struct Knot
{
- Real frame;
+ unsigned int frame;
BasicCameraData data;
};
std::vector<Knot> knots;
Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc (original)
+++ trunk/UserInterface/XWindowUI.cc Thu Aug 17 17:44:24 2006
@@ -68,16 +68,19 @@
: rtrt_interface(rtrt_interface), xlock("XWindowUI display lock"),
xsema("XWindowUI semaphore", 0), path( 0 )
{
- bool loop=false;
+ CameraPath::LoopMode loop=CameraPath::NoLoop;
+ int max_count=INT_MAX;
int offset=0;
+ CameraPath::IOMode mode;
string fname="";
- CameraPath::Mode mode;
// Parse command line args.
for (int i=0;i<args.size();++i) {
const string &arg = args[i];
if (arg=="-loop") {
- loop=true;
+ // Grab optional loop count
+ getIntArg(i, args, max_count);
+ loop=CameraPath::Loop;
} else if (arg=="-offset") {
if (!getIntArg(i, args, offset))
throw IllegalArgument("XWindowUI -offset", i, args);
@@ -89,12 +92,14 @@
if (!getStringArg(i, args, fname))
throw IllegalArgument("XWindowUI -path", i, args);
mode=CameraPath::ReadKnots;
+ } else if (arg=="-quit") {
+ loop=CameraPath::Quit;
}
}
// Create a CameraPath (if necessary)
if (fname != "")
- path = new CameraPath(rtrt_interface, fname, mode, loop, offset);
+ path = new CameraPath(rtrt_interface, fname, mode, loop, max_count,
offset);
fov_speed = 10;
translate_speed = 1;
Modified: trunk/scenes/dynlt.cc
==============================================================================
--- trunk/scenes/dynlt.cc (original)
+++ trunk/scenes/dynlt.cc Thu Aug 17 17:44:24 2006
@@ -131,8 +131,10 @@
} else if (arg=="-qsize") {
if (!getIntArg(i, args, qsize))
throw IllegalArgument("scene dynplt -qsize", i, args);
+#ifdef USE_STATS_COLLECTOR
} else if (arg=="-stats") {
stats=true;
+#endif
} else if (arg=="-timed") {
string s;
if (getStringArg(i, args, s)) {
@@ -160,12 +162,12 @@
cerr<<" -ngroups <int> number of sample
groups\n";
cerr<<" -nsamples <int> number of
samples/texel\n";
cerr<<" -nthreads <int> number of static dynplt
workers\n";
- cerr<<" -opath <string> output filename of camera
path\n";
- cerr<<" -path <string> input filename of camera
path\n";
cerr<<" -qsize <int> maximum queue qsize\n";
cerr<<" -radius <float> particle radius\n";
cerr<<" -ridx <int> radius index\n";
- cerr<<" -stats dump summary stats on
exit (if stats collection supported by build)\n";
+#ifdef USE_STATS_COLLECTOR
+ cerr<<" -stats dump summary stats on
exit\n";
+#endif
cerr<<" -timed [<double> [<int> <int>]] texgen thread range and
runtime (in seconds)\n";
throw IllegalArgument("scene dynplt", i, args);
}
- [MANTA] r1184 - in trunk: Interface UserInterface scenes, cgribble, 08/17/2006
Archive powered by MHonArc 2.6.16.