whitespace updates

This commit is contained in:
Thomas "elfprince13" Dickerson 2017-01-06 23:04:49 -05:00
parent dc73228ccf
commit ce51070fc4
16 changed files with 421 additions and 421 deletions

View file

@ -1351,7 +1351,7 @@ void Camera::consoleInit()
// ExtendedMove support // ExtendedMove support
Con::addVariable("$camera::extendedMovePosRotIndex", TypeS32, &smExtendedMovePosRotIndex, Con::addVariable("$camera::extendedMovePosRotIndex", TypeS32, &smExtendedMovePosRotIndex,
"@brief The ExtendedMove position/rotation index used for camera movements.\n\n" "@brief The ExtendedMove position/rotation index used for camera movements.\n\n"
"@ingroup BaseCamera\n"); "@ingroup BaseCamera\n");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -546,7 +546,7 @@ void DecalManager::removeDecal( DecalInstance *inst )
// Remove the decal from the instance vector. // Remove the decal from the instance vector.
if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() ) if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() )
mDecalInstanceVec[ inst->mId ] = NULL; mDecalInstanceVec[ inst->mId ] = NULL;
// Release its geometry (if it has any). // Release its geometry (if it has any).
@ -674,23 +674,23 @@ DecalInstance* DecalManager::raycast( const Point3F &start, const Point3F &end,
if ( !worldSphere.intersectsRay( start, end ) ) if ( !worldSphere.intersectsRay( start, end ) )
continue; continue;
RayInfo ri; RayInfo ri;
bool containsPoint = false; bool containsPoint = false;
if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) ) if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
{ {
Point2F poly[4]; Point2F poly[4];
poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2));
poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2));
poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) ) if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) )
containsPoint = true; containsPoint = true;
} }
if( !containsPoint ) if( !containsPoint )
continue; continue;
hitDecals.push_back( inst ); hitDecals.push_back( inst );
} }
@ -1406,7 +1406,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
query.init( rootFrustum.getPosition(), query.init( rootFrustum.getPosition(),
rootFrustum.getTransform().getForwardVector(), rootFrustum.getTransform().getForwardVector(),
rootFrustum.getFarDist() ); rootFrustum.getFarDist() );
query.getLights( baseRenderInst.lights, 8 ); query.getLights( baseRenderInst.lights, 8 );
} }
// Submit render inst... // Submit render inst...
@ -1575,7 +1575,7 @@ void DecalManager::clearData()
} }
mData = NULL; mData = NULL;
mDecalInstanceVec.clear(); mDecalInstanceVec.clear();
_freePools(); _freePools();
} }
@ -1758,7 +1758,7 @@ DefineEngineFunction( decalManagerEditDecal, bool, ( S32 decalID, Point3F pos, P
{ {
DecalInstance *decalInstance = gDecalManager->getDecal( decalID ); DecalInstance *decalInstance = gDecalManager->getDecal( decalID );
if( !decalInstance ) if( !decalInstance )
return false; return false;
//Internally we need Point3F tangent instead of the user friendly F32 rotAroundNormal //Internally we need Point3F tangent instead of the user friendly F32 rotAroundNormal
MatrixF mat( true ); MatrixF mat( true );

View file

@ -76,7 +76,7 @@ bool BtBody::init( PhysicsCollision *shape,
AssertFatal( shape, "BtBody::init - Got a null collision shape!" ); AssertFatal( shape, "BtBody::init - Got a null collision shape!" );
AssertFatal( dynamic_cast<BtCollision*>( shape ), "BtBody::init - The collision shape is the wrong type!" ); AssertFatal( dynamic_cast<BtCollision*>( shape ), "BtBody::init - The collision shape is the wrong type!" );
AssertFatal( ((BtCollision*)shape)->getShape(), "BtBody::init - Got empty collision shape!" ); AssertFatal( ((BtCollision*)shape)->getShape(), "BtBody::init - Got empty collision shape!" );
// Cleanup any previous actor. // Cleanup any previous actor.
_releaseActor(); _releaseActor();
@ -97,20 +97,20 @@ bool BtBody::init( PhysicsCollision *shape,
btScalar *masses = new btScalar[ btCompound->getNumChildShapes() ]; btScalar *masses = new btScalar[ btCompound->getNumChildShapes() ];
for ( U32 j=0; j < btCompound->getNumChildShapes(); j++ ) for ( U32 j=0; j < btCompound->getNumChildShapes(); j++ )
masses[j] = mass / btCompound->getNumChildShapes(); masses[j] = mass / btCompound->getNumChildShapes();
btVector3 principalInertia; btVector3 principalInertia;
btTransform principal; btTransform principal;
btCompound->calculatePrincipalAxisTransform( masses, principal, principalInertia ); btCompound->calculatePrincipalAxisTransform( masses, principal, principalInertia );
delete [] masses; delete [] masses;
// Create a new compound with the shifted children. // Create a new compound with the shifted children.
btColShape = mCompound = new btCompoundShape(); btColShape = mCompound = new btCompoundShape();
for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ ) for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ )
{ {
btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i); btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i);
mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) ); mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) );
} }
localXfm = btCast<MatrixF>( principal ); localXfm = btCast<MatrixF>( principal );
} }

View file

@ -53,7 +53,7 @@ bool BtWorld::initWorld( bool isServer, ProcessList *processList )
{ {
// Collision configuration contains default setup for memory, collision setup. // Collision configuration contains default setup for memory, collision setup.
mCollisionConfiguration = new btDefaultCollisionConfiguration(); mCollisionConfiguration = new btDefaultCollisionConfiguration();
mDispatcher = new btCollisionDispatcher( mCollisionConfiguration ); mDispatcher = new btCollisionDispatcher( mCollisionConfiguration );
btVector3 worldMin( -2000, -2000, -1000 ); btVector3 worldMin( -2000, -2000, -1000 );
btVector3 worldMax( 2000, 2000, 1000 ); btVector3 worldMax( 2000, 2000, 1000 );

View file

@ -242,7 +242,7 @@ void PhysicsShapeData::onRemove()
void PhysicsShapeData::_onResourceChanged( const Torque::Path &path ) void PhysicsShapeData::_onResourceChanged( const Torque::Path &path )
{ {
if ( path != Path( shapeName ) ) if ( path != Path( shapeName ) )
return; return;
// Reload the changed shape. // Reload the changed shape.
@ -360,8 +360,8 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer )
Vector<FConvexResult*> mHulls; Vector<FConvexResult*> mHulls;
}; };
DecompDesc d; DecompDesc d;
d.mVcount = polyList.mVertexList.size(); d.mVcount = polyList.mVertexList.size();
d.mVertices = doubleVerts.address(); d.mVertices = doubleVerts.address();
d.mTcount = polyList.mIndexList.size() / 3; d.mTcount = polyList.mIndexList.size() / 3;
d.mIndices = polyList.mIndexList.address(); d.mIndices = polyList.mIndexList.address();
@ -659,7 +659,7 @@ void PhysicsShape::onRemove()
PhysicsPlugin::getPhysicsResetSignal().remove( this, &PhysicsShape::_onPhysicsReset ); PhysicsPlugin::getPhysicsResetSignal().remove( this, &PhysicsShape::_onPhysicsReset );
if ( mDestroyedShape ) if ( mDestroyedShape )
mDestroyedShape->deleteObject(); mDestroyedShape->deleteObject();
} }
// Remove the resource change signal. // Remove the resource change signal.

View file

