本文整理汇总了C++中TSShapeInstance::animate方法的典型用法代码示例。如果您正苦于以下问题:C++ TSShapeInstance::animate方法的具体用法?C++ TSShapeInstance::animate怎么用?C++ TSShapeInstance::animate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSShapeInstance
的用法示例。
在下文中一共展示了TSShapeInstance::animate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPolyList
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);
}
示例2: preload
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;
}
示例3: _update
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;
}
//.........这里部分代码省略.........