Thanx Robert!
All works now but I found that I used SimpleViewer instead Viewer
so cullmask works perfectly but Now my camera callback don't want to work
(I've got camera with trackball manipulator but I don't setup trackball
manipulator to my view.
so I use this to setup callback
viewer.getCamera()->setUpdateCallback(new RotateCB);
and here my callback
class RotateCB : public osg::NodeCallback
{
public :
RotateCB() : _angle(0.){}
virtual void operator () ( osg::Node* node, osg::NodeVisitor* nv)
{
osg::Camera* camera= dynamic_cast<osg::Camera *>(node);
float azAngle(1.56f),elAngle(4.74f),twAngle(-1.57f);
camera->setCullMask(~0x01);
azAngle = ( az * PI ) / 180;
elAngle = ( el * PI ) / 180;
std::cout<<"rotateCB"<<std::endl;
osg::Matrixd myCameraMatrix;
osg::Matrixd cameraRotation;
osg::Matrixd cameraTrans;
cameraRotation.makeRotate(
osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // roll
osg::DegreesToRadians(el), osg::Vec3(1,0,0) , // pitch
osg::DegreesToRadians( az), osg::Vec3(0,0,1) ); // heading
cameraTrans.makeTranslate( 1,5,1 );
myCameraMatrix = cameraRotation * cameraTrans;
osg::Matrixd i = myCameraMatrix.inverse(myCameraMatrix);
camera->setViewMatrix(i*osg::Matrix::rotate(-(osg::PI_2),1,0,0));
traverse(node,nv);
}
protected:
double _angle;
};
Could you please tell me what I'm doing wrong?
Thanx in advance
Roman
----- Original Message -----
From: "Robert Osfield" <[EMAIL PROTECTED]>
To: "osg users" <[email protected]>
Sent: Thursday, May 17, 2007 5:18 PM
Subject: Re: [osg-users] Nub Q: node masking
Hi Roman,
During traversal the cull traversal mask is AND'd with the node mask
and if it returns a non zero value then the node and its subgraph are
traversed, so as you've set it 0x2 & 0x2 will pass. Set the traversal
mask to ~0x2 and you should get the result you want.
On 5/17/07, Roman Grigoriev <[EMAIL PROTECTED]> wrote:
Hi guys!
Node masking don't work at all for me
I setup node like this:
osg::Group* heli=(osg::Group*) osgDB::readNodeFile("ah64d.flt");
heli->setDataVariance(osg::Object::DYNAMIC);
heli->setNodeMask(0x2);
osg::PositionAttitudeTransform* patTarget = new
osg::PositionAttitudeTransform();
patTarget->addChild(heli);
targetDataType* targetData = new targetDataType(patTarget);
patTarget->setUserData( targetData );
root->addChild(patTarget);
patTarget->setUpdateCallback(new updateTargetCB(tIDevState));
and viewer like this:
int inheritanceMask =
(osg::CullSettings::VariablesMask::ALL_VARIABLES &
~osg::CullSettings::VariablesMask::CULL_MASK);
viewer.getCamera()->setInheritanceMask(inheritanceMask);
viewer.getCamera()->setCullMask(0x2);
but I still see my node. How can I disable this node?
Could you please tell me what I'm doing wrong?
Thanx in advance
Bye
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/