本文整理汇总了C++中TSShapeInstance::getShape方法的典型用法代码示例。如果您正苦于以下问题:C++ TSShapeInstance::getShape方法的具体用法?C++ TSShapeInstance::getShape怎么用?C++ TSShapeInstance::getShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSShapeInstance
的用法示例。
在下文中一共展示了TSShapeInstance::getShape方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFeatures
void ForestConvex::getFeatures( const MatrixF &mat, const VectorF &n, ConvexFeature *cf )
{
cf->material = 0;
cf->object = mObject;
TSShapeInstance *si = mData->getShapeInstance();
TSShape::ConvexHullAccelerator* pAccel =
si->getShape()->getAccelerator(mData->getCollisionDetails()[hullId]);
AssertFatal(pAccel != NULL, "Error, no accel!");
F32 currMaxDP = mDot(pAccel->vertexList[0], n);
U32 index = 0;
U32 i;
for (i = 1; i < pAccel->numVerts; i++)
{
F32 dp = mDot(pAccel->vertexList[i], n);
if (dp > currMaxDP)
{
currMaxDP = dp;
index = i;
}
}
const U8* emitString = pAccel->emitStrings[index];
U32 currPos = 0;
U32 numVerts = emitString[currPos++];
for (i = 0; i < numVerts; i++)
{
cf->mVertexList.increment();
U32 index = emitString[currPos++];
mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last());
}
U32 numEdges = emitString[currPos++];
for (i = 0; i < numEdges; i++)
{
U32 ev0 = emitString[currPos++];
U32 ev1 = emitString[currPos++];
cf->mEdgeList.increment();
cf->mEdgeList.last().vertex[0] = ev0;
cf->mEdgeList.last().vertex[1] = ev1;
}
U32 numFaces = emitString[currPos++];
for (i = 0; i < numFaces; i++)
{
cf->mFaceList.increment();
U32 plane = emitString[currPos++];
mat.mulV(pAccel->normalList[plane], &cf->mFaceList.last().normal);
for (U32 j = 0; j < 3; j++)
cf->mFaceList.last().vertex[j] = emitString[currPos++];
}
}
示例2: support
Point3F ForestConvex::support(const VectorF& v) const
{
TSShapeInstance *si = mData->getShapeInstance();
TSShape::ConvexHullAccelerator* pAccel =
si->getShape()->getAccelerator(mData->getCollisionDetails()[hullId]);
AssertFatal(pAccel != NULL, "Error, no accel!");
F32 currMaxDP = mDot(pAccel->vertexList[0], v);
U32 index = 0;
for (U32 i = 1; i < pAccel->numVerts; i++)
{
F32 dp = mDot(pAccel->vertexList[i], v);
if (dp > currMaxDP)
{
currMaxDP = dp;
index = i;
}
}
return pAccel->vertexList[index];
}
示例3: getNodeOffset
void Turret::getNodeOffset (TMat3F *trans, char *nodeName, int Node)
{
TSShapeInstance *si = image.shape;
if(si)
{
int node;
if (Node == -1)
node = si->getShape().findNode(nodeName);
else
node = Node;
if (node != -1)
{
TMat3F nodeTrans;
nodeTrans.identity();
nodeTrans.p = si->getTransform (node).p;
m_mul (nodeTrans, getTransform(), trans);
}
}
}