clang: constructor initialization order

while not a major issue per-se, the sheer number of times the engine has to jump back in memory and backfill data in a given class can add up. First run of... many.,
This commit is contained in:
Azaezel 2016-10-14 18:16:55 -05:00
parent 1131ed15df
commit fbfd3ed8ed
64 changed files with 260 additions and 255 deletions

View file

@ -91,9 +91,9 @@ ConsoleSetType(TypeComponentAssetPtr)
//-----------------------------------------------------------------------------
ComponentAsset::ComponentAsset() :
mAcquireReferenceCount(0),
mpOwningAssetManager(NULL),
mAssetInitialized(false)
mAssetInitialized(false),
mAcquireReferenceCount(0)
{
// Generate an asset definition.
mpAssetDefinition = new AssetDefinition();

View file

@ -91,9 +91,9 @@ ConsoleSetType(TypeExampleAssetPtr)
//-----------------------------------------------------------------------------
ExampleAsset::ExampleAsset() :
mAcquireReferenceCount(0),
mpOwningAssetManager(NULL),
mAssetInitialized(false)
mAssetInitialized(false),
mAcquireReferenceCount(0)
{
// Generate an asset definition.
mpAssetDefinition = new AssetDefinition();

View file

@ -91,9 +91,9 @@ ConsoleSetType(TypeGameObjectAssetPtr)
//-----------------------------------------------------------------------------
GameObjectAsset::GameObjectAsset() :
mAcquireReferenceCount(0),
mpOwningAssetManager(NULL),
mAssetInitialized(false)
mAssetInitialized(false),
mAcquireReferenceCount(0)
{
// Generate an asset definition.
mpAssetDefinition = new AssetDefinition();

View file

@ -96,9 +96,9 @@ ConsoleSetType(TypeShapeAssetPtr)
//-----------------------------------------------------------------------------
ShapeAsset::ShapeAsset() :
mAcquireReferenceCount(0),
mpOwningAssetManager(NULL),
mAssetInitialized(false)
mAssetInitialized(false),
mAcquireReferenceCount(0)
{
}

View file

@ -39,14 +39,14 @@ class WaterObject;
struct ContainerQueryInfo
{
ContainerQueryInfo()
: waterCoverage(0.0f),
: box(-1,-1,-1,1,1,1),
mass(1.0f),
waterCoverage(0.0f),
waterHeight(0.0f),
waterDensity(0.0f),
waterViscosity(0.0f),
gravityScale(1.0f),
appliedForce(0,0,0),
box(-1,-1,-1,1,1,1),
mass(1.0f),
waterObject(NULL)
{
}

View file

@ -227,12 +227,12 @@ bool ConvexShape::protectedSetSurface( void *object, const char *index, const ch
ConvexShape::ConvexShape()
: mMaterialInst( NULL ),
mNormalLength( 0.3f ),
: mMaterialName( "Grid512_OrangeLines_Mat" ),
mMaterialInst( NULL ),
mVertCount( 0 ),
mPrimCount( 0 ),
mMaterialName( "Grid512_OrangeLines_Mat" ),
mPhysicsRep( NULL )
mPhysicsRep( NULL ),
mNormalLength( 0.3f )
{
mNetFlags.set( Ghostable | ScopeAlways );

View file

@ -60,14 +60,14 @@ GFXImplementVertexFormat( GCVertex )
};
GroundCoverShaderConstHandles::GroundCoverShaderConstHandles()
: mTypeRectsSC( NULL ),
: mGroundCover( NULL ),
mTypeRectsSC( NULL ),
mFadeSC( NULL ),
mWindDirSC( NULL ),
mGustInfoSC( NULL ),
mTurbInfoSC( NULL ),
mCamRightSC( NULL ),
mCamUpSC( NULL ),
mGroundCover( NULL )
mCamUpSC( NULL )
{
}

View file

@ -69,9 +69,9 @@ GroundPlane::GroundPlane()
mScaleU( 1.0f ),
mScaleV( 1.0f ),
mMaterial( NULL ),
mPhysicsRep( NULL ),
mMin( 0.0f, 0.0f ),
mMax( 0.0f, 0.0f ),
mPhysicsRep( NULL )
mMax( 0.0f, 0.0f )
{
mTypeMask |= StaticObjectType | StaticShapeObjectType;
mNetFlags.set( Ghostable | ScopeAlways );

View file

@ -36,15 +36,15 @@
// GuiMaterialPreview
GuiMaterialPreview::GuiMaterialPreview()
: mMaxOrbitDist(5.0f),
mMinOrbitDist(0.0f),
mOrbitDist(5.0f),
mMouseState(None),
: mMouseState(None),
mModel(NULL),
mLastMousePoint(0, 0),
lastRenderTime(0),
runThread(0),
mFakeSun(NULL)
lastRenderTime(0),
mLastMousePoint(0, 0),
mFakeSun(NULL),
mMaxOrbitDist(5.0f),
mMinOrbitDist(0.0f),
mOrbitDist(5.0f)
{
mActive = true;
mCameraMatrix.identity();

View file

@ -89,21 +89,21 @@ IMPLEMENT_CALLBACK( GuiObjectView, onMouseLeave, void, (),(),
//------------------------------------------------------------------------------
GuiObjectView::GuiObjectView()
: mMaxOrbitDist( 5.0f ),
mMinOrbitDist( 0.0f ),
mOrbitDist( 5.0f ),
mMouseState( None ),
mModel( NULL ),
mMountedModel( NULL ),
: mMouseState( None ),
mLastMousePoint( 0, 0 ),
mLastRenderTime( 0 ),
mRunThread( NULL ),
mLight( NULL ),
mAnimationSeq( -1 ),
mMountNodeName( "mount0" ),
mMountNode( -1 ),
mModel( NULL ),
mMaxOrbitDist( 5.0f ),
mMinOrbitDist( 0.0f ),
mCameraRotation( 0.0f, 0.0f, 0.0f ),
mOrbitDist( 5.0f ),
mCameraSpeed( 0.01f ),
mCameraRotation( 0.0f, 0.0f, 0.0f ),
mMountNode( -1 ),
mMountNodeName( "mount0" ),
mMountedModel( NULL ),
mAnimationSeq( -1 ),
mRunThread( NULL ),
mLastRenderTime( 0 ),
mLight( NULL ),
mLightColor( 1.0f, 1.0f, 1.0f ),
mLightAmbient( 0.5f, 0.5f, 0.5f ),
mLightDirection( 0.f, 0.707f, -0.707f )

View file

@ -79,16 +79,16 @@ static SFXAmbience sDefaultAmbience;
//-----------------------------------------------------------------------------
LevelInfo::LevelInfo()
: mNearClip( 0.1f ),
: mWorldSize( 10000.0f ),
mNearClip( 0.1f ),
mVisibleDistance( 1000.0f ),
mVisibleGhostDistance ( 0 ),
mDecalBias( 0.0015f ),
mCanvasClearColor( 255, 0, 255, 255 ),
mAmbientLightBlendPhase( 1.f ),
mSoundAmbience( NULL ),
mSoundscape( NULL ),
mSoundDistanceModel( SFXDistanceModelLinear ),
mWorldSize( 10000.0f ),
mAmbientLightBlendPhase( 1.f )
mSoundscape( NULL )
{
mFogData.density = 0.0f;
mFogData.densityOffset = 0.0f;

View file

@ -118,11 +118,11 @@ ConsoleDocClass( LightFlareData,
);
LightFlareData::LightFlareData()
: mFlareEnabled( true ),
mElementCount( 0 ),
mScale( 1.0f ),
: mScale( 1.0f ),
mFlareEnabled( true ),
mOcclusionRadius( 0.0f ),
mRenderReflectPass( true )
mRenderReflectPass( true ),
mElementCount( 0 )
{
dMemset( mElementRect, 0, sizeof( RectF ) * MAX_ELEMENTS );
dMemset( mElementScale, 0, sizeof( F32 ) * MAX_ELEMENTS );

View file

@ -46,9 +46,9 @@ struct PhysicsState
momentum( Point3F::Zero ),
orientation( QuatF::Identity ),
angularMomentum( Point3F::Zero ),
sleeping( false ),
linVelocity( Point3F::Zero ),
angVelocity( Point3F::Zero ),
sleeping( false )
angVelocity( Point3F::Zero )
{
}

View file

@ -312,11 +312,11 @@ PhysicsDebris* PhysicsDebris::create( PhysicsDebrisData *datablock,
}
PhysicsDebris::PhysicsDebris()
: mDataBlock( NULL ),
mLifetime( 0.0f ),
: mLifetime( 0.0f ),
mInitialLinVel( Point3F::Zero ),
mDataBlock( NULL ),
mShapeInstance( NULL ),
mWorld( NULL ),
mInitialLinVel( Point3F::Zero )
mWorld( NULL )
{
mTypeMask |= DebrisObjectType | DynamicShapeObjectType;

View file

@ -41,9 +41,10 @@ ConsoleDocClass( PhysicsForce,
PhysicsForce::PhysicsForce()
: mWorld( NULL ),
mBody( NULL ),
mPhysicsTick( false )
:
mWorld( NULL ),
mPhysicsTick( false ),
mBody( NULL )
{
}

View file

@ -401,12 +401,12 @@ ConsoleDocClass( PhysicsShape,
PhysicsShape::PhysicsShape()
: mPhysicsRep( NULL ),
mWorld( NULL ),
mShapeInst( NULL ),
mResetPos( MatrixF::Identity ),
mShapeInst( NULL ),
mDestroyed( false ),
mPlayAmbient( false ),
mAmbientThread( NULL ),
mAmbientSeq( -1 )
mAmbientSeq( -1 ),
mAmbientThread( NULL )
{
mNetFlags.set( Ghostable | ScopeAlways );
mTypeMask |= DynamicShapeObjectType;

View file

@ -55,11 +55,12 @@ public:
/// The constructor.
PhysicsUserData()
: mObject( NULL ),
:
#ifdef TORQUE_DEBUG
mTypeId( smTypeName ),
#endif
mObject( NULL ),
mBody( NULL )
#ifdef TORQUE_DEBUG
, mTypeId( smTypeName )
#endif
{}
/// The destructor.
@ -117,4 +118,4 @@ protected:
PhysicsBody *mBody;
};
#endif // _PHYSICS_PHYSICSUSERDATA_H_
#endif // _PHYSICS_PHYSICSUSERDATA_H_

View file

@ -551,14 +551,14 @@ S32 ProjectileData::scaleValue( S32 value, bool down )
Projectile::Projectile()
: mPhysicsWorld( NULL ),
mDataBlock( NULL ),
mParticleEmitter( NULL ),
mParticleWaterEmitter( NULL ),
mSound( NULL ),
mCurrPosition( 0, 0, 0 ),
mCurrVelocity( 0, 0, 1 ),
mSourceObjectId( -1 ),
mSourceObjectSlot( -1 ),
mCurrTick( 0 ),
mParticleEmitter( NULL ),
mParticleWaterEmitter( NULL ),
mSound( NULL ),
mProjectileShape( NULL ),
mActivateThread( NULL ),
mMaintainThread( NULL ),

View file

@ -95,9 +95,9 @@ SFXEmitter::SFXEmitter()
: SceneObject(),
mSource( NULL ),
mTrack( NULL ),
mUseTrackDescriptionOnly( false ),
mLocalProfile( &mDescription ),
mPlayOnAdd( true ),
mUseTrackDescriptionOnly( false )
mPlayOnAdd( true )
{
mTypeMask |= MarkerObjectType;
mNetFlags.set( Ghostable | ScopeAlways );

View file

@ -168,12 +168,9 @@ ShapeBaseData::ShapeBaseData()
density( 1.0f ),
maxEnergy( 0.0f ),
maxDamage( 1.0f ),
destroyedLevel( 1.0f ),
disabledLevel( 1.0f ),
repairRate( 0.0033f ),
eyeNode( -1 ),
earNode( -1 ),
cameraNode( -1 ),
disabledLevel( 1.0f ),
destroyedLevel( 1.0f ),
cameraMaxDist( 0.0f ),
cameraMinDist( 0.2f ),
cameraDefaultFov( 75.0f ),
@ -181,6 +178,11 @@ ShapeBaseData::ShapeBaseData()
cameraMaxFov( 120.f ),
cameraCanBank( false ),
mountedImagesBank( false ),
mCRC( 0 ),
computeCRC( false ),
eyeNode( -1 ),
earNode( -1 ),
cameraNode( -1 ),
debrisDetail( -1 ),
damageSequence( -1 ),
hulkSequence( -1 ),
@ -189,9 +191,7 @@ ShapeBaseData::ShapeBaseData()
useEyePoint( false ),
isInvincible( false ),
renderWhenDestroyed( true ),
computeCRC( false ),
inheritEnergyFromMount( false ),
mCRC( 0 )
inheritEnergyFromMount( false )
{
dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints );
}