本文整理汇总了C++中MatrixF::setColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixF::setColumn方法的具体用法?C++ MatrixF::setColumn怎么用?C++ MatrixF::setColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixF
的用法示例。
在下文中一共展示了MatrixF::setColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: setRenderPosition
void RigidBody::setRenderPosition(const Point3F& pos, const QuatF& rot)
{
MatrixF mat;
rot.setMatrix(&mat);
mat.setColumn(3,pos);
setRenderTransform(mat);
}
示例4: 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);
}
示例5: setPosition
void SceneObject::setPosition(const Point3F &pos)
{
AssertFatal( !mIsNaN( pos ), "SceneObject::setPosition() - The position is NaN!" );
MatrixF xform = mObjToWorld;
xform.setColumn(3, pos);
setTransform(xform);
}
示例6: 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);
}
示例7: setRenderPosition
void Etherform::setRenderPosition(const Point3F& pos, const Point3F& rot, F32 dt)
{
MatrixF xRot, zRot;
xRot.set(EulerF(rot.x, 0, 0));
zRot.set(EulerF(0, 0, rot.z));
MatrixF temp;
temp.mul(zRot, xRot);
temp.setColumn(3, pos);
Parent::setRenderTransform(temp);
}
示例8: interpolateTick
void Item::interpolateTick(F32 dt)
{
Parent::interpolateTick(dt);
// Client side interpolation
Point3F pos = delta.pos + delta.posVec * dt;
MatrixF mat = mRenderObjToWorld;
mat.setColumn(3,pos);
setRenderTransform(mat);
delta.dt = dt;
}
示例9: 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);
}
示例10: getFrustumClipProj
MatrixF PlaneReflector::getFrustumClipProj( MatrixF &modelview )
{
static MatrixF rotMat(EulerF( static_cast<F32>(M_PI / 2.f), 0.0, 0.0));
static MatrixF invRotMat(EulerF( -static_cast<F32>(M_PI / 2.f), 0.0, 0.0));
MatrixF revModelview = modelview;
revModelview = rotMat * revModelview; // add rotation to modelview because it needs to be removed from projection
// rotate clip plane into modelview space
Point4F clipPlane;
Point3F pnt = refplane * -(refplane.d + 0.0 );
Point3F norm = refplane;
revModelview.mulP( pnt );
revModelview.mulV( norm );
norm.normalize();
clipPlane.set( norm.x, norm.y, norm.z, -mDot( pnt, norm ) );
// Manipulate projection matrix
//------------------------------------------------------------------------
MatrixF proj = GFX->getProjectionMatrix();
proj.mul( invRotMat ); // reverse rotation imposed by Torque
proj.transpose(); // switch to row-major order
// Calculate the clip-space corner point opposite the clipping plane
// as (sgn(clipPlane.x), sgn(clipPlane.y), 1, 1) and
// transform it into camera space by multiplying it
// by the inverse of the projection matrix
Vector4F q;
q.x = sgn(clipPlane.x) / proj(0,0);
q.y = sgn(clipPlane.y) / proj(1,1);
q.z = -1.0F;
q.w = ( 1.0F - proj(2,2) ) / proj(3,2);
F32 a = 1.0 / (clipPlane.x * q.x + clipPlane.y * q.y + clipPlane.z * q.z + clipPlane.w * q.w);
Vector4F c = clipPlane * a;
// CodeReview [ags 1/23/08] Come up with a better way to deal with this.
if(GFX->getAdapterType() == OpenGL)
c.z += 1.0f;
// Replace the third column of the projection matrix
proj.setColumn( 2, c );
proj.transpose(); // convert back to column major order
proj.mul( rotMat ); // restore Torque rotation
return proj;
}
示例11: setClipRect
void GFXGLDevice::setClipRect( const RectI &inRect )
{
AssertFatal(mCurrentRT.isValid(), "GFXGLDevice::setClipRect - must have a render target set to do any rendering operations!");
// Clip the rect against the renderable size.
Point2I size = mCurrentRT->getSize();
RectI maxRect(Point2I(0,0), size);
mClip = inRect;
mClip.intersect(maxRect);
// Create projection matrix. See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html
const F32 left = mClip.point.x;
const F32 right = mClip.point.x + mClip.extent.x;
const F32 bottom = mClip.extent.y;
const F32 top = 0.0f;
const F32 nearPlane = 0.0f;
const F32 farPlane = 1.0f;
const F32 tx = -(right + left)/(right - left);
const F32 ty = -(top + bottom)/(top - bottom);
const F32 tz = -(farPlane + nearPlane)/(farPlane - nearPlane);
static Point4F pt;
pt.set(2.0f / (right - left), 0.0f, 0.0f, 0.0f);
mProjectionMatrix.setColumn(0, pt);
pt.set(0.0f, 2.0f/(top - bottom), 0.0f, 0.0f);
mProjectionMatrix.setColumn(1, pt);
pt.set(0.0f, 0.0f, -2.0f/(farPlane - nearPlane), 0.0f);
mProjectionMatrix.setColumn(2, pt);
pt.set(tx, ty, tz, 1.0f);
mProjectionMatrix.setColumn(3, pt);
// Translate projection matrix.
static MatrixF translate(true);
pt.set(0.0f, -mClip.point.y, 0.0f, 1.0f);
translate.setColumn(3, pt);
mProjectionMatrix *= translate;
setMatrix(GFXMatrixProjection, mProjectionMatrix);
MatrixF mTempMatrix(true);
setViewMatrix( mTempMatrix );
setWorldMatrix( mTempMatrix );
// Set the viewport to the clip rect
RectI viewport(mClip.point.x, mClip.point.y, mClip.extent.x, mClip.extent.y);
setViewport(viewport);
}
示例12: 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);
}
}
}
示例13: buildPolyList
bool Item::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F&, const SphereF&)
{
if ( context == PLC_Decal )
return false;
// Collision with the item is always against the item's object
// space bounding box axis aligned in world space.
Point3F pos;
mObjToWorld.getColumn(3,&pos);
IMat.setColumn(3,pos);
polyList->setTransform(&IMat, mObjScale);
polyList->setObject(this);
polyList->addBox(mObjBox);
return true;
}
示例14: processTick
void RigidBody::processTick(const Move* move)
{
Parent::processTick(move);
if (mPhysShape)
{
// Save current interpolation
/*
MatrixF curTr = getRenderTransform();
mDelta.posVec = curTr.getPosition();
mDelta.rot[0].set(curTr);
*/
mDelta.posVec = mPhysPosition;
mDelta.rot[0] = mPhysRotation;
mPhysPosition = mPhysShape->getPosition();
mPhysRotation = mPhysShape->getRotation();
mForce = mPhysShape->getForce();
mTorque = mPhysShape->getTorque();
mLinVelocity = mPhysShape->getLinVelocity();
mAngVelocity = mPhysShape->getAngVelocity();
mDelta.pos = mPhysPosition;
mDelta.posVec -= mDelta.pos;
mDelta.rot[1] = mPhysRotation;
// Update container database
//setPosition(mDelta.pos, mDelta.rot[1]);
MatrixF mat;
mDelta.rot[1].setMatrix(&mat);
mat.setColumn(3,mDelta.pos);
Parent::setTransform(mat);
}
/*
Con::printf("ProcessTick s:%d vel: %f %f %f momentum: %f %f %f ",isServerObject(),mLinVelocity.x,mLinVelocity.y,mLinVelocity.z,
mForce.x, mForce.y, mForce.z);
*/
setMaskBits(PositionMask);
updateContainer();
}
示例15: CreateShapes
//.........这里部分代码省略.........
if ((CollisionType & WaterObjectType) && !mFieldData.mAllowWaterSurface)
{
// Is this the Server?
if (isServerObject())
{
// Yes, so do it on the server container.
if (!gServerContainer.castRay( ShapeStart, ShapeEnd, FXREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
}
else
{
// No, so do it on the client container.
if (!gClientContainer.castRay( ShapeStart, ShapeEnd, FXREPLICATOR_NOWATER_COLLISION_MASK, &RayEvent)) continue;
}
}
// We passed with flying colours so carry on.
CollisionResult = true;
}
// Invalidate if we are below Allowed Terrain Angle.
if (RayEvent.normal.z < mSin(mDegToRad(90.0f-mFieldData.mAllowedTerrainSlope))) CollisionResult = false;
// Wait until we get a collision.
} while(!CollisionResult && --RelocationRetry);
// Check for Relocation Problem.
if (RelocationRetry > 0)
{
// Adjust Impact point.
RayEvent.point.z += mFieldData.mOffsetZ;
// Set New Position.
ShapePosition = RayEvent.point;
}
else
{
// Warning.
Con::warnf(ConsoleLogEntry::General, "[%s] - Could not find satisfactory position for shape '%s' on %s!", getName(), mFieldData.mShapeFile,isServerObject()?"Server":"Client");
// Unregister Object.
fxStatic->unregisterObject();
// Destroy Shape.
delete fxStatic;
// Skip to next.
continue;
}
// Get Shape Transform.
MatrixF XForm = fxStatic->getTransform();
// Are we aligning to Terrain?
if (mFieldData.mAlignToTerrain)
{
// Yes, so set rotation to Terrain Impact Normal.
ShapeRotation = RayEvent.normal * mFieldData.mTerrainAlignment;
}
else
{
// No, so choose a new Rotation (in Radians).
ShapeRotation.set( mDegToRad(RandomGen.randF(mFieldData.mShapeRotateMin.x, mFieldData.mShapeRotateMax.x)),
mDegToRad(RandomGen.randF(mFieldData.mShapeRotateMin.y, mFieldData.mShapeRotateMax.y)),
mDegToRad(RandomGen.randF(mFieldData.mShapeRotateMin.z, mFieldData.mShapeRotateMax.z)));
}
// Set Quaternion Roation.
QRotation.set(ShapeRotation);
// Set Transform Rotation.
QRotation.setMatrix(&XForm);
// Set Position.
XForm.setColumn(3, ShapePosition);
// Set Shape Position / Rotation.
fxStatic->setTransform(XForm);
// Choose a new Scale.
ShapeScale.set( RandomGen.randF(mFieldData.mShapeScaleMin.x, mFieldData.mShapeScaleMax.x),
RandomGen.randF(mFieldData.mShapeScaleMin.y, mFieldData.mShapeScaleMax.y),
RandomGen.randF(mFieldData.mShapeScaleMin.z, mFieldData.mShapeScaleMax.z));
// Set Shape Scale.
fxStatic->setScale(ShapeScale);
// Lock it.
fxStatic->setLocked(true);
// Store Shape in Replicated Shapes Vector.
//mReplicatedShapes[mCurrentShapeCount++] = fxStatic;
mReplicatedShapes.push_back(fxStatic);
}
mCurrentShapeCount = mReplicatedShapes.size();
// Take first Timestamp.
mLastRenderTime = Platform::getVirtualMilliseconds();
}