diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index b581b8261..de991db51 100644 --- a/Engine/source/T3D/debris.cpp +++ b/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() diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index a1616751a..2f6fd36d2 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -254,7 +254,6 @@ GameBase::GameBase() mTicksSinceLastMove = 0; mIsAiControlled = false; #endif - mTickCount = 0; mCameraFov = 90.f; } diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 9042f3a82..d9830785d 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/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]); diff --git a/Engine/source/gui/containers/guiAutoScrollCtrl.cpp b/Engine/source/gui/containers/guiAutoScrollCtrl.cpp index 5d252bc53..bb3432bce 100644 --- a/Engine/source/gui/containers/guiAutoScrollCtrl.cpp +++ b/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 ), diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 250af18d6..83a711343 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/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(); diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index a8adbf34e..b41c495dd 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -213,63 +213,48 @@ public: //----------------------------------------------------------------------- // Data //----------------------------------------------------------------------- - FileName mDiffuseMapFilename[MAX_STAGES]; - StringTableEntry mDiffuseMapAssetId[MAX_STAGES]; - AssetPtr mDiffuseMapAsset[MAX_STAGES]; + DECLARE_TEXTUREARRAY(DiffuseMap, MAX_STAGES); bool mDiffuseMapSRGB[MAX_STAGES]; // SRGB diffuse + 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]; + F32 mSmoothnessChan[MAX_STAGES]; + DECLARE_TEXTUREARRAY(AOMap, MAX_STAGES); + F32 mAOChan[MAX_STAGES]; + DECLARE_TEXTUREARRAY(MetalMap, MAX_STAGES); + F32 mMetalChan[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. + DECLARE_TEXTUREARRAY(DetailNormalMap, MAX_STAGES); + /// The strength scalar for the detail normal map. + 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]; - FileName mOverlayMapFilename[MAX_STAGES]; - StringTableEntry mOverlayMapAssetId[MAX_STAGES]; - AssetPtr mOverlayMapAsset[MAX_STAGES]; - FileName mLightMapFilename[MAX_STAGES]; - StringTableEntry mLightMapAssetId[MAX_STAGES]; - AssetPtr mLightMapAsset[MAX_STAGES]; - FileName mToneMapFilename[MAX_STAGES]; - StringTableEntry mToneMapAssetId[MAX_STAGES]; - AssetPtr mToneMapAsset[MAX_STAGES]; - FileName mDetailMapFilename[MAX_STAGES]; - StringTableEntry mDetailMapAssetId[MAX_STAGES]; - AssetPtr mDetailMapAsset[MAX_STAGES]; - FileName mNormalMapFilename[MAX_STAGES]; - StringTableEntry mNormalMapAssetId[MAX_STAGES]; - AssetPtr mNormalMapAsset[MAX_STAGES]; - bool mIsSRGb[MAX_STAGES]; - bool mInvertSmoothness[MAX_STAGES]; - FileName mPBRConfigMapFilename[MAX_STAGES]; - StringTableEntry mPBRConfigMapAssetId[MAX_STAGES]; - AssetPtr mPBRConfigMapAsset[MAX_STAGES]; - FileName mRoughMapFilename[MAX_STAGES]; - StringTableEntry mRoughMapAssetId[MAX_STAGES]; - AssetPtr mRoughMapAsset[MAX_STAGES]; - F32 mSmoothnessChan[MAX_STAGES]; - FileName mAOMapFilename[MAX_STAGES]; - StringTableEntry mAOMapAssetId[MAX_STAGES]; - AssetPtr mAOMapAsset[MAX_STAGES]; - F32 mAOChan[MAX_STAGES]; - FileName mMetalMapFilename[MAX_STAGES]; - StringTableEntry mMetalMapAssetId[MAX_STAGES]; - AssetPtr mMetalMapAsset[MAX_STAGES]; - F32 mMetalChan[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]; - FileName mGlowMapFilename[MAX_STAGES]; - StringTableEntry mGlowMapAssetId[MAX_STAGES]; - AssetPtr mGlowMapAsset[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 mDetailNormalMapAsset[MAX_STAGES]; - - /// The strength scalar for the detail normal map. - F32 mDetailNormalMapStrength[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. diff --git a/Engine/source/sfx/openal/sfxALDevice.cpp b/Engine/source/sfx/openal/sfxALDevice.cpp index 58d7c0146..9dd308c58 100644 --- a/Engine/source/sfx/openal/sfxALDevice.cpp +++ b/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 } //----------------------------------------------------------------------------- diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 40004e98b..0de7478c3 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/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; } diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 990030ec3..6337f35e9 100644 --- a/Tools/CMake/torque3d.cmake +++ b/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()