• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TransformUnrecPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TransformUnrecPtr的典型用法代码示例。如果您正苦于以下问题:C++ TransformUnrecPtr类的具体用法?C++ TransformUnrecPtr怎么用?C++ TransformUnrecPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: makeNodeFor

void
ColladaNode::handleTranslate(domTranslate *translate)
{
    if(translate == NULL)
        return;

    domNodeRef        node   = getDOMElementAs<domNode>();

    TransformUnrecPtr xform  = Transform::create();
    NodeUnrecPtr      xformN = makeNodeFor(xform);

    xform->editMatrix().setTranslate(translate->getValue()[0],
                                     translate->getValue()[1],
                                     translate->getValue()[2] );

    if(getGlobal()->getOptions()->getCreateNameAttachments() == true && 
       node->getName()                                       != NULL   )
    {
        std::string nodeName = node->getName();

        if(translate->getSid() != NULL)
        {
            nodeName.append("."                );
            nodeName.append(translate->getSid());
        }

        setName(xformN, nodeName);
    }

    appendXForm(xformN);
}
开发者ID:msteners,项目名称:OpenSGDevMaster_Toolbox,代码行数:31,代码来源:OSGColladaNode.cpp


示例2: m

void
ColladaNode::handleMatrix(domMatrix *matrix)
{
    if(matrix == NULL)
        return;

    domNodeRef        node   = getDOMElementAs<domNode>();

    Matrix m(matrix->getValue()[0],      // rVal00
             matrix->getValue()[1],      // rVal10
             matrix->getValue()[2],      // rVal20
             matrix->getValue()[3],      // rVal30
             matrix->getValue()[4],      // rVal01
             matrix->getValue()[5],      // rVal11
             matrix->getValue()[6],      // rVal21
             matrix->getValue()[7],      // rVal31
             matrix->getValue()[8],      // rVal02
             matrix->getValue()[9],      // rVal12
             matrix->getValue()[10],     // rVal22
             matrix->getValue()[11],     // rVal32
             matrix->getValue()[12],     // rVal03
             matrix->getValue()[13],     // rVal13
             matrix->getValue()[14],     // rVal23
             matrix->getValue()[15] );   // rVal33

    if(getGlobal()->getOptions()->getFlattenNodeXForms())
    {
        MatrixTransformationElementUnrecPtr MatrixElement = MatrixTransformationElement::create();
        MatrixElement->setMatrix(m);
        setName(MatrixElement, matrix->getSid());

        appendStackedXForm(MatrixElement, node);
    }
    else
    {
        TransformUnrecPtr xform = Transform::create();

        NodeUnrecPtr      xformN = makeNodeFor(xform);
        
        xform->setMatrix(m);

        if(getGlobal()->getOptions()->getCreateNameAttachments() == true && 
           node->getName()                                       != NULL   )
        {
            std::string nodeName = node->getName();

            if(matrix->getSid() != NULL&& 
			    getGlobal()->getOptions()->getFlattenNodeXForms() == false)
            {
                nodeName.append("."             );
                nodeName.append(matrix->getSid());
            }

            setName(xformN, nodeName);
        }

        appendXForm(xformN);
    }
}
开发者ID:danguilliams,项目名称:OpenSGDevMaster_Toolbox,代码行数:59,代码来源:OSGColladaNode.cpp


示例3: rotationAxis

