Merge branch 'development' into Fix_Issue_#1951_TCPObject_is_broken_3.10

This commit is contained in:
Areloch 2017-04-17 20:19:20 -05:00 committed by GitHub
commit 5be2497b69
1893 changed files with 19222 additions and 25891 deletions

5
Engine/source/.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
*.cpp filter=tabspace
*.h filter=tabspace
*.l filter=tabspace
*.y filter=tabspace
*.mm filter=tabspace

View file

@ -35,9 +35,9 @@ static U32 sAIPlayerLoSMask = TerrainObjectType | StaticShapeObjectType | Static
IMPLEMENT_CO_NETOBJECT_V1(AIPlayer);
ConsoleDocClass( AIPlayer,
"@brief A Player object not controlled by conventional input, but by an AI engine.\n\n"
"@brief A Player object not controlled by conventional input, but by an AI engine.\n\n"
"The AIPlayer provides a Player object that may be controlled from script. You control "
"The AIPlayer provides a Player object that may be controlled from script. You control "
"where the player moves and how fast. You may also set where the AIPlayer is aiming at "
"-- either a location or another game object.\n\n"
@ -70,19 +70,19 @@ ConsoleDocClass( AIPlayer,
"position to the center of the target's bounding box. The LOS ray test only checks against interiors, "
"statis shapes, and terrain.\n\n"
"@tsexample\n"
"// Create the demo player object\n"
"%player = new AiPlayer()\n"
"{\n"
" dataBlock = DemoPlayer;\n"
" path = \"\";\n"
"};\n"
"@endtsexample\n\n"
"@tsexample\n"
"// Create the demo player object\n"
"%player = new AiPlayer()\n"
"{\n"
" dataBlock = DemoPlayer;\n"
" path = \"\";\n"
"};\n"
"@endtsexample\n\n"
"@see Player for a list of all inherited functions, variables, and base description\n"
"@see Player for a list of all inherited functions, variables, and base description\n"
"@ingroup AI\n"
"@ingroup gameObjects\n");
"@ingroup AI\n"
"@ingroup gameObjects\n");
/**
* Constructor
*/
@ -147,7 +147,7 @@ void AIPlayer::initPersistFields()
addField( "AttackRadius", TypeF32, Offset( mAttackRadius, AIPlayer ),
"@brief Distance considered in firing range for callback purposes.");
endGroup( "AI" );
#ifdef TORQUE_NAVIGATION_ENABLED
@ -399,11 +399,11 @@ bool AIPlayer::getAIMove(Move *movePtr)
{
clearPath();
mMoveState = ModeStop;
throwCallback("onTargetInRange");
throwCallback("onTargetInRange");
}
else if((getPosition() - mFollowData.object->getPosition()).len() < mAttackRadius)
{
throwCallback("onTargetInFiringRange");
throwCallback("onTargetInFiringRange");
}
}
}
@ -854,7 +854,7 @@ DefineEngineMethod(AIPlayer, getPathDestination, Point3F, (),,
"@see setPathDestination()\n")
{
return object->getPathDestination();
return object->getPathDestination();
}
void AIPlayer::followNavPath(NavPath *path)
@ -1148,7 +1148,7 @@ DefineEngineMethod( AIPlayer, setMoveSpeed, void, ( F32 speed ),,
"@see getMoveDestination()\n")
{
object->setMoveSpeed(speed);
object->setMoveSpeed(speed);
}
DefineEngineMethod( AIPlayer, getMoveSpeed, F32, ( ),,
@ -1186,7 +1186,7 @@ DefineEngineMethod( AIPlayer, getMoveDestination, Point3F, (),,
"@see setMoveDestination()\n")
{
return object->getMoveDestination();
return object->getMoveDestination();
}
DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),,
@ -1196,7 +1196,7 @@ DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),,
"@see getAimLocation()\n")
{
object->setAimLocation(target);
object->setAimLocation(target);
}
DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),,
@ -1212,7 +1212,7 @@ DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),,
"@see setAimLocation()\n"
"@see setAimObject()\n")
{
return object->getAimLocation();
return object->getAimLocation();
}
ConsoleDocFragment _setAimObject(
@ -1240,7 +1240,7 @@ ConsoleDocFragment _setAimObject(
DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )"
"Sets the bot's target object. Optionally set an offset from target location."
"@hide")
"@hide")
{
// Find the target
@ -1262,7 +1262,7 @@ DefineEngineMethod( AIPlayer, getAimObject, S32, (),,
"@see setAimObject()\n")
{
GameBase* obj = object->getAimObject();
GameBase* obj = object->getAimObject();
return obj? obj->getId(): -1;
}

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

@ -540,8 +540,8 @@ void Lightning::renderObject(ObjectRenderInst *ri, SceneRenderState *state, Base
}
//GFX->setZWriteEnable(true);
//GFX->setAlphaTestEnable(false);
//GFX->setAlphaBlendEnable(false);
//GFX->setAlphaTestEnable(false);
//GFX->setAlphaBlendEnable(false);
}
void Lightning::scheduleThunder(Strike* newStrike)
@ -743,9 +743,9 @@ void Lightning::warningFlashes()
{
LightningStrikeEvent* pEvent = new LightningStrikeEvent;
pEvent->mLightning = this;
pEvent->mStart.x = strikePoint.x;
pEvent->mStart.y = strikePoint.y;
pEvent->mStart.x = strikePoint.x;
pEvent->mStart.y = strikePoint.y;
nc->postNetEvent(pEvent);
}
@ -905,7 +905,7 @@ void Lightning::strikeObject(ShapeBase* targetObj)
{
LightningStrikeEvent* pEvent = new LightningStrikeEvent;
pEvent->mLightning = this;
pEvent->mStart.x = strikePoint.x;
pEvent->mStart.y = strikePoint.y;
pEvent->mTarget = targetObj;
@ -1100,7 +1100,7 @@ void LightningBolt::render( const Point3F &camPos )
renderSegment(mMinorNodes[i], camPos, false);
}
PrimBuild::end();
PrimBuild::end();
for(LightingBoltList::Iterator i = splitList.begin(); i != splitList.end(); ++i)
{
@ -1230,7 +1230,7 @@ void LightningBolt::createSplit( const Point3F &startingPoint, const Point3F &en
{
if( depth == 0 )
return;
F32 chanceToEnd = gRandGen.randF();
if( chanceToEnd > 0.70f )
return;
@ -1275,7 +1275,7 @@ void LightningBolt::startSplits()
for( U32 i=0; i<mMajorNodes.numNodes-1; i++ )
{
if( gRandGen.randF() > 0.3f )
continue;
continue;
Node node = mMajorNodes.nodeList[i];
Node node2 = mMajorNodes.nodeList[i+1];

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

@ -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

@ -45,48 +45,48 @@ static const U32 sgAllowedDynamicTypes = 0xffffff;
IMPLEMENT_CO_DATABLOCK_V1(StaticShapeData);
ConsoleDocClass( StaticShapeData,
"@brief The most basic ShapeBaseData derrived shape datablock available in Torque 3D.\n\n"
"@brief The most basic ShapeBaseData derrived shape datablock available in Torque 3D.\n\n"
"When it comes to placing 3D objects in the scene, you effectively have two options:\n\n"
"1. TSStatic objects\n\n"
"2. ShapeBase derived objects\n\n"
"When it comes to placing 3D objects in the scene, you effectively have two options:\n\n"
"1. TSStatic objects\n\n"
"2. ShapeBase derived objects\n\n"
"Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you "
"will use one of its child classes instead. Several game related objects are derived "
"from ShapeBase: Player, Vehicle, Item, and so on.\n\n"
"Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you "
"will use one of its child classes instead. Several game related objects are derived "
"from ShapeBase: Player, Vehicle, Item, and so on.\n\n"
"When you need a 3D object with datablock capabilities, you will use an object derived "
"from ShapeBase. When you need an object with extremely low overhead, and with no other "
"purpose than to be a 3D object in the scene, you will use TSStatic.\n\n"
"When you need a 3D object with datablock capabilities, you will use an object derived "
"from ShapeBase. When you need an object with extremely low overhead, and with no other "
"purpose than to be a 3D object in the scene, you will use TSStatic.\n\n"
"The most basic child of ShapeBase is StaticShape. It does not introduce any of the "
"additional functionality you see in Player, Item, Vehicle or the other game play "
"heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having "
"The most basic child of ShapeBase is StaticShape. It does not introduce any of the "
"additional functionality you see in Player, Item, Vehicle or the other game play "
"heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having "
"a datablock provides a location for common variables as well as having access to "
"various ShapeBaseData, GameBaseData and SimDataBlock callbacks.\n\n"
"@tsexample\n"
"// Create a StaticShape using a datablock\n"
"datablock StaticShapeData(BasicShapeData)\n"
"{\n"
" shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n"
" testVar = \"Simple string, not a stock variable\";\n"
"};\n\n"
"new StaticShape()\n"
"{\n"
" dataBlock = \"BasicShapeData\";\n"
" position = \"0.0 0.0 0.0\";\n"
" rotation = \"1 0 0 0\";\n"
" scale = \"1 1 1\";\n"
"};\n"
"@endtsexample\n\n"
"@tsexample\n"
"// Create a StaticShape using a datablock\n"
"datablock StaticShapeData(BasicShapeData)\n"
"{\n"
" shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n"
" testVar = \"Simple string, not a stock variable\";\n"
"};\n\n"
"new StaticShape()\n"
"{\n"
" dataBlock = \"BasicShapeData\";\n"
" position = \"0.0 0.0 0.0\";\n"
" rotation = \"1 0 0 0\";\n"
" scale = \"1 1 1\";\n"
"};\n"
"@endtsexample\n\n"
"@see StaticShape\n"
"@see StaticShape\n"
"@see ShapeBaseData\n"
"@see TSStatic\n\n"
"@see TSStatic\n\n"
"@ingroup gameObjects\n"
"@ingroup Datablocks");
"@ingroup gameObjects\n"
"@ingroup Datablocks");
StaticShapeData::StaticShapeData()
{
@ -128,47 +128,47 @@ void StaticShapeData::unpackData(BitStream* stream)
IMPLEMENT_CO_NETOBJECT_V1(StaticShape);
ConsoleDocClass( StaticShape,
"@brief The most basic 3D shape with a datablock available in Torque 3D.\n\n"
"@brief The most basic 3D shape with a datablock available in Torque 3D.\n\n"
"When it comes to placing 3D objects in the scene, you technically have two options:\n\n"
"1. TSStatic objects\n\n"
"2. ShapeBase derived objects\n\n"
"When it comes to placing 3D objects in the scene, you technically have two options:\n\n"
"1. TSStatic objects\n\n"
"2. ShapeBase derived objects\n\n"
"Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you "
"will use one of its child classes instead. Several game related objects are derived "
"from ShapeBase: Player, Vehicle, Item, and so on.\n\n"
"Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you "
"will use one of its child classes instead. Several game related objects are derived "
"from ShapeBase: Player, Vehicle, Item, and so on.\n\n"
"When you need a 3D object with datablock capabilities, you will use an object derived "
"from ShapeBase. When you need an object with extremely low overhead, and with no other "
"purpose than to be a 3D object in the scene, you will use TSStatic.\n\n"
"When you need a 3D object with datablock capabilities, you will use an object derived "
"from ShapeBase. When you need an object with extremely low overhead, and with no other "
"purpose than to be a 3D object in the scene, you will use TSStatic.\n\n"
"The most basic child of ShapeBase is StaticShape. It does not introduce any of the "
"additional functionality you see in Player, Item, Vehicle or the other game play "
"heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having "
"The most basic child of ShapeBase is StaticShape. It does not introduce any of the "
"additional functionality you see in Player, Item, Vehicle or the other game play "
"heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having "
"a datablock provides a location for common variables as well as having access to "
"various ShapeBaseData, GameBaseData and SimDataBlock callbacks.\n\n"
"@tsexample\n"
"// Create a StaticShape using a datablock\n"
"datablock StaticShapeData(BasicShapeData)\n"
"{\n"
" shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n"
" testVar = \"Simple string, not a stock variable\";\n"
"};\n\n"
"new StaticShape()\n"
"{\n"
" dataBlock = \"BasicShapeData\";\n"
" position = \"0.0 0.0 0.0\";\n"
" rotation = \"1 0 0 0\";\n"
" scale = \"1 1 1\";\n"
"};\n"
"@endtsexample\n\n"
"@tsexample\n"
"// Create a StaticShape using a datablock\n"
"datablock StaticShapeData(BasicShapeData)\n"
"{\n"
" shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n"
" testVar = \"Simple string, not a stock variable\";\n"
"};\n\n"
"new StaticShape()\n"
"{\n"
" dataBlock = \"BasicShapeData\";\n"
" position = \"0.0 0.0 0.0\";\n"
" rotation = \"1 0 0 0\";\n"
" scale = \"1 1 1\";\n"
"};\n"
"@endtsexample\n\n"
"@see StaticShapeData\n"
"@see ShapeBase\n"
"@see TSStatic\n\n"
"@see StaticShapeData\n"
"@see ShapeBase\n"
"@see TSStatic\n\n"
"@ingroup gameObjects\n");
"@ingroup gameObjects\n");
StaticShape::StaticShape()
{
@ -303,7 +303,7 @@ void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream)
// Marked internal, as this is flagged to be deleted
// [8/1/2010 mperry]
DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)"
"@internal")
"@internal")
{
if(!object->isServerObject())
return;

View file

@ -1222,17 +1222,17 @@ DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0),
"@return the name of the indexed material.\n"
"@see getTargetCount()\n")
{
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
if(obj)
{
// Try to use the client object (so we get the reskinned targets in the Material Editor)
if ((TSStatic*)obj->getClientObject())
obj = (TSStatic*)obj->getClientObject();
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
if(obj)
{
// Try to use the client object (so we get the reskinned targets in the Material Editor)
if ((TSStatic*)obj->getClientObject())
obj = (TSStatic*)obj->getClientObject();
return obj->getShapeInstance()->getTargetName(index);
}
return obj->getShapeInstance()->getTargetName(index);
}
return "";
return "";
}
DefineEngineMethod( TSStatic, getTargetCount, S32,(),,
@ -1240,17 +1240,17 @@ DefineEngineMethod( TSStatic, getTargetCount, S32,(),,
"@return the number of materials in the shape.\n"
"@see getTargetName()\n")
{
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
if(obj)
{
// Try to use the client object (so we get the reskinned targets in the Material Editor)
if ((TSStatic*)obj->getClientObject())
obj = (TSStatic*)obj->getClientObject();
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
if(obj)
{
// Try to use the client object (so we get the reskinned targets in the Material Editor)
if ((TSStatic*)obj->getClientObject())
obj = (TSStatic*)obj->getClientObject();
return obj->getShapeInstance()->getTargetCount();
}
return obj->getShapeInstance()->getTargetCount();
}
return -1;
return -1;
}
// This method is able to change materials per map to with others. The material that is being replaced is being mapped to
@ -1317,10 +1317,10 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
"@return the shape filename\n\n"
"@tsexample\n"
"// Acquire the model filename used on this shape.\n"
"%modelFilename = %obj.getModelFile();\n"
"// Acquire the model filename used on this shape.\n"
"%modelFilename = %obj.getModelFile();\n"
"@endtsexample\n"
)
{
return object->getShapeFileName();
return object->getShapeFileName();
}

File diff suppressed because it is too large Load diff

View file

