当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix::multLeft方法代码示例

本文整理汇总了C++中osg::Matrix::multLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::multLeft方法的具体用法?C++ Matrix::multLeft怎么用?C++ Matrix::multLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::Matrix的用法示例。


在下文中一共展示了Matrix::multLeft方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getConvexShape

btCollisionShape* VRPhysics::getConvexShape() {
    btConvexHullShape* shape = new btConvexHullShape();

    OSG::Matrix m;
    OSG::Matrix M = vr_obj->getWorldMatrix();
    M.invert();

    vector<OSG::VRObject*> geos = vr_obj->getObjectListByType("Geometry");
	for (auto g : geos) {
        OSG::VRGeometry* geo = (OSG::VRGeometry*)g;
        if (geo == 0) continue;
        if (geo->getMesh() == 0) continue;
        OSG::GeoVectorPropertyRecPtr pos = geo->getMesh()->getPositions();
        if (pos == 0) continue;

        if (geo != vr_obj) {
            m = geo->getWorldMatrix();
            m.multLeft(M);
        }

		for (unsigned int i = 0; i<pos->size(); i++) {
            OSG::Pnt3f p;
            pos->getValue(p,i);
            if (geo != vr_obj) m.mult(p,p);
            for (int i=0; i<3; i++) p[i] *= scale[i];
            shape->addPoint(btVector3(p[0], p[1], p[2]));
        }
    }

    shape->setMargin(collisionMargin);

    //cout << "\nConstruct Convex shape for " << vr_obj->getName() << endl;
    return shape;
}
开发者ID:AntonChalakov,项目名称:polyvr,代码行数:34,代码来源:VRPhysics.cpp

示例2: makeMatrix

// create the motion matrix for a light source at time t
void makeMatrix(OSG::Real32 t, OSG::Matrix &result)
{
    OSG::Matrix m;
    
    result.setTransform(OSG::Quaternion(OSG::Vec3f(0,0,1), -OSG::Pi / 2));    
    
    m.setTransform(OSG::Vec3f(1, 0, 0));
    result.multLeft(m);
    
    m.setTransform(OSG::Quaternion(OSG::Vec3f(0,1,0), t / 1000.f));    
    result.multLeft(m);

    m.setTransform(OSG::Vec3f(2, 0, 0));
    result.multLeft(m);
    
    m.setTransform(OSG::Quaternion(OSG::Vec3f(0,0,1), t / 3000.f));
    result.multLeft(m); 
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:19,代码来源:lights.cpp

示例3: updateClipPlanes

//
// In  case the clip plane data change this function is called
//
void updateClipPlanes(const VecClipPlaneData& vec)
{
    int sz  = vec.size();

    for(int i = 0; i < iNumClipPlanes; ++i)
    {
        OSG::ClipPlaneChunk *clipPlaneChunk =
            vecClipPlaneDetails[i]._clipPlaneChunk;

        clipPlaneChunk->setEnable(false);

        if(i < sz)
        {
            const ClipPlaneData& data = vec[i];

            //
            // Update the clip plane chunk
            //
            clipPlaneChunk->setEquation(data._equation);
            clipPlaneChunk->setEnable  (data._enabled );

            //
            // and the plane transform core
            //
            OSG::Matrix rotMat;
            OSG::Vec4f v1(0.f, 0.f, -1.f, 0.f);
            OSG::Quaternion q(OSG::Vec3f(v1), OSG::Vec3f(data._equation));
            rotMat.setTransform(q);

            OSG::Matrix mat;
            OSG::Vec3f v2(0.0f, 0.0f, data._equation[3]);
            mat.setTranslate(v2);

            mat.multLeft(rotMat);

            vecClipPlaneDetails[i]._planeTrafoCore->setMatrix(mat);
        }
    }
}
开发者ID:baibaiwei,项目名称:OpenSGDevMaster,代码行数:42,代码来源:clipplanecaps.cpp


注:本文中的osg::Matrix::multLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。