本文整理汇总了C++中MatrixF::getColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixF::getColumn方法的具体用法?C++ MatrixF::getColumn怎么用?C++ MatrixF::getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixF
的用法示例。
在下文中一共展示了MatrixF::getColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTransform
void Item::setTransform(const MatrixF& mat)
{
Point3F pos;
mat.getColumn(3,&pos);
MatrixF tmat;
if (!mRotate) {
// Forces all rotation to be around the z axis
VectorF vec;
mat.getColumn(1,&vec);
tmat.set(EulerF(0,0,-mAtan2(-vec.x,vec.y)));
}
else
tmat.identity();
tmat.setColumn(3,pos);
Parent::setTransform(tmat);
if (!mStatic)
{
mAtRest = false;
mAtRestCounter = 0;
}
if ( mPhysicsRep )
mPhysicsRep->setTransform( getTransform() );
setMaskBits(RotationMask | PositionMask | NoWarpMask);
}
示例2: updateEmitter
void FlyingVehicle::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));
}
}
else {
for (S32 j = idx; j < idx + count; j++)
if (bool(mJetEmitter[j])) {
mJetEmitter[j]->deleteWhenEmpty();
mJetEmitter[j] = 0;
}
}
}
示例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: setTransform
void SFXXAudioVoice::setTransform( const MatrixF& transform )
{
transform.getColumn( 3, (Point3F*)&mEmitter.Position );
transform.getColumn( 1, (Point3F*)&mEmitter.OrientFront );
transform.getColumn( 2, (Point3F*)&mEmitter.OrientTop );
// XAudio and Torque use opposite handedness, so
// flip the z coord to account for that.
mEmitter.Position.z *= -1.0f;
mEmitter.OrientFront.z *= -1.0f;
mEmitter.OrientTop.z *= -1.0f;
}
示例5: emitFace
void BoxConvex::emitFace(S32 fi,const MatrixF& mat,ConvexFeature* cf)
{
Face& face = sFace[fi];
// Emit vertices
S32 vc = cf->mVertexList.size();
cf->mVertexList.increment(4);
Point3F *vp = cf->mVertexList.begin();
for (S32 v = 0; v < 4; v++)
mat.mulP(getVertex(face.vertex[v]),&vp[vc + v]);
// Emit edges
cf->mEdgeList.increment(4);
ConvexFeature::Edge* edge = cf->mEdgeList.end() - 4;
for (S32 e = 0; e < 4; e++) {
edge[e].vertex[0] = vc + e;
edge[e].vertex[1] = vc + ((e + 1) & 3);
}
// Emit 2 triangle faces
cf->mFaceList.increment(2);
ConvexFeature::Face* ef = cf->mFaceList.end() - 2;
mat.getColumn(face.axis,&ef->normal);
if (face.flip)
ef[0].normal.neg();
ef[1].normal = ef[0].normal;
ef[1].vertex[0] = ef[0].vertex[0] = vc;
ef[1].vertex[1] = ef[0].vertex[2] = vc + 2;
ef[0].vertex[1] = vc + 1;
ef[1].vertex[2] = vc + 3;
}
示例6: 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;
}
示例7: setTransform
void Rigid::setTransform(const MatrixF& mat)
{
angPosition.set(mat);
mat.getColumn(3,&linPosition);
// Update center of mass
angPosition.mulP(centerOfMass,&worldCenterOfMass);
worldCenterOfMass += linPosition;
}
示例8: processTick
void Item::processTick(const Move* move)
{
Parent::processTick(move);
//
if (mCollisionObject && !--mCollisionTimeout)
mCollisionObject = 0;
// Warp to catch up to server
if (delta.warpTicks > 0)
{
delta.warpTicks--;
// Set new pos.
MatrixF mat = mObjToWorld;
mat.getColumn(3,&delta.pos);
delta.pos += delta.warpOffset;
mat.setColumn(3,delta.pos);
Parent::setTransform(mat);
// Backstepping
delta.posVec.x = -delta.warpOffset.x;
delta.posVec.y = -delta.warpOffset.y;
delta.posVec.z = -delta.warpOffset.z;
}
else
{
if (isServerObject() && mAtRest && (mStatic == false && mDataBlock->sticky == false))
{
if (++mAtRestCounter > csmAtRestTimer)
{
mAtRest = false;
mAtRestCounter = 0;
setMaskBits(PositionMask);
}
}
if (!mStatic && !mAtRest && isHidden() == false)
{
updateVelocity(TickSec);
updateWorkingCollisionSet(isGhost() ? sClientCollisionMask : sServerCollisionMask, TickSec);
updatePos(isGhost() ? sClientCollisionMask : sServerCollisionMask, TickSec);
}
else
{
// Need to clear out last updatePos or warp interpolation
delta.posVec.set(0,0,0);
}
}
}
示例9: setTransform
void SFXDSVoice::setTransform( const MatrixF& transform )
{
if ( !mDSBuffer3D )
return;
Point3F pos, dir;
transform.getColumn( 3, &pos );
transform.getColumn( 1, &dir );
DSAssert( mDSBuffer3D->SetPosition( pos.x, pos.z, pos.y, DS3D_DEFERRED ),
"SFXDSVoice::setTransform - couldn't set position of the buffer." );
DSAssert( mDSBuffer3D->SetConeOrientation( dir.x, dir.z, dir.y, DS3D_DEFERRED ),
"SFXDSVoice::setTransform - couldn't set cone orientation of the buffer." );
}
示例10: setRotate
void WorldEditorSelection::setRotate(const EulerF & rot)
{
for( iterator iter = begin(); iter != end(); ++ iter )
{
SceneObject* object = dynamic_cast< SceneObject* >( *iter );
if( !object )
continue;
MatrixF mat = object->getTransform();
Point3F pos;
mat.getColumn(3, &pos);
MatrixF rmat(rot);
rmat.setPosition(pos);
object->setTransform(rmat);
}
}
示例11: onMouseMove
void GameTSCtrl::onMouseMove(const GuiEvent &evt)
{
if(gSnapLine)
return;
MatrixF mat;
Point3F vel;
if ( GameGetCameraTransform(&mat, &vel) )
{
Point3F pos;
mat.getColumn(3,&pos);
Point3F screenPoint((F32)evt.mousePoint.x, (F32)evt.mousePoint.y, 1.0f);
Point3F worldPoint;
if (unproject(screenPoint, &worldPoint))
{
Point3F vec = worldPoint - pos;
lineTestStart = pos;
vec.normalizeSafe();
lineTestEnd = pos + vec * 500;
static U32 losMask = VehicleObjectType | StaticShapeObjectType;
RayInfo ri;
bool hit = gClientContainer.castRay( lineTestStart, lineTestEnd, losMask, &ri);
if (!hit)
{
//Con::printf("no hit!");
if (mCursorObject != NULL)
mCursorObject->setHighlighted(false);
mCursorObject = NULL;
}
else
{
if (ri.object != mCursorObject && mCursorObject != NULL)
mCursorObject->setHighlighted(false);
mCursorObject = (ShapeBase*)ri.object;
mCursorObject->setHighlighted(true);
}
}
}
}
示例12: setScale
void WorldEditorSelection::setScale(const VectorF & scale, const Point3F & center)
{
for( iterator iter = begin(); iter != end(); ++ iter )
{
SceneObject* object = dynamic_cast< SceneObject* >( *iter );
if( !object )
continue;
MatrixF mat = object->getTransform();
Point3F pos;
mat.getColumn(3, &pos);
Point3F offset = pos - center;
offset *= scale;
object->setPosition(offset + center);
object->setScale(scale);
}
}
示例13: getMuzzleVector
/**
* Sets the correct aim for the bot to the target
*/
void AIPlayer::getMuzzleVector(U32 imageSlot,VectorF* vec)
{
MatrixF mat;
getMuzzleTransform(imageSlot,&mat);
MountedImage& image = mMountedImageList[imageSlot];
if (image.dataBlock->correctMuzzleVector)
{
disableHeadZCalc();
if (getCorrectedAim(mat, vec))
{
enableHeadZCalc();
return;
}
enableHeadZCalc();
}
mat.getColumn(1,vec);
}
示例14: onMouseMove
void GameTSCtrl::onMouseMove(const GuiEvent &evt)
{
if(gSnapLine)
return;
MatrixF mat;
Point3F vel;
if ( GameGetCameraTransform(&mat, &vel) )
{
Point3F pos;
mat.getColumn(3,&pos);
Point3F screenPoint((F32)evt.mousePoint.x, (F32)evt.mousePoint.y, -1.0f);
Point3F worldPoint;
if (unproject(screenPoint, &worldPoint)) {
Point3F vec = worldPoint - pos;
lineTestStart = pos;
vec.normalizeSafe();
lineTestEnd = pos + vec * 1000;
}
}
}
示例15: scale
void WorldEditorSelection::scale(const VectorF & scale, const Point3F & center)
{
for( iterator iter = begin(); iter != end(); ++ iter )
{
SceneObject* object = dynamic_cast< SceneObject* >( *iter );
if( !object )
continue;
VectorF current = object->getScale();
current.convolve(scale);
// clamp scale to sensible limits
current.setMax( Point3F( 0.01f ) );
current.setMin( Point3F( 1000.0f ) );
// Apply the scale first. If the object's scale doesn't change with
// this operation then this object doesn't scale. In this case
// we don't want to continue with the offset operation.
VectorF prevScale = object->getScale();
object->setScale(current);
if( !object->getScale().equal(current) )
continue;
// determine the actual scale factor to apply to the object offset
// need to account for the scale limiting above to prevent offsets
// being reduced to 0 which then cannot be restored by unscaling
VectorF adjustedScale = current / prevScale;
MatrixF mat = object->getTransform();
Point3F pos;
mat.getColumn(3, &pos);
Point3F offset = pos - center;
offset *= adjustedScale;
object->setPosition(offset + center);
}
}