本文整理汇总了C++中osg::Matrix::setScale方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::setScale方法的具体用法?C++ Matrix::setScale怎么用?C++ Matrix::setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Matrix
的用法示例。
在下文中一共展示了Matrix::setScale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromBTTransform
OSG::Matrix VRPhysics::fromBTTransform(const btTransform t, OSG::Vec3f scale) {
OSG::Matrix m = fromBTTransform(t);
// apply scale
OSG::Matrix s;
s.setScale(scale);
m.mult(s);
return m;
}
示例2: Animate
void Animate()
{
//Show FPS
//showFpsCounter();
if(bAnim == true)
{
static OSG::Real64 t0 = OSG::getSystemTime();
OSG::Real64 t = OSG::getSystemTime() - t0;
OSG::Real32 rot0 = t * 0.25;
if(rot0 > 360.0)
rot0 -= 360.0;
OSG::Real32 rota = t * 0.5;
if(rota > 360.0)
rota -= 360.0;
OSG::Real32 rotb = t * 1.0;
if(rotb > 360.0)
rotb -= 360.0;
OSG::Real32 rotc = t * 1.5;
if(rotc > 360.0)
rotc -= 360.0;
OSG::Real32 rotd = t * 2.0;
if(rotd > 360.0)
rotd -= 360.0;
// _light2_trans->editMatrix().setTranslate(-100.0*sin(rota),-100.0*cos(rota), 250.0);
//animate Trees
OSG::Quaternion q;
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rota));
_tree1_trans->editMatrix().setRotate(q);
_tree1_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotc));
_tree2_trans->editMatrix().setRotate(q);
_tree2_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotb));
_tree3_trans->editMatrix().setRotate(q);
_tree3_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotb));
_tree4_trans->editMatrix().setRotate(q);
_tree4_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotc));
_tree5_trans->editMatrix().setRotate(q);
_tree5_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotb));
_tree6_trans->editMatrix().setRotate(q);
_tree6_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotd));
_tree7_trans->editMatrix().setRotate(q);
_tree7_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotb));
_tree8_trans->editMatrix().setRotate(q);
_tree8_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
q.setValueAsAxisRad(1, 1, 1, 0.5 * sin(rotc));
_tree9_trans->editMatrix().setRotate(q);
_tree9_trans->editMatrix().setScale(OSG::Vec3f(12.0, 12.0, 10.0));
q.setIdentity();
{
OSG::Matrix m;
m.setIdentity();
OSG::Vec3f scale(0.15f,0.15f,0.15f);
OSG::Vec3f trans(-40.0 * sin(rotb),-40.0 * cos(rotb),
50.0 + 25.0 * sin(rotd));
q.setValueAsAxisRad(0, 0, 1, -rotb);
m.setTransform(trans, q, scale);
_obj1_trans->setMatrix(m);
}
//.........这里部分代码省略.........