@ -156,7 +156,7 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect)
if (!conn)
return;
// Requires either a vehicle control object or a vehicle-mounted player
// Requires either a vehicle control object or a vehicle-mounted player
Vehicle* vehicle = dynamic_cast<Vehicle*>(conn->getControlObject());
if(!vehicle){
Player * player = dynamic_cast<Player*>(conn->getControlObject());
@ -183,20 +183,20 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect)
F32 fillOffset = GFX->getFillConventionOffset(); // Find the fill offset
Point2F viewCenter(offset.x + fillOffset + center.x, offset.y + fillOffset + center.y);
// Handle rotation calculations
// Handle rotation calculations
F32 rotation, spinAngle;
rotation = mMinAngle + (mMaxAngle - mMinAngle) * (mSpeed / mMaxSpeed);
spinAngle = mDegToRad(rotation);
MatrixF rotMatrix(EulerF(0.0, 0.0, spinAngle));
// Set up the needle vertex list
Point3F vertList[5];
vertList[0].set(+mNeedleLength,-mNeedleWidth,0);
vertList[1].set(+mNeedleLength,+mNeedleWidth,0);
vertList[2].set(-mTailLength ,+mNeedleWidth,0);
vertList[3].set(-mTailLength ,-mNeedleWidth,0);
vertList[4].set(+mNeedleLength,-mNeedleWidth,0); //// Get back to the start!
// Set up the needle vertex list
Point3F vertList[5];
vertList[0].set(+mNeedleLength,-mNeedleWidth,0);
vertList[1].set(+mNeedleLength,+mNeedleWidth,0);
vertList[2].set(-mTailLength ,+mNeedleWidth,0);
vertList[3].set(-mTailLength ,-mNeedleWidth,0);
vertList[4].set(+mNeedleLength,-mNeedleWidth,0); //// Get back to the start!
// Create a GFXStateBlock description if one has not been set.
if (mBlendSB.isNull())
{

View file

@ -65,7 +65,7 @@ void BadWordFilter::create()
{
Con::addVariable("pref::enableBadWordFilter", TypeBool, &filteringEnabled,
"@brief If true, the bad word filter will be enabled.\n\n"
"@ingroup Game");
"@ingroup Game");
gBadWordFilter = new BadWordFilter;
gBadWordFilter->addBadWord("shit");
gBadWordFilter->addBadWord("fuck");
@ -251,7 +251,7 @@ DefineEngineFunction(addBadWord, bool, (const char* badWord),,
"@ingroup Game")
{
return gBadWordFilter->addBadWord(badWord);
return gBadWordFilter->addBadWord(badWord);
}
DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (nullAsType<const char*>(), nullAsType<const char*>()),
@ -279,17 +279,17 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const
"@ingroup Game")
{
const char *replaceStr = NULL;
const char *replaceStr = NULL;
if(replacementChars)
replaceStr = replacementChars;
else
replaceStr = gBadWordFilter->getDefaultReplaceStr();
if(replacementChars)
replaceStr = replacementChars;
else
replaceStr = gBadWordFilter->getDefaultReplaceStr();
char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1);
dStrcpy(ret, baseString);
gBadWordFilter->filterString(ret, replaceStr);
return ret;
char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1);
dStrcpy(ret, baseString);
gBadWordFilter->filterString(ret, replaceStr);
return ret;
}
DefineEngineFunction(containsBadWords, bool, (const char* text),,
@ -316,17 +316,17 @@ DefineEngineFunction(containsBadWords, bool, (const char* text),,
"// Otherwise print the original text\n"
"if(containsBadWords(%userText))\n"
"{\n"
" // Filter the string\n"
" %filteredText = filterString(%userText, %replacementChars);\n\n"
" // Print filtered text\n"
" echo(%filteredText);\n"
" // Filter the string\n"
" %filteredText = filterString(%userText, %replacementChars);\n\n"
" // Print filtered text\n"
" echo(%filteredText);\n"
"}\n"
"else\n"
" echo(%userText);\n\n"
" echo(%userText);\n\n"
"@endtsexample\n"
"@ingroup Game")
{
return gBadWordFilter->containsBadWords(text);
return gBadWordFilter->containsBadWords(text);
}

File diff suppressed because it is too large Load diff

View file

@ -45,7 +45,7 @@ class SimXMLDocument: public SimObject
{
// This typedef is required for tie ins with the script language.
// --------------------------------------------------------------------------
protected:
protected:
typedef SimObject Parent;
// --------------------------------------------------------------------------
@ -85,8 +85,8 @@ class SimXMLDocument: public SimObject
bool nextSiblingElement(const char* rName);
// push child element at index onto stack.
bool pushChildElement(S32 index);
// Get element value
const char* elementValue();
// Get element value
const char* elementValue();
// Pop last element off of stack.
void popElement(void);
@ -94,16 +94,16 @@ class SimXMLDocument: public SimObject
// Get attribute from top element on element stack.
const char* attribute(const char* rAttribute);
// Does the attribute exist in the current element
// Does the attribute exist in the current element
bool attributeExists(const char* rAttribute);
// Obtain the name of the current element's first or last attribute
const char* firstAttribute();
const char* lastAttribute();
// Obtain the name of the current element's first or last attribute
const char* firstAttribute();
const char* lastAttribute();
// Move through the current element's attributes to obtain their names
const char* nextAttribute();
const char* prevAttribute();
// Move through the current element's attributes to obtain their names
const char* nextAttribute();
const char* prevAttribute();
// Set attribute of top element on element stack.
void setAttribute(const char* rAttribute, const char* rVal);
@ -139,8 +139,8 @@ class SimXMLDocument: public SimObject
TiXmlDocument* m_qDocument;
// Stack of nodes.
Vector<TiXmlElement*> m_paNode;
// The current attribute
TiXmlAttribute* m_CurrentAttribute;
// The current attribute
TiXmlAttribute* m_CurrentAttribute;
public:
DECLARE_CONOBJECT(SimXMLDocument);

View file

@ -102,7 +102,7 @@ public:
/// Returns the value for a given index.
/// Will return a null value for an invalid index
const String& getValueFromIndex( S32 index ) const;
const String& getValueFromIndex( S32 index ) const;
///
S32 getIndexFromKeyValue( const String &key, const String &value ) const;

View file

@ -11,78 +11,78 @@
#define yychar CMDchar
#define yydebug CMDdebug
#define yynerrs CMDnerrs
#define rwDEFINE 258
#define rwENDDEF 259
#define rwDECLARE 260
#define rwDECLARESINGLETON 261
#define rwBREAK 262
#define rwELSE 263
#define rwCONTINUE 264
#define rwGLOBAL 265
#define rwIF 266
#define rwNIL 267
#define rwRETURN 268
#define rwWHILE 269
#define rwDO 270
#define rwENDIF 271
#define rwENDWHILE 272
#define rwENDFOR 273
#define rwDEFAULT 274
#define rwFOR 275
#define rwFOREACH 276
#define rwFOREACHSTR 277
#define rwIN 278
#define rwDATABLOCK 279
#define rwSWITCH 280
#define rwCASE 281
#define rwSWITCHSTR 282
#define rwCASEOR 283
#define rwPACKAGE 284
#define rwNAMESPACE 285
#define rwCLASS 286
#define rwASSERT 287
#define ILLEGAL_TOKEN 288
#define CHRCONST 289
#define INTCONST 290
#define TTAG 291
#define VAR 292
#define IDENT 293
#define TYPEIDENT 294
#define DOCBLOCK 295
#define STRATOM 296
#define TAGATOM 297
#define FLTCONST 298
#define opINTNAME 299
#define opINTNAMER 300
#define opMINUSMINUS 301
#define opPLUSPLUS 302
#define STMT_SEP 303
#define opSHL 304
#define opSHR 305
#define opPLASN 306
#define opMIASN 307
#define opMLASN 308
#define opDVASN 309
#define opMODASN 310
#define opANDASN 311
#define opXORASN 312
#define opORASN 313
#define opSLASN 314
#define opSRASN 315
#define opCAT 316
#define opEQ 317
#define opNE 318
#define opGE 319
#define opLE 320
#define opAND 321
#define opOR 322
#define opSTREQ 323
#define opCOLONCOLON 324
#define opMDASN 325
#define opNDASN 326
#define opNTASN 327
#define opSTRNE 328
#define UNARY 329
#define rwDEFINE 258
#define rwENDDEF 259
#define rwDECLARE 260
#define rwDECLARESINGLETON 261
#define rwBREAK 262
#define rwELSE 263
#define rwCONTINUE 264
#define rwGLOBAL 265
#define rwIF 266
#define rwNIL 267
#define rwRETURN 268
#define rwWHILE 269
#define rwDO 270
#define rwENDIF 271
#define rwENDWHILE 272
#define rwENDFOR 273
#define rwDEFAULT 274
#define rwFOR 275
#define rwFOREACH 276
#define rwFOREACHSTR 277
#define rwIN 278
#define rwDATABLOCK 279
#define rwSWITCH 280
#define rwCASE 281
#define rwSWITCHSTR 282
#define rwCASEOR 283
#define rwPACKAGE 284
#define rwNAMESPACE 285
#define rwCLASS 286
#define rwASSERT 287
#define ILLEGAL_TOKEN 288
#define CHRCONST 289
#define INTCONST 290
#define TTAG 291
#define VAR 292
#define IDENT 293
#define TYPEIDENT 294
#define DOCBLOCK 295
#define STRATOM 296
#define TAGATOM 297
#define FLTCONST 298
#define opINTNAME 299
#define opINTNAMER 300
#define opMINUSMINUS 301
#define opPLUSPLUS 302
#define STMT_SEP 303
#define opSHL 304
#define opSHR 305
#define opPLASN 306
#define opMIASN 307
#define opMLASN 308
#define opDVASN 309
#define opMODASN 310
#define opANDASN 311
#define opXORASN 312
#define opORASN 313
#define opSLASN 314
#define opSRASN 315
#define opCAT 316
#define opEQ 317
#define opNE 318
#define opGE 319
#define opLE 320
#define opAND 321
#define opOR 322
#define opSTREQ 323
#define opCOLONCOLON 324
#define opMDASN 325
#define opNDASN 326
#define opNTASN 327
#define opSTRNE 328
#define UNARY 329
#line 1 "cmdgram.y"
@ -182,9 +182,9 @@ typedef
#define YYFINAL 388
#define YYFLAG -32768
#define YYNTBASE 100
#define YYFINAL 388
#define YYFLAG -32768
#define YYNTBASE 100
#define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140)
@ -502,7 +502,7 @@ static const short yypgoto[] = {-32768,
};
#define YYLAST 3042
#define YYLAST 3042
static const short yytable[] = { 47,
@ -1183,50 +1183,50 @@ void *alloca ();
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYPURE
#define YYLEX yylex()
#define YYLEX yylex()
#endif
#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval, &yylloc)
#define YYLEX yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX yylex(&yylval)
#define YYLEX yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif
@ -1235,27 +1235,27 @@ while (0)
#ifndef YYPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
@ -1275,9 +1275,9 @@ int yydebug; /* nonzero means print parse trace */
int yyparse (void);
#endif
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
#ifndef __cplusplus
/* This is the most reliable way to avoid incompatibilities
@ -1337,17 +1337,17 @@ yyparse(YYPARSE_PARAM)
int yyn;
short *yyssp;
YYSTYPE *yyvsp;
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
#ifdef YYLSP_NEEDED
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
@ -1367,9 +1367,9 @@ yyparse(YYPARSE_PARAM)
#endif
#endif
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
int yylen;
@ -1381,7 +1381,7 @@ yyparse(YYPARSE_PARAM)
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
@ -1416,20 +1416,20 @@ yynewstate:
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
the data in use in that stack, in bytes. */
#ifdef YYLSP_NEEDED
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
but that might be undefined if yyoverflow is a macro. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
&yystacksize);
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yyls1, size * sizeof (*yylsp),
&yystacksize);
#else
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yystacksize);
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
&yystacksize);
#endif
yyss = yyss1; yyvs = yyvs1;
@ -1439,13 +1439,13 @@ yynewstate:
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
return 2;
}
{
yyerror("parser stack overflow");
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
@ -1464,11 +1464,11 @@ yynewstate:
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
YYABORT;
}
#if YYDEBUG != 0
@ -1498,21 +1498,21 @@ yynewstate:
{
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Reading a token: ");
fprintf(stderr, "Reading a token: ");
#endif
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
yychar = YYEOF; /* Don't call YYLEX any more */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Now at end of input.\n");
fprintf(stderr, "Now at end of input.\n");
#endif
}
else
@ -1521,15 +1521,15 @@ yynewstate:
#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise meaning
of a token, for further debugging info. */
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise meaning
of a token, for further debugging info. */
#ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
YYPRINT (stderr, yychar, yylval);
#endif
fprintf (stderr, ")\n");
}
fprintf (stderr, ")\n");
}
#endif
}
@ -1549,7 +1549,7 @@ yynewstate:
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@ -1600,11 +1600,11 @@ yyreduce:
int i;
fprintf (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
@ -2265,7 +2265,7 @@ case 162:
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
@ -2315,44 +2315,44 @@ yyerrlab: /* here on detecting error */
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
{
int size = 0;
char *msg;
int x, count;
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
count = 0;
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) malloc(size + 15);
if (msg != 0)
{
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
if (count < 5)
{
count = 0;
for (x = (yyn < 0 ? -yyn : 0);
x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
yyerror ("parse error; also virtual memory exceeded");
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
yyerror("parse error");
}
goto yyerrlab1;
@ -2364,11 +2364,11 @@ yyerrlab1: /* here on error raised explicitly by an action */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
YYABORT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
yychar = YYEMPTY;
@ -2377,7 +2377,7 @@ yyerrlab1: /* here on error raised explicitly by an action */
/* Else will try to reuse lookahead token
after shifting the error token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
@ -2405,7 +2405,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
@ -2424,7 +2424,7 @@ yyerrhandle:
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}

View file

@ -15,78 +15,78 @@ typedef union {
AssignDecl asn;
IfStmtNode* ifnode;
} YYSTYPE;
#define rwDEFINE 258
#define rwENDDEF 259
#define rwDECLARE 260
#define rwDECLARESINGLETON 261
#define rwBREAK 262
#define rwELSE 263
#define rwCONTINUE 264
#define rwGLOBAL 265
#define rwIF 266
#define rwNIL 267
#define rwRETURN 268
#define rwWHILE 269
#define rwDO 270
#define rwENDIF 271
#define rwENDWHILE 272
#define rwENDFOR 273
#define rwDEFAULT 274
#define rwFOR 275
#define rwFOREACH 276
#define rwFOREACHSTR 277
#define rwIN 278
#define rwDATABLOCK 279
#define rwSWITCH 280
#define rwCASE 281
#define rwSWITCHSTR 282
#define rwCASEOR 283
#define rwPACKAGE 284
#define rwNAMESPACE 285
#define rwCLASS 286
#define rwASSERT 287
#define ILLEGAL_TOKEN 288
#define CHRCONST 289
#define INTCONST 290
#define TTAG 291
#define VAR 292
#define IDENT 293
#define TYPEIDENT 294
#define DOCBLOCK 295
#define STRATOM 296
#define TAGATOM 297
#define FLTCONST 298
#define opINTNAME 299
#define opINTNAMER 300
#define opMINUSMINUS 301
#define opPLUSPLUS 302
#define STMT_SEP 303
#define opSHL 304
#define opSHR 305
#define opPLASN 306
#define opMIASN 307
#define opMLASN 308
#define opDVASN 309
#define opMODASN 310
#define opANDASN 311
#define opXORASN 312
#define opORASN 313
#define opSLASN 314
#define opSRASN 315
#define opCAT 316
#define opEQ 317
#define opNE 318
#define opGE 319
#define opLE 320
#define opAND 321
#define opOR 322
#define opSTREQ 323
#define opCOLONCOLON 324
#define opMDASN 325
#define opNDASN 326
#define opNTASN 327
#define opSTRNE 328
#define UNARY 329
#define rwDEFINE 258
#define rwENDDEF 259
#define rwDECLARE 260
#define rwDECLARESINGLETON 261
#define rwBREAK 262
#define rwELSE 263
#define rwCONTINUE 264
#define rwGLOBAL 265
#define rwIF 266
#define rwNIL 267
#define rwRETURN 268
#define rwWHILE 269
#define rwDO 270
#define rwENDIF 271
#define rwENDWHILE 272
#define rwENDFOR 273
#define rwDEFAULT 274
#define rwFOR 275
#define rwFOREACH 276
#define rwFOREACHSTR 277
#define rwIN 278
#define rwDATABLOCK 279
#define rwSWITCH 280
#define rwCASE 281
#define rwSWITCHSTR 282
#define rwCASEOR 283
#define rwPACKAGE 284
#define rwNAMESPACE 285
#define rwCLASS 286
#define rwASSERT 287
#define ILLEGAL_TOKEN 288
#define CHRCONST 289
#define INTCONST 290
#define TTAG 291
#define VAR 292
#define IDENT 293
#define TYPEIDENT 294
#define DOCBLOCK 295
#define STRATOM 296
#define TAGATOM 297
#define FLTCONST 298
#define opINTNAME 299
#define opINTNAMER 300
#define opMINUSMINUS 301
#define opPLUSPLUS 302
#define STMT_SEP 303
#define opSHL 304
#define opSHR 305
#define opPLASN 306
#define opMIASN 307
#define opMLASN 308
#define opDVASN 309
#define opMODASN 310
#define opANDASN 311
#define opXORASN 312
#define opORASN 313
#define opSLASN 314
#define opSRASN 315
#define opCAT 316
#define opEQ 317
#define opNE 318
#define opGE 319
#define opLE 320
#define opAND 321
#define opOR 322
#define opSTREQ 323
#define opCOLONCOLON 324
#define opMDASN 325
#define opNDASN 326
#define opNTASN 327
#define opSTRNE 328
#define UNARY 329
extern YYSTYPE CMDlval;

View file

@ -242,7 +242,7 @@ inline void ExprEvalState::setCurVarName(StringTableEntry name)
else if( getStackDepth() > 0 )
currentVariable = getCurrentFrame().lookup(name);
if(!currentVariable && gWarnUndefinedScriptVariables)
Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name);
Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name);
}
inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name)
@ -316,7 +316,7 @@ inline void ExprEvalState::setCopyVariable()
default:
currentVariable->setStringValue(copyVariable->getStringValue());
break;
}
}
}
}
@ -398,7 +398,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const
// Ensure that the variable has a value
if (!prevVal)
return;
return;
static const StringTableEntry xyzw[] =
{
@ -419,7 +419,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const
// Insert the value into the specified
// component of the string.
if ( subField == xyzw[0] || subField == rgba[0] )
dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") );
dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") );
else if ( subField == xyzw[1] || subField == rgba[1] )
dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") );
@ -1020,7 +1020,7 @@ breakContinue:
dataBlock->deleteObject();
currentNewObject = NULL;
ip = failJump;
// Prevent stack value corruption
CSTK.popFrame();
STR.popFrame();
@ -1164,8 +1164,8 @@ breakContinue:
// This fixes a bug when not explicitly returning a value.
case OP_RETURN_VOID:
STR.setStringValue("");
// We're falling thru here on purpose.
STR.setStringValue("");
// We're falling thru here on purpose.
case OP_RETURN:
retValue = STR.getStringValuePtr();
@ -1437,7 +1437,7 @@ breakContinue:
case OP_SAVEVAR_STR:
gEvalState.setStringVariable(STR.getStringValue());
break;
case OP_SAVEVAR_VAR:
// this basically handles %var1 = %var2
gEvalState.setCopyVariable();

View file

@ -278,8 +278,8 @@ bool useTimestamp = false;
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
DefineConsoleFunction( cls, void, (), , "()"
"@brief Clears the console output.\n\n"
"@ingroup Console")
"@brief Clears the console output.\n\n"
"@ingroup Console")
{
if(consoleLogLocked)
return;
@ -288,17 +288,17 @@ DefineConsoleFunction( cls, void, (), , "()"
};
DefineConsoleFunction( getClipboard, const char*, (), , "()"
"@brief Get text from the clipboard.\n\n"
"@internal")
"@brief Get text from the clipboard.\n\n"
"@internal")
{
return Platform::getClipboard();
return Platform::getClipboard();
};
DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)"
"@brief Set the system clipboard.\n\n"
"@internal")
"@internal")
{
return Platform::setClipboard(text);
return Platform::setClipboard(text);
};
ConsoleFunctionGroupEnd( Clipboard );
@ -332,25 +332,25 @@ void init()
// Variables
setVariable("Con::prompt", "% ");
addVariable("Con::logBufferEnabled", TypeBool, &logBufferEnabled, "If true, the log buffer will be enabled.\n"
"@ingroup Console\n");
"@ingroup Console\n");
addVariable("Con::printLevel", TypeS32, &printLevel,
"@brief This is deprecated.\n\n"
"It is no longer in use and does nothing.\n"
"@ingroup Console\n");
"@ingroup Console\n");
addVariable("Con::warnUndefinedVariables", TypeBool, &gWarnUndefinedScriptVariables, "If true, a warning will be displayed in the console whenever a undefined variable is used in script.\n"
"@ingroup Console\n");
"@ingroup Console\n");
addVariable( "instantGroup", TypeRealString, &gInstantGroup, "The group that objects will be added to when they are created.\n"
"@ingroup Console\n");
"@ingroup Console\n");
addVariable("Con::objectCopyFailures", TypeS32, &gObjectCopyFailures, "If greater than zero then it counts the number of object creation "
"failures based on a missing copy object and does not report an error..\n"
"@ingroup Console\n");
"@ingroup Console\n");
// Current script file name and root
addVariable( "Con::File", TypeString, &gCurrentFile, "The currently executing script file.\n"
"@ingroup FileSystem\n");
"@ingroup FileSystem\n");
addVariable( "Con::Root", TypeString, &gCurrentRoot, "The mod folder for the currently executing script file.\n"
"@ingroup FileSystem\n" );
"@ingroup FileSystem\n" );
// alwaysUseDebugOutput determines whether to send output to the platform's
// "debug" system. see winConsole for an example.
@ -364,14 +364,14 @@ void init()
addVariable("Con::alwaysUseDebugOutput", TypeBool, &alwaysUseDebugOutput,
"@brief Determines whether to send output to the platform's \"debug\" system.\n\n"
"@note This is disabled in shipping builds.\n"
"@ingroup Console");
"@ingroup Console");
#else
alwaysUseDebugOutput = false;
#endif
// controls whether a timestamp is prepended to every console message
addVariable("Con::useTimestamp", TypeBool, &useTimestamp, "If true a timestamp is prepended to every console message.\n"
"@ingroup Console\n");
"@ingroup Console\n");
// Plug us into the journaled console input signal.
smConsoleInput.notify(postConsoleInput);
@ -599,7 +599,7 @@ static void log(const char *string)
static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, const char* fmt, va_list argptr)
{
if (!active)
return;
return;
Con::active = false;
char buffer[8192];
@ -781,7 +781,7 @@ Dictionary::Entry *getAddVariableEntry(const char *name)
StringTableEntry stName = StringTable->insert(name);
Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName);
if (!entry)
entry = gEvalState.globalVars.add(stName);
entry = gEvalState.globalVars.add(stName);
return entry;
}
@ -791,7 +791,7 @@ Dictionary::Entry *getAddLocalVariableEntry(const char *name)
StringTableEntry stName = StringTable->insert(name);
Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName);
if (!entry)
entry = gEvalState.getCurrentFrame().add(stName);
entry = gEvalState.getCurrentFrame().add(stName);
return entry;
}
@ -802,7 +802,7 @@ void setVariable(const char *name, const char *value)
if (getVariableObjectField(name, &obj, &objField))
{
obj->setDataField(StringTable->insert(objField), 0, value);
obj->setDataField(StringTable->insert(objField), 0, value);
}
else
{
@ -824,13 +824,13 @@ void setBoolVariable(const char *varName, bool value)
if (getVariableObjectField(varName, &obj, &objField))
{
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
}
else
{
varName = prependDollar(varName);
Dictionary::Entry *entry = getAddVariableEntry(varName);
entry->setStringValue(value ? "1" : "0");
entry->setStringValue(value ? "1" : "0");
}
}
@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value)
if (getVariableObjectField(varName, &obj, &objField))
{
char scratchBuffer[32];
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
char scratchBuffer[32];
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
}
else
{
@ -860,15 +860,15 @@ void setFloatVariable(const char *varName, F32 value)
if (getVariableObjectField(varName, &obj, &objField))
{
char scratchBuffer[32];
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
char scratchBuffer[32];
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
}
else
{
varName = prependDollar(varName);
Dictionary::Entry *entry = getAddVariableEntry(varName);
entry->setFloatValue(value);
entry->setFloatValue(value);
}
}
@ -1020,7 +1020,7 @@ F32 getFloatVariable(const char *varName, F32 def)
else
{
Dictionary::Entry *entry = getVariableEntry(varName);
return entry ? entry->getFloatValue() : def;
return entry ? entry->getFloatValue() : def;
}
}
@ -1308,8 +1308,8 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript)
// Let's do a sanity check to complain about DSOs in the future.
//
// MM: This doesn't seem to be working correctly for now so let's just not issue
// the warning until someone knows how to resolve it.
// MM: This doesn't seem to be working correctly for now so let's just not issue
// the warning until someone knows how to resolve it.
//
//if(compiled && rCom && rScr && Platform::compareFileTimes(comModifyTime, scrModifyTime) < 0)
//{
@ -1515,7 +1515,7 @@ ConsoleValueRef execute(S32 argc, ConsoleValueRef argv[])
#endif
ConsoleStackFrameSaver stackSaver;
stackSaver.save();
return _internalExecute(argc, argv);
return _internalExecute(argc, argv);
#ifdef TORQUE_MULTITHREAD
}
else
@ -2616,7 +2616,7 @@ const char *ConsoleValue::getStringValue()
U32 stringLen = dStrlen(internalValue);
U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line
if (bufferLen == 0)
sval = (char *) dMalloc(newLen);
else if(newLen > bufferLen)

View file

@ -45,7 +45,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi
"@brief Dumps all declared console classes to the console.\n\n"
"@param dumpScript Optional parameter specifying whether or not classes defined in script should be dumped.\n"
"@param dumpEngine Optional parameter specifying whether or not classes defined in the engine should be dumped.\n"
"@ingroup Logging")
"@ingroup Logging")
{
Namespace::dumpClasses( dumpScript, dumpEngine );
}
@ -54,7 +54,7 @@ DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEn
"@brief Dumps all declared console functions to the console.\n"
"@param dumpScript Optional parameter specifying whether or not functions defined in script should be dumped.\n"
"@param dumpEngine Optional parameter specitying whether or not functions defined in the engine should be dumped.\n"
"@ingroup Logging")
"@ingroup Logging")
{
Namespace::dumpFunctions( dumpScript, dumpEngine );
}

View file

@ -463,12 +463,12 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle,
U32 sublen = dStrlen( needle );
U32 strlen = dStrlen( haystack );
S32 start = strlen - offset;
if(start < 0 || start > strlen)
return -1;
if (start + sublen > strlen)
start = strlen - sublen;
start = strlen - sublen;
for(; start >= 0; start--)
if(!dStrncmp(haystack + start, needle, sublen))
return start;
@ -1022,15 +1022,15 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32
//----------------------------------------------------------------
DefineConsoleFunction(ColorFloatToInt, ColorI, (ColorF color), ,
"Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n"
"@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n"
"@return Converted color value (0 - 255)\n\n"
"@tsexample\n"
"ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n"
"@endtsexample\n"
"@ingroup Strings")
"Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n"
"@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n"
"@return Converted color value (0 - 255)\n\n"
"@tsexample\n"
"ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n"
"@endtsexample\n"
"@ingroup Strings")
{
return (ColorI)color;
return (ColorI)color;
}
DefineConsoleFunction(ColorIntToFloat, ColorF, (ColorI color), ,
@ -1201,8 +1201,8 @@ DefineConsoleFunction( isValidIP, bool, ( const char* str),,
ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
"Adds case sensitive strings to the StringTable.")
{
for(int i = 1; i < argc; i++)
StringTable->insert(argv[i], true);
for(int i = 1; i < argc; i++)
StringTable->insert(argv[i], true);
}
//=============================================================================
@ -1645,7 +1645,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t
"@endtsexample\n\n"
"@ingroup Strings" )
{
char buffer[4096];
char buffer[4096];
dStrncpy(buffer, str1, 4096);
char *str = buffer;
@ -1812,7 +1812,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
"{\n"
" onChatMessage(detag(%msgString), %voice, %pitch);\n"
"}\n"
"@endtsexample\n\n"
"@endtsexample\n\n"
"@see \\ref syntaxDataTypes under Tagged %Strings\n"
"@see getTag()\n"
@ -2017,8 +2017,8 @@ DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),,
//-----------------------------------------------------------------------------
DefineEngineFunction( setLogMode, void, ( S32 mode ),,
"@brief Determines how log files are written.\n\n"
"Sets the operational mode of the console logging system.\n\n"
"@brief Determines how log files are written.\n\n"
"Sets the operational mode of the console logging system.\n\n"
"@param mode Parameter specifying the logging mode. This can be:\n"
"- 1: Open and close the console log file for each seperate string of output. This will ensure that all "
"parts get written out to disk and that no parts remain in intermediate buffers even if the process crashes.\n"
@ -2030,8 +2030,8 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),,
"combined by binary OR with 0x4 to cause the logging system to flush all console log messages that had already been "
"issued to the console system into the newly created log file.\n\n"
"@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead."
"@ingroup Logging" )
"@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead."
"@ingroup Logging" )
{
Con::setLogMode( mode );
}
@ -2144,7 +2144,7 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),,
DefineEngineFunction( displaySplashWindow, bool, (const char* path), (""),
"Display a startup splash window suitable for showing while the engine still starts up.\n\n"
"@note This is currently only implemented on Windows.\n\n"
"@param path relative path to splash screen image to display.\n"
"@param path relative path to splash screen image to display.\n"
"@return True if the splash window could be successfully initialized.\n\n"
"@ingroup Platform" )
{
@ -2395,19 +2395,19 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val
}
DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)"
"@brief Determines if a function exists or not\n\n"
"@param funcName String containing name of the function\n"
"@return True if the function exists, false if not\n"
"@ingroup Scripting")
"@brief Determines if a function exists or not\n\n"
"@param funcName String containing name of the function\n"
"@return True if the function exists, false if not\n"
"@ingroup Scripting")
{
return Con::isFunction(funcName);
}
DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)"
"@brief Provides the name of the package the function belongs to\n\n"
"@param funcName String containing name of the function\n"
"@return The name of the function's package\n"
"@ingroup Packages")
"@brief Provides the name of the package the function belongs to\n\n"
"@param funcName String containing name of the function\n"
"@return The name of the function's package\n"
"@ingroup Packages")
{
Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( funcName ) );
if( !nse )
@ -2417,11 +2417,11 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName )
}
DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
"@brief Determines if a class/namespace method exists\n\n"
"@param namespace Class or namespace, such as Player\n"
"@param method Name of the function to search for\n"
"@return True if the method exists, false if not\n"
"@ingroup Scripting\n")
"@brief Determines if a class/namespace method exists\n\n"
"@param namespace Class or namespace, such as Player\n"
"@param method Name of the function to search for\n"
"@return True if the method exists, false if not\n"
"@ingroup Scripting\n")
{
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
@ -2432,11 +2432,11 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth
}
DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
"@brief Provides the name of the package the method belongs to\n\n"
"@param namespace Class or namespace, such as Player\n"
"@param method Name of the funciton to search for\n"
"@return The name of the method's package\n"
"@ingroup Packages")
"@brief Provides the name of the package the method belongs to\n\n"
"@param namespace Class or namespace, such as Player\n"
"@param method Name of the funciton to search for\n"
"@return The name of the method's package\n"
"@ingroup Packages")
{
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
if( !ns )
@ -2450,13 +2450,13 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c
}
DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)"
"@brief Determines if a variable exists and contains a value\n"
"@param varName Name of the variable to search for\n"
"@return True if the variable was defined in script, false if not\n"
"@brief Determines if a variable exists and contains a value\n"
"@param varName Name of the variable to search for\n"
"@return True if the variable was defined in script, false if not\n"
"@tsexample\n"
"isDefined( \"$myVar\" );\n"
"@endtsexample\n\n"
"@ingroup Scripting")
"@ingroup Scripting")
{
if(String::isEmpty(varName))
{
@ -2595,10 +2595,10 @@ DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()"
}
DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)"
"@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n"
"@param File path of mod folder\n"
"@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n"
"@internal")
"@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n"
"@param File path of mod folder\n"
"@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n"
"@internal")
{
StringTableEntry modPath = Con::getModNameFromPath(path);
return modPath ? modPath : "";
@ -2607,11 +2607,11 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), ,
//-----------------------------------------------------------------------------
DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])"
"@brief Pushes the current $instantGroup on a stack "
"and sets it to the given value (or clears it).\n\n"
"@note Currently only used for editors\n"
"@ingroup Editors\n"
"@internal")
"@brief Pushes the current $instantGroup on a stack "
"and sets it to the given value (or clears it).\n\n"
"@note Currently only used for editors\n"
"@ingroup Editors\n"
"@internal")
{
if( group.size() > 0 )
Con::pushInstantGroup( group );
@ -2620,10 +2620,10 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group]
}
DefineConsoleFunction( popInstantGroup, void, (), , "()"
"@brief Pop and restore the last setting of $instantGroup off the stack.\n\n"
"@note Currently only used for editors\n\n"
"@ingroup Editors\n"
"@internal")
"@brief Pop and restore the last setting of $instantGroup off the stack.\n\n"
"@note Currently only used for editors\n\n"
"@ingroup Editors\n"
"@internal")
{
Con::popInstantGroup();
}
@ -2631,8 +2631,8 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()"
//-----------------------------------------------------------------------------
DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])"
"@note Appears to be useless in Torque 3D, should be deprecated\n"
"@internal")
"@note Appears to be useless in Torque 3D, should be deprecated\n"
"@internal")
{
const char *filename = Platform::getPrefsPath(relativeFileName);
if(filename == NULL || *filename == 0)
@ -2644,13 +2644,13 @@ DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileNam
//-----------------------------------------------------------------------------
ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )"
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
"@param relativeFileName Name and path to file from project folder\n"
"@param noCalls Deprecated\n"
"@param journalScript Deprecated\n"
"@return True if script was successfully executed\n"
"@note Appears to be useless in Torque 3D, should be deprecated\n"
"@ingroup Scripting")
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
"@param relativeFileName Name and path to file from project folder\n"
"@param noCalls Deprecated\n"
"@param journalScript Deprecated\n"
"@return True if script was successfully executed\n"
"@note Appears to be useless in Torque 3D, should be deprecated\n"
"@ingroup Scripting")
{
const char *filename = Platform::getPrefsPath(argv[1]);
if(filename == NULL || *filename == 0)
@ -2791,8 +2791,8 @@ DefineEngineFunction( isToolBuild, bool, (),,
}
DefineEngineFunction( getMaxDynamicVerts, S32, (),,
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
"@return the max number of allowable dynamic vertices in a single vertex buffer" )
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
"@return the max number of allowable dynamic vertices in a single vertex buffer" )
{
return MAX_DYNAMIC_VERTS / 2;
}

View file

@ -510,7 +510,7 @@ void ConsoleValue::setStringValue(const char * value)
return;
}
*/
if (value == typeValueEmpty)
if (value == typeValueEmpty)
{
if (bufferLen > 0)
{
@ -544,7 +544,7 @@ void ConsoleValue::setStringValue(const char * value)
// may as well pad to the next cache line
U32 newLen = ((stringLen + 1) + 15) & ~15;
if(bufferLen == 0)
sval = (char *) dMalloc(newLen);
else if(newLen > bufferLen)
@ -573,7 +573,7 @@ void ConsoleValue::setStackStringValue(const char *value)
bufferLen = 0;
}
if (value == typeValueEmpty)
if (value == typeValueEmpty)
{
sval = typeValueEmpty;
fval = 0.f;
@ -607,7 +607,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
if(type <= ConsoleValue::TypeInternalString)
{
const char *value = StringStackPtrRef(ptrValue).getPtr(&STR);
if (bufferLen > 0)
if (bufferLen > 0)
{
dFree(sval);
bufferLen = 0;
@ -1418,14 +1418,14 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE
case StringCallbackType:
return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv)));
case IntCallbackType:
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
case FloatCallbackType:
return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
case VoidCallbackType:
cb.mVoidCallbackFunc(state->thisObject, argc, argv);
return ConsoleValueRef();
case BoolCallbackType:
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
}
return ConsoleValueRef();

View file

@ -226,20 +226,20 @@ void ConsoleLogger::log( const char *consoleLine )
//-----------------------------------------------------------------------------
DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file"
"@tsexample\n"
"// Create the logger\n"
"// Will automatically start writing to testLogging.txt with normal priority\n"
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
"// Send something to the console, with the logger consumes and writes to file\n"
"echo(\"This is logged to the file\");\n\n"
"// Stop logging, but do not delete the logger\n"
"logger.detach();\n\n"
"echo(\"This is not logged to the file\");\n\n"
"// Attach the logger to the console again\n"
"logger.attach();\n\n"
"// Logging has resumed\n"
"echo(\"Logging has resumed\");"
"@endtsexample\n\n")
"@tsexample\n"
"// Create the logger\n"
"// Will automatically start writing to testLogging.txt with normal priority\n"
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
"// Send something to the console, with the logger consumes and writes to file\n"
"echo(\"This is logged to the file\");\n\n"
"// Stop logging, but do not delete the logger\n"
"logger.detach();\n\n"
"echo(\"This is not logged to the file\");\n\n"
"// Attach the logger to the console again\n"
"logger.attach();\n\n"
"// Logging has resumed\n"
"echo(\"Logging has resumed\");"
"@endtsexample\n\n")
{
ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
return logger->attach();
@ -248,20 +248,20 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger
//-----------------------------------------------------------------------------
DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file"
"@tsexample\n"
"// Create the logger\n"
"// Will automatically start writing to testLogging.txt with normal priority\n"
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
"// Send something to the console, with the logger consumes and writes to file\n"
"echo(\"This is logged to the file\");\n\n"
"// Stop logging, but do not delete the logger\n"
"logger.detach();\n\n"
"echo(\"This is not logged to the file\");\n\n"
"// Attach the logger to the console again\n"
"logger.attach();\n\n"
"// Logging has resumed\n"
"echo(\"Logging has resumed\");"
"@endtsexample\n\n")
"@tsexample\n"
"// Create the logger\n"
"// Will automatically start writing to testLogging.txt with normal priority\n"
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
"// Send something to the console, with the logger consumes and writes to file\n"
"echo(\"This is logged to the file\");\n\n"
"// Stop logging, but do not delete the logger\n"
"logger.detach();\n\n"
"echo(\"This is not logged to the file\");\n\n"
"// Attach the logger to the console again\n"
"logger.attach();\n\n"
"// Logging has resumed\n"
"echo(\"Logging has resumed\");"
"@endtsexample\n\n")
{
ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
return logger->detach();

View file

@ -334,15 +334,15 @@ AbstractClassRep *AbstractClassRep::getCommonParent( const AbstractClassRep *oth
static char replacebuf[1024];
static char* suppressSpaces(const char* in_pname)
{
U32 i = 0;
char chr;
do
{
chr = in_pname[i];
replacebuf[i++] = (chr != 32) ? chr : '_';
} while(chr);
U32 i = 0;
char chr;
do
{
chr = in_pname[i];
replacebuf[i++] = (chr != 32) ? chr : '_';
} while(chr);
return replacebuf;
return replacebuf;
}
void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDocs)
@ -740,8 +740,8 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu
//------------------------------------------------------------------------------
DefineEngineFunction( isClass, bool, ( const char* identifier ),,
"@brief Returns true if the passed identifier is the name of a declared class.\n\n"
"@ingroup Console")
"@brief Returns true if the passed identifier is the name of a declared class.\n\n"
"@ingroup Console")
{
AbstractClassRep* rep = AbstractClassRep::findClassRep( identifier );
return rep != NULL;
@ -765,10 +765,10 @@ DefineEngineFunction( isMemberOfClass, bool, ( const char* className, const char
}
DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* className ),,
"@brief Returns the description string for the named class.\n\n"
"@param className The name of the class.\n"
"@return The class description in string format.\n"
"@ingroup Console")
"@brief Returns the description string for the named class.\n\n"
"@param className The name of the class.\n"
"@return The class description in string format.\n"
"@ingroup Console")
{
AbstractClassRep* rep = AbstractClassRep::findClassRep( className );
if( rep )
@ -779,9 +779,9 @@ DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* classNam
}
DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className ),,
"@brief Returns the category of the given class.\n\n"
"@param className The name of the class.\n"
"@ingroup Console")
"@brief Returns the category of the given class.\n\n"
"@param className The name of the class.\n"
"@ingroup Console")
{
AbstractClassRep* rep = AbstractClassRep::findClassRep( className );
if( rep )
@ -792,12 +792,12 @@ DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className
}
DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* className ), ( "" ),
"@brief Returns a list of classes that derive from the named class.\n\n"
"@brief Returns a list of classes that derive from the named class.\n\n"
"If the named class is omitted this dumps all the classes.\n"
"@param className The optional base class name.\n"
"@return A tab delimited list of classes.\n"
"@return A tab delimited list of classes.\n"
"@ingroup Editors\n"
"@internal")
"@internal")
{
AbstractClassRep *base = NULL;
if(className && *className)
@ -822,11 +822,11 @@ DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* classN
}
DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String category ),,
"@brief Provide a list of classes that belong to the given category.\n\n"
"@param category The category name.\n"
"@return A tab delimited list of classes.\n"
"@ingroup Editors\n"
"@internal")
"@brief Provide a list of classes that belong to the given category.\n\n"
"@param category The category name.\n"
"@return A tab delimited list of classes.\n"
"@ingroup Editors\n"
"@internal")
{
U32 categoryLength = category.length();
@ -914,10 +914,10 @@ DefineEngineFunction( dumpNetStats, void, (),,
}
DefineEngineFunction( sizeof, S32, ( const char *objectOrClass ),,
"@brief Determines the memory consumption of a class or object.\n\n"
"@param objectOrClass The object or class being measured.\n"
"@return Returns the total size of an object in bytes.\n"
"@ingroup Debugging\n")
"@brief Determines the memory consumption of a class or object.\n\n"
"@param objectOrClass The object or class being measured.\n"
"@return Returns the total size of an object in bytes.\n"
"@ingroup Debugging\n")
{
AbstractClassRep *acr = NULL;
SimObject *obj = Sim::findObject(objectOrClass);

View file

@ -35,21 +35,21 @@ static ConsoleParser *gDefaultParser = NULL;
void freeConsoleParserList(void)
{
while(gParserList)
{
while(gParserList)
{
ConsoleParser * pParser = gParserList;
gParserList = pParser->next;
delete pParser;
}
gParserList = pParser->next;
delete pParser;
}
gDefaultParser = NULL;
gDefaultParser = NULL;
}
bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnParse p, fnRestart r, fnSetScanBuffer ssb, bool def)
{
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
ConsoleParser * pParser = new ConsoleParser;
ConsoleParser * pParser = new ConsoleParser;
pParser->ext = ext;
pParser->getCurrentFile = gcf;
@ -69,23 +69,23 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP
ConsoleParser * getParserForFile(const char *filename)
{
if(filename == NULL)
return gDefaultParser;
if(filename == NULL)
return gDefaultParser;
char *ptr = dStrrchr((char *)filename, '.');
if(ptr != NULL)
{
ptr++;
char *ptr = dStrrchr((char *)filename, '.');
if(ptr != NULL)
{
ptr++;
ConsoleParser *p;
for(p = gParserList; p; p = p->next)
{
if(dStricmp(ptr, p->ext) == 0)
return p;
}
}
ConsoleParser *p;
for(p = gParserList; p; p = p->next)
{
if(dStricmp(ptr, p->ext) == 0)
return p;
}
}
return gDefaultParser;
return gDefaultParser;
}
} // end namespace Con

