Hi Drake,

just guessing by the subject of the email. If you want to store matrix to
some node (your child node) you can use the userdata of the node and
RefMatrix. Something like

osg::Matrix parentMatrix;
child->setUserData(new osg::RefMatrix(parentMatrix));

then dynamic_cast the userData to RefMatrix when you need it

Again, the hint is just by guessing. Robert is right, it is not clear what
you are after

Cheers,
Nick

On Mon, Jan 5, 2015 at 8:50 PM, Robert Osfield <robert.osfi...@gmail.com>
wrote:

> Hi Drake,
>
> I can't personally help you, I know nothing about gizmo.  You don't really
> explain what you are trying to do either, you provide code, which is a
> specific attempt at a solution to a problem, not a definition of the
> problem which makes it doubly impossible to guess what you need to do.
>
> I'd suggest when explaining stuff you don't provide code, but a high level
> explanation of how you want to manage you scene and how gizmo affects this.
>
> Robert.
>
> On 5 January 2015 at 18:02, Drake Aldwyn <azrai...@gmail.com> wrote:
>
>> 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
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to