Well, Ill try describe what I'm trying to do. I have scene where I put object
with this code:
Code:
std::string path="models\\";
std::string path2="textures\\";
osg::Node* scene = osgDB::readNodeFile(path+n);
scene->setName("scene");
osg::BlendFunc *blendFunc = new osg::BlendFunc();
osg::BlendColor *blendColor= new osg::BlendColor(osg::Vec4(1, 1, 1,
0.5 ));
blendFunc->setSource(osg::BlendFunc::CONSTANT_ALPHA);
blendFunc->setDestination(osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);
scene->getOrCreateStateSet()->setAttributeAndModes( new osg::BlendFunc
);
scene->getOrCreateStateSet()->setRenderingHint( osg::StateSet::
TRANSPARENT_BIN );
osg::StateSet* pStateSet = scene->getOrCreateStateSet();
pStateSet->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
osg::Texture2D* pTex = new osg::Texture2D;
osg::Image* pImage = osgDB::readImageFile(path2+t);
pTex->setImage( pImage );
pStateSet->setTextureAttributeAndModes( 0, pTex,
osg::StateAttribute::ON );
osg::Material* material = new osg::Material;
material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,1.0f,1.0f,1.0f));
material->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,1.0f,1.0f,1.0f));
material->setAlpha(osg::Material::FRONT_AND_BACK, 0.5);
pStateSet->setAttribute(material,osg::StateAttribute::ON);
pStateSet->setMode(GL_BLEND, true);
osg::BlendFunc* blend = new osg::BlendFunc;
blend->setFunction(osg::BlendFunc::SRC_ALPHA,
osg::BlendFunc::ONE_MINUS_DST_ALPHA);
pStateSet->setAttributeAndModes(blend, osg::StateAttribute::ON |
osg::StateAttribute::OVERRIDE);
osg::ref_ptr<osg::Switch> sw = new osg::Switch;
sw->setName("Switch");
sw->addChild(scene,true);
sw->addChild(getLineCube(pos,11),false);
osg::ref_ptr<AgentShape> myPos = new AgentShape;
myPos->setPosition(pos);
myPos->addChild(sw);
myPos->setName("AgentShape");
osg::ref_ptr<osg::Geode> geodeGizmo = new osg::Geode;
osg::ref_ptr<GizmoDrawable> gizmo = new GizmoDrawable;
gizmo->setName("gizmo");
gizmo->setGizmoMode( GizmoDrawable:: NO_GIZMO);
geodeGizmo->addDrawable( gizmo.get() );
geodeGizmo->setCullingActive( false );
myPos->addChild(geodeGizmo);
return myPos;
}
I use my own class inherited from PAT, because I need my own values. This PAT
contains gizmo from lib gizmo and osggizmo examples. When i put matrix
transform of my osg::Node* scene, I can move object but it doesn't move PAT
actually, so I trying understand how could I move whole PAT with this
gizmo.[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62229#62229
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org