Updated usage messages to include new stereo and stencil commandline options.

This commit is contained in:
Robert Osfield
2001-12-22 14:55:22 +00:00
parent 19c99dc94c
commit a370545c79
6 changed files with 204 additions and 101 deletions

View File

@@ -1,8 +1,8 @@
#include <osg/Notify>
#include <osg/Types>
#include "GliderManipulator.h"
#include <osg/Types>
#include <osg/Notify>
using namespace osg;
using namespace osgUtil;
@@ -88,27 +88,27 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
addMouseEvent(ea);
us.requestContinuousUpdate(true);
if (calcMovement()) us.requestRedraw();
return true;
}
return true;
case(GUIEventAdapter::RELEASE):
{
addMouseEvent(ea);
us.requestContinuousUpdate(true);
if (calcMovement()) us.requestRedraw();
return true;
}
return true;
case(GUIEventAdapter::DRAG):
{
addMouseEvent(ea);
us.requestContinuousUpdate(true);
if (calcMovement()) us.requestRedraw();
return true;
}
return true;
case(GUIEventAdapter::MOVE):
{
@@ -116,8 +116,8 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
us.requestContinuousUpdate(true);
if (calcMovement()) us.requestRedraw();
return true;
}
return true;
case(GUIEventAdapter::KEYBOARD):
if (ea.getKey()==' ')
@@ -128,17 +128,28 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
us.requestContinuousUpdate(false);
return true;
}
else if (ea.getKey()=='+')
{
_camera->setFusionDistanceRatio(_camera->getFusionDistanceRatio()*1.25f);
return true;
}
else if (ea.getKey()=='-')
{
_camera->setFusionDistanceRatio(_camera->getFusionDistanceRatio()/1.25f);
return true;
}
return false;
case(GUIEventAdapter::FRAME):
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
return true;
case(GUIEventAdapter::RESIZE):
{
init(ea,us);
us.requestRedraw();
}
return true;
return true;
default:
return false;
}
@@ -161,9 +172,12 @@ void GliderManipulator::addMouseEvent(const GUIEventAdapter& ea)
bool GliderManipulator::calcMovement()
{
_camera->setFusionDistanceMode(osg::Camera::PROPORTIONAL_TO_SCREEN_DISTANCE);
// return if less then two events have been added.
if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false;
float dt = _ga_t0->time()-_ga_t1->time();
if (dt<0.0f)
@@ -220,7 +234,7 @@ bool GliderManipulator::calcMovement()
lv *= (_velocity*dt);
mat *= Matrix::translate(center + lv);
mat *= Matrix::translate(center+lv);
_camera->transformLookAt(mat);

View File

@@ -14,6 +14,37 @@
#include <osg/Quat>
void write_usage(ostream& out,const std::string& name)
{
out << std::endl;
out <<"usage:"<< std::endl;
out <<" "<<name<<" [options] infile1 [infile2 ...]"<< std::endl;
out << std::endl;
out <<"options:"<< std::endl;
out <<" -l libraryName - load plugin of name libraryName"<< std::endl;
out <<" i.e. -l osgdb_pfb"<< std::endl;
out <<" Useful for loading reader/writers which can load"<< std::endl;
out <<" other file formats in addition to its extension."<< std::endl;
out <<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
out <<" i.e. -e pfb"<< std::endl;
out <<" Useful short hand for specifying full library name as"<< std::endl;
out <<" done with -l above, as it automatically expands to"<< std::endl;
out <<" the full library name appropriate for each platform."<< std::endl;
out <<std::endl;
out <<" -stereo - switch on stereo rendering, using the default of,"<< std::endl;
out <<" ANAGLYPHIC or the value set in the OSG_STEREO_MODE "<< std::endl;
out <<" environmental variable. See doc/stereo.html for "<< std::endl;
out <<" further details on setting up accurate stereo "<< std::endl;
out <<" for your system. "<< std::endl;
out <<" -stereo ANAGLYPHIC - switch on anaglyphic(red/cyan) stereo rendering."<< std::endl;
out <<" -stereo QUAD_BUFFER - switch on quad buffered stereo rendering."<< std::endl;
out <<std::endl;
out <<" -stencil - use a visual with stencil buffer enabled, this "<< std::endl;
out <<" also allows the depth complexity statistics mode"<< std::endl;
out <<" to be used (press 'p' three times to cycle to it)."<< std::endl;
out << std::endl;
}
int main( int argc, char **argv )
{
@@ -22,21 +53,7 @@ int main( int argc, char **argv )
if (argc<2)
{
osg::notify(osg::NOTICE)<<"usage:"<< std::endl;
osg::notify(osg::NOTICE)<<" osgimpostor [options] infile1 [infile2 ...]"<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
osg::notify(osg::NOTICE)<<"options:"<< std::endl;
osg::notify(osg::NOTICE)<<" -l libraryName - load plugin of name libraryName"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -l osgdb_pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful for loading reader/writers which can load"<< std::endl;
osg::notify(osg::NOTICE)<<" other file formats in addition to its extension."<< std::endl;
osg::notify(osg::NOTICE)<<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -e pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful short hand for specifying full library name as"<< std::endl;
osg::notify(osg::NOTICE)<<" done with -l above, as it automatically expands to the"<< std::endl;
osg::notify(osg::NOTICE)<<" full library name appropriate for each platform."<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 0;
}
@@ -60,7 +77,11 @@ int main( int argc, char **argv )
// load the nodes from the commandline arguments.
osg::Node* model = osgDB::readNodeFiles(commandLine);
if (!model) return 0;
if (!model)
{
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 1;
}
// the osgUtil::InsertImpostorsVisitor used lower down to insert impostors

View File

@@ -99,23 +99,35 @@ osg::Drawable* createMirrorSurface(float xMin,float xMax,float yMin,float yMax,f
return gset;
}
void write_usage()
void write_usage(ostream& out,const std::string& name)
{
osg::notify(osg::NOTICE)<< std::endl;
osg::notify(osg::NOTICE)<<"usage:"<< std::endl;
osg::notify(osg::NOTICE)<<" osgreflect [options] infile1 [infile2 ...]"<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
osg::notify(osg::NOTICE)<<"options:"<< std::endl;
osg::notify(osg::NOTICE)<<" -l libraryName - load plugin of name libraryName"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -l osgdb_pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful for loading reader/writers which can load"<< std::endl;
osg::notify(osg::NOTICE)<<" other file formats in addition to its extension."<< std::endl;
osg::notify(osg::NOTICE)<<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -e pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful short hand for specifying full library name as"<< std::endl;
osg::notify(osg::NOTICE)<<" done with -l above, as it automatically expands to the"<< std::endl;
osg::notify(osg::NOTICE)<<" full library name appropriate for each platform."<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
out << std::endl;
out <<"usage:"<< std::endl;
out <<" "<<name<<" [options] infile1 [infile2 ...]"<< std::endl;
out << std::endl;
out <<"options:"<< std::endl;
out <<" -l libraryName - load plugin of name libraryName"<< std::endl;
out <<" i.e. -l osgdb_pfb"<< std::endl;
out <<" Useful for loading reader/writers which can load"<< std::endl;
out <<" other file formats in addition to its extension."<< std::endl;
out <<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
out <<" i.e. -e pfb"<< std::endl;
out <<" Useful short hand for specifying full library name as"<< std::endl;
out <<" done with -l above, as it automatically expands to"<< std::endl;
out <<" the full library name appropriate for each platform."<< std::endl;
out <<std::endl;
out <<" -stereo - switch on stereo rendering, using the default of,"<< std::endl;
out <<" ANAGLYPHIC or the value set in the OSG_STEREO_MODE "<< std::endl;
out <<" environmental variable. See doc/stereo.html for "<< std::endl;
out <<" further details on setting up accurate stereo "<< std::endl;
out <<" for your system. "<< std::endl;
out <<" -stereo ANAGLYPHIC - switch on anaglyphic(red/cyan) stereo rendering."<< std::endl;
out <<" -stereo QUAD_BUFFER - switch on quad buffered stereo rendering."<< std::endl;
out <<std::endl;
out <<" -stencil - use a visual with stencil buffer enabled, this "<< std::endl;
out <<" also allows the depth complexity statistics mode"<< std::endl;
out <<" to be used (press 'p' three times to cycle to it)."<< std::endl;
out << std::endl;
}
int main( int argc, char **argv )
@@ -126,7 +138,7 @@ int main( int argc, char **argv )
if (argc<2)
{
write_usage();
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 0;
}
@@ -152,7 +164,7 @@ int main( int argc, char **argv )
if (!loadedModel)
{
write_usage();
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 1;
}

View File

@@ -327,26 +327,38 @@ osg::Node* createModelFromImages(ImageList& imageList)
}
void write_usage()
void write_usage(ostream& out,const std::string& name)
{
osg::notify(osg::NOTICE)<<std::endl;
osg::notify(osg::NOTICE)<<"usage:"<<std::endl;
osg::notify(osg::NOTICE)<<" osgtexture [options] image_file1 [image_infile2 ...]"<<std::endl;
osg::notify(osg::NOTICE)<<std::endl;
osg::notify(osg::NOTICE)<<"options:"<<std::endl;
osg::notify(osg::NOTICE)<<" -l libraryName - load plugin of name libraryName"<<std::endl;
osg::notify(osg::NOTICE)<<" i.e. -l osgdb_pfb"<<std::endl;
osg::notify(osg::NOTICE)<<" Useful for loading reader/writers which can load"<<std::endl;
osg::notify(osg::NOTICE)<<" other file formats in addition to its extension."<<std::endl;
osg::notify(osg::NOTICE)<<" -e extensionName - load reader/wrter plugin for file extension"<<std::endl;
osg::notify(osg::NOTICE)<<" i.e. -e pfb"<<std::endl;
osg::notify(osg::NOTICE)<<" Useful short hand for specifying full library name as"<<std::endl;
osg::notify(osg::NOTICE)<<" done with -l above, as it automatically expands to the"<<std::endl;
osg::notify(osg::NOTICE)<<" full library name appropriate for each platform."<<std::endl;
osg::notify(osg::NOTICE)<<std::endl;
osg::notify(osg::NOTICE)<<"example:"<<std::endl;
osg::notify(osg::NOTICE)<<" osgtexture lz.rgb"<<std::endl;
osg::notify(osg::NOTICE)<<std::endl;
out << std::endl;
out <<"usage:"<< std::endl;
out <<" "<<name<<" [options] image_infile1 [image_infile2 ...]"<< std::endl;
out << std::endl;
out <<"options:"<< std::endl;
out <<" -l libraryName - load plugin of name libraryName"<< std::endl;
out <<" i.e. -l osgdb_pfb"<< std::endl;
out <<" Useful for loading reader/writers which can load"<< std::endl;
out <<" other file formats in addition to its extension."<< std::endl;
out <<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
out <<" i.e. -e pfb"<< std::endl;
out <<" Useful short hand for specifying full library name as"<< std::endl;
out <<" done with -l above, as it automatically expands to"<< std::endl;
out <<" the full library name appropriate for each platform."<< std::endl;
out <<std::endl;
out <<" -stereo - switch on stereo rendering, using the default of,"<< std::endl;
out <<" ANAGLYPHIC or the value set in the OSG_STEREO_MODE "<< std::endl;
out <<" environmental variable. See doc/stereo.html for "<< std::endl;
out <<" further details on setting up accurate stereo "<< std::endl;
out <<" for your system. "<< std::endl;
out <<" -stereo ANAGLYPHIC - switch on anaglyphic(red/cyan) stereo rendering."<< std::endl;
out <<" -stereo QUAD_BUFFER - switch on quad buffered stereo rendering."<< std::endl;
out <<std::endl;
out <<" -stencil - use a visual with stencil buffer enabled, this "<< std::endl;
out <<" also allows the depth complexity statistics mode"<< std::endl;
out <<" to be used (press 'p' three times to cycle to it)."<< std::endl;
out << std::endl;
out<<"example:"<<std::endl;
out<<" osgtexture lz.rgb"<<std::endl;
out<<std::endl;
}
int main( int argc, char **argv )
@@ -357,7 +369,7 @@ int main( int argc, char **argv )
if (argc<2)
{
write_usage();
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 0;
}
@@ -400,7 +412,10 @@ int main( int argc, char **argv )
viewer.run();
}
else
write_usage();
{
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 0;
}

