本文整理汇总了C++中NxMat33::setColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ NxMat33::setColumn方法的具体用法?C++ NxMat33::setColumn怎么用?C++ NxMat33::setColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxMat33
的用法示例。
在下文中一共展示了NxMat33::setColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeBaryCoords
// ----------------------------------------------------------------------
// computes barycentric coordinates
NxVec3 ObjMesh::computeBaryCoords(NxVec3 vertex, NxVec3 p0, NxVec3 p1, NxVec3 p2, NxVec3 p3) {
NxVec3 baryCoords;
NxVec3 q = vertex-p3;
NxVec3 q0 = p0-p3;
NxVec3 q1 = p1-p3;
NxVec3 q2 = p2-p3;
NxMat33 m;
m.setColumn(0,q0);
m.setColumn(1,q1);
m.setColumn(2,q2);
NxReal det = m.determinant();
m.setColumn(0, q);
baryCoords.x = m.determinant();
m.setColumn(0, q0); m.setColumn(1,q);
baryCoords.y = m.determinant();
m.setColumn(1, q1); m.setColumn(2,q);
baryCoords.z = m.determinant();
if (det != 0.0f)
baryCoords /= det;
return baryCoords;
}
示例2:
void pWheel1::setAngle(float angle)
{
_angle = angle;
NxReal Cos, Sin;
NxMath::sinCos(_angle, Sin, Cos);
NxMat33 wheelOrientation = wheelCapsule->getLocalOrientation();
wheelOrientation.setColumn(0, NxVec3( Cos, 0, Sin ));
wheelOrientation.setColumn(2, NxVec3( Sin, 0,-Cos ));
setWheelOrientation(wheelOrientation);
}
示例3: TickCar
void TickCar()
{
NxReal steeringAngle = gSteeringValue * gMaxSteeringAngle;
NxArray<CarWheelContact>::iterator i = wheelContactPoints.begin();
while(i != wheelContactPoints.end())
{
CarWheelContact& cwc = *i;
WheelShapeUserData* wheelData = (WheelShapeUserData *)(cwc.wheel->userData);
//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();
}
示例4: InitNx
void InitNx()
{
// Create the physics SDK
gPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, &gErrorStream);
if (!gPhysicsSDK) return;
// Set the physics parameters
gPhysicsSDK->setParameter(NX_SKIN_WIDTH, 0.05);
// Set the debug visualization parameters
gPhysicsSDK->setParameter(NX_VISUALIZATION_SCALE, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_ACTOR_AXES, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_COLLISION_SHAPES, 1);
// gPhysicsSDK->setParameter(NX_VISUALIZE_COLLISION_AXES, 1);
// gPhysicsSDK->setParameter(NX_VISUALIZE_COLLISION_FNORMALS, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_CONTACT_POINT, 1);
gPhysicsSDK->setParameter(NX_VISUALIZE_CONTACT_NORMAL, 1);
// Create the scene
NxSceneDesc sceneDesc;
sceneDesc.gravity = gDefaultGravity;
sceneDesc.simType = NX_SIMULATION_HW;
gScene = gPhysicsSDK->createScene(sceneDesc);
if(!gScene){
sceneDesc.simType = NX_SIMULATION_SW;
gScene = gPhysicsSDK->createScene(sceneDesc);
if(!gScene) return;
}
NxU32 set = 0;
#ifdef WIN32
set = SetCurrentDirectory(&fname[0]);
if (!set) set = SetCurrentDirectory(&fname1[0]);
if (!set)
{
char basePath[256];
GetModuleFileName(NULL, basePath, 256);
char* pTmp = strrchr(basePath, '\\');
basePath[pTmp-basePath+1] = 0;
SetCurrentDirectory(basePath);//for running from start menu
set = SetCurrentDirectory(&fname2[0]);
}
if (!set) set = SetCurrentDirectory(&fname3[0]);
#elif LINUX
set = chdir(&fname[0]);
if (set != 0) set = chdir(&fname2[0]);
if (set != 0) set = chdir(&fname3[0]);
#endif
// Create the default material
NxMaterialDesc defaultMaterial;
defaultMaterial.restitution = 0;
defaultMaterial.staticFriction = 0.5;
defaultMaterial.dynamicFriction = 0.5;
NxMaterial* m = gScene->getMaterialFromIndex(0);
m->loadFromDesc(defaultMaterial);
char buffer[512];
FindMediaFile("Course.pml", buffer);
nxmlLoadScene(buffer, gPhysicsSDK, gScene);
// Switch from Max Coordinate System to
// Training Program Coordinate System
NxMat34 mat;
NxMat33 orient;
orient.setColumn(0, NxVec3(-1,0,0));
orient.setColumn(1, NxVec3(0,0,1));
orient.setColumn(2, NxVec3(0,1,0));
mat.M = orient;
SwitchCoordinateSystem(gScene, mat);
// Reset wheel material
wsm = NULL;
// Create the trike actor
trike = CreateTrike(NxVec3(0,3,0));
trike->wakeUp(1e30);
AddUserDataToActors(gScene);
gSelectedActor = trike;
// Initialize HUD
InitializeHUD();
InitializeSpecialHUD();
// Get the current time
getElapsedTime();
// Start the first frame of the simulation
if (gScene) StartPhysics();
}
示例5: 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();
}