当前位置: 首页>>代码示例>>C++>>正文


C++ TSShapeInstance::getShape方法代码示例

本文整理汇总了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++];
   }
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:54,代码来源:forestCollision.cpp

示例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];
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:22,代码来源:forestCollision.cpp

示例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);
				}
	   }
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:22,代码来源:turret.cpp


注:本文中的TSShapeInstance::getShape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。