Text archives Help
- From: roni@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1793 - in trunk: Engine/Display UserInterface
- Date: Tue, 30 Oct 2007 16:09:53 -0600 (MDT)
Author: roni
Date: Tue Oct 30 16:09:52 2007
New Revision: 1793
Modified:
trunk/Engine/Display/FileDisplay.cc
trunk/Engine/Display/FileDisplay.h
trunk/Engine/Display/PureOpenGLDisplay.h
trunk/UserInterface/CameraPathAutomator.cc
Log:
UserInterface/CameraPathAutomator.cc
Changed to use C++ style I/O, and eliminated hard coded line length
limit.
Engine/Display/FileDisplay.cc
Engine/Display/FileDisplay.h
Added an option to use sequential numbers in file names instead of
timestamps ("-notimestamp"), and an option to not use a numeric
suffix at all ("-noframecount"). The latter is useful for single
screenshots taken with "-bench 1 0".
Engine/Display/PureOpenGLDisplay.h
Apple #include for OpenGL/gl.h
Modified: trunk/Engine/Display/FileDisplay.cc
==============================================================================
--- trunk/Engine/Display/FileDisplay.cc (original)
+++ trunk/Engine/Display/FileDisplay.cc Tue Oct 30 16:09:52 2007
@@ -60,6 +60,7 @@
file_number( 0 ),
skip_frames( 0 ),
prefix( "manta_frame" ),
+ doFrameCount( true ),
type_extension( "png" ),
init_time( Time::currentSeconds() ),
use_timestamp( true )
@@ -73,6 +74,9 @@
throw IllegalArgument( "FileDisplay", i, args );
}
}
+ else if(args[i] == "-noframecount") {
+ doFrameCount = false;
+ }
else if (args[i] == "-type") {
if (!getStringArg( i, args, type_extension )) {
throw IllegalArgument( "FileDisplay", i, args );
@@ -91,6 +95,9 @@
else if (args[i] == "-fps") {
display_fps = true;
}
+ else if (args[i] == "-notimestamp") {
+ use_timestamp = false;
+ }
}
/////////////////////////////////////////////////////////////////////////////
@@ -167,8 +174,14 @@
stringstream lss, rss;
// Output left and right images.
- lss << prefix << "_left_" << setfill( '0' ) << setw( width ) << number
<< "." << type_extension;
- rss << prefix << "_right_" << setfill( '0' ) << setw( width ) <<
number << "." << type_extension;
+ if(doFrameCount){
+ lss << prefix << "_left_" << setfill( '0' ) << setw( width ) <<
number << "." << type_extension;
+ rss << prefix << "_right_" << setfill( '0' ) << setw( width ) <<
number << "." << type_extension;
+ }
+ else{
+ lss << prefix << "_left_." << type_extension;
+ lss << prefix << "_right_." << type_extension;
+ }
// Send the image to the appropriate writer.
if (writer == TGA_WRITER) {
@@ -183,11 +196,16 @@
// Otherwise output a single image.
stringstream ss;
- ss << prefix << "_"
- << setfill( '0' )
- << setw( width )
- << number
- << "." << type_extension;
+ if(doFrameCount){
+ ss << prefix << "_"
+ << setfill( '0' )
+ << setw( width )
+ << number
+ << "." << type_extension;
+ }
+ else{
+ ss << prefix << "." << type_extension;
+ }
if (writer == TGA_WRITER) {
writeTGA( image, ss.str(), 0 );
Modified: trunk/Engine/Display/FileDisplay.h
==============================================================================
--- trunk/Engine/Display/FileDisplay.h (original)
+++ trunk/Engine/Display/FileDisplay.h Tue Oct 30 16:09:52 2007
@@ -53,6 +53,9 @@
const Image* image);
static ImageDisplay* create(const vector<string>& args);
+ void useFrameCount(bool on) { doFrameCount = on; }
+ bool useFrameCount() const { return doFrameCount; }
+
protected:
bool display_fps;
int writer;
@@ -60,6 +63,7 @@
int file_number;
int skip_frames;
string prefix;
+ bool doFrameCount;
string type_extension;
float init_time;
bool use_timestamp; // Use either timestamp of file number counter.
Modified: trunk/Engine/Display/PureOpenGLDisplay.h
==============================================================================
--- trunk/Engine/Display/PureOpenGLDisplay.h (original)
+++ trunk/Engine/Display/PureOpenGLDisplay.h Tue Oct 30 16:09:52 2007
@@ -31,8 +31,12 @@
#include <Core/Color/RGBColor.h>
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
//#include <GL/glext.h>
+#endif
// #ifdef __APPLE__
# ifndef GL_ARB_vertex_buffer_object
Modified: trunk/UserInterface/CameraPathAutomator.cc
==============================================================================
--- trunk/UserInterface/CameraPathAutomator.cc (original)
+++ trunk/UserInterface/CameraPathAutomator.cc Tue Oct 30 16:09:52 2007
@@ -44,6 +44,8 @@
#include <stdio.h>
#include <errno.h>
+#include <fstream>
+
using namespace Manta;
using namespace SCIRun;
@@ -139,22 +141,23 @@
vector<string> args;
string name;
- char line[128];
-
/////////////////////////////////////////////////////////////////////////////
// Load the input file.
- FILE *file = fopen( file_name.c_str(), "r" );
- if (file == 0) {
+ std::string line;
+
+ std::ifstream file(file_name.c_str());
+ if(!file){
throw ErrnoException( "Cannot open camera path file: " + file_name,
errno, __FILE__, __LINE__ );
}
/////////////////////////////////////////////////////////////////////////////
// Count input.
- while (!feof(file)) {
-
+ while (true){
// Read in one line at a time.
- fgets( line, 127, file );
+ getline(file, line);
+ if(file.eof())
+ break;
// Parse a manta specification.
parseSpec( line, name, args );
@@ -171,8 +174,9 @@
__FILE__, __LINE__ );
}
- // Rewind the input file.
- fseek( file, SEEK_SET, 0 );
+ // Clear the EOF bit and rewind the input file.
+ file.clear();
+ file.seekg(0);
// Allocate storage for points.
eye = new Vector[total_points];
@@ -185,12 +189,14 @@
int control_point = 0;
char error_message[64];
- while (!feof(file)) {
-
+ while(true){
// Parse a new set of args.
args.clear();
- fgets( line, 127, file );
+ getline(file, line);
+ if(file.eof())
+ break;
+
parseSpec( line, name, args );
///////////////////////////////////////////////////////////////////////////
@@ -281,7 +287,6 @@
}
UserInterface *CameraPathAutomator::create( const vector<string> &args,
MantaInterface *manta_interface_ ) {
-
/////////////////////////////////////////////////////////////////////////////
// Parse args.
string file_name;
- [Manta] r1793 - in trunk: Engine/Display UserInterface, roni, 10/30/2007
Archive powered by MHonArc 2.6.16.