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


C++ MatrixF类代码示例

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


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

示例1: updateEmitter

void HoverVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitter,S32 idx,S32 count)
{
    if (!emitter)
        return;
    for (S32 j = idx; j < idx + count; j++)
        if (active) {
            if (mDataBlock->jetNode[j] != -1) {
                if (!bool(mJetEmitter[j])) {
                    mJetEmitter[j] = new ParticleEmitter;
                    mJetEmitter[j]->onNewDataBlock( emitter, false );
                    mJetEmitter[j]->registerObject();
                }
                MatrixF mat;
                Point3F pos,axis;
                mat.mul(getRenderTransform(),
                        mShapeInstance->mNodeTransforms[mDataBlock->jetNode[j]]);
                mat.getColumn(1,&axis);
                mat.getColumn(3,&pos);
                mJetEmitter[j]->emitParticles(pos,true,axis,getVelocity(),(U32)(dt * 1000.0f));
            }
        }
        else {
            for (S32 j = idx; j < idx + count; j++)
                if (bool(mJetEmitter[j])) {
                    mJetEmitter[j]->deleteWhenEmpty();
                    mJetEmitter[j] = 0;
                }
        }
}
开发者ID:caomw,项目名称:Torque3D,代码行数:29,代码来源:hoverVehicle.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: offset

void WorldEditorSelection::offset( const Point3F& offset, F32 gridSnap )
{
   for( iterator iter = begin(); iter != end(); ++ iter )
   {
      SceneObject* obj = dynamic_cast<SceneObject*>( *iter );
      if( !obj )
         continue;

      MatrixF mat = obj->getTransform();
      Point3F wPos;
      mat.getColumn(3, &wPos);

      // adjust
      wPos += offset;
      
      if( gridSnap != 0.f )
      {
         wPos.x -= mFmod( wPos.x, gridSnap );
         wPos.y -= mFmod( wPos.y, gridSnap );
         wPos.z -= mFmod( wPos.z, gridSnap );
      }
      
      mat.setColumn(3, wPos);
      obj->setTransform(mat);
   }

   mCentroidValid = false;
}
开发者ID:AlkexGas,项目名称:Torque3D,代码行数:28,代码来源:worldEditorSelection.cpp

示例4: setRenderPosition

void RigidBody::setRenderPosition(const Point3F& pos, const QuatF& rot)
{
	MatrixF mat;
	rot.setMatrix(&mat);
	mat.setColumn(3,pos);
	setRenderTransform(mat);
}
开发者ID:Duion,项目名称:GuideBot,代码行数:7,代码来源:rigidBody.cpp

示例5: dSscanf

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:Acidburn0zzz,项目名称:Torque3D,代码行数:26,代码来源:convexShape.cpp

示例6: setTransform

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

示例7: _roundProjection