void
ColladaNode::handleSkew(domSkew *skew)
{
    if(skew == NULL)
        return;
	
    domNodeRef        node   = getDOMElementAs<domNode>();
    Vec3f rotationAxis(skew->getValue()[1],skew->getValue()[2],skew->getValue()[3]), 
          translationAxis(skew->getValue()[4],skew->getValue()[5],skew->getValue()[6]);
    Real32 angle(skew->getValue()[0]);

    if(getGlobal()->getOptions()->getFlattenNodeXForms())
    {
        SkewTransformationElementUnrecPtr SkewElement = SkewTransformationElement::create();
        SkewElement->setRotationAxis(rotationAxis);
        SkewElement->setTranslationAxis(translationAxis);
        SkewElement->setAngle(angle);
        setName(SkewElement, skew->getSid());

        appendStackedXForm(SkewElement, node);
    }
    else
    {

        TransformUnrecPtr xform = Transform::create();
	    NodeUnrecPtr      xformN = makeNodeFor(xform);

        Matrix skewMatrix;
        MatrixSkew(skewMatrix,rotationAxis, translationAxis, angle);

	    xform->setMatrix(skewMatrix);

	     if(getGlobal()->getOptions()->getCreateNameAttachments() == true && 
           node->getName()                                       != NULL   )
        {
            std::string nodeName = node->getName();

            if(skew->getSid() != NULL && 
			    getGlobal()->getOptions()->getFlattenNodeXForms() == false)
            {
                nodeName.append("."                );
                nodeName.append(skew->getSid());
            }

            setName(xformN, nodeName);
        }

        appendXForm(xformN);
    }

}
开发者ID:danguilliams,项目名称:OpenSGDevMaster_Toolbox,代码行数:51,代码来源:OSGColladaNode.cpp


示例4: axis

void
ColladaNode::handleRotate(domRotate *rotate)
{
    if(rotate == NULL)
        return;

    domNodeRef        node   = getDOMElementAs<domNode>();

    Vec3f axis(rotate->getValue()[0], rotate->getValue()[1], rotate->getValue()[2]);
    Real32 angle(rotate->getValue()[3]);

    if(getGlobal()->getOptions()->getFlattenNodeXForms())
    {
        RotationTransformationElementUnrecPtr RotationElement = RotationTransformationElement::create();
        RotationElement->setAxis(axis);
        RotationElement->setAngle(angle);
        setName(RotationElement, rotate->getSid());

        appendStackedXForm(RotationElement, node);

	    if(getGlobal()->editAnimationMap()[rotate] != NULL) 
	    {
            SLOG << "Found Rotation Animation" << std::endl;
		    getGlobal()->editAnimationMap()[rotate]->getAnimation()->setAnimatedField(RotationElement,std::string("Angle"));
	    }
    }
    else
    {
        TransformUnrecPtr xform = Transform::create();
        NodeUnrecPtr      xformN = makeNodeFor(xform);
        
        xform->editMatrix().setRotate(Quaternion(axis, osgDegree2Rad(angle)));

        if(getGlobal()->getOptions()->getCreateNameAttachments() == true && 
           node->getName()                                       != NULL   )
        {
            std::string nodeName = node->getName();

            if(rotate->getSid() != NULL&& 
			    getGlobal()->getOptions()->getFlattenNodeXForms() == false)
            {
                nodeName.append("."             );
                nodeName.append(rotate->getSid());
            }

            setName(xformN, nodeName);
        }

        appendXForm(xformN);
    }
}
开发者ID:danguilliams,项目名称:OpenSGDevMaster_Toolbox,代码行数:51,代码来源:OSGColladaNode.cpp


示例5: eyePosition

void
ColladaNode::handleLookAt(domLookat *lookat)
{
    if(lookat == NULL)
        return;
	
    domNodeRef        node   = getDOMElementAs<domNode>();
    Pnt3f eyePosition(lookat->getValue()[0],lookat->getValue()[1],lookat->getValue()[2]), 
          lookAtPoint(lookat->getValue()[3],lookat->getValue()[4],lookat->getValue()[5]);
    Vec3f upDirection(lookat->getValue()[7],lookat->getValue()[8],lookat->getValue()[9]);

    if(getGlobal()->getOptions()->getFlattenNodeXForms())
    {
        LookAtTransformationElementUnrecPtr LookAtElement = LookAtTransformationElement::create();
        LookAtElement->setEyePosition(eyePosition);
        LookAtElement->setLookAtPosition(lookAtPoint);
        LookAtElement->setUpDirection(upDirection);
        setName(LookAtElement, lookat->getSid());

        appendStackedXForm(LookAtElement, node);
    }
    else
    {

        TransformUnrecPtr xform = Transform::create();
	    NodeUnrecPtr      xformN = makeNodeFor(xform);

        Matrix lookAtMatrix;
        MatrixLookAt(lookAtMatrix,eyePosition, lookAtPoint, upDirection);

	    xform->setMatrix(lookAtMatrix);

	     if(getGlobal()->getOptions()->getCreateNameAttachments() == true && 
           node->getName()                                       != NULL   )
        {
            std::string nodeName = node->getName();

            if(lookat->getSid() != NULL && 
			    getGlobal()->getOptions()->getFlattenNodeXForms() == false)
            {
                nodeName.append("."                );
                nodeName.append(lookat->getSid());
            }

            setName(xformN, nodeName);
        }

        appendXForm(xformN);
    }
}
开发者ID:danguilliams,项目名称:OpenSGDevMaster_Toolbox,代码行数:50,代码来源:OSGColladaNode.cpp


