本文整理汇总了C++中TransformPtr::editSFMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformPtr::editSFMatrix方法的具体用法?C++ TransformPtr::editSFMatrix怎么用?C++ TransformPtr::editSFMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformPtr
的用法示例。
在下文中一共展示了TransformPtr::editSFMatrix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glutGet
void
display(void)
{
Matrix m1, m2;
m1.setRotate( tball.getRotation() );
m2.setTranslate( tball.getPosition() );
m1.mult( m2 );
cam_trans->editSFMatrix()->setValue( m1 );
// move the object
float t = glutGet(GLUT_ELAPSED_TIME);
Quaternion q;
q.setValueAsAxisDeg(0, 1, 0, t / 5000);
m1.setTransform(Vec3f(osgsin(t / 500.), 0, osgcos(t / 500)), q);
tr->setMatrix(m1);
if ( doRender )
win->render( ract );
else
win->draw( dact );
}
示例2: display
void display(void)
{
Matrix m1, m2, m3;
Quaternion q1;
tball.getRotation().getValue(m3);
q1.setValue(m3);
m1.setRotate(q1);
m2.setTranslate( tball.getPosition() );
m1.mult( m2 );
cam_trans->editSFMatrix()->setValue( m1 );
window->draw( drAct );
}
示例3:
void
display(void)
{
Matrix m1, m2, m3;
m1=trackball.getMatrix();
// m1.transpose();
// m2.setTranslate(0,0,8);
// m1.mult(m2);
cam_trans->editSFMatrix()->setValue( m1 );
win->draw( ract );
}
示例4: display
void display(void)
{
Matrix m1, m2;
m1.setRotate(tball.getRotation());
m2.setTranslate(tball.getPosition());
m1.mult(m2);
cam_trans->editSFMatrix()->setValue(m1);
if(doRender)
win->render(ract);
else
win->draw(dact);
}
示例5: main
//.........这里部分代码省略.........
NodePtr medDetailNode = makeSphere( 1, 1 );
GeometryPtr medSphereCore = GeometryPtr::dcast(medDetailNode->getCore());
SimpleMaterialPtr medDetailMat = SimpleMaterial::create();
medDetailMat->setDiffuse( Color3f( 0,1,0 ) );
medDetailMat->setAmbient( Color3f( 0,1,0 ) );
medSphereCore->setMaterial( medDetailMat );
NodePtr highDetailNode = makeSphere( 2, 1 );
GeometryPtr highSphereCore = GeometryPtr::dcast(highDetailNode->getCore());
SimpleMaterialPtr highDetailMat = SimpleMaterial::create();
highDetailMat->setDiffuse( Color3f( 0,0,1 ) );
highDetailMat->setAmbient( Color3f( 0,0,1 ) );
highDetailMat->setSpecular( Color3f(1, 1, 1) );
highDetailMat->setShininess( 10 );
highSphereCore->setMaterial( highDetailMat );
NodePtr lodNode = Node::create();
DistanceLODPtr lodNodeCore = DistanceLOD::create();
beginEditCP(lodNode);
lodNode->setCore(lodNodeCore);
lodNode->addChild( highDetailNode );
lodNode->addChild( medDetailNode );
lodNode->addChild( lowDetailNode );
endEditCP(lodNode);
beginEditCP(lodNodeCore);
lodNodeCore->editSFCenter()->setValue( Pnt3f(0, 0, 2) );
lodNodeCore->editMFRange()->push_back( 4.0 );
lodNodeCore->editMFRange()->push_back( 8.0 );
lodNodeCore->editMFRange()->push_back( 11.0 );
endEditCP(lodNodeCore);
//TRANSFORM LOD
NodePtr transLODNode = Node::create();
TransformPtr transLODCore = Transform::create();
transMat.setTranslate( 1, -1, -1 );
beginEditCP(transLODCore);
transLODCore->editSFMatrix()->setValue( transMat );
endEditCP(transLODCore);
beginEditCP( transLODNode );
transLODNode->setCore( transLODCore );
transLODNode->addChild( lodNode );
endEditCP( transLODNode );
//ROOT
root = Node::create();
GroupPtr rootCore = Group::create();
beginEditCP(root);
root->setCore(rootCore);
root->addChild(transNode);
root->addChild(transLODNode);
endEditCP(root);
camera = PerspectiveCamera::create();
beginEditCP(camera);
camera->setBeacon( beaconNode );
camera->setFov( deg2rad(90) );
camera->setNear( 0.1 );
camera->setFar( 10000 );
endEditCP(camera);
SolidBackgroundPtr background = SolidBackground::create();
viewp = Viewport::create();
beginEditCP(viewp);
viewp->setCamera( camera );
viewp->setBackground( background );
viewp->setRoot( root );
viewp->setSize( 0,0, 1,1 );
endEditCP(viewp);
GLint glVP[4];
glGetIntegerv( GL_VIEWPORT, glVP );
GLUTWindowPtr gwin = GLUTWindow::create();
gwin->setId(winID);
gwin->setSize(glVP[2], glVP[3]);
window = gwin;
beginEditCP(window);
window->addPort( viewp );
window->init();
endEditCP(window);
drAct = DrawAction::create();
Vec3f pos( 0, 0, 3 );
tball.setMode( Trackball::OSGObject );
tball.setStartPosition( pos, true );
tball.setSum( true );
tball.setTranslationMode( Trackball::OSGFree );
glutMainLoop();
return 0;
}