@ -80,7 +80,7 @@ bool Px3Body::init( PhysicsCollision *shape,
AssertFatal( shape, "Px3Body::init - Got a null collision shape!" ); AssertFatal( shape, "Px3Body::init - Got a null collision shape!" );
AssertFatal( dynamic_cast<Px3Collision*>( shape ), "Px3Body::init - The collision shape is the wrong type!" ); AssertFatal( dynamic_cast<Px3Collision*>( shape ), "Px3Body::init - The collision shape is the wrong type!" );
AssertFatal( !((Px3Collision*)shape)->getShapes().empty(), "Px3Body::init - Got empty collision shape!" ); AssertFatal( !((Px3Collision*)shape)->getShapes().empty(), "Px3Body::init - Got empty collision shape!" );
// Cleanup any previous actor. // Cleanup any previous actor.
_releaseActor(); _releaseActor();
@ -94,10 +94,10 @@ bool Px3Body::init( PhysicsCollision *shape,
if ( isKinematic ) if ( isKinematic )
{ {
mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY()));
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true); actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true);
actor->setMass(getMax( mass, 1.0f )); actor->setMass(getMax( mass, 1.0f ));
} }
else if ( mass > 0.0f ) else if ( mass > 0.0f )
{ {
@ -107,7 +107,7 @@ bool Px3Body::init( PhysicsCollision *shape,
{ {
mActor = gPhysics3SDK->createRigidStatic(physx::PxTransform(physx::PxIDENTITY())); mActor = gPhysics3SDK->createRigidStatic(physx::PxTransform(physx::PxIDENTITY()));
mIsStatic = true; mIsStatic = true;
} }
mMaterial = gPhysics3SDK->createMaterial(0.6f,0.4f,0.1f); mMaterial = gPhysics3SDK->createMaterial(0.6f,0.4f,0.1f);
@ -115,22 +115,22 @@ bool Px3Body::init( PhysicsCollision *shape,
const Vector<Px3CollisionDesc*> &shapes = mColShape->getShapes(); const Vector<Px3CollisionDesc*> &shapes = mColShape->getShapes();
for ( U32 i=0; i < shapes.size(); i++ ) for ( U32 i=0; i < shapes.size(); i++ )
{ {
Px3CollisionDesc* desc = shapes[i]; Px3CollisionDesc* desc = shapes[i];
if( mass > 0.0f ) if( mass > 0.0f )
{ {
if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH) if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH)
{ {
Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported.");
} }
} }
physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial); physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial);
physx::PxFilterData colData; physx::PxFilterData colData;
if(isDebris) if(isDebris)
colData.word0 = PX3_DEBRIS; colData.word0 = PX3_DEBRIS;
else if(isTrigger) else if(isTrigger)
colData.word0 = PX3_TRIGGER; colData.word0 = PX3_TRIGGER;
else else
colData.word0 = PX3_DEFAULT; colData.word0 = PX3_DEFAULT;
//set local pose - actor->createShape with a local pose is deprecated in physx 3.3 //set local pose - actor->createShape with a local pose is deprecated in physx 3.3
pShape->setLocalPose(desc->pose); pShape->setLocalPose(desc->pose);
@ -145,8 +145,8 @@ bool Px3Body::init( PhysicsCollision *shape,
//mass & intertia has to be set after creating the shape //mass & intertia has to be set after creating the shape
if ( mass > 0.0f ) if ( mass > 0.0f )
{ {
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass);
} }
// This sucks, but it has to happen if we want // This sucks, but it has to happen if we want
@ -178,9 +178,9 @@ void Px3Body::setMaterial( F32 restitution,
actor->wakeUp(); actor->wakeUp();
} }
mMaterial->setRestitution(restitution); mMaterial->setRestitution(restitution);
mMaterial->setStaticFriction(staticFriction); mMaterial->setStaticFriction(staticFriction);
mMaterial->setDynamicFriction(friction); mMaterial->setDynamicFriction(friction);
} }
@ -189,7 +189,7 @@ void Px3Body::setSleepThreshold( F32 linear, F32 angular )
AssertFatal( mActor, "Px3Body::setSleepThreshold - The actor is null!" ); AssertFatal( mActor, "Px3Body::setSleepThreshold - The actor is null!" );
if(mIsStatic) if(mIsStatic)
return; return;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxF32 massNormalized= (linear*linear+angular*angular)/2.0f; physx::PxF32 massNormalized= (linear*linear+angular*angular)/2.0f;
@ -200,7 +200,7 @@ void Px3Body::setDamping( F32 linear, F32 angular )
{ {
AssertFatal( mActor, "Px3Body::setDamping - The actor is null!" ); AssertFatal( mActor, "Px3Body::setDamping - The actor is null!" );
if(mIsStatic) if(mIsStatic)
return; return;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setLinearDamping( linear ); actor->setLinearDamping( linear );
@ -227,7 +227,7 @@ F32 Px3Body::getMass() const
{ {
AssertFatal( mActor, "PxBody::getCMassPosition - The actor is null!" ); AssertFatal( mActor, "PxBody::getCMassPosition - The actor is null!" );
if(mIsStatic) if(mIsStatic)
return 0; return 0;
const physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); const physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
return actor->getMass(); return actor->getMass();
@ -237,7 +237,7 @@ Point3F Px3Body::getCMassPosition() const
{ {
AssertFatal( mActor, "Px3Body::getCMassPosition - The actor is null!" ); AssertFatal( mActor, "Px3Body::getCMassPosition - The actor is null!" );
if(mIsStatic) if(mIsStatic)
return px3Cast<Point3F>(mActor->getGlobalPose().p); return px3Cast<Point3F>(mActor->getGlobalPose().p);
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxTransform pose = actor->getGlobalPose() * actor->getCMassLocalPose(); physx::PxTransform pose = actor->getGlobalPose() * actor->getCMassLocalPose();
@ -326,11 +326,11 @@ Box3F Px3Body::getWorldBounds()
U32 shapeCount = mActor->getNbShapes(); U32 shapeCount = mActor->getNbShapes();
physx::PxShape **shapes = new physx::PxShape*[shapeCount]; physx::PxShape **shapes = new physx::PxShape*[shapeCount];
mActor->getShapes(shapes, shapeCount); mActor->getShapes(shapes, shapeCount);
for ( U32 i = 0; i < shapeCount; i++ ) for ( U32 i = 0; i < shapeCount; i++ )
{ {
// Get the shape's bounds. // Get the shape's bounds.
shapeBounds = physx::PxShapeExt::getWorldBounds(*shapes[i],*mActor); shapeBounds = physx::PxShapeExt::getWorldBounds(*shapes[i],*mActor);
// Combine them into the total bounds. // Combine them into the total bounds.
bounds.include( shapeBounds ); bounds.include( shapeBounds );
@ -355,11 +355,11 @@ void Px3Body::setSimulationEnabled( bool enabled )
mWorld->releaseWriteLock(); mWorld->releaseWriteLock();
U32 shapeCount = mActor->getNbShapes(); U32 shapeCount = mActor->getNbShapes();
physx::PxShape **shapes = new physx::PxShape*[shapeCount]; physx::PxShape **shapes = new physx::PxShape*[shapeCount];
mActor->getShapes(shapes, shapeCount); mActor->getShapes(shapes, shapeCount);
for ( S32 i = 0; i < mActor->getNbShapes(); i++ ) for ( S32 i = 0; i < mActor->getNbShapes(); i++ )
{ {
shapes[i]->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,!mIsEnabled);//????? shapes[i]->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,!mIsEnabled);//?????
} }
delete [] shapes; delete [] shapes;
@ -377,10 +377,10 @@ void Px3Body::setTransform( const MatrixF &transform )
mActor->setGlobalPose(px3Cast<physx::PxTransform>(transform),false); mActor->setGlobalPose(px3Cast<physx::PxTransform>(transform),false);
if(mIsStatic) if(mIsStatic)
return; return;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC;
// If its dynamic we have more to do. // If its dynamic we have more to do.
if ( isDynamic() && !kinematic ) if ( isDynamic() && !kinematic )
{ {
@ -412,8 +412,8 @@ void Px3Body::applyImpulse( const Point3F &origin, const Point3F &force )
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
if ( mIsEnabled && isDynamic() ) if ( mIsEnabled && isDynamic() )
physx::PxRigidBodyExt::addForceAtPos(*actor,px3Cast<physx::PxVec3>(force), physx::PxRigidBodyExt::addForceAtPos(*actor,px3Cast<physx::PxVec3>(force),
px3Cast<physx::PxVec3>(origin), px3Cast<physx::PxVec3>(origin),
physx::PxForceMode::eIMPULSE); physx::PxForceMode::eIMPULSE);
} }

View file

@ -41,9 +41,9 @@ class Px3Collision;
struct Px3CollisionDesc; struct Px3CollisionDesc;
namespace physx{ namespace physx{
class PxRigidActor; class PxRigidActor;
class PxMaterial; class PxMaterial;
class PxShape; class PxShape;
} }

View file

@ -71,113 +71,113 @@ Px3World::~Px3World()
physx::PxCooking *Px3World::getCooking() physx::PxCooking *Px3World::getCooking()
{ {
return smCooking; return smCooking;
} }
bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *serverWorld) bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *serverWorld)
{ {
// If either the client or the server still exist // If either the client or the server still exist
// then we cannot reset the SDK. // then we cannot reset the SDK.
if ( clientWorld || serverWorld ) if ( clientWorld || serverWorld )
return false; return false;
if(smPvdConnection) if(smPvdConnection)
smPvdConnection->release(); smPvdConnection->release();
if(smCooking) if(smCooking)
smCooking->release(); smCooking->release();
if(smCpuDispatcher) if(smCpuDispatcher)
smCpuDispatcher->release(); smCpuDispatcher->release();
// Destroy the existing SDK. // Destroy the existing SDK.
if ( gPhysics3SDK ) if ( gPhysics3SDK )
{ {
PxCloseExtensions(); PxCloseExtensions();
gPhysics3SDK->release(); gPhysics3SDK->release();
} }
if(smErrorCallback) if(smErrorCallback)
{ {
SAFE_DELETE(smErrorCallback); SAFE_DELETE(smErrorCallback);
} }
if(smFoundation) if(smFoundation)
{ {
smFoundation->release(); smFoundation->release();
SAFE_DELETE(smErrorCallback); SAFE_DELETE(smErrorCallback);
} }
// If we're not supposed to restart... return. // If we're not supposed to restart... return.
if ( destroyOnly ) if ( destroyOnly )
return true; return true;
bool memTrack = false; bool memTrack = false;
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
memTrack = true; memTrack = true;
#endif #endif
smErrorCallback = new Px3ConsoleStream; smErrorCallback = new Px3ConsoleStream;
smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback); smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback);
smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation); smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation);
gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager); gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager);
if ( !gPhysics3SDK ) if ( !gPhysics3SDK )
{ {
Con::errorf( "PhysX3 failed to initialize!" ); Con::errorf( "PhysX3 failed to initialize!" );
Platform::messageBox( Con::getVariable( "$appName" ), Platform::messageBox( Con::getVariable( "$appName" ),
avar("PhysX3 could not be started!\r\n"), avar("PhysX3 could not be started!\r\n"),
MBOk, MIStop ); MBOk, MIStop );
Platform::forceShutdown( -1 ); Platform::forceShutdown( -1 );
// We shouldn't get here, but this shuts up // We shouldn't get here, but this shuts up
// source diagnostic tools. // source diagnostic tools.
return false; return false;
} }
if(!PxInitExtensions(*gPhysics3SDK)) if(!PxInitExtensions(*gPhysics3SDK))
{ {
Con::errorf( "PhysX3 failed to initialize extensions!" ); Con::errorf( "PhysX3 failed to initialize extensions!" );
Platform::messageBox( Con::getVariable( "$appName" ), Platform::messageBox( Con::getVariable( "$appName" ),
avar("PhysX3 could not be started!\r\n"), avar("PhysX3 could not be started!\r\n"),
MBOk, MIStop ); MBOk, MIStop );
Platform::forceShutdown( -1 ); Platform::forceShutdown( -1 );
return false; return false;
} }
smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale())); smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale()));
if(!smCooking) if(!smCooking)
{ {
Con::errorf( "PhysX3 failed to initialize cooking!" ); Con::errorf( "PhysX3 failed to initialize cooking!" );
Platform::messageBox( Con::getVariable( "$appName" ), Platform::messageBox( Con::getVariable( "$appName" ),
avar("PhysX3 could not be started!\r\n"), avar("PhysX3 could not be started!\r\n"),
MBOk, MIStop ); MBOk, MIStop );
Platform::forceShutdown( -1 ); Platform::forceShutdown( -1 );
return false; return false;
} }
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags()); physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags());
smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(), smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(),
"localhost", 5425, 100, connectionFlags); "localhost", 5425, 100, connectionFlags);
#endif #endif
return true; return true;
} }
void Px3World::destroyWorld() void Px3World::destroyWorld()
{ {
getPhysicsResults(); getPhysicsResults();
mRenderBuffer = NULL; mRenderBuffer = NULL;
// Release the tick processing signals. // Release the tick processing signals.
if ( mProcessList ) if ( mProcessList )
{ {
mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults ); mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults );
mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics ); mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics );
mProcessList = NULL; mProcessList = NULL;
} }
if(mControllerManager) if(mControllerManager)
{ {
@ -185,13 +185,13 @@ void Px3World::destroyWorld()
mControllerManager = NULL; mControllerManager = NULL;
} }
// Destroy the scene. // Destroy the scene.
if ( mScene ) if ( mScene )
{ {
// Release the scene. // Release the scene.
mScene->release(); mScene->release();
mScene = NULL; mScene = NULL;
} }
} }
bool Px3World::initWorld( bool isServer, ProcessList *processList ) bool Px3World::initWorld( bool isServer, ProcessList *processList )
@ -203,7 +203,7 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList )
} }
mIsServer = isServer; mIsServer = isServer;
physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale()); physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale());
sceneDesc.gravity = px3Cast<physx::PxVec3>(mGravity); sceneDesc.gravity = px3Cast<physx::PxVec3>(mGravity);
@ -217,26 +217,26 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList )
sceneDesc.cpuDispatcher = smCpuDispatcher; sceneDesc.cpuDispatcher = smCpuDispatcher;
Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount()); Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount());
} }
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD; sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS; sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader; sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader;
mScene = gPhysics3SDK->createScene(sceneDesc); mScene = gPhysics3SDK->createScene(sceneDesc);
//cache renderbuffer for use with debug drawing //cache renderbuffer for use with debug drawing
mRenderBuffer = const_cast<physx::PxRenderBuffer*>(&mScene->getRenderBuffer()); mRenderBuffer = const_cast<physx::PxRenderBuffer*>(&mScene->getRenderBuffer());
physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f ); physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f );
mScene->setDominanceGroupPair(0,31,debrisDominance); mScene->setDominanceGroupPair(0,31,debrisDominance);
mControllerManager = PxCreateControllerManager(*mScene); mControllerManager = PxCreateControllerManager(*mScene);
AssertFatal( processList, "Px3World::init() - We need a process list to create the world!" ); AssertFatal( processList, "Px3World::init() - We need a process list to create the world!" );
mProcessList = processList; mProcessList = processList;
mProcessList->preTickSignal().notify( this, &Px3World::getPhysicsResults ); mProcessList->preTickSignal().notify( this, &Px3World::getPhysicsResults );
mProcessList->postTickSignal().notify( this, &Px3World::tickPhysics, 1000.0f ); mProcessList->postTickSignal().notify( this, &Px3World::tickPhysics, 1000.0f );
return true; return true;
} }
// Most of this borrowed from bullet physics library, see btDiscreteDynamicsWorld.cpp // Most of this borrowed from bullet physics library, see btDiscreteDynamicsWorld.cpp
bool Px3World::_simulate(const F32 dt) bool Px3World::_simulate(const F32 dt)
@ -249,21 +249,21 @@ bool Px3World::_simulate(const F32 dt)
numSimulationSubSteps = S32(mAccumulator / smPhysicsStepTime); numSimulationSubSteps = S32(mAccumulator / smPhysicsStepTime);
mAccumulator -= numSimulationSubSteps * smPhysicsStepTime; mAccumulator -= numSimulationSubSteps * smPhysicsStepTime;
} }
if (numSimulationSubSteps) if (numSimulationSubSteps)
{ {
//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps; S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps;
for (S32 i=0;i<clampedSimulationSteps;i++) for (S32 i=0;i<clampedSimulationSteps;i++)
{ {
mScene->fetchResults(true); mScene->fetchResults(true);
mScene->simulate(smPhysicsStepTime); mScene->simulate(smPhysicsStepTime);
} }
} }
mIsSimulating = true; mIsSimulating = true;
return true; return true;
} }
void Px3World::tickPhysics( U32 elapsedMs ) void Px3World::tickPhysics( U32 elapsedMs )
@ -290,45 +290,45 @@ void Px3World::tickPhysics( U32 elapsedMs )
void Px3World::getPhysicsResults() void Px3World::getPhysicsResults()
{ {
if ( !mScene || !mIsSimulating ) if ( !mScene || !mIsSimulating )
return; return;
PROFILE_SCOPE(Px3World_GetPhysicsResults); PROFILE_SCOPE(Px3World_GetPhysicsResults);
// Get results from scene. // Get results from scene.
mScene->fetchResults(true); mScene->fetchResults(true);
mIsSimulating = false; mIsSimulating = false;
mTickCount++; mTickCount++;
// Con::printf( "%s PhysXWorld::getPhysicsResults!", this == smClientWorld ? "Client" : "Server" ); // Con::printf( "%s PhysXWorld::getPhysicsResults!", this == smClientWorld ? "Client" : "Server" );
} }
void Px3World::releaseWriteLocks() void Px3World::releaseWriteLocks()
{ {
Px3World *world = dynamic_cast<Px3World*>( PHYSICSMGR->getWorld( "server" ) ); Px3World *world = dynamic_cast<Px3World*>( PHYSICSMGR->getWorld( "server" ) );
if ( world ) if ( world )
world->releaseWriteLock(); world->releaseWriteLock();
world = dynamic_cast<Px3World*>( PHYSICSMGR->getWorld( "client" ) ); world = dynamic_cast<Px3World*>( PHYSICSMGR->getWorld( "client" ) );
if ( world ) if ( world )
world->releaseWriteLock(); world->releaseWriteLock();
} }
void Px3World::releaseWriteLock() void Px3World::releaseWriteLock()
{ {
if ( !mScene || !mIsSimulating ) if ( !mScene || !mIsSimulating )
return; return;
PROFILE_SCOPE(PxWorld_ReleaseWriteLock); PROFILE_SCOPE(PxWorld_ReleaseWriteLock);
// We use checkResults here to release the write lock // We use checkResults here to release the write lock
// but we do not change the simulation flag or increment // but we do not change the simulation flag or increment
// the tick count... we may have gotten results, but the // the tick count... we may have gotten results, but the
// simulation hasn't really ticked! // simulation hasn't really ticked!
mScene->checkResults( true ); mScene->checkResults( true );
//AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" ); //AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" );
} }
void Px3World::lockScenes() void Px3World::lockScenes()
@ -390,7 +390,7 @@ void Px3World::unlockScene()
bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ) bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse )
{ {
physx::PxVec3 orig = px3Cast<physx::PxVec3>( startPnt ); physx::PxVec3 orig = px3Cast<physx::PxVec3>( startPnt );
physx::PxVec3 dir = px3Cast<physx::PxVec3>( endPnt - startPnt ); physx::PxVec3 dir = px3Cast<physx::PxVec3>( endPnt - startPnt );
physx::PxF32 maxDist = dir.magnitude(); physx::PxF32 maxDist = dir.magnitude();
dir.normalize(); dir.normalize();
@ -404,11 +404,11 @@ bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo
physx::PxRaycastBuffer buf; physx::PxRaycastBuffer buf;
if(!mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData)) if(!mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData))
return false; return false;
if(!buf.hasBlock) if(!buf.hasBlock)
return false; return false;
const physx::PxRaycastHit hit = buf.block; const physx::PxRaycastHit hit = buf.block;
physx::PxRigidActor *actor = hit.actor; physx::PxRigidActor *actor = hit.actor;
PhysicsUserData *userData = PhysicsUserData::cast( actor->userData ); PhysicsUserData *userData = PhysicsUserData::cast( actor->userData );
@ -456,15 +456,15 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo
physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL); physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL);
physx::PxQueryFilterData filterData; physx::PxQueryFilterData filterData;
if(bodyTypes & BT_Static) if(bodyTypes & BT_Static)
filterData.flags |= physx::PxQueryFlag::eSTATIC; filterData.flags |= physx::PxQueryFlag::eSTATIC;
if(bodyTypes & BT_Dynamic) if(bodyTypes & BT_Dynamic)
filterData.flags |= physx::PxQueryFlag::eDYNAMIC; filterData.flags |= physx::PxQueryFlag::eDYNAMIC;
filterData.data.word0 = groups; filterData.data.word0 = groups;
physx::PxRaycastBuffer buf; physx::PxRaycastBuffer buf;
if( !mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData) ) if( !mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData) )
return NULL; return NULL;
if(!buf.hasBlock) if(!buf.hasBlock)
return NULL; return NULL;
@ -478,7 +478,7 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo
void Px3World::explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ) void Px3World::explosion( const Point3F &pos, F32 radius, F32 forceMagnitude )
{ {
physx::PxVec3 nxPos = px3Cast<physx::PxVec3>( pos ); physx::PxVec3 nxPos = px3Cast<physx::PxVec3>( pos );
const physx::PxU32 bufferSize = 10; const physx::PxU32 bufferSize = 10;
physx::PxSphereGeometry worldSphere(radius); physx::PxSphereGeometry worldSphere(radius);
physx::PxTransform pose(nxPos); physx::PxTransform pose(nxPos);
@ -520,14 +520,14 @@ void Px3World::setEnabled( bool enabled )
physx::PxController* Px3World::createController( physx::PxControllerDesc &desc ) physx::PxController* Px3World::createController( physx::PxControllerDesc &desc )
{ {
if ( !mScene ) if ( !mScene )
return NULL; return NULL;
// We need the writelock! // We need the writelock!
releaseWriteLock(); releaseWriteLock();
physx::PxController* pController = mControllerManager->createController(desc); physx::PxController* pController = mControllerManager->createController(desc);
AssertFatal( pController, "Px3World::createController - Got a null!" ); AssertFatal( pController, "Px3World::createController - Got a null!" );
return pController; return pController;
} }
static ColorI getDebugColor( physx::PxU32 packed ) static ColorI getDebugColor( physx::PxU32 packed )

View file

@ -42,66 +42,66 @@ class FixedStepper;
enum Px3CollisionGroup enum Px3CollisionGroup
{ {
PX3_DEFAULT = BIT(0), PX3_DEFAULT = BIT(0),
PX3_PLAYER = BIT(1), PX3_PLAYER = BIT(1),
PX3_DEBRIS = BIT(2), PX3_DEBRIS = BIT(2),
PX3_TRIGGER = BIT(3), PX3_TRIGGER = BIT(3),
}; };
class Px3World : public PhysicsWorld class Px3World : public PhysicsWorld
{ {
protected: protected:
physx::PxScene* mScene; physx::PxScene* mScene;
bool mIsEnabled; bool mIsEnabled;
bool mIsSimulating; bool mIsSimulating;
bool mIsServer; bool mIsServer;
bool mIsSceneLocked; bool mIsSceneLocked;
U32 mTickCount; U32 mTickCount;
ProcessList *mProcessList; ProcessList *mProcessList;
F32 mEditorTimeScale; F32 mEditorTimeScale;
bool mErrorReport; bool mErrorReport;
physx::PxRenderBuffer *mRenderBuffer; physx::PxRenderBuffer *mRenderBuffer;
physx::PxControllerManager* mControllerManager; physx::PxControllerManager* mControllerManager;
static Px3ConsoleStream *smErrorCallback; static Px3ConsoleStream *smErrorCallback;
static physx::PxDefaultAllocator smMemoryAlloc; static physx::PxDefaultAllocator smMemoryAlloc;
static physx::PxFoundation* smFoundation; static physx::PxFoundation* smFoundation;
static physx::PxCooking *smCooking; static physx::PxCooking *smCooking;
static physx::PxProfileZoneManager* smProfileZoneManager; static physx::PxProfileZoneManager* smProfileZoneManager;
static physx::PxDefaultCpuDispatcher* smCpuDispatcher; static physx::PxDefaultCpuDispatcher* smCpuDispatcher;
static physx::PxVisualDebuggerConnection* smPvdConnection; static physx::PxVisualDebuggerConnection* smPvdConnection;
F32 mAccumulator; F32 mAccumulator;
bool _simulate(const F32 dt); bool _simulate(const F32 dt);
public: public:
Px3World(); Px3World();
virtual ~Px3World(); virtual ~Px3World();
virtual bool initWorld( bool isServer, ProcessList *processList ); virtual bool initWorld( bool isServer, ProcessList *processList );
virtual void destroyWorld(); virtual void destroyWorld();
virtual void onDebugDraw( const SceneRenderState *state ); virtual void onDebugDraw( const SceneRenderState *state );
virtual void reset() {} virtual void reset() {}
virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse );
virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All );
virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude );
virtual bool isEnabled() const { return mIsEnabled; } virtual bool isEnabled() const { return mIsEnabled; }
physx::PxScene* getScene(){ return mScene;} physx::PxScene* getScene(){ return mScene;}
void setEnabled( bool enabled ); void setEnabled( bool enabled );
U32 getTick() { return mTickCount; } U32 getTick() { return mTickCount; }
void tickPhysics( U32 elapsedMs ); void tickPhysics( U32 elapsedMs );
void getPhysicsResults(); void getPhysicsResults();
void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; }
const F32 getEditorTimeScale() const { return mEditorTimeScale; } const F32 getEditorTimeScale() const { return mEditorTimeScale; }
void releaseWriteLock(); void releaseWriteLock();
bool isServer(){return mIsServer;} bool isServer(){return mIsServer;}
physx::PxController* createController( physx::PxControllerDesc &desc ); physx::PxController* createController( physx::PxControllerDesc &desc );
void lockScene(); void lockScene();
void unlockScene(); void unlockScene();
//static //static
static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL );
static void releaseWriteLocks(); static void releaseWriteLocks();
static physx::PxCooking *getCooking(); static physx::PxCooking *getCooking();
static void lockScenes(); static void lockScenes();
static void unlockScenes(); static void unlockScenes();
}; };

View file

@ -6652,7 +6652,7 @@ DefineEngineMethod( Player, setActionThread, bool, ( const char* name, bool hold
"@tsexample\n" "@tsexample\n"
"// Place the player in a sitting position after being mounted\n" "// Place the player in a sitting position after being mounted\n"
"%player.setActionThread( \"sitting\", true, true );\n" "%player.setActionThread( \"sitting\", true, true );\n"
"@endtsexample\n") "@endtsexample\n")
{ {
return object->setActionThread( name, hold, true, fsp); return object->setActionThread( name, hold, true, fsp);
} }
@ -6700,11 +6700,11 @@ DefineEngineMethod( Player, clearControlObject, void, (),,
"Returns control to the player. This internally calls " "Returns control to the player. This internally calls "
"Player::setControlObject(0).\n" "Player::setControlObject(0).\n"
"@tsexample\n" "@tsexample\n"
"%player.clearControlObject();\n" "%player.clearControlObject();\n"
"echo(%player.getControlObject()); //<-- Returns 0, player assumes control\n" "echo(%player.getControlObject()); //<-- Returns 0, player assumes control\n"
"%player.setControlObject(%vehicle);\n" "%player.setControlObject(%vehicle);\n"
"echo(%player.getControlObject()); //<-- Returns %vehicle, player controls the vehicle now.\n" "echo(%player.getControlObject()); //<-- Returns %vehicle, player controls the vehicle now.\n"
"@endtsexample\n" "@endtsexample\n"
"@note If the player does not have a control object, the player will receive all moves " "@note If the player does not have a control object, the player will receive all moves "
"from its GameConnection. If you're looking to remove control from the player itself " "from its GameConnection. If you're looking to remove control from the player itself "
"(i.e. stop sending moves to the player) use GameConnection::setControlObject() to transfer " "(i.e. stop sending moves to the player) use GameConnection::setControlObject() to transfer "
@ -6762,63 +6762,63 @@ void Player::consoleInit()
"@brief Determines if the player is rendered or not.\n\n" "@brief Determines if the player is rendered or not.\n\n"
"Used on the client side to disable the rendering of all Player objects. This is " "Used on the client side to disable the rendering of all Player objects. This is "
"mainly for the tools or debugging.\n" "mainly for the tools or debugging.\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::renderMyItems",TypeBool, &sRenderMyItems, Con::addVariable("$player::renderMyItems",TypeBool, &sRenderMyItems,
"@brief Determines if mounted shapes are rendered or not.\n\n" "@brief Determines if mounted shapes are rendered or not.\n\n"
"Used on the client side to disable the rendering of all Player mounted objects. This is " "Used on the client side to disable the rendering of all Player mounted objects. This is "
"mainly used for the tools or debugging.\n" "mainly used for the tools or debugging.\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::renderCollision", TypeBool, &sRenderPlayerCollision, Con::addVariable("$player::renderCollision", TypeBool, &sRenderPlayerCollision,
"@brief Determines if the player's collision mesh should be rendered.\n\n" "@brief Determines if the player's collision mesh should be rendered.\n\n"
"This is mainly used for the tools and debugging.\n" "This is mainly used for the tools and debugging.\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::minWarpTicks",TypeF32,&sMinWarpTicks, Con::addVariable("$player::minWarpTicks",TypeF32,&sMinWarpTicks,
"@brief Fraction of tick at which instant warp occures on the client.\n\n" "@brief Fraction of tick at which instant warp occures on the client.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::maxWarpTicks",TypeS32,&sMaxWarpTicks, Con::addVariable("$player::maxWarpTicks",TypeS32,&sMaxWarpTicks,
"@brief When a warp needs to occur due to the client being too far off from the server, this is the " "@brief When a warp needs to occur due to the client being too far off from the server, this is the "
"maximum number of ticks we'll allow the client to warp to catch up.\n\n" "maximum number of ticks we'll allow the client to warp to catch up.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::maxPredictionTicks",TypeS32,&sMaxPredictionTicks, Con::addVariable("$player::maxPredictionTicks",TypeS32,&sMaxPredictionTicks,
"@brief Maximum number of ticks to predict on the client from the last known move obtained from the server.\n\n" "@brief Maximum number of ticks to predict on the client from the last known move obtained from the server.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::maxImpulseVelocity", TypeF32, &sMaxImpulseVelocity, Con::addVariable("$player::maxImpulseVelocity", TypeF32, &sMaxImpulseVelocity,
"@brief The maximum velocity allowed due to a single impulse.\n\n" "@brief The maximum velocity allowed due to a single impulse.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
// Move triggers // Move triggers
Con::addVariable("$player::jumpTrigger", TypeS32, &sJumpTrigger, Con::addVariable("$player::jumpTrigger", TypeS32, &sJumpTrigger,
"@brief The move trigger index used for player jumping.\n\n" "@brief The move trigger index used for player jumping.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::crouchTrigger", TypeS32, &sCrouchTrigger, Con::addVariable("$player::crouchTrigger", TypeS32, &sCrouchTrigger,
"@brief The move trigger index used for player crouching.\n\n" "@brief The move trigger index used for player crouching.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::proneTrigger", TypeS32, &sProneTrigger, Con::addVariable("$player::proneTrigger", TypeS32, &sProneTrigger,
"@brief The move trigger index used for player prone pose.\n\n" "@brief The move trigger index used for player prone pose.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::sprintTrigger", TypeS32, &sSprintTrigger, Con::addVariable("$player::sprintTrigger", TypeS32, &sSprintTrigger,
"@brief The move trigger index used for player sprinting.\n\n" "@brief The move trigger index used for player sprinting.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::imageTrigger0", TypeS32, &sImageTrigger0, Con::addVariable("$player::imageTrigger0", TypeS32, &sImageTrigger0,
"@brief The move trigger index used to trigger mounted image 0.\n\n" "@brief The move trigger index used to trigger mounted image 0.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::imageTrigger1", TypeS32, &sImageTrigger1, Con::addVariable("$player::imageTrigger1", TypeS32, &sImageTrigger1,
"@brief The move trigger index used to trigger mounted image 1 or alternate fire " "@brief The move trigger index used to trigger mounted image 1 or alternate fire "
"on mounted image 0.\n\n" "on mounted image 0.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::jumpJetTrigger", TypeS32, &sJumpJetTrigger, Con::addVariable("$player::jumpJetTrigger", TypeS32, &sJumpJetTrigger,
"@brief The move trigger index used for player jump jetting.\n\n" "@brief The move trigger index used for player jump jetting.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
Con::addVariable("$player::vehicleDismountTrigger", TypeS32, &sVehicleDismountTrigger, Con::addVariable("$player::vehicleDismountTrigger", TypeS32, &sVehicleDismountTrigger,
"@brief The move trigger index used to dismount player.\n\n" "@brief The move trigger index used to dismount player.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
// ExtendedMove support // ExtendedMove support
Con::addVariable("$player::extendedMoveHeadPosRotIndex", TypeS32, &smExtendedMoveHeadPosRotIndex, Con::addVariable("$player::extendedMoveHeadPosRotIndex", TypeS32, &smExtendedMoveHeadPosRotIndex,
"@brief The ExtendedMove position/rotation index used for head movements.\n\n" "@brief The ExtendedMove position/rotation index used for head movements.\n\n"
"@ingroup GameObjects\n"); "@ingroup GameObjects\n");
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View file

@ -80,7 +80,7 @@ EndImplementEnumType;
ImplementEnumType( ShapeBaseImageLightType, ImplementEnumType( ShapeBaseImageLightType,
"@brief The type of light to attach to this ShapeBaseImage.\n\n" "@brief The type of light to attach to this ShapeBaseImage.\n\n"
"@ingroup gameObjects\n\n") "@ingroup gameObjects\n\n")
{ ShapeBaseImageData::NoLight, "NoLight", "No light is attached.\n" }, { ShapeBaseImageData::NoLight, "NoLight", "No light is attached.\n" },
{ ShapeBaseImageData::ConstantLight, "ConstantLight", "A constant emitting light is attached.\n" }, { ShapeBaseImageData::ConstantLight, "ConstantLight", "A constant emitting light is attached.\n" },
{ ShapeBaseImageData::SpotLight, "SpotLight", "A spotlight is attached.\n" }, { ShapeBaseImageData::SpotLight, "SpotLight", "A spotlight is attached.\n" },
{ ShapeBaseImageData::PulsingLight, "PulsingLight", "A pusling light is attached.\n" }, { ShapeBaseImageData::PulsingLight, "PulsingLight", "A pusling light is attached.\n" },
@ -1532,7 +1532,7 @@ bool ShapeBase::unmountImage(U32 imageSlot)
{ {
AssertFatal(imageSlot<MaxMountedImages,"Out of range image slot"); AssertFatal(imageSlot<MaxMountedImages,"Out of range image slot");
bool returnValue = false; bool returnValue = false;
MountedImage& image = mMountedImageList[imageSlot]; MountedImage& image = mMountedImageList[imageSlot];
if (image.dataBlock) if (image.dataBlock)
{ {
@ -2772,7 +2772,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState,bool force)
if( stateData.sound && isGhost() ) if( stateData.sound && isGhost() )
{ {
const Point3F& velocity = getVelocity(); const Point3F& velocity = getVelocity();
image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity )); image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity ));
} }
// Play animation // Play animation

View file

@ -77,12 +77,12 @@ ConsoleDocClass( River,
#define NODE_RADIUS 15.0f #define NODE_RADIUS 15.0f
static U32 gIdxArray[6][2][3] = { static U32 gIdxArray[6][2][3] = {
{ { 0, 4, 5 }, { 0, 5, 1 }, }, // Top Face { { 0, 4, 5 }, { 0, 5, 1 }, }, // Top Face
{ { 2, 6, 4 }, { 2, 4, 0 }, }, // Left Face { { 2, 6, 4 }, { 2, 4, 0 }, }, // Left Face
{ { 1, 5, 7 }, { 1, 7, 3 }, }, // Right Face { { 1, 5, 7 }, { 1, 7, 3 }, }, // Right Face
{ { 2, 3, 7 }, { 2, 7, 6 }, }, // Bottom Face { { 2, 3, 7 }, { 2, 7, 6 }, }, // Bottom Face
{ { 0, 1, 3 }, { 0, 3, 2 }, }, // Front Face { { 0, 1, 3 }, { 0, 3, 2 }, }, // Front Face
{ { 4, 6, 7 }, { 4, 7, 5 }, }, // Back Face { { 4, 6, 7 }, { 4, 7, 5 }, }, // Back Face
}; };
struct RiverHitSegment struct RiverHitSegment
@ -93,10 +93,10 @@ struct RiverHitSegment
static S32 QSORT_CALLBACK compareHitSegments(const void* a,const void* b) static S32 QSORT_CALLBACK compareHitSegments(const void* a,const void* b)
{ {
const RiverHitSegment *fa = (RiverHitSegment*)a; const RiverHitSegment *fa = (RiverHitSegment*)a;
const RiverHitSegment *fb = (RiverHitSegment*)b; const RiverHitSegment *fb = (RiverHitSegment*)b;
return mSign(fb->t - fa->t); return mSign(fb->t - fa->t);
} }
static Point3F sSegmentPointComparePoints[4]; static Point3F sSegmentPointComparePoints[4];
@ -655,17 +655,17 @@ void River::consoleInit()
Parent::consoleInit(); Parent::consoleInit();
Con::addVariable( "$River::EditorOpen", TypeBool, &River::smEditorOpen, "For editor use.\n" Con::addVariable( "$River::EditorOpen", TypeBool, &River::smEditorOpen, "For editor use.\n"
"@ingroup Editors\n" ); "@ingroup Editors\n" );
Con::addVariable( "$River::showWalls", TypeBool, &River::smShowWalls, "For editor use.\n" Con::addVariable( "$River::showWalls", TypeBool, &River::smShowWalls, "For editor use.\n"
"@ingroup Editors\n" ); "@ingroup Editors\n" );
Con::addVariable( "$River::showNodes", TypeBool, &River::smShowNodes, "For editor use.\n" Con::addVariable( "$River::showNodes", TypeBool, &River::smShowNodes, "For editor use.\n"
"@ingroup Editors\n"); "@ingroup Editors\n");
Con::addVariable( "$River::showSpline", TypeBool, &River::smShowSpline, "For editor use.\n" Con::addVariable( "$River::showSpline", TypeBool, &River::smShowSpline, "For editor use.\n"
"@ingroup Editors\n" ); "@ingroup Editors\n" );
Con::addVariable( "$River::showRiver", TypeBool, &River::smShowRiver, "For editor use.\n" Con::addVariable( "$River::showRiver", TypeBool, &River::smShowRiver, "For editor use.\n"
"@ingroup Editors\n" ); "@ingroup Editors\n" );
Con::addVariable( "$River::showWireframe", TypeBool, &River::smWireframe, "For editor use.\n" Con::addVariable( "$River::showWireframe", TypeBool, &River::smWireframe, "For editor use.\n"
"@ingroup Editors\n"); "@ingroup Editors\n");
} }
bool River::addNodeFromField( void *object, const char *index, const char *data ) bool River::addNodeFromField( void *object, const char *index, const char *data )
@ -816,7 +816,7 @@ void River::innerRender( SceneRenderState *state )
_makeRenderBatches( camPosition ); _makeRenderBatches( camPosition );
if ( !River::smShowRiver ) if ( !River::smShowRiver )
return; return;
// If no material... we're done. // If no material... we're done.
@ -851,7 +851,7 @@ void River::innerRender( SceneRenderState *state )
U32 vertCount = ( endVert - startVert ) + 1; U32 vertCount = ( endVert - startVert ) + 1;
U32 idxCount = ( endIdx - startIdx ) + 1; U32 idxCount = ( endIdx - startIdx ) + 1;
U32 triangleCount = idxCount / 3; U32 triangleCount = idxCount / 3;
AssertFatal( startVert < mLowVertCount, "River, bad draw call!" ); AssertFatal( startVert < mLowVertCount, "River, bad draw call!" );
AssertFatal( startVert + vertCount <= mLowVertCount, "River, bad draw call!" ); AssertFatal( startVert + vertCount <= mLowVertCount, "River, bad draw call!" );
AssertFatal( triangleCount <= mLowTriangleCount, "River, bad draw call!" ); AssertFatal( triangleCount <= mLowTriangleCount, "River, bad draw call!" );
@ -962,7 +962,7 @@ U32 River::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
stream->write( mSegmentsPerBatch ); stream->write( mSegmentsPerBatch );
stream->write( mDepthScale ); stream->write( mDepthScale );
stream->write( mMaxDivisionSize ); stream->write( mMaxDivisionSize );
stream->write( mColumnCount ); stream->write( mColumnCount );
stream->write( mFlowMagnitude ); stream->write( mFlowMagnitude );
stream->write( mLodDistance ); stream->write( mLodDistance );
@ -1045,7 +1045,7 @@ void River::unpackUpdate(NetConnection * con, BitStream * stream)
// RiverMask // RiverMask
if(stream->readFlag()) if(stream->readFlag())
{ {
MatrixF ObjectMatrix; MatrixF ObjectMatrix;
stream->readAffineTransform(&ObjectMatrix); stream->readAffineTransform(&ObjectMatrix);
Parent::setTransform(ObjectMatrix); Parent::setTransform(ObjectMatrix);
@ -1053,7 +1053,7 @@ void River::unpackUpdate(NetConnection * con, BitStream * stream)
stream->read( &mSegmentsPerBatch ); stream->read( &mSegmentsPerBatch );
stream->read( &mDepthScale ); stream->read( &mDepthScale );
stream->read( &mMaxDivisionSize ); stream->read( &mMaxDivisionSize );
stream->read( &mColumnCount ); stream->read( &mColumnCount );
stream->read( &mFlowMagnitude ); stream->read( &mFlowMagnitude );
stream->read( &mLodDistance ); stream->read( &mLodDistance );
@ -1198,56 +1198,56 @@ void River::setScale( const VectorF &scale )
bool River::castRay(const Point3F &s, const Point3F &e, RayInfo* info) bool River::castRay(const Point3F &s, const Point3F &e, RayInfo* info)
{ {
Point3F start = s; Point3F start = s;
Point3F end = e; Point3F end = e;
mObjToWorld.mulP(start); mObjToWorld.mulP(start);
mObjToWorld.mulP(end); mObjToWorld.mulP(end);
F32 out = 1.0f; // The output fraction/percentage along the line defined by s and e F32 out = 1.0f; // The output fraction/percentage along the line defined by s and e
VectorF norm(0.0f, 0.0f, 0.0f); // The normal of the face intersected VectorF norm(0.0f, 0.0f, 0.0f); // The normal of the face intersected
Vector<RiverHitSegment> hitSegments; Vector<RiverHitSegment> hitSegments;
for ( U32 i = 0; i < mSegments.size(); i++ ) for ( U32 i = 0; i < mSegments.size(); i++ )
{ {
const RiverSegment &segment = mSegments[i]; const RiverSegment &segment = mSegments[i];
F32 t; F32 t;
VectorF n; VectorF n;
if ( segment.worldbounds.collideLine( start, end, &t, &n ) ) if ( segment.worldbounds.collideLine( start, end, &t, &n ) )
{ {
hitSegments.increment(); hitSegments.increment();
hitSegments.last().t = t; hitSegments.last().t = t;
hitSegments.last().idx = i; hitSegments.last().idx = i;
} }
} }
dQsort( hitSegments.address(), hitSegments.size(), sizeof(RiverHitSegment), compareHitSegments ); dQsort( hitSegments.address(), hitSegments.size(), sizeof(RiverHitSegment), compareHitSegments );
U32 idx0, idx1, idx2; U32 idx0, idx1, idx2;
F32 t; F32 t;
for ( U32 i = 0; i < hitSegments.size(); i++ ) for ( U32 i = 0; i < hitSegments.size(); i++ )
{ {
U32 segIdx = hitSegments[i].idx; U32 segIdx = hitSegments[i].idx;
const RiverSegment &segment = mSegments[segIdx]; const RiverSegment &segment = mSegments[segIdx];
// Each segment has 6 faces // Each segment has 6 faces
for ( U32 j = 0; j < 6; j++ ) for ( U32 j = 0; j < 6; j++ )
{ {
if ( j == 4 && segIdx != 0 ) if ( j == 4 && segIdx != 0 )
continue; continue;
if ( j == 5 && segIdx != mSegments.size() - 1 ) if ( j == 5 && segIdx != mSegments.size() - 1 )
continue; continue;
// Each face has 2 triangles // Each face has 2 triangles
for ( U32 k = 0; k < 2; k++ ) for ( U32 k = 0; k < 2; k++ )
{ {
idx0 = gIdxArray[j][k][0]; idx0 = gIdxArray[j][k][0];
idx1 = gIdxArray[j][k][1]; idx1 = gIdxArray[j][k][1];
idx2 = gIdxArray[j][k][2]; idx2 = gIdxArray[j][k][2];
const Point3F &v0 = segment[idx0]; const Point3F &v0 = segment[idx0];
const Point3F &v1 = segment[idx1]; const Point3F &v1 = segment[idx1];
@ -1257,40 +1257,40 @@ bool River::castRay(const Point3F &s, const Point3F &e, RayInfo* info)
v2, v1, v0, v2, v1, v0,
NULL, NULL,
&t ) ) &t ) )
continue; continue;
if ( t >= 0.0f && t < 1.0f && t < out ) if ( t >= 0.0f && t < 1.0f && t < out )
{ {
out = t; out = t;
// optimize this, can be calculated easily within // optimize this, can be calculated easily within
// the collision test // the collision test
norm = PlaneF( v0, v1, v2 ); norm = PlaneF( v0, v1, v2 );
} }
} }
} }
if (out >= 0.0f && out < 1.0f) if (out >= 0.0f && out < 1.0f)
break; break;
} }
if (out >= 0.0f && out < 1.0f) if (out >= 0.0f && out < 1.0f)
{ {
info->t = out; info->t = out;
info->normal = norm; info->normal = norm;
info->point.interpolate(start, end, out); info->point.interpolate(start, end, out);
info->face = -1; info->face = -1;
info->object = this; info->object = this;
return true; return true;
} }
return false; return false;
} }
bool River::collideBox(const Point3F &start, const Point3F &end, RayInfo* info) bool River::collideBox(const Point3F &start, const Point3F &end, RayInfo* info)
{ {
return false; return false;
} }
bool River::buildPolyList( PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF& sphere ) bool River::buildPolyList( PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF& sphere )
@ -1656,8 +1656,8 @@ void River::_generateVerts()
// These will depend on the level of subdivision per segment // These will depend on the level of subdivision per segment
// calculated below. // calculated below.
mHighVertCount = 0; mHighVertCount = 0;
mHighTriangleCount = 0; mHighTriangleCount = 0;
// Calculate the number of row/column subdivisions per each // Calculate the number of row/column subdivisions per each
// RiverSegment. // RiverSegment.
@ -1671,18 +1671,18 @@ void River::_generateVerts()
mColumnCount = mCeil( greatestWidth / mMaxDivisionSize ); mColumnCount = mCeil( greatestWidth / mMaxDivisionSize );
for ( U32 i = 0; i < mSegments.size(); i++ ) for ( U32 i = 0; i < mSegments.size(); i++ )
{ {
RiverSegment &segment = mSegments[i]; RiverSegment &segment = mSegments[i];
const RiverSlice *slice = segment.slice0; const RiverSlice *slice = segment.slice0;
const RiverSlice *nextSlice = segment.slice1; const RiverSlice *nextSlice = segment.slice1;
// Calculate the size of divisions in the forward direction ( p00 -> p01 ) // Calculate the size of divisions in the forward direction ( p00 -> p01 )
F32 segLength = (nextSlice->p1 - slice->p1).len(); F32 segLength = (nextSlice->p1 - slice->p1).len();
// A division count of one is actually NO subdivision, // A division count of one is actually NO subdivision,
// the segment corners are the only verts in this segment. // the segment corners are the only verts in this segment.
U32 numRows = 1; U32 numRows = 1;
if ( segLength > 0.0f ) if ( segLength > 0.0f )
numRows = mCeil( segLength / mMaxDivisionSize ); numRows = mCeil( segLength / mMaxDivisionSize );
@ -1693,33 +1693,33 @@ void River::_generateVerts()
// column data member we initialize all segments in the river to // column data member we initialize all segments in the river to
// the same (River::mColumnCount) // the same (River::mColumnCount)
// Calculate the size of divisions in the right direction ( p00 -> p10 ) // Calculate the size of divisions in the right direction ( p00 -> p10 )
// F32 segWidth = ( ( p11 - p01 ).len() + ( p10 - p00 ).len() ) * 0.5f; // F32 segWidth = ( ( p11 - p01 ).len() + ( p10 - p00 ).len() ) * 0.5f;
// U32 numColumns = 5; // U32 numColumns = 5;
//F32 columnSize = segWidth / numColumns; //F32 columnSize = segWidth / numColumns;
//while ( columnSize > mMaxDivisionSize ) //while ( columnSize > mMaxDivisionSize )
//{ //{
// numColumns++; // numColumns++;
// columnSize = segWidth / numColumns; // columnSize = segWidth / numColumns;
//} //}
// Save the calculated numb of columns / rows for this segment. // Save the calculated numb of columns / rows for this segment.
segment.columns = mColumnCount; segment.columns = mColumnCount;
segment.rows = numRows; segment.rows = numRows;
// Save the corresponding number of verts/prims // Save the corresponding number of verts/prims
segment.numVerts = ( 1 + mColumnCount ) * ( 1 + numRows ); segment.numVerts = ( 1 + mColumnCount ) * ( 1 + numRows );
segment.numTriangles = mColumnCount * numRows * 2; segment.numTriangles = mColumnCount * numRows * 2;
mHighVertCount += segment.numVerts; mHighVertCount += segment.numVerts;
mHighTriangleCount += segment.numTriangles; mHighTriangleCount += segment.numTriangles;
} }
// Number of low detail verts/prims. // Number of low detail verts/prims.
mLowVertCount = mSlices.size() * 2; mLowVertCount = mSlices.size() * 2;
mLowTriangleCount = mSegments.size() * 2; mLowTriangleCount = mSegments.size() * 2;
// Allocate the low detail VertexBuffer, // Allocate the low detail VertexBuffer,
// this will stay in memory and will never need to change. // this will stay in memory and will never need to change.
@ -1728,8 +1728,8 @@ void River::_generateVerts()
GFXWaterVertex *lowVertPtr = mVB_low.lock(); GFXWaterVertex *lowVertPtr = mVB_low.lock();
U32 vertCounter = 0; U32 vertCounter = 0;
// The texCoord.y value start/end for a segment // The texCoord.y value start/end for a segment
// as we loop through them. // as we loop through them.
F32 textCoordV = 0; F32 textCoordV = 0;
// //
@ -1760,7 +1760,7 @@ void River::_generateVerts()
{ {
// Increment the textCoordV for the next slice. // Increment the textCoordV for the next slice.
F32 segLen = ( mSlices[i+1].p1 - slice.p1 ).len(); F32 segLen = ( mSlices[i+1].p1 - slice.p1 ).len();
textCoordV += segLen; textCoordV += segLen;
} }
} }
@ -1771,8 +1771,8 @@ void River::_generateVerts()
// //
// Create the low-detail prim buffer(s) // Create the low-detail prim buffer(s)
// //
mPB_low.set( GFX, mLowTriangleCount * 3, mLowTriangleCount, GFXBufferTypeStatic ); mPB_low.set( GFX, mLowTriangleCount * 3, mLowTriangleCount, GFXBufferTypeStatic );
U16 *lowIdxBuff; U16 *lowIdxBuff;
mPB_low.lock(&lowIdxBuff); mPB_low.lock(&lowIdxBuff);
@ -1784,13 +1784,13 @@ void River::_generateVerts()
U32 offset = 0; U32 offset = 0;
// Fill the low-detail PrimitiveBuffer // Fill the low-detail PrimitiveBuffer
for ( U32 i = 0; i < mSegments.size(); i++ ) for ( U32 i = 0; i < mSegments.size(); i++ )
{ {
//const RiverSegment &segment = mSegments[i]; //const RiverSegment &segment = mSegments[i];
// Two triangles formed by the corner points of this segment // Two triangles formed by the corner points of this segment
// into the the low detail primitive buffer. // into the the low detail primitive buffer.
p00 = offset; p00 = offset;
p01 = p00 + 2; p01 = p00 + 2;
p11 = p01 + 1; p11 = p01 + 1;
p10 = p00 + 1; p10 = p00 + 1;

View file

@ -40,32 +40,32 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) :
mCachedHashValue(desc.getHashValue()) mCachedHashValue(desc.getHashValue())
{ {
if( !GFXGL->mCapabilities.samplerObjects ) if( !GFXGL->mCapabilities.samplerObjects )
return; return;
static Map<GFXSamplerStateDesc, U32> mSamplersMap; static Map<GFXSamplerStateDesc, U32> mSamplersMap;
for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i) for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i)
{ {
GLuint &id = mSamplerObjects[i]; GLuint &id = mSamplerObjects[i];
GFXSamplerStateDesc &ssd = mDesc.samplers[i]; GFXSamplerStateDesc &ssd = mDesc.samplers[i];
Map<GFXSamplerStateDesc, U32>::Iterator itr = mSamplersMap.find(ssd); Map<GFXSamplerStateDesc, U32>::Iterator itr = mSamplersMap.find(ssd);
if(itr == mSamplersMap.end()) if(itr == mSamplersMap.end())
{ {
glGenSamplers(1, &id); glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, minificationFilter(ssd.minFilter, ssd.mipFilter, 1) ); glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, minificationFilter(ssd.minFilter, ssd.mipFilter, 1) );
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GFXGLTextureFilter[ssd.magFilter]); glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GFXGLTextureFilter[ssd.magFilter]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]); glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]); glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]);
if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() ) if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy); glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
mSamplersMap[ssd] = id; mSamplersMap[ssd] = id;
} }
else else
id = itr->value; id = itr->value;
} }
} }
GFXGLStateBlock::~GFXGLStateBlock() GFXGLStateBlock::~GFXGLStateBlock()
@ -171,9 +171,9 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState)
for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) TEXTURE_STAGE_COUNT); i++) for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) TEXTURE_STAGE_COUNT); i++)
{ {
if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i]) if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i])
glBindSampler(i, mSamplerObjects[i] ); glBindSampler(i, mSamplerObjects[i] );
} }
} }
// TODO: states added for detail blend // TODO: states added for detail blend
} }

View file

@ -462,9 +462,9 @@ void GuiRolloutCtrl::processTick()
newHeight -= mAnimateStep; newHeight -= mAnimateStep;
if( !mIsAnimating ) if( !mIsAnimating )
{ {
mIsExpanded = false; mIsExpanded = false;
} }
} }
else // We're expanding ourself (Showing our contents) else // We're expanding ourself (Showing our contents)
{ {
@ -559,13 +559,13 @@ void GuiRolloutCtrl::onRender( Point2I offset, const RectI &updateRect )
if ( pChild ) if ( pChild )
{ {
if ( !mIsExpanded && !mIsAnimating && pChild->isVisible() ) if ( !mIsExpanded && !mIsAnimating && pChild->isVisible() )
{ {
pChild->setVisible( false ); pChild->setVisible( false );
} }
else if ( (mIsExpanded || mIsAnimating) && !pChild->isVisible() ) else if ( (mIsExpanded || mIsAnimating) && !pChild->isVisible() )
{ {
pChild->setVisible( true ); pChild->setVisible( true );
} }
} }
renderChildControls( offset, updateRect ); renderChildControls( offset, updateRect );
@ -614,7 +614,7 @@ DefineEngineMethod( GuiRolloutCtrl, toggleCollapse, void, (),,
if( object->isExpanded() ) if( object->isExpanded() )
object->collapse(); object->collapse();
else else
object->expand(); object->expand();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -1143,10 +1143,10 @@ void NavMesh::buildLinks()
// Iterate over links // Iterate over links
for(U32 j = 0; j < mLinkIDs.size(); j++) for(U32 j = 0; j < mLinkIDs.size(); j++)
{ {
if (mLinksUnsynced[j]) if (mLinksUnsynced[j])
{ {
if(tile.box.isContained(getLinkStart(j)) || if(tile.box.isContained(getLinkStart(j)) ||
tile.box.isContained(getLinkEnd(j))) tile.box.isContained(getLinkEnd(j)))
{ {
// Mark tile for build. // Mark tile for build.
mDirtyTiles.push_back_unique(i); mDirtyTiles.push_back_unique(i);
@ -1161,7 +1161,7 @@ void NavMesh::buildLinks()
} }
} }
} }
} }
if(mDirtyTiles.size()) if(mDirtyTiles.size())
ctx->startTimer(RC_TIMER_TOTAL); ctx->startTimer(RC_TIMER_TOTAL);
} }

View file

@ -843,7 +843,7 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc)
if ( isTranslucent ) if ( isTranslucent )
{ {
prePassStateBlock.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha ); prePassStateBlock.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha );
prePassStateBlock.setColorWrites(false, false, false, true); prePassStateBlock.setColorWrites(false, false, false, true);
} }
// Enable z reads, but only enable zwrites if we're not translucent. // Enable z reads, but only enable zwrites if we're not translucent.