whitespace updates

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

View file

@ -1351,7 +1351,7 @@ void Camera::consoleInit()
// ExtendedMove support
Con::addVariable("$camera::extendedMovePosRotIndex", TypeS32, &smExtendedMovePosRotIndex,
"@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.
if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() )
if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() )
mDecalInstanceVec[ inst->mId ] = NULL;
// 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 ) )
continue;
RayInfo ri;
bool containsPoint = false;
if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
{
Point2F poly[4];
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[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));
if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) )
containsPoint = true;
}
RayInfo ri;
bool containsPoint = false;
if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
{
Point2F poly[4];
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[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));
if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) )
containsPoint = true;
}
if( !containsPoint )
continue;
if( !containsPoint )
continue;
hitDecals.push_back( inst );
}
@ -1406,7 +1406,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
query.init( rootFrustum.getPosition(),
rootFrustum.getTransform().getForwardVector(),
rootFrustum.getFarDist() );
query.getLights( baseRenderInst.lights, 8 );
query.getLights( baseRenderInst.lights, 8 );
}
// Submit render inst...
@ -1575,7 +1575,7 @@ void DecalManager::clearData()
}
mData = NULL;
mDecalInstanceVec.clear();
mDecalInstanceVec.clear();
_freePools();
}
@ -1758,7 +1758,7 @@ DefineEngineFunction( decalManagerEditDecal, bool, ( S32 decalID, Point3F pos, P
{
DecalInstance *decalInstance = gDecalManager->getDecal( decalID );
if( !decalInstance )
return false;
return false;
//Internally we need Point3F tangent instead of the user friendly F32 rotAroundNormal
MatrixF mat( true );

View file

@ -76,7 +76,7 @@ bool BtBody::init( PhysicsCollision *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( ((BtCollision*)shape)->getShape(), "BtBody::init - Got empty collision shape!" );
// Cleanup any previous actor.
_releaseActor();
@ -97,20 +97,20 @@ bool BtBody::init( PhysicsCollision *shape,
btScalar *masses = new btScalar[ btCompound->getNumChildShapes() ];
for ( U32 j=0; j < btCompound->getNumChildShapes(); j++ )
masses[j] = mass / btCompound->getNumChildShapes();
masses[j] = mass / btCompound->getNumChildShapes();
btVector3 principalInertia;
btTransform principal;
btCompound->calculatePrincipalAxisTransform( masses, principal, principalInertia );
delete [] masses;
// Create a new compound with the shifted children.
btColShape = mCompound = new btCompoundShape();
for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ )
{
btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i);
mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) );
}
// Create a new compound with the shifted children.
btColShape = mCompound = new btCompoundShape();
for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ )
{
btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i);
mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) );
}
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.
mCollisionConfiguration = new btDefaultCollisionConfiguration();
mDispatcher = new btCollisionDispatcher( mCollisionConfiguration );
mDispatcher = new btCollisionDispatcher( mCollisionConfiguration );
btVector3 worldMin( -2000, -2000, -1000 );
btVector3 worldMax( 2000, 2000, 1000 );

View file