View file

@ -57,15 +57,15 @@ typedef void (*fnSetScanBuffer)(const char *sb, const char *fn);
//-----------------------------------------------------------------------------
struct ConsoleParser
{
struct ConsoleParser *next; //!< Next object in list or NULL
struct ConsoleParser *next; //!< Next object in list or NULL
char *ext; //!< Filename extension handled by this parser
fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function
fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function
fnParse parse; //!< Parse lexer function
fnRestart restart; //!< Restart lexer function
fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function
char *ext; //!< Filename extension handled by this parser
fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function
fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function
fnParse parse; //!< Parse lexer function
fnRestart restart; //!< Restart lexer function
fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function
};
// Macros
@ -74,18 +74,18 @@ struct ConsoleParser
/// \brief Declare a parser's function prototypes
//-----------------------------------------------------------------------------
#define CON_DECLARE_PARSER(prefix) \
const char * prefix##GetCurrentFile(); \
S32 prefix##GetCurrentLine(); \
void prefix##SetScanBuffer(const char *sb, const char *fn); \
S32 prefix##parse(); \
void prefix##restart(FILE *input_file)
const char * prefix##GetCurrentFile(); \
S32 prefix##GetCurrentLine(); \
void prefix##SetScanBuffer(const char *sb, const char *fn); \
S32 prefix##parse(); \
void prefix##restart(FILE *input_file)
//-----------------------------------------------------------------------------
/// \brief Helper macro to add console parsers
//-----------------------------------------------------------------------------
#define CON_ADD_PARSER(prefix, ext, def) \
Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \
prefix##restart, prefix##SetScanBuffer, def)
Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \
prefix##restart, prefix##SetScanBuffer, def)
//-----------------------------------------------------------------------------
/// \brief Free the console parser list

