本文整理汇总了C++中osg::Matrix::multFull方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::multFull方法的具体用法?C++ Matrix::multFull怎么用?C++ Matrix::multFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Matrix
的用法示例。
在下文中一共展示了Matrix::multFull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//
// transform vector from world space to eye space
//
OSG::Vec3f transform_to_eye_space(const OSG::Vec3f& v, OSG::SimpleSceneManager* pSSM)
{
if (!pSSM || !pSSM->getWindow() || pSSM->getWindow()->getMFPort()->size() == 0)
return v;
OSG::Viewport* pPort = mgr->getWindow()->getPort(0);
OSG::Vec3f v_es;
OSG::Matrix view;
OSG::Int16 width = pPort->calcPixelWidth();
OSG::Int16 height = pPort->calcPixelHeight();
pPort->getCamera()->getViewing(view, width, height);
view.multFull( v, v_es);
return v_es;
}
示例2: mouseMove
/*! The mouseMove is called by the viewer when the mouse is moved in the
viewer and this handle is the active one.
\param x the x-pos of the mouse (pixel)
\param y the y-pos of the mouse (pixel)
*/
void PlaneMoveManipulator::mouseMove(const Int16 x,
const Int16 y)
{
SLOG << "==============================" << endLog;
SLOG << "PlaneMoveManipulator::mouseMove() enter x=" << x << " y=" << y << endLog;
// get the beacon's core (must be ComponentTransform) and it's center
if( getTarget() == NULL )
{
SWARNING << "Handle has no target.\n";
return;
}
// get transformation of beacon
Transform *t = dynamic_cast<Transform *>(getTarget()->getCore());
if( t == NULL )
{
SWARNING << "handled object has no parent transform!\n";
return;
}
Vec3f translation; // for matrix decomposition
Quaternion rotation;
Vec3f scaleFactor;
Quaternion scaleOrientation;
t->getMatrix().getTransform(translation, rotation, scaleFactor,
scaleOrientation);
OSG::Line viewray;
getViewport()->getCamera()->calcViewRay(viewray, x, y, *getViewport());
SLOG << "Manipulator::mouseMove(): viewray: " << viewray << endLog;
// Get manipulator axes into world space
OSG::Matrix tm = getTarget()->getToWorld();
Vec3f rot_axis;
tm.multFull(Vec3f(0,1,0), rot_axis);
Plane pl(rot_axis, getClickPoint());
Pnt3f plpoint;
if (pl.intersect(viewray, plpoint) == true) // Ignore moving out of the plane...
{
SLOG << "Manipulator::mouseMove(): plpoint: " << plpoint << endLog;
Vec3f trans = getBaseTranslation();
Quaternion rot = getBaseRotation();
// Get manipulator axes into world space
Vec3f xp,zp;
tm.multFull(Vec3f(1,0,0), xp);
tm.multFull(Vec3f(0,0,1), zp);
if (getActiveSubHandle() == getHandleXNode())
{
Line xaxis(getClickPoint(), xp);
Line zaxis(getClickPoint(), zp);
Real32 fx = xaxis.getClosestPointT(plpoint);
Real32 fz = zaxis.getClosestPointT(plpoint);
SLOG << "Manipulator::mouseMove(): xaxis: " << xaxis << " zaxis: " << zaxis <<endLog;
SLOG << "Manipulator::mouseMove(): fx: " << fx << " fz: " << fz <<endLog;
// Alternative: transform hitpoint into manip space
OSG::Matrix m = getTarget()->getToWorld();
m.invert();
Pnt3f mpoint;
m.mult(plpoint, mpoint);
SLOG << "Manipulator::mouseMove(): mpoint:" << mpoint << endLog;
trans = trans + xp * fx + zp * fz;
}
else if (getActiveSubHandle() == getHandleZNode())
{
Pnt3f wcenter;
tm.multFull(Pnt3f(0,getLength()[1],0), wcenter);
Vec3f vclick, vcurrent;
vclick = getClickPoint() - wcenter;
vcurrent = plpoint - wcenter;
vclick.normalize();
vcurrent.normalize();
//.........这里部分代码省略.........