Added the support in AnimationPathCallback for taking a pivot, axis and rotation rate
paramters in its constructor to allow it to be used to create rotations around a point. This provides the same interface and functionality as osgUtil::TransformCallback but has the advantage and AnimationPathCallback is fully supported by the .osg and .ive file formats.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/DriveManipulator>
|
||||
#include <osgUtil/TransformCallback>
|
||||
|
||||
#include <osgProducer/Viewer>
|
||||
|
||||
@@ -65,7 +64,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
||||
|
||||
osg::MatrixTransform* transform= new osg::MatrixTransform;
|
||||
|
||||
osg::NodeCallback* nc = new osgUtil::TransformCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
osg::NodeCallback* nc = new osg::AnimationPathCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
transform->setUpdateCallback(nc);
|
||||
|
||||
osg::ClipNode* clipnode = new osg::ClipNode;
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#include <osg/TexEnvCombine>
|
||||
#include <osg/TexEnv>
|
||||
|
||||
#include <osgUtil/TransformCallback>
|
||||
|
||||
#include <osg/CameraNode>
|
||||
#include <osg/TexGenNode>
|
||||
|
||||
@@ -137,13 +135,13 @@ ref_ptr<Group> _create_scene()
|
||||
ref_ptr<Geode> geode_2 = new Geode;
|
||||
ref_ptr<MatrixTransform> transform_2 = new MatrixTransform;
|
||||
transform_2->addChild(geode_2.get());
|
||||
transform_2->setUpdateCallback(new osgUtil::TransformCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(45.0f)));
|
||||
transform_2->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(45.0f)));
|
||||
scene->addChild(transform_2.get());
|
||||
|
||||
ref_ptr<Geode> geode_3 = new Geode;
|
||||
ref_ptr<MatrixTransform> transform_3 = new MatrixTransform;
|
||||
transform_3->addChild(geode_3.get());
|
||||
transform_3->setUpdateCallback(new osgUtil::TransformCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(-22.5f)));
|
||||
transform_3->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(-22.5f)));
|
||||
scene->addChild(transform_3.get());
|
||||
|
||||
const float radius = 0.8f;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/DriveManipulator>
|
||||
|
||||
#include <osgUtil/TransformCallback>
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgUtil/Tesselator>
|
||||
#include <osgUtil/TransformCallback>
|
||||
#include <osgUtil/CullVisitor>
|
||||
#include <osgUtil/Optimizer>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <osg/ClearNode>
|
||||
|
||||
#include <osgUtil/Tesselator>
|
||||
#include <osgUtil/TransformCallback>
|
||||
#include <osgUtil/CullVisitor>
|
||||
|
||||
#include <osgText/Text>
|
||||
@@ -190,7 +189,7 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb)
|
||||
osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio, const std::string& filename)
|
||||
{
|
||||
osg::MatrixTransform* xform = new osg::MatrixTransform;
|
||||
xform->setUpdateCallback(new osgUtil::TransformCallback(bb.center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(10.0f)));
|
||||
xform->setUpdateCallback(new osg::AnimationPathCallback(bb.center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(10.0f)));
|
||||
|
||||
osg::Node* bluemarble = osgDB::readNodeFile(filename.c_str());
|
||||
if (bluemarble)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <osg/MatrixTransform>
|
||||
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
#include <osgUtil/TransformCallback>
|
||||
|
||||
|
||||
class PBufferTexture2D : public osg::Texture2D
|
||||
@@ -239,7 +238,7 @@ osg::ref_ptr<osg::Node> buildSceneGraphAndSetCameraViews(osg::Node *loadedModel,
|
||||
osg::ref_ptr<osg::MatrixTransform> loadedModelTransform = new osg::MatrixTransform;
|
||||
loadedModelTransform->addChild(loadedModel);
|
||||
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osgUtil::TransformCallback(
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osg::AnimationPathCallback(
|
||||
loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
loadedModelTransform->setUpdateCallback(nc.get());
|
||||
|
||||
@@ -269,7 +268,7 @@ osg::ref_ptr<osg::Node> buildSceneGraph(osg::Node *loadedModel, Producer::Render
|
||||
osg::ref_ptr<osg::MatrixTransform> loadedModelTransform = new osg::MatrixTransform;
|
||||
loadedModelTransform->addChild(loadedModel);
|
||||
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osgUtil::TransformCallback(
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osg::AnimationPathCallback(
|
||||
loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
loadedModelTransform->setUpdateCallback(nc.get());
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/DriveManipulator>
|
||||
|
||||
#include <osgUtil/TransformCallback>
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
@@ -450,7 +449,7 @@ int main( int argc, char **argv )
|
||||
osg::MatrixTransform* loadedModelTransform = new osg::MatrixTransform;
|
||||
loadedModelTransform->addChild(loadedModel);
|
||||
|
||||
osg::NodeCallback* nc = new osgUtil::TransformCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
osg::NodeCallback* nc = new osg::AnimationPathCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
loadedModelTransform->setUpdateCallback(nc);
|
||||
|
||||
osg::Group* rootNode = new osg::Group();
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <osg/RefNodePath>
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
|
||||
#include <osgUtil/TransformCallback>
|
||||
|
||||
#include <osg/CameraNode>
|
||||
#include <osg/TexGenNode>
|
||||
|
||||
@@ -36,13 +34,13 @@ ref_ptr<Group> _create_scene()
|
||||
ref_ptr<Geode> geode_2 = new Geode;
|
||||
ref_ptr<MatrixTransform> transform_2 = new MatrixTransform;
|
||||
transform_2->addChild(geode_2.get());
|
||||
transform_2->setUpdateCallback(new osgUtil::TransformCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(45.0f)));
|
||||
transform_2->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(45.0f)));
|
||||
scene->addChild(transform_2.get());
|
||||
|
||||
ref_ptr<Geode> geode_3 = new Geode;
|
||||
ref_ptr<MatrixTransform> transform_3 = new MatrixTransform;
|
||||
transform_3->addChild(geode_3.get());
|
||||
transform_3->setUpdateCallback(new osgUtil::TransformCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(-22.5f)));
|
||||
transform_3->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(-22.5f)));
|
||||
scene->addChild(transform_3.get());
|
||||
|
||||
const float radius = 0.8f;
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
#include <osg/ColorMask>
|
||||
#include <osg/Depth>
|
||||
#include <osg/ClipNode>
|
||||
|
||||
#include <osgUtil/TransformCallback>
|
||||
#include <osg/AnimationPath>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgUtil/Optimizer>
|
||||
@@ -382,7 +381,7 @@ int main( int argc, char **argv )
|
||||
osg::ref_ptr<osg::MatrixTransform> loadedModelTransform = new osg::MatrixTransform;
|
||||
loadedModelTransform->addChild(loadedModel.get());
|
||||
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osgUtil::TransformCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
osg::ref_ptr<osg::NodeCallback> nc = new osg::AnimationPathCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||
loadedModelTransform->setUpdateCallback(nc.get());
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <osg/Projection>
|
||||
|
||||
#include <osgUtil/Tesselator>
|
||||
#include <osgUtil/TransformCallback>
|
||||
#include <osgUtil/CullVisitor>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user