View file

@ -99,7 +99,7 @@ U32 postEvent(SimObject *destObject, SimEvent* event,U32 time)
Mutex::lockMutex(gEventQueueMutex);
if( time == -1 )
if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix
time = gCurrentTime;
event->time = time;

View file

@ -60,7 +60,7 @@ MODULE_END;
WindDeformationGLSL::WindDeformationGLSL()
: mDep( "shaders/common/gl/wind.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/wind.glsl" ))
{
addDependency( &mDep );
}

View file

@ -60,7 +60,7 @@ MODULE_END;
WindDeformationHLSL::WindDeformationHLSL()
: mDep( "shaders/common/wind.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/wind.hlsl" ))
{
addDependency( &mDep );
}

View file

@ -670,8 +670,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
//shader model 4.0 is enough for the generic shaders
const char* shaderModel = "4.0";
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/colorV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/colorP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader();
@ -680,8 +680,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/modColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/modColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSModColorTexture] = shaderData->getShader();
@ -690,8 +690,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/addColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/addColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSAddColorTexture] = shaderData->getShader();
@ -700,8 +700,8 @@ void GFXD3D11Device::setupGenericShaders(GenericShaderType type)
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/textureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/textureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureP.hlsl"));
shaderData->setField("pixVersion", shaderModel);
shaderData->registerObject();
mGenericShader[GSTexture] = shaderData->getShader();

View file