@ -242,7 +242,7 @@ void PhysicsShapeData::onRemove()
void PhysicsShapeData::_onResourceChanged( const Torque::Path &path )
{
if ( path != Path( shapeName ) )
if ( path != Path( shapeName ) )
return;
// Reload the changed shape.
@ -360,8 +360,8 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer )
Vector<FConvexResult*> mHulls;
};
DecompDesc d;
d.mVcount = polyList.mVertexList.size();
DecompDesc d;
d.mVcount = polyList.mVertexList.size();
d.mVertices = doubleVerts.address();
d.mTcount = polyList.mIndexList.size() / 3;
d.mIndices = polyList.mIndexList.address();
@ -659,7 +659,7 @@ void PhysicsShape::onRemove()
PhysicsPlugin::getPhysicsResetSignal().remove( this, &PhysicsShape::_onPhysicsReset );
if ( mDestroyedShape )
mDestroyedShape->deleteObject();
mDestroyedShape->deleteObject();
}
// 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( dynamic_cast<Px3Collision*>( shape ), "Px3Body::init - The collision shape is the wrong type!" );
AssertFatal( !((Px3Collision*)shape)->getShapes().empty(), "Px3Body::init - Got empty collision shape!" );
// Cleanup any previous actor.
_releaseActor();
@ -94,10 +94,10 @@ bool Px3Body::init( PhysicsCollision *shape,
if ( isKinematic )
{
mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY()));
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true);
actor->setMass(getMax( mass, 1.0f ));
mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY()));
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true);
actor->setMass(getMax( mass, 1.0f ));
}
else if ( mass > 0.0f )
{
@ -107,7 +107,7 @@ bool Px3Body::init( PhysicsCollision *shape,
{
mActor = gPhysics3SDK->createRigidStatic(physx::PxTransform(physx::PxIDENTITY()));
mIsStatic = true;
}
}
mMaterial = gPhysics3SDK->createMaterial(0.6f,0.4f,0.1f);
@ -115,22 +115,22 @@ bool Px3Body::init( PhysicsCollision *shape,
const Vector<Px3CollisionDesc*> &shapes = mColShape->getShapes();
for ( U32 i=0; i < shapes.size(); i++ )
{
Px3CollisionDesc* desc = shapes[i];
if( mass > 0.0f )
{
if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH)
{
Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported.");
}
}
physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial);
physx::PxFilterData colData;
if(isDebris)
colData.word0 = PX3_DEBRIS;
else if(isTrigger)
Px3CollisionDesc* desc = shapes[i];
if( mass > 0.0f )
{
if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH)
{
Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported.");
}
}
physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial);
physx::PxFilterData colData;
if(isDebris)
colData.word0 = PX3_DEBRIS;
else if(isTrigger)
colData.word0 = PX3_TRIGGER;
else
colData.word0 = PX3_DEFAULT;
else
colData.word0 = PX3_DEFAULT;
//set local pose - actor->createShape with a local pose is deprecated in physx 3.3
pShape->setLocalPose(desc->pose);
@ -145,8 +145,8 @@ bool Px3Body::init( PhysicsCollision *shape,
//mass & intertia has to be set after creating the shape
if ( mass > 0.0f )
{
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass);
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass);
}
// This sucks, but it has to happen if we want
@ -178,9 +178,9 @@ void Px3Body::setMaterial( F32 restitution,
actor->wakeUp();
}
mMaterial->setRestitution(restitution);
mMaterial->setStaticFriction(staticFriction);
mMaterial->setDynamicFriction(friction);
mMaterial->setRestitution(restitution);
mMaterial->setStaticFriction(staticFriction);
mMaterial->setDynamicFriction(friction);
}
@ -189,7 +189,7 @@ void Px3Body::setSleepThreshold( F32 linear, F32 angular )
AssertFatal( mActor, "Px3Body::setSleepThreshold - The actor is null!" );
if(mIsStatic)
return;
return;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
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!" );
if(mIsStatic)
return;
return;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setLinearDamping( linear );
@ -227,7 +227,7 @@ F32 Px3Body::getMass() const
{
AssertFatal( mActor, "PxBody::getCMassPosition - The actor is null!" );
if(mIsStatic)
return 0;
return 0;
const physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
return actor->getMass();
@ -237,7 +237,7 @@ Point3F Px3Body::getCMassPosition() const
{
AssertFatal( mActor, "Px3Body::getCMassPosition - The actor is null!" );
if(mIsStatic)
return px3Cast<Point3F>(mActor->getGlobalPose().p);
return px3Cast<Point3F>(mActor->getGlobalPose().p);
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxTransform pose = actor->getGlobalPose() * actor->getCMassLocalPose();
@ -326,11 +326,11 @@ Box3F Px3Body::getWorldBounds()
U32 shapeCount = mActor->getNbShapes();
physx::PxShape **shapes = new physx::PxShape*[shapeCount];
mActor->getShapes(shapes, shapeCount);
physx::PxShape **shapes = new physx::PxShape*[shapeCount];
mActor->getShapes(shapes, shapeCount);
for ( U32 i = 0; i < shapeCount; i++ )
{
// Get the shape's bounds.
// Get the shape's bounds.
shapeBounds = physx::PxShapeExt::getWorldBounds(*shapes[i],*mActor);
// Combine them into the total bounds.
bounds.include( shapeBounds );
@ -355,11 +355,11 @@ void Px3Body::setSimulationEnabled( bool enabled )
mWorld->releaseWriteLock();
U32 shapeCount = mActor->getNbShapes();
physx::PxShape **shapes = new physx::PxShape*[shapeCount];
mActor->getShapes(shapes, shapeCount);
physx::PxShape **shapes = new physx::PxShape*[shapeCount];
mActor->getShapes(shapes, shapeCount);
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;
@ -377,10 +377,10 @@ void Px3Body::setTransform( const MatrixF &transform )
mActor->setGlobalPose(px3Cast<physx::PxTransform>(transform),false);
if(mIsStatic)
return;
return;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC;
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC;
// If its dynamic we have more to do.
if ( isDynamic() && !kinematic )
{
@ -412,8 +412,8 @@ void Px3Body::applyImpulse( const Point3F &origin, const Point3F &force )
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
if ( mIsEnabled && isDynamic() )
physx::PxRigidBodyExt::addForceAtPos(*actor,px3Cast<physx::PxVec3>(force),
px3Cast<physx::PxVec3>(origin),
physx::PxForceMode::eIMPULSE);
px3Cast<physx::PxVec3>(origin),
physx::PxForceMode::eIMPULSE);
}

View file

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

View file

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

View file

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

View file

@ -6652,7 +6652,7 @@ DefineEngineMethod( Player, setActionThread, bool, ( const char* name, bool hold
"@tsexample\n"
"// Place the player in a sitting position after being mounted\n"
"%player.setActionThread( \"sitting\", true, true );\n"
"@endtsexample\n")
"@endtsexample\n")
{
return object->setActionThread( name, hold, true, fsp);
}
@ -6700,11 +6700,11 @@ DefineEngineMethod( Player, clearControlObject, void, (),,
"Returns control to the player. This internally calls "
"Player::setControlObject(0).\n"
"@tsexample\n"
"%player.clearControlObject();\n"
"%player.clearControlObject();\n"
"echo(%player.getControlObject()); //<-- Returns 0, player assumes control\n"
"%player.setControlObject(%vehicle);\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 "
"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 "
@ -6762,63 +6762,63 @@ void Player::consoleInit()
"@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 "
"mainly for the tools or debugging.\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::renderMyItems",TypeBool, &sRenderMyItems,
"@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 "
"mainly used for the tools or debugging.\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::renderCollision", TypeBool, &sRenderPlayerCollision,
"@brief Determines if the player's collision mesh should be rendered.\n\n"
"This is mainly used for the tools and debugging.\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::minWarpTicks",TypeF32,&sMinWarpTicks,
"@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,
"@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"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
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"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::maxImpulseVelocity", TypeF32, &sMaxImpulseVelocity,
"@brief The maximum velocity allowed due to a single impulse.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
// Move triggers
Con::addVariable("$player::jumpTrigger", TypeS32, &sJumpTrigger,
"@brief The move trigger index used for player jumping.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::crouchTrigger", TypeS32, &sCrouchTrigger,
"@brief The move trigger index used for player crouching.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::proneTrigger", TypeS32, &sProneTrigger,
"@brief The move trigger index used for player prone pose.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::sprintTrigger", TypeS32, &sSprintTrigger,
"@brief The move trigger index used for player sprinting.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::imageTrigger0", TypeS32, &sImageTrigger0,
"@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,
"@brief The move trigger index used to trigger mounted image 1 or alternate fire "
"on mounted image 0.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::jumpJetTrigger", TypeS32, &sJumpJetTrigger,
"@brief The move trigger index used for player jump jetting.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
Con::addVariable("$player::vehicleDismountTrigger", TypeS32, &sVehicleDismountTrigger,
"@brief The move trigger index used to dismount player.\n\n"
"@ingroup GameObjects\n");
"@ingroup GameObjects\n");
// ExtendedMove support
Con::addVariable("$player::extendedMoveHeadPosRotIndex", TypeS32, &smExtendedMoveHeadPosRotIndex,
"@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,
"@brief The type of light to attach to this ShapeBaseImage.\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::SpotLight, "SpotLight", "A spotlight 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");
bool returnValue = false;
bool returnValue = false;
MountedImage& image = mMountedImageList[imageSlot];
if (image.dataBlock)
{
@ -2772,7 +2772,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState,bool force)
if( stateData.sound && isGhost() )
{
const Point3F& velocity = getVelocity();
image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity ));
image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity ));
}
// Play animation

View file

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

View file

@ -40,32 +40,32 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) :
mCachedHashValue(desc.getHashValue())
{
if( !GFXGL->mCapabilities.samplerObjects )
return;
return;
static Map<GFXSamplerStateDesc, U32> mSamplersMap;
for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i)
{
GLuint &id = mSamplerObjects[i];
GFXSamplerStateDesc &ssd = mDesc.samplers[i];
for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i)
{
GLuint &id = mSamplerObjects[i];
GFXSamplerStateDesc &ssd = mDesc.samplers[i];
Map<GFXSamplerStateDesc, U32>::Iterator itr = mSamplersMap.find(ssd);
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_MAG_FILTER, GFXGLTextureFilter[ssd.magFilter]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]);
if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
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_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]);
glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]);
if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
mSamplersMap[ssd] = id;
}
else
id = itr->value;
}
}
}
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++)
{
if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i])
glBindSampler(i, mSamplerObjects[i] );
glBindSampler(i, mSamplerObjects[i] );
}
}
}
// TODO: states added for detail blend
}

View file

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

View file

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

View file

@ -843,7 +843,7 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc)
if ( isTranslucent )
{
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.