本文整理汇总了C++中TSShapeInstance类的典型用法代码示例。如果您正苦于以下问题:C++ TSShapeInstance类的具体用法?C++ TSShapeInstance怎么用?C++ TSShapeInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TSShapeInstance类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Point3F
void ForestConvex::getPolyList(AbstractPolyList* list)
{
list->setTransform( &mTransform, Point3F(mScale,mScale,mScale));
list->setObject(mObject);
TSShapeInstance *si = mData->getShapeInstance();
S32 detail = mData->getCollisionDetails()[hullId];
si->animate(detail);
si->buildPolyList(list, detail);
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:11,代码来源:forestCollision.cpp
示例2: 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
示例3: TSShapeInstance
bool FlyingVehicleData::preload(bool server, String &errorStr)
{
if (!Parent::preload(server, errorStr))
return false;
TSShapeInstance* si = new TSShapeInstance(mShape, false);
// Resolve objects transmitted from server
if (!server) {
for (S32 i = 0; i < MaxSounds; i++)
if (sound[i])
Sim::findObject(SimObjectId(sound[i]),sound[i]);
for (S32 j = 0; j < MaxJetEmitters; j++)
if (jetEmitter[j])
Sim::findObject(SimObjectId(jetEmitter[j]),jetEmitter[j]);
}
// Extract collision planes from shape collision detail level
if (collisionDetails[0] != -1)
{
MatrixF imat(1);
PlaneExtractorPolyList polyList;
polyList.mPlaneList = &rigidBody.mPlaneList;
polyList.setTransform(&imat, Point3F(1,1,1));
si->animate(collisionDetails[0]);
si->buildPolyList(&polyList,collisionDetails[0]);
}
// Resolve jet nodes
for (S32 j = 0; j < MaxJetNodes; j++)
jetNode[j] = mShape->findNode(sJetNode[j]);
//
maxSpeed = maneuveringForce / minDrag;
delete si;
return true;
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:39,代码来源:flyingVehicle.cpp
示例4: 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
示例5: getTransform
bool ForestItem::buildPolyList( AbstractPolyList* polyList, const Box3F &box, const SphereF &sphere ) const
{
TSForestItemData *data = (TSForestItemData*)mDataBlock;
bool ret = false;
MatrixF xfm = getTransform();
polyList->setTransform( &xfm, Point3F(mScale,mScale,mScale) );
TSShapeInstance *si = data->getShapeInstance();
const Vector<S32> &details = data->getCollisionDetails();
S32 detail;
for (U32 i = 0; i < details.size(); i++ )
{
detail = details[i];
if (detail != -1)
ret |= si->buildPolyList( polyList, detail );
}
return ret;
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:22,代码来源:forestCollision.cpp
示例6: 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
示例7: _validateDim
void TSLastDetail::_update()
{
// We're gonna render... make sure we can.
bool sceneBegun = GFX->canCurrentlyRender();
if ( !sceneBegun )
GFX->beginScene();
_validateDim();
Vector<GBitmap*> bitmaps;
Vector<GBitmap*> normalmaps;
// We need to create our own instance to render with.
TSShapeInstance *shape = new TSShapeInstance( mShape, true );
// Animate the shape once.
shape->animate( mDl );
// So we don't have to change it everywhere.
const GFXFormat format = GFXFormatR8G8B8A8;
S32 imposterCount = ( ((2*mNumPolarSteps) + 1 ) * mNumEquatorSteps ) + ( mIncludePoles ? 2 : 0 );
// Figure out the optimal texture size.
Point2I texSize( smMaxTexSize, smMaxTexSize );
while ( true )
{
Point2I halfSize( texSize.x / 2, texSize.y / 2 );
U32 count = ( halfSize.x / mDim ) * ( halfSize.y / mDim );
if ( count < imposterCount )
{
// Try half of the height.
count = ( texSize.x / mDim ) * ( halfSize.y / mDim );
if ( count >= imposterCount )
texSize.y = halfSize.y;
break;
}
texSize = halfSize;
}
GBitmap *imposter = NULL;
GBitmap *normalmap = NULL;
GBitmap destBmp( texSize.x, texSize.y, true, format );
GBitmap destNormal( texSize.x, texSize.y, true, format );
U32 mipLevels = destBmp.getNumMipLevels();
ImposterCapture *imposterCap = new ImposterCapture();
F32 equatorStepSize = M_2PI_F / (F32)mNumEquatorSteps;
static const MatrixF topXfm( EulerF( -M_PI_F / 2.0f, 0, 0 ) );
static const MatrixF bottomXfm( EulerF( M_PI_F / 2.0f, 0, 0 ) );
MatrixF angMat;
F32 polarStepSize = 0.0f;
if ( mNumPolarSteps > 0 )
polarStepSize = -( 0.5f * M_PI_F - mDegToRad( mPolarAngle ) ) / (F32)mNumPolarSteps;
PROFILE_START(TSLastDetail_snapshots);
S32 currDim = mDim;
for ( S32 mip = 0; mip < mipLevels; mip++ )
{
if ( currDim < 1 )
currDim = 1;
dMemset( destBmp.getWritableBits(mip), 0, destBmp.getWidth(mip) * destBmp.getHeight(mip) * GFXFormat_getByteSize( format ) );
dMemset( destNormal.getWritableBits(mip), 0, destNormal.getWidth(mip) * destNormal.getHeight(mip) * GFXFormat_getByteSize( format ) );
bitmaps.clear();
normalmaps.clear();
F32 rotX = 0.0f;
if ( mNumPolarSteps > 0 )
rotX = -( mDegToRad( mPolarAngle ) - 0.5f * M_PI_F );
// We capture the images in a particular order which must
// match the order expected by the imposter renderer.
imposterCap->begin( shape, mDl, currDim, mRadius, mCenter );
for ( U32 j=0; j < (2 * mNumPolarSteps + 1); j++ )
{
F32 rotZ = -M_PI_F / 2.0f;
for ( U32 k=0; k < mNumEquatorSteps; k++ )
{
angMat.mul( MatrixF( EulerF( rotX, 0, 0 ) ),
MatrixF( EulerF( 0, 0, rotZ ) ) );
imposterCap->capture( angMat, &imposter, &normalmap );
bitmaps.push_back( imposter );
normalmaps.push_back( normalmap );
rotZ += equatorStepSize;
}
//.........这里部分代码省略.........
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:101,代码来源:tsLastDetail.cpp
注:本文中的TSShapeInstance类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论