@ -154,8 +154,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
ShaderData *shaderData;
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/colorV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/colorP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/colorP.hlsl"));
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader();
@ -164,8 +164,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/modColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/modColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/modColorTextureP.hlsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();
@ -175,8 +175,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/addColorTextureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/addColorTextureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/addColorTextureP.hlsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();
@ -186,8 +186,8 @@ inline void GFXD3D9Device::setupGenericShaders( GenericShaderType type /* = GSCo
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("DXVertexShaderFile", "shaders/common/fixedFunction/textureV.hlsl");
shaderData->setField("DXPixelShaderFile", "shaders/common/fixedFunction/textureP.hlsl");
shaderData->setField("DXVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureV.hlsl"));
shaderData->setField("DXPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/textureP.hlsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "3.0");
shaderData->registerObject();

View file

@ -611,31 +611,31 @@ bool GBitmap::checkForTransparency()
//------------------------------------------------------------------------------
ColorF GBitmap::sampleTexel(F32 u, F32 v) const
{
ColorF col(0.5f, 0.5f, 0.5f);
// normally sampling wraps all the way around at 1.0,
// but locking doesn't support this, and we seem to calc
// the uv based on a clamped 0 - 1...
Point2F max((F32)(getWidth()-1), (F32)(getHeight()-1));
Point2F posf;
posf.x = mClampF(((u) * max.x), 0.0f, max.x);
posf.y = mClampF(((v) * max.y), 0.0f, max.y);
Point2I posi((S32)posf.x, (S32)posf.y);
ColorF col(0.5f, 0.5f, 0.5f);
// normally sampling wraps all the way around at 1.0,
// but locking doesn't support this, and we seem to calc
// the uv based on a clamped 0 - 1...
Point2F max((F32)(getWidth()-1), (F32)(getHeight()-1));
Point2F posf;
posf.x = mClampF(((u) * max.x), 0.0f, max.x);
posf.y = mClampF(((v) * max.y), 0.0f, max.y);
Point2I posi((S32)posf.x, (S32)posf.y);
const U8 *buffer = getBits();
U32 lexelindex = ((posi.y * getWidth()) + posi.x) * mBytesPerPixel;
const U8 *buffer = getBits();
U32 lexelindex = ((posi.y * getWidth()) + posi.x) * mBytesPerPixel;
if(mBytesPerPixel == 2)
{
//U16 *buffer = (U16 *)lockrect->pBits;
}
else if(mBytesPerPixel > 2)
{
col.red = F32(buffer[lexelindex + 0]) / 255.0f;
if(mBytesPerPixel == 2)
{
//U16 *buffer = (U16 *)lockrect->pBits;
}
else if(mBytesPerPixel > 2)
{
col.red = F32(buffer[lexelindex + 0]) / 255.0f;
col.green = F32(buffer[lexelindex + 1]) / 255.0f;
col.blue = F32(buffer[lexelindex + 2]) / 255.0f;
}
col.blue = F32(buffer[lexelindex + 2]) / 255.0f;
}
return col;
return col;
}
//--------------------------------------------------------------------------

View file

@ -42,9 +42,9 @@ using namespace Torque;
S32 GFXTextureManager::smTextureReductionLevel = 0;
String GFXTextureManager::smMissingTexturePath("core/art/missingTexture");
String GFXTextureManager::smUnavailableTexturePath("core/art/unavailable");
String GFXTextureManager::smWarningTexturePath("core/art/warnmat");
String GFXTextureManager::smMissingTexturePath(Con::getVariable("$Core::MissingTexturePath"));
String GFXTextureManager::smUnavailableTexturePath(Con::getVariable("$Core::UnAvailableTexturePath"));
String GFXTextureManager::smWarningTexturePath(Con::getVariable("$Core::WarningTexturePath"));
GFXTextureManager::EventSignal GFXTextureManager::smEventSignal;

View file

@ -780,8 +780,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
ShaderData *shaderData;
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/colorV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/colorP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorP.glsl"));
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();
mGenericShader[GSColor] = shaderData->getShader();
@ -790,8 +790,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/modColorTextureV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/modColorTextureP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();
@ -801,8 +801,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/addColorTextureV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/addColorTextureP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();
@ -812,8 +812,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
Sim::getRootGroup()->addObject(shaderData);
shaderData = new ShaderData();
shaderData->setField("OGLVertexShaderFile", "shaders/common/fixedFunction/gl/textureV.glsl");
shaderData->setField("OGLPixelShaderFile", "shaders/common/fixedFunction/gl/textureP.glsl");
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureV.glsl"));
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureP.glsl"));
shaderData->setSamplerName("$diffuseMap", 0);
shaderData->setField("pixVersion", "2.0");
shaderData->registerObject();

View file

@ -68,7 +68,8 @@ ImplementEnumType( WorldEditorDropType,
{ WorldEditor::DropAtScreenCenter, "screenCenter", "Places at a position projected outwards from the screen's center.\n" },
{ WorldEditor::DropAtCentroid, "atCentroid", "Places at the center position of the current centroid.\n" },
{ WorldEditor::DropToTerrain, "toTerrain", "Places on the terrain.\n" },
{ WorldEditor::DropBelowSelection, "belowSelection", "Places at a position below the selected object.\n" }
{ WorldEditor::DropBelowSelection, "belowSelection", "Places at a position below the selected object.\n" },
{ WorldEditor::DropAtGizmo, "atGizmo", "Places at the gizmo point.\n" }
EndImplementEnumType;
ImplementEnumType( WorldEditorAlignmentType,
@ -643,10 +644,10 @@ void WorldEditor::dropSelection(Selection* sel)
Point3F offset = -boxCenter;
offset.z += bounds.len_z() * 0.5f;
sel->offset( offset, mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(offset, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
}
else
sel->offset( Point3F( -centroid ), mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(Point3F(-centroid), (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
break;
}
@ -657,7 +658,7 @@ void WorldEditor::dropSelection(Selection* sel)
if(mDropAtBounds && !sel->containsGlobalBounds())
center = sel->getBoxBottomCenter();
sel->offset( Point3F( smCamPos - center ), mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(Point3F(smCamPos - center), (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
sel->orient(smCamMatrix, center);
break;
}
@ -668,7 +669,7 @@ void WorldEditor::dropSelection(Selection* sel)
if(mDropAtBounds && !sel->containsGlobalBounds())
sel->getBoxBottomCenter();
sel->offset( Point3F( smCamPos - center ), mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(Point3F(smCamPos - center), (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
break;
}
@ -680,7 +681,7 @@ void WorldEditor::dropSelection(Selection* sel)
Point3F offset = smCamPos - center;
offset.z -= mDropBelowCameraOffset;
sel->offset( offset, mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(offset, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
break;
}
@ -712,7 +713,7 @@ void WorldEditor::dropSelection(Selection* sel)
event.vec = wp - smCamPos;
event.vec.normalizeSafe();
event.vec *= viewdist;
sel->offset( Point3F( event.pos - center ) += event.vec, mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(Point3F(event.pos - center) += event.vec, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
break;
}
@ -728,12 +729,26 @@ void WorldEditor::dropSelection(Selection* sel)
dropBelowSelection(sel, centroid, mDropAtBounds);
break;
}
case DropAtGizmo:
{
dropAtGizmo(sel, mGizmo->getPosition()-centroid);
break;
}
}
//
updateClientTransforms(sel);
}
void WorldEditor::dropAtGizmo(Selection* sel, const Point3F & gizmoPos)
{
if (!sel->size())
return;
sel->offset(gizmoPos, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
}
void WorldEditor::dropBelowSelection(Selection* sel, const Point3F & centroid, bool useBottomBounds)
{
if(!sel->size())
@ -756,7 +771,7 @@ void WorldEditor::dropBelowSelection(Selection* sel, const Point3F & centroid,
sel->enableCollision();
if( hit )
sel->offset( ri.point - start, mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(ri.point - start, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
}
//------------------------------------------------------------------------------
@ -800,7 +815,7 @@ void WorldEditor::terrainSnapSelection(Selection* sel, U8 modifier, Point3F gizm
{
mStuckToGround = true;
sel->offset( ri.point - centroid, mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(ri.point - centroid, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
if(mTerrainSnapAlignment != AlignNone)
{
@ -1026,7 +1041,7 @@ void WorldEditor::softSnapSelection(Selection* sel, U8 modifier, Point3F gizmoPo
if ( minT <= 1.0f )
foundPoint += ( end - start ) * (0.5f - minT);
sel->offset( foundPoint - sel->getCentroid(), mGridSnap ? mGridPlaneSize : 0.f );
sel->offset(foundPoint - sel->getCentroid(), (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
}
mSoftSnapIsStuck = found;
@ -1805,7 +1820,7 @@ WorldEditor::WorldEditor()
mSoftSnapDebugPoint.set(0.0f, 0.0f, 0.0f);
mGridSnap = false;
mUseGroupCenter = true;
mFadeIcons = true;
mFadeIconsDist = 8.f;
}
@ -2254,7 +2269,7 @@ void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
mGizmo->getProfile()->snapToGrid = snapToGrid;
}
mSelected->offset( mGizmo->getOffset() );
mSelected->offset(mGizmo->getOffset(), (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
// Handle various sticking
terrainSnapSelection( mSelected, event.modifier, mGizmo->getPosition() );
@ -2686,7 +2701,8 @@ void WorldEditor::initPersistFields()
addGroup( "Grid" );
addField( "gridSnap", TypeBool, Offset( mGridSnap, WorldEditor ),
"If true, transform operations will snap to the grid." );
"If true, transform operations will snap to the grid.");
addField("useGroupCenter", TypeBool, Offset(mUseGroupCenter, WorldEditor));
endGroup( "Grid" );
@ -3035,7 +3051,7 @@ void WorldEditor::transformSelection(bool position, Point3F& p, bool relativePos
{
if( relativePos )
{
mSelected->offset( p, mGridSnap ? mGridPlaneSize : 0.f );
mSelected->offset(p, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
}
else
{
@ -3641,7 +3657,7 @@ void WorldEditor::makeSelectionPrefab( const char *filename )
else
{
//Only push the cleanup of the group if it's ONLY a SimGroup.
cleanup.push_back(grp);
cleanup.push_back( grp );
}
}
else

View file

@ -164,7 +164,8 @@ class WorldEditor : public EditTSCtrl
bool copySelection(Selection* sel);
bool pasteSelection(bool dropSel=true);
void dropSelection(Selection* sel);
void dropBelowSelection(Selection* sel, const Point3F & centroid, bool useBottomBounds=false);
void dropBelowSelection(Selection* sel, const Point3F & centroid, bool useBottomBounds = false);
void dropAtGizmo(Selection* sel, const Point3F & gizmoPos);
void terrainSnapSelection(Selection* sel, U8 modifier, Point3F gizmoPos, bool forceStick=false);
void softSnapSelection(Selection* sel, U8 modifier, Point3F gizmoPos);
@ -296,7 +297,8 @@ class WorldEditor : public EditTSCtrl
DropAtScreenCenter,
DropAtCentroid,
DropToTerrain,
DropBelowSelection
DropBelowSelection,
DropAtGizmo
};
// Snapping alignment mode
@ -349,6 +351,7 @@ class WorldEditor : public EditTSCtrl
F32 mDropAtScreenCenterMax;
bool mGridSnap;
bool mUseGroupCenter;
bool mStickToGround;
bool mStuckToGround; ///< Selection is stuck to the ground
AlignmentType mTerrainSnapAlignment; ///< How does the stickied object align to the terrain

View file

@ -306,9 +306,9 @@ void WorldEditorSelection::offset( const Point3F& offset, F32 gridSnap )
if( gridSnap != 0.f )
{
wPos.x -= mFmod( wPos.x, gridSnap );
wPos.y -= mFmod( wPos.y, gridSnap );
wPos.z -= mFmod( wPos.z, gridSnap );
wPos.x = _snapFloat(wPos.x, gridSnap);
wPos.y = _snapFloat(wPos.y, gridSnap);
wPos.z = _snapFloat(wPos.z, gridSnap);
}
mat.setColumn(3, wPos);
@ -318,6 +318,22 @@ void WorldEditorSelection::offset( const Point3F& offset, F32 gridSnap )
mCentroidValid = false;
}
F32 WorldEditorSelection::_snapFloat(const F32 &val, const F32 &snap) const
{
if (snap == 0.0f)
return val;
F32 a = mFmod(val, snap);
F32 temp = val;
if (mFabs(a) > (snap / 2))
val < 0.0f ? temp -= snap : temp += snap;
return(temp - a);
}
//-----------------------------------------------------------------------------
void WorldEditorSelection::setPosition(const Point3F & pos)

View file

@ -108,6 +108,7 @@ class WorldEditorSelection : public SimPersistSet
//
void offset(const Point3F& delta, F32 gridSnap = 0.f );
void setPosition(const Point3F & pos);
F32 _snapFloat(const F32 &val, const F32 &snap) const;
void setCentroidPosition(bool useBoxCenter, const Point3F & pos);
void orient(const MatrixF &, const Point3F &);

View file

@ -48,10 +48,10 @@ ConsoleDocClass( ShaderData,
"// Used for the procedural clould system\n"
"singleton ShaderData( CloudLayerShader )\n"
"{\n"
" DXVertexShaderFile = \"shaders/common/cloudLayerV.hlsl\";\n"
" DXPixelShaderFile = \"shaders/common/cloudLayerP.hlsl\";\n"
" OGLVertexShaderFile = \"shaders/common/gl/cloudLayerV.glsl\";\n"
" OGLPixelShaderFile = \"shaders/common/gl/cloudLayerP.glsl\";\n"
" DXVertexShaderFile = $Core::CommonShaderPath @ \"/cloudLayerV.hlsl\";\n"
" DXPixelShaderFile = $Core::CommonShaderPath @ \"/cloudLayerP.hlsl\";\n"
" OGLVertexShaderFile = $Core::CommonShaderPath @ \"/gl/cloudLayerV.glsl\";\n"
" OGLPixelShaderFile = $Core::CommonShaderPath @ \"/gl/cloudLayerP.glsl\";\n"
" pixVersion = 2.0;\n"
"};\n"
"@endtsexample\n\n"
@ -109,8 +109,8 @@ void ShaderData::initPersistFields()
"@tsexample\n"
"singleton ShaderData( FlashShader )\n"
"{\n"
"DXVertexShaderFile = \"shaders/common/postFx/flashV.hlsl\";\n"
"DXPixelShaderFile = \"shaders/common/postFx/flashP.hlsl\";\n\n"
"DXVertexShaderFile = $shaderGen::cachePath @ \"/postFx/flashV.hlsl\";\n"
"DXPixelShaderFile = $shaderGen::cachePath @ \"/postFx/flashP.hlsl\";\n\n"
" //Define setting the color of WHITE_COLOR.\n"
"defines = \"WHITE_COLOR=float4(1.0,1.0,1.0,0.0)\";\n\n"
"pixVersion = 2.0\n"

View file

@ -373,3 +373,20 @@ DefineConsoleFunction( mGetAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB
{
return MathUtils::getAngleBetweenVectors(vecA, vecB);
}
DefineConsoleFunction(mGetSignedAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB, VectorF norm), (VectorF::Zero, VectorF::Zero, VectorF::Zero),
"Returns signed angle between two vectors, using a normal for orientation.\n"
"@param vecA First input vector."
"@param vecB Second input vector."
"@param norm Normal/Cross Product vector."
"@returns Angle between both vectors in radians."
"@ingroup Math")
{
if (vecA.isZero() || vecB.isZero() || norm.isZero())
{
Con::errorf("mGetSignedAngleBetweenVectors - Error! Requires all 3 vectors used to be non-zero!");
return 0;
}
return MathUtils::getSignedAngleBetweenVectors(vecA, vecB, norm);
}

View file

@ -371,6 +371,18 @@ F32 getAngleBetweenVectors(VectorF vecA, VectorF vecB)
return angle;
}
F32 getSignedAngleBetweenVectors(VectorF vecA, VectorF vecB, VectorF norm)
{
// angle in 0-180
F32 angle = getAngleBetweenVectors(vecA, vecB);
F32 sign = mSign(mDot(norm, mCross(vecA, vecB)));
// angle in -179-180
F32 signed_angle = angle * sign;
return signed_angle;
}
//-----------------------------------------------------------------------------
void transformBoundingBox(const Box3F &sbox, const MatrixF &mat, const Point3F scale, Box3F &dbox)

View file

@ -161,6 +161,11 @@ namespace MathUtils
///
F32 getAngleBetweenVectors(VectorF vecA, VectorF vecB);
/// Returns the angle between two given vectors, utilizing a normal vector to discertain the angle's sign
///
/// Angles is in RADIANS
///
F32 getSignedAngleBetweenVectors(VectorF vecA, VectorF vecB, VectorF norm);
/// Simple reflection equation - pass in a vector and a normal to reflect off of
inline Point3F reflect( Point3F &inVec, Point3F &norm )

View file

@ -51,6 +51,7 @@ mModuleId(StringTable->EmptyString()),
mSynchronized( false ),
mDeprecated( false ),
mCriticalMerge( false ),
mOverrideExistingObjects(false),
mModuleDescription( StringTable->EmptyString() ),
mAuthor(StringTable->EmptyString()),
mModuleGroup(StringTable->EmptyString()),
@ -91,6 +92,7 @@ void ModuleDefinition::initPersistFields()
addProtectedField( "Synchronized", TypeBool, Offset(mSynchronized, ModuleDefinition), &setSynchronized, &defaultProtectedGetFn, &writeSynchronized, "Whether the module should be synchronized or not. Optional: If not specified then the module is not synchronized." );
addProtectedField( "Deprecated", TypeBool, Offset(mDeprecated, ModuleDefinition), &setDeprecated, &defaultProtectedGetFn, &writeDeprecated, "Whether the module is deprecated or not. Optional: If not specified then the module is not deprecated." );
addProtectedField( "CriticalMerge", TypeBool, Offset(mCriticalMerge, ModuleDefinition), &setDeprecated, &defaultProtectedGetFn, &writeCriticalMerge, "Whether the merging of a module prior to a restart is critical or not. Optional: If not specified then the module is not merge critical." );
addProtectedField( "OverrideExistingObjects", TypeBool, Offset(mOverrideExistingObjects, ModuleDefinition), &setOverrideExistingObjects, &defaultProtectedGetFn, &writeOverrideExistingObjects, "Controls if when this module is loaded and the create function is executed, it will replace existing objects that share names or not.");
addProtectedField( "Description", TypeString, Offset(mModuleDescription, ModuleDefinition), &setModuleDescription, &defaultProtectedGetFn, &writeModuleDescription, "The description typically used for debugging purposes but can be used for anything." );
addProtectedField( "Author", TypeString, Offset(mAuthor, ModuleDefinition), &setAuthor, &defaultProtectedGetFn, &writeAuthor, "The author of the module." );
addProtectedField( "Group", TypeString, Offset(mModuleGroup, ModuleDefinition), &setModuleGroup, &defaultProtectedGetFn, "The module group used typically when loading modules as a group." );

View file

@ -89,6 +89,7 @@ private:
bool mSynchronized;
bool mDeprecated;
bool mCriticalMerge;
bool mOverrideExistingObjects;
StringTableEntry mModuleDescription;
StringTableEntry mAuthor;;
StringTableEntry mModuleGroup;
@ -141,6 +142,8 @@ public:
inline bool getDeprecated( void ) const { return mDeprecated; }
inline void setCriticalMerge( const bool mergeCritical ) { if ( checkUnlocked() ) { mCriticalMerge = mergeCritical; } }
inline bool getCriticalMerge( void ) const { return mCriticalMerge; }
inline void setOverrideExistingObjects(const bool overrideExistingObj) { if (checkUnlocked()) { mOverrideExistingObjects = overrideExistingObj; } }
inline bool getOverrideExistingObjects(void) const { return mOverrideExistingObjects; }
inline void setModuleDescription( const char* pModuleDescription ) { if ( checkUnlocked() ) { mModuleDescription = StringTable->insert(pModuleDescription); } }
inline StringTableEntry getModuleDescription( void ) const { return mModuleDescription; }
inline void setAuthor( const char* pAuthor ) { if ( checkUnlocked() ) { mAuthor = StringTable->insert(pAuthor); } }
@ -206,6 +209,8 @@ protected:
static bool setDeprecated(void* obj, const char* index, const char* data) { static_cast<ModuleDefinition*>(obj)->setDeprecated(dAtob(data)); return false; }
static bool writeDeprecated( void* obj, StringTableEntry pFieldName ) { return static_cast<ModuleDefinition*>(obj)->getDeprecated() == true; }
static bool writeCriticalMerge( void* obj, StringTableEntry pFieldName ){ return static_cast<ModuleDefinition*>(obj)->getCriticalMerge() == true; }
static bool setOverrideExistingObjects(void* obj, const char* index, const char* data) { static_cast<ModuleDefinition*>(obj)->setOverrideExistingObjects(dAtob(data)); return false; }
static bool writeOverrideExistingObjects(void* obj, StringTableEntry pFieldName) { return static_cast<ModuleDefinition*>(obj)->getOverrideExistingObjects() == true; }
static bool setModuleDescription(void* obj, const char* index, const char* data) { static_cast<ModuleDefinition*>(obj)->setModuleDescription(data); return false; }
static bool writeModuleDescription( void* obj, StringTableEntry pFieldName ) { return static_cast<ModuleDefinition*>(obj)->getModuleDescription() != StringTable->EmptyString(); }
static bool setAuthor(void* obj, const char* index, const char* data) { static_cast<ModuleDefinition*>(obj)->setAuthor(data); return false; }

View file

@ -429,7 +429,22 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup )
if ( pScopeSet->isMethod( pLoadReadyModuleDefinition->getCreateFunction() ) )
{
// Yes, so call the create method.
Con::executef( pScopeSet, pLoadReadyModuleDefinition->getCreateFunction() );
//But first, check if we're overriding objects, and if so, set our console var to make that happen while we exec our create function
if (pLoadReadyModuleDefinition->getOverrideExistingObjects())
{
String redefineBehaviorPrev = Con::getVariable("$Con::redefineBehavior");
Con::setVariable("$Con::redefineBehavior", "replaceExisting");
Con::executef(pScopeSet, pLoadReadyModuleDefinition->getCreateFunction());
//And now that we've executed, switch back to the prior behavior
Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str());
}
else
{
//Nothing to do, just run the create function
Con::executef(pScopeSet, pLoadReadyModuleDefinition->getCreateFunction());
}
}
}
else

View file

@ -739,6 +739,7 @@ Box3F NavMesh::getTileBox(U32 id)
void NavMesh::updateTiles(bool dirty)
{
PROFILE_SCOPE(NavMesh_updateTiles);
if(!isProperlyAdded())
return;
@ -793,6 +794,7 @@ void NavMesh::processTick(const Move *move)
void NavMesh::buildNextTile()
{
PROFILE_SCOPE(NavMesh_buildNextTile);
if(!mDirtyTiles.empty())
{
// Pop a single dirty tile and process it.
@ -1099,6 +1101,7 @@ unsigned char *NavMesh::buildTileData(const Tile &tile, TileData &data, U32 &dat
/// this NavMesh object.
void NavMesh::buildTiles(const Box3F &box)
{
PROFILE_SCOPE(NavMesh_buildTiles);
// Make sure we've already built or loaded.
if(!nm)
return;
@ -1124,6 +1127,7 @@ DefineEngineMethod(NavMesh, buildTiles, void, (Box3F box),,
void NavMesh::buildTile(const U32 &tile)
{
PROFILE_SCOPE(NavMesh_buildTile);
if(tile < mTiles.size())
{
mDirtyTiles.push_back_unique(tile);

View file

@ -369,6 +369,7 @@ void NavPath::resize()
bool NavPath::plan()
{
PROFILE_SCOPE(NavPath_plan);
// Initialise filter.
mFilter.setIncludeFlags(mLinkTypes.getFlags());
@ -430,15 +431,15 @@ bool NavPath::visitNext()
if(dtStatusFailed(mQuery->findNearestPoly(from, extents, &mFilter, &startRef, NULL)) || !startRef)
{
Con::errorf("No NavMesh polygon near visit point (%g, %g, %g) of NavPath %s",
start.x, start.y, start.z, getIdString());
//Con::errorf("No NavMesh polygon near visit point (%g, %g, %g) of NavPath %s",
//start.x, start.y, start.z, getIdString());
return false;
}
if(dtStatusFailed(mQuery->findNearestPoly(to, extents, &mFilter, &endRef, NULL)) || !endRef)
{
Con::errorf("No NavMesh polygon near visit point (%g, %g, %g) of NavPath %s",
end.x, end.y, end.z, getIdString());
//Con::errorf("No NavMesh polygon near visit point (%g, %g, %g) of NavPath %s",
//end.x, end.y, end.z, getIdString());
return false;
}
@ -452,6 +453,7 @@ bool NavPath::visitNext()
bool NavPath::update()
{
PROFILE_SCOPE(NavPath_update);
if(dtStatusInProgress(mStatus))
mStatus = mQuery->updateSlicedFindPath(mMaxIterations, NULL);
if(dtStatusSucceed(mStatus))
@ -527,6 +529,7 @@ bool NavPath::finalise()
void NavPath::processTick(const Move *move)
{
PROFILE_SCOPE(NavPath_processTick);
if(!mMesh)
if(Sim::findObject(mMeshName.c_str(), mMesh))
plan();

View file

@ -492,10 +492,10 @@ template<class T> T ReservedSocketList<T>::resolve(NetSocket socketToResolve)
return entry.used ? entry.value : -1;
}
static ConnectionNotifyEvent* smConnectionNotify = NULL;
static ConnectionAcceptedEvent* smConnectionAccept = NULL;
static ConnectionReceiveEvent* smConnectionReceive = NULL;
static PacketReceiveEvent* smPacketReceive = NULL;
ConnectionNotifyEvent* Net::smConnectionNotify = NULL;
ConnectionAcceptedEvent* Net::smConnectionAccept = NULL;
ConnectionReceiveEvent* Net::smConnectionReceive = NULL;
PacketReceiveEvent* Net::smPacketReceive = NULL;
ConnectionNotifyEvent& Net::getConnectionNotifyEvent()
{
@ -809,6 +809,7 @@ NetSocket Net::openConnectTo(const char *addressString)
error = Net::WrongProtocolType;
}
// Open socket
if (error == NoError || error == NeedHostLookup)
{
handleFd = openSocket();

View file

@ -214,6 +214,12 @@ struct Net
static bool smMulticastEnabled;
static bool smIpv4Enabled;
static bool smIpv6Enabled;
static ConnectionNotifyEvent* smConnectionNotify;
static ConnectionAcceptedEvent* smConnectionAccept;
static ConnectionReceiveEvent* smConnectionReceive;
static PacketReceiveEvent* smPacketReceive;
static bool init();
static void shutdown();

View file

@ -54,9 +54,9 @@ Profiler *gProfiler = NULL;
Vector<StringTableEntry> gProfilerNodeStack;
#define TORQUE_PROFILE_AT_ENGINE_START true
#define PROFILER_DEBUG_PUSH_NODE( nodename ) \
gProfilerNodeStack.push_back( nodename );
gProfilerNodeStack.push_back( nodename );
#define PROFILER_DEBUG_POP_NODE() \
gProfilerNodeStack.pop_back();
gProfilerNodeStack.pop_back();
#else
#define TORQUE_PROFILE_AT_ENGINE_START false
#define PROFILER_DEBUG_PUSH_NODE( nodename ) ;
@ -68,7 +68,7 @@ gProfilerNodeStack.pop_back();
void startHighResolutionTimer(U32 time[2])
{
//time[0] = Platform::getRealMilliseconds();
__asm
{
push eax
@ -89,7 +89,7 @@ U32 endHighResolutionTimer(U32 time[2])
U32 ticks;
//ticks = Platform::getRealMilliseconds() - time[0];
//return ticks;
__asm
{
push eax
@ -176,7 +176,7 @@ Profiler::Profiler()
{
mMaxStackDepth = MaxStackDepth;
mCurrentHash = 0;
mCurrentProfilerData = (ProfilerData *) malloc(sizeof(ProfilerData));
mCurrentProfilerData->mRoot = NULL;
mCurrentProfilerData->mNextForRoot = NULL;
@ -195,12 +195,12 @@ Profiler::Profiler()
mCurrentProfilerData->mPath = "";
#endif
mRootProfilerData = mCurrentProfilerData;
for(U32 i = 0; i < ProfilerData::HashTableSize; i++)
mCurrentProfilerData->mChildHash[i] = 0;
mProfileList = NULL;
mEnabled = TORQUE_PROFILE_AT_ENGINE_START;
mNextEnable = TORQUE_PROFILE_AT_ENGINE_START;
mStackDepth = 0;
@ -222,20 +222,20 @@ void Profiler::reset()
mEnabled = false; // in case we're in a profiler call.
ProfilerData * head = mProfileList;
ProfilerData * curr = head;
while ( curr )
{
head = curr->mNextProfilerData;
free( curr );
if ( head )
curr = head;
else
curr = NULL;
}
mProfileList = NULL;
for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
{
walk->mFirstProfilerData = 0;
@ -262,7 +262,7 @@ ProfilerRootData::ProfilerRootData(const char *name)
for(ProfilerRootData *walk = sRootList; walk; walk = walk->mNextRoot)
if(!dStrcmp(walk->mName, name))
AssertFatal( false, avar( "Duplicate profile name: %s", name ) );
mName = name;
mNameHash = _StringTable::hashString(name);
mNextRoot = sRootList;
@ -306,7 +306,7 @@ const char * Profiler::getProfilePath()
if( !ThreadManager::isMainThread() )
return "[non-main thread]";
#endif
return (mEnabled && mCurrentProfilerData) ? mCurrentProfilerData->mPath : "na";
}
#endif
@ -318,14 +318,14 @@ const char * Profiler::constructProfilePath(ProfilerData * pd)
{
const bool saveEnable = gProfiler->mEnabled;
gProfiler->mEnabled = false;
const char * connector = " -> ";
U32 len = dStrlen(pd->mParent->mPath);
if (!len)
connector = "";
len += dStrlen(connector);
len += dStrlen(pd->mRoot->mName);
U32 mark = FrameAllocator::getWaterMark();
char * buf = (char*)FrameAllocator::alloc(len+1);
dStrcpy(buf,pd->mParent->mPath);
@ -348,25 +348,25 @@ void Profiler::hashPush(ProfilerRootData *root)
if( !ThreadManager::isMainThread() )
return;
#endif
mStackDepth++;
PROFILER_DEBUG_PUSH_NODE(root->mName);
AssertFatal(mStackDepth <= mMaxStackDepth,
"Stack overflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs");
if(!mEnabled)
return;
ProfilerData *nextProfiler = NULL;
if(!root->mEnabled || mCurrentProfilerData->mRoot == root)
{
mCurrentProfilerData->mSubDepth++;
return;
}
if(mCurrentProfilerData->mLastSeenProfiler &&
mCurrentProfilerData->mLastSeenProfiler->mRoot == root)
nextProfiler = mCurrentProfilerData->mLastSeenProfiler;
if(!nextProfiler)
{
// first see if it's in the hash table...
@ -383,17 +383,17 @@ void Profiler::hashPush(ProfilerRootData *root)
nextProfiler = (ProfilerData *) malloc(sizeof(ProfilerData));
for(U32 i = 0; i < ProfilerData::HashTableSize; i++)
nextProfiler->mChildHash[i] = 0;
nextProfiler->mRoot = root;
nextProfiler->mNextForRoot = root->mFirstProfilerData;
root->mFirstProfilerData = nextProfiler;
nextProfiler->mNextProfilerData = mProfileList;
mProfileList = nextProfiler;
nextProfiler->mNextHash = mCurrentProfilerData->mChildHash[index];
mCurrentProfilerData->mChildHash[index] = nextProfiler;
nextProfiler->mParent = mCurrentProfilerData;
nextProfiler->mNextSibling = mCurrentProfilerData->mFirstChild;
mCurrentProfilerData->mFirstChild = nextProfiler;
@ -443,7 +443,7 @@ void Profiler::hashPop(ProfilerRootData *expected)
if( !ThreadManager::isMainThread() )
return;
#endif
mStackDepth--;
PROFILER_DEBUG_POP_NODE();
AssertFatal(mStackDepth >= 0, "Stack underflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs");
@ -459,15 +459,15 @@ void Profiler::hashPop(ProfilerRootData *expected)
{
AssertISV(expected == mCurrentProfilerData->mRoot, "Profiler::hashPop - didn't get expected ProfilerRoot!");
}
F64 fElapsed = endHighResolutionTimer(mCurrentProfilerData->mStartTime);
mCurrentProfilerData->mTotalTime += fElapsed;
mCurrentProfilerData->mParent->mSubTime += fElapsed; // mark it in the parent as well...
mCurrentProfilerData->mRoot->mTotalTime += fElapsed;
if(mCurrentProfilerData->mParent->mRoot)
mCurrentProfilerData->mParent->mRoot->mSubTime += fElapsed; // mark it in the parent as well...
mCurrentProfilerData = mCurrentProfilerData->mParent;
}
if(mStackDepth == 0)
@ -480,13 +480,13 @@ void Profiler::hashPop(ProfilerRootData *expected)
}
if(!mEnabled && mNextEnable)
startHighResolutionTimer(mCurrentProfilerData->mStartTime);
#if defined(TORQUE_OS_WIN)
// The high performance counters under win32 are unreliable when running on multiple
// processors. When the profiler is enabled, we restrict Torque to a single processor.
if(mNextEnable != mEnabled)
{
if(mNextEnable)
{
Con::warnf("Warning: forcing the Torque profiler thread to run only on cpu 1.");
@ -502,7 +502,7 @@ void Profiler::hashPop(ProfilerRootData *expected)
}
}
#endif
mEnabled = mNextEnable;
}
}
@ -520,15 +520,15 @@ static void profilerDataDumpRecurse(ProfilerData *data, char *buffer, U32 buffer
{
// dump out this one:
Con::printf("%7.3f %7.3f %8d %s%s",
100 * data->mTotalTime / totalTime,
100 * (data->mTotalTime - data->mSubTime) / totalTime,
data->mInvokeCount,
buffer,
data->mRoot ? data->mRoot->mName : "ROOT" );
100 * data->mTotalTime / totalTime,
100 * (data->mTotalTime - data->mSubTime) / totalTime,
data->mInvokeCount,
buffer,
data->mRoot ? data->mRoot->mName : "ROOT" );
data->mTotalTime = 0;
data->mSubTime = 0;
data->mInvokeCount = 0;
buffer[bufferLen] = ' ';
buffer[bufferLen+1] = ' ';
buffer[bufferLen+2] = 0;
@ -558,16 +558,16 @@ static void profilerDataDumpRecurseFile(ProfilerData *data, char *buffer, U32 bu
{
char pbuffer[256];
dSprintf(pbuffer, 255, "%7.3f %7.3f %8d %s%s\n",
100 * data->mTotalTime / totalTime,
100 * (data->mTotalTime - data->mSubTime) / totalTime,
data->mInvokeCount,
buffer,
data->mRoot ? data->mRoot->mName : "ROOT" );
100 * data->mTotalTime / totalTime,
100 * (data->mTotalTime - data->mSubTime) / totalTime,
data->mInvokeCount,
buffer,
data->mRoot ? data->mRoot->mName : "ROOT" );
fws.write(dStrlen(pbuffer), pbuffer);
data->mTotalTime = 0;
data->mSubTime = 0;
data->mInvokeCount = 0;
buffer[bufferLen] = ' ';
buffer[bufferLen+1] = ' ';
buffer[bufferLen+2] = 0;
@ -599,7 +599,7 @@ void Profiler::dump()
mEnabled = false;
mStackDepth++;
// may have some profiled calls... gotta turn em off.
Vector<ProfilerRootData *> rootVector;
F64 totalTime = 0;
for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
@ -608,8 +608,8 @@ void Profiler::dump()
rootVector.push_back(walk);
}
dQsort((void *) &rootVector[0], rootVector.size(), sizeof(ProfilerRootData *), rootDataCompare);
if (mDumpToConsole == true)
{
Con::printf("Profiler Data Dump:");
@ -618,10 +618,10 @@ void Profiler::dump()
for(U32 i = 0; i < rootVector.size(); i++)
{
Con::printf("%7.3f %7.3f %8d %s",
100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime,
100 * rootVector[i]->mTotalTime / totalTime,
rootVector[i]->mTotalInvokeCount,
rootVector[i]->mName);
100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime,
100 * rootVector[i]->mTotalTime / totalTime,
rootVector[i]->mTotalInvokeCount,
rootVector[i]->mName);
rootVector[i]->mTotalInvokeCount = 0;
rootVector[i]->mTotalTime = 0;
rootVector[i]->mSubTime = 0;
@ -629,9 +629,9 @@ void Profiler::dump()
Con::printf("");
Con::printf("Ordered by stack trace total time -");
Con::printf("%% Time %% NSTime Invoke # Name");
mCurrentProfilerData->mTotalTime = endHighResolutionTimer(mCurrentProfilerData->mStartTime);
char depthBuffer[MaxStackDepth * 2 + 1];
depthBuffer[0] = 0;
profilerDataDumpRecurse(mCurrentProfilerData, depthBuffer, 0, totalTime);
@ -643,44 +643,44 @@ void Profiler::dump()
FileStream fws;
bool success = fws.open(mDumpFileName, Torque::FS::File::Write);
AssertFatal(success, "Cannot write profile dump to specified file!");
char buffer[1024];
dStrcpy(buffer, "Profiler Data Dump:\n");
fws.write(dStrlen(buffer), buffer);
dStrcpy(buffer, "Ordered by non-sub total time -\n");
fws.write(dStrlen(buffer), buffer);
dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n");
fws.write(dStrlen(buffer), buffer);
for(U32 i = 0; i < rootVector.size(); i++)
{
dSprintf(buffer, 1023, "%7.3f %7.3f %8d %s\n",
100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime,
100 * rootVector[i]->mTotalTime / totalTime,
rootVector[i]->mTotalInvokeCount,
rootVector[i]->mName);
char buffer[1024];
dStrcpy(buffer, "Profiler Data Dump:\n");
fws.write(dStrlen(buffer), buffer);
rootVector[i]->mTotalInvokeCount = 0;
rootVector[i]->mTotalTime = 0;
rootVector[i]->mSubTime = 0;
}
dStrcpy(buffer, "\nOrdered by non-sub total time -\n");
fws.write(dStrlen(buffer), buffer);
dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n");
fws.write(dStrlen(buffer), buffer);
dStrcpy(buffer, "Ordered by non-sub total time -\n");
fws.write(dStrlen(buffer), buffer);
dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n");
fws.write(dStrlen(buffer), buffer);
for(U32 i = 0; i < rootVector.size(); i++)
{
dSprintf(buffer, 1023, "%7.3f %7.3f %8d %s\n",
100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime,
100 * rootVector[i]->mTotalTime / totalTime,
rootVector[i]->mTotalInvokeCount,
rootVector[i]->mName);
fws.write(dStrlen(buffer), buffer);
rootVector[i]->mTotalInvokeCount = 0;
rootVector[i]->mTotalTime = 0;
rootVector[i]->mSubTime = 0;
}
dStrcpy(buffer, "\nOrdered by non-sub total time -\n");
fws.write(dStrlen(buffer), buffer);
dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n");
fws.write(dStrlen(buffer), buffer);
mCurrentProfilerData->mTotalTime = endHighResolutionTimer(mCurrentProfilerData->mStartTime);
char depthBuffer[MaxStackDepth * 2 + 1];
depthBuffer[0] = 0;
profilerDataDumpRecurseFile(mCurrentProfilerData, depthBuffer, 0, totalTime, fws);
mEnabled = enableSave;
mStackDepth--;
fws.close();
}
mDumpToConsole = false;
mDumpToFile = false;
mDumpFileName[0] = '\0';
@ -716,12 +716,12 @@ void Profiler::enableMarker(const char *marker, bool enable)
//-----------------------------------------------------------------------------
DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool enable ), ( true ),
"@brief Enable or disable a specific profile.\n\n"
"@param enable Optional paramater to enable or disable the profile.\n"
"@param markerName Name of a specific marker to enable or disable.\n"
"@note Calling this function will first call profilerReset(), clearing all data from profiler. "
"All profile markers are enabled by default.\n\n"
"@ingroup Debugging")
"@brief Enable or disable a specific profile.\n\n"
"@param enable Optional paramater to enable or disable the profile.\n"
"@param markerName Name of a specific marker to enable or disable.\n"
"@note Calling this function will first call profilerReset(), clearing all data from profiler. "
"All profile markers are enabled by default.\n\n"
"@ingroup Debugging")
{
if( gProfiler )
gProfiler->enableMarker( markerName, enable );
@ -730,47 +730,47 @@ DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool
//-----------------------------------------------------------------------------
DefineEngineFunction( profilerEnable, void, ( bool enable ),,
"@brief Enables or disables the profiler.\n\n"
"Data is only gathered while the profiler is enabled.\n\n"
"@note Profiler is not available in shipping builds.\n"
"T3D has predefined profiling areas surrounded by markers, "
"but you may need to define additional markers (in C++) around areas you wish to profile,"
" by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n"
"@ingroup Debugging\n" )
"@brief Enables or disables the profiler.\n\n"
"Data is only gathered while the profiler is enabled.\n\n"
"@note Profiler is not available in shipping builds.\n"
"T3D has predefined profiling areas surrounded by markers, "
"but you may need to define additional markers (in C++) around areas you wish to profile,"
" by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n"
"@ingroup Debugging\n" )
{
if(gProfiler)
gProfiler->enable(enable);
}
DefineEngineFunction(profilerDump, void, (),,
"@brief Dumps current profiling stats to the console window.\n\n"
"@note Markers disabled with profilerMarkerEnable() will be skipped over. "
"If the profiler is currently running, it will be disabled.\n"
"@ingroup Debugging")
"@brief Dumps current profiling stats to the console window.\n\n"
"@note Markers disabled with profilerMarkerEnable() will be skipped over. "
"If the profiler is currently running, it will be disabled.\n"
"@ingroup Debugging")
{
if(gProfiler)
gProfiler->dumpToConsole();
}
DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),,
"@brief Dumps current profiling stats to a file.\n\n"
"@note If the profiler is currently running, it will be disabled.\n"
"@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). "
"Will attempt to create the file if it does not already exist.\n"
"@tsexample\n"
"profilerDumpToFile( \"C:/Torque/log1.txt\" );\n"
"@endtsexample\n\n"
"@ingroup Debugging" )
"@brief Dumps current profiling stats to a file.\n\n"
"@note If the profiler is currently running, it will be disabled.\n"
"@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). "
"Will attempt to create the file if it does not already exist.\n"
"@tsexample\n"
"profilerDumpToFile( \"C:/Torque/log1.txt\" );\n"
"@endtsexample\n\n"
"@ingroup Debugging" )
{
if(gProfiler)
gProfiler->dumpToFile(fileName);
}
DefineEngineFunction( profilerReset, void, (),,
"@brief Resets the profiler, clearing it of all its data.\n\n"
"If the profiler is currently running, it will first be disabled. "
"All markers will retain their current enabled/disabled status.\n\n"
"@ingroup Debugging" )
"@brief Resets the profiler, clearing it of all its data.\n\n"
"If the profiler is currently running, it will first be disabled. "
"All markers will retain their current enabled/disabled status.\n\n"
"@ingroup Debugging" )
{
if(gProfiler)
gProfiler->reset();

View file

@ -76,8 +76,8 @@ TEST(Net, TCPRequest)
handler.mDataReceived = 0;
// Hook into the signals.
Net::smConnectionNotify .notify(&handler, &TcpHandle::notify);
Net::smConnectionReceive.notify(&handler, &TcpHandle::receive);
Net::smConnectionNotify ->notify(&handler, &TcpHandle::notify);
Net::smConnectionReceive->notify(&handler, &TcpHandle::receive);
// Open a TCP connection to garagegames.com
handler.mSocket = Net::openConnectTo("72.246.107.193:80");
@ -85,8 +85,8 @@ TEST(Net, TCPRequest)
while(Process::processEvents() && (Platform::getRealMilliseconds() < limit) ) {}
// Unhook from the signals.
Net::smConnectionNotify .remove(&handler, &TcpHandle::notify);
Net::smConnectionReceive.remove(&handler, &TcpHandle::receive);
Net::smConnectionNotify ->remove(&handler, &TcpHandle::notify);
Net::smConnectionReceive->remove(&handler, &TcpHandle::receive);
EXPECT_GT(handler.mDataReceived, 0)
<< "Didn't get any data back!";
@ -139,8 +139,8 @@ struct JournalHandle
mDataReceived = 0;
// Hook into the signals.
Net::smConnectionNotify .notify(this, &JournalHandle::notify);
Net::smConnectionReceive.notify(this, &JournalHandle::receive);
Net::smConnectionNotify ->notify(this, &JournalHandle::notify);
Net::smConnectionReceive->notify(this, &JournalHandle::receive);
// Open a TCP connection to garagegames.com
mSocket = Net::openConnectTo("72.246.107.193:80");
@ -149,8 +149,8 @@ struct JournalHandle
while(Process::processEvents()) {}
// Unhook from the signals.
Net::smConnectionNotify .remove(this, &JournalHandle::notify);
Net::smConnectionReceive.remove(this, &JournalHandle::receive);
Net::smConnectionNotify ->remove(this, &JournalHandle::notify);
Net::smConnectionReceive->remove(this, &JournalHandle::receive);
EXPECT_GT(mDataReceived, 0)
<< "Didn't get any data back!";

View file

@ -411,10 +411,6 @@ bool PostEffect::onAdd()
texFilename[0] == '#' )
continue;
// If '/', then path is specified, open normally
if ( texFilename[0] != '/' )
texFilename = scriptPath.getFullPath() + '/' + texFilename;
// Try to load the texture.
bool success = mTextures[i].set( texFilename, &PostFxTextureProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) );
if (!success)

View file

@ -236,7 +236,7 @@ void BumpFeatGLSL::setTexData( Material::StageData &stageDat,
ParallaxFeatGLSL::ParallaxFeatGLSL()
: mIncludeDep( "shaders/common/gl/torque.glsl" )
: mIncludeDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mIncludeDep );
}

View file

@ -30,7 +30,7 @@
PixelSpecularGLSL::PixelSpecularGLSL()
: mDep( "shaders/common/gl/lighting.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" ))
{
addDependency( &mDep );
}

View file

@ -830,7 +830,7 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//****************************************************************************
DiffuseMapFeatGLSL::DiffuseMapFeatGLSL()
: mTorqueDep("shaders/common/gl/torque.glsl")
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl"))
{
addDependency(&mTorqueDep);
}
@ -1975,7 +1975,7 @@ void ReflectCubeFeatGLSL::setTexData( Material::StageData &stageDat,
//****************************************************************************
RTLightingFeatGLSL::RTLightingFeatGLSL()
: mDep( "shaders/common/gl/lighting.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/lighting.glsl" ))
{
addDependency( &mDep );
}
@ -2190,7 +2190,7 @@ ShaderFeature::Resources RTLightingFeatGLSL::getResources( const MaterialFeature
//****************************************************************************
FogFeatGLSL::FogFeatGLSL()
: mFogDep( "shaders/common/gl/torque.glsl" )
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mFogDep );
}
@ -2321,7 +2321,7 @@ ShaderFeature::Resources FogFeatGLSL::getResources( const MaterialFeatureData &f
//****************************************************************************
VisibilityFeatGLSL::VisibilityFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -2487,7 +2487,7 @@ void RenderTargetZeroGLSL::processPix( Vector<ShaderComponent*> &componentList,
//****************************************************************************
HDROutGLSL::HDROutGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -2508,7 +2508,7 @@ void HDROutGLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h"
FoliageFeatureGLSL::FoliageFeatureGLSL()
: mDep( "shaders/common/gl/foliage.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/foliage.glsl" ))
{
addDependency( &mDep );
}
@ -2654,7 +2654,7 @@ void ParticleNormalFeatureGLSL::processVert(Vector<ShaderComponent*> &componentL
//****************************************************************************
ImposterVertFeatureGLSL::ImposterVertFeatureGLSL()
: mDep( "shaders/common/gl/imposter.glsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/imposter.glsl" ))
{
addDependency( &mDep );
}

View file

@ -37,8 +37,8 @@ void ShaderGenPrinterGLSL::printShaderHeader( Stream& stream )
stream.write( dStrlen(header1), header1 );
// Cheap HLSL compatibility.
const char* header3 = "#include \"shaders/common/gl/hlslCompat.glsl\"\r\n";
stream.write( dStrlen(header3), header3 );
String header3 = String("#include \"") + String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/hlslCompat.glsl\"\r\n");
stream.write(dStrlen(header3), header3.c_str());
const char* header4 = "\r\n";
stream.write( dStrlen(header4), header4 );

View file

@ -268,7 +268,7 @@ void BumpFeatHLSL::setTexData( Material::StageData &stageDat,
ParallaxFeatHLSL::ParallaxFeatHLSL()
: mIncludeDep( "shaders/common/torque.hlsl" )
: mIncludeDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mIncludeDep );
}

View file

@ -30,7 +30,7 @@
PixelSpecularHLSL::PixelSpecularHLSL()
: mDep( "shaders/common/lighting.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" ))
{
addDependency( &mDep );
}

View file

@ -853,7 +853,7 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
//****************************************************************************
DiffuseMapFeatHLSL::DiffuseMapFeatHLSL()
: mTorqueDep("shaders/common/torque.hlsl")
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl"))
{
addDependency(&mTorqueDep);
}
@ -2168,7 +2168,7 @@ void ReflectCubeFeatHLSL::setTexData( Material::StageData &stageDat,
//****************************************************************************
RTLightingFeatHLSL::RTLightingFeatHLSL()
: mDep( "shaders/common/lighting.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/lighting.hlsl" ))
{
addDependency( &mDep );
}
@ -2383,7 +2383,7 @@ ShaderFeature::Resources RTLightingFeatHLSL::getResources( const MaterialFeature
//****************************************************************************
FogFeatHLSL::FogFeatHLSL()
: mFogDep( "shaders/common/torque.hlsl" )
: mFogDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mFogDep );
}
@ -2514,7 +2514,7 @@ ShaderFeature::Resources FogFeatHLSL::getResources( const MaterialFeatureData &f
//****************************************************************************
VisibilityFeatHLSL::VisibilityFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -2681,7 +2681,7 @@ void RenderTargetZeroHLSL::processPix( Vector<ShaderComponent*> &componentList,
//****************************************************************************
HDROutHLSL::HDROutHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -2702,7 +2702,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
#include "T3D/fx/groundCover.h"
FoliageFeatureHLSL::FoliageFeatureHLSL()
: mDep( "shaders/common/foliage.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/foliage.hlsl" ))
{
addDependency( &mDep );
}
@ -2848,7 +2848,7 @@ void ParticleNormalFeatureHLSL::processVert(Vector<ShaderComponent*> &componentL
//****************************************************************************
ImposterVertFeatureHLSL::ImposterVertFeatureHLSL()
: mDep( "shaders/common/imposter.hlsl" )
: mDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/imposter.hlsl" ))
{
addDependency( &mDep );
}

View file

@ -70,7 +70,7 @@ MODULE_END;
TerrainFeatGLSL::TerrainFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" ))
{
addDependency( &mTorqueDep );
}
@ -297,8 +297,8 @@ U32 TerrainBaseMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) co
}
TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" ),
mTerrainDep( "shaders/common/terrain/terrain.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.glsl" ))
{
addDependency( &mTorqueDep );
@ -667,8 +667,8 @@ U32 TerrainDetailMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd )
TerrainMacroMapFeatGLSL::TerrainMacroMapFeatGLSL()
: mTorqueDep( "shaders/common/gl/torque.glsl" ),
mTerrainDep( "shaders/common/terrain/terrain.glsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/gl/torque.glsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.glsl" ))
{
addDependency( &mTorqueDep );

View file

@ -69,7 +69,7 @@ MODULE_END;
TerrainFeatHLSL::TerrainFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" ))
{
addDependency( &mTorqueDep );
}
@ -315,8 +315,8 @@ U32 TerrainBaseMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) co
}
TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" ),
mTerrainDep( "shaders/common/terrain/terrain.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.hlsl" ))
{
addDependency( &mTorqueDep );
@ -692,8 +692,8 @@ U32 TerrainDetailMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd )
TerrainMacroMapFeatHLSL::TerrainMacroMapFeatHLSL()
: mTorqueDep( "shaders/common/torque.hlsl" ),
mTerrainDep( "shaders/common/terrain/terrain.hlsl" )
: mTorqueDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/torque.hlsl" )),
mTerrainDep(String(Con::getVariable("$Core::CommonShaderPath")) + String("/terrain/terrain.hlsl" ))
{
addDependency( &mTorqueDep );

View file

@ -98,15 +98,31 @@ bool Platform::displaySplashWindow( String path )
SDL_RenderPresent(gSplashRenderer);
}
return true;
return true;
}
bool Platform::closeSplashWindow()
{
SDL_DestroyTexture(gSplashTexture);
SDL_FreeSurface(gSplashImage);
SDL_DestroyRenderer(gSplashRenderer);
SDL_DestroyWindow(gSplashWindow);
if (gSplashTexture != nullptr)
{
SDL_DestroyTexture(gSplashTexture);
gSplashTexture = nullptr;
}
if (gSplashImage != nullptr)
{
SDL_FreeSurface(gSplashImage);
gSplashImage = nullptr;
}
if (gSplashRenderer != nullptr)
{
SDL_DestroyRenderer(gSplashRenderer);
gSplashRenderer = nullptr;
}
if (gSplashWindow != nullptr)
{
SDL_DestroyWindow(gSplashWindow);
gSplashWindow = nullptr;
}
return true;
}

View file

@ -104,37 +104,37 @@ mShouldLockMouse(false),
mSuppressReset(false),
mMenuHandle(NULL)
{
mCursorController = new PlatformCursorControllerSDL( this );
mCursorController = new PlatformCursorControllerSDL( this );
mVideoMode.bitDepth = 32;
mVideoMode.fullScreen = false;
mVideoMode.refreshRate = 60;
mVideoMode.resolution.set(800,600);
mVideoMode.bitDepth = 32;
mVideoMode.fullScreen = false;
mVideoMode.refreshRate = 60;
mVideoMode.resolution.set(800,600);
}
PlatformWindowSDL::~PlatformWindowSDL()
{
// delete our sdl handle..
SDL_DestroyWindow(mWindowHandle);
// delete our sdl handle..
SDL_DestroyWindow(mWindowHandle);
// unlink ourselves from the window list...
AssertFatal(mOwningManager, "PlatformWindowSDL::~PlatformWindowSDL - orphan window, cannot unlink!");
mOwningManager->unlinkWindow(this);
// unlink ourselves from the window list...
AssertFatal(mOwningManager, "PlatformWindowSDL::~PlatformWindowSDL - orphan window, cannot unlink!");
mOwningManager->unlinkWindow(this);
}
GFXDevice * PlatformWindowSDL::getGFXDevice()
{
return mDevice;
return mDevice;
}
GFXWindowTarget * PlatformWindowSDL::getGFXTarget()
{
return mTarget;
return mTarget;
}
const GFXVideoMode & PlatformWindowSDL::getVideoMode()
{
return mVideoMode;
return mVideoMode;
}
void* PlatformWindowSDL::getSystemWindow(const WindowSystem system)
@ -162,41 +162,41 @@ void PlatformWindowSDL::setVideoMode( const GFXVideoMode &mode )
mVideoMode = mode;
mSuppressReset = true;
// Set our window to have the right style based on the mode
// Set our window to have the right style based on the mode
if(mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender)
{
{
setSize(mode.resolution);
SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN);
// When switching to Fullscreen, reset device after setting style
if(mTarget.isValid())
mTarget->resetMode();
}
else
{
if(mTarget.isValid())
mTarget->resetMode();
}
else
{
// Reset device *first*, so that when we call setSize() and let it
// access the monitor settings, it won't end up with our fullscreen
// geometry that is just about to change.
// access the monitor settings, it won't end up with our fullscreen
// geometry that is just about to change.
if(mTarget.isValid())
mTarget->resetMode();
if(mTarget.isValid())
mTarget->resetMode();
if (!mOffscreenRender)
{
SDL_SetWindowFullscreen( mWindowHandle, 0);
SDL_SetWindowFullscreen( mWindowHandle, 0);
}
setSize(mode.resolution);
centerWindow();
}
}
mSuppressReset = false;
mSuppressReset = false;
}
bool PlatformWindowSDL::clearFullscreen()
{
return true;
return true;
}
bool PlatformWindowSDL::isFullscreen()
@ -210,32 +210,32 @@ bool PlatformWindowSDL::isFullscreen()
void PlatformWindowSDL::_setFullscreen(const bool fullscreen)
{
if( isFullscreen() )
return;
if( isFullscreen() )
return;
if(fullscreen && !mOffscreenRender)
{
Con::printf("PlatformWindowSDL::setFullscreen (full) enter");
SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN);
}
else
{
Con::printf("PlatformWindowSDL::setFullscreen (windowed) enter");
if(fullscreen && !mOffscreenRender)
{
Con::printf("PlatformWindowSDL::setFullscreen (full) enter");
SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN);
}
else
{
Con::printf("PlatformWindowSDL::setFullscreen (windowed) enter");
if (!mOffscreenRender)
{
SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN_DESKTOP);
}
setSize(mVideoMode.resolution);
}
Con::printf("PlatformWindowSDL::setFullscreen exit");
}
Con::printf("PlatformWindowSDL::setFullscreen exit");
}
bool PlatformWindowSDL::setCaption( const char *cap )
{
SDL_SetWindowTitle(mWindowHandle, cap);
return true;
return true;
}
const char * PlatformWindowSDL::getCaption()
@ -250,45 +250,45 @@ void PlatformWindowSDL::setFocus()
void PlatformWindowSDL::setClientExtent( const Point2I newExtent )
{
Point2I oldExtent = getClientExtent();
if (oldExtent == newExtent)
return;
Point2I oldExtent = getClientExtent();
if (oldExtent == newExtent)
return;
SDL_SetWindowSize(mWindowHandle, newExtent.x, newExtent.y);
}
const Point2I PlatformWindowSDL::getClientExtent()
{
// Fetch Client Rect from Windows
// Fetch Client Rect from Windows
Point2I size;
SDL_GetWindowSize(mWindowHandle, &size.x, &size.y);
SDL_GetWindowSize(mWindowHandle, &size.x, &size.y);
return size;
return size;
}
void PlatformWindowSDL::setBounds( const RectI &newBounds )
{
// TODO SDL
// TODO SDL
}
const RectI PlatformWindowSDL::getBounds() const
{
// TODO SDL
return RectI(0, 0, 0, 0);
// TODO SDL
return RectI(0, 0, 0, 0);
}
void PlatformWindowSDL::setPosition( const Point2I newPosition )
{
SDL_SetWindowPosition( mWindowHandle, newPosition.x, newPosition.y );
SDL_SetWindowPosition( mWindowHandle, newPosition.x, newPosition.y );
}
const Point2I PlatformWindowSDL::getPosition()
{
Point2I position;
SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y );
Point2I position;
SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y );
// Return position
return position;
// Return position
return position;
}
Point2I PlatformWindowSDL::clientToScreen( const Point2I& pos )
@ -311,7 +311,7 @@ void PlatformWindowSDL::centerWindow()
SDL_GetWindowSize(mWindowHandle, &sizeX, &sizeY);
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0, &mode);
SDL_GetDesktopDisplayMode(0, &mode);
U32 posX = (mode.w/2) - (sizeX/2);
U32 posY = (mode.h/2) - (sizeY/2);
@ -325,21 +325,21 @@ bool PlatformWindowSDL::setSize( const Point2I &newSize )
// Let GFX get an update about the new resolution
if (mTarget.isValid())
mTarget->resetMode();
mTarget->resetMode();
return true;
return true;
}
bool PlatformWindowSDL::isOpen()
{
return mWindowHandle;
return mWindowHandle;
}
bool PlatformWindowSDL::isVisible()
{
// Is the window open and visible, ie. not minimized?
if(!mWindowHandle)
return false;
// Is the window open and visible, ie. not minimized?
if(!mWindowHandle)
return false;
if (mOffscreenRender)
return true;
@ -348,7 +348,7 @@ bool PlatformWindowSDL::isVisible()
if( flags & SDL_WINDOW_SHOWN)
return true;
return false;
return false;
}
bool PlatformWindowSDL::isFocused()
@ -389,7 +389,7 @@ bool PlatformWindowSDL::isMaximized()
WindowId PlatformWindowSDL::getWindowId()
{
return mWindowId;
return mWindowId;
}
void PlatformWindowSDL::minimize()
@ -397,7 +397,7 @@ void PlatformWindowSDL::minimize()
if (mOffscreenRender)
return;
SDL_MinimizeWindow( mWindowHandle );
SDL_MinimizeWindow( mWindowHandle );
}
void PlatformWindowSDL::maximize()
@ -405,7 +405,7 @@ void PlatformWindowSDL::maximize()
if (mOffscreenRender)
return;
SDL_MaximizeWindow( mWindowHandle );
SDL_MaximizeWindow( mWindowHandle );
}
void PlatformWindowSDL::restore()
@ -413,7 +413,7 @@ void PlatformWindowSDL::restore()
if (mOffscreenRender)
return;
SDL_RestoreWindow( mWindowHandle );
SDL_RestoreWindow( mWindowHandle );
}
void PlatformWindowSDL::hide()
@ -421,7 +421,7 @@ void PlatformWindowSDL::hide()
if (mOffscreenRender)
return;
SDL_HideWindow( mWindowHandle );
SDL_HideWindow( mWindowHandle );
}
void PlatformWindowSDL::show()
@ -429,17 +429,17 @@ void PlatformWindowSDL::show()
if (mOffscreenRender)
return;
SDL_ShowWindow( mWindowHandle );
SDL_ShowWindow( mWindowHandle );
}
void PlatformWindowSDL::close()
{
delete this;
delete this;
}
void PlatformWindowSDL::defaultRender()
{
// TODO SDL
// TODO SDL
}
void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt)
@ -615,7 +615,7 @@ void PlatformWindowSDL::setMouseLocked( bool enable )
if (mOffscreenRender)
return;
mMouseLocked = enable;
mMouseLocked = enable;
SDL_SetWindowGrab( mWindowHandle, SDL_bool(enable) );
SDL_SetRelativeMouseMode( SDL_bool(enable) );