View File

@@ -14,6 +14,36 @@
#include <osg/Quat>
void write_usage(ostream& out,const std::string& name)
{
out << std::endl;
out <<"usage:"<< std::endl;
out <<" "<<name<<" [options] infile1 [infile2 ...]"<< std::endl;
out << std::endl;
out <<"options:"<< std::endl;
out <<" -l libraryName - load plugin of name libraryName"<< std::endl;
out <<" i.e. -l osgdb_pfb"<< std::endl;
out <<" Useful for loading reader/writers which can load"<< std::endl;
out <<" other file formats in addition to its extension."<< std::endl;
out <<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
out <<" i.e. -e pfb"<< std::endl;
out <<" Useful short hand for specifying full library name as"<< std::endl;
out <<" done with -l above, as it automatically expands to"<< std::endl;
out <<" the full library name appropriate for each platform."<< std::endl;
out <<std::endl;
out <<" -stereo - switch on stereo rendering, using the default of,"<< std::endl;
out <<" ANAGLYPHIC or the value set in the OSG_STEREO_MODE "<< std::endl;
out <<" environmental variable. See doc/stereo.html for "<< std::endl;
out <<" further details on setting up accurate stereo "<< std::endl;
out <<" for your system. "<< std::endl;
out <<" -stereo ANAGLYPHIC - switch on anaglyphic(red/cyan) stereo rendering."<< std::endl;
out <<" -stereo QUAD_BUFFER - switch on quad buffered stereo rendering."<< std::endl;
out <<std::endl;
out <<" -stencil - use a visual with stencil buffer enabled, this "<< std::endl;
out <<" also allows the depth complexity statistics mode"<< std::endl;
out <<" to be used (press 'p' three times to cycle to it)."<< std::endl;
out << std::endl;
}
int main( int argc, char **argv )
{
@@ -23,21 +53,7 @@ int main( int argc, char **argv )
if (argc<2)
{
osg::notify(osg::NOTICE)<<"usage:"<< std::endl;
osg::notify(osg::NOTICE)<<" osgviews [options] infile1 [infile2 ...]"<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
osg::notify(osg::NOTICE)<<"options:"<< std::endl;
osg::notify(osg::NOTICE)<<" -l libraryName - load plugin of name libraryName"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -l osgdb_pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful for loading reader/writers which can load"<< std::endl;
osg::notify(osg::NOTICE)<<" other file formats in addition to its extension."<< std::endl;
osg::notify(osg::NOTICE)<<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -e pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful short hand for specifying full library name as"<< std::endl;
osg::notify(osg::NOTICE)<<" done with -l above, as it automatically expands to the"<< std::endl;
osg::notify(osg::NOTICE)<<" full library name appropriate for each platform."<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 0;
}
@@ -59,7 +75,11 @@ int main( int argc, char **argv )
// load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(commandLine);
if (!rootnode) return 0;
if (!rootnode)
{
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 1;
}
// create the vewiports

View File

@@ -16,6 +16,37 @@
#include <osgUtil/Optimizer>
void write_usage(ostream& out,const std::string& name)
{
out << std::endl;
out <<"usage:"<< std::endl;
out <<" "<<name<<" [options] infile1 [infile2 ...]"<< std::endl;
out << std::endl;
out <<"options:"<< std::endl;
out <<" -l libraryName - load plugin of name libraryName"<< std::endl;
out <<" i.e. -l osgdb_pfb"<< std::endl;
out <<" Useful for loading reader/writers which can load"<< std::endl;
out <<" other file formats in addition to its extension."<< std::endl;
out <<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
out <<" i.e. -e pfb"<< std::endl;
out <<" Useful short hand for specifying full library name as"<< std::endl;
out <<" done with -l above, as it automatically expands to"<< std::endl;
out <<" the full library name appropriate for each platform."<< std::endl;
out <<std::endl;
out <<" -stereo - switch on stereo rendering, using the default of,"<< std::endl;
out <<" ANAGLYPHIC or the value set in the OSG_STEREO_MODE "<< std::endl;
out <<" environmental variable. See doc/stereo.html for "<< std::endl;
out <<" further details on setting up accurate stereo "<< std::endl;
out <<" for your system. "<< std::endl;
out <<" -stereo ANAGLYPHIC - switch on anaglyphic(red/cyan) stereo rendering."<< std::endl;
out <<" -stereo QUAD_BUFFER - switch on quad buffered stereo rendering."<< std::endl;
out <<std::endl;
out <<" -stencil - use a visual with stencil buffer enabled, this "<< std::endl;
out <<" also allows the depth complexity statistics mode"<< std::endl;
out <<" to be used (press 'p' three times to cycle to it)."<< std::endl;
out << std::endl;
}
int main( int argc, char **argv )
{
@@ -25,21 +56,7 @@ int main( int argc, char **argv )
if (argc<2)
{
osg::notify(osg::NOTICE)<<"usage:"<< std::endl;
osg::notify(osg::NOTICE)<<" sgv [options] infile1 [infile2 ...]"<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
osg::notify(osg::NOTICE)<<"options:"<< std::endl;
osg::notify(osg::NOTICE)<<" -l libraryName - load plugin of name libraryName"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -l osgdb_pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful for loading reader/writers which can load"<< std::endl;
osg::notify(osg::NOTICE)<<" other file formats in addition to its extension."<< std::endl;
osg::notify(osg::NOTICE)<<" -e extensionName - load reader/wrter plugin for file extension"<< std::endl;
osg::notify(osg::NOTICE)<<" i.e. -e pfb"<< std::endl;
osg::notify(osg::NOTICE)<<" Useful short hand for specifying full library name as"<< std::endl;
osg::notify(osg::NOTICE)<<" done with -l above, as it automatically expands to the"<< std::endl;
osg::notify(osg::NOTICE)<<" full library name appropriate for each platform."<< std::endl;
osg::notify(osg::NOTICE)<< std::endl;
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 0;
}
@@ -61,7 +78,11 @@ int main( int argc, char **argv )
// load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(commandLine);
if (!rootnode) return 0;
if (!rootnode)
{
write_usage(osg::notify(osg::NOTICE),argv[0]);
return 1;
}
// run optimization over the scene graph
osgUtil::Optimizer optimzer;