mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
Merge remote-tracking branch 'GarageGames/development' into physx3_basic
This commit is contained in:
commit
d58a69e76c
527 changed files with 9928 additions and 5548 deletions
|
|
@ -63,7 +63,7 @@ AIClient::AIClient() {
|
|||
mMoveTolerance = 0.25f;
|
||||
|
||||
// Clear the triggers
|
||||
for( int i = 0; i < MaxTriggerKeys; i++ )
|
||||
for( S32 i = 0; i < MaxTriggerKeys; i++ )
|
||||
mTriggers[i] = false;
|
||||
|
||||
mAimToDestination = true;
|
||||
|
|
@ -369,7 +369,7 @@ U32 AIClient::getMoveList( Move **movePtr,U32 *numMoves ) {
|
|||
}
|
||||
|
||||
// Copy over the trigger status
|
||||
for( int i = 0; i < MaxTriggerKeys; i++ ) {
|
||||
for( S32 i = 0; i < MaxTriggerKeys; i++ ) {
|
||||
mMove.trigger[i] = mTriggers[i];
|
||||
mTriggers[i] = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ bool AIPlayer::getAIMove(Move *movePtr)
|
|||
|
||||
// Replicate the trigger state into the move so that
|
||||
// triggers can be controlled from scripts.
|
||||
for( int i = 0; i < MaxTriggerKeys; i++ )
|
||||
for( S32 i = 0; i < MaxTriggerKeys; i++ )
|
||||
movePtr->trigger[i] = getImageTriggerState(i);
|
||||
|
||||
mLastLocation = location;
|
||||
|
|
|
|||
|
|
@ -1546,7 +1546,7 @@ void Camera::_validateEyePoint(F32 pos, MatrixF *mat)
|
|||
float dot = mDot(dir, collision.normal);
|
||||
if (dot > 0.01f)
|
||||
{
|
||||
float colDist = mDot(startPos - collision.point, dir) - (1 / dot) * CameraRadius;
|
||||
F32 colDist = mDot(startPos - collision.point, dir) - (1 / dot) * CameraRadius;
|
||||
if (colDist > pos)
|
||||
colDist = pos;
|
||||
if (colDist < 0.0f)
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ void CameraSpline::renderTimeMap()
|
|||
if(!ptr) return;
|
||||
|
||||
MRandomLCG random(1376312589 * (U32)this);
|
||||
int index = 0;
|
||||
S32 index = 0;
|
||||
for(Vector<TimeMap>::iterator itr=mTimeMap.begin(); itr != mTimeMap.end(); itr++)
|
||||
{
|
||||
Knot a;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "lighting/lightQuery.h"
|
||||
|
||||
|
||||
const U32 csmStaticCollisionMask = TerrainObjectType;
|
||||
const U32 csmStaticCollisionMask = TerrainObjectType | StaticShapeObjectType | StaticObjectType;
|
||||
|
||||
const U32 csmDynamicCollisionMask = StaticShapeObjectType;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ bool DebrisData::onAdd()
|
|||
if(!Parent::onAdd())
|
||||
return false;
|
||||
|
||||
for( int i=0; i<DDC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<DDC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( !emitterList[i] && emitterIDList[i] != 0 )
|
||||
{
|
||||
|
|
@ -303,7 +303,7 @@ void DebrisData::packData(BitStream* stream)
|
|||
stream->writeString( textureName );
|
||||
stream->writeString( shapeName );
|
||||
|
||||
for( int i=0; i<DDC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<DDC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( stream->writeFlag( emitterList[i] != NULL ) )
|
||||
{
|
||||
|
|
@ -346,7 +346,7 @@ void DebrisData::unpackData(BitStream* stream)
|
|||
textureName = stream->readSTString();
|
||||
shapeName = stream->readSTString();
|
||||
|
||||
for( int i=0; i<DDC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<DDC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( stream->readFlag() )
|
||||
{
|
||||
|
|
@ -512,7 +512,7 @@ bool Debris::onAdd()
|
|||
}
|
||||
|
||||
// create emitters
|
||||
for( int i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( mDataBlock->emitterList[i] != NULL )
|
||||
{
|
||||
|
|
@ -631,7 +631,7 @@ bool Debris::onAdd()
|
|||
|
||||
void Debris::onRemove()
|
||||
{
|
||||
for( int i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( mEmitterList[i] )
|
||||
{
|
||||
|
|
@ -848,7 +848,7 @@ void Debris::updateEmitters( Point3F &pos, Point3F &vel, U32 ms )
|
|||
|
||||
Point3F lastPos = mLastPos;
|
||||
|
||||
for( int i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( mEmitterList[i] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ ConsoleDocClass( DecalManager,
|
|||
|
||||
namespace {
|
||||
|
||||
int QSORT_CALLBACK cmpDecalInstance(const void* p1, const void* p2)
|
||||
S32 QSORT_CALLBACK cmpDecalInstance(const void* p1, const void* p2)
|
||||
{
|
||||
const DecalInstance** pd1 = (const DecalInstance**)p1;
|
||||
const DecalInstance** pd2 = (const DecalInstance**)p2;
|
||||
|
|
@ -125,7 +125,7 @@ int QSORT_CALLBACK cmpDecalInstance(const void* p1, const void* p2)
|
|||
return int(((char *)(*pd1)->mDataBlock) - ((char *)(*pd2)->mDataBlock));
|
||||
}
|
||||
|
||||
int QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 )
|
||||
S32 QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 )
|
||||
{
|
||||
const Point3F *pnt1 = (const Point3F*)p1;
|
||||
const Point3F *pnt2 = (const Point3F*)p2;
|
||||
|
|
@ -142,7 +142,7 @@ int QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 )
|
||||
S32 QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 )
|
||||
{
|
||||
const Point4F *pnt1 = (const Point4F*)p1;
|
||||
const Point4F *pnt2 = (const Point4F*)p2;
|
||||
|
|
@ -157,7 +157,7 @@ int QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 )
|
|||
|
||||
static Point3F gSortPoint;
|
||||
|
||||
int QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 )
|
||||
S32 QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 )
|
||||
{
|
||||
const DecalInstance** pd1 = (const DecalInstance**)p1;
|
||||
const DecalInstance** pd2 = (const DecalInstance**)p2;
|
||||
|
|
@ -168,7 +168,7 @@ int QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 )
|
|||
return mSign( dist1 - dist2 );
|
||||
}
|
||||
|
||||
int QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 )
|
||||
S32 QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 )
|
||||
{
|
||||
const DecalInstance** pd1 = (const DecalInstance**)p1;
|
||||
const DecalInstance** pd2 = (const DecalInstance**)p2;
|
||||
|
|
@ -179,14 +179,14 @@ int QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 )
|
|||
return 1;
|
||||
else
|
||||
{
|
||||
int priority = (*pd1)->getRenderPriority() - (*pd2)->getRenderPriority();
|
||||
S32 priority = (*pd1)->getRenderPriority() - (*pd2)->getRenderPriority();
|
||||
|
||||
if ( priority != 0 )
|
||||
return priority;
|
||||
|
||||
if ( (*pd2)->mFlags & SaveDecal )
|
||||
{
|
||||
int id = ( (*pd1)->mDataBlock->getMaterial()->getId() - (*pd2)->mDataBlock->getMaterial()->getId() );
|
||||
S32 id = ( (*pd1)->mDataBlock->getMaterial()->getId() - (*pd2)->mDataBlock->getMaterial()->getId() );
|
||||
if ( id != 0 )
|
||||
return id;
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ bool RenderMeshExample::onAdd()
|
|||
// Add this object to the scene
|
||||
addToScene();
|
||||
|
||||
// Refresh this object's material (if any)
|
||||
updateMaterial();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ protected:
|
|||
|
||||
public:
|
||||
CameraFX();
|
||||
virtual ~CameraFX() { }
|
||||
|
||||
MatrixF & getTrans(){ return mCamFXTrans; }
|
||||
virtual bool isExpired(){ return mElapsedTime >= mDuration; }
|
||||
|
|
|
|||
|
|
@ -106,18 +106,31 @@ ConsoleDocClass( Explosion,
|
|||
" lightEndBrightness = 0.0;\n"
|
||||
" lightNormalOffset = 2.0;\n"
|
||||
"};\n\n"
|
||||
"function createExplosion()\n"
|
||||
"function ServerPlayExplosion(%position, %datablock)\n"
|
||||
"{\n"
|
||||
" // Create a new explosion - it will explode automatically\n"
|
||||
" %pos = \"0 0 100\";\n"
|
||||
" %obj = new Explosion()\n"
|
||||
" // Play the given explosion on every client.\n"
|
||||
" // The explosion will be transmitted as an event, not attached to any object.\n"
|
||||
" for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)\n"
|
||||
" {\n"
|
||||
" position = %pos;\n"
|
||||
" dataBlock = GrenadeLauncherExplosion;\n"
|
||||
" };\n"
|
||||
" %client = ClientGroup.getObject(%idx);\n"
|
||||
" commandToClient(%client, 'PlayExplosion', %position, %datablock.getId());\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
"function clientCmdPlayExplosion(%position, %effectDataBlock)\n"
|
||||
"{\n"
|
||||
" // Play an explosion sent by the server. Make sure this function is defined\n"
|
||||
" // on the client.\n"
|
||||
" if (isObject(%effectDataBlock))\n"
|
||||
" {\n"
|
||||
" new Explosion()\n"
|
||||
" {\n"
|
||||
" position = %position;\n"
|
||||
" dataBlock = %effectDataBlock;\n"
|
||||
" };\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
"// schedule an explosion\n"
|
||||
"schedule(1000, 0, createExplosion);\n"
|
||||
"schedule(1000, 0, ServerPlayExplosion, \"0 0 0\", GrenadeLauncherExplosion);\n"
|
||||
"@endtsexample"
|
||||
);
|
||||
|
||||
|
|
@ -736,9 +749,9 @@ bool ExplosionData::preload(bool server, String &errorStr)
|
|||
|
||||
if( !server )
|
||||
{
|
||||
String errorStr;
|
||||
if( !sfxResolve( &soundProfile, errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", errorStr.c_str());
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &soundProfile, sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", sfxErrorStr.c_str());
|
||||
if (!particleEmitter && particleEmitterId != 0)
|
||||
if (Sim::findObject(particleEmitterId, particleEmitter) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock");
|
||||
|
|
@ -929,7 +942,7 @@ bool Explosion::onAdd()
|
|||
|
||||
void Explosion::onRemove()
|
||||
{
|
||||
for( int i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( mEmitterList[i] )
|
||||
{
|
||||
|
|
@ -1114,7 +1127,7 @@ void Explosion::updateEmitters( F32 dt )
|
|||
{
|
||||
Point3F pos = getPosition();
|
||||
|
||||
for( int i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( mEmitterList[i] )
|
||||
{
|
||||
|
|
@ -1134,7 +1147,7 @@ void Explosion::launchDebris( Point3F &axis )
|
|||
return;
|
||||
|
||||
bool hasDebris = false;
|
||||
for( int j=0; j<ExplosionData::EC_NUM_DEBRIS_TYPES; j++ )
|
||||
for( S32 j=0; j<ExplosionData::EC_NUM_DEBRIS_TYPES; j++ )
|
||||
{
|
||||
if( mDataBlock->debrisList[j] )
|
||||
{
|
||||
|
|
@ -1160,7 +1173,7 @@ void Explosion::launchDebris( Point3F &axis )
|
|||
|
||||
U32 numDebris = mDataBlock->debrisNum + sgRandom.randI( -mDataBlock->debrisNumVariance, mDataBlock->debrisNumVariance );
|
||||
|
||||
for( int i=0; i<numDebris; i++ )
|
||||
for( S32 i=0; i<numDebris; i++ )
|
||||
{
|
||||
|
||||
Point3F launchDir = MathUtils::randomDir( axis, mDataBlock->debrisThetaMin, mDataBlock->debrisThetaMax,
|
||||
|
|
@ -1249,7 +1262,7 @@ bool Explosion::explode()
|
|||
Point3F::Zero, U32(mDataBlock->particleDensity * mFade));
|
||||
}
|
||||
|
||||
for( int i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
|
||||
for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
|
||||
{
|
||||
if( mDataBlock->emitterList[i] != NULL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -287,14 +287,14 @@ bool LightningData::preload(bool server, String &errorStr)
|
|||
|
||||
if (server == false)
|
||||
{
|
||||
String errorStr;
|
||||
String sfxErrorStr;
|
||||
for (U32 i = 0; i < MaxThunders; i++) {
|
||||
if( !sfxResolve( &thunderSounds[ i ], errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str());
|
||||
if( !sfxResolve( &thunderSounds[ i ], sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
|
||||
}
|
||||
|
||||
if( !sfxResolve( &strikeSound, errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str());
|
||||
if( !sfxResolve( &strikeSound, sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
|
||||
|
||||
for (U32 i = 0; i < MaxTextures; i++)
|
||||
{
|
||||
|
|
@ -1139,7 +1139,7 @@ void LightningBolt::generateMinorNodes()
|
|||
{
|
||||
mMinorNodes.clear();
|
||||
|
||||
for( int i=0; i<mMajorNodes.numNodes - 1; i++ )
|
||||
for( S32 i=0; i<mMajorNodes.numNodes - 1; i++ )
|
||||
{
|
||||
NodeManager segment;
|
||||
segment.startPoint = mMajorNodes.nodeList[i].point;
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ ConsoleDocClass( ParticleData,
|
|||
"@see ParticleEmitterNode\n"
|
||||
);
|
||||
|
||||
static const float sgDefaultWindCoefficient = 0.0f;
|
||||
static const float sgDefaultConstantAcceleration = 0.f;
|
||||
static const float sgDefaultSpinSpeed = 1.f;
|
||||
static const float sgDefaultSpinRandomMin = 0.f;
|
||||
static const float sgDefaultSpinRandomMax = 0.f;
|
||||
static const F32 sgDefaultWindCoefficient = 0.0f;
|
||||
static const F32 sgDefaultConstantAcceleration = 0.f;
|
||||
static const F32 sgDefaultSpinSpeed = 1.f;
|
||||
static const F32 sgDefaultSpinRandomMin = 0.f;
|
||||
static const F32 sgDefaultSpinRandomMax = 0.f;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -622,7 +622,7 @@ bool ParticleData::reload(char errorBuffer[256])
|
|||
}
|
||||
/*
|
||||
numFrames = 0;
|
||||
for( int i=0; i<PDC_MAX_TEX; i++ )
|
||||
for( S32 i=0; i<PDC_MAX_TEX; i++ )
|
||||
{
|
||||
if( textureNameList[i] && textureNameList[i][0] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,9 +100,9 @@ ConsoleDocClass( ParticleEmitterData,
|
|||
"@see ParticleEmitterNode\n"
|
||||
);
|
||||
|
||||
static const float sgDefaultEjectionOffset = 0.f;
|
||||
static const float sgDefaultPhiReferenceVel = 0.f;
|
||||
static const float sgDefaultPhiVariance = 360.f;
|
||||
static const F32 sgDefaultEjectionOffset = 0.f;
|
||||
static const F32 sgDefaultPhiReferenceVel = 0.f;
|
||||
static const F32 sgDefaultPhiVariance = 360.f;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ParticleEmitterData
|
||||
|
|
@ -929,7 +929,7 @@ void ParticleEmitter::prepRenderImage(SceneRenderState* state)
|
|||
//-----------------------------------------------------------------------------
|
||||
void ParticleEmitter::setSizes( F32 *sizeList )
|
||||
{
|
||||
for( int i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
|
||||
for( S32 i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
|
||||
{
|
||||
sizes[i] = sizeList[i];
|
||||
}
|
||||
|
|
@ -940,7 +940,7 @@ void ParticleEmitter::setSizes( F32 *sizeList )
|
|||
//-----------------------------------------------------------------------------
|
||||
void ParticleEmitter::setColors( ColorF *colorList )
|
||||
{
|
||||
for( int i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
|
||||
for( S32 i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
|
||||
{
|
||||
colors[i] = colorList[i];
|
||||
}
|
||||
|
|
@ -1455,7 +1455,7 @@ struct SortParticle
|
|||
};
|
||||
|
||||
// qsort callback function for particle sorting
|
||||
int QSORT_CALLBACK cmpSortParticles(const void* p1, const void* p2)
|
||||
S32 QSORT_CALLBACK cmpSortParticles(const void* p1, const void* p2)
|
||||
{
|
||||
const SortParticle* sp1 = (const SortParticle*)p1;
|
||||
const SortParticle* sp2 = (const SortParticle*)p2;
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ void GameBase::onUnmount( SceneObject *obj, S32 node )
|
|||
|
||||
bool GameBase::setDataBlockProperty( void *obj, const char *index, const char *db)
|
||||
{
|
||||
if( db == NULL || !db || !db[ 0 ] )
|
||||
if( db == NULL || !db[ 0 ] )
|
||||
{
|
||||
Con::errorf( "GameBase::setDataBlockProperty - Can't unset datablock on GameBase objects" );
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ void StdMoveList::clientWriteMovePacket(BitStream *bstream)
|
|||
bstream->writeInt(start,32);
|
||||
bstream->writeInt(count,MoveCountBits);
|
||||
Move * prevMove = NULL;
|
||||
for (int i = 0; i < count; i++)
|
||||
for (S32 i = 0; i < count; i++)
|
||||
{
|
||||
move[offset + i].sendCount++;
|
||||
move[offset + i].pack(bstream,prevMove);
|
||||
|
|
@ -112,7 +112,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
|
|||
|
||||
// Skip forward (must be starting up), or over the moves
|
||||
// we already have.
|
||||
int skip = mLastMoveAck - start;
|
||||
S32 skip = mLastMoveAck - start;
|
||||
if (skip < 0)
|
||||
{
|
||||
mLastMoveAck = start;
|
||||
|
|
@ -121,7 +121,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
|
|||
{
|
||||
if (skip > count)
|
||||
skip = count;
|
||||
for (int i = 0; i < skip; i++)
|
||||
for (S32 i = 0; i < skip; i++)
|
||||
{
|
||||
prevMoveHolder.unpack(bstream,prevMove);
|
||||
prevMoveHolder.checksum = bstream->readInt(Move::ChecksumBits);
|
||||
|
|
@ -141,7 +141,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
|
|||
}
|
||||
|
||||
// Put the rest on the move list.
|
||||
int index = mMoveVec.size();
|
||||
S32 index = mMoveVec.size();
|
||||
mMoveVec.increment(count);
|
||||
while (index < mMoveVec.size())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -893,7 +893,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
|
|||
// Pick the most resistant surface
|
||||
F32 bd = 0;
|
||||
const Collision* collision = 0;
|
||||
for (int c = 0; c < collisionList.getCount(); c++) {
|
||||
for (S32 c = 0; c < collisionList.getCount(); c++) {
|
||||
const Collision &cp = collisionList[c];
|
||||
F32 dot = -mDot(mVelocity,cp.normal);
|
||||
if (dot > bd) {
|
||||
|
|
@ -1204,7 +1204,7 @@ DefineEngineMethod( Item, isRotating, bool, (),,
|
|||
return object->isRotating();
|
||||
}
|
||||
|
||||
DefineEngineMethod( Item, setCollisionTimeout, bool, (int ignoreColObj),(NULL),
|
||||
DefineEngineMethod( Item, setCollisionTimeout, bool, (S32 ignoreColObj),(NULL),
|
||||
"@brief Temporarily disable collisions against a specific ShapeBase object.\n\n"
|
||||
|
||||
"This is useful to prevent a player from immediately picking up an Item they have "
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ DefineEngineMethod( MissionArea, getArea, const char *, (),,
|
|||
char* returnBuffer = Con::getReturnBuffer(48);
|
||||
|
||||
RectI area = object->getArea();
|
||||
dSprintf(returnBuffer, sizeof(returnBuffer), "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y);
|
||||
dSprintf(returnBuffer, 48, "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y);
|
||||
return(returnBuffer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ U32 PathCamera::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
if (stream->writeFlag(mask & WindowMask)) {
|
||||
stream->write(mNodeBase);
|
||||
stream->write(mNodeCount);
|
||||
for (int i = 0; i < mNodeCount; i++) {
|
||||
for (S32 i = 0; i < mNodeCount; i++) {
|
||||
CameraSpline::Knot *knot = mSpline.getKnot(i);
|
||||
mathWrite(*stream, knot->mPosition);
|
||||
mathWrite(*stream, knot->mRotation);
|
||||
|
|
@ -477,7 +477,7 @@ void PathCamera::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
mSpline.removeAll();
|
||||
stream->read(&mNodeBase);
|
||||
stream->read(&mNodeCount);
|
||||
for (int i = 0; i < mNodeCount; i++)
|
||||
for (S32 i = 0; i < mNodeCount; i++)
|
||||
{
|
||||
CameraSpline::Knot *knot = new CameraSpline::Knot();
|
||||
mathRead(*stream, &knot->mPosition);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ private:
|
|||
S32 mNodeBase;
|
||||
S32 mNodeCount;
|
||||
F32 mPosition;
|
||||
int mState;
|
||||
S32 mState;
|
||||
F32 mTarget;
|
||||
bool mTargetSet;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#define _BULLET_H_
|
||||
|
||||
// NOTE: We set these defines which bullet needs here.
|
||||
#ifdef TORQUE_OS_WIN32
|
||||
#ifdef TORQUE_OS_WIN
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#define __APPLE__
|
||||
#elif defined(TORQUE_OS_LINUX) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(TORQUE_OS_WIN32) && !defined(WIN32)
|
||||
#elif defined(TORQUE_OS_WIN) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ bool PxMultiActorData::preload( bool server, String &errorBuffer )
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!shapeName || shapeName == '\0')
|
||||
if (!shapeName || shapeName[0] == '\0')
|
||||
{
|
||||
errorBuffer = "PxMultiActorDatas::preload: no shape name!";
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ AFTER_MODULE_INIT( Sim )
|
|||
{
|
||||
NamedFactory<PhysicsPlugin>::add( "PhysX", &PxPlugin::create );
|
||||
|
||||
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
|
||||
#if defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
|
||||
NamedFactory<PhysicsPlugin>::add( "default", &PxPlugin::create );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -29,25 +29,25 @@
|
|||
#define __APPLE__
|
||||
#elif defined(TORQUE_OS_LINUX) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(TORQUE_OS_WIN32) && !defined(WIN32)
|
||||
#elif defined(TORQUE_OS_WIN) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include <PxPhysicsAPI.h>
|
||||
#include <extensions/PxExtensionsAPI.h>
|
||||
#include <extensions/PxDefaultErrorCallback.h>
|
||||
#include <extensions/PxDefaultAllocator.h>
|
||||
#include <extensions/PxDefaultSimulationFilterShader.h>
|
||||
#include <extensions/PxDefaultCpuDispatcher.h>
|
||||
#include <extensions/PxShapeExt.h>
|
||||
#include <extensions/PxSimpleFactory.h>
|
||||
#include <foundation/PxFoundation.h>
|
||||
#include <characterkinematic/PxController.h>
|
||||
#include <common/PxIO.h>
|
||||
#include <PxExtensionsAPI.h>
|
||||
#include <PxDefaultErrorCallback.h>
|
||||
#include <PxDefaultAllocator.h>
|
||||
#include <PxDefaultSimulationFilterShader.h>
|
||||
#include <PxDefaultCpuDispatcher.h>
|
||||
#include <PxShapeExt.h>
|
||||
#include <PxSimpleFactory.h>
|
||||
#include <PxFoundation.h>
|
||||
#include <PxController.h>
|
||||
#include <PxIO.h>
|
||||
|
||||
|
||||
extern physx::PxPhysics* gPhysics3SDK;
|
||||
|
||||
#endif
|
||||
#endif // _PHYSX3_
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "T3D/physics/physx3/px3Body.h"
|
||||
|
||||
#include "T3D/physics/physx3/px3.h"
|
||||
#include "T3D/physics/physx3/px3Cast.h"
|
||||
#include "T3D/physics/physx3/px3Casts.h"
|
||||
#include "T3D/physics/physx3/px3World.h"
|
||||
#include "T3D/physics/physx3/px3Collision.h"
|
||||
|
||||
|
|
@ -123,24 +123,23 @@ bool Px3Body::init( PhysicsCollision *shape,
|
|||
Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported.");
|
||||
}
|
||||
}
|
||||
physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial,desc->pose);
|
||||
physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial);
|
||||
physx::PxFilterData colData;
|
||||
if(isDebris)
|
||||
colData.word0 = PX3_DEBRIS;
|
||||
else if(isTrigger)
|
||||
{
|
||||
//We don't want trigger shapes taking part in shape pair intersection tests
|
||||
pShape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, false);
|
||||
colData.word0 = PX3_TRIGGER;
|
||||
}
|
||||
colData.word0 = PX3_TRIGGER;
|
||||
else
|
||||
colData.word0 = PX3_DEFAULT;
|
||||
|
||||
//set local pose - actor->createShape with a local pose is deprecated in physx 3.3
|
||||
pShape->setLocalPose(desc->pose);
|
||||
//set the skin width
|
||||
pShape->setContactOffset(0.01f);
|
||||
pShape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, !isTrigger);
|
||||
pShape->setFlag(physx::PxShapeFlag::eSCENE_QUERY_SHAPE,true);
|
||||
pShape->setSimulationFilterData(colData);
|
||||
pShape->setQueryFilterData(colData);
|
||||
pShape->setSimulationFilterData(colData);
|
||||
pShape->setQueryFilterData(colData);
|
||||
}
|
||||
|
||||
//mass & intertia has to be set after creating the shape
|
||||
|
|
@ -148,6 +147,10 @@ bool Px3Body::init( PhysicsCollision *shape,
|
|||
{
|
||||
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
|
||||
physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass);
|
||||
if(mBodyFlags & BF_CCD)
|
||||
actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eENABLE_CCD, true);
|
||||
else
|
||||
actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eENABLE_CCD, false);
|
||||
}
|
||||
|
||||
// This sucks, but it has to happen if we want
|
||||
|
|
@ -366,6 +369,23 @@ void Px3Body::setSimulationEnabled( bool enabled )
|
|||
delete [] shapes;
|
||||
}
|
||||
|
||||
void Px3Body::moveKinematicTo( const MatrixF &transform )
|
||||
{
|
||||
AssertFatal( mActor, "Px3Body::moveKinematicTo - The actor is null!" );
|
||||
|
||||
const bool isKinematic = mBodyFlags & BF_KINEMATIC;
|
||||
if (!isKinematic )
|
||||
{
|
||||
Con::errorf("Px3Body::moveKinematicTo is only for kinematic bodies.");
|
||||
return;
|
||||
}
|
||||
|
||||
mWorld->releaseWriteLock();
|
||||
|
||||
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
|
||||
actor->setKinematicTarget(px3Cast<physx::PxTransform>(transform));
|
||||
}
|
||||
|
||||
void Px3Body::setTransform( const MatrixF &transform )
|
||||
{
|
||||
AssertFatal( mActor, "Px3Body::setTransform - The actor is null!" );
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3BODY_H_
|
||||
#define _T3D_PHYSICS_PX3BODY_H_
|
||||
#ifndef _PX3BODY_H_
|
||||
#define _PX3BODY_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSBODY_H_
|
||||
#include "T3D/physics/physicsBody.h"
|
||||
|
|
@ -88,6 +88,7 @@ public:
|
|||
// PhysicsObject
|
||||
virtual PhysicsWorld* getWorld();
|
||||
virtual void setTransform( const MatrixF &xfm );
|
||||
virtual void moveKinematicTo( const MatrixF &xfm );
|
||||
virtual MatrixF& getTransform( MatrixF *outMatrix );
|
||||
virtual Box3F getWorldBounds();
|
||||
virtual void setSimulationEnabled( bool enabled );
|
||||
|
|
@ -118,4 +119,4 @@ public:
|
|||
virtual void applyImpulse( const Point3F &origin, const Point3F &force );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3BODY_H_
|
||||
|
|
|
|||
137
Engine/source/T3D/physics/physx3/px3Casts.h
Normal file
137
Engine/source/T3D/physics/physx3/px3Casts.h
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _PX3CASTS_H_
|
||||
#define _PX3CASTS_H_
|
||||
|
||||
#ifndef _MPOINT3_H_
|
||||
#include "math/mPoint3.h"
|
||||
#endif
|
||||
#ifndef _MMATRIX_H_
|
||||
#include "math/mMatrix.h"
|
||||
#endif
|
||||
#ifndef _MBOX_H_
|
||||
#include "math/mBox.h"
|
||||
#endif
|
||||
#ifndef _MQUAT_H_
|
||||
#include "math/mQuat.h"
|
||||
#endif
|
||||
#ifndef _MTRANSFORM_H_
|
||||
#include "math/mTransform.h"
|
||||
#endif
|
||||
|
||||
|
||||
template <class T, class F> inline T px3Cast( const F &from );
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
inline Point3F px3Cast( const physx::PxVec3 &vec )
|
||||
{
|
||||
return Point3F( vec.x, vec.y, vec.z );
|
||||
}
|
||||
|
||||
template<>
|
||||
inline physx::PxVec3 px3Cast( const Point3F &point )
|
||||
{
|
||||
return physx::PxVec3( point.x, point.y, point.z );
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
template<>
|
||||
inline QuatF px3Cast( const physx::PxQuat &quat )
|
||||
{
|
||||
/// The Torque quat has the opposite winding order.
|
||||
return QuatF( -quat.x, -quat.y, -quat.z, quat.w );
|
||||
}
|
||||
|
||||
template<>
|
||||
inline physx::PxQuat px3Cast( const QuatF &quat )
|
||||
{
|
||||
/// The Torque quat has the opposite winding order.
|
||||
physx::PxQuat result( -quat.x, -quat.y, -quat.z, quat.w );
|
||||
return result;
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
inline physx::PxExtendedVec3 px3Cast( const Point3F &point )
|
||||
{
|
||||
return physx::PxExtendedVec3( point.x, point.y, point.z );
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Point3F px3Cast( const physx::PxExtendedVec3 &xvec )
|
||||
{
|
||||
return Point3F( xvec.x, xvec.y, xvec.z );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
inline physx::PxBounds3 px3Cast( const Box3F &box )
|
||||
{
|
||||
physx::PxBounds3 bounds(px3Cast<physx::PxVec3>(box.minExtents),
|
||||
px3Cast<physx::PxVec3>(box.maxExtents));
|
||||
return bounds;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Box3F px3Cast( const physx::PxBounds3 &bounds )
|
||||
{
|
||||
return Box3F( bounds.minimum.x,
|
||||
bounds.minimum.y,
|
||||
bounds.minimum.z,
|
||||
bounds.maximum.x,
|
||||
bounds.maximum.y,
|
||||
bounds.maximum.z );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
inline physx::PxTransform px3Cast( const MatrixF &xfm )
|
||||
{
|
||||
physx::PxTransform out;
|
||||
QuatF q;
|
||||
q.set(xfm);
|
||||
out.q = px3Cast<physx::PxQuat>(q);
|
||||
out.p = px3Cast<physx::PxVec3>(xfm.getPosition());
|
||||
return out;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline TransformF px3Cast(const physx::PxTransform &xfm)
|
||||
{
|
||||
TransformF out(px3Cast<Point3F>(xfm.p),AngAxisF(px3Cast<QuatF>(xfm.q)));
|
||||
return out;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline MatrixF px3Cast( const physx::PxTransform &xfm )
|
||||
{
|
||||
MatrixF out;
|
||||
TransformF t = px3Cast<TransformF>(xfm);
|
||||
out = t.getMatrix();
|
||||
return out;
|
||||
}
|
||||
|
||||
#endif //_PX3CASTS_H_
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
#include "math/mPoint3.h"
|
||||
#include "math/mMatrix.h"
|
||||
#include "T3D/physics/physx3/px3.h"
|
||||
#include "T3D/physics/physx3/px3Cast.h"
|
||||
#include "T3D/physics/physx3/px3Casts.h"
|
||||
#include "T3D/physics/physx3/px3World.h"
|
||||
#include "T3D/physics/physx3/px3Stream.h"
|
||||
|
||||
|
|
@ -105,7 +105,10 @@ bool Px3Collision::addConvex( const Point3F *points,
|
|||
convexMesh = gPhysics3SDK->createConvexMesh(in);
|
||||
|
||||
Px3CollisionDesc *desc = new Px3CollisionDesc;
|
||||
desc->pGeometry = new physx::PxConvexMeshGeometry(convexMesh);
|
||||
physx::PxVec3 scale = px3Cast<physx::PxVec3>(localXfm.getScale());
|
||||
physx::PxQuat rotation = px3Cast<physx::PxQuat>(QuatF(localXfm));
|
||||
physx::PxMeshScale meshScale(scale,rotation);
|
||||
desc->pGeometry = new physx::PxConvexMeshGeometry(convexMesh,meshScale);
|
||||
desc->pose = px3Cast<physx::PxTransform>(localXfm);
|
||||
mColShapes.push_back(desc);
|
||||
return true;
|
||||
|
|
@ -177,13 +180,13 @@ bool Px3Collision::addHeightfield( const U16 *heights,
|
|||
|
||||
if ( holes && holes[ getMax( (S32)index - 1, 0 ) ] ) // row index for holes adjusted so PhysX collision shape better matches rendered terrain
|
||||
{
|
||||
currentSample->materialIndex0 = 0;
|
||||
currentSample->materialIndex1 = 0;
|
||||
currentSample->materialIndex0 = physx::PxHeightFieldMaterial::eHOLE;
|
||||
currentSample->materialIndex1 = physx::PxHeightFieldMaterial::eHOLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentSample->materialIndex0 = 1;
|
||||
currentSample->materialIndex1 = 1;
|
||||
currentSample->materialIndex0 = 0;
|
||||
currentSample->materialIndex1 = 0;
|
||||
}
|
||||
|
||||
int flag = ( column + tess ) % 2;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3COLLISION_H_
|
||||
#define _T3D_PHYSICS_PX3COLLISION_H_
|
||||
#ifndef _PX3COLLISION_H_
|
||||
#define _PX3COLLISION_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSCOLLISION_H_
|
||||
#include "T3D/physics/physicsCollision.h"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
#ifndef _MMATRIX_H_
|
||||
#include "math/mMatrix.h"
|
||||
#endif
|
||||
//nasty hate doing this!
|
||||
|
||||
#include <foundation/PxTransform.h>
|
||||
|
||||
//forward declare
|
||||
|
|
@ -84,4 +84,4 @@ public:
|
|||
const MatrixF &localXfm );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3COLLISION_H_
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "T3D/physics/physx3/px3Player.h"
|
||||
#include "T3D/physics/physicsPlugin.h"
|
||||
#include "T3D/physics/physx3/px3World.h"
|
||||
#include "T3D/physics/physx3/px3Cast.h"
|
||||
#include "T3D/physics/physx3/px3Casts.h"
|
||||
#include "T3D/physics/physx3/px3Utils.h"
|
||||
#include "collision/collision.h"
|
||||
|
||||
|
|
@ -322,7 +322,10 @@ void Px3Player::setScale( const Point3F &scale )
|
|||
|
||||
Box3F Px3Player::getWorldBounds()
|
||||
{
|
||||
Con::warnf( "Px3Player::getWorldBounds - not implemented" );
|
||||
return Box3F::Invalid;
|
||||
physx::PxBounds3 bounds;
|
||||
physx::PxRigidDynamic *actor = mController->getActor();
|
||||
physx::PxShape *shape = px3GetFirstShape(actor);
|
||||
bounds = physx::PxShapeExt::getWorldBounds(*shape,*actor);
|
||||
return px3Cast<Box3F>( bounds );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,4 +101,4 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#endif // _PXPLAYER_H
|
||||
#endif // _PX3PLAYER_H_
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ AFTER_MODULE_INIT( Sim )
|
|||
{
|
||||
NamedFactory<PhysicsPlugin>::add( "PhysX3", &Px3Plugin::create );
|
||||
|
||||
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
|
||||
#if defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
|
||||
NamedFactory<PhysicsPlugin>::add( "default", &Px3Plugin::create );
|
||||
#endif
|
||||
}
|
||||
|
|
@ -224,4 +224,3 @@ U32 Px3Plugin::getWorldCount() const
|
|||
{
|
||||
return mPhysicsWorldLookup.size();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,15 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3PLUGIN_H_
|
||||
#define _T3D_PHYSICS_PX3PLUGIN_H_
|
||||
#ifndef _PX3PLUGIN_H_
|
||||
#define _PX3PLUGIN_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSPLUGIN_H_
|
||||
#include "T3D/physics/physicsPlugin.h"
|
||||
#endif
|
||||
|
||||
class Px3ClothShape;
|
||||
|
||||
class Px3Plugin : public PhysicsPlugin
|
||||
{
|
||||
public:
|
||||
|
|
@ -52,7 +54,6 @@ public:
|
|||
virtual PhysicsWorld* getWorld( const String &worldName ) const;
|
||||
virtual PhysicsWorld* getWorld() const;
|
||||
virtual U32 getWorldCount() const;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3PLUGIN_H_
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3STREAM_H_
|
||||
#define _T3D_PHYSICS_PX3STREAM_H_
|
||||
#ifndef _PX3STREAM_H_
|
||||
#define _PX3STREAM_H_
|
||||
|
||||
#ifndef _PHYSX3_H_
|
||||
#include "T3D/physics/physx3/px3.h"
|
||||
|
|
@ -74,4 +74,4 @@ public:
|
|||
virtual ~Px3ConsoleStream();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3STREAM_H_
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _PHYSX3_UTILS_H_
|
||||
#define _PHYSX3_UTILS_H_
|
||||
#ifndef _PX3UTILS_H_
|
||||
#define _PX3UTILS_H_
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
|
@ -31,5 +31,4 @@ namespace physx
|
|||
|
||||
extern physx::PxShape* px3GetFirstShape(physx::PxRigidActor *actor);
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _PX3UTILS_H_
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "T3D/physics/physx3/px3.h"
|
||||
#include "T3D/physics/physx3/px3Plugin.h"
|
||||
#include "T3D/physics/physx3/px3Cast.h"
|
||||
#include "T3D/physics/physx3/px3Casts.h"
|
||||
#include "T3D/physics/physx3/px3Stream.h"
|
||||
#include "T3D/physics/physicsUserData.h"
|
||||
|
||||
|
|
@ -54,6 +54,23 @@ physx::PxDefaultAllocator Px3World::smMemoryAlloc;
|
|||
F32 Px3World::smPhysicsStepTime = 1.0f/(F32)TickMs;
|
||||
U32 Px3World::smPhysicsMaxIterations = 4;
|
||||
|
||||
//filter shader with support for CCD pairs
|
||||
static physx::PxFilterFlags sCcdFilterShader(
|
||||
physx::PxFilterObjectAttributes attributes0,
|
||||
physx::PxFilterData filterData0,
|
||||
physx::PxFilterObjectAttributes attributes1,
|
||||
physx::PxFilterData filterData1,
|
||||
physx::PxPairFlags& pairFlags,
|
||||
const void* constantBlock,
|
||||
physx::PxU32 constantBlockSize)
|
||||
{
|
||||
pairFlags = physx::PxPairFlag::eRESOLVE_CONTACTS;
|
||||
pairFlags |= physx::PxPairFlag::eCCD_LINEAR;
|
||||
return physx::PxFilterFlags();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Px3World::Px3World(): mScene( NULL ),
|
||||
mProcessList( NULL ),
|
||||
mIsSimulating( false ),
|
||||
|
|
@ -198,7 +215,6 @@ void Px3World::destroyWorld()
|
|||
mScene->release();
|
||||
mScene = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
||||
|
|
@ -221,10 +237,12 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
|||
sceneDesc.cpuDispatcher = smCpuDispatcher;
|
||||
Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount());
|
||||
}
|
||||
|
||||
|
||||
|
||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
|
||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
|
||||
|
||||
sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader;
|
||||
sceneDesc.filterShader = sCcdFilterShader;
|
||||
|
||||
mScene = gPhysics3SDK->createScene(sceneDesc);
|
||||
|
||||
|
|
@ -559,7 +577,6 @@ void Px3World::onDebugDraw( const SceneRenderState *state )
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
//set simulation timing via script
|
||||
DefineEngineFunction( physx3SetSimulationTiming, void, ( F32 stepTime, U32 maxSteps ),, "Set simulation timing of the PhysX 3 plugin" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _PHYSX3_WORLD_H_
|
||||
#define _PHYSX3_WORLD_H_
|
||||
#ifndef _PX3WORLD_H_
|
||||
#define _PX3WORLD_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSWORLD_H_
|
||||
#include "T3D/physics/physicsWorld.h"
|
||||
|
|
@ -53,7 +53,6 @@ class Px3World : public PhysicsWorld
|
|||
protected:
|
||||
|
||||
physx::PxScene* mScene;
|
||||
|
||||
bool mIsEnabled;
|
||||
bool mIsSimulating;
|
||||
bool mIsServer;
|
||||
|
|
@ -71,7 +70,6 @@ protected:
|
|||
static physx::PxVisualDebuggerConnection* smPvdConnection;
|
||||
static F32 smPhysicsStepTime;
|
||||
static U32 smPhysicsMaxIterations;
|
||||
|
||||
F32 mAccumulator;
|
||||
bool _simulate(const F32 dt);
|
||||
|
||||
|
|
@ -105,6 +103,4 @@ public:
|
|||
static void setTiming(F32 stepTime,U32 maxIterations);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _PX3WORLD_H_
|
||||
|
|
|
|||
|
|
@ -427,9 +427,9 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
{
|
||||
for( U32 i = 0; i < MaxSounds; ++ i )
|
||||
{
|
||||
String errorStr;
|
||||
if( !sfxResolve( &sound[ i ], errorStr ) )
|
||||
Con::errorf( "PlayerData::preload: %s", errorStr.c_str() );
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &sound[ i ], sfxErrorStr ) )
|
||||
Con::errorf( "PlayerData::preload: %s", sfxErrorStr.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
// Extract ground transform velocity from animations
|
||||
// Get the named ones first so they can be indexed directly.
|
||||
ActionAnimation *dp = &actionList[0];
|
||||
for (int i = 0; i < NumTableActionAnims; i++,dp++)
|
||||
for (S32 i = 0; i < NumTableActionAnims; i++,dp++)
|
||||
{
|
||||
ActionAnimationDef *sp = &ActionAnimationList[i];
|
||||
dp->name = sp->name;
|
||||
|
|
@ -492,7 +492,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
if (dStricmp(sp->name, "jet") != 0)
|
||||
AssertWarn(dp->sequence != -1, avar("PlayerData::preload - Unable to find named animation sequence '%s'!", sp->name));
|
||||
}
|
||||
for (int b = 0; b < mShape->sequences.size(); b++)
|
||||
for (S32 b = 0; b < mShape->sequences.size(); b++)
|
||||
{
|
||||
if (!isTableSequence(b))
|
||||
{
|
||||
|
|
@ -509,7 +509,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
// Resolve lookAction index
|
||||
dp = &actionList[0];
|
||||
String lookName("look");
|
||||
for (int c = 0; c < actionCount; c++,dp++)
|
||||
for (S32 c = 0; c < actionCount; c++,dp++)
|
||||
if( dStricmp( dp->name, lookName ) == 0 )
|
||||
lookAction = c;
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
if (!Sim::findObject(dustID, dustEmitter))
|
||||
Con::errorf(ConsoleLogEntry::General, "PlayerData::preload - Invalid packet, bad datablockId(dustEmitter): 0x%x", dustID);
|
||||
|
||||
for (int i=0; i<NUM_SPLASH_EMITTERS; i++)
|
||||
for (S32 i=0; i<NUM_SPLASH_EMITTERS; i++)
|
||||
if( !splashEmitterList[i] && splashEmitterIDList[i] != 0 )
|
||||
if( Sim::findObject( splashEmitterIDList[i], splashEmitterList[i] ) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "PlayerData::onAdd - Invalid packet, bad datablockId(particle emitter): 0x%x", splashEmitterIDList[i]);
|
||||
|
|
@ -586,7 +586,10 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath());
|
||||
|
||||
if (!fileRef)
|
||||
{
|
||||
errorStr = String::ToString("PlayerData: Mounted image %d loading failed, shape \"%s\" is not found.",i,mShapeFP[i].getPath().getFullPath().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(server)
|
||||
mCRCFP[i] = fileRef->getChecksum();
|
||||
|
|
@ -647,7 +650,7 @@ bool PlayerData::isTableSequence(S32 seq)
|
|||
{
|
||||
// The sequences from the table must already have
|
||||
// been loaded for this to work.
|
||||
for (int i = 0; i < NumTableActionAnims; i++)
|
||||
for (S32 i = 0; i < NumTableActionAnims; i++)
|
||||
if (actionList[i].sequence == seq)
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -1944,7 +1947,7 @@ void Player::reSkin()
|
|||
Vector<String> skins;
|
||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
||||
|
||||
for ( int i = 0; i < skins.size(); i++ )
|
||||
for ( S32 i = 0; i < skins.size(); i++ )
|
||||
{
|
||||
String oldSkin( mAppliedSkinName.c_str() );
|
||||
String newSkin( skins[i] );
|
||||
|
|
@ -1961,7 +1964,7 @@ void Player::reSkin()
|
|||
|
||||
// Apply skin to both 3rd person and 1st person shape instances
|
||||
mShapeInstance->reSkin( newSkin, oldSkin );
|
||||
for ( int j = 0; j < ShapeBase::MaxMountedImages; j++ )
|
||||
for ( S32 j = 0; j < ShapeBase::MaxMountedImages; j++ )
|
||||
{
|
||||
if (mShapeFPInstance[j])
|
||||
mShapeFPInstance[j]->reSkin( newSkin, oldSkin );
|
||||
|
|
@ -5822,7 +5825,7 @@ bool Player::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
|
|||
F32 const *si = &start.x;
|
||||
F32 const *ei = &end.x;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (S32 i = 0; i < 3; i++) {
|
||||
if (*si < *ei) {
|
||||
if (*si > *bmax || *ei < *bmin)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -320,9 +320,9 @@ bool ProjectileData::preload(bool server, String &errorStr)
|
|||
if (Sim::findObject(decalId, decal) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
|
||||
|
||||
String errorStr;
|
||||
if( !sfxResolve( &sound, errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", errorStr.c_str());
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &sound, sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
|
||||
|
||||
if (!lightDesc && lightDescId != 0)
|
||||
if (Sim::findObject(lightDescId, lightDesc) == false)
|
||||
|
|
@ -1011,7 +1011,7 @@ void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideT
|
|||
|
||||
// Client (impact) decal.
|
||||
if ( mDataBlock->decal )
|
||||
gDecalManager->addDecal( p, n, 0.0f, mDataBlock->decal );
|
||||
gDecalManager->addDecal(p, n, mRandF(0.0f, M_2PI_F), mDataBlock->decal);
|
||||
|
||||
// Client object
|
||||
updateSound();
|
||||
|
|
|
|||
|
|
@ -215,9 +215,9 @@ public:
|
|||
|
||||
void updateSound();
|
||||
|
||||
virtual bool calculateImpact( float simTime,
|
||||
virtual bool calculateImpact( F32 simTime,
|
||||
Point3F &pointOfImpact,
|
||||
float &impactTime );
|
||||
F32 &impactTime );
|
||||
|
||||
void setInitialPosition( const Point3F& pos );
|
||||
void setInitialVelocity( const Point3F& vel );
|
||||
|
|
|
|||
|
|
@ -136,11 +136,11 @@ bool ProximityMineData::preload( bool server, String& errorStr )
|
|||
if ( !server )
|
||||
{
|
||||
// Resolve sounds
|
||||
String errorStr;
|
||||
if( !sfxResolve( &armingSound, errorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() );
|
||||
if( !sfxResolve( &triggerSound, errorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() );
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &armingSound, sfxErrorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
|
||||
if( !sfxResolve( &triggerSound, sfxErrorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
|
||||
}
|
||||
|
||||
if ( mShape )
|
||||
|
|
@ -451,7 +451,7 @@ void ProximityMine::processTick( const Move* move )
|
|||
SimpleQueryList sql;
|
||||
getContainer()->findObjects( triggerBox, sTriggerCollisionMask,
|
||||
SimpleQueryList::insertionCallback, &sql );
|
||||
for ( int i = 0; i < sql.mList.size(); i++ )
|
||||
for ( S32 i = 0; i < sql.mList.size(); i++ )
|
||||
{
|
||||
// Detect movement in the trigger area
|
||||
if ( ( sql.mList[i] == mOwner && !mDataBlock->triggerOnOwner ) ||
|
||||
|
|
|
|||
|
|
@ -265,8 +265,8 @@ void Rigid::translateCenterOfMass(const Point3F &oldPos,const Point3F &newPos)
|
|||
MatrixF oldx,newx;
|
||||
oldx.setCrossProduct(oldPos);
|
||||
newx.setCrossProduct(newPos);
|
||||
for (int row = 0; row < 3; row++)
|
||||
for (int col = 0; col < 3; col++) {
|
||||
for (S32 row = 0; row < 3; row++)
|
||||
for (S32 col = 0; col < 3; col++) {
|
||||
F32 n = newx(row,col), o = oldx(row,col);
|
||||
objectInertia(row,col) += mass * ((o * o) - (n * n));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ namespace {
|
|||
|
||||
// Physics and collision constants
|
||||
static F32 sRestTol = 0.5; // % of gravity energy to be at rest
|
||||
static int sRestCount = 10; // Consecutive ticks before comming to rest
|
||||
static S32 sRestCount = 10; // Consecutive ticks before comming to rest
|
||||
|
||||
const U32 sCollisionMoveMask = ( TerrainObjectType | PlayerObjectType |
|
||||
StaticShapeObjectType | VehicleObjectType |
|
||||
|
|
@ -302,6 +302,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
if (!collisionDetails.size() || collisionDetails[0] == -1)
|
||||
{
|
||||
Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail");
|
||||
errorStr = String::ToString("RigidShapeData: Couldn't load shape \"%s\"",shapeName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1652,7 +1653,7 @@ void RigidShape::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState
|
|||
GFX->getDrawUtil()->drawCube( desc, Point3F(0.1f,0.1f,0.1f), mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld );
|
||||
|
||||
// Collision points...
|
||||
for (int i = 0; i < mCollisionList.getCount(); i++)
|
||||
for (S32 i = 0; i < mCollisionList.getCount(); i++)
|
||||
{
|
||||
const Collision& collision = mCollisionList[i];
|
||||
GFX->getDrawUtil()->drawCube( desc, Point3F(0.05f,0.05f,0.05f), collision.point, ColorI(0, 0, 255) );
|
||||
|
|
@ -1660,7 +1661,7 @@ void RigidShape::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState
|
|||
|
||||
// Render the normals as one big batch...
|
||||
PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2);
|
||||
for (int i = 0; i < mCollisionList.getCount(); i++)
|
||||
for (S32 i = 0; i < mCollisionList.getCount(); i++)
|
||||
{
|
||||
|
||||
const Collision& collision = mCollisionList[i];
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class RigidShape: public ShapeBase
|
|||
CollisionList mContacts;
|
||||
Rigid mRigid;
|
||||
ShapeBaseConvex mConvex;
|
||||
int restCount;
|
||||
S32 restCount;
|
||||
|
||||
SimObjectPtr<ParticleEmitter> mDustEmitterList[RigidShapeData::VC_NUM_DUST_EMITTERS];
|
||||
SimObjectPtr<ParticleEmitter> mSplashEmitterList[RigidShapeData::VC_NUM_SPLASH_EMITTERS];
|
||||
|
|
|
|||
|
|
@ -306,7 +306,10 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
|||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShape.getPath());
|
||||
|
||||
if (!fileRef)
|
||||
{
|
||||
errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"",shapeName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(server)
|
||||
mCRC = fileRef->getChecksum();
|
||||
|
|
@ -898,17 +901,9 @@ ShapeBase::ShapeBase()
|
|||
mCloakLevel( 0.0f ),
|
||||
mDamageFlash( 0.0f ),
|
||||
mWhiteOut( 0.0f ),
|
||||
mInvincibleEffect( 0.0f ),
|
||||
mInvincibleDelta( 0.0f ),
|
||||
mInvincibleCount( 0.0f ),
|
||||
mInvincibleSpeed( 0.0f ),
|
||||
mInvincibleTime( 0.0f ),
|
||||
mInvincibleFade( 0.1f ),
|
||||
mInvincibleOn( false ),
|
||||
mIsControlled( false ),
|
||||
mConvexList( new Convex ),
|
||||
mCameraFov( 90.0f ),
|
||||
mShieldNormal( 0.0f, 0.0f, 1.0f ),
|
||||
mFadeOut( true ),
|
||||
mFading( false ),
|
||||
mFadeVal( 1.0f ),
|
||||
|
|
@ -1282,7 +1277,7 @@ void ShapeBase::processTick(const Move* move)
|
|||
{
|
||||
mMoveMotion = true;
|
||||
}
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
{
|
||||
setImageMotionState(i, mMoveMotion);
|
||||
}
|
||||
|
|
@ -1305,7 +1300,7 @@ void ShapeBase::processTick(const Move* move)
|
|||
// Advance images
|
||||
if (isServerObject())
|
||||
{
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
{
|
||||
if (mMountedImageList[i].dataBlock)
|
||||
updateImageState(i, TickSec);
|
||||
|
|
@ -1347,7 +1342,7 @@ void ShapeBase::advanceTime(F32 dt)
|
|||
// advanced at framerate.
|
||||
advanceThreads(dt);
|
||||
updateAudioPos();
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
if (mMountedImageList[i].dataBlock)
|
||||
{
|
||||
updateImageState(i, dt);
|
||||
|
|
@ -1382,9 +1377,6 @@ void ShapeBase::advanceTime(F32 dt)
|
|||
mCloakLevel = 0.0;
|
||||
}
|
||||
}
|
||||
if(mInvincibleOn)
|
||||
updateInvincibleEffect(dt);
|
||||
|
||||
if(mFading)
|
||||
{
|
||||
mFadeElapsedTime += dt;
|
||||
|
|
@ -1987,119 +1979,6 @@ void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
|
|||
mat->mul( gCamFXMgr.getTrans() );
|
||||
}
|
||||
|
||||
// void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
|
||||
// {
|
||||
// // Returns camera to world space transform
|
||||
// // Handles first person / third person camera position
|
||||
|
||||
// if (isServerObject() && mShapeInstance)
|
||||
// mShapeInstance->animateNodeSubtrees(true);
|
||||
|
||||
// if (*pos != 0) {
|
||||
// F32 min,max;
|
||||
// Point3F offset;
|
||||
// MatrixF eye,rot;
|
||||
// getCameraParameters(&min,&max,&offset,&rot);
|
||||
// getRenderEyeTransform(&eye);
|
||||
// mat->mul(eye,rot);
|
||||
|
||||
// // Use the eye transform to orient the camera
|
||||
// VectorF vp,vec;
|
||||
// vp.x = vp.z = 0;
|
||||
// vp.y = -(max - min) * *pos;
|
||||
// eye.mulV(vp,&vec);
|
||||
|
||||
// // Use the camera node's pos.
|
||||
// Point3F osp,sp;
|
||||
// if (mDataBlock->cameraNode != -1) {
|
||||
// mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp);
|
||||
// getRenderTransform().mulP(osp,&sp);
|
||||
// }
|
||||
// else
|
||||
// getRenderTransform().getColumn(3,&sp);
|
||||
|
||||
// // Make sure we don't extend the camera into anything solid
|
||||
// Point3F ep = sp + vec;
|
||||
// ep += offset;
|
||||
// disableCollision();
|
||||
// if (isMounted())
|
||||
// getObjectMount()->disableCollision();
|
||||
// RayInfo collision;
|
||||
// if (mContainer->castRay(sp,ep,(0xFFFFFFFF & ~(WaterObjectType|ForceFieldObjectType|GameBaseObjectType|DefaultObjectType)),&collision)) {
|
||||
// *pos = collision.t *= 0.9;
|
||||
// if (*pos == 0)
|
||||
// eye.getColumn(3,&ep);
|
||||
// else
|
||||
// ep = sp + vec * *pos;
|
||||
// }
|
||||
// mat->setColumn(3,ep);
|
||||
// if (isMounted())
|
||||
// getObjectMount()->enableCollision();
|
||||
// enableCollision();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// getRenderEyeTransform(mat);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// void ShapeBase::getRenderCameraTransform(F32* pos,MatrixF* mat)
|
||||
// {
|
||||
// // Returns camera to world space transform
|
||||
// // Handles first person / third person camera position
|
||||
|
||||
// if (isServerObject() && mShapeInstance)
|
||||
// mShapeInstance->animateNodeSubtrees(true);
|
||||
|
||||
// if (*pos != 0) {
|
||||
// F32 min,max;
|
||||
// Point3F offset;
|
||||
// MatrixF eye,rot;
|
||||
// getCameraParameters(&min,&max,&offset,&rot);
|
||||
// getRenderEyeTransform(&eye);
|
||||
// mat->mul(eye,rot);
|
||||
|
||||
// // Use the eye transform to orient the camera
|
||||
// VectorF vp,vec;
|
||||
// vp.x = vp.z = 0;
|
||||
// vp.y = -(max - min) * *pos;
|
||||
// eye.mulV(vp,&vec);
|
||||
|
||||
// // Use the camera node's pos.
|
||||
// Point3F osp,sp;
|
||||
// if (mDataBlock->cameraNode != -1) {
|
||||
// mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp);
|
||||
// getRenderTransform().mulP(osp,&sp);
|
||||
// }
|
||||
// else
|
||||
// getRenderTransform().getColumn(3,&sp);
|
||||
|
||||
// // Make sure we don't extend the camera into anything solid
|
||||
// Point3F ep = sp + vec;
|
||||
// ep += offset;
|
||||
// disableCollision();
|
||||
// if (isMounted())
|
||||
// getObjectMount()->disableCollision();
|
||||
// RayInfo collision;
|
||||
// if (mContainer->castRay(sp,ep,(0xFFFFFFFF & ~(WaterObjectType|ForceFieldObjectType|GameBaseObjectType|DefaultObjectType)),&collision)) {
|
||||
// *pos = collision.t *= 0.9;
|
||||
// if (*pos == 0)
|
||||
// eye.getColumn(3,&ep);
|
||||
// else
|
||||
// ep = sp + vec * *pos;
|
||||
// }
|
||||
// mat->setColumn(3,ep);
|
||||
// if (isMounted())
|
||||
// getObjectMount()->enableCollision();
|
||||
// enableCollision();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// getRenderEyeTransform(mat);
|
||||
// }
|
||||
// }
|
||||
|
||||
void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
|
||||
{
|
||||
*min = mDataBlock->cameraMinDist;
|
||||
|
|
@ -2153,52 +2032,6 @@ bool ShapeBase::useObjsEyePoint() const
|
|||
return mDataBlock->useEyePoint;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
F32 ShapeBase::getInvincibleEffect() const
|
||||
{
|
||||
return mInvincibleEffect;
|
||||
}
|
||||
|
||||
void ShapeBase::setupInvincibleEffect(F32 time, F32 speed)
|
||||
{
|
||||
if(isClientObject())
|
||||
{
|
||||
mInvincibleCount = mInvincibleTime = time;
|
||||
mInvincibleSpeed = mInvincibleDelta = speed;
|
||||
mInvincibleEffect = 0.0f;
|
||||
mInvincibleOn = true;
|
||||
mInvincibleFade = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
mInvincibleTime = time;
|
||||
mInvincibleSpeed = speed;
|
||||
setMaskBits(InvincibleMask);
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBase::updateInvincibleEffect(F32 dt)
|
||||
{
|
||||
if(mInvincibleCount > 0.0f )
|
||||
{
|
||||
if(mInvincibleEffect >= ((0.3 * mInvincibleFade) + 0.05f) && mInvincibleDelta > 0.0f)
|
||||
mInvincibleDelta = -mInvincibleSpeed;
|
||||
else if(mInvincibleEffect <= 0.05f && mInvincibleDelta < 0.0f)
|
||||
{
|
||||
mInvincibleDelta = mInvincibleSpeed;
|
||||
mInvincibleFade = mInvincibleCount / mInvincibleTime;
|
||||
}
|
||||
mInvincibleEffect += mInvincibleDelta;
|
||||
mInvincibleCount -= dt;
|
||||
}
|
||||
else
|
||||
{
|
||||
mInvincibleEffect = 0.0f;
|
||||
mInvincibleOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void ShapeBase::setVelocity(const VectorF&)
|
||||
{
|
||||
|
|
@ -2240,7 +2073,7 @@ void ShapeBase::stopAudio(U32 slot)
|
|||
void ShapeBase::updateServerAudio()
|
||||
{
|
||||
// Timeout non-looping sounds
|
||||
for (int i = 0; i < MaxSoundThreads; i++) {
|
||||
for (S32 i = 0; i < MaxSoundThreads; i++) {
|
||||
Sound& st = mSoundThread[i];
|
||||
if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) {
|
||||
clearMaskBits(SoundMaskN << i);
|
||||
|
|
@ -2280,7 +2113,7 @@ void ShapeBase::updateAudioState(Sound& st)
|
|||
|
||||
void ShapeBase::updateAudioPos()
|
||||
{
|
||||
for (int i = 0; i < MaxSoundThreads; i++)
|
||||
for (S32 i = 0; i < MaxSoundThreads; i++)
|
||||
{
|
||||
SFXSource* source = mSoundThread[i].sound;
|
||||
if ( source )
|
||||
|
|
@ -3102,8 +2935,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if(!stream->writeFlag(mask & (NameMask | DamageMask | SoundMask | MeshHiddenMask |
|
||||
ThreadMask | ImageMask | CloakMask | InvincibleMask |
|
||||
ShieldMask | SkinMask)))
|
||||
ThreadMask | ImageMask | CloakMask | SkinMask)))
|
||||
return retMask;
|
||||
|
||||
if (stream->writeFlag(mask & DamageMask)) {
|
||||
|
|
@ -3113,7 +2945,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if (stream->writeFlag(mask & ThreadMask)) {
|
||||
for (int i = 0; i < MaxScriptThreads; i++) {
|
||||
for (S32 i = 0; i < MaxScriptThreads; i++) {
|
||||
Thread& st = mScriptThread[i];
|
||||
if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) {
|
||||
stream->writeInt(st.sequence,ThreadSequenceBits);
|
||||
|
|
@ -3126,7 +2958,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if (stream->writeFlag(mask & SoundMask)) {
|
||||
for (int i = 0; i < MaxSoundThreads; i++) {
|
||||
for (S32 i = 0; i < MaxSoundThreads; i++) {
|
||||
Sound& st = mSoundThread[i];
|
||||
if (stream->writeFlag(mask & (SoundMaskN << i)))
|
||||
if (stream->writeFlag(st.play))
|
||||
|
|
@ -3136,7 +2968,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if (stream->writeFlag(mask & ImageMask)) {
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
if (stream->writeFlag(mask & (ImageMaskN << i))) {
|
||||
MountedImage& image = mMountedImageList[i];
|
||||
if (stream->writeFlag(image.dataBlock))
|
||||
|
|
@ -3158,9 +2990,9 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->writeFlag(image.triggerDown);
|
||||
stream->writeFlag(image.altTriggerDown);
|
||||
|
||||
for (U32 i=0; i<ShapeBaseImageData::MaxGenericTriggers; ++i)
|
||||
for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
|
||||
{
|
||||
stream->writeFlag(image.genericTrigger[i]);
|
||||
stream->writeFlag(image.genericTrigger[j]);
|
||||
}
|
||||
|
||||
stream->writeInt(image.fireCount,3);
|
||||
|
|
@ -3173,7 +3005,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
// Group some of the uncommon stuff together.
|
||||
if (stream->writeFlag(mask & (NameMask | ShieldMask | CloakMask | InvincibleMask | SkinMask | MeshHiddenMask ))) {
|
||||
if (stream->writeFlag(mask & (NameMask | CloakMask | SkinMask | MeshHiddenMask ))) {
|
||||
|
||||
if (stream->writeFlag(mask & CloakMask))
|
||||
{
|
||||
|
|
@ -3194,14 +3026,6 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
if (stream->writeFlag(mask & NameMask)) {
|
||||
con->packNetStringHandleU(stream, mShapeNameHandle);
|
||||
}
|
||||
if (stream->writeFlag(mask & ShieldMask)) {
|
||||
stream->writeNormalVector(mShieldNormal, ShieldNormalBits);
|
||||
stream->writeFloat( getEnergyValue(), EnergyLevelBits );
|
||||
}
|
||||
if (stream->writeFlag(mask & InvincibleMask)) {
|
||||
stream->write(mInvincibleTime);
|
||||
stream->write(mInvincibleSpeed);
|
||||
}
|
||||
|
||||
if ( stream->writeFlag( mask & MeshHiddenMask ) )
|
||||
stream->writeBits( mMeshHidden );
|
||||
|
|
@ -3271,7 +3095,7 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
// Mounted Images
|
||||
if (stream->readFlag()) {
|
||||
for (int i = 0; i < MaxMountedImages; i++) {
|
||||
for (S32 i = 0; i < MaxMountedImages; i++) {
|
||||
if (stream->readFlag()) {
|
||||
MountedImage& image = mMountedImageList[i];
|
||||
ShapeBaseImageData* imageData = 0;
|
||||
|
|
@ -3303,14 +3127,14 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
image.triggerDown = stream->readFlag();
|
||||
image.altTriggerDown = stream->readFlag();
|
||||
|
||||
for (U32 i=0; i<ShapeBaseImageData::MaxGenericTriggers; ++i)
|
||||
for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
|
||||
{
|
||||
image.genericTrigger[i] = stream->readFlag();
|
||||
image.genericTrigger[j] = stream->readFlag();
|
||||
}
|
||||
|
||||
int count = stream->readInt(3);
|
||||
int altCount = stream->readInt(3);
|
||||
int reloadCount = stream->readInt(3);
|
||||
S32 count = stream->readInt(3);
|
||||
S32 altCount = stream->readInt(3);
|
||||
S32 reloadCount = stream->readInt(3);
|
||||
|
||||
bool datablockChange = image.dataBlock != imageData;
|
||||
if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
|
||||
|
|
@ -3443,25 +3267,6 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
if (stream->readFlag()) { // NameMask
|
||||
mShapeNameHandle = con->unpackNetStringHandleU(stream);
|
||||
}
|
||||
if(stream->readFlag()) // ShieldMask
|
||||
{
|
||||
// Cloaking, Shield, and invul masking
|
||||
Point3F shieldNormal;
|
||||
stream->readNormalVector(&shieldNormal, ShieldNormalBits);
|
||||
|
||||
// CodeReview [bjg 4/6/07] This is our energy level - why aren't we storing it? Was in a
|
||||
// local variable called energyPercent.
|
||||
stream->readFloat(EnergyLevelBits);
|
||||
}
|
||||
|
||||
if (stream->readFlag())
|
||||
{
|
||||
// InvincibleMask
|
||||
F32 time, speed;
|
||||
stream->read(&time);
|
||||
stream->read(&speed);
|
||||
setupInvincibleEffect(time, speed);
|
||||
}
|
||||
|
||||
if ( stream->readFlag() ) // MeshHiddenMask
|
||||
{
|
||||
|
|
@ -3742,7 +3547,7 @@ void ShapeBase::reSkin()
|
|||
Vector<String> skins;
|
||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
||||
|
||||
for (int i = 0; i < skins.size(); i++)
|
||||
for (S32 i = 0; i < skins.size(); i++)
|
||||
{
|
||||
String oldSkin( mAppliedSkinName.c_str() );
|
||||
String newSkin( skins[i] );
|
||||
|
|
@ -4826,18 +4631,6 @@ DefineEngineMethod( ShapeBase, setCameraFov, void, ( F32 fov ),,
|
|||
object->setCameraFov( fov );
|
||||
}
|
||||
|
||||
DefineEngineMethod( ShapeBase, setInvincibleMode, void, ( F32 time, F32 speed ),,
|
||||
"@brief Setup the invincible effect.\n\n"
|
||||
|
||||
"This effect is used for HUD feedback to the user that they are invincible.\n"
|
||||
"@note Currently not implemented\n"
|
||||
|
||||
"@param time duration in seconds for the invincible effect\n"
|
||||
"@param speed speed at which the invincible effect progresses\n" )
|
||||
{
|
||||
object->setupInvincibleEffect( time, speed );
|
||||
}
|
||||
|
||||
DefineEngineMethod( ShapeBase, startFade, void, ( S32 time, S32 delay, bool fadeOut ),,
|
||||
"@brief Fade the object in or out without removing it from the scene.\n\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -689,7 +689,6 @@ public:
|
|||
MaxMountedImages = 4, ///< Should be a power of 2
|
||||
MaxImageEmitters = 3,
|
||||
NumImageBits = 3,
|
||||
ShieldNormalBits = 8,
|
||||
CollisionTimeoutValue = 250 ///< Timeout in ms.
|
||||
};
|
||||
|
||||
|
|
@ -743,17 +742,6 @@ protected:
|
|||
|
||||
/// @}
|
||||
|
||||
/// @name Invincibility
|
||||
/// @{
|
||||
F32 mInvincibleCount;
|
||||
F32 mInvincibleTime;
|
||||
F32 mInvincibleSpeed;
|
||||
F32 mInvincibleDelta;
|
||||
F32 mInvincibleEffect;
|
||||
F32 mInvincibleFade;
|
||||
bool mInvincibleOn;
|
||||
/// @}
|
||||
|
||||
/// @name Motion
|
||||
/// @{
|
||||
bool mMoveMotion; ///< Indicates that a Move has come in requesting x, y or z motion
|
||||
|
|
@ -918,9 +906,6 @@ protected:
|
|||
|
||||
bool mFlipFadeVal;
|
||||
|
||||
/// Last shield direction (cur. unused)
|
||||
Point3F mShieldNormal;
|
||||
|
||||
/// Camera shake caused by weapon fire.
|
||||
CameraShake *mWeaponCamShake;
|
||||
|
||||
|
|
@ -1156,11 +1141,9 @@ public:
|
|||
DamageMask = Parent::NextFreeMask << 1,
|
||||
NoWarpMask = Parent::NextFreeMask << 2,
|
||||
CloakMask = Parent::NextFreeMask << 3,
|
||||
ShieldMask = Parent::NextFreeMask << 4,
|
||||
InvincibleMask = Parent::NextFreeMask << 5,
|
||||
SkinMask = Parent::NextFreeMask << 6,
|
||||
MeshHiddenMask = Parent::NextFreeMask << 7,
|
||||
SoundMaskN = Parent::NextFreeMask << 8, ///< Extends + MaxSoundThreads bits
|
||||
SkinMask = Parent::NextFreeMask << 4,
|
||||
MeshHiddenMask = Parent::NextFreeMask << 5,
|
||||
SoundMaskN = Parent::NextFreeMask << 6, ///< Extends + MaxSoundThreads bits
|
||||
ThreadMaskN = SoundMaskN << MaxSoundThreads, ///< Extends + MaxScriptThreads bits
|
||||
ImageMaskN = ThreadMaskN << MaxScriptThreads, ///< Extends + MaxMountedImage bits
|
||||
NextFreeMask = ImageMaskN << MaxMountedImages
|
||||
|
|
@ -1702,26 +1685,6 @@ public:
|
|||
virtual void setWhiteOut(const F32);
|
||||
/// @}
|
||||
|
||||
/// @name Invincibility effect
|
||||
/// This is the screen effect when invincible in the HUD
|
||||
/// @see GameRenderFilters()
|
||||
/// @{
|
||||
|
||||
/// Returns the level of invincibility effect
|
||||
virtual F32 getInvincibleEffect() const;
|
||||
|
||||
/// Initializes invincibility effect and interpolation parameters
|
||||
///
|
||||
/// @param time Time it takes to become invincible
|
||||
/// @param speed Speed at which invincibility effects progress
|
||||
virtual void setupInvincibleEffect(F32 time, F32 speed);
|
||||
|
||||
/// Advance invincibility effect animation
|
||||
/// @param dt Time since last call of this function
|
||||
virtual void updateInvincibleEffect(F32 dt);
|
||||
|
||||
/// @}
|
||||
|
||||
/// @name Movement & velocity
|
||||
/// @{
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ ShapeBaseImageData::ShapeBaseImageData()
|
|||
scriptAnimTransitionTime = 0.25f;
|
||||
|
||||
//
|
||||
for (int i = 0; i < MaxStates; i++) {
|
||||
for (S32 i = 0; i < MaxStates; i++) {
|
||||
stateName[i] = 0;
|
||||
|
||||
stateTransitionLoaded[i] = 0;
|
||||
|
|
@ -462,7 +462,10 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
|
|||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(shape[i].getPath());
|
||||
|
||||
if (!fileRef)
|
||||
{
|
||||
errorStr = String::ToString("ShapeBaseImageData: Couldn't load shape \"%s\"",name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(server)
|
||||
{
|
||||
|
|
@ -3057,7 +3060,7 @@ TICKAGAIN:
|
|||
|
||||
if (image.spinThread[i])
|
||||
{
|
||||
float timeScale;
|
||||
F32 timeScale;
|
||||
|
||||
switch (stateData.spin)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ bool Trigger::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
|
|||
F32 const *si = &start.x;
|
||||
F32 const *ei = &end.x;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (S32 i = 0; i < 3; i++)
|
||||
{
|
||||
if (*si < *ei)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ void TSStatic::reSkin()
|
|||
Vector<String> skins;
|
||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
||||
|
||||
for (int i = 0; i < skins.size(); i++)
|
||||
for (S32 i = 0; i < skins.size(); i++)
|
||||
{
|
||||
String oldSkin( mAppliedSkinName.c_str() );
|
||||
String newSkin( skins[i] );
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ AITurretShapeData::AITurretShapeData()
|
|||
|
||||
weaponLeadVelocity = 0;
|
||||
|
||||
for (int i = 0; i < MaxStates; i++) {
|
||||
for (S32 i = 0; i < MaxStates; i++) {
|
||||
stateName[i] = 0;
|
||||
stateTransitionAtRest[i] = 0;
|
||||
stateTransitionNotAtRest[i] = 0;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const F32 sVehicleGravity = -20;
|
|||
|
||||
// Physics and collision constants
|
||||
static F32 sRestTol = 0.5; // % of gravity energy to be at rest
|
||||
static int sRestCount = 10; // Consecutive ticks before comming to rest
|
||||
static S32 sRestCount = 10; // Consecutive ticks before comming to rest
|
||||
|
||||
} // namespace {}
|
||||
|
||||
|
|
@ -218,6 +218,7 @@ bool VehicleData::preload(bool server, String &errorStr)
|
|||
if (!collisionDetails.size() || collisionDetails[0] == -1)
|
||||
{
|
||||
Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail");
|
||||
errorStr = String::ToString("VehicleData: Couldn't load shape \"%s\"",shapeName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -341,14 +342,14 @@ void VehicleData::packData(BitStream* stream)
|
|||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < VC_NUM_DAMAGE_EMITTER_AREAS; j++)
|
||||
for (S32 j = 0; j < VC_NUM_DAMAGE_EMITTER_AREAS; j++)
|
||||
{
|
||||
stream->write( damageEmitterOffset[j].x );
|
||||
stream->write( damageEmitterOffset[j].y );
|
||||
stream->write( damageEmitterOffset[j].z );
|
||||
}
|
||||
|
||||
for (int k = 0; k < VC_NUM_DAMAGE_LEVELS; k++)
|
||||
for (S32 k = 0; k < VC_NUM_DAMAGE_LEVELS; k++)
|
||||
{
|
||||
stream->write( damageLevelTolerance[k] );
|
||||
}
|
||||
|
|
@ -440,14 +441,14 @@ void VehicleData::unpackData(BitStream* stream)
|
|||
}
|
||||
}
|
||||
|
||||
for( int j=0; j<VC_NUM_DAMAGE_EMITTER_AREAS; j++ )
|
||||
for( S32 j=0; j<VC_NUM_DAMAGE_EMITTER_AREAS; j++ )
|
||||
{
|
||||
stream->read( &damageEmitterOffset[j].x );
|
||||
stream->read( &damageEmitterOffset[j].y );
|
||||
stream->read( &damageEmitterOffset[j].z );
|
||||
}
|
||||
|
||||
for( int k=0; k<VC_NUM_DAMAGE_LEVELS; k++ )
|
||||
for( S32 k=0; k<VC_NUM_DAMAGE_LEVELS; k++ )
|
||||
{
|
||||
stream->read( &damageLevelTolerance[k] );
|
||||
}
|
||||
|
|
@ -718,7 +719,7 @@ bool Vehicle::onAdd()
|
|||
{
|
||||
if( mDataBlock->dustEmitter )
|
||||
{
|
||||
for( int i=0; i<VehicleData::VC_NUM_DUST_EMITTERS; i++ )
|
||||
for( S32 i=0; i<VehicleData::VC_NUM_DUST_EMITTERS; i++ )
|
||||
{
|
||||
mDustEmitterList[i] = new ParticleEmitter;
|
||||
mDustEmitterList[i]->onNewDataBlock( mDataBlock->dustEmitter, false );
|
||||
|
|
@ -1804,7 +1805,7 @@ void Vehicle::updateDamageSmoke( F32 dt )
|
|||
F32 damagePercent = mDamage / mDataBlock->maxDamage;
|
||||
if( damagePercent >= mDataBlock->damageLevelTolerance[j] )
|
||||
{
|
||||
for( int i=0; i<mDataBlock->numDmgEmitterAreas; i++ )
|
||||
for( S32 i=0; i<mDataBlock->numDmgEmitterAreas; i++ )
|
||||
{
|
||||
MatrixF trans = getTransform();
|
||||
Point3F offset = mDataBlock->damageEmitterOffset[i];
|
||||
|
|
@ -1935,7 +1936,7 @@ void Vehicle::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState *st
|
|||
GFX->getDrawUtil()->drawCube(desc, Point3F(0.1f,0.1f,0.1f),mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld);
|
||||
|
||||
// Now render all the contact points.
|
||||
for (int i = 0; i < mCollisionList.getCount(); i++)
|
||||
for (S32 i = 0; i < mCollisionList.getCount(); i++)
|
||||
{
|
||||
const Collision& collision = mCollisionList[i];
|
||||
GFX->getDrawUtil()->drawCube(desc, Point3F(0.05f,0.05f,0.05f),collision.point, ColorI(0, 0, 255));
|
||||
|
|
@ -1943,7 +1944,7 @@ void Vehicle::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState *st
|
|||
|
||||
// Finally render the normals as one big batch.
|
||||
PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2);
|
||||
for (int i = 0; i < mCollisionList.getCount(); i++)
|
||||
for (S32 i = 0; i < mCollisionList.getCount(); i++)
|
||||
{
|
||||
const Collision& collision = mCollisionList[i];
|
||||
PrimBuild::color3f(1, 1, 1);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class Vehicle: public ShapeBase
|
|||
CollisionList mContacts;
|
||||
Rigid mRigid;
|
||||
ShapeBaseConvex mConvex;
|
||||
int restCount;
|
||||
S32 restCount;
|
||||
|
||||
SimObjectPtr<ParticleEmitter> mDustEmitterList[VehicleData::VC_NUM_DUST_EMITTERS];
|
||||
SimObjectPtr<ParticleEmitter> mDamageEmitterList[VehicleData::VC_NUM_DAMAGE_EMITTERS];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue