Added -f/--fixed option to allow use to freeze the animation of the cessna.
This commit is contained in:
parent
cf9518f346
commit
7a66aaca15
@ -71,17 +71,18 @@ class ModelPositionCallback : public osg::NodeCallback
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ModelPositionCallback():
|
ModelPositionCallback(double speed):
|
||||||
_latitude(0.0),
|
_latitude(0.0),
|
||||||
_longitude(0.0),
|
_longitude(0.0),
|
||||||
_height(100000.0)
|
_height(100000.0),
|
||||||
|
_speed(speed)
|
||||||
{
|
{
|
||||||
_rotation.makeRotate(osg::DegreesToRadians(90.0),0.0,0.0,1.0);
|
_rotation.makeRotate(osg::DegreesToRadians(90.0),0.0,0.0,1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateParameters()
|
void updateParameters()
|
||||||
{
|
{
|
||||||
_longitude += ((2.0*osg::PI)/360.0)/20.0;
|
_longitude += _speed * ((2.0*osg::PI)/360.0)/20.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ public:
|
|||||||
double _longitude;
|
double _longitude;
|
||||||
double _height;
|
double _height;
|
||||||
osg::Quat _rotation;
|
osg::Quat _rotation;
|
||||||
|
double _speed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -196,6 +198,10 @@ int main(int argc, char **argv)
|
|||||||
viewer.getCamera()->setNearFarRatio(0.00001f);
|
viewer.getCamera()->setNearFarRatio(0.00001f);
|
||||||
|
|
||||||
|
|
||||||
|
double speed = 1.0;
|
||||||
|
while (arguments.read("-f") || arguments.read("--fixed")) speed = 0.0;
|
||||||
|
|
||||||
|
|
||||||
osg::Quat rotation;
|
osg::Quat rotation;
|
||||||
osg::Vec4 vec4;
|
osg::Vec4 vec4;
|
||||||
while (arguments.read("--rotate-model",vec4[0],vec4[1],vec4[2],vec4[3]))
|
while (arguments.read("--rotate-model",vec4[0],vec4[1],vec4[2],vec4[3]))
|
||||||
@ -340,10 +346,10 @@ int main(int argc, char **argv)
|
|||||||
mt->addChild(scaler);
|
mt->addChild(scaler);
|
||||||
|
|
||||||
|
|
||||||
if (!nc) nc = new ModelPositionCallback;
|
if (!nc) nc = new ModelPositionCallback(speed);
|
||||||
|
|
||||||
mt->setUpdateCallback(nc);
|
mt->setUpdateCallback(nc);
|
||||||
|
|
||||||
csn->addChild(mt);
|
csn->addChild(mt);
|
||||||
|
|
||||||
// if we are using an overaly node, use the cessna subgraph as the overlay subgraph
|
// if we are using an overaly node, use the cessna subgraph as the overlay subgraph
|
||||||
|
Loading…
Reference in New Issue
Block a user