Added support to slideshow3D for -s commandline option allow the size of
the display to be specified. Also implementaited some code for display position and speed info in osgProducer::Viewer, not fully implemented yet.
This commit is contained in:
@@ -48,8 +48,9 @@ void DisplaySettings::copy(const DisplaySettings& vs)
|
||||
_displayType = vs._displayType;
|
||||
_stereoMode = vs._stereoMode;
|
||||
_eyeSeparation = vs._eyeSeparation;
|
||||
_screenDistance = vs._screenDistance;
|
||||
_screenWidth = vs._screenWidth;
|
||||
_screenHeight = vs._screenHeight;
|
||||
_screenDistance = vs._screenDistance;
|
||||
|
||||
_splitStereoHorizontalEyeMapping = vs._splitStereoHorizontalEyeMapping;
|
||||
_splitStereoHorizontalSeparation = vs._splitStereoHorizontalSeparation;
|
||||
@@ -89,8 +90,9 @@ void DisplaySettings::setDefaults()
|
||||
_stereo = false;
|
||||
_stereoMode = ANAGLYPHIC;
|
||||
_eyeSeparation = 0.05f;
|
||||
_screenDistance = 0.5f;
|
||||
_screenWidth = 0.325f;
|
||||
_screenHeight = 0.26f;
|
||||
_screenDistance = 0.5f;
|
||||
|
||||
_splitStereoHorizontalEyeMapping = LEFT_EYE_LEFT_VIEWPORT;
|
||||
_splitStereoHorizontalSeparation = 0;
|
||||
@@ -200,9 +202,9 @@ void DisplaySettings::readEnvironmentalVariables()
|
||||
_eyeSeparation = atof(ptr);
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_SCREEN_DISTANCE")) != 0)
|
||||
if( (ptr = getenv("OSG_SCREEN_WIDTH")) != 0)
|
||||
{
|
||||
_screenDistance = atof(ptr);
|
||||
_screenWidth = atof(ptr);
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_SCREEN_HEIGHT")) != 0)
|
||||
@@ -210,6 +212,11 @@ void DisplaySettings::readEnvironmentalVariables()
|
||||
_screenHeight = atof(ptr);
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_SCREEN_DISTANCE")) != 0)
|
||||
{
|
||||
_screenDistance = atof(ptr);
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_SPLIT_STEREO_HORIZONTAL_EYE_MAPPING")) != 0)
|
||||
{
|
||||
if (strcmp(ptr,"LEFT_EYE_LEFT_VIEWPORT")==0)
|
||||
|
||||
@@ -136,6 +136,10 @@ Viewer::Viewer():
|
||||
_done(false),
|
||||
_recordingAnimationPath(false)
|
||||
{
|
||||
_position[0] = 0.0;
|
||||
_position[1] = 0.0;
|
||||
_position[2] = 0.0;
|
||||
_speed = 0.0;
|
||||
}
|
||||
|
||||
Viewer::Viewer(Producer::CameraConfig *cfg):
|
||||
@@ -143,6 +147,10 @@ Viewer::Viewer(Producer::CameraConfig *cfg):
|
||||
_done(false),
|
||||
_recordingAnimationPath(false)
|
||||
{
|
||||
_position[0] = 0.0;
|
||||
_position[1] = 0.0;
|
||||
_position[2] = 0.0;
|
||||
_speed = 0.0;
|
||||
}
|
||||
|
||||
Viewer::Viewer(const std::string& configFile):
|
||||
@@ -150,6 +158,10 @@ Viewer::Viewer(const std::string& configFile):
|
||||
_done(false),
|
||||
_recordingAnimationPath(false)
|
||||
{
|
||||
_position[0] = 0.0;
|
||||
_position[1] = 0.0;
|
||||
_position[2] = 0.0;
|
||||
_speed = 0.0;
|
||||
}
|
||||
|
||||
Viewer::Viewer(osg::ArgumentParser& arguments):
|
||||
@@ -157,6 +169,11 @@ Viewer::Viewer(osg::ArgumentParser& arguments):
|
||||
_done(false),
|
||||
_recordingAnimationPath(false)
|
||||
{
|
||||
_position[0] = 0.0;
|
||||
_position[1] = 0.0;
|
||||
_position[2] = 0.0;
|
||||
_speed = 0.0;
|
||||
|
||||
// report the usage options.
|
||||
if (arguments.getApplicationUsage())
|
||||
{
|
||||
@@ -477,14 +494,38 @@ void Viewer::update()
|
||||
|
||||
void Viewer::frame()
|
||||
{
|
||||
// record the position of the view point.
|
||||
osg::Matrixd matrix;
|
||||
matrix.invert(getViewMatrix());
|
||||
matrix.get(_orientation);
|
||||
|
||||
double newPosition[3];
|
||||
newPosition[0] = matrix(3,0);
|
||||
newPosition[1] = matrix(3,1);
|
||||
newPosition[2] = matrix(3,2);
|
||||
|
||||
_speed = sqrtf(osg::square(newPosition[0]-_position[0])+osg::square(newPosition[1]-_position[1])+osg::square(newPosition[2]-_position[2]));
|
||||
_position[0] = newPosition[0];
|
||||
_position[1] = newPosition[1];
|
||||
_position[2] = newPosition[2];
|
||||
|
||||
#if 0
|
||||
osg::Quat::value_type angle;
|
||||
osg::Vec3 axis;
|
||||
|
||||
osg::Quat roll;
|
||||
roll.makeRotate(-osg::PI/2.0f,1,0,0);
|
||||
|
||||
_orientation = roll*_orientation;
|
||||
|
||||
_orientation.getRotate(angle,axis);
|
||||
|
||||
std::cout<<"_position "<<_position[0]<<", "<<_position[1]<<", "<<_position[2]<<" speed "<<_speed<<" angle "<<osg::RadiansToDegrees(angle)<<" axis "<<axis<<std::endl;
|
||||
#endif
|
||||
|
||||
if (getRecordingAnimationPath() && getAnimationPath())
|
||||
{
|
||||
osg::Matrixd matrix;
|
||||
matrix.invert(getViewMatrix());
|
||||
osg::Quat quat;
|
||||
matrix.get(quat);
|
||||
getAnimationPath()->insert(_frameStamp->getReferenceTime(),osg::AnimationPath::ControlPoint(matrix.getTrans(),quat));
|
||||
getAnimationPath()->insert(_frameStamp->getReferenceTime(),osg::AnimationPath::ControlPoint(osg::Vec3(_position[0],_position[1],_position[2]),_orientation));
|
||||
}
|
||||
|
||||
OsgCameraGroup::frame();
|
||||
|
||||
@@ -58,7 +58,8 @@ public:
|
||||
_veh(veh),
|
||||
_cameraNumber(cameraNumber),
|
||||
_helpInitialized(false),
|
||||
_statsInitialized(false)
|
||||
_statsInitialized(false),
|
||||
_infoInitialized(false)
|
||||
{
|
||||
_fs.resize(10);
|
||||
_index = 0;
|
||||
@@ -120,7 +121,7 @@ protected:
|
||||
|
||||
typedef std::vector<double> CameraTimes;
|
||||
|
||||
bool _statsInitialized;
|
||||
bool _statsInitialized;
|
||||
osg::ref_ptr<osgText::Text> _frameRateLabelText;
|
||||
osg::ref_ptr<osgText::Text> _frameRateCounterText;
|
||||
TextList _statsLabelList;
|
||||
@@ -130,6 +131,15 @@ protected:
|
||||
CameraTimes _drawTimes;
|
||||
TextList _drawTimeText;
|
||||
|
||||
// info related methods and data.
|
||||
void displayInfo();
|
||||
void createInfoText();
|
||||
|
||||
bool _infoInitialized;
|
||||
TextList _infoLabelList;
|
||||
osg::ref_ptr<osgText::Text> _positionText;
|
||||
osg::ref_ptr<osgText::Text> _orientationText;
|
||||
osg::ref_ptr<osgText::Text> _speedText;
|
||||
|
||||
std::vector <Producer::CameraGroup::FrameStats> _fs;
|
||||
unsigned int _index;
|
||||
@@ -168,6 +178,11 @@ void ViewerEventHandler::StatsAndHelpDrawCallback::operator()( const Producer::C
|
||||
displayHelp();
|
||||
}
|
||||
|
||||
if (_veh->getDisplayHelp())
|
||||
{
|
||||
displayInfo();
|
||||
}
|
||||
|
||||
state.popStateSet();
|
||||
|
||||
//state.apply();
|
||||
@@ -677,6 +692,14 @@ void ViewerEventHandler::StatsAndHelpDrawCallback::createStatsText()
|
||||
|
||||
}
|
||||
|
||||
void ViewerEventHandler::StatsAndHelpDrawCallback::displayInfo()
|
||||
{
|
||||
}
|
||||
|
||||
void ViewerEventHandler::StatsAndHelpDrawCallback::createInfoText()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
ViewerEventHandler::ViewerEventHandler(OsgCameraGroup* cg):
|
||||
@@ -824,7 +847,7 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
|
||||
// have already been recording so switch of recording.
|
||||
viewer->setRecordingAnimationPath(false);
|
||||
|
||||
osg::notify(osg::NOTICE) << "To finished recording camera animation, press 'Z' to reply."<< std::endl;
|
||||
osg::notify(osg::NOTICE) << "finished recording camera animation, press 'Z' to replay."<< std::endl;
|
||||
|
||||
if (viewer->getAnimationPath())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user