Parcourir la source

Swaps some references from the windows SDK-specific FLT_MAX to T3D's F32_MAX
Takes the makeFullPath in findTSShapeConstructor and turn it into a string before passing it along to the Filename to make stricter compilers happy
Removed some referenced to fields that don't exist in the current build
Removed unneeded ASM language activation for the cmake files
Adjustments to material map assembling macros to better comply to stricter compilers

Areloch il y a 5 ans
Parent
commit
9b907e77ee

+ 0 - 3
Engine/source/T3D/debris.cpp

@@ -157,9 +157,6 @@ DebrisData::DebrisData(const DebrisData& other, bool temp_clone) : GameBaseData(
    explosion = other.explosion;
    dMemcpy( emitterList, other.emitterList, sizeof( emitterList ) );
    dMemcpy( emitterIDList, other.emitterIDList, sizeof( emitterIDList ) ); // -- for pack/unpack of emitterList ptrs
-   mShatter = other.mShatter;
-   mProbBreak = other.mProbBreak;
-   mProbDepth = other.mProbDepth;
 }
 
 DebrisData::~DebrisData()

+ 0 - 1
Engine/source/T3D/gameBase/gameBase.cpp

@@ -254,7 +254,6 @@ GameBase::GameBase()
    mTicksSinceLastMove = 0;
    mIsAiControlled = false;
 #endif
-   mTickCount = 0;
    mCameraFov = 90.f;
 }
 

+ 1 - 1
Engine/source/T3D/shapeBase.cpp

