本文整理汇总了C++中MatrixF::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixF::getPosition方法的具体用法?C++ MatrixF::getPosition怎么用?C++ MatrixF::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixF
的用法示例。
在下文中一共展示了MatrixF::getPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepBatchRender
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 );
}
示例2: generateGroundAnimation
void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq)
{
seq.firstGroundFrame = shape->groundTranslations.size();
seq.numGroundFrames = 0;
if (!boundsNode)
return;
// Check if the bounds node is animated by this sequence
seq.numGroundFrames = (S32)((seq.duration + 0.25f/AppGroundFrameRate) * AppGroundFrameRate);
seq.flags |= TSShape::MakePath;
// Get ground transform at the start of the sequence
MatrixF invStartMat = boundsNode->getNodeTransform(appSeq->getStart());
zapScale(invStartMat);
invStartMat.inverse();
for (int iFrame = 0; iFrame < seq.numGroundFrames; iFrame++)
{
F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numGroundFrames - 1);
// Determine delta bounds node transform at 't'
MatrixF mat = boundsNode->getNodeTransform(time);
zapScale(mat);
mat = invStartMat * mat;
// Add ground transform
Quat16 rotation;
rotation.set(QuatF(mat));
shape->groundTranslations.push_back(mat.getPosition());
shape->groundRotations.push_back(rotation);
}
}
示例3: getCameraReflection
MatrixF PlaneReflector::getCameraReflection( const MatrixF &camTrans )
{
Point3F normal = refplane;
// Figure out new cam position
Point3F camPos = camTrans.getPosition();
F32 dist = refplane.distToPlane( camPos );
Point3F newCamPos = camPos - normal * dist * 2.0;
// Figure out new look direction
Point3F i, j, k;
camTrans.getColumn( 0, &i );
camTrans.getColumn( 1, &j );
camTrans.getColumn( 2, &k );
i = MathUtils::reflect( i, normal );
j = MathUtils::reflect( j, normal );
k = MathUtils::reflect( k, normal );
//mCross( i, j, &k );
MatrixF newTrans(true);
newTrans.setColumn( 0, i );
newTrans.setColumn( 1, j );
newTrans.setColumn( 2, k );
newTrans.setPosition( newCamPos );
return newTrans;
}
示例4: 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 );
}
示例5:
Frustum::Frustum( bool isOrtho,
F32 nearLeft,
F32 nearRight,
F32 nearTop,
F32 nearBottom,
F32 nearDist,
F32 farDist,
const MatrixF &transform )
{
mTransform = transform;
mPosition = transform.getPosition();
mNearLeft = nearLeft;
mNearRight = nearRight;
mNearTop = nearTop;
mNearBottom = nearBottom;
mNearDist = nearDist;
mFarDist = farDist;
mIsOrtho = isOrtho;
mNumTiles = 1;
mCurrTile.set(0,0);
mTileOverlap.set(0.0f, 0.0f);
mProjectionOffset.zero();
mProjectionOffsetMatrix.identity();
}
示例6:
void OrientedBox3F::set( const MatrixF& transform, const Point3F& extents )
{
mCenter = transform.getPosition();
mAxes[ RightVector ] = transform.getRightVector();
mAxes[ ForwardVector ] = transform.getForwardVector();
mAxes[ UpVector ] = transform.getUpVector();
mHalfExtents = extents * 0.5f;
_initPoints();
}
示例7: onAdd
bool AIPlayer::onAdd()
{
if (!Parent::onAdd())
return false;
// Use the eye as the current position (see getAIMove)
MatrixF eye;
getEyeTransform(&eye);
mLastLocation = eye.getPosition();
return true;
}
示例8: _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 );
}
}
}
示例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;
}
示例10: setMoveDestination
/**
* Sets the location for the bot to run to
*
* @param location Point to run to
*/
void AIPlayer::setMoveDestination( const Point3F &location, bool slowdown )
{
//.logicking >> hack to avoid stopping right after
// beginning of the move
MatrixF eye;
getEyeTransform(&eye);
Point3F pos = eye.getPosition();
mLastLocation = pos;
mLastLocation.z += mMoveTolerance * 2;
//.logicking <<
mMoveDestination = location;
mMoveState = ModeMove;
mMoveSlowdown = slowdown;
mMoveStuckTestCountdown = mMoveStuckTestDelay;
}
示例11: getEarTransform
void SFX3DObject::getReferenceCenter( F32 position[ 3 ] ) const
{
MatrixF transform;
getEarTransform( transform );
Point3F pos = transform.getPosition();
AssertFatal( TypeTraits< F32 >::MIN <= pos.x && pos.x <= TypeTraits< F32 >::MAX,
"SFX3DObject::getReferenceCenter - invalid float in reference center X position" );
AssertFatal( TypeTraits< F32 >::MIN <= pos.y && pos.y <= TypeTraits< F32 >::MAX,
"SFX3DObject::getReferenceCenter - invalid float in reference center Y position" );
AssertFatal( TypeTraits< F32 >::MIN <= pos.z && pos.z <= TypeTraits< F32 >::MAX,
"SFX3DObject::getReferenceCenter - invalid float in reference center Z position" );
dMemcpy( position, &pos.x, sizeof( F32 ) * 3 );
}
示例12: 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;
}
示例13: setTransform
void RigidBody::setTransform(const MatrixF& newMat)
{
Parent::setTransform(newMat);
// for GMK editor, when physics simulation is frozen
//if(gFreezeSim)
{
if(mPhysShape)
mPhysShape->setTransform(newMat);
mDelta.pos = newMat.getPosition();
mDelta.rot[0] = QuatF(newMat);
mDelta.rot[1] = mDelta.rot[0];
mPhysPosition = mDelta.pos;
mPhysRotation = mDelta.rot[0];
}
}
示例14: setTransform
void SoftBody::setTransform(const MatrixF& mat)
{
PhysBody::setTransform(mat);
if(gFreezeSim || m_stopSimulation)
{
m_initTransform = mat;
if(mPhysShape)
mPhysShape->setTransform(mat);
mDelta.pos = mat.getPosition();
mDelta.rot[0] = QuatF(mat);
mDelta.rot[1] = mDelta.rot[0];
mPhysPosition = mDelta.pos;
mPhysRotation = mDelta.rot[0];
mDelta.posVec = VectorF::Zero;
}
}
示例15: applyCorrection
void PxSingleActor::applyCorrection( const MatrixF& mat, const NxVec3& linVel, const NxVec3& angVel )
{
// Sometimes the actor hasn't been
// created yet during the call from unpackUpdate.
if ( !mActor || !mWorld )
return;
mWorld->releaseWriteLock();
NxVec3 newPos = mat.getPosition();
NxVec3 currPos = getPosition();
NxVec3 offset = newPos - currPos;
// If the difference isn't large enough,
// just set the new transform, no correction.
if ( offset.magnitude() > 0.3f )
{
// If we're going to set the linear or angular velocity,
// we do it before we add a corrective force, since it would be overwritten otherwise.
NxVec3 currLinVel, currAngVel;
currLinVel = mActor->getLinearVelocity();
currAngVel = mActor->getAngularVelocity();
// Scale the corrective force by half,
// otherwise it will over correct and oscillate.
NxVec3 massCent = mActor->getCMassGlobalPosition();
mActor->addForceAtPos( offset, massCent, NX_VELOCITY_CHANGE );
// If the linear velocity is divergent enough, change to server linear velocity.
if ( (linVel - currLinVel).magnitude() > 0.3f )
mActor->setLinearVelocity( linVel );
// Same for angular.
if ( (angVel - currAngVel).magnitude() > 0.3f )
mActor->setAngularVelocity( angVel );
}
Parent::setTransform( mat );
}