本文整理汇总了C++中osg::TransformRecPtr::editMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformRecPtr::editMatrix方法的具体用法?C++ TransformRecPtr::editMatrix怎么用?C++ TransformRecPtr::editMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::TransformRecPtr
的用法示例。
在下文中一共展示了TransformRecPtr::editMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doMain
//.........这里部分代码省略.........
OSG::NodeUnrecPtr pCubeRoot = OSG::Node::create();
OSG::CubeMapGeneratorUnrecPtr pCubeGen = OSG::CubeMapGenerator::create();
pCubeRoot->addChild(file);
pCubeRoot->setCore(pCubeGen);
// pCubeRoot->setCore(Group::create());
OSG::NodeUnrecPtr pCubeSceneRoot = OSG::Node::create();
OSG::VisitSubTreeUnrecPtr pCubeVisit = OSG::VisitSubTree::create();
pCubeSceneRoot->setCore(pCubeVisit);
pCubeVisit->setSubTreeRoot(root);
pCubeGen->setRoot (pCubeSceneRoot);
pCubeGen->setTextureFormat(GL_RGB32F_ARB );
pCubeGen->setSize (512,
512 );
pCubeGen->setTexUnit (3);
// Cubemap Background
OSG::SolidBackgroundUnrecPtr cubeBkgnd = OSG::SolidBackground::create();
{
cubeBkgnd->setColor(OSG::Color3f(0.5f, 0.3f, 0.3f));
}
pCubeGen->setBackground(cubeBkgnd);
OSG::NodeUnrecPtr pAnimRoot = setupAnim();
scene_trans = OSG::Transform::create();
OSG::NodeUnrecPtr sceneTrN = OSG::Node::create();
scene_trans->editMatrix()[3][2] = -50.f;
sceneTrN->setCore (scene_trans);
sceneTrN->addChild(pCubeRoot );
sceneTrN->addChild(pAnimRoot );
OSG::Thread::getCurrentChangeList()->commitChanges();
OSG::Vec3f min,max;
sceneTrN->updateVolume();
sceneTrN->getVolume().getBounds(min, max);
std::cout << "Volume: from " << min << " to " << max << std::endl;
dlight->addChild(sceneTrN);
// Camera
cam = OSG::PerspectiveCamera::create();
{
cam->setBeacon( b1n );
cam->setFov( OSG::osgDegree2Rad( 90 ) );
cam->setNear( 0.1f );
cam->setFar( 100000 );
}
// Background
OSG::SolidBackgroundUnrecPtr bkgnd = OSG::SolidBackground::create();
{
bkgnd->setColor(OSG::Color3f(0.3f, 0.3f, 0.3f));
}
示例2: display
void display(void)
{
OSG::Time t;
// std::cout << glutGet(GLUT_WINDOW_WIDTH) << std::endl;
t=-OSG::getSystemTime();
if(animate && animPos.size()>1)
{
if(animLength>0)
animTime = frameCount * (animPos.size())/float(animLength);
OSG::UInt32 i=OSG::UInt32(animTime);
OSG::Real32 a=animTime-i;
OSG::Vec3f v;
OSG::Quaternion q;
if(i+1 < animPos.size())
{
v = animPos[i] + (animPos[i+1] - animPos[i]) * a;
q = OSG::Quaternion::slerp(animOri[i],animOri[i+1],a);
}
else
{
v = animPos[i];
q = animOri[i];
}
cam_trans->editMatrix().setTranslate(v[0],v[1],v[2]);
cam_trans->editMatrix().setRotate(q);
}
else
{
cam_trans->editSFMatrix()->setValue( tball.getFullTrackballMatrix() );
}
try
{
OSG::Thread::getCurrentChangeList()->commitChanges();
#if 0
clusterWindow->activate();
clusterWindow->frameInit();
clusterWindow->renderAllViewports(ract);
#endif
clusterWindow->renderNoFinish(ract);
#if 0
if(showInfo)
{
displayInfo(10,90);
/*
char text[1024];
sprintf(text,"FPS: %12.1f",1.0/frame_time);
showText(10,70,text);
sprintf(text,"Positions: %12d",sum_positions);
showText(10,50,text);
sprintf(text,"Triangles: %12d",sum_triangles);
showText(10,30,text);
sprintf(text,"Geometries: %12d",sum_geometries);
showText(10,10,text);
*/
}
#endif
#if 0
clusterWindow->swap();
clusterWindow->frameExit();
#endif
clusterWindow->frameFinish();
// clear changelist from prototypes
OSG::Thread::getCurrentChangeList()->clear();
}
catch(OSG_STDEXCEPTION_NAMESPACE::exception &e)
{
std::cout << e.what() << std::endl;
cleanup();
exit(0);
}
t+=OSG::getSystemTime();
frame_time = t;
if(animate && animPos.size()>1)
{
OSG::Vec3f v;
printf("Frame %8.3f %8.5f %8.3f\n",
animTime,
t,1/t);
frameCount++;
if(frameCount == animLength)
{
animTime = 0;
frameCount = 0;
if(animLoops > 0)
{
animLoops--;
if(!animLoops)
{
cleanup();
//.........这里部分代码省略.........