本文整理汇总了C++中NxShape::getMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ NxShape::getMaterial方法的具体用法?C++ NxShape::getMaterial怎么用?C++ NxShape::getMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxShape
的用法示例。
在下文中一共展示了NxShape::getMaterial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pWheelContactData
pWheelContactData* pWheel2::getContact()
{
NxWheelShape *wShape = getWheelShape();
if (!wShape)
{
return new pWheelContactData();
}
NxWheelContactData wcd;
NxShape* contactShape = wShape->getContact(wcd);
pWheelContactData result;
result.contactEntity = NULL;
if (contactShape)
{
result.contactForce = wcd.contactForce;
result.contactNormal = getFrom(wcd.contactNormal);
result.contactPoint= getFrom(wcd.contactPoint);
result.contactPosition= wcd.contactPosition;
result.lateralDirection= getFrom(wcd.lateralDirection);
result.lateralImpulse= wcd.lateralImpulse;
result.lateralSlip = wcd.lateralSlip;
result.longitudalDirection = getFrom(wcd.longitudalDirection);
result.longitudalImpulse = wcd.longitudalImpulse;
result.longitudalSlip= wcd.longitudalSlip;
pSubMeshInfo *sInfo = static_cast<pSubMeshInfo*>(contactShape->userData);
if (sInfo->entID)
{
CKObject *obj = (CKObject*)GetPMan()->m_Context->GetObject(sInfo->entID);
if (obj)
{
result.contactEntity = (CK3dEntity*)obj;
}else
{
result.contactEntity = NULL;
}
}
result.otherShapeMaterialIndex = contactShape->getMaterial();
NxMaterial* otherMaterial = contactShape->getActor().getScene().getMaterialFromIndex(contactShape->getMaterial());
if (otherMaterial)
{
pFactory::Instance()->copyTo(result.otherMaterial,otherMaterial);
}
}
return &result;
}
示例2: Write
void plPXPhysical::Write(hsStream* stream, hsResMgr* mgr)
{
plPhysical::Write(stream, mgr);
hsAssert(fActor, "nil actor");
hsAssert(fActor->getNbShapes() == 1, "Can only write actors with one shape. Writing first only.");
NxShape* shape = fActor->getShapes()[0];
NxMaterialIndex matIdx = shape->getMaterial();
NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey);
NxMaterial* mat = scene->getMaterialFromIndex(matIdx);
float friction = mat->getStaticFriction();
float restitution = mat->getRestitution();
stream->WriteLEScalar(fActor->getMass());
stream->WriteLEScalar(friction);
stream->WriteLEScalar(restitution);
stream->WriteByte(fBoundsType);
stream->WriteByte(fGroup);
stream->WriteLE32(fReportsOn);
stream->WriteLE16(fLOSDBs);
mgr->WriteKey(stream, fObjectKey);
mgr->WriteKey(stream, fSceneNode);
mgr->WriteKey(stream, fWorldKey);
mgr->WriteKey(stream, fSndGroup);
hsPoint3 pos;
hsQuat rot;
IGetPositionSim(pos);
IGetRotationSim(rot);
pos.Write(stream);
rot.Write(stream);
fProps.Write(stream);
if (fBoundsType == plSimDefs::kSphereBounds)
{
const NxSphereShape* sphereShape = shape->isSphere();
stream->WriteLEScalar(sphereShape->getRadius());
hsPoint3 localPos = plPXConvert::Point(sphereShape->getLocalPosition());
localPos.Write(stream);
}
else if (fBoundsType == plSimDefs::kBoxBounds)
{
const NxBoxShape* boxShape = shape->isBox();
hsPoint3 dim = plPXConvert::Point(boxShape->getDimensions());
dim.Write(stream);
hsPoint3 localPos = plPXConvert::Point(boxShape->getLocalPosition());
localPos.Write(stream);
}
else
{
if (fBoundsType == plSimDefs::kHullBounds)
hsAssert(shape->isConvexMesh(), "Hull shape isn't a convex mesh");
else
hsAssert(shape->isTriangleMesh(), "Exact shape isn't a trimesh");
// We hide the stream we used to create this mesh away in the shape user data.
// Pull it out and write it to disk.
hsVectorStream* vecStream = (hsVectorStream*)shape->userData;
stream->Write(vecStream->GetEOF(), vecStream->GetData());
delete vecStream;
}
}