本文整理汇总了C++中NxMat33::getColumnMajorStride4方法的典型用法代码示例。如果您正苦于以下问题:C++ NxMat33::getColumnMajorStride4方法的具体用法?C++ NxMat33::getColumnMajorStride4怎么用?C++ NxMat33::getColumnMajorStride4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxMat33
的用法示例。
在下文中一共展示了NxMat33::getColumnMajorStride4方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Update ( void )
{
NxVec3 forceDir ( -1, 0, 0 );
NxReal forceStrength = 100;
NxVec3 forceVec = forceStrength*forceDir;
this->tractor->addForce(forceVec);
g_iValue = 10;
for (int i=0; i<2; i++)
{
NxMat34 pose = frontWheels [ i ].wheel->getGlobalPose ( );
NxMat33 orient = pose.M;
NxVec3 pos = pose.t;
float glmat[16];
orient.getColumnMajorStride4(&(glmat[0]));
pos.get(&(glmat[12]));
glmat[3] = glmat[7] = glmat[11] = 0.0f;
glmat[15] = 1.0f;
SetWorldMatrix ( g_iValue, ( D3DXMATRIX* ) &glmat );
sObject* pObject = dbGetObject ( g_iValue++ );
pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
}
for (int i=0; i<2; i++)
{
NxMat34 pose = steerWheels [ i ].wheel.wheel->getGlobalPose ( );
NxMat33 orient = pose.M;
NxVec3 pos = pose.t;
float glmat[16];
orient.getColumnMajorStride4(&(glmat[0]));
pos.get(&(glmat[12]));
glmat[3] = glmat[7] = glmat[11] = 0.0f;
glmat[15] = 1.0f;
SetWorldMatrix ( g_iValue, ( D3DXMATRIX* ) &glmat );
sObject* pObject = dbGetObject ( g_iValue++ );
pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
}
//dbPositionObject ( g_iValue, glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
}
示例2: SetupGLMatrix
void SetupGLMatrix(const NxVec3& pos, const NxMat33& orient)
{
float glmat[16]; //4x4 column major matrix for OpenGL.
orient.getColumnMajorStride4(&(glmat[0]));
pos.get(&(glmat[12]));
//clear the elements we don't need:
glmat[3] = glmat[7] = glmat[11] = 0.0f;
glmat[15] = 1.0f;
glMultMatrixf(&(glmat[0]));
}
示例3: PhysUpdate
void PhysUpdate ( void )
{
int iObject = 1;
// Render all the actors in the scene
int nbActors = gScene->getNbActors();
NxActor** actors = gScene->getActors();
while (nbActors--)
{
NxActor* actor = *actors++;
// Get an OpenGL transform (float[16]) from a Novodex shape’s global pose
// (NxMat34)
NxShape* shape = NULL;
NxMat34 pose = actor->getGlobalPose();
NxMat33 orient = pose.M;
NxVec3 pos = pose.t;
float glmat[16]; // 4x4 column major OpenGL matrix
orient.getColumnMajorStride4(&(glmat[0]));
pos.get(&(glmat[12]));
// clear the elements we don't need:
glmat[3] = glmat[7] = glmat[11] = 0.0f;
glmat[15] = 1.0f;
{
sPhysObject* pPhys = ( sPhysObject* ) actor->userData;
if ( pPhys )
{
SetWorldMatrix ( pPhys->iID, ( D3DXMATRIX* ) &glmat );
sObject* pObject = dbGetObject ( pPhys->iID );
pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
}
}
}
}
示例4: TickCar
void TickCar ( void )
{
g_iValue = 10;
NxReal steeringAngle = gSteeringValue * gMaxSteeringAngle;
NxArray<CarWheelContact>::iterator i = wheelContactPoints.begin();
while(i != wheelContactPoints.end())
{
CarWheelContact& cwc = *i;
WheelShapeUserData* wheelData = (WheelShapeUserData *)(cwc.wheel->userData);
/*
struct CarWheelContact
{
NxActor* car;
NxShape* wheel;
NxVec3 contactPoint;
NxVec3 contactNormalForce;
NxVec3 contactFrictionForce;
};
*/
{
NxMat34 pose = cwc.wheel->getGlobalPose ( );
NxMat33 orient = pose.M;
NxVec3 pos = pose.t;
float glmat[16];
orient.getColumnMajorStride4(&(glmat[0]));
pos.get(&(glmat[12]));
glmat[3] = glmat[7] = glmat[11] = 0.0f;
glmat[15] = 1.0f;
SetWorldMatrix ( g_iValue, ( D3DXMATRIX* ) &glmat );
sObject* pObject = dbGetObject ( g_iValue );
pObject->position.vecPosition = D3DXVECTOR3 ( glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
//dbPositionObject ( g_iValue, glmat [ 12 ], glmat [ 13 ], glmat [ 14 ] );
g_iValue++;
}
//apply to powered wheels only.
if (wheelData->frontWheel)
{
//steering:
NxMat33 wheelOrientation = cwc.wheel->getLocalOrientation();
wheelOrientation.setColumn(0, NxVec3(NxMath::cos(steeringAngle), 0, NxMath::sin(steeringAngle) ));
wheelOrientation.setColumn(2, NxVec3(NxMath::sin(steeringAngle), 0, -NxMath::cos(steeringAngle) ));
cwc.wheel->setLocalOrientation(wheelOrientation);
if (frontWheelIsPowered)
{
//get the world space orientation:
wheelOrientation = cwc.wheel->getGlobalOrientation();
NxVec3 steeringDirection;
wheelOrientation.getColumn(0, steeringDirection);
//the power direction of the front wheel is the wheel's axis as it is steered.
if (gMotorForce)
{
cwc.car->addForceAtPos(steeringDirection * gMotorForce,cwc.contactPoint);
}
}
}
if (!wheelData->frontWheel && rearWheelIsPowered)
{
//get the orientation of this car:
NxMat33 m = cwc.car->getGlobalOrientation();
NxVec3 carForwardAxis;
m.getColumn(0, carForwardAxis);
//the power direction of the rear wheel is always the car's length axis.
cwc.car->addForceAtPos(carForwardAxis * gMotorForce,cwc.contactPoint);
}
i++;
}
wheelContactPoints.clear();
}