本文整理汇总了C++中Trackball::getRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Trackball::getRotation方法的具体用法?C++ Trackball::getRotation怎么用?C++ Trackball::getRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trackball
的用法示例。
在下文中一共展示了Trackball::getRotation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
display(void)
{
Matrix m1, m2, m3;
Quaternion q1;
tball.getRotation().getValue(m3);
q1.setValue(m3);
m1.setRotate(q1);
// std::cout << "TBROT" << std::endl << tball.getRotation() << std::endl;
// std::cout << "M3" << std::endl << m3 << std::endl;
// std::cout << "Q1" << std::endl << q1 << std::endl;
// std::cout << "M1" << std::endl << m1 << std::endl;
// m1.setRotate( tball.getRotation() );
m2.setTranslate( tball.getPosition() );
//std::cout << "Pos: " << tball.getPosition() << ", Rot: " << tball.getRotation() << std::endl;
// std::cout << tball.getRotation() << std::endl;
m1.mult( m2 );
cam_trans->editSFMatrix()->setValue( m1 );
win->draw( ract );
}
示例2: 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 );
}
示例3: doCamTrans
void doCamTrans ( 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->getSFMatrix()->setValue( m1 );
}
示例4: 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 );
}
示例5: 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);
}
示例6: 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);
#if 0
m1c.setIdentity();
Matrix m2c, m3c;
Quaternion q1c;
tcamball.getRotation().getValue(m3c);
q1c.setValue(m3c);
m1c.setRotate(q1c);
m2c.setTranslate( tcamball.getPosition() );
m1c.mult( m2c );
#else
m1c.setIdentity();
float fLat = xPoints[0][1] + (xPoints[1][1] - xPoints[0][1]) * t;
float fLong = xPoints[0][0] + (xPoints[1][0] - xPoints[0][0]) * t;
// fprintf(stderr, "%f %f\n", fLat, fLong);
if(bAnimate == true)
{
t += tStep;
if(t > 1)
{
tStep = -tStep;
t = 1;
}
else if(t < 0)
{
tStep = -tStep;
t = 0;
}
}
Pnt3f p1;
projectPnt(p1, fLat, fLong, 50);
m1c[3][0] = p1[0];
m1c[3][1] = p1[1];
m1c[3][2] = p1[2];
#endif
scene_trans->editSFMatrix()->setValue(m1c);
Vec3f x1(m1c[3][0],
m1c[3][1],
m1c[3][2]);
Vec3f x2;
backProjectPnt(x2, x1);
/*
fprintf(stderr, "%f %f %f\n",
osgRad2Degree(x2[0]),
x2[2],
osgRad2Degree(x2[1]));
*/
/* -285.728333 -285.728333 | 494.500488 494.500488 */
const BbqDataSourceInformation &tInfo =
pSource->getInformation();
m4c.setIdentity();
m4c[3][0] = osgRad2Degree(x2[0]);
m4c[3][1] = 0; //x2[2];
// m4c[3][2] = -45.f - (osgRad2Degree(x2[1]) + 40.f);
// m4c[3][2] = -(osgRad2Degree(x2[1]) + 40.f);
m4c[3][2] = osgRad2Degree(x2[1]);
// fprintf(stderr, "%f %f\n",
// -(osgRad2Degree(x2[1]) + 40.f),
// -45.f - (osgRad2Degree(x2[1]) + 40.f));
//.........这里部分代码省略.........
示例7: key
void key(unsigned char key, int x, int y)
{
switch(key)
{
case 27:
win = NULL;
rentravact = NULL;
root = NULL;
file = NULL;
cam = NULL;
vp = NULL;
win = NULL;
cam_trans = NULL;
scene_trans = NULL;
osgExit();
exit(0);
case 'a':
glDisable( GL_LIGHTING );
std::cerr << "Lighting disabled." << std::endl;
break;
case 's':
glEnable( GL_LIGHTING );
std::cerr << "Lighting enabled." << std::endl;
break;
case 'r':
{
std::cerr << "Sending ray through " << x << "," << y << std::endl;
Line l;
cam->calcViewRay( l, x, y, *vp );
std::cerr << "From " << l.getPosition() << ", dir "
<< l.getDirection()
<< std::endl;
}
break;
case 'w':
bWireframe = !bWireframe;
break;
case ' ':
{
Matrix m;
Quaternion q;
Vec3f v;
q = oldq;
v = oldv;
oldq = tball.getRotation();
oldv = tball.getPosition();
move_obj = ! move_obj;
if ( move_obj )
{
puts("moving object");
tball.setMode( OSG::Trackball::OSGCamera );
}
else
{
puts("moving camera");
tball.setMode( OSG::Trackball::OSGObject );
}
tball.setStartPosition(v, true);
tball.setStartRotation(q, true);
}
break;
}
}
示例8: key
void key(unsigned char key, int x, int y)
{
switch ( key )
{
case 27:
osgExit();
exit(0);
case 'a':
glDisable( GL_LIGHTING );
std::cerr << "Lighting disabled." << std::endl;
break;
case 's':
glEnable( GL_LIGHTING );
std::cerr << "Lighting enabled." << std::endl;
break;
case 'z':
glPolygonMode( GL_FRONT_AND_BACK, GL_POINT);
std::cerr << "PolygonMode: Point." << std::endl;
break;
case 'x':
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE);
std::cerr << "PolygonMode: Line." << std::endl;
break;
case 'c':
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL);
std::cerr << "PolygonMode: Fill." << std::endl;
break;
case 'r':
{
std::cerr << "Sending ray through " << x << "," << y << std::endl;
Line l;
cam->calcViewRay( l, x, y, *vp );
std::cerr << "From " << l.getPosition() << ", dir "
<< l.getDirection()
<< std::endl;
}
break;
case ' ':
{
Matrix m;
Quaternion q;
Vec3f v;
q = oldq;
v = oldv;
oldq = tball.getRotation();
oldv = tball.getPosition();
move_obj = ! move_obj;
if ( move_obj )
{
puts("moving object");
// m = scene_trans->getSFMatrix()->getValue();
tball.setMode( OSG::Trackball::OSGCamera );
}
else
{
puts("moving camera");
// m = cam_trans->getSFMatrix()->getValue();
tball.setMode( OSG::Trackball::OSGObject );
}
// q.setValue(m);
tball.setStartPosition( v, true );
tball.setStartRotation( q, true );
// std::cout << q << std::endl;
// std::cout << v << std::endl;
// std::cout << " " << m[3][0] << " " << m[3][1] << " " << m[3][2] << std::endl;
}
break;
}
}