示例6: translation

void
ColladaNode::handleTranslate(domTranslate *translate)
{
    if(translate == NULL)
        return;

    domNodeRef        node   = getDOMElementAs<domNode>();
    Vec3f translation(translate->getValue()[0], translate->getValue()[1], translate->getValue()[2]);

    if(getGlobal()->getOptions()->getFlattenNodeXForms())
    {
        TranslationTransformationElementUnrecPtr TranslateElement = TranslationTransformationElement::create();
        TranslateElement->setTranslation(translation);
        setName(TranslateElement, translate->getSid());

        appendStackedXForm(TranslateElement, node);

	    if(getGlobal()->editAnimationMap()[translate] != NULL) 
	    {
				SLOG << "Found Translation Animation" << std::endl;
				getGlobal()->editAnimationMap()[translate]->getAnimation()->setAnimatedField(TranslateElement,std::string("Translation")) ;
	    }
    }
    else
    {

        TransformUnrecPtr xform = Transform::create();
        NodeUnrecPtr      xformN = makeNodeFor(xform);

        xform->editMatrix().setTranslate(translation);

        if(getGlobal()->getOptions()->getCreateNameAttachments() == true && 
           node->getName()                                       != NULL   )
        {
            std::string nodeName = node->getName();

            if(translate->getSid() != NULL && 
			    getGlobal()->getOptions()->getFlattenNodeXForms() == false)
            {
                nodeName.append("."                );
                nodeName.append(translate->getSid());
            }

            setName(xformN, nodeName);
        }

        appendXForm(xformN);
    }
}
开发者ID:danguilliams,项目名称:OpenSGDevMaster_Toolbox,代码行数:49,代码来源:OSGColladaNode.cpp


示例7: returnValue

/* virtual */
NodeTransitPtr OFMatrixRecord::convert(Node *pNode)
{
    NodeUnrecPtr returnValue(NULL);

    if(pNode != NULL)
    {
        TransformUnrecPtr pXform = Transform::create();
        pXform->setMatrix(matrix);

        returnValue = makeNodeFor(pXform);
        returnValue->addChild(pNode);
    }

    return NodeTransitPtr(returnValue);
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:16,代码来源:OSGOFAncillaryRecords.cpp


示例8: createStaticScene

//
// create an arbitrarly complex render scene
//
static NodeTransitPtr createStaticScene()
{
    NodeUnrecPtr root = makeCoredNode<Group>();

    typedef boost::mt19937 base_generator_type;
    static base_generator_type generator(0);
    static boost::uniform_01<float> value;
    static boost::variate_generator< base_generator_type, boost::uniform_01<float> > die(generator, value);

    for (int i = 0; i < max_tori; ++i) {
        NodeUnrecPtr scene = makeTorus(.5, 2, 32, 32);

        TransformUnrecPtr transformCore = Transform::create();
        Matrix mat;

        mat.setIdentity();

        float x = 500.f * die();
        float y = 500.f * die();
        float z = 500.f * die();

        float e1 = die();
        float e2 = die();
        float e3 = die();

        Vec3f v(e1,e2,e3);
        v.normalize();

        float a = TwoPi * die();

        Quaternion q(v, a);

        mat.setTranslate(x,y,z);
        mat.setRotate(q);

        transformCore->setMatrix(mat);

        NodeUnrecPtr trafo = makeNodeFor(transformCore);

        trafo->addChild(scene);

        root->addChild(trafo);
    }
    
    return NodeTransitPtr(root);
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:49,代码来源:dyndrawing1.cpp


示例9: updateOsgOde

OSG_BEGIN_NAMESPACE

// Documentation for this class is emitted in the
// OSGPhysicsHandlerBase.cpp file.
// To modify it, please change the .fcd file (OSGPhysicsHandler.fcd) and
// regenerate the base file.


//////////////////////////////////////////////////////////////////////////
//! this action traverses the graph to match the OpenSG representation 
//! to ODE
//////////////////////////////////////////////////////////////////////////
Action::ResultE updateOsgOde(Node* const node)
{   
    //SLOG << "entering " << node << endLog;
    TransformUnrecPtr t = dynamic_cast<Transform*>(node->getCore());
    if(t!=NULL)
    {
        //SLOG << "found a TransformNode " << endLog;
        AttachmentUnrecPtr a = node->findAttachment(PhysicsBody::getClassType());
        if(a!=NULL)
        {
            Matrix m;
            PhysicsBodyUnrecPtr body = dynamic_pointer_cast<PhysicsBody>(a);
            body->updateToODEState();

            //update the position and rotation, but keep the scaling

            Vec3f Translation, Scale;
            Quaternion Rotation, ScaleOrientation;
            t->getMatrix().getTransform(Translation,Rotation,Scale,ScaleOrientation);
            Translation = body->getPosition();
            Rotation = body->getQuaternion();
            
            m.setTransform(Translation,Rotation,Scale,ScaleOrientation);

            t->setMatrix(m);
            //update BB
            node->updateVolume();
        }
    }

    return Action::Continue; 
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:44,代码来源:OSGPhysicsHandler.cpp


示例10: buildBox

PhysicsBodyUnrecPtr  buildBox(const Pnt3f& Position,
                              const Vec3f& Dimensions,
                              const Color3f& Color,
                              Node* const spaceGroupNode,
                              PhysicsWorld* const physicsWorld,
                              PhysicsHashSpace* const physicsSpace)
{
    Matrix m;
    //create OpenSG mesh
    GeometryUnrecPtr box;
    NodeUnrecPtr boxNode = makeBox(Dimensions.x(), Dimensions.y(), Dimensions.z(), 1, 1, 1);
    box = dynamic_cast<Geometry*>(boxNode->getCore());
    SimpleMaterialUnrecPtr box_mat = SimpleMaterial::create();
    box_mat->setAmbient(Color3f(0.0,0.0,0.0));
    box_mat->setDiffuse(Color);
    box->setMaterial(box_mat);
    TransformUnrecPtr boxTrans;
    NodeUnrecPtr boxTransNode = makeCoredNode<Transform>(&boxTrans);
    m.setIdentity();
    m.setTranslate(Position);
    boxTrans->setMatrix(m);

    //create ODE data
    PhysicsBodyUnrecPtr boxBody = PhysicsBody::create(physicsWorld);
    boxBody->setPosition(Vec3f(Position));
    boxBody->setBoxMass(1.0,Dimensions.x(), Dimensions.y(), Dimensions.z());
    boxBody->setLinearDamping(0.0001);
    boxBody->setAngularDamping(0.0001);
    PhysicsBoxGeomUnrecPtr boxGeom = PhysicsBoxGeom::create();
    boxGeom->setBody(boxBody);
    boxGeom->setSpace(physicsSpace);
    boxGeom->setLengths(Dimensions);

    //add attachments
    boxNode->addAttachment(boxGeom);
    boxTransNode->addAttachment(boxBody);
    boxTransNode->addChild(boxNode);

    //add to SceneGraph
    spaceGroupNode->addChild(boxTransNode);

    return boxBody;
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:43,代码来源:03CharacterTerrain.cpp


示例11: buildSphere

//////////////////////////////////////////////////////////////////////////
//! build a sphere
//////////////////////////////////////////////////////////////////////////
PhysicsBodyUnrecPtr buildSphere(void)
{
    Real32 Radius((Real32)(rand()%2)*0.5+0.5);
    Matrix m;
    //create OpenSG mesh
    GeometryUnrecPtr sphere;
    NodeUnrecPtr sphereNode = makeSphere(2, Radius);
    sphere = dynamic_cast<Geometry*>(sphereNode->getCore());
    SimpleMaterialUnrecPtr sphere_mat = SimpleMaterial::create();
    sphere_mat->setAmbient(Color3f(0.0,0.0,0.0));
    sphere_mat->setDiffuse(Color3f(0.0,0.0,1.0));
    sphere->setMaterial(sphere_mat);
    TransformUnrecPtr sphereTrans;
    NodeUnrecPtr sphereTransNode = makeCoredNode<Transform>(&sphereTrans);
    m.setIdentity();
    Real32 randX = (Real32)(rand()%10)-5.0;
    Real32 randY = (Real32)(rand()%10)-5.0;
    m.setTranslate(randX, randY, 10.0);
    sphereTrans->setMatrix(m);
    //create ODE data
    PhysicsBodyUnrecPtr sphereBody = PhysicsBody::create(physicsWorld);
        sphereBody->setPosition(Vec3f(randX, randY, 10.0));
        sphereBody->setLinearDamping(0.0001);
        sphereBody->setAngularDamping(0.0001);
    sphereBody->setSphereMass(1.0,Radius);

    PhysicsSphereGeomUnrecPtr sphereGeom = PhysicsSphereGeom::create();
        sphereGeom->setBody(sphereBody);
        sphereGeom->setSpace(physicsSpace);
        sphereGeom->setRadius(Radius);
    
    //add attachments
    sphereNode->addAttachment(sphereGeom);
    sphereTransNode->addAttachment(sphereBody);
    sphereTransNode->addChild(sphereNode);
    //add to SceneGraph
    spaceGroupNode->addChild(sphereTransNode);

    commitChanges();

    return sphereBody;
}
开发者ID:danguilliams,项目名称:OpenSGToolbox,代码行数:45,代码来源:05Explosion.cpp


示例12: buildBox

//////////////////////////////////////////////////////////////////////////
//! build a box
//////////////////////////////////////////////////////////////////////////
PhysicsBodyUnrecPtr buildBox(void)
{
    Vec3f Lengths((Real32)(rand()%2)+1.0, (Real32)(rand()%2)+1.0, (Real32)(rand()%2)+1.0);
    Matrix m;
    //create OpenSG mesh
    GeometryUnrecPtr box;
    NodeUnrecPtr boxNode = makeBox(Lengths.x(), Lengths.y(), Lengths.z(), 1, 1, 1);
    box = dynamic_cast<Geometry*>(boxNode->getCore());
    SimpleMaterialUnrecPtr box_mat = SimpleMaterial::create();
        box_mat->setAmbient(Color3f(0.0,0.0,0.0));
        box_mat->setDiffuse(Color3f(0.0,1.0 ,0.0));
        box->setMaterial(box_mat);
    TransformUnrecPtr boxTrans;
    NodeUnrecPtr boxTransNode = makeCoredNode<Transform>(&boxTrans);
    m.setIdentity();
    Real32 randX = (Real32)(rand()%10)-5.0;
    Real32 randY = (Real32)(rand()%10)-5.0;
    m.setTranslate(randX, randY, 10.0);
        boxTrans->setMatrix(m);

    //create ODE data
    PhysicsBodyUnrecPtr boxBody = PhysicsBody::create(physicsWorld);
        boxBody->setPosition(Vec3f(randX, randY, 10.0));
    boxBody->setBoxMass(1.0, Lengths.x(), Lengths.y(), Lengths.z());

    PhysicsBoxGeomUnrecPtr boxGeom = PhysicsBoxGeom::create();
        boxGeom->setBody(boxBody);
        boxGeom->setSpace(physicsSpace);
        boxGeom->setLengths(Lengths);

    //add attachments
        boxNode->addAttachment(boxGeom);
        boxTransNode->addAttachment(boxBody);
        boxTransNode->addChild(boxNode);

    //add to SceneGraph
        spaceGroupNode->addChild(boxTransNode);

    commitChanges();
    return boxBody;
}
开发者ID:danguilliams,项目名称:OpenSGToolbox,代码行数:44,代码来源:05Explosion.cpp


示例13: getGlobal

void
ColladaNode::appendXForm(const Matrix      &m,
                         const std::string &xformSID,
                         InstData          &instData   )
{
    domNodeRef       node  = getDOMElementAs<domNode>();
    NodeLoaderState *state =
        getGlobal()->getLoaderStateAs<NodeLoaderState>(_loaderStateName);
    OSG_ASSERT(state != NULL);

    if(getGlobal()->getOptions()->getMergeTransforms() == true)
    {
        if(instData._bottomN == NULL)
        {
            if(node->getType() == NODETYPE_JOINT)
            {
                SkeletonJointUnrecPtr joint = SkeletonJoint::create();
                instData._bottomN           = makeNodeFor(joint);

                joint->setMatrix(m);
                joint->setJointId(state->getJointId());
            }
            else
            {
                TransformUnrecPtr xform = Transform::create();
                instData._bottomN       = makeNodeFor(xform);

                xform->setMatrix(m);
            }

            instData._localMatrix = m;
        }
        else
        {
            if(node->getType() == NODETYPE_JOINT)
            {
                SkeletonJoint *joint =
                    dynamic_cast<SkeletonJoint *>(instData._bottomN->getCore());
                OSG_ASSERT(joint != NULL);

                joint->editMatrix().mult(m);
            }
            else
            {
                Transform *xform =
                    dynamic_cast<Transform *>(instData._bottomN->getCore());
                OSG_ASSERT(xform != NULL);

                xform->editMatrix().mult(m);
            }

            instData._localMatrix.mult(m);
        }

        if(instData._topN == NULL)
            instData._topN = instData._bottomN;

        if(xformSID.empty() == false)
            instData._sidMap[xformSID] = instData._bottomN;

        if(getGlobal()->getOptions()->getCreateNameAttachments() == true &&
           node->getName()                                       != NULL &&
           getName(instData._bottomN)                            == NULL   )
        {
            std::string nodeName = node->getName();

            setName(instData._bottomN, nodeName);
        }
    }
    else
    {
        TransformUnrecPtr xform  = Transform::create();
        NodeUnrecPtr      xformN = makeNodeFor(xform);

        if(instData._bottomN != NULL)
            instData._bottomN->addChild(xformN);

        xform->setMatrix(m);
        instData._localMatrix.mult(m);

        instData._bottomN = xformN;

        if(instData._topN == NULL)
            instData._topN = instData._bottomN;

        if(xformSID.empty() == false)
            instData._sidMap[xformSID] = xformN;

        if(getGlobal()->getOptions()->getCreateNameAttachments() == true &&
           node->getName()                                       != NULL   )
        {
            std::string nodeName = node->getName();

            if(xformSID.empty() == false)
            {
                nodeName.append("."     );
                nodeName.append(xformSID);
            }

            setName(instData._bottomN, nodeName);
//.........这里部分代码省略.........
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:101,代码来源:OSGColladaNode.cpp


示例14: endEntity

/* Insert one or more shallow copies of a block (created by DXFBlock as
 * Transform Group) into a layer (created by DXFLayer as MaterialGroup) or
 * another block.
 * \todo 
 * Could there be a INSERT inside a block referring to another block which has
 * not been read yet? We then have to find a solution to enable deferred
 * instantiation of INSERT entities :-(
 */
DXFResult DXFInsert::endEntity(void)
{
    NodeUnrecPtr                ctrafoNodeP = NULL;
//    ComponentTransformUnrecPtr  ctrafoCoreP = NULL;
    TransformUnrecPtr           ctrafoCoreP = NULL;
    NodeUnrecPtr                blockNodeP  = NULL;

    Node                       *parentNodeP = getParentNode();
    
    StringToNodePtrMap::iterator itr = _blocksMapP->find(_blockName);
    if (itr != _blocksMapP->end() && parentNodeP != NULL)
    {
        blockNodeP = itr->second;
        // TODO: check fetched INSERT Data for consistency!

        // Insert multiple times in a grid...
        Vec3f offset(0.0, 0.0, 0.0);
        for(Int16 column = 0; column < _columnCount; ++ column)
        {
            offset[0] = column * _columnSpacing;
            for(Int16 row = 0; row < _rowCount; ++ row)
            {
                offset[1] = row * _rowSpacing;
                // TODO: find out about DXF insert semantics!

                ctrafoNodeP = Node::create();
                ctrafoCoreP = Transform::create();
                
#if 0
                beginEditCP(ctrafoCoreP);
#endif
                {
					if(_blockName == std::string("Rectangular Mullion - 64 x 128 rectangular-V1-Level 1"))
					{
						std::cout << blockNodeP->getNChildren() << std::endl;
					}
					OSG::TransformationMatrix<Real32> transMat;
					transMat.setIdentity();
		
					transMat.setTranslate(_insertionPoint + offset);

					OSG::TransformationMatrix<Real32> rotMat;
					rotMat.setIdentity();
					OSG::Quaternion rot(OSG::Vec3f(0,0,1),osgDegree2Rad(_rotationAngle));
					rotMat.setRotate(rot);
					OSG::TransformationMatrix<Real32> scaleMat;
					scaleMat.setIdentity();
					scaleMat.setScale(_scaleFactor);
					
					OSG::Vec3f vin(-40, 65, 0);
					OSG::Vec3f vout;
					transMat.mult(rotMat);
					transMat.mult(scaleMat);
					if(_extrusionDirection[2]<0)
					{
						transMat[0][0] *= -1.0;
						transMat[1][0] *= -1.0;
						transMat[2][0] *= -1.0;
						transMat[3][0] *= -1.0;
					}
					ctrafoCoreP->setMatrix(transMat);
                }
#if 0
                endEditCP(ctrafoCoreP);
#endif
#if 0
                beginEditCP(ctrafoNodeP);
#endif
                {
                    ctrafoNodeP->setCore(ctrafoCoreP);
#if 0
                    ctrafoNodeP->addChild(blockNodeP->clone());
#endif
                    NodeUnrecPtr pClone = cloneTree(blockNodeP);
                    ctrafoNodeP->addChild(pClone);
                }
#if 0
                endEditCP(ctrafoNodeP);
#endif                
#if 0
                beginEditCP(parentNodeP);
#endif
                {
                    parentNodeP->addChild(ctrafoNodeP);
                }
#if 0
                endEditCP(parentNodeP);
#endif
            }
        }

        // Warn for details not implemented or assured yet! TODO: better
//.........这里部分代码省略.........
开发者ID:chengzg,项目名称:OSGAddOnsGV,代码行数:101,代码来源:OSGDXFInsert.cpp


示例15: display

void display(void)
{
    m1c = tball.getFullTrackballMatrix();

    if(move_obj == true)
    {
        scene_trans->editSFMatrix()->setValue( m1c );
    }
    else
    {
        cam_trans->editSFMatrix()->setValue( m1c );
    }

    commitChanges();

    win->render(rentravact);
}
开发者ID:whztt07,项目名称:OSGAddOnsGV,代码行数:17,代码来源:testMiniTerrainLoad.cpp


示例16: 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));
//.........这里部分代码省略.........
开发者ID:jieah,项目名称:OSGAddOnsGV,代码行数:101,代码来源:testBbqGeoRefRender.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Transformable类代码示例发布时间:2022-05-31
下一篇:
C++ TransformState类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap