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


C++ MatrixF::setPosition方法代码示例

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


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

示例1: resize

void NavPath::resize()
{
   if(!mPoints.size())
   {
      mObjBox.set(Point3F(-0.5f, -0.5f, -0.5f),
                  Point3F( 0.5f,  0.5f,  0.5f));
      resetWorldBox();
      setTransform(MatrixF(true));
      return;
   }

   Point3F max(mPoints[0]), min(mPoints[0]), pos(0.0f);
   for(U32 i = 1; i < mPoints.size(); i++)
   {
      Point3F p = mPoints[i];
      max.x = getMax(max.x, p.x);
      max.y = getMax(max.y, p.y);
      max.z = getMax(max.z, p.z);
      min.x = getMin(min.x, p.x);
      min.y = getMin(min.y, p.y);
      min.z = getMin(min.z, p.z);
      pos += p;
   }
   pos /= mPoints.size();
   min -= Point3F(0.5f, 0.5f, 0.5f);
   max += Point3F(0.5f, 0.5f, 0.5f);

   mObjBox.set(min - pos, max - pos);
   MatrixF mat = Parent::getTransform();
   mat.setPosition(pos);
   Parent::setTransform(mat);
}
开发者ID:Dwarf-King,项目名称:OmniEngine.Net,代码行数:32,代码来源:navPath.cpp

示例2: getRenderWeaponMountTransform

void TurretShape::getRenderWeaponMountTransform( F32 delta, S32 mountPoint, const MatrixF &xfm, MatrixF *outMat )
{
   // Returns mount point to world space transform
   if ( mountPoint >= 0 && mountPoint < SceneObject::NumMountPoints) {
      S32 ni = mDataBlock->weaponMountNode[mountPoint];
      if (ni != -1) {
         MatrixF mountTransform = mShapeInstance->mNodeTransforms[ni];
         mountTransform.mul( xfm );
         const Point3F& scale = getScale();

         // The position of the mount point needs to be scaled.
         Point3F position = mountTransform.getPosition();
         position.convolve( scale );
         mountTransform.setPosition( position );

         // Also we would like the object to be scaled to the model.
         mountTransform.scale( scale );
         outMat->mul(getRenderTransform(), mountTransform);
         return;
      }
   }

   // Then let SceneObject handle it.
   GrandParent::getRenderMountTransform( delta, mountPoint, xfm, outMat );   
}
开发者ID:mray,项目名称:terminal-overload,代码行数:25,代码来源:turretShape.cpp

示例3: setTransform

void	PhysShape::setRotation(const QuatF& rot)
{
    MatrixF tr;
    rot.setMatrix(&tr);
    tr.setPosition(getPosition());
    setTransform(tr);
}
开发者ID:Bloodknight,项目名称:GMK,代码行数:7,代码来源:physShape.cpp

示例4: protectedSetSurface

bool ConvexShape::protectedSetSurface( void *object, const char *index, const char *data )
{
   ConvexShape *shape = static_cast< ConvexShape* >( object );

   QuatF quat;
	Point3F pos;
	//MatrixF mat;

	/*
   dSscanf( data, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g", 
      &mat[0], &mat[1], &mat[2], &mat[3], 
      &mat[4], &mat[5], &mat[6], &mat[7], 
      &mat[8], &mat[9], &mat[10], &mat[11],
      &mat[12], &mat[13], &mat[14], &mat[15] );
	*/

	dSscanf( data, "%g %g %g %g %g %g %g", &quat.x, &quat.y, &quat.z, &quat.w, &pos.x, &pos.y, &pos.z );

	MatrixF surface;
	quat.setMatrix( &surface );
	surface.setPosition( pos );

   shape->mSurfaces.push_back( surface );   

   return false;
}
开发者ID:fr1tz,项目名称:alux3d,代码行数:26,代码来源:convexShape.cpp

示例5: getWorldTransform

MatrixF VPathNode::getWorldTransform( void ) const
{
    MatrixF mat;
    getWorldRotation().setMatrix( &mat );
    mat.setPosition( getWorldPosition() );

    return mat;
}
开发者ID:AnteSim,项目名称:Verve,代码行数:8,代码来源:VPathNode.cpp

示例6: drawSphere

void GFXDrawUtil::drawSphere( const GFXStateBlockDesc &desc, F32 radius, const Point3F &pos, const ColorI &color, bool drawTop, bool drawBottom, const MatrixF *xfm )
{
   MatrixF mat;
   if ( xfm )
      mat = *xfm;
   else
      mat = MatrixF::Identity;

   mat.scale(Point3F(radius,radius,radius));
   mat.setPosition(pos);
   GFX->pushWorldMatrix();
   GFX->multWorld(mat);

   const SphereMesh::TriangleMesh * sphereMesh = gSphere.getMesh(2);
   S32 numPoly = sphereMesh->numPoly;
   S32 totalPoly = 0;
   GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoly*3, GFXBufferTypeVolatile);
   verts.lock();
   S32 vertexIndex = 0;
   for (S32 i=0; i<numPoly; i++)
   {
      if (!drawBottom)
      {
         if (sphereMesh->poly[i].pnt[0].z < -0.01f || sphereMesh->poly[i].pnt[1].z < -0.01f || sphereMesh->poly[i].pnt[2].z < -0.01f)
            continue;
      }
      if (!drawTop)
      {
         if (sphereMesh->poly[i].pnt[0].z > 0.01f || sphereMesh->poly[i].pnt[1].z > 0.01f || sphereMesh->poly[i].pnt[2].z > 0.01f)
            continue;
      }
      totalPoly++;

      verts[vertexIndex].point = sphereMesh->poly[i].pnt[0];
      verts[vertexIndex].color = color;
      vertexIndex++;

      verts[vertexIndex].point = sphereMesh->poly[i].pnt[1];
      verts[vertexIndex].color = color;
      vertexIndex++;

      verts[vertexIndex].point = sphereMesh->poly[i].pnt[2];
      verts[vertexIndex].color = color;
      vertexIndex++;
   }
   verts.unlock();

   mDevice->setStateBlockByDesc( desc );

   mDevice->setVertexBuffer( verts );
   mDevice->setupGenericShaders();

   mDevice->drawPrimitive( GFXTriangleList, 0, totalPoly );

   GFX->popWorldMatrix();
}
开发者ID:mray,项目名称:terminal-overload,代码行数:56,代码来源:gfxDrawUtil.cpp

示例7: _renderObject

void SkyBox::_renderObject( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mi )
{
   GFXDEBUGEVENT_SCOPE( SkyBox_RenderObject, ColorF::WHITE );

   GFXTransformSaver saver;  
   GFX->setVertexBuffer( mVB );         

   MatrixF worldMat = MatrixF::Identity;
   worldMat.setPosition( state->getCameraPosition() );

   SceneData sgData;
   sgData.init( state );
   sgData.objTrans = &worldMat;

   mMatrixSet->restoreSceneViewProjection();
   mMatrixSet->setWorld( worldMat );
   if ( state->isReflectPass() )
      mMatrixSet->setProjection( state->getSceneManager()->getNonClipProjection() );

   while ( mMatInstance->setupPass( state, sgData ) )
   {         
      mMatInstance->setTransforms( *mMatrixSet, state );
      mMatInstance->setSceneInfo( state, sgData );

      GFX->drawPrimitive( GFXTriangleList, 0, mPrimCount );     
   }

   // Draw render band.
   if ( mFogBandHeight > 0 && mFogBandMatInst )
   {
      const FogData &fog = state->getSceneManager()->getFogData();
      if ( mLastFogColor != fog.color )
      {
         mLastFogColor = fog.color;
         _initRender();
      }

      // Just need it to follow the camera... no rotation.
      MatrixF camPosMat( MatrixF::Identity );
      camPosMat.setPosition( worldMat.getPosition() );
      sgData.objTrans = &camPosMat;
      mMatrixSet->setWorld( *sgData.objTrans );

      while ( mFogBandMatInst->setupPass( state, sgData ) )
      {
         mFogBandMatInst->setTransforms( *mMatrixSet, state );
         mFogBandMatInst->setSceneInfo( state, sgData );

         GFX->setVertexBuffer( mFogBandVB );      
         GFX->drawPrimitive( GFXTriangleList, 0, 16 );
      }
   }
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:53,代码来源:skyBox.cpp

示例8: convertRotation

void convertRotation(const F32 inRotMat[3][3], MatrixF& outRotation)
{
   // Set rotation.  We need to convert from sixense coordinates to
   // Torque coordinates.  The conversion is:
   //
   // Sixense                      Torque
   // a b c         a  b  c        a -c  b
   // d e f   -->  -g -h -i  -->  -g  i -h
   // g h i         d  e  f        d -f  e
   outRotation.setColumn(0, Point4F( inRotMat[0][0], -inRotMat[0][2],  inRotMat[0][1], 0.0f));
   outRotation.setColumn(1, Point4F(-inRotMat[2][0],  inRotMat[2][2], -inRotMat[2][1], 0.0f));
   outRotation.setColumn(2, Point4F( inRotMat[1][0], -inRotMat[1][2],  inRotMat[1][1], 0.0f));
   outRotation.setPosition(Point3F::Zero);
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:14,代码来源:razerHydraUtil.cpp

示例9: spawnExplosion

//----------------------------------------------------------------------------
// Explode
//----------------------------------------------------------------------------
void Splash::spawnExplosion()
{
   if( !mDataBlock->explosion ) return;

   Explosion* pExplosion = new Explosion;
   pExplosion->onNewDataBlock(mDataBlock->explosion, false);

   MatrixF trans = getTransform();
   trans.setPosition( getPosition() );

   pExplosion->setTransform( trans );
   pExplosion->setInitialState( trans.getPosition(), VectorF(0,0,1), 1);
   if (!pExplosion->registerObject())
      delete pExplosion;
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:18,代码来源:splash.cpp

示例10: orient

void WorldEditorSelection::orient(const MatrixF & rot, const Point3F & center)
{
   // Orient all the selected objects to the given rotation
   for( iterator iter = begin(); iter != end(); ++ iter )
   {
      SceneObject* object = dynamic_cast< SceneObject* >( *iter );
      if( !object )
         continue;
         
      MatrixF mat = rot;
      mat.setPosition( object->getPosition() );
      object->setTransform(mat);
   }

   mCentroidValid = false;
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:16,代码来源:worldEditorSelection.cpp

示例11: getNodeTransform

bool TurretShape::getNodeTransform(S32 node, MatrixF& mat)
{
   if (node == -1)
      return false;

   MatrixF nodeTransform = mShapeInstance->mNodeTransforms[node];
   const Point3F& scale = getScale();

   // The position of the node needs to be scaled.
   Point3F position = nodeTransform.getPosition();
   position.convolve( scale );
   nodeTransform.setPosition( position );

   mat.mul(mObjToWorld, nodeTransform);
   return true;
}
开发者ID:mray,项目名称:terminal-overload,代码行数:16,代码来源:turretShape.cpp

示例12: convertPointableRotation

void convertPointableRotation(const Leap::Pointable& pointable, MatrixF& outRotation)
{
   // We need to convert from Motion coordinates to
   // Torque coordinates.  The conversion is:
   //
   // Motion                       Torque
   // a b c         a  b  c        a -c  b
   // d e f   -->  -g -h -i  -->  -g  i -h
   // g h i         d  e  f        d -f  e
   Leap::Vector pointableFront = -pointable.direction();
   Leap::Vector pointableRight = Leap::Vector::up().cross(pointableFront);
   Leap::Vector pointableUp = pointableFront.cross(pointableRight);

   outRotation.setColumn(0, Point4F(  pointableRight.x, -pointableRight.z,  pointableRight.y,  0.0f));
   outRotation.setColumn(1, Point4F( -pointableFront.x,  pointableFront.z, -pointableFront.y,  0.0f));
   outRotation.setColumn(2, Point4F(  pointableUp.x,    -pointableUp.z,     pointableUp.y,     0.0f));
   outRotation.setPosition(Point3F::Zero);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:18,代码来源:leapMotionUtil.cpp

示例13: convertHandRotation

void convertHandRotation(const Leap::Hand& hand, MatrixF& outRotation)
{
   // We need to convert from Motion coordinates to
   // Torque coordinates.  The conversion is:
   //
   // Motion                       Torque
   // a b c         a  b  c        a -c  b
   // d e f   -->  -g -h -i  -->  -g  i -h
   // g h i         d  e  f        d -f  e
   const Leap::Vector& handToFingers = hand.direction();
   Leap::Vector handFront = -handToFingers;
   const Leap::Vector& handDown = hand.palmNormal();
   Leap::Vector handUp = -handDown;
   Leap::Vector handRight = handUp.cross(handFront);

   outRotation.setColumn(0, Point4F(  handRight.x, -handRight.z,  handRight.y,  0.0f));
   outRotation.setColumn(1, Point4F( -handFront.x,  handFront.z, -handFront.y,  0.0f));
   outRotation.setColumn(2, Point4F(  handUp.x,    -handUp.z,     handUp.y,     0.0f));
   outRotation.setPosition(Point3F::Zero);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:20,代码来源:leapMotionUtil.cpp

示例14: _drawWireCapsule

void GFXDrawUtil::_drawWireCapsule( const GFXStateBlockDesc &desc, const Point3F &center, F32 radius, F32 height, const ColorI &color, const MatrixF *xfm )
{
   MatrixF mat;
   if ( xfm )
      mat = *xfm;
   else
      mat = MatrixF::Identity;

   mat.scale( Point3F(radius,radius,height*0.5f) );
   mat.setPosition(center);
   mDevice->pushWorldMatrix();
   mDevice->multWorld(mat);

   S32 numPoints = sizeof(circlePoints)/sizeof(Point2F);
   GFXVertexBufferHandle<GFXVertexPC> verts(mDevice, numPoints, GFXBufferTypeVolatile);
   verts.lock();
   for (S32 i=0; i< numPoints; i++)
   {
      S32 idx = i & (~1); // just draw the even ones
      F32 z = i & 1 ? 1.0f : -1.0f;
      verts[i].point = Point3F(circlePoints[idx].x,circlePoints[idx].y, z);
      verts[i].color = color;
   }
   verts.unlock();

   mDevice->setStateBlockByDesc( desc );

   mDevice->setVertexBuffer( verts );
   mDevice->setupGenericShaders();

   for (S32 i=0; i<numPoints; i += 2)
      mDevice->drawPrimitive(GFXLineStrip, i, 1);

   mDevice->popWorldMatrix();

   Point3F sphereCenter;
   sphereCenter.z = center.z + 0.5f * height;
   drawSphere( desc, radius,sphereCenter,color,true,false);
   sphereCenter.z = center.z - 0.5f * height;
   drawSphere( desc, radius,sphereCenter,color,false,true);
}
开发者ID:mray,项目名称:terminal-overload,代码行数:41,代码来源:gfxDrawUtil.cpp

示例15: interpolateTick

void PxSingleActor::interpolateTick( F32 delta )
{
   Point3F interpPos;
   QuatF interpRot;

   // Interpolate the position based on the delta.
   interpPos.interpolate( mNextPos, mLastPos, delta );

   // Interpolate the rotation based on the delta.
   interpRot.interpolate( mNextRot, mLastRot, delta );

   // Set up the interpolated transform.
   MatrixF interpMat;

   // Set the interpolated position and rotation.
   interpRot.setMatrix( &interpMat );
   interpMat.setPosition( interpPos );

   // Set the transform to the interpolated transform.
   Parent::setTransform( interpMat );
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:21,代码来源:pxSingleActor.cpp


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