// This "rounds" the projection matrix to remove subtexel movement during shadow map
// rasterization.  This is here to reduce shadow shimmering.
void PSSMLightShadowMap::_roundProjection(const MatrixF& lightMat, const MatrixF& cropMatrix, Point3F &offset, U32 splitNum)
{
   // Round to the nearest shadowmap texel, this helps reduce shimmering
   MatrixF currentProj = GFX->getProjectionMatrix();
   currentProj = cropMatrix * currentProj * lightMat;

   // Project origin to screen.
   Point4F originShadow4F(0,0,0,1);
   currentProj.mul(originShadow4F);
   Point2F originShadow(originShadow4F.x / originShadow4F.w, originShadow4F.y / originShadow4F.w);   

   // Convert to texture space (0..shadowMapSize)
   F32 t = mNumSplits < 4 ? mShadowMapTex->getWidth() / mNumSplits : mShadowMapTex->getWidth() / 2;
   Point2F texelsToTexture(t / 2.0f, mShadowMapTex->getHeight() / 2.0f);
   if (mNumSplits >= 4) texelsToTexture.y *= 0.5f;
   originShadow.convolve(texelsToTexture);

   // Clamp to texel boundary
   Point2F originRounded;
   originRounded.x = mFloor(originShadow.x + 0.5f);
   originRounded.y = mFloor(originShadow.y + 0.5f);

   // Subtract origin to get an offset to recenter everything on texel boundaries
   originRounded -= originShadow;

   // Convert back to texels (0..1) and offset
   originRounded.convolveInverse(texelsToTexture);
   offset.x += originRounded.x;
   offset.y += originRounded.y;
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:32,代码来源:pssmLightShadowMap.cpp

示例8: getWorldSphere

void Projectile::prepBatchRender( SceneRenderState *state )
{
   if ( !mProjectileShape )
      return;

   GFXTransformSaver saver;

   // Set up our TS render state.
   TSRenderState rdata;
   rdata.setSceneState( state );

   // We might have some forward lit materials
   // so pass down a query to gather lights.
   LightQuery query;
   query.init( getWorldSphere() );
   rdata.setLightQuery( &query );

   MatrixF mat = getRenderTransform();
   mat.scale( mObjScale );
   mat.scale( mDataBlock->scale );
   GFX->setWorldMatrix( mat );

   mProjectileShape->setDetailFromPosAndScale( state, mat.getPosition(), mObjScale );
   mProjectileShape->animate();

   mProjectileShape->render( rdata );
}
开发者ID:AkiraofAstra,项目名称:Torque3D,代码行数:27,代码来源:projectile.cpp

示例9: getTransform

/// Get the world transform of the node at the specified time
MatrixF ColladaAppNode::getNodeTransform(F32 time)
{
   // Avoid re-computing the default transform if possible
   if (defaultTransformValid && time == TSShapeLoader::DefaultTime)
   {
      return defaultNodeTransform;
   }
   else
   {
      MatrixF nodeTransform = getTransform(time);

      // Check for inverted node coordinate spaces => can happen when modelers
      // use the 'mirror' tool in their 3d app. Shows up as negative <scale>
      // transforms in the collada model.
      if (m_matF_determinant(nodeTransform) < 0.0f)
      {
         // Mark this node as inverted so we can mirror mesh geometry, then
         // de-invert the transform matrix
         invertMeshes = true;
         nodeTransform.scale(Point3F(1, 1, -1));
      }

      // Cache the default transform
      if (time == TSShapeLoader::DefaultTime)
      {
         defaultTransformValid = true;
         defaultNodeTransform = nodeTransform;
      }

      return nodeTransform;
   }
}
开发者ID:03050903,项目名称:Torque3D,代码行数:33,代码来源:colladaAppNode.cpp

示例10: getRenderTransform

void Trigger::renderObject( ObjectRenderInst *ri,
                            SceneRenderState *state,
                            BaseMatInstance *overrideMat )
{
   if(overrideMat)
      return;

   GFXStateBlockDesc desc;
   desc.setZReadWrite( true, false );
   desc.setBlend( true );

   // Trigger polyhedrons are set up with outward facing normals and CCW ordering
   // so can't enable backface culling.
   desc.setCullMode( GFXCullNone );

   GFXTransformSaver saver;

   MatrixF mat = getRenderTransform();
   mat.scale( getScale() );

   GFX->multWorld( mat );

   GFXDrawUtil *drawer = GFX->getDrawUtil();
   
   drawer->drawPolyhedron( desc, mTriggerPolyhedron, ColorI( 255, 192, 0, 45 ) );

   // Render wireframe.

   desc.setFillModeWireframe();
   drawer->drawPolyhedron( desc, mTriggerPolyhedron, ColorI::BLACK );
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:31,代码来源:trigger.cpp

示例11: Point3F

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

示例12: getWorldTransform

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

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

示例13: zapScale

void TSShapeLoader::zapScale(MatrixF& mat)
{
   Point3F invScale = mat.getScale();
   invScale.x = invScale.x ? (1.0f / invScale.x) : 0;
   invScale.y = invScale.y ? (1.0f / invScale.y) : 0;
   invScale.z = invScale.z ? (1.0f / invScale.z) : 0;
   mat.scale(invScale);
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:8,代码来源:tsShapeLoader.cpp

示例14: AssertFatal

void SceneObject::setPosition(const Point3F &pos)
{
	AssertFatal( !mIsNaN( pos ), "SceneObject::setPosition() - The position is NaN!" );

   MatrixF xform = mObjToWorld;
   xform.setColumn(3, pos);
   setTransform(xform);
}
开发者ID:mray,项目名称:terminal-overload,代码行数:8,代码来源:sceneObject.cpp

示例15: reset

void GjkCollisionState::reset(const MatrixF& a2w, const MatrixF& b2w)
{
   VectorF zero(0,0,0),sa,sb;
   a2w.mulP(a->support(zero),&sa);
   b2w.mulP(b->support(zero),&sb);
   v = sa - sb;
   dist = v.len();
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:8,代码来源:gjk.cpp


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