@@ -3571,7 +3571,7 @@ Point3F ShapeBaseConvex::support(const VectorF& v) const
 void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFeature* cf)
 {
    cf->material = 0;
-   cf->object = mObject;
+   cf->mObject = mObject;
 
    TSShape::ConvexHullAccelerator* pAccel =
       pShapeBase->mShapeInstance->getShape()->getAccelerator(pShapeBase->mDataBlock->collisionDetails[hullId]);

+ 1 - 1
Engine/source/gui/containers/guiAutoScrollCtrl.cpp

@@ -92,7 +92,7 @@ GuiAutoScrollCtrl::GuiAutoScrollCtrl()
      mIsLooping( true ),
      mCurrentPhase( GuiAutoScrollCtrl::PhaseComplete ),
      mCurrentTime( 0.f ),
-     mCompleteTime(FLT_MAX),
+     mCompleteTime(F32_MAX),
      mCurrentPosition(0.0f),
      mStartDelay( 3.f ),
      mResetDelay( 5.f ),

+ 77 - 49
Engine/source/materials/materialDefinition.cpp

@@ -97,8 +97,8 @@ ImplementEnumType( MaterialWaveType,
    { Material::Square,       "Square", "Warps the material along a wave which transitions between two oppposite states. As a Square Wave, the transition is quick and sudden." },
 EndImplementEnumType;
 
-#define initMapSlot(name,id) name##Filename[id##] = String::EmptyString; name##AssetId[id##] = StringTable->EmptyString(); name##Asset[id##] = NULL;
-#define bindMapSlot(name,id) if (name##AssetId[id##] != String::EmptyString) name##Asset[id##] = name##AssetId[id##];
+#define initMapSlot(name,id) m##name##Filename[id] = String::EmptyString; m##name##AssetId[id] = StringTable->EmptyString(); m##name##Asset[id] = NULL;
+#define bindMapSlot(name,id) if (m##name##AssetId[id] != String::EmptyString) m##name##Asset[id] = m##name##AssetId[id];
 
 bool Material::sAllowTextureTargetAssignment = false;
 
@@ -124,7 +124,7 @@ Material::Material()
       mSmoothness[i] = 0.0f;
       mMetalness[i] = 0.0f;
 
-	   mIsSRGb[i] = false;
+	   mIsSRGb[i] = true;
       mInvertSmoothness[i] = false;
 
       mSmoothnessChan[i] = 0;
@@ -138,18 +138,23 @@ Material::Material()
       mAccuCoverage[i]  = 0.9f;
       mAccuSpecular[i]  = 16.0f;
 
-      initMapSlot(mDiffuseMap, i);
-      initMapSlot(mOverlayMap, i);
-      initMapSlot(mLightMap, i);
-      initMapSlot(mToneMap, i);
-      initMapSlot(mDetailMap, i);
-      initMapSlot(mNormalMap, i);
-      initMapSlot(mPBRConfigMap, i);
-      initMapSlot(mRoughMap, i);
-      initMapSlot(mAOMap, i);
-      initMapSlot(mMetalMap, i);
-      initMapSlot(mGlowMap, i);
-      initMapSlot(mDetailNormalMap, i);
+      initMapSlot(DiffuseMap, i);
+      initMapSlot(OverlayMap, i);
+      initMapSlot(LightMap, i);
+      initMapSlot(ToneMap, i);
+      initMapSlot(DetailMap, i);
+      initMapSlot(NormalMap, i);
+      initMapSlot(PBRConfigMap, i);
+      initMapSlot(RoughMap, i);
+      initMapSlot(AOMap, i);
+      initMapSlot(MetalMap, i);
+      initMapSlot(GlowMap, i);
+      initMapSlot(DetailNormalMap, i);
+
+      //cogs specific
+      initMapSlot(AlbedoDamageMap, i);
+      initMapSlot(NormalDamageMap, i);
+      initMapSlot(CompositeDamageMap, i);
 
       mParallaxScale[i] = 0.0f;
 
@@ -188,13 +193,10 @@ Material::Material()
 
       // Deferred Shading
       mMatInfoFlags[i] = 0.0f;
-      mRoughMapFilename[i].clear();
-      mRoughMapAsset[i] = StringTable->EmptyString();
-      mAOMapFilename[i].clear();
-      mMetalMapFilename[i].clear();
-      mMetalMapAsset[i] = StringTable->EmptyString();
-      mGlowMapFilename[i].clear();
-      mGlowMapAsset[i] = StringTable->EmptyString();
+
+      // Damage
+      mMaterialDamageMin[i] = 0.0f;
+      mAlbedoDamageMapSRGB[i] = true;
       mGlowMul[i] = 0.0f;
    }
 
@@ -232,6 +234,7 @@ Material::Material()
    dMemset( mEffectColor,     0, sizeof( mEffectColor ) );
 
    mFootstepSoundId = -1;     mImpactSoundId = -1;
+   mImpactFXIndex = -1;
    mFootstepSoundCustom = 0;  mImpactSoundCustom = 0;
    mFriction = 0.0;
    
@@ -240,9 +243,9 @@ Material::Material()
 }
 
 
-#define assetText(x,suff) (String::String(#x) + String::String(#suff)).c_str()
-#define scriptBindMapSlot(name) addField(#name, TypeImageFilename, Offset(m##name##Filename, Material), MAX_STAGES, assetText(name,texture map.)); \
-                                      addField(assetText(name,Asset), TypeImageAssetPtr, Offset(m##name##AssetId, Material), MAX_STAGES, assetText(name,asset reference.));
+#define assetText(x,suff) std::string(std::string(#x) + std::string(#suff)).c_str()
+#define scriptBindMapSlot(name,arraySize) addField(#name, TypeImageFilename, Offset(m##name##Filename, Material), arraySize, assetText(name,texture map.)); \
+                                      addField(assetText(name,Asset), TypeImageAssetPtr, Offset(m##name##AssetId, Material), arraySize, assetText(name,asset reference.));
 
 void Material::initPersistFields()
 {
@@ -255,19 +258,18 @@ void Material::initPersistFields()
          "This color is multiplied against the diffuse texture color.  If no diffuse texture "
          "is present this is the material color." );
 
-      scriptBindMapSlot(DiffuseMap);
-      scriptBindMapSlot(DiffuseMap);
-      scriptBindMapSlot(OverlayMap);
-      scriptBindMapSlot(LightMap);
-      scriptBindMapSlot(ToneMap);
-      scriptBindMapSlot(DetailMap);
-      scriptBindMapSlot(NormalMap);
-      scriptBindMapSlot(PBRConfigMap);
-      scriptBindMapSlot(RoughMap);
-      scriptBindMapSlot(AOMap);
-      scriptBindMapSlot(MetalMap);
-      scriptBindMapSlot(GlowMap);
-      scriptBindMapSlot(DetailNormalMap);
+      scriptBindMapSlot(DiffuseMap, MAX_STAGES);
+      scriptBindMapSlot(OverlayMap, MAX_STAGES);
+      scriptBindMapSlot(LightMap, MAX_STAGES);
+      scriptBindMapSlot(ToneMap, MAX_STAGES);
+      scriptBindMapSlot(DetailMap, MAX_STAGES);
+      scriptBindMapSlot(NormalMap, MAX_STAGES);
+      scriptBindMapSlot(PBRConfigMap, MAX_STAGES);
+      scriptBindMapSlot(RoughMap, MAX_STAGES);
+      scriptBindMapSlot(AOMap, MAX_STAGES);
+      scriptBindMapSlot(MetalMap, MAX_STAGES);
+      scriptBindMapSlot(GlowMap, MAX_STAGES);
+      scriptBindMapSlot(DetailNormalMap, MAX_STAGES);
 
       addField("diffuseMapSRGB", TypeBool, Offset(mDiffuseMapSRGB, Material), MAX_STAGES,
          "Enable sRGB for the diffuse color texture map.");
@@ -420,6 +422,22 @@ void Material::initPersistFields()
 
    endArray( "Stages" );
 
+   addGroup("Damage");
+
+   //cogs
+   scriptBindMapSlot(AlbedoDamageMap, MAX_STAGES);
+   /// Damage blend maps (normal)
+   scriptBindMapSlot(NormalDamageMap, MAX_STAGES);
+   /// Damage blend maps (Roughness, AO, Metalness)
+   scriptBindMapSlot(CompositeDamageMap, MAX_STAGES);
+
+   addField("albedoDamageSRGB", TypeBool, Offset(mAlbedoDamageMapSRGB, Material), MAX_STAGES,
+      "Enable sRGB for the albedo damage map");
+
+   addField("minDamage", TypeF32, Offset(mMaterialDamageMin, Material), MAX_STAGES,
+      "The minimum ammount of blended damage.");
+   endGroup("Damage");
+
    addField( "castShadows", TypeBool, Offset(mCastShadows, Material),
       "If set to false the lighting system will not cast shadows from this material." );
 
@@ -492,6 +510,10 @@ void Material::initPersistFields()
          "What sound to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater "
          "than PlayerData::groundImpactMinSpeed.\n\n"
          "For a list of IDs, see #footstepSoundId" );
+      addField("ImpactFXIndex", TypeS32, Offset(mImpactFXIndex, Material),
+         "What FX to play from the PlayerData sound list when the player impacts on the surface with a velocity equal or greater "
+         "than PlayerData::groundImpactMinSpeed.\n\n"
+         "For a list of IDs, see #impactFXId");
       addField( "customImpactSound", TypeSFXTrackName,    Offset( mImpactSoundCustom, Material ),
          "The sound to play when the player impacts on the surface with a velocity equal or greater than PlayerData::groundImpactMinSpeed.  "
          "If this is set, it overrides #impactSoundId.  This field is useful for directly assigning custom impact sounds to materials "
@@ -559,6 +581,7 @@ bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char
 	return false;
 }
 
+
 bool Material::onAdd()
 {
    if (Parent::onAdd() == false)
@@ -595,17 +618,22 @@ bool Material::onAdd()
   */
    for (U32 i = 0; i < MAX_STAGES; i++)
    {
-      bindMapSlot(mDiffuseMap, i);
-      bindMapSlot(mOverlayMap, i);
-      bindMapSlot(mLightMap, i);
-      bindMapSlot(mToneMap, i);
-      bindMapSlot(mDetailMap, i);
-      bindMapSlot(mPBRConfigMap, i);
-      bindMapSlot(mRoughMap, i);
-      bindMapSlot(mAOMap, i);
-      bindMapSlot(mMetalMap, i);
-      bindMapSlot(mGlowMap, i);
-      bindMapSlot(mDetailNormalMap, i);
+      bindMapSlot(DiffuseMap, i);
+      bindMapSlot(OverlayMap, i);
+      bindMapSlot(LightMap, i);
+      bindMapSlot(ToneMap, i);
+      bindMapSlot(DetailMap, i);
+      bindMapSlot(PBRConfigMap, i);
+      bindMapSlot(RoughMap, i);
+      bindMapSlot(AOMap, i);
+      bindMapSlot(MetalMap, i);
+      bindMapSlot(GlowMap, i);
+      bindMapSlot(DetailNormalMap, i);
+
+      //cogs specific
+      bindMapSlot(AlbedoDamageMap, i);
+      bindMapSlot(NormalDamageMap, i);
+      bindMapSlot(CompositeDamageMap, i);
    }
 
    _mapMaterial();

+ 33 - 47
Engine/source/materials/materialDefinition.h

@@ -213,63 +213,48 @@ public:
    //-----------------------------------------------------------------------
    // Data
    //-----------------------------------------------------------------------
-   FileName mDiffuseMapFilename[MAX_STAGES];
-   StringTableEntry mDiffuseMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mDiffuseMapAsset[MAX_STAGES];
+   DECLARE_TEXTUREARRAY(DiffuseMap, MAX_STAGES);
    bool     mDiffuseMapSRGB[MAX_STAGES];   // SRGB diffuse
-   bool     mAccuEnabled[MAX_STAGES];
-   F32      mAccuScale[MAX_STAGES];
-   F32      mAccuDirection[MAX_STAGES];
-   F32      mAccuStrength[MAX_STAGES];
-   F32      mAccuCoverage[MAX_STAGES];
-   F32      mAccuSpecular[MAX_STAGES];
-   FileName mOverlayMapFilename[MAX_STAGES];
-   StringTableEntry mOverlayMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mOverlayMapAsset[MAX_STAGES];
-   FileName mLightMapFilename[MAX_STAGES];
-   StringTableEntry mLightMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mLightMapAsset[MAX_STAGES];
-   FileName mToneMapFilename[MAX_STAGES];
-   StringTableEntry mToneMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mToneMapAsset[MAX_STAGES];
-   FileName mDetailMapFilename[MAX_STAGES];
-   StringTableEntry mDetailMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mDetailMapAsset[MAX_STAGES];
-   FileName mNormalMapFilename[MAX_STAGES];
-   StringTableEntry mNormalMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mNormalMapAsset[MAX_STAGES];
-
+   DECLARE_TEXTUREARRAY(OverlayMap, MAX_STAGES);
+   DECLARE_TEXTUREARRAY(LightMap, MAX_STAGES);;
+   DECLARE_TEXTUREARRAY(ToneMap, MAX_STAGES);
+   DECLARE_TEXTUREARRAY(DetailMap, MAX_STAGES);;
+   DECLARE_TEXTUREARRAY(NormalMap, MAX_STAGES);
+   DECLARE_TEXTUREARRAY(PBRConfigMap, MAX_STAGES);
    bool     mIsSRGb[MAX_STAGES];
+   DECLARE_TEXTUREARRAY(RoughMap, MAX_STAGES);
    bool     mInvertSmoothness[MAX_STAGES];
-   FileName mPBRConfigMapFilename[MAX_STAGES];
-   StringTableEntry mPBRConfigMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mPBRConfigMapAsset[MAX_STAGES];
-   FileName mRoughMapFilename[MAX_STAGES];
-   StringTableEntry mRoughMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mRoughMapAsset[MAX_STAGES];
    F32      mSmoothnessChan[MAX_STAGES];
-   FileName mAOMapFilename[MAX_STAGES];
-   StringTableEntry mAOMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mAOMapAsset[MAX_STAGES];
+   DECLARE_TEXTUREARRAY(AOMap, MAX_STAGES);
    F32      mAOChan[MAX_STAGES];
-   FileName mMetalMapFilename[MAX_STAGES];
-   StringTableEntry mMetalMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mMetalMapAsset[MAX_STAGES];
+   DECLARE_TEXTUREARRAY(MetalMap, MAX_STAGES);
    F32      mMetalChan[MAX_STAGES];
-
-   FileName mGlowMapFilename[MAX_STAGES];
-   StringTableEntry mGlowMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mGlowMapAsset[MAX_STAGES];
+   DECLARE_TEXTUREARRAY(GlowMap, MAX_STAGES);
    F32      mGlowMul[MAX_STAGES];
    /// A second normal map which repeats at the detail map
    /// scale and blended with the base normal map.
-   FileName mDetailNormalMapFilename[MAX_STAGES];
-   StringTableEntry mDetailNormalMapAssetId[MAX_STAGES];
-   AssetPtr<ImageAsset> mDetailNormalMapAsset[MAX_STAGES];
-
+   DECLARE_TEXTUREARRAY(DetailNormalMap, MAX_STAGES);
    /// The strength scalar for the detail normal map.
-   F32 mDetailNormalMapStrength[MAX_STAGES];   
-      
+   F32 mDetailNormalMapStrength[MAX_STAGES];
+
+   bool     mAccuEnabled[MAX_STAGES];
+   F32      mAccuScale[MAX_STAGES];
+   F32      mAccuDirection[MAX_STAGES];
+   F32      mAccuStrength[MAX_STAGES];
+   F32      mAccuCoverage[MAX_STAGES];
+   F32      mAccuSpecular[MAX_STAGES];
+
+   //cogs specific
+   /// Damage blend maps (albedo)
+   DECLARE_TEXTUREARRAY(AlbedoDamageMap, MAX_STAGES);
+   bool mAlbedoDamageMapSRGB[MAX_STAGES];
+   /// Damage blend maps (normal)
+   DECLARE_TEXTUREARRAY(NormalDamageMap, MAX_STAGES);
+   /// Damage blend maps (Roughness, AO, Metalness)
+   DECLARE_TEXTUREARRAY(CompositeDamageMap, MAX_STAGES);
+   /// Damage blend minimum
+   F32      mMaterialDamageMin[MAX_STAGES];
+
    /// This color is the diffuse color of the material
    /// or if it has a texture it is multiplied against 
    /// the diffuse texture color.
@@ -373,6 +358,7 @@ public:
    /// @see mFootstepSoundCustom
    S32 mFootstepSoundId;
    S32 mImpactSoundId;
+   S32 mImpactFXIndex;
 
    /// Sound effect to play when walking on surface with this material.
    /// If defined, overrides mFootstepSoundId.

+ 2 - 0
Engine/source/sfx/openal/sfxALDevice.cpp

@@ -84,9 +84,11 @@ SFXALDevice::SFXALDevice(  SFXProvider *provider,
    }
 #endif
 
+#if defined(AL_ALEXT_PROTOTYPES)
    dMemset(effectSlot, 0, sizeof(effectSlot));
    dMemset(effect, 0, sizeof(effect));
    uLoop = 0;
+#endif
 }
 
 //-----------------------------------------------------------------------------

+ 1 - 1
Engine/source/ts/tsShapeConstruct.cpp

@@ -393,7 +393,7 @@ TSShapeConstructor* TSShapeConstructor::findShapeConstructor(const FileName& pat
          FileName shapePath = tss->mShapePath;
 
          char buf[1024];
-         FileName fullShapePath = Platform::makeFullPathName(shapePath, buf, sizeof(buf));
+         FileName fullShapePath = String(Platform::makeFullPathName(shapePath, buf, sizeof(buf)));
          if (shapePath.equal( path, String::NoCase ) || fullShapePath.equal(path, String::NoCase))
             return tss;
       }

+ 0 - 4
Tools/CMake/torque3d.cmake

@@ -38,10 +38,6 @@ if(UNIX)
 
    endif()    
 
-	# for asm files
-	SET (CMAKE_ASM_NASM_OBJECT_FORMAT "elf")
-	ENABLE_LANGUAGE (ASM_NASM)
-
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 endif()