Hi again,
I made a quick example using a text editor. The matrices should
definitely accumulate by themselves in the graph, that's the whole
purpose of the scene graph. Make sure that the matrix is "referenceFrame
RELATIVE".
Have a look at the attached .osg file. I have just copied two
matrixtransforms at the top. You can add more, just add and put a
bracket at the end of the file.
If you run "osgpick sphere.osg" you should see that the sphere center is
at (20,20,0), i.e. two times 10,10 adjustment.
rgds
jp
J.P. Delport wrote:
Hi,
yang zhiyuan wrote:
Hi:
I find something strange like this:
osg::Matrix _matrix;
osg::ref_prt<osg::MatrixTransform> PAT1 = new osg::MatrixTransform();
_matrix.setTrans(osg::Vec3(10.0f,10.0f,0.0f));
PAT1 ->setMatrix(_matrix);
osg::ref_prt<osg::MatrixTransform> PAT2 = new osg::MatrixTransform();
PAT2 ->setMatrix(_matrix);
osg::ref_prt<osg::MatrixTransform> PAT3= new osg::MatrixTransform();
PAT3 ->setMatrix(_matrix);
osg::ref_prt<osg::MatrixTransform> PAT4= new osg::MatrixTransform();
PAT4 ->setMatrix(_matrix);
PAT1->addChild(PAT2->get());
PAT2->addChild(PAT3->get());
PAT3->addChild(PAT4->get());
osg::Node* node = osgDB::readNodeFile("*.ive");
PAT4->addChild(node);
I think node's final position is (40,40,0),but the actual position in
scene is(10,10,0).Do I have to accumulate the four MatrixTransform
manually?
How did you calculate the actual position?
jp
tim.yan
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
MatrixTransform {
DataVariance DYNAMIC
nodeMask 0xffffffff
cullingActive TRUE
referenceFrame RELATIVE
Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
10 10 0 1
}
num_children 1
MatrixTransform {
DataVariance DYNAMIC
nodeMask 0xffffffff
cullingActive TRUE
referenceFrame RELATIVE
Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
10 10 0 1
}
num_children 1
Group {
UniqueID Group_0
DataVariance DYNAMIC
name "sphere_1000K.osg"
nodeMask 0xffffffff
cullingActive TRUE
num_children 1
Geode {
DataVariance DYNAMIC
name "sphere"
nodeMask 0xffffffff
cullingActive TRUE
num_drawables 1
ShapeDrawable {
DataVariance DYNAMIC
StateSet {
UniqueID StateSet_1
DataVariance STATIC
rendering_hint DEFAULT_BIN
renderBinMode INHERIT
Material {
DataVariance STATIC
ColorMode OFF
ambientColor 0.0 0 0 1
diffuseColor 0.0 0 0 1
specularColor 0 0 0 1
emissionColor 0 0.0 1 1
shininess 0
}
}
Sphere {
DataVariance DYNAMIC
Center 0 0 0
Radius 1
}
useDisplayList TRUE
useVertexBufferObjects FALSE
}
}
}
}
}
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org