From 21c17d0ed1748973d4558fd76c1a893bb2e7906a Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Fri, 17 Sep 2021 01:24:20 -0500 Subject: [PATCH 01/38] cleanups for shadergen and the visibility feature math fixes, feature inclusion removal. will still need to circle back on why the crosshatch.. isn't --- .../lighting/shadowMap/shadowMatHook.cpp | 4 +--- .../shaderGen/GLSL/shaderFeatureGLSL.cpp | 24 ++++--------------- .../shaderGen/HLSL/shaderFeatureHLSL.cpp | 6 ++--- .../core/rendering/shaders/gl/torque.glsl | 4 ++-- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/Engine/source/lighting/shadowMap/shadowMatHook.cpp b/Engine/source/lighting/shadowMap/shadowMatHook.cpp index 30f2db593..c6b8bab01 100644 --- a/Engine/source/lighting/shadowMap/shadowMatHook.cpp +++ b/Engine/source/lighting/shadowMap/shadowMatHook.cpp @@ -186,10 +186,8 @@ void ShadowMaterialHook::_overrideFeatures( ProcessedMaterial *mat, type == MFT_TexAnim || type == MFT_DiffuseMap || type == MFT_IsTranslucent || - type == MFT_Visibility || type == MFT_UseInstancing || - type == MFT_EyeSpaceDepthOut || - type == MFT_DeferredConditioner) + type == MFT_EyeSpaceDepthOut) newFeatures.addFeature(type); else if (type.getGroup() == MFG_PreTransform || type.getGroup() == MFG_Transform || diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 2bd24931d..3ee76ffdf 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -455,12 +455,12 @@ Var* ShaderFeatureGLSL::addOutVpos( MultiLine *meta, outVpos = connectComp->getElement( RT_TEXCOORD ); outVpos->setName( "outVpos" ); outVpos->setStructName( "OUT" ); - outVpos->setType( "vec4" ); + outVpos->setType( "vec3" ); Var *outPosition = (Var*) LangElement::find( "gl_Position" ); AssertFatal( outPosition, "ShaderFeatureGLSL::addOutVpos - Didn't find the output position." ); - meta->addStatement( new GenOp( " @ = @;\r\n", outVpos, outPosition ) ); + meta->addStatement( new GenOp( " @ = @.xyz;\r\n", outVpos, outPosition ) ); } return outVpos; @@ -474,25 +474,11 @@ Var* ShaderFeatureGLSL::getInVpos( MultiLine *meta, return inVpos; ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); - /* - if ( GFX->getPixelShaderVersion() >= 3.0f ) - { - inVpos = connectComp->getElement( RT_VPOS ); - inVpos->setName( "vpos" ); - inVpos->setStructName( "IN" ); - inVpos->setType( "vec2" ); - return inVpos; - } - */ inVpos = connectComp->getElement( RT_TEXCOORD ); inVpos->setName( "inVpos" ); inVpos->setStructName( "IN" ); inVpos->setType( "vec4" ); - - Var *vpos = new Var( "vpos", "vec2" ); - meta->addStatement( new GenOp( " @ = @.xy / @.w;\r\n", new DecOp( vpos ), inVpos, inVpos ) ); - - return vpos; + return inVpos; } Var* ShaderFeatureGLSL::getInWorldToTangent( Vector &componentList ) @@ -2473,7 +2459,7 @@ void VisibilityFeatGLSL::processPix( Vector &componentList, // Everything else does a fizzle. Var *vPos = getInVpos( meta, componentList ); - meta->addStatement( new GenOp( " fizzle( @, @ );\r\n", vPos, visibility ) ); + meta->addStatement( new GenOp( " fizzle( @.xy, @ );\r\n", vPos, visibility ) ); } ShaderFeature::Resources VisibilityFeatGLSL::getResources( const MaterialFeatureData &fd ) @@ -2616,7 +2602,7 @@ void FoliageFeatureGLSL::processVert( Vector &componentList, tangent->setType( "vec3" ); tangent->setName( "T" ); LangElement *tangentDec = new DecOp( tangent ); - meta->addStatement( new GenOp( " @;\n", tangentDec ) ); + meta->addStatement( new GenOp( " @ = vec3(1.0,0,0);\n", tangentDec ) ); // We add a float foliageFade to the OUT structure. ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 80601ad68..2fe171aba 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -453,12 +453,12 @@ Var* ShaderFeatureHLSL::addOutVpos( MultiLine *meta, outVpos = connectComp->getElement( RT_TEXCOORD ); outVpos->setName( "outVpos" ); outVpos->setStructName( "OUT" ); - outVpos->setType( "float4" ); + outVpos->setType( "float3" ); Var *outPosition = (Var*) LangElement::find( "hpos" ); AssertFatal( outPosition, "ShaderFeatureHLSL::addOutVpos - Didn't find the output position." ); - meta->addStatement( new GenOp( " @ = @;\r\n", outVpos, outPosition ) ); + meta->addStatement( new GenOp( " @ = @.xyz;\r\n", outVpos, outPosition ) ); } return outVpos; @@ -2686,7 +2686,7 @@ void FoliageFeatureHLSL::processVert( Vector &componentList, tangent->setType( "float3" ); tangent->setName( "T" ); LangElement *tangentDec = new DecOp( tangent ); - meta->addStatement( new GenOp( " @;\n", tangentDec ) ); + meta->addStatement( new GenOp( " @ = float3(1.0,0,0);\n", tangentDec ) ); // We add a float foliageFade to the OUT structure. ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl index 5482bdaf3..4ec0303aa 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl @@ -291,8 +291,8 @@ void fizzle(vec2 vpos, float visibility) // I'm sure there are many more patterns here to // discover for different effects. - mat2x2 m = mat2x2( vpos.x, vpos.y, 0.916, 0.350 ); - if( (visibility - fract( determinant( m ) )) < 0 ) //if(a < 0) discard; + mat2x2 m = mat2x2( vpos.x, 0.916, vpos.y, 0.350 ); + if( (visibility - fract( determinant( m ) )) < 0 ) discard; } #endif //TORQUE_PIXEL_SHADER From 8ce207561e487bd3495dbe4ed3b8cd9bbcc9c51f Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 20 Sep 2021 16:56:53 -0500 Subject: [PATCH 02/38] revert a bit causing crashes on certain 'nix boxes. --- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 4 ++-- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 3ee76ffdf..0cf46277c 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -455,12 +455,12 @@ Var* ShaderFeatureGLSL::addOutVpos( MultiLine *meta, outVpos = connectComp->getElement( RT_TEXCOORD ); outVpos->setName( "outVpos" ); outVpos->setStructName( "OUT" ); - outVpos->setType( "vec3" ); + outVpos->setType( "vec4" ); Var *outPosition = (Var*) LangElement::find( "gl_Position" ); AssertFatal( outPosition, "ShaderFeatureGLSL::addOutVpos - Didn't find the output position." ); - meta->addStatement( new GenOp( " @ = @.xyz;\r\n", outVpos, outPosition ) ); + meta->addStatement( new GenOp( " @ = @;\r\n", outVpos, outPosition ) ); } return outVpos; diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 2fe171aba..1ebc3982a 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -453,12 +453,12 @@ Var* ShaderFeatureHLSL::addOutVpos( MultiLine *meta, outVpos = connectComp->getElement( RT_TEXCOORD ); outVpos->setName( "outVpos" ); outVpos->setStructName( "OUT" ); - outVpos->setType( "float3" ); + outVpos->setType( "float4" ); Var *outPosition = (Var*) LangElement::find( "hpos" ); AssertFatal( outPosition, "ShaderFeatureHLSL::addOutVpos - Didn't find the output position." ); - meta->addStatement( new GenOp( " @ = @.xyz;\r\n", outVpos, outPosition ) ); + meta->addStatement( new GenOp( " @ = @;\r\n", outVpos, outPosition ) ); } return outVpos; From 9775d69988fc1ca269e13ef9d6e8b1caae8f8a58 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 21 Sep 2021 17:10:07 -0500 Subject: [PATCH 03/38] pad shader uniform length pipe by 1 to avoid a bug with some integrated chips clipping --- Engine/source/gfx/gl/gfxGLShader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/gfx/gl/gfxGLShader.cpp b/Engine/source/gfx/gl/gfxGLShader.cpp index d2f2edd22..eed45b3e1 100644 --- a/Engine/source/gfx/gl/gfxGLShader.cpp +++ b/Engine/source/gfx/gl/gfxGLShader.cpp @@ -561,6 +561,7 @@ void GFXGLShader::initConstantDescs() if(!maxNameLength) return; + maxNameLength++; FrameTemp uniformName(maxNameLength); From c86cc489458cc4c1d32fbf40d08d996a6b91351c Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 22 Sep 2021 18:27:42 -0500 Subject: [PATCH 04/38] use srgb sapce for backbuffer --- Engine/source/postFx/postEffectManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/postFx/postEffectManager.cpp b/Engine/source/postFx/postEffectManager.cpp index 7904c522d..d65e25e25 100644 --- a/Engine/source/postFx/postEffectManager.cpp +++ b/Engine/source/postFx/postEffectManager.cpp @@ -141,7 +141,7 @@ GFXTextureObject* PostEffectManager::getBackBufferTex() mBackBufferCopyTex.set( targetSize.x, targetSize.y, targetFormat, - &PostFxTargetProfile, "mBackBufferCopyTex" ); + &PostFxTextureSRGBProfile, "mBackBufferCopyTex" ); target->resolveTo( mBackBufferCopyTex ); mLastBackBufferTarget = target; From 5682bafb291fe7a5a865d256153d6229e74f4d4a Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 22 Sep 2021 18:28:19 -0500 Subject: [PATCH 05/38] kills off that second buffer in terrain rendering when in forward mode --- .../source/terrain/glsl/terrFeatureGLSL.cpp | 132 ++++++++-------- Engine/source/terrain/glsl/terrFeatureGLSL.h | 1 - .../source/terrain/hlsl/terrFeatureHLSL.cpp | 141 +++++++++--------- Engine/source/terrain/hlsl/terrFeatureHLSL.h | 2 - 4 files changed, 142 insertions(+), 134 deletions(-) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 14f321cce..d30e639ec 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -304,29 +304,28 @@ void TerrainBaseMapFeatGLSL::processPix( Vector &componentLis baseColor->setName( "baseColor" ); meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) ); - ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget; + ShaderFeature::OutputTarget target = (fd.features[MFT_isDeferred]) ? RenderTarget1 : DefaultTarget; + meta->addStatement(new GenOp(" @;\r\n", assignColor(baseColor, Material::Mul, NULL, target))); - if(fd.features.hasFeature(MFT_isDeferred)) - { - target= ShaderFeature::RenderTarget1; - } - meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul,NULL,target ) ) ); - - // Set base ORM info Var* ormConfig; - OutputTarget targ = RenderTarget1; - if (fd.features[MFT_isDeferred]) + if ((fd.features[MFT_isDeferred])) { - targ = RenderTarget2; + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); + + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } } - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); - if (!ormConfig) + else { - // create color var - ormConfig = new Var; - ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); - ormConfig->setStructName("OUT"); + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); } meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); @@ -347,7 +346,7 @@ ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFea U32 TerrainBaseMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) const { - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget1 | ShaderFeature::RenderTarget2 : ShaderFeature::DefaultTarget | ShaderFeature::RenderTarget1; + return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 | ShaderFeature::RenderTarget1 : ShaderFeature::DefaultTarget; } TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL() @@ -1167,24 +1166,36 @@ void TerrainORMMapFeatGLSL::processPix(Vector &componentList, else texOp = new GenOp("tex2D(@, vec3(@.xy, @.x))", ormConfigMap, inDet, new IndexOp(detailInfo, compositeIndex)); - // search for material var - Var * ormConfig; - OutputTarget targ = RenderTarget1; - if (fd.features[MFT_isDeferred]) - { - targ = RenderTarget2; - } - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); + MultiLine* meta = new MultiLine; + // search for material var + Var* ormConfig; + if ((fd.features[MFT_isDeferred])) + { + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!ormConfig) - { - // create color var - ormConfig = new Var; - ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); - ormConfig->setStructName("OUT"); - } + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else + { + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "vec4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } + } + if (compositeIndex == 0) + { + meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); + } Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); AssertFatal(detailBlend, "The detail blend is missing!"); @@ -1192,11 +1203,6 @@ void TerrainORMMapFeatGLSL::processPix(Vector &componentList, String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); Var *matinfoCol = new Var(matinfoName, "vec3"); - if (compositeIndex == 0) - { - meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); - } - meta->addStatement(new GenOp(" @ = @.rgb;\r\n", new DecOp(matinfoCol), texOp)); if (fd.features.hasFeature(MFT_InvertRoughness, compositeIndex)) @@ -1236,40 +1242,40 @@ ShaderFeature::Resources TerrainORMMapFeatGLSL::getResources(const MaterialFeatu return res; } - -U32 TerrainBlankInfoMapFeatGLSL::getOutputTargets(const MaterialFeatureData &fd) const -{ - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::RenderTarget1; -} - // reminder, the matinfo buffer is flags, smooth, ao, metal void TerrainBlankInfoMapFeatGLSL::processPix(Vector &componentList, const MaterialFeatureData &fd) { S32 compositeIndex = getProcessIndex(); - // search for material var - Var *material; - OutputTarget targ = DefaultTarget; - if (fd.features[MFT_isDeferred]) + MultiLine* meta = new MultiLine; Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { - targ = RenderTarget2; - } - material = (Var*)LangElement::find(getOutputTargetVarName(targ)); + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!material) + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else { - // create color var - material = new Var; - material->setType("vec4"); - material->setName(getOutputTargetVarName(targ)); - material->setStructName("OUT"); + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "vec4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } } if (compositeIndex == 0) { - meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", material)); + meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); } Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); @@ -1277,7 +1283,7 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector &component String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); - meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", material, detailBlend, detailBlend)); + meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend)); output = meta; } diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.h b/Engine/source/terrain/glsl/terrFeatureGLSL.h index 5b48c0a51..7d56a75bf 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.h +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.h @@ -174,7 +174,6 @@ public: virtual void processPix(Vector &componentList, const MaterialFeatureData &fd); - virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; virtual String getName() { return "Blank Matinfo map"; } }; diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index e136c82eb..362a012a3 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -337,27 +337,27 @@ void TerrainBaseMapFeatHLSL::processVert( Vector &componentLis new DecOp( inTanget ), squareSize, inTangentZ ) ); } -void TerrainBaseMapFeatHLSL::processPix( Vector &componentList, - const MaterialFeatureData &fd ) +void TerrainBaseMapFeatHLSL::processPix(Vector& componentList, + const MaterialFeatureData& fd) { // grab connector texcoord register - Var *texCoord = getInTexCoord( "texCoord", "float3", componentList ); + Var* texCoord = getInTexCoord("texCoord", "float3", componentList); // create texture var - Var *diffuseMap = new Var; - diffuseMap->setType( "SamplerState" ); - diffuseMap->setName( "baseTexMap" ); + Var* diffuseMap = new Var; + diffuseMap->setType("SamplerState"); + diffuseMap->setName("baseTexMap"); diffuseMap->uniform = true; diffuseMap->sampler = true; diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here - MultiLine *meta = new MultiLine; + MultiLine* meta = new MultiLine; - Var *baseColor = new Var; - baseColor->setType( "float4" ); - baseColor->setName( "baseColor" ); + Var* baseColor = new Var; + baseColor->setType("float4"); + baseColor->setName("baseColor"); - Var *diffuseTex = new Var; + Var* diffuseTex = new Var; diffuseTex->setType("Texture2D"); diffuseTex->setName("baseTexture"); diffuseTex->uniform = true; @@ -365,33 +365,31 @@ void TerrainBaseMapFeatHLSL::processPix( Vector &componentLis diffuseTex->constNum = diffuseMap->constNum; meta->addStatement(new GenOp(" @ = @.Sample( @, @.xy );\r\n", new DecOp(baseColor), diffuseTex, diffuseMap, texCoord)); - ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget; + ShaderFeature::OutputTarget target = (fd.features[MFT_isDeferred]) ? RenderTarget1 : DefaultTarget; + meta->addStatement(new GenOp(" @;\r\n", assignColor(baseColor, Material::Mul, NULL, target))); - if (fd.features.hasFeature(MFT_isDeferred)) - { - target= ShaderFeature::RenderTarget1; - } - - meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul,NULL,target ) ) ); - - if (fd.features[MFT_isDeferred]) + Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { // Set base ORM info - Var* ormConfig; - OutputTarget targ = RenderTarget1; - targ = RenderTarget2; - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); + if (!ormConfig) { // create color var ormConfig = new Var; ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); ormConfig->setStructName("OUT"); } - - meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); } + else + { + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } + + meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); output = meta; } @@ -407,7 +405,7 @@ ShaderFeature::Resources TerrainBaseMapFeatHLSL::getResources( const MaterialFea U32 TerrainBaseMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) const { - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget1 | ShaderFeature::RenderTarget2 : ShaderFeature::DefaultTarget; + return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 | ShaderFeature::RenderTarget1 : ShaderFeature::DefaultTarget; } TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL() @@ -1259,23 +1257,35 @@ void TerrainORMMapFeatHLSL::processPix(Vector &componentList, else texOp = new GenOp("@.Sample(@, float3(@.xy, @.x))", ormMapArray, ormMapSampler, inDet, new IndexOp(detailInfo, compositeIndex)); + MultiLine* meta = new MultiLine; // search for material var - Var * ormConfig; - OutputTarget targ = RenderTarget1; - if (fd.features[MFT_isDeferred]) + Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { - targ = RenderTarget2; - } - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!ormConfig) + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else { - // create color var - ormConfig = new Var; - ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); - ormConfig->setStructName("OUT"); + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } + } + if (compositeIndex == 0) + { + meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); } Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); @@ -1284,11 +1294,6 @@ void TerrainORMMapFeatHLSL::processPix(Vector &componentList, String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); Var *matinfoCol = new Var(matinfoName, "float3"); - if (compositeIndex == 0) - { - meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); - } - meta->addStatement(new GenOp(" @ = @.rgb;\r\n", new DecOp(matinfoCol), texOp)); if (fd.features.hasFeature(MFT_InvertRoughness, compositeIndex)) @@ -1313,39 +1318,39 @@ ShaderFeature::Resources TerrainORMMapFeatHLSL::getResources(const MaterialFeatu return res; } -// reminder, the matinfo buffer is flags, smooth, ao, metal -U32 TerrainBlankInfoMapFeatHLSL::getOutputTargets(const MaterialFeatureData &fd) const -{ - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::RenderTarget1; -} - void TerrainBlankInfoMapFeatHLSL::processPix(Vector &componentList, const MaterialFeatureData &fd) { S32 compositeIndex = getProcessIndex(); - // search for material var - Var *material; - OutputTarget ormConfig = RenderTarget1; - if (fd.features[MFT_isDeferred]) + MultiLine * meta = new MultiLine; Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { - ormConfig = RenderTarget2; - } - material = (Var*)LangElement::find(getOutputTargetVarName(ormConfig)); + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!material) + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else { - // create color var - material = new Var; - material->setType("fragout"); - material->setName(getOutputTargetVarName(ormConfig)); - material->setStructName("OUT"); + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } } if (compositeIndex == 0) { - meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", material)); + meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); } Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); @@ -1355,7 +1360,7 @@ void TerrainBlankInfoMapFeatHLSL::processPix(Vector &component if (!fd.features.hasFeature(MFT_TerrainHeightBlend)) { - meta->addStatement(new GenOp(" @.gba += float3(@, @, 0.0);\r\n", material, detailBlend, detailBlend)); + meta->addStatement(new GenOp(" @.gba += float3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend)); } output = meta; diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.h b/Engine/source/terrain/hlsl/terrFeatureHLSL.h index 829af9c6f..f3803f2d9 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.h +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.h @@ -179,8 +179,6 @@ public: virtual void processPix(Vector &componentList, const MaterialFeatureData &fd); - - virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; virtual String getName() { return "Blank Matinfo map"; } }; From e784b0140c32f2de6c5ca7ac5d23d3961cb28d00 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Wed, 22 Sep 2021 21:41:38 -0400 Subject: [PATCH 06/38] Let's fix the texcoord alignment for RT Lighting. --- .../source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 16 +++++++--------- .../source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 12 +++++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 0cf46277c..e9604eb77 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -2090,12 +2090,15 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, return; } - + + addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); + getOutWorldToTangent(componentList, meta, fd); + + output = meta; + // Find the incoming vertex normal. Var *inNormal = (Var*)LangElement::find( "normal" ); - - // Skip out on realtime lighting if we don't have a normal - // or we're doing some sort of baked lighting. + if ( !inNormal || fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || @@ -2119,11 +2122,6 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, meta->addStatement( new GenOp( " @ = tMul( @, vec4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); }*/ - addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); - - getOutWorldToTangent(componentList, meta, fd); - - output = meta; } void RTLightingFeatGLSL::processPix( Vector &componentList, diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 1ebc3982a..dfdb5439c 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -2178,11 +2178,14 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, return; } + addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); + getOutWorldToTangent(componentList, meta, fd); + output = meta; + + // Find the incoming vertex normal. Var *inNormal = (Var*)LangElement::find( "normal" ); - // Skip out on realtime lighting if we don't have a normal - // or we're doing some sort of baked lighting. if ( !inNormal || fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || @@ -2205,11 +2208,6 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, // Transform the normal to world space. meta->addStatement( new GenOp( " @ = mul( @, float4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); } - - addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); - getOutWorldToTangent(componentList, meta, fd); - - output = meta; } void RTLightingFeatHLSL::processPix( Vector &componentList, From 58a79e0105a6a88848e4f21c77cf3b6220b2d1b3 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Fri, 24 Sep 2021 22:55:59 -0400 Subject: [PATCH 07/38] inputTest Module Update Updates the input event monitor to work with the current BaseGame template. --- Templates/Modules/inputTest/inputTest.tscript | 17 +++++++++++------ .../inputTest/scripts/gui/inputMonitor.gui | 2 +- .../inputTest/scripts/menuButtons.tscript | 8 +++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Templates/Modules/inputTest/inputTest.tscript b/Templates/Modules/inputTest/inputTest.tscript index 7dad50618..07f27fc9f 100644 --- a/Templates/Modules/inputTest/inputTest.tscript +++ b/Templates/Modules/inputTest/inputTest.tscript @@ -4,6 +4,11 @@ function inputTest::create( %this ) { + // If addToMainMenu is true, a button to display the input monitor will be + // added to the MainMenu gui. If false, you will need to call + // "$GameCanvas.pushDialog(InputMonitorDlg);" from the console or add a + // shortcut somewhere else to access the Input Event Monitor. + %this.addToMainMenu = true; } function inputTest::destroy( %this ) @@ -13,12 +18,12 @@ function inputTest::destroy( %this ) function inputTest::initClient( %this ) { - %this.queueExec("/scripts/customProfiles." @ $TorqueScriptFileExtension); - %this.queueExec("/scripts/inputMonitor." @ $TorqueScriptFileExtension); - %this.queueExec("/scripts/gui/inputMonitor.gui"); - %this.queueExec("/scripts/joystickSettings." @ $TorqueScriptFileExtension); - %this.queueExec("/scripts/gui/joystickSettings.gui"); - %this.queueExec("/scripts/menuButtons." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/customProfiles." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/inputMonitor." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/gui/inputMonitor.gui"); + %this.queueExec("./scripts/joystickSettings." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/gui/joystickSettings.gui"); + %this.queueExec("./scripts/menuButtons." @ $TorqueScriptFileExtension); } function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType) diff --git a/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui b/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui index 67708cf2e..c695016af 100644 --- a/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui +++ b/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui @@ -55,7 +55,7 @@ $guiContent = new GuiControl(InputMonitorDlg) { canSaveDynamicFields = "0"; }; new GuiChunkedBitmapCtrl() { - bitmap = "data/ui/art/hudfill.png"; + bitmap = "data/ui/images/hudfill.png"; useVariable = "0"; tile = "0"; position = "0 0"; diff --git a/Templates/Modules/inputTest/scripts/menuButtons.tscript b/Templates/Modules/inputTest/scripts/menuButtons.tscript index 471676a07..8f97d2262 100644 --- a/Templates/Modules/inputTest/scripts/menuButtons.tscript +++ b/Templates/Modules/inputTest/scripts/menuButtons.tscript @@ -2,6 +2,8 @@ // Add buttons to the MainMenu after all other scripts have been exec'ed. //----------------------------------------------------------------------------- +function inputTest::addMenuButton( %this ) +{ if (isObject(MainMenuGui)) { %testBtn = new GuiButtonCtrl() { @@ -56,4 +58,8 @@ } MMTestContainer.add(%testBtn); - } \ No newline at end of file + } +} + +if (inputTest.addToMainMenu) + inputTest.addMenuButton(); \ No newline at end of file From e035aa911481d237a40c0467089df536f00883c0 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Tue, 28 Sep 2021 05:38:17 -0400 Subject: [PATCH 08/38] GuiCanvas Callbacks Adds handler modes for keyboard translations and native accelerators. This is needed so APIs that provide software keyboards can be notified when controls that require text input become active. This was previously hardcoded in OpenVROverlay, but is also needed by Steam Input and Big Picture so moving to GuiCanvas will make it accessible there as well. Handler mode for both settings default to "Platform" so there is no change to the default behavior. If the setting is changed to "Callback", callbacks will be triggered to allow script to determine if the request should fall through to the platform window. The script callback is also the appropriate place to display a software keyboard and attach it to the input control. --- Engine/source/gui/core/guiCanvas.cpp | 60 +++++++++++++++++++++++++--- Engine/source/gui/core/guiCanvas.h | 19 +++++++++ 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 967c3e7d7..8ad674474 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -94,6 +94,33 @@ ConsoleDocClass( GuiCanvas, "@ingroup GuiCore\n"); + ImplementEnumType(KeyboardTranslationMode, + "Modes for handling keyboard translation or native accelerator requests.\n\n") + { GuiCanvas::TranslationMode_Platform, "Platform", + "Requests will be passed to the platform window for handling." }, + { GuiCanvas::TranslationMode_Callback, "Callback", + "Script callbacks will be issued to notify and allow override of these events." }, + { GuiCanvas::TranslationMode_Ignore, "Ignore", + "Requsts to enable/disable keyboard translations or native accelerators will be ignored " + "with no callback triggered." }, + EndImplementEnumType; + + IMPLEMENT_CALLBACK(GuiCanvas, onSetKeyboardTranslationEnabled, bool, (bool enable), (enable), + "Called when the canvas receives an enableKeyboardTranslation request. This is usually the " + "result of a GuitTextInputCtrl gaining or losing focus. Return false to allow the request " + "to be passed to the platform window. Return true to override the request and handle it in script.\n\n" + "@note This callback is only issued if keyTranslationMode is set to \"Callback\" for this canvas.\n" + "@param enable Requested keyboard translation state.\n" + "@see KeyboardTranslationMode\n"); + + IMPLEMENT_CALLBACK(GuiCanvas, onSetNativeAcceleratorsEnabled, bool, (bool enable), (enable), + "Called when the canvas receives a setNativeAcceleratorsEnabled request. This is usually the " + "result of a GuitTextInputCtrl gaining or losing focus. Return false to allow the request to " + "be passed to the platform window. Return true to override the request and handle it in script.\n\n" + "@note This callback is only issued if nativeAcceleratorMode is set to \"Callback\" for this canvas.\n" + "@param enable Requested accelerator state.\n" + "@see KeyboardTranslationMode\n"); + ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear extern InputModifiers convertModifierBits(const U32 in); @@ -127,6 +154,8 @@ GuiCanvas::GuiCanvas(): GuiControl(), mHoverPositionSet(false), mLeftMouseLast(false), mHoverLeftControlTime(0), + mKeyTranslationMode(TranslationMode_Platform), + mNativeAcceleratorMode(TranslationMode_Platform), mMiddleMouseLast(false), mRightMouseLast(false), mMouseDownPoint(0.0f,0.0f), @@ -183,6 +212,13 @@ void GuiCanvas::initPersistFields() addField("displayWindow", TypeBool, Offset(mDisplayWindow, GuiCanvas), "Controls if the canvas window is rendered or not." ); endGroup("Canvas Rendering"); + addGroup("KeyboardMode Callbacks"); + addField("keyTranslationMode", TYPEID< KeyTranslationMode >(), Offset(mKeyTranslationMode, GuiCanvas), + "How to handle enable/disable keyboard translation requests. \"Platform\", \"Callback\" or \"Ignore\".\n"); + addField("nativeAcceleratorMode", TYPEID< KeyTranslationMode >(), Offset(mNativeAcceleratorMode, GuiCanvas), + "How to handle enable/disable native accelerator requests. \"Platform\", \"Callback\" or \"Ignore\".\n"); + endGroup("KeyboardMode Callbacks"); + Parent::initPersistFields(); } @@ -442,20 +478,32 @@ Point2I GuiCanvas::getWindowSize() void GuiCanvas::enableKeyboardTranslation() { - AssertISV(mPlatformWindow, "GuiCanvas::enableKeyboardTranslation - no window present!"); - mPlatformWindow->setKeyboardTranslation(true); + if ((mKeyTranslationMode == TranslationMode_Platform) || + ((mKeyTranslationMode == TranslationMode_Callback) && onSetKeyboardTranslationEnabled_callback(true))) + { + AssertISV(mPlatformWindow, "GuiCanvas::enableKeyboardTranslation - no window present!"); + mPlatformWindow->setKeyboardTranslation(true); + } } void GuiCanvas::disableKeyboardTranslation() { - AssertISV(mPlatformWindow, "GuiCanvas::disableKeyboardTranslation - no window present!"); - mPlatformWindow->setKeyboardTranslation(false); + if ((mKeyTranslationMode == TranslationMode_Platform) || + ((mKeyTranslationMode == TranslationMode_Callback) && onSetKeyboardTranslationEnabled_callback(false))) + { + AssertISV(mPlatformWindow, "GuiCanvas::disableKeyboardTranslation - no window present!"); + mPlatformWindow->setKeyboardTranslation(false); + } } void GuiCanvas::setNativeAcceleratorsEnabled( bool enabled ) { - AssertISV(mPlatformWindow, "GuiCanvas::setNativeAcceleratorsEnabled - no window present!"); - mPlatformWindow->setAcceleratorsEnabled( enabled ); + if ((mNativeAcceleratorMode == TranslationMode_Platform) || + ((mNativeAcceleratorMode == TranslationMode_Callback) && onSetNativeAcceleratorsEnabled_callback(enabled))) + { + AssertISV(mPlatformWindow, "GuiCanvas::setNativeAcceleratorsEnabled - no window present!"); + mPlatformWindow->setAcceleratorsEnabled(enabled); + } } void GuiCanvas::setForceMouseToGUI(bool onOff) diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index f9f4a37af..fdb1cfd25 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -178,6 +178,19 @@ protected: bool mHoverPositionSet; U32 mHoverLeftControlTime; +public: + /// Setting for how to handle 'enableKeyboardTranslation' and 'setNativeAcceleratorsEnabled' requests. + enum KeyTranslationMode + { + TranslationMode_Platform, + TranslationMode_Callback, + TranslationMode_Ignore, + }; + +protected: + KeyTranslationMode mKeyTranslationMode; + KeyTranslationMode mNativeAcceleratorMode; + /// @} // Internal event handling callbacks for use with PlatformWindow. @@ -454,6 +467,10 @@ public: virtual void setWindowTitle(const char *newTitle); + DECLARE_CALLBACK(bool, onSetKeyboardTranslationEnabled, (bool enable)); + DECLARE_CALLBACK(bool, onSetNativeAcceleratorsEnabled, (bool enable)); + + private: static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads protected: @@ -464,5 +481,7 @@ private: void setConsumeLastInputEvent(bool flag) { mConsumeLastInputEvent = flag; } bool getLastCursorPoint(Point2I& pt) const { pt = mLastCursorPt; return mLastCursorEnabled; } }; +typedef GuiCanvas::KeyTranslationMode KeyboardTranslationMode; +DefineEnumType(KeyboardTranslationMode); #endif From 37c924512c4bb7856de65d35b8fa8ff4204214b1 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Tue, 28 Sep 2021 05:52:45 -0400 Subject: [PATCH 09/38] Corrects console documentation. --- Engine/source/gui/core/guiCanvas.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 8ad674474..96022edaa 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -107,16 +107,16 @@ ConsoleDocClass( GuiCanvas, IMPLEMENT_CALLBACK(GuiCanvas, onSetKeyboardTranslationEnabled, bool, (bool enable), (enable), "Called when the canvas receives an enableKeyboardTranslation request. This is usually the " - "result of a GuitTextInputCtrl gaining or losing focus. Return false to allow the request " - "to be passed to the platform window. Return true to override the request and handle it in script.\n\n" + "result of a GuitTextInputCtrl gaining or losing focus. Return true to allow the request " + "to be passed to the platform window. Return false to override the request and handle it in script.\n\n" "@note This callback is only issued if keyTranslationMode is set to \"Callback\" for this canvas.\n" "@param enable Requested keyboard translation state.\n" "@see KeyboardTranslationMode\n"); IMPLEMENT_CALLBACK(GuiCanvas, onSetNativeAcceleratorsEnabled, bool, (bool enable), (enable), "Called when the canvas receives a setNativeAcceleratorsEnabled request. This is usually the " - "result of a GuitTextInputCtrl gaining or losing focus. Return false to allow the request to " - "be passed to the platform window. Return true to override the request and handle it in script.\n\n" + "result of a GuitTextInputCtrl gaining or losing focus. Return true to allow the request to " + "be passed to the platform window. Return false to override the request and handle it in script.\n\n" "@note This callback is only issued if nativeAcceleratorMode is set to \"Callback\" for this canvas.\n" "@param enable Requested accelerator state.\n" "@see KeyboardTranslationMode\n"); From c5d5a9135645bd87920cd4d2e091711c2e12b8dd Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 28 Sep 2021 18:17:49 -0500 Subject: [PATCH 10/38] Add handling to RotationF's addRotation function to ensure formatted return --- Engine/source/math/mRotation.cpp | 11 +++++++++-- Engine/source/math/mathTypes.cpp | 12 ++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index 43b696d4a..18114c58d 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -325,14 +325,21 @@ TEST(Maths, RotationF_Calculations) }; #endif -DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b), , +DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b, const char* returnType), ("Euler"), "Adds two rotations together.\n" "@param a Rotation one." "@param b Rotation two." "@returns v sum of both rotations." "@ingroup Math") { - return a + b; + RotationF ret; + RotationF sum = a + b; + if (String(returnType) == String("Euler")) + ret.set(sum.asEulerF()); + else + ret.set(sum.asAxisAngle()); + + return ret; } DefineEngineFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 14c7335e8..70ac9adf7 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -620,8 +620,16 @@ ConsoleGetType(TypeRotationF) static const U32 bufSize = 256; char* returnBuffer = Con::getReturnBuffer(bufSize); - EulerF out = pt->asEulerF(RotationF::Degrees); - dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); + if (pt->mRotationType == RotationF::Euler) + { + EulerF out = pt->asEulerF(RotationF::Degrees); + dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); + } + else if (pt->mRotationType == RotationF::AxisAngle) + { + AngAxisF out = pt->asAxisAngle(RotationF::Degrees); + dSprintf(returnBuffer, bufSize, "%g %g %g %g", out.axis.x, out.axis.y, out.axis.z, out.angle); + } return returnBuffer; } From 1676d102f35cc588bf717897ff5e5bc35125a046 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 2 Oct 2021 16:22:55 -0400 Subject: [PATCH 11/38] * [AssetBrowser] BugFix: Correct a logic error in the filtering of the asset browser causing tags queries to display all assets. --- .../game/tools/assetBrowser/scripts/assetBrowser.tscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 747d3e86d..660577c78 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -1802,7 +1802,7 @@ function matchesSearch(%assetName, %assetType) } else { - if(%assetName.tags !$= %word) + if(strstr(strlwr(%assetName.tags), strlwr(%word)) != -1) %matchTags = true; } } From 5e88ab25708cb9771d99fb5b1e5c02d94586a9d6 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Fri, 1 Oct 2021 21:34:45 -0400 Subject: [PATCH 12/38] * BugFix: Fix AL device listing so that functions like sfxGetAvailableDevices return the actual devices on the system. --- Engine/source/sfx/openal/aldlist.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index a453579e3..8f7c0d4a6 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -56,7 +56,7 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { - devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); + devices = (char *)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) @@ -70,7 +70,7 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) if (context) { ALFunction.alcMakeContextCurrent(context); // if new actual device name isn't already in the list, then add it... - actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER); + actualDeviceName = devices; bool bNewName = true; for (int i = 0; i < GetNumDevices(); i++) { if (String::compare(GetDeviceName(i), actualDeviceName) == 0) { @@ -313,4 +313,4 @@ unsigned int ALDeviceList::GetMaxNumSources() } return iSourceCount; -} \ No newline at end of file +} From 43630c31c2938efb107eca01494fd73633e56fea Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 2 Oct 2021 22:24:11 -0400 Subject: [PATCH 13/38] * BugFix: Tweaks to the ALC device listing logic to be more consistent with the AL API. --- Engine/source/sfx/openal/aldlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index 8f7c0d4a6..51f5a3b51 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -55,9 +55,9 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices - if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { + if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) { devices = (char *)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); - defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) while (*devices != 0) { From 6a94946e5b1621b2e0e2bdce45e016816f247b21 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 2 Oct 2021 22:29:34 -0400 Subject: [PATCH 14/38] * BugFix: Fallback to ALC_ENUMERATION_EXT if ALC_ENUMERATE_ALL_EXT is not available. --- Engine/source/sfx/openal/aldlist.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index 51f5a3b51..73307f50b 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -55,9 +55,20 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices - if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) { - devices = (char *)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); - defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); + const bool enumerationExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"); + const bool enumerateAllExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"); + if (enumerateAllExtensionPresent || enumerationExtensionPresent) { + if (enumerateAllExtensionPresent) + { + devices = (char *)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); + } + else + { + devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); + defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + } + index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) while (*devices != 0) { From 67c889279dbbd27671ef45c4df3ca1dbd97091c4 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 3 Oct 2021 17:42:32 -0500 Subject: [PATCH 15/38] fix groundplane material reference in examplelevel --- .../BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis b/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis index ba5384a96..e2b9ce7d1 100644 --- a/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis +++ b/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis @@ -36,7 +36,7 @@ new Scene(EditorTemplateLevel) { squareSize = "128"; scaleU = "25"; scaleV = "25"; - MaterialFile = "FloorGray"; + MaterialAsset = "Prototyping:FloorGray"; canSave = "1"; canSaveDynamicFields = "1"; Enabled = "1"; From a1117b1c41ad728311c82aa558598971dedf8788 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 3 Oct 2021 21:51:40 -0500 Subject: [PATCH 16/38] add getInWorldNormal method glsl side --- .../shaderGen/GLSL/shaderFeatureGLSL.cpp | 35 +++++++++++++------ .../source/shaderGen/GLSL/shaderFeatureGLSL.h | 1 + 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index e9604eb77..73bb56fd1 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -765,6 +765,21 @@ Var* ShaderFeatureGLSL::getWsView( Var *wsPosition, MultiLine *meta ) return wsView; } +Var* ShaderFeatureGLSL::getInWorldNormal(Vector& componentList) +{ + Var* wsNormal = (Var*)LangElement::find("wsNormal"); + if (!wsNormal) + { + ShaderConnector* connectComp = dynamic_cast(componentList[C_CONNECTOR]); + wsNormal = connectComp->getElement(RT_TEXCOORD); + wsNormal->setName("wsNormal"); + wsNormal->setStructName("IN"); + wsNormal->setType("float3"); + } + + return wsNormal; +} + Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector &componentList, MultiLine *meta, bool useTexAnim, @@ -851,21 +866,23 @@ Var* ShaderFeatureGLSL::getSurface(Vector& componentList, Mult meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, roughness, metalness)); //reconstruct ormConfig, no ao darkening } - Var* wsNormal = (Var*)LangElement::find("wsNormal"); Var* normal = (Var*)LangElement::find("normal"); if (!normal) { normal = new Var("normal", "vec3"); meta->addStatement(new GenOp(" @;\r\n\n", new DecOp(normal))); + + Var* wsNormal = (Var*)LangElement::find("wsNormal"); if (!fd.features[MFT_NormalMap]) { - Var* worldToTangent = getInWorldToTangent(componentList); - meta->addStatement(new GenOp(" @ = normalize(tMul(@,vec3(0,0,1.0f)));\r\n\n", normal, worldToTangent)); + if (!wsNormal) + wsNormal = getInWorldNormal(componentList); + meta->addStatement(new GenOp(" @ = normalize( @ );\r\n\n", normal, wsNormal)); } else { - meta->addStatement(new GenOp(" @ = normalize( half3( @ ) );\r\n", normal, wsNormal)); - } + meta->addStatement(new GenOp(" @ = normalize( @ );\r\n", normal, wsNormal)); + } } Var* wsEyePos = (Var*)LangElement::find("eyePosWorld"); @@ -2142,14 +2159,10 @@ void RTLightingFeatGLSL::processPix( Vector &componentList, // Now the wsPosition and wsView. Var *wsPosition = getInWsPosition( componentList ); + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); Var *wsView = getWsView( wsPosition, meta ); - // Create temporaries to hold results of lighting. - Var *rtShading = new Var( "rtShading", "vec4" ); - Var *specular = new Var( "specular", "vec4" ); - meta->addStatement( new GenOp( " @; @;\r\n", - new DecOp( rtShading ), new DecOp( specular ) ) ); - // Look for a light mask generated from a previous // feature (this is done for BL terrain lightmaps). LangElement *lightMask = LangElement::find( "lightMask" ); diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h index 24a2a8115..d4dbb1886 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h @@ -137,6 +137,7 @@ public: MultiLine *meta ); Var* getSurface(Vector& componentList, MultiLine* meta, const MaterialFeatureData& fd); + Var* getInWorldNormal(Vector& componentList); // ShaderFeature Var* getVertTexCoord( const String &name ); From 661a192e878a951ac10d0d2f715e352fd5e57ba4 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 3 Oct 2021 21:53:16 -0500 Subject: [PATCH 17/38] orderfix for RTLightingFeatHLSL vert vs pixel shader. the order needs to match, same as network comunicating --- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index dfdb5439c..ecd4619d0 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -879,12 +879,10 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult meta->addStatement(new GenOp(" @;\r\n\n", new DecOp(normal))); Var* wsNormal = (Var*)LangElement::find("wsNormal"); - if (!fd.features[MFT_NormalMap]) { if (!wsNormal) wsNormal = getInWorldNormal(componentList); - meta->addStatement(new GenOp(" @ = normalize( @ );\r\n\n", normal, wsNormal)); } else @@ -2227,10 +2225,9 @@ void RTLightingFeatHLSL::processPix( Vector &componentList, MultiLine *meta = new MultiLine; // Now the wsPosition and wsView. - Var* worldToTangent = getInWorldToTangent(componentList); - Var* wsNormal = getInWorldNormal(componentList); Var *wsPosition = getInWsPosition( componentList ); - + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); Var *wsView = getWsView( wsPosition, meta ); // Look for a light mask generated from a previous From 79ad78361d75e8f233a7504b949836d803ffc4fd Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 4 Oct 2021 18:24:33 -0500 Subject: [PATCH 18/38] item->importStatus cleanup for asset importer --- Engine/source/T3D/assets/assetImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 5df1ca8ab..254df381d 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -1409,7 +1409,7 @@ void AssetImporter::processImportAssets(AssetImportObject* assetItem) Con::executef(this, processCommand.c_str(), item); } - item->importStatus == AssetImportObject::Processed; + item->importStatus = AssetImportObject::Processed; //try recusing on the children(if any) processImportAssets(item); @@ -2018,7 +2018,7 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) AssetQuery aQuery; U32 numAssetsFound = AssetDatabase.findAllAssets(&aQuery); - bool hasCollision = false; + hasCollision = false; for (U32 i = 0; i < numAssetsFound; i++) { StringTableEntry assetId = aQuery.mAssetList[i]; From 1b6b803a20d7f58f639ff2c09e7f8bf0e7b78742 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Mon, 4 Oct 2021 20:04:21 -0400 Subject: [PATCH 19/38] * BugFix: Clear a lot of warnings and correct a few actual programming errors along the way. --- Engine/lib/collada/include/dae.h | 2 +- .../lib/collada/include/dae/daeErrorHandler.h | 2 +- .../include/dae/daeStandardURIResolver.h | 2 +- .../lib/collada/src/dae/daeErrorHandler.cpp | 2 +- Engine/source/T3D/assets/MaterialAsset.cpp | 15 ++++--- Engine/source/T3D/assets/assetImporter.cpp | 2 +- Engine/source/T3D/assets/assetImporter.h | 9 ----- Engine/source/T3D/convexShape.cpp | 4 +- Engine/source/T3D/fx/particleEmitter.cpp | 12 +++++- Engine/source/T3D/fx/precipitation.cpp | 2 +- Engine/source/T3D/gameBase/gameConnection.cpp | 2 +- Engine/source/T3D/shapeBase.h | 2 +- Engine/source/afx/util/afxAnimCurve.h | 2 +- Engine/source/afx/util/afxCurveEval.h | 1 + Engine/source/afx/xm/afxXM_WaveBase.h | 3 +- Engine/source/collision/optimizedPolyList.h | 2 +- Engine/source/collision/polytope.h | 2 +- Engine/source/console/CMDscan.cpp | 40 +++++++++---------- Engine/source/console/arrayObject.cpp | 4 +- Engine/source/console/simObject.cpp | 4 +- Engine/source/core/stringBuffer.cpp | 2 +- Engine/source/core/strings/unicode.cpp | 4 +- Engine/source/core/util/hashFunction.h | 4 +- Engine/source/environment/decalRoad.cpp | 2 +- .../editors/guiMeshRoadEditorCtrl.cpp | 2 +- .../editors/guiRiverEditorCtrl.cpp | 2 +- .../environment/editors/guiRoadEditorCtrl.cpp | 2 +- Engine/source/environment/meshRoad.cpp | 4 +- Engine/source/environment/river.cpp | 2 +- Engine/source/gfx/bitmap/gBitmap.cpp | 4 +- .../source/gfx/bitmap/loaders/bitmapPng.cpp | 2 +- Engine/source/gfx/gl/gfxGLCubemap.cpp | 2 +- Engine/source/gfx/gl/gfxGLStateBlock.cpp | 4 +- Engine/source/gfx/gl/gfxGLTextureArray.cpp | 2 +- Engine/source/gfx/gl/gfxGLTextureArray.h | 2 +- Engine/source/gfx/gl/gfxGLTextureObject.cpp | 2 +- Engine/source/gfx/sim/cubemapData.cpp | 2 +- .../source/gfx/video/videoEncoderTheora.cpp | 2 +- Engine/source/gui/core/guiCanvas.cpp | 2 +- Engine/source/gui/editor/guiInspector.cpp | 4 +- .../source/gui/editor/guiShapeEdPreview.cpp | 6 +-- .../worldEditor/guiConvexShapeEditorCtrl.h | 2 +- .../source/gui/worldEditor/guiMissionArea.h | 2 +- .../source/gui/worldEditor/terrainActions.cpp | 2 +- .../advanced/advancedLightBinManager.h | 2 +- .../source/lighting/basic/blTerrainSystem.cpp | 4 +- .../source/materials/materialDefinition.cpp | 2 +- Engine/source/math/mRandom.h | 2 +- Engine/source/navigation/guiNavEditorCtrl.h | 2 +- Engine/source/persistence/taml/taml.cpp | 2 +- Engine/source/platform/platformNet.cpp | 2 +- Engine/source/platformSDL/sdlInput.cpp | 2 +- .../source/platformX86UNIX/x86UNIXFileio.cpp | 16 ++++---- .../renderInstance/renderImposterMgr.cpp | 2 +- .../renderInstance/renderPassStateToken.cpp | 2 +- .../scene/mixin/scenePolyhedralObject.impl.h | 6 +-- Engine/source/sim/actionMap.cpp | 2 +- Engine/source/sim/actionMap.h | 2 +- Engine/source/sim/netObject.cpp | 4 +- Engine/source/ts/tsShape.cpp | 6 +-- Engine/source/ts/tsShapeConstruct.cpp | 2 +- 61 files changed, 120 insertions(+), 118 deletions(-) diff --git a/Engine/lib/collada/include/dae.h b/Engine/lib/collada/include/dae.h index d6f217ed8..d5d16f125 100644 --- a/Engine/lib/collada/include/dae.h +++ b/Engine/lib/collada/include/dae.h @@ -195,7 +195,7 @@ private: daeRawRefCache rawRefCache; daeSidRefCache sidRefCache; - std::auto_ptr localCharEncoding; + std::unique_ptr localCharEncoding; static charEncoding globalCharEncoding; }; diff --git a/Engine/lib/collada/include/dae/daeErrorHandler.h b/Engine/lib/collada/include/dae/daeErrorHandler.h index 6d6499486..edc20ee31 100644 --- a/Engine/lib/collada/include/dae/daeErrorHandler.h +++ b/Engine/lib/collada/include/dae/daeErrorHandler.h @@ -60,7 +60,7 @@ public: private: static daeErrorHandler *_instance; - static std::auto_ptr _defaultInstance; + static std::unique_ptr _defaultInstance; }; #endif diff --git a/Engine/lib/collada/include/dae/daeStandardURIResolver.h b/Engine/lib/collada/include/dae/daeStandardURIResolver.h index 0c92bcc6e..6d9bcf15d 100644 --- a/Engine/lib/collada/include/dae/daeStandardURIResolver.h +++ b/Engine/lib/collada/include/dae/daeStandardURIResolver.h @@ -12,7 +12,7 @@ */ #ifndef __DAE_STANDARD_URI_RESOLVER__ -#define __DAE_STANDARD_URI_RESOVLER__ +#define __DAE_STANDARD_URI_RESOLVER__ #include #include "dae/daeURI.h" diff --git a/Engine/lib/collada/src/dae/daeErrorHandler.cpp b/Engine/lib/collada/src/dae/daeErrorHandler.cpp index 843bbbae3..2e7edcf9c 100644 --- a/Engine/lib/collada/src/dae/daeErrorHandler.cpp +++ b/Engine/lib/collada/src/dae/daeErrorHandler.cpp @@ -15,7 +15,7 @@ #include daeErrorHandler *daeErrorHandler::_instance = NULL; -std::auto_ptr daeErrorHandler::_defaultInstance(new stdErrPlugin); +std::unique_ptr daeErrorHandler::_defaultInstance(new stdErrPlugin); daeErrorHandler::daeErrorHandler() { } diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 8fd2b6ecf..57008b025 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -19,7 +19,6 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#pragma once #ifndef MATERIALASSET_H #include "MaterialAsset.h" @@ -171,10 +170,16 @@ void MaterialAsset::initializeAsset() if (Torque::FS::IsScriptFile(mScriptPath)) { if (!Sim::findObject(mMatDefinitionName)) - if (Con::executeFile(mScriptPath, false, false)) - mLoadedState = ScriptLoaded; - else - mLoadedState = Failed; + { + if (Con::executeFile(mScriptPath, false, false)) + { + mLoadedState = ScriptLoaded; + } + else + { + mLoadedState = Failed; + } + } } loadMaterial(); diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 5df1ca8ab..c9ed8a211 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -1409,7 +1409,7 @@ void AssetImporter::processImportAssets(AssetImportObject* assetItem) Con::executef(this, processCommand.c_str(), item); } - item->importStatus == AssetImportObject::Processed; + item->importStatus = AssetImportObject::Processed; //try recusing on the children(if any) processImportAssets(item); diff --git a/Engine/source/T3D/assets/assetImporter.h b/Engine/source/T3D/assets/assetImporter.h index 0c176840a..b03c89c40 100644 --- a/Engine/source/T3D/assets/assetImporter.h +++ b/Engine/source/T3D/assets/assetImporter.h @@ -931,15 +931,6 @@ public: return imagePath; } - static inline const char* makeFullPath(const String& path) - { - char qualifiedFilePath[2048]; - - Platform::makeFullPathName(path.c_str(), qualifiedFilePath, sizeof(qualifiedFilePath)); - - return qualifiedFilePath; - } - // void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; } const String& getTargetModuleId() { return targetModuleId; } diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index 99f3f418a..e0184f2f4 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -318,10 +318,10 @@ void ConvexShape::initPersistFields() addGroup( "Internal" ); - addProtectedField( "surface", TypeRealString, NULL, &protectedSetSurface, &defaultProtectedGetFn, + addProtectedField( "surface", TypeRealString, 0, &protectedSetSurface, &defaultProtectedGetFn, "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors ); - addProtectedField( "surfaceTexture", TypeRealString, NULL, &protectedSetSurfaceTexture, &defaultProtectedGetFn, + addProtectedField( "surfaceTexture", TypeRealString, 0, &protectedSetSurfaceTexture, &defaultProtectedGetFn, "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors ); endGroup( "Internal" ); diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 45acd1ecb..c60dc6d49 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1914,7 +1914,11 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie { SortParticle* partPtr = orderedVector.address(); for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr -= 4) - setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr); + { + SortParticle* part = partPtr; + partPtr++; + setupRibbon(part->p, partPtr->p, partPtr->p, camPos, ambientColor, buffPtr); + } } // do unsorted-oriented particles else @@ -1933,7 +1937,11 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie { SortParticle* partPtr = orderedVector.address(); for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr += 4) - setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr); + { + SortParticle* part = partPtr; + partPtr++; + setupRibbon(part->p, partPtr->p, partPtr->p, camPos, ambientColor, buffPtr); + } } // do unsorted-oriented particles else diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index 4356cd45f..5740edae6 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -996,7 +996,7 @@ void Precipitation::initRenderObjects() // entire or a partially filled vb. mRainIB.set(GFX, mMaxVBDrops * 6, 0, GFXBufferTypeStatic); U16 *idxBuff; - mRainIB.lock(&idxBuff, NULL, NULL, NULL); + mRainIB.lock(&idxBuff, NULL, 0, 0); for( U32 i=0; i < mMaxVBDrops; i++ ) { // diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 09cfa13cf..f759a03da 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -807,7 +807,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov) return cObj->isValidCameraFov(fov); } - return NULL; + return false; } bool GameConnection::setControlCameraFov(F32 fov) diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 4d3286b5c..2deb7996c 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -116,7 +116,7 @@ class ShapeBaseConvex : public Convex Box3F box; public: - ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(NULL), nodeTransform(0) { mType = ShapeBaseConvexType; } + ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(0), nodeTransform(0) { mType = ShapeBaseConvexType; } ShapeBaseConvex(const ShapeBaseConvex& cv) { mObject = cv.mObject; pShapeBase = cv.pShapeBase; diff --git a/Engine/source/afx/util/afxAnimCurve.h b/Engine/source/afx/util/afxAnimCurve.h index 158203b44..6ed7dbfd0 100644 --- a/Engine/source/afx/util/afxAnimCurve.h +++ b/Engine/source/afx/util/afxAnimCurve.h @@ -56,7 +56,7 @@ class afxAnimCurve public: afxAnimCurve(); - ~afxAnimCurve(); + virtual ~afxAnimCurve(); void addKey( Point2F &v ); void addKey( F32 time, F32 value ); diff --git a/Engine/source/afx/util/afxCurveEval.h b/Engine/source/afx/util/afxCurveEval.h index 0a8765c19..d5c6853b9 100644 --- a/Engine/source/afx/util/afxCurveEval.h +++ b/Engine/source/afx/util/afxCurveEval.h @@ -32,6 +32,7 @@ class afxCurveEval { public: + virtual ~afxCurveEval() { } virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, F32 t)=0; virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t)=0; virtual Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, F32 t)=0; diff --git a/Engine/source/afx/xm/afxXM_WaveBase.h b/Engine/source/afx/xm/afxXM_WaveBase.h index f7dd26f31..e231ef2b8 100644 --- a/Engine/source/afx/xm/afxXM_WaveBase.h +++ b/Engine/source/afx/xm/afxXM_WaveBase.h @@ -81,6 +81,7 @@ public: class afxXM_WaveInterp { public: + virtual ~afxXM_WaveInterp() { } virtual void interpolate(F32 t, afxXM_Params& params)=0; virtual void pulse()=0; @@ -250,7 +251,7 @@ protected: public: /*C*/ afxXM_WaveBase(afxXM_WaveBaseData*, afxEffectWrapper*, afxXM_WaveInterp*); - /*D*/ ~afxXM_WaveBase(); + /*D*/ virtual ~afxXM_WaveBase(); virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); }; diff --git a/Engine/source/collision/optimizedPolyList.h b/Engine/source/collision/optimizedPolyList.h index b66cc76c0..b42469fe1 100644 --- a/Engine/source/collision/optimizedPolyList.h +++ b/Engine/source/collision/optimizedPolyList.h @@ -87,7 +87,7 @@ class OptimizedPolyList : public AbstractPolyList Poly() : plane( -1 ), - material( NULL ), + material( 0 ), vertexStart(0), vertexCount( 0 ), surfaceKey(0), diff --git a/Engine/source/collision/polytope.h b/Engine/source/collision/polytope.h index 347a85c70..34483c976 100644 --- a/Engine/source/collision/polytope.h +++ b/Engine/source/collision/polytope.h @@ -76,7 +76,7 @@ public: Collision() { object = NULL; - material = NULL; + material = 0; distance = 0.0; } }; diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 43a864570..787b4e845 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -774,9 +774,9 @@ YY_MALLOC_DECL YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; #line 105 "CMDscan.l" @@ -823,7 +823,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1430,9 +1430,9 @@ case YY_STATE_EOF(INITIAL): static int yy_get_next_buffer() { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; + char *dest = yy_current_buffer->yy_ch_buf; + char *source = yytext_ptr; + int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) @@ -1560,14 +1560,14 @@ static int yy_get_next_buffer() static yy_state_type yy_get_previous_state() { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1599,10 +1599,10 @@ static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + int yy_is_jam; + char *yy_cp = yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1623,14 +1623,14 @@ yy_state_type yy_current_state; #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) +static void yyunput( int c, char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; -register char *yy_bp; +char *yy_bp; #endif { - register char *yy_cp = yy_c_buf_p; + char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; @@ -1638,10 +1638,10 @@ register char *yy_bp; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ + int number_to_move = yy_n_chars + 2; + char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; - register char *source = + char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) @@ -2095,7 +2095,7 @@ yyconst char *s2; int n; #endif { - register int i; + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index 68b34059e..4c18ac306 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -125,7 +125,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void ArrayObject::ArrayObject() : mCaseSensitive( false ), - mCurrentIndex( NULL ) + mCurrentIndex( 0 ) { } @@ -137,7 +137,7 @@ void ArrayObject::initPersistFields() "Makes the keys and values case-sensitive.\n" "By default, comparison of key and value strings will be case-insensitive." ); - addProtectedField( "key", TypeCaseString, NULL, &_addKeyFromField, &emptyStringProtectedGetFn, + addProtectedField( "key", TypeCaseString, 0, &_addKeyFromField, &emptyStringProtectedGetFn, "Helper field which allows you to add new key['keyname'] = value pairs." ); Parent::initPersistFields(); diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 6b54bdd1d..3d485354c 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -179,10 +179,10 @@ void SimObject::initPersistFields() addGroup( "Editing" ); - addProtectedField( "hidden", TypeBool, NULL, + addProtectedField( "hidden", TypeBool, 0, &_setHidden, &_getHidden, "Whether the object is visible." ); - addProtectedField( "locked", TypeBool, NULL, + addProtectedField( "locked", TypeBool, 0, &_setLocked, &_getLocked, "Whether the object can be edited." ); diff --git a/Engine/source/core/stringBuffer.cpp b/Engine/source/core/stringBuffer.cpp index 2bc3fb069..66983fcf2 100644 --- a/Engine/source/core/stringBuffer.cpp +++ b/Engine/source/core/stringBuffer.cpp @@ -371,7 +371,7 @@ void StringBuffer::getCopy(UTF16 *buff, const U32 buffSize) const AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!"); dMemcpy(buff, mBuffer.address(), sizeof(UTF16) * getMin(buffSize, (U32)mBuffer.size())); // ensure null termination. - buff[buffSize-1] = NULL; + buff[buffSize-1] = 0; } UTF8* StringBuffer::createCopy8() const diff --git a/Engine/source/core/strings/unicode.cpp b/Engine/source/core/strings/unicode.cpp index fd2341b7b..ad43ad3e1 100644 --- a/Engine/source/core/strings/unicode.cpp +++ b/Engine/source/core/strings/unicode.cpp @@ -236,8 +236,8 @@ U32 convertUTF16toUTF8DoubleNULL( const UTF16 *unistring, UTF8 *outbuffer, U32 } nCodeunits = getMin(nCodeunits,len - 1); - outbuffer[nCodeunits] = NULL; - outbuffer[nCodeunits+1] = NULL; + outbuffer[nCodeunits] = '\0'; + outbuffer[nCodeunits+1] = '\0'; PROFILE_END(); return nCodeunits; diff --git a/Engine/source/core/util/hashFunction.h b/Engine/source/core/util/hashFunction.h index d2e1d5b4a..02ecd019b 100644 --- a/Engine/source/core/util/hashFunction.h +++ b/Engine/source/core/util/hashFunction.h @@ -30,9 +30,9 @@ namespace Torque { -extern U32 hash(register const U8 *k, register U32 length, register U32 initval); +extern U32 hash(const U8 *k, U32 length, U32 initval); -extern U64 hash64(register const U8 *k, register U32 length, register U64 initval); +extern U64 hash64(const U8 *k, U32 length, U64 initval); } diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index e1d9a27ee..33d137a83 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -320,7 +320,7 @@ void DecalRoad::initPersistFields() addGroup( "Internal" ); - addProtectedField( "node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, + addProtectedField( "node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "Do not modify, for internal use." ); endGroup( "Internal" ); diff --git a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp index b0812f738..6433332d7 100644 --- a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp @@ -1757,7 +1757,7 @@ DefineEngineMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) { MeshRoad *road = object->getSelectedRoad(); if ( !road ) - return NULL; + return 0; return road->getId(); } diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index e650fdf59..983c8a01e 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -1472,7 +1472,7 @@ DefineEngineMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" ) { River *river = object->getSelectedRiver(); if ( !river ) - return NULL; + return 0; return river->getId(); } diff --git a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp index 3f111a80e..67b6ef883 100644 --- a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp @@ -1097,7 +1097,7 @@ DefineEngineMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) if ( road ) return road->getId(); - return NULL; + return 0; } DefineEngineMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" ) diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index f27d2d84a..01f8017de 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -954,10 +954,10 @@ void MeshRoad::initPersistFields() addGroup( "Internal" ); - addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, + addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "Do not modify, for internal use." ); - addProtectedField( "ProfileNode", TypeString, NULL, &addProfileNodeFromField, &emptyStringProtectedGetFn, + addProtectedField( "ProfileNode", TypeString, 0, &addProfileNodeFromField, &emptyStringProtectedGetFn, "Do not modify, for internal use." ); endGroup( "Internal" ); diff --git a/Engine/source/environment/river.cpp b/Engine/source/environment/river.cpp index 9bb1d7aac..0213f9d1d 100644 --- a/Engine/source/environment/river.cpp +++ b/Engine/source/environment/river.cpp @@ -647,7 +647,7 @@ void River::initPersistFields() addGroup( "Internal" ); - addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." ); + addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." ); endGroup( "Internal" ); diff --git a/Engine/source/gfx/bitmap/gBitmap.cpp b/Engine/source/gfx/bitmap/gBitmap.cpp index 9560586dd..b7045d129 100644 --- a/Engine/source/gfx/bitmap/gBitmap.cpp +++ b/Engine/source/gfx/bitmap/gBitmap.cpp @@ -1199,7 +1199,7 @@ bool GBitmap::readBitmap( const String &bmType, Stream &ioStream ) if ( regInfo == NULL ) { Con::errorf( "[GBitmap::readBitmap] unable to find registration for extension [%s]", bmType.c_str() ); - return NULL; + return false; } return regInfo->readFunc( ioStream, this ); @@ -1212,7 +1212,7 @@ bool GBitmap::writeBitmap( const String &bmType, Stream &ioStream, U32 compress if ( regInfo == NULL ) { Con::errorf( "[GBitmap::writeBitmap] unable to find registration for extension [%s]", bmType.c_str() ); - return NULL; + return false; } return regInfo->writeFunc( this, ioStream, (compressionLevel == U32_MAX) ? regInfo->defaultCompression : compressionLevel ); diff --git a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp index 65586caa8..9eb1d7b2c 100644 --- a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp +++ b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp @@ -143,7 +143,7 @@ static bool sReadPNG(Stream &stream, GBitmap *bitmap) stream.read(cs_headerBytesChecked, header); bool isPng = png_check_sig(header, cs_headerBytesChecked) != 0; - if (isPng == false) + if (!isPng) { AssertWarn(false, "GBitmap::readPNG: stream doesn't contain a PNG"); return false; diff --git a/Engine/source/gfx/gl/gfxGLCubemap.cpp b/Engine/source/gfx/gl/gfxGLCubemap.cpp index 99f3f02a8..db23a0fc2 100644 --- a/Engine/source/gfx/gl/gfxGLCubemap.cpp +++ b/Engine/source/gfx/gl/gfxGLCubemap.cpp @@ -308,7 +308,7 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip) GFXGLCubemapArray::GFXGLCubemapArray() { - mCubemap = NULL; + mCubemap = 0; } GFXGLCubemapArray::~GFXGLCubemapArray() diff --git a/Engine/source/gfx/gl/gfxGLStateBlock.cpp b/Engine/source/gfx/gl/gfxGLStateBlock.cpp index 5be2e43d5..12eab71b0 100644 --- a/Engine/source/gfx/gl/gfxGLStateBlock.cpp +++ b/Engine/source/gfx/gl/gfxGLStateBlock.cpp @@ -101,8 +101,8 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState) // the state value even if that value is identical to the current value. #define STATE_CHANGE(state) (!oldState || oldState->mDesc.state != mDesc.state) -#define TOGGLE_STATE(state, enum) if(mDesc.state) glEnable(enum); else glDisable(enum) -#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) if(mDesc.state) glEnable(enum); else glDisable(enum) +#define TOGGLE_STATE(state, enum) if(mDesc.state) { glEnable(enum); } else { glDisable(enum); } +#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) { if(mDesc.state) { glEnable(enum); } else { glDisable(enum); }} // Blending CHECK_TOGGLE_STATE(blendEnable, GL_BLEND); diff --git a/Engine/source/gfx/gl/gfxGLTextureArray.cpp b/Engine/source/gfx/gl/gfxGLTextureArray.cpp index f2b403bb0..e0137a448 100644 --- a/Engine/source/gfx/gl/gfxGLTextureArray.cpp +++ b/Engine/source/gfx/gl/gfxGLTextureArray.cpp @@ -6,7 +6,7 @@ GFXGLTextureArray::GFXGLTextureArray() { - mTextureArray = NULL; + mTextureArray = 0; } void GFXGLTextureArray::init() diff --git a/Engine/source/gfx/gl/gfxGLTextureArray.h b/Engine/source/gfx/gl/gfxGLTextureArray.h index 65e1d9729..7073b1653 100644 --- a/Engine/source/gfx/gl/gfxGLTextureArray.h +++ b/Engine/source/gfx/gl/gfxGLTextureArray.h @@ -13,7 +13,7 @@ public: ~GFXGLTextureArray() { Release(); }; - void init(); + void init() override; void setToTexUnit(U32 tuNum) override; diff --git a/Engine/source/gfx/gl/gfxGLTextureObject.cpp b/Engine/source/gfx/gl/gfxGLTextureObject.cpp index 9eabc8114..1d5c043e4 100644 --- a/Engine/source/gfx/gl/gfxGLTextureObject.cpp +++ b/Engine/source/gfx/gl/gfxGLTextureObject.cpp @@ -46,7 +46,7 @@ GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *p { #if TORQUE_DEBUG - mFrameAllocatorMarkGuard == FrameAllocator::getWaterMark(); + mFrameAllocatorMarkGuard = FrameAllocator::getWaterMark(); #endif dMemset(&mLockedRect, 0, sizeof(mLockedRect)); diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index a6833de5c..bf9390dfe 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -135,7 +135,7 @@ void CubemapData::createMap() if( initSuccess ) { mCubemap = GFX->createCubemap(); - if (mCubeMapFace == NULL || mCubeMapFace->isNull()) + if (!mCubeMapFace || mCubeMapFace->isNull()) return; mCubemap->initStatic(mCubeMapFace); } diff --git a/Engine/source/gfx/video/videoEncoderTheora.cpp b/Engine/source/gfx/video/videoEncoderTheora.cpp index d64f76487..ef88787f8 100644 --- a/Engine/source/gfx/video/videoEncoderTheora.cpp +++ b/Engine/source/gfx/video/videoEncoderTheora.cpp @@ -226,7 +226,7 @@ public: return setStatus(false); } - ogg_stream_init(&to, Platform::getRandom() * S32_MAX); + ogg_stream_init(&to, Platform::getRandom() * double(S32_MAX)); ogg_packet op; diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 96022edaa..0b894f7c3 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -2438,7 +2438,7 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),, if (control) return control->getId(); - return NULL; + return 0; } DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),, diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 48c4dcc94..47d1e3c85 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -908,12 +908,12 @@ DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), , "@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.") { if ( !obj) - return NULL; + return 0; SimObject *inspector = GuiInspector::findByObject(obj); if ( !inspector ) - return NULL; + return 0; return inspector->getId(); } diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 5ea20ec13..eba775edb 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -160,11 +160,11 @@ void GuiShapeEdPreview::initPersistFields() addGroup( "Animation" ); addField( "activeThread", TypeS32, Offset( mActiveThread, GuiShapeEdPreview ), "Index of the active thread, or -1 if none" ); - addProtectedField( "threadPos", TypeF32, NULL, &setFieldThreadPos, &getFieldThreadPos, + addProtectedField( "threadPos", TypeF32, 0, &setFieldThreadPos, &getFieldThreadPos, "Current position of the active thread (0-1)" ); - addProtectedField( "threadDirection", TypeS32, NULL, &setFieldThreadDir, &getFieldThreadDir, + addProtectedField( "threadDirection", TypeS32, 0, &setFieldThreadDir, &getFieldThreadDir, "Playback direction of the active thread" ); - addProtectedField( "threadPingPong", TypeBool, NULL, &setFieldThreadPingPong, &getFieldThreadPingPong, + addProtectedField( "threadPingPong", TypeBool, 0, &setFieldThreadPingPong, &getFieldThreadPingPong, "'PingPong' mode of the active thread" ); endGroup( "Animation" ); diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h index 6ede0cf61..1600a4e50 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h @@ -248,7 +248,7 @@ class GuiConvexEditorUndoAction : public UndoAction friend class GuiConvexEditorCtrl; public: - GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(NULL) + GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(0) { } diff --git a/Engine/source/gui/worldEditor/guiMissionArea.h b/Engine/source/gui/worldEditor/guiMissionArea.h index 885f85107..9c3dec0a5 100644 --- a/Engine/source/gui/worldEditor/guiMissionArea.h +++ b/Engine/source/gui/worldEditor/guiMissionArea.h @@ -145,7 +145,7 @@ class GuiMissionAreaUndoAction : public UndoAction { public: - GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(NULL) + GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(0) { } diff --git a/Engine/source/gui/worldEditor/terrainActions.cpp b/Engine/source/gui/worldEditor/terrainActions.cpp index 3fc07205d..a6fbb5c21 100644 --- a/Engine/source/gui/worldEditor/terrainActions.cpp +++ b/Engine/source/gui/worldEditor/terrainActions.cpp @@ -773,7 +773,7 @@ ConsoleDocClass( TerrainSmoothAction, ); TerrainSmoothAction::TerrainSmoothAction() - : UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(NULL) + : UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(0) { } diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.h b/Engine/source/lighting/advanced/advancedLightBinManager.h index 4f97e4239..4d04f3cfc 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.h +++ b/Engine/source/lighting/advanced/advancedLightBinManager.h @@ -70,7 +70,7 @@ protected: GFXStateBlockRef mLitState[NUM_LIT_STATES][2]; public: - LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false), mSpecialLight(NULL) {} + LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false), mSpecialLight(false) {} virtual bool init( const FeatureSet &features, const GFXVertexFormat *vertexFormat ); virtual bool setupPass( SceneRenderState *state, const SceneData &sgData ); diff --git a/Engine/source/lighting/basic/blTerrainSystem.cpp b/Engine/source/lighting/basic/blTerrainSystem.cpp index d6fb3f9d5..1cf077575 100644 --- a/Engine/source/lighting/basic/blTerrainSystem.cpp +++ b/Engine/source/lighting/basic/blTerrainSystem.cpp @@ -682,9 +682,9 @@ bool blTerrainSystem::createPersistChunkFromProxy(SceneLighting::ObjectProxy* ob { *ret = new blTerrainChunk(); return true; - } else { - return NULL; } + + return false; } // Given a ray, this will return the color from the lightmap of this object, return true if handled diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 7eb49ffc0..3c3cb5898 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -218,7 +218,7 @@ Material::Material() mPlanarReflection = false; mCubemapData = NULL; - mDynamicCubemap = NULL; + mDynamicCubemap = false; mLastUpdateTime = 0; diff --git a/Engine/source/math/mRandom.h b/Engine/source/math/mRandom.h index c69c06477..dbd4a2328 100644 --- a/Engine/source/math/mRandom.h +++ b/Engine/source/math/mRandom.h @@ -54,7 +54,7 @@ public: inline F32 MRandomGenerator::randF() { // default: multiply by 1/(2^31) - return F32(randI()) * (1.0f / S32_MAX); + return F32(randI()) * (1.0f / F64(S32_MAX)); } inline S32 MRandomGenerator::randI(S32 i, S32 n) diff --git a/Engine/source/navigation/guiNavEditorCtrl.h b/Engine/source/navigation/guiNavEditorCtrl.h index 4a6780b33..2d4c96bce 100644 --- a/Engine/source/navigation/guiNavEditorCtrl.h +++ b/Engine/source/navigation/guiNavEditorCtrl.h @@ -168,7 +168,7 @@ protected: class GuiNavEditorUndoAction : public UndoAction { public: - GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(NULL) + GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(0) { } diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index 837843c72..0454e102a 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -335,7 +335,7 @@ ImplementEnumType(_TamlFormatMode, // Write. //return writer.write( stream, pRootNode ); - return NULL; + return false; } /// Invalid. diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 1e5cb0a5a..db7c26604 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -241,7 +241,7 @@ namespace PlatformNetState struct addrinfo* pickAddressByProtocol(struct addrinfo* addr, int protocol) { - for (addr; addr != NULL; addr = addr->ai_next) + for (; addr != NULL; addr = addr->ai_next) { if (addr->ai_family == protocol) return addr; diff --git a/Engine/source/platformSDL/sdlInput.cpp b/Engine/source/platformSDL/sdlInput.cpp index a60a0e7b5..67d86b277 100644 --- a/Engine/source/platformSDL/sdlInput.cpp +++ b/Engine/source/platformSDL/sdlInput.cpp @@ -102,7 +102,7 @@ U16 Input::getKeyCode( U16 asciiCode ) char c[2]; c[0]= asciiCode; - c[1] = NULL; + c[1] = 0; return KeyMapSDL::getTorqueScanCodeFromSDL( SDL_GetScancodeFromKey( SDL_GetKeyFromName(c) ) ); } diff --git a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp index 77419a96a..eee06a84e 100644 --- a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp @@ -594,20 +594,20 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) return currentStatus; U32 finalPos = 0; - switch (absolutePos) + + if (absolutePos) { - case true: // absolute position AssertFatal(0 <= position, "File::setPosition: negative absolute position"); // position beyond EOS is OK finalPos = lseek(*((int *)handle), position, SEEK_SET); - break; - case false: // relative position + } + else + { AssertFatal((getPosition() >= (U32)abs(position) && 0 > position) || 0 <= position, "File::setPosition: negative relative position"); // position beyond EOS is OK finalPos = lseek(*((int *)handle), position, SEEK_CUR); - break; } if (0xffffffff == finalPos) @@ -1110,7 +1110,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) if (dip == NULL) return false; - while (d = readdir(dip)) + while ((d = readdir(dip))) { bool isDir = false; if (d->d_type == DT_UNKNOWN) @@ -1229,14 +1229,14 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) // Iterate through and grab valid directories ////////////////////////////////////////////////////////////////////////// - while (d = readdir(dip)) + while ((d = readdir(dip))) { bool isDir; isDir = false; if (d->d_type == DT_UNKNOWN) { char child [1024]; - if ((Path[dStrlen(Path) - 1] == '/')) + if (Path[dStrlen(Path) - 1] == '/') dSprintf(child, 1024, "%s%s", Path, d->d_name); else dSprintf(child, 1024, "%s/%s", Path, d->d_name); diff --git a/Engine/source/renderInstance/renderImposterMgr.cpp b/Engine/source/renderInstance/renderImposterMgr.cpp index d93c6c620..e0b8b3156 100644 --- a/Engine/source/renderInstance/renderImposterMgr.cpp +++ b/Engine/source/renderInstance/renderImposterMgr.cpp @@ -152,7 +152,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDefer // Setup a static index buffer for rendering. mIB.set( GFX, smImposterBatchSize * 6, 0, GFXBufferTypeStatic ); U16 *idxBuff; - mIB.lock(&idxBuff, NULL, NULL, NULL); + mIB.lock(&idxBuff, NULL, 0, 0); for ( U32 i=0; i < smImposterBatchSize; i++ ) { // diff --git a/Engine/source/renderInstance/renderPassStateToken.cpp b/Engine/source/renderInstance/renderPassStateToken.cpp index 560fb40f3..c00b05cdf 100644 --- a/Engine/source/renderInstance/renderPassStateToken.cpp +++ b/Engine/source/renderInstance/renderPassStateToken.cpp @@ -86,7 +86,7 @@ static const char *_get_enable(void* obj, const char* data) void RenderPassStateToken::initPersistFields() { - addProtectedField("enabled", TypeBool, NULL, &_set_enable, &_get_enable, "Enables or disables this token."); + addProtectedField("enabled", TypeBool, 0, &_set_enable, &_get_enable, "Enables or disables this token."); Parent::initPersistFields(); } diff --git a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h index 4ce8998f0..32ec98e71 100644 --- a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h +++ b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h @@ -44,15 +44,15 @@ void ScenePolyhedralObject< Base, P >::initPersistFields() { Parent::addGroup( "Internal" ); - Parent::addProtectedField( "plane", TypeRealString, NULL, + Parent::addProtectedField( "plane", TypeRealString, 0, &_setPlane, &defaultProtectedGetFn, "For internal use only.", AbstractClassRep::FIELD_HideInInspectors ); - Parent::addProtectedField( "point", TypeRealString, NULL, + Parent::addProtectedField( "point", TypeRealString, 0, &_setPoint, &defaultProtectedGetFn, "For internal use only.", AbstractClassRep::FIELD_HideInInspectors ); - Parent::addProtectedField( "edge", TypeRealString, NULL, + Parent::addProtectedField( "edge", TypeRealString, 0, &_setEdge, &defaultProtectedGetFn, "For internal use only.", AbstractClassRep::FIELD_HideInInspectors ); diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 40a41aa06..117278aff 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1962,7 +1962,7 @@ void ContextAction::processTick() if (mActive) { F32 currTime = Sim::getCurrentTime(); - static const char *argv[2]; + static const char *argv[3]; //see if this key even is still active if (!mBreakEvent) diff --git a/Engine/source/sim/actionMap.h b/Engine/source/sim/actionMap.h index 26caffe7b..840dd70f9 100644 --- a/Engine/source/sim/actionMap.h +++ b/Engine/source/sim/actionMap.h @@ -92,7 +92,7 @@ class ActionMap : public SimObject U32 deviceInst; Vector nodeMap; - DeviceMap():deviceType(NULL), deviceInst(NULL){ + DeviceMap():deviceType(0), deviceInst(0){ VECTOR_SET_ASSOCIATION(nodeMap); } ~DeviceMap(); diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index 25c5e3657..0a33379ec 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -407,7 +407,7 @@ DefineEngineMethod( NetObject, getClientObject, S32, (),, if ( obj ) return obj->getId(); - return NULL; + return 0; } //ConsoleMethod( NetObject, getClientObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." ) @@ -439,7 +439,7 @@ DefineEngineMethod( NetObject, getServerObject, S32, (),, if ( obj ) return obj->getId(); - return NULL; + return 0; } //ConsoleMethod( NetObject, getServerObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." ) diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index b3026a98a..36825014b 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -74,7 +74,7 @@ TSShape::TSShape() mRadius = 0; mFlags = 0; tubeRadius = 0; - data = NULL; + data = 0; materialList = NULL; mReadVersion = -1; // -1 means constructed from scratch (e.g., in exporter or no read yet) mSequencesConstructed = false; @@ -225,11 +225,7 @@ const String& TSShape::getTargetName( S32 mapToNameIndex ) const S32 TSShape::getTargetCount() const { - if(!this) - return -1; - return materialList->getMaterialNameList().size(); - } S32 TSShape::findNode(S32 nameIndex) const diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 08dbc21c2..6f53670b8 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -357,7 +357,7 @@ void TSShapeConstructor::initPersistFields() endGroup("Collada"); addGroup("Sequences"); - addProtectedField("sequence", TypeStringFilename, NULL, &addSequenceFromField, &emptyStringProtectedGetFn, + addProtectedField("sequence", TypeStringFilename, 0, &addSequenceFromField, &emptyStringProtectedGetFn, "Legacy method of adding sequences to a DTS or DAE shape after loading.\n\n" "@tsexample\n" "singleton TSShapeConstructor(MyShapeDae)\n" From eb8434c5a447b30886d94d54c04e7e3dd4edfeab Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 5 Oct 2021 00:23:26 -0500 Subject: [PATCH 20/38] don't try and sort ribbon particles --- Engine/source/T3D/fx/particleEmitter.cpp | 37 +++--------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index c60dc6d49..79d2e6f1d 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1908,50 +1908,21 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie if (mDataBlock->reverseOrder) { - buffPtr += 4 * (n_parts - 1); - // do sorted-oriented particles - if (mDataBlock->sortParticles) - { - SortParticle* partPtr = orderedVector.address(); - for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr -= 4) - { - SortParticle* part = partPtr; - partPtr++; - setupRibbon(part->p, partPtr->p, partPtr->p, camPos, ambientColor, buffPtr); - } - } - // do unsorted-oriented particles - else - { Particle* oldPtr = NULL; - for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4) { + for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4) + { setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr); oldPtr = partPtr; } - } } else { - // do sorted-oriented particles - if (mDataBlock->sortParticles) - { - SortParticle* partPtr = orderedVector.address(); - for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr += 4) - { - SortParticle* part = partPtr; - partPtr++; - setupRibbon(part->p, partPtr->p, partPtr->p, camPos, ambientColor, buffPtr); - } - } - // do unsorted-oriented particles - else - { Particle* oldPtr = NULL; - for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4) { + for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4) + { setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr); oldPtr = partPtr; } - } } PROFILE_END(); } From 42e90ad3fb7cbb5b5fa9c78baa8875e4ea2e8d46 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 5 Oct 2021 14:46:37 -0500 Subject: [PATCH 21/38] RTLightingFeat work. 1) we do *not* in fact want to early out in the presence of MFT_ImposterVert. it mangles the position-send. 2) dx sucessfuly handles the if ( !fd.features[MFT_NormalMap] ) case, so use the same for gl --- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 6 ++---- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 73bb56fd1..6df9a01bf 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -2070,7 +2070,6 @@ RTLightingFeatGLSL::RTLightingFeatGLSL() void RTLightingFeatGLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - if (fd.features[MFT_ImposterVert]) return; MultiLine *meta = new MultiLine; ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); @@ -2124,8 +2123,7 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, // If there isn't a normal map then we need to pass // the world space normal to the pixel shader ourselves. - //Temporarily disabled while we figure out how to better handle normals without a normal map - /*if ( !fd.features[MFT_NormalMap] ) + if ( !fd.features[MFT_NormalMap] ) { Var *outNormal = connectComp->getElement( RT_TEXCOORD ); outNormal->setName( "wsNormal" ); @@ -2137,7 +2135,7 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, // Transform the normal to world space. meta->addStatement( new GenOp( " @ = tMul( @, vec4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); - }*/ + } } diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index ecd4619d0..eae07aa95 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -2136,8 +2136,6 @@ RTLightingFeatHLSL::RTLightingFeatHLSL() void RTLightingFeatHLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - if (fd.features[MFT_ImposterVert]) return; - MultiLine *meta = new MultiLine; ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); @@ -2192,7 +2190,6 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, // If there isn't a normal map then we need to pass // the world space normal to the pixel shader ourselves. - //Temporarily disabled while we figure out how to better handle normals without a normal map if ( !fd.features[MFT_NormalMap] ) { Var *outNormal = connectComp->getElement( RT_TEXCOORD ); From 070a3a30b60bea1c7d14a5bd1a5e5f5aa00bcaf3 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Wed, 6 Oct 2021 00:35:38 -0400 Subject: [PATCH 22/38] * [Linux] BugFix: Free the mouse cursor when triggering SIGTRAP on Linux to ensure that the cursor is available for debugging. --- .../source/platformX86UNIX/x86UNIXProcessControl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp b/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp index 09c59af4d..db7d0bdb7 100644 --- a/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp @@ -24,6 +24,8 @@ #include "platformX86UNIX/x86UNIXState.h" #include "platformX86UNIX/x86UNIXStdConsole.h" #include "platform/platformInput.h" +#include "windowManager/platformWindow.h" +#include "windowManager/platformWindowMgr.h" #include "console/console.h" #include @@ -165,6 +167,15 @@ void Platform::debugBreak() Con::errorf(ConsoleLogEntry::General, "Platform::debugBreak: triggering SIGSEGV for core dump"); //kill(getpid(), SIGSEGV); + + // On Linux, the mouse cursor will remain trapped when the SIGTRAP below triggers so we ensure the mouse + // locked state is disabled prior to dropping to debug + PlatformWindow* firstWindow = WindowManager->getFirstWindow(); + if (firstWindow) + { + firstWindow->setMouseLocked(false); + } + kill(getpid(), SIGTRAP); } From 24bf807713a3a361406ae3365a5483b8e0be68cd Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Wed, 6 Oct 2021 21:53:26 -0400 Subject: [PATCH 23/38] various shadergen fixes. --- .../shaderGen/GLSL/shaderFeatureGLSL.cpp | 1 + .../shaderGen/HLSL/shaderFeatureHLSL.cpp | 8 ++++ .../source/terrain/glsl/terrFeatureGLSL.cpp | 41 +++++++++++-------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 6df9a01bf..b41dfc234 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -1982,6 +1982,7 @@ void ReflectCubeFeatGLSL::processPix( Vector &componentList, Var *envColor = new Var("envColor", "vec3"); meta->addStatement(new GenOp(" @ = @.rgb - (@.rgb * @);\r\n", new DecOp(dColor), targ, targ, metalness)); meta->addStatement(new GenOp(" @ = @.rgb*(@).rgb;\r\n", new DecOp(envColor), targ, texCube)); + meta->addStatement(new GenOp(" @.rgb = @+@;\r\n", targ, dColor, envColor)); } else if (lerpVal) meta->addStatement(new GenOp(" @ *= vec4(@.rgb*@.a, @.a);\r\n", targ, texCube, lerpVal, targ)); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index eae07aa95..0b5f79e4d 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -892,6 +892,14 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult } Var* wsEyePos = (Var*)LangElement::find("eyePosWorld"); + + if (!wsEyePos) + { + wsEyePos = new Var("eyePosWorld", "float3"); + wsEyePos->uniform = true; + wsEyePos->constSortPos = cspPass; + } + Var* wsPosition = getInWsPosition(componentList); Var* wsView = getWsView(wsPosition, meta); diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index d30e639ec..3b66006ce 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -281,6 +281,8 @@ void TerrainBaseMapFeatGLSL::processVert( Vector &componentLis Var *squareSize = _getUniformVar( "squareSize", "float", cspPass ); meta->addStatement( new GenOp( " @ = normalize( vec3( @, 0, @ ) );\r\n", new DecOp( inTanget ), squareSize, inTangentZ ) ); + + getOutViewToTangent(componentList, meta, fd); } void TerrainBaseMapFeatGLSL::processPix( Vector &componentList, @@ -331,6 +333,8 @@ void TerrainBaseMapFeatGLSL::processPix( Vector &componentLis meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); output = meta; + + Var* viewToTangent = getInViewToTangent(componentList); } ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFeatureData &fd ) @@ -781,6 +785,22 @@ void TerrainMacroMapFeatGLSL::processPix( Vector &componentL meta->addStatement( new GenOp( " @ = calcBlend( @.x, @.xy, @, @ );\r\n", new DecOp( detailBlend ), detailInfo, inTex, layerSize, layerSample ) ); + // Check to see if we have a gbuffer normal. + Var* gbNormal = (Var*)LangElement::find("gbNormal"); + + // If we have a gbuffer normal and we don't have a + // normal map feature then we need to lerp in a + // default normal else the normals below this layer + // will show thru. + if (gbNormal && + !fd.features.hasFeature(MFT_TerrainNormalMap, detailIndex)) + { + Var* viewToTangent = getInViewToTangent(componentList); + + meta->addStatement(new GenOp(" @ = lerp( @, @[2], min( @, @.w ) );\r\n", + gbNormal, gbNormal, viewToTangent, detailBlend, inDet)); + } + Var *detailColor = (Var*)LangElement::find( "macroColor" ); if ( !detailColor ) { @@ -1224,21 +1244,7 @@ void TerrainORMMapFeatGLSL::processPix(Vector &componentList, ShaderFeature::Resources TerrainORMMapFeatGLSL::getResources(const MaterialFeatureData &fd) { Resources res; - - S32 featureIndex = 0, firstOrmMapIndex = 0; - for (int idx = 0; idx < fd.features.getCount(); ++idx) { - const FeatureType& type = fd.features.getAt(idx, &featureIndex); - if (type == MFT_TerrainORMMap) { - firstOrmMapIndex = getMin(firstOrmMapIndex, featureIndex); - } - } - - // We only need to process normals during the deferred. - if (getProcessIndex() == firstOrmMapIndex) - { - res.numTexReg = 1; - res.numTex = 1; - } + res.numTex = 1; return res; } @@ -1283,7 +1289,10 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector &component String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); - meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend)); + if (!fd.features.hasFeature(MFT_TerrainHeightBlend)) + { + meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend)); + } output = meta; } From 5d26dba7da4967f7a0845a9b2f61e3cb5c55f81c Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Thu, 7 Oct 2021 00:27:39 -0400 Subject: [PATCH 24/38] * BugFix: Clear some MSVC compiler warnings. --- Engine/source/T3D/convexShape.cpp | 17 -------- Engine/source/T3D/lighting/IBLUtilities.cpp | 2 - Engine/source/T3D/shapeImage.cpp | 1 - Engine/source/console/SimXMLDocument.cpp | 1 - Engine/source/console/astNodes.cpp | 6 +-- Engine/source/console/compiledEval.cpp | 5 +-- Engine/source/environment/cloudLayer.cpp | 1 - Engine/source/environment/meshRoad.cpp | 1 - Engine/source/forest/forestItem.cpp | 2 - Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp | 3 -- .../gui/controls/guiGameListMenuCtrl.cpp | 9 ----- Engine/source/gui/controls/guiPopUpCtrl.cpp | 1 - Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 1 - .../gui/utility/guiRenderTargetVizCtrl.cpp | 2 - .../advanced/advancedLightBinManager.cpp | 2 - .../materials/processedShaderMaterial.cpp | 7 ---- Engine/source/persistence/taml/taml.cpp | 2 +- .../source/platform/async/asyncPacketStream.h | 2 +- Engine/source/platform/platformNet.cpp | 40 +++---------------- .../renderInstance/renderTranslucentMgr.cpp | 1 - Engine/source/terrain/terrCellMaterial.cpp | 2 - Engine/source/terrain/terrData.cpp | 3 -- Engine/source/ts/tsCollision.cpp | 24 +++++------ 23 files changed, 24 insertions(+), 111 deletions(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index e0184f2f4..729548ce7 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -222,7 +222,6 @@ bool ConvexShape::protectedSetSurface( void *object, const char *index, const ch */ String t = data; - S32 len = t.length(); dSscanf( data, "%g %g %g %g %g %g %g %i %g %g %g %g %f", &quat.x, &quat.y, &quat.z, &quat.w, &pos.x, &pos.y, &pos.z, &matID, &offset.x, &offset.y, &scale.x, &scale.y, &rot); @@ -961,17 +960,6 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in VectorF rayDir( end - start ); rayDir.normalizeSafe(); - if ( false ) - { - PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) ); - Point3F sp( 0,0,-1 ); - Point3F ep( 0,0,1 ); - - F32 t = plane.intersect( sp, ep ); - Point3F hitPnt; - hitPnt.interpolate( sp, ep, t ); - } - for ( S32 i = 0; i < planeCount; i++ ) { // Don't hit the back-side of planes. @@ -1376,8 +1364,6 @@ void ConvexShape::_updateGeometry( bool updateCollision ) { U32 count = faceList[i].triangles.size(); - S32 matID = mSurfaceUVs[i].matID; - mSurfaceBuffers[mSurfaceUVs[i].matID].mPrimCount += count; mSurfaceBuffers[mSurfaceUVs[i].matID].mVertCount += count * 3; } @@ -1429,9 +1415,6 @@ void ConvexShape::_updateGeometry( bool updateCollision ) { if (mSurfaceBuffers[i].mVertCount > 0) { - U32 primCount = mSurfaceBuffers[i].mPrimCount; - U32 vertCount = mSurfaceBuffers[i].mVertCount; - mSurfaceBuffers[i].mVertexBuffer.set(GFX, mSurfaceBuffers[i].mVertCount, GFXBufferTypeStatic); VertexType *pVert = mSurfaceBuffers[i].mVertexBuffer.lock(); diff --git a/Engine/source/T3D/lighting/IBLUtilities.cpp b/Engine/source/T3D/lighting/IBLUtilities.cpp index f3b7c477c..5cdf27acb 100644 --- a/Engine/source/T3D/lighting/IBLUtilities.cpp +++ b/Engine/source/T3D/lighting/IBLUtilities.cpp @@ -46,7 +46,6 @@ namespace IBLUtilities } GFXShaderConstBufferRef irrConsts = irrShader->allocConstBuffer(); - GFXShaderConstHandle* irrEnvMapSC = irrShader->getShaderConstHandle("$environmentMap"); GFXShaderConstHandle* irrFaceSC = irrShader->getShaderConstHandle("$face"); GFXStateBlockDesc desc; @@ -132,7 +131,6 @@ namespace IBLUtilities } GFXShaderConstBufferRef prefilterConsts = prefilterShader->allocConstBuffer(); - GFXShaderConstHandle* prefilterEnvMapSC = prefilterShader->getShaderConstHandle("$environmentMap"); GFXShaderConstHandle* prefilterFaceSC = prefilterShader->getShaderConstHandle("$face"); GFXShaderConstHandle* prefilterRoughnessSC = prefilterShader->getShaderConstHandle("$roughness"); GFXShaderConstHandle* prefilterMipSizeSC = prefilterShader->getShaderConstHandle("$mipSize"); diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 7bd42bea5..b8ea08a75 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -407,7 +407,6 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr) { if (!Parent::preload(server, errorStr)) return false; - bool shapeError = false; // Resolve objects transmitted from server if (!server) { diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 9f0bd4ff4..6e0de4c19 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -827,7 +827,6 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) char textbuf[1024]; tinyxml2::XMLElement* field = m_qDocument->NewElement("Field"); - tinyxml2::XMLElement* group = m_qDocument->NewElement("FieldGroup"); pElement->SetAttribute( "Name", pObject->getName() ); diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index aaca1ea06..c34c4b38d 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -74,7 +74,7 @@ void StmtNode::addBreakLine(CodeStream& code) //------------------------------------------------------------ -StmtNode::StmtNode() +StmtNode::StmtNode() : dbgLineNumber(0) { next = NULL; dbgFileName = CodeBlock::smCurrentParser->getCurrentFile(); @@ -84,12 +84,12 @@ void StmtNode::setPackage(StringTableEntry) { } -void StmtNode::append(StmtNode* next) +void StmtNode::append(StmtNode* appended) { StmtNode* walk = this; while (walk->next) walk = walk->next; - walk->next = next; + walk->next = appended; } diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 360c13c90..e9862c7ee 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -717,7 +717,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa TelDebugger->pushStackFrame(); StringTableEntry var, objParent; - U32 failJump; + U32 failJump = 0; StringTableEntry fnName; StringTableEntry fnNamespace, fnPackage; @@ -776,7 +776,6 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa fnNamespace = CodeToSTE(code, ip + 2); fnPackage = CodeToSTE(code, ip + 4); bool hasBody = (code[ip + 6] & 0x01) != 0; - U32 lineNumber = code[ip + 6] >> 1; Namespace::unlinkPackages(); if (fnNamespace == NULL && fnPackage == NULL) @@ -1819,8 +1818,6 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa // it handles this method. It is set to an enum from the table // above indicating whether it handles it on a component it owns // or just on the object. - S32 routingId = 0; - fnName = CodeToSTE(code, ip); fnNamespace = CodeToSTE(code, ip + 2); U32 callType = code[ip + 4]; diff --git a/Engine/source/environment/cloudLayer.cpp b/Engine/source/environment/cloudLayer.cpp index 01e55dc6e..29d2ab502 100644 --- a/Engine/source/environment/cloudLayer.cpp +++ b/Engine/source/environment/cloudLayer.cpp @@ -278,7 +278,6 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream ) stream->read( &mBaseColor ); - F32 oldCoverage = mCoverage; stream->read( &mCoverage ); stream->read( &mExposure ); diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index 01f8017de..84cbb2d0f 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -2896,7 +2896,6 @@ void MeshRoad::_generateVerts() // Make Primitive Buffers U32 p00, p01, p11, p10; - U32 pb00, pb01, pb11, pb10; U32 offset = 0; U16 *pIdx = NULL; U32 curIdx = 0; diff --git a/Engine/source/forest/forestItem.cpp b/Engine/source/forest/forestItem.cpp index 11d514b34..36ac0dfe3 100644 --- a/Engine/source/forest/forestItem.cpp +++ b/Engine/source/forest/forestItem.cpp @@ -190,8 +190,6 @@ void ForestItemData::unpackData(BitStream* stream) stream->read( &localName ); setInternalName( localName ); - char readBuffer[1024]; - UNPACKDATA_SHAPEASSET(Shape); mCollidable = stream->readFlag(); diff --git a/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp b/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp index 562ab7b63..ed10be7bd 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp @@ -528,9 +528,6 @@ void GFXD3D11CubemapArray::init(const U32 cubemapCount, const U32 cubemapFaceSiz void GFXD3D11CubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32 slot) { - U32 cubeMapSz = cubemap->getSize(); - U32 cubeMapSize = cubemap->getMipMapLevels(); - AssertFatal(slot <= mNumCubemaps, "GFXD3D11CubemapArray::updateTexture - trying to update a cubemap texture that is out of bounds!"); AssertFatal(mFormat == cubemap->getFormat(), "GFXD3D11CubemapArray::updateTexture - Destination format doesn't match"); AssertFatal(mSize == cubemap->getSize(), "GFXD3D11CubemapArray::updateTexture - Destination size doesn't match"); diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 72b3d02f2..33efb32d8 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -275,8 +275,6 @@ void GuiGameListMenuCtrl::onRenderSliderOption(Row* row, Point2I currentOffset) Point2I arrowOffset; S32 columnSplit = profile->mColumnSplit * xScale; - S32 iconIndex; - bool isRowSelected = (getSelected() != NO_ROW) && (row == mRows[getSelected()]); bool isRowHighlighted = (getHighlighted() != NO_ROW) ? ((row == mRows[getHighlighted()]) && (row->mEnabled)) : false; /*if (profileHasArrows) @@ -384,8 +382,6 @@ void GuiGameListMenuCtrl::onRenderKeybindOption(Row* row, Point2I currentOffset) S32 rowHeight = profile->getRowHeight(); - S32 optionWidth = xScale - columnSplit; - GFXDrawUtil* drawer = GFX->getDrawUtil(); //drawer->drawBitmap(row->mBitmap, ) @@ -1048,7 +1044,6 @@ RectI GuiGameListMenuCtrl::getRowBounds(S32 rowIndex) { GuiGameListMenuProfile* profile = (GuiGameListMenuProfile*)mProfile; - F32 xScale = (float)getWidth() / profile->getRowWidth(); S32 rowHeight = profile->getRowHeight(); Point2I currentOffset = Point2I::Zero; @@ -1375,9 +1370,6 @@ void GuiGameListMenuCtrl::clickKeybind(Row* row, S32 xPos) S32 rowHeight = profile->getRowHeight(); - S32 optionWidth = xScale - columnSplit; - - GFXDrawUtil* drawer = GFX->getDrawUtil(); //drawer->drawBitmap(row->mBitmap, ) Point2I button; @@ -1388,7 +1380,6 @@ void GuiGameListMenuCtrl::clickKeybind(Row* row, S32 xPos) buttonSize.x = rowHeight / 2; buttonSize.y = rowHeight / 2; - GFXTextureObject* texture = row->mBitmapTex; RectI rect(button, buttonSize); if (rect.pointInRect(Point2I(xPos, rowHeight / 2))) diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index 0cd08dfb8..d66f50e92 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -311,7 +311,6 @@ void GuiPopUpMenuCtrl::initPersistFields(void) bool GuiPopUpMenuCtrl::_setBitmaps(void* obj, const char* index, const char* data) { - bool ret = false; GuiPopUpMenuCtrl* object = static_cast(obj); object->setBitmap(data); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 5cbd1e3bc..b66e0d209 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -365,7 +365,6 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void) bool GuiPopUpMenuCtrlEx::_setBitmaps(void* obj, const char* index, const char* data) { - bool ret = false; GuiPopUpMenuCtrlEx* object = static_cast(obj); object->setBitmap(data); diff --git a/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp b/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp index 91544f5e0..6c1366afb 100644 --- a/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp +++ b/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp @@ -102,8 +102,6 @@ void GuiRenderTargetVizCtrl::onRender(Point2I offset, camObject = dynamic_cast(camObject->getClientObject()); - bool servObj = camObject->isServerObject(); - if (camObject) { GFXTexHandle targ = camObject->getCameraRenderTarget(); diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.cpp b/Engine/source/lighting/advanced/advancedLightBinManager.cpp index 322560799..fd8cd6dc4 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightBinManager.cpp @@ -323,8 +323,6 @@ void AdvancedLightBinManager::_scoreLights(const MatrixF& cameraTrans) { if (dist > smLightFadeStart) { - F32 brightness = light.lightInfo->getBrightness(); - float fadeOutAmt = (dist - smLightFadeStart) / (smLightFadeEnd - smLightFadeStart); fadeOutAmt = 1 - fadeOutAmt; diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index fc453958f..b6d7be05c 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -1290,16 +1290,9 @@ void ProcessedShaderMaterial::setCustomShaderData(VectormCustomHandles.size(); ++h) - { - StringTableEntry handleName = shaderData[i].getHandleName(); - bool tmp = true; - } //roll through and try setting our data! for (U32 h = 0; h < handles->mCustomHandles.size(); ++h) { - StringTableEntry handleName = shaderData[i].getHandleName(); - StringTableEntry rpdHandleName = handles->mCustomHandles[h].handleName; if (handles->mCustomHandles[h].handleName == shaderData[i].getHandleName()) { if (handles->mCustomHandles[h].handle->isValid()) diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index 0454e102a..b05b0d8bc 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -640,7 +640,7 @@ ImplementEnumType(_TamlFormatMode, // Iterate fields. U8 arrayDepth = 0; - TamlCustomNode* currentArrayNode; + TamlCustomNode* currentArrayNode = NULL; for (U32 index = 0; index < fieldCount; ++index) { // Fetch field. diff --git a/Engine/source/platform/async/asyncPacketStream.h b/Engine/source/platform/async/asyncPacketStream.h index 44b4b661f..00f798946 100644 --- a/Engine/source/platform/async/asyncPacketStream.h +++ b/Engine/source/platform/async/asyncPacketStream.h @@ -282,7 +282,7 @@ void AsyncPacketBufferedInputStream< Stream, Packet >::_requestNext() if( resettable ) { IPositionable< U32 >* positionable = dynamic_cast< IPositionable< U32 >* >( &Deref( stream ) ); - U32 pos; + U32 pos = 0; if(positionable) pos = positionable->getPosition(); diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index db7c26604..a97a094c0 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -95,36 +95,6 @@ typedef int SOCKET; #endif -#if defined(TORQUE_USE_WINSOCK) -static const char* strerror_wsa( S32 code ) -{ - switch( code ) - { -#define E( name ) case name: return #name; - E( WSANOTINITIALISED ); - E( WSAENETDOWN ); - E( WSAEADDRINUSE ); - E( WSAEINPROGRESS ); - E( WSAEALREADY ); - E( WSAEADDRNOTAVAIL ); - E( WSAEAFNOSUPPORT ); - E( WSAEFAULT ); - E( WSAEINVAL ); - E( WSAEISCONN ); - E( WSAENETUNREACH ); - E( WSAEHOSTUNREACH ); - E( WSAENOBUFS ); - E( WSAENOTSOCK ); - E( WSAETIMEDOUT ); - E( WSAEWOULDBLOCK ); - E( WSAEACCES ); -#undef E - default: - return "Unknown"; - } -} -#endif - #include "core/util/tVector.h" #include "platform/platformNetAsync.h" #include "console/console.h" @@ -1243,7 +1213,8 @@ void Net::process() } break; case PolledSocket::NameLookupRequired: - U32 newState; + { + U32 newState = Net::NoError; // is the lookup complete? if (!gNetAsync.checkLookup( @@ -1262,7 +1233,7 @@ void Net::process() { // try to connect out_h_addr.port = currentSock->remotePort; - const sockaddr *ai_addr = NULL; + const sockaddr* ai_addr = NULL; int ai_addrlen = 0; sockaddr_in socketAddress; sockaddr_in6 socketAddress6; @@ -1304,7 +1275,7 @@ void Net::process() else { Con::errorf("Error connecting to %s: Invalid Protocol", - currentSock->remoteAddr); + currentSock->remoteAddr); newState = Net::ConnectFailed; removeSock = true; removeSockHandle = currentSock->handleFd; @@ -1319,7 +1290,7 @@ void Net::process() if (err != Net::WouldBlock) { Con::errorf("Error connecting to %s: %u", - currentSock->remoteAddr, err); + currentSock->remoteAddr, err); newState = Net::ConnectFailed; removeSock = true; removeSockHandle = currentSock->handleFd; @@ -1340,6 +1311,7 @@ void Net::process() smConnectionNotify->trigger(currentSock->handleFd, newState); break; + } case PolledSocket::Listening: NetAddress incomingAddy; diff --git a/Engine/source/renderInstance/renderTranslucentMgr.cpp b/Engine/source/renderInstance/renderTranslucentMgr.cpp index 725cd3e7e..8c4b0cc8c 100644 --- a/Engine/source/renderInstance/renderTranslucentMgr.cpp +++ b/Engine/source/renderInstance/renderTranslucentMgr.cpp @@ -144,7 +144,6 @@ void RenderTranslucentMgr::render( SceneRenderState *state ) GFXTextureObject *lastLM = NULL; GFXCubemap *lastCubemap = NULL; GFXTextureObject *lastReflectTex = NULL; - GFXTextureObject *lastMiscTex = NULL; GFXTextureObject *lastAccuTex = NULL; // Find the particle render manager (if we don't have it) diff --git a/Engine/source/terrain/terrCellMaterial.cpp b/Engine/source/terrain/terrCellMaterial.cpp index ff34a65ac..5f6eefd08 100644 --- a/Engine/source/terrain/terrCellMaterial.cpp +++ b/Engine/source/terrain/terrCellMaterial.cpp @@ -615,8 +615,6 @@ bool TerrainCellMaterial::_initShader(bool deferredMat, mOrmTexArrayConst = mShader->getShaderConstHandle("$ormMapSampler"); if (mOrmTexArrayConst->isValid()) { - GFXTextureProfile* profile = &GFXStaticTextureProfile; - const S32 sampler = mOrmTexArrayConst->getSamplerRegister(); desc.samplers[sampler] = GFXSamplerStateDesc::getWrapLinear(); diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index be43d6638..0f07abd9b 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -992,8 +992,6 @@ void TerrainBlock::addMaterial( const String &name, U32 insertAt ) mFile->mMaterials.push_back( mat ); mFile->_initMaterialInstMapping(); - bool isSrv = isServerObject(); - //now we update our asset if (mTerrainAsset) { @@ -1418,7 +1416,6 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) char buffer[256]; stream->readString(buffer); - bool validAsset = setTerrainAsset(StringTable->insert(buffer)); } if (baseTexSizeChanged && isProperlyAdded()) _updateBaseTexture(NONE); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 53fcb60d6..22381436b 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1044,9 +1044,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // We need the default mesh transform. MatrixF localXfm; getNodeWorldTransform( object.nodeIndex, &localXfm ); - Point3F t = localXfm.getPosition(); - t.convolve(scale); - localXfm.setPosition(t); + Point3F nodeWorldPosition = localXfm.getPosition(); + nodeWorldPosition.convolve(scale); + localXfm.setPosition(nodeWorldPosition); // We have some sort of collision shape... so allocate it. if ( !colShape ) @@ -1061,9 +1061,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // Add the offset to the center of the bounds // into the local space transform. MatrixF centerXfm( true ); - Point3F t = mesh->getBounds().getCenter(); - t.convolve(scale); - centerXfm.setPosition(t); + Point3F meshBoundsCenter = mesh->getBounds().getCenter(); + meshBoundsCenter.convolve(scale); + centerXfm.setPosition(meshBoundsCenter); localXfm.mul( centerXfm ); colShape->addBox( halfWidth, localXfm ); @@ -1077,9 +1077,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // Add the offset to the center of the bounds // into the local space transform. MatrixF primXfm( true ); - Point3F t = mesh->getBounds().getCenter(); - t.convolve(scale); - primXfm.setPosition(t); + Point3F meshBoundsCenter = mesh->getBounds().getCenter(); + meshBoundsCenter.convolve(scale); + primXfm.setPosition(meshBoundsCenter); localXfm.mul( primXfm ); colShape->addSphere( radius, localXfm ); @@ -1092,9 +1092,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // We need to center the capsule and align it to the Y axis. MatrixF primXfm( true ); - Point3F t = mesh->getBounds().getCenter(); - t.convolve(scale); - primXfm.setPosition(t); + Point3F meshBoundsCenter = mesh->getBounds().getCenter(); + meshBoundsCenter.convolve(scale); + primXfm.setPosition(meshBoundsCenter); // Use the longest axis as the capsule height. F32 height = -radius * 2.0f; From 22d6b4a1f139c73edde7d466e0d810a2ecc465da Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Thu, 7 Oct 2021 00:32:42 -0400 Subject: [PATCH 25/38] * BugFix: Correct an accidentally removed line from clearing compiler warnings. --- Engine/source/terrain/terrData.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index 0f07abd9b..532e0cc19 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -1416,6 +1416,7 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) char buffer[256]; stream->readString(buffer); + setTerrainAsset(StringTable->insert(buffer)); } if (baseTexSizeChanged && isProperlyAdded()) _updateBaseTexture(NONE); From 74cc60508b5e957f72fda20e3aac5b6d1f1c1332 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Thu, 7 Oct 2021 01:10:00 -0400 Subject: [PATCH 26/38] * BugFix: More cleanup of MSVC compiler warnings. --- Engine/source/T3D/assets/GUIAsset.cpp | 2 -- Engine/source/T3D/assets/ImageAsset.cpp | 17 ----------------- Engine/source/T3D/assets/ScriptAsset.cpp | 10 ---------- Engine/source/T3D/assets/ShapeAsset.cpp | 2 -- Engine/source/T3D/assets/TerrainAsset.cpp | 2 -- Engine/source/T3D/assets/assetImporter.cpp | 9 +-------- Engine/source/windowManager/sdl/sdlWindow.cpp | 2 +- 7 files changed, 2 insertions(+), 42 deletions(-) diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp index f9a2b500c..cacc3f9be 100644 --- a/Engine/source/T3D/assets/GUIAsset.cpp +++ b/Engine/source/T3D/assets/GUIAsset.cpp @@ -65,8 +65,6 @@ ConsoleSetType(TypeGUIAssetPtr) if (argc == 1) { // Yes, so fetch field value. - const char* pFieldValue = argv[0]; - *((const char**)dptr) = StringTable->insert(argv[0]); return; diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 4376614ed..fea2bca3e 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -275,21 +275,6 @@ void ImageAsset::loadImage() mLoadedState = Ok; mIsValidImage = true; return; - - //GFXTexHandle texture = getTexture(&GFXStaticTextureSRGBProfile); - - //mTexture.set(mImagePath, &GFXStaticTextureSRGBProfile, avar("%s() - mImage (line %d)", __FUNCTION__, __LINE__)); - - /*if (texture.isValid()) - { - mIsValidImage = true; - - //mBitmap = texture.getBitmap(); - - return; - }*/ - - mChangeSignal.trigger(); } mLoadedState = BadFileReference; @@ -497,8 +482,6 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl() mInspector->getInspectObject()->getIdString(), mCaption); mBrowseButton->setField("Command", szBuffer); - const char* id = mInspector->getInspectObject()->getIdString(); - setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); // Create "Open in ShapeEditor" button diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp index dad8ab1c6..ee1b696d0 100644 --- a/Engine/source/T3D/assets/ScriptAsset.cpp +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -191,16 +191,6 @@ bool ScriptAsset::execScript() return true; return false; - - if (Torque::FS::IsScriptFile(mScriptPath)) - { - return Con::executeFile(mScriptPath, false, false); - } - else - { - Con::errorf("ScriptAsset:execScript() - Script asset must have a valid file to exec"); - return false; - } } DefineEngineMethod(ScriptAsset, execScript, bool, (), , diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index bde3b4af5..7a8628238 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -603,8 +603,6 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl() mInspector->getInspectObject()->getIdString(), mCaption); mBrowseButton->setField("Command", szBuffer); - const char* id = mInspector->getInspectObject()->getIdString(); - setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); // Create "Open in ShapeEditor" button diff --git a/Engine/source/T3D/assets/TerrainAsset.cpp b/Engine/source/T3D/assets/TerrainAsset.cpp index da0372097..70ce8786b 100644 --- a/Engine/source/T3D/assets/TerrainAsset.cpp +++ b/Engine/source/T3D/assets/TerrainAsset.cpp @@ -468,8 +468,6 @@ GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl() mInspector->getInspectObject()->getIdString(), mCaption); mBrowseButton->setField("Command", szBuffer); - const char* id = mInspector->getInspectObject()->getIdString(); - setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); // Create "Open in ShapeEditor" button diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index c9ed8a211..e9afcc479 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -1821,10 +1821,8 @@ void AssetImporter::processShapeAsset(AssetImportObject* assetItem) } S32 meshCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_meshCount"), nullptr)); - S32 shapeItem = assetItem->shapeInfo->findItemByName("Meshes"); S32 animCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_animCount"), nullptr)); - S32 animItem = assetItem->shapeInfo->findItemByName("Animations"); S32 materialCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_materialCount"), nullptr)); S32 matItem = assetItem->shapeInfo->findItemByName("Materials"); @@ -2005,9 +2003,7 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) if (assetItem->importStatus == AssetImportObject::Skipped || assetItem->importStatus == AssetImportObject::NotProcessed) return; - bool hasCollision = checkAssetForCollision(assetItem); - - if (hasCollision) + if (checkAssetForCollision(assetItem)) { importIssues = true; return; @@ -2018,7 +2014,6 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) AssetQuery aQuery; U32 numAssetsFound = AssetDatabase.findAllAssets(&aQuery); - bool hasCollision = false; for (U32 i = 0; i < numAssetsFound; i++) { StringTableEntry assetId = aQuery.mAssetList[i]; @@ -2032,7 +2027,6 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) if (assetName == StringTable->insert(assetItem->assetName.c_str())) { - hasCollision = true; assetItem->status = "Error"; assetItem->statusType = "DuplicateAsset"; assetItem->statusInfo = "Duplicate asset names found within the target module!\nAsset \"" + assetItem->assetName + "\" of type \"" + assetItem->assetType + "\" has a matching name.\nPlease rename it and try again!"; @@ -2241,7 +2235,6 @@ void AssetImporter::resetImportConfig() activeImportConfig->registerObject(); } - bool foundConfig = false; Settings* editorSettings; //See if we can get our editor settings if (Sim::findObject("EditorSettings", editorSettings)) diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index 2c725a2d1..6b420d080 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -550,7 +550,7 @@ void PlatformWindowSDL::_triggerTextNotify(const SDL_Event& evt) } else // get a wchar string { - const U32 len = strlen(evt.text.text); + const dsize_t len = strlen(evt.text.text); U16 wchar[16] = {}; dMemcpy(wchar, evt.text.text, sizeof(char)*len); From 15b946fb35c86f6e4207cf55e71e55075444153e Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Thu, 7 Oct 2021 09:59:03 -0400 Subject: [PATCH 27/38] * Adjustment: Utilize native compiler intrinsics for endian swapping when available. --- Engine/source/core/util/endian.h | 13 ++++++++++++- Engine/source/platform/types.gcc.h | 7 +++++-- Engine/source/platform/types.visualc.h | 7 +++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Engine/source/core/util/endian.h b/Engine/source/core/util/endian.h index 566f8be54..eaff3c03c 100644 --- a/Engine/source/core/util/endian.h +++ b/Engine/source/core/util/endian.h @@ -48,8 +48,12 @@ Convert the byte ordering on the U16 to and from big/little endian format. inline U16 endianSwap(const U16 in_swap) { +#ifdef TORQUE_U16_ENDIANSWAP_BUILTIN + return TORQUE_U16_ENDIANSWAP_BUILTIN(in_swap); +#else return U16(((in_swap >> 8) & 0x00ff) | ((in_swap << 8) & 0xff00)); +#endif } inline S16 endianSwap(const S16 in_swap) @@ -64,10 +68,14 @@ Convert the byte ordering on the U32 to and from big/little endian format. */ inline U32 endianSwap(const U32 in_swap) { +#ifdef TORQUE_U32_ENDIANSWAP_BUILTIN + return TORQUE_U32_ENDIANSWAP_BUILTIN(in_swap); +#else return U32(((in_swap >> 24) & 0x000000ff) | ((in_swap >> 8) & 0x0000ff00) | ((in_swap << 8) & 0x00ff0000) | ((in_swap << 24) & 0xff000000)); +#endif } inline S32 endianSwap(const S32 in_swap) @@ -77,12 +85,16 @@ inline S32 endianSwap(const S32 in_swap) inline U64 endianSwap(const U64 in_swap) { +#ifdef TORQUE_U64_ENDIANSWAP_BUILTIN + return TORQUE_U64_ENDIANSWAP_BUILTIN(in_swap); +#else U32 *inp = (U32 *) &in_swap; U64 ret; U32 *outp = (U32 *) &ret; outp[0] = endianSwap(inp[1]); outp[1] = endianSwap(inp[0]); return ret; +#endif } inline S64 endianSwap(const S64 in_swap) @@ -138,4 +150,3 @@ TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F32) TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F64) #endif - diff --git a/Engine/source/platform/types.gcc.h b/Engine/source/platform/types.gcc.h index 8255a251d..f6f4cf6df 100644 --- a/Engine/source/platform/types.gcc.h +++ b/Engine/source/platform/types.gcc.h @@ -107,7 +107,7 @@ typedef unsigned long U64; // This could be reconfigured for static builds, though minimal impact //# define TORQUE_SUPPORTS_NASM # endif -#else +#else # error "GCC: Unsupported Operating System" #endif @@ -169,5 +169,8 @@ typedef unsigned long U64; #endif #endif -#endif // INCLUDED_TYPES_GCC_H +#define TORQUE_U16_ENDIANSWAP_BUILTIN __builtin_bswap16 +#define TORQUE_U32_ENDIANSWAP_BUILTIN __builtin_bswap32 +#define TORQUE_U64_ENDIANSWAP_BUILTIN __builtin_bswap64 +#endif // INCLUDED_TYPES_GCC_H diff --git a/Engine/source/platform/types.visualc.h b/Engine/source/platform/types.visualc.h index 4ccc6ce42..1b62da721 100644 --- a/Engine/source/platform/types.visualc.h +++ b/Engine/source/platform/types.visualc.h @@ -69,7 +69,7 @@ typedef unsigned _int64 U64; # define TORQUE_OS_WIN # define TORQUE_OS_WIN64 # include "platform/types.win.h" -#else +#else # error "VC: Unsupported Operating System" #endif @@ -115,5 +115,8 @@ typedef unsigned _int64 U64; #define TORQUE_UNLIKELY #endif -#endif // INCLUDED_TYPES_VISUALC_H +#define TORQUE_U16_ENDIANSWAP_BUILTIN _byteswap_ushort +#define TORQUE_U32_ENDIANSWAP_BUILTIN _byteswap_ulong +#define TORQUE_U64_ENDIANSWAP_BUILTIN _byteswap_uint64 +#endif // INCLUDED_TYPES_VISUALC_H From 2d55fcf1bcf3744244a624b65d95b6b2bead3cb1 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Thu, 7 Oct 2021 13:16:55 -0400 Subject: [PATCH 28/38] * BugFix: Invert the corrections made in ImageAsset and ScriptAsset to be correct. --- Engine/source/T3D/assets/ImageAsset.cpp | 5 +++-- Engine/source/T3D/assets/ScriptAsset.cpp | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index fea2bca3e..eb5f5036d 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -147,7 +147,7 @@ void ImageAsset::consoleInit() Con::addVariable("$Core::NoImageAssetFallback", TypeString, &smNoImageAssetFallback, "The assetId of the texture to display when the requested image asset is missing.\n" "@ingroup GFX\n"); - + smNoImageAssetFallback = StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback")); } @@ -274,6 +274,7 @@ void ImageAsset::loadImage() mLoadedState = Ok; mIsValidImage = true; + mChangeSignal.trigger(); return; } mLoadedState = BadFileReference; @@ -552,7 +553,7 @@ bool GuiInspectorTypeImageAssetPtr::renderTooltip(const Point2I& hoverPos, const if (texture.isNull()) return false; - // Render image at a reasonable screen size while + // Render image at a reasonable screen size while // keeping its aspect ratio... Point2I screensize = getRoot()->getWindowSize(); Point2I offset = hoverPos; diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp index ee1b696d0..199c6402c 100644 --- a/Engine/source/T3D/assets/ScriptAsset.cpp +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -190,6 +190,11 @@ bool ScriptAsset::execScript() if (handle) return true; + if (Torque::FS::IsScriptFile(mScriptPath)) + { + return Con::executeFile(mScriptPath, false, false); + } + Con::errorf("ScriptAsset:execScript() - Script asset must have a valid file to exec"); return false; } From cf9d15a9d48bed4c3174dfaa7156778448d4ea8b Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Fri, 8 Oct 2021 17:23:16 -0400 Subject: [PATCH 29/38] * BugFix: Correct a Windows compilation error in the endian swap code due to a missing include. --- Engine/source/platform/types.visualc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/platform/types.visualc.h b/Engine/source/platform/types.visualc.h index 1b62da721..2be0e51b3 100644 --- a/Engine/source/platform/types.visualc.h +++ b/Engine/source/platform/types.visualc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_TYPES_VISUALC_H #define INCLUDED_TYPES_VISUALC_H +#include // For more information on VisualC++ predefined macros // http://support.microsoft.com/default.aspx?scid=kb;EN-US;q65472 From 23e5e891ed0f4a57ae11e3c4e1ba90953ee4228c Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Fri, 8 Oct 2021 23:45:20 -0500 Subject: [PATCH 30/38] simplify callOnModules --- .../game/core/utility/scripts/module.tscript | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/Templates/BaseGame/game/core/utility/scripts/module.tscript b/Templates/BaseGame/game/core/utility/scripts/module.tscript index a895f99bf..1f6a755d1 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/module.tscript @@ -4,8 +4,7 @@ if (!isObject(ExecFilesList)) new ArrayObject(ExecFilesList); function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6) -{ - %maxvars = 7; // match this to i/o signature +{ //clear per module group file execution chain ExecFilesList.empty(); //Get our modules so we can exec any specific client-side loading/handling @@ -19,22 +18,9 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, if(%module.group !$= %moduleGroup) continue; } - + // match this to i/o signature if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName)) - { - %stryng = %module.scopeSet @ "." @ %functionName @ "("; - for (%a=0;%a<%maxvars;%a++) - { - if (%var[%a] !$= "") - { - %stryng = %stryng @ %var[%a]; - if (%a<%maxvars-1 && %var[%a+1] !$= "") - %stryng = %stryng @ ","; - } - } - %stryng = %stryng @ ");"; - eval(%stryng); - } + %module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6); } %execFilecount = ExecFilesList.count(); From 506621352ceebea54eb3c706bfba252027ebd87a Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 9 Oct 2021 00:07:01 -0500 Subject: [PATCH 31/38] Tweaks the MaterialAsset loading logic to continue to see if the matDefinition already points to an existing object(to avoid needlessly re-executing files over and over), but also validate other cases, and ensures that if we DO have an existing definition, we still process and load it in the asset itself properly. --- Engine/source/T3D/assets/MaterialAsset.cpp | 19 +++++++++++++++++-- Engine/source/T3D/assets/MaterialAsset.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 57008b025..50e75ffa3 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -167,6 +167,12 @@ void MaterialAsset::initializeAsset() mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + if (mMatDefinitionName == StringTable->EmptyString()) + { + mLoadedState = Failed; + return; + } + if (Torque::FS::IsScriptFile(mScriptPath)) { if (!Sim::findObject(mMatDefinitionName)) @@ -180,6 +186,10 @@ void MaterialAsset::initializeAsset() mLoadedState = Failed; } } + else + { + mLoadedState = DefinitionAlreadyExists; + } } loadMaterial(); @@ -189,6 +199,12 @@ void MaterialAsset::onAssetRefresh() { mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + if (mMatDefinitionName == StringTable->EmptyString()) + { + mLoadedState = Failed; + return; + } + if (Torque::FS::IsScriptFile(mScriptPath)) { //Since we're refreshing, we can assume that the file we're executing WILL have an existing definition. @@ -204,7 +220,6 @@ void MaterialAsset::onAssetRefresh() //And now that we've executed, switch back to the prior behavior Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str()); - } loadMaterial(); @@ -232,7 +247,7 @@ void MaterialAsset::loadMaterial() if (mMaterialDefinition) SAFE_DELETE(mMaterialDefinition); - if (mLoadedState == ScriptLoaded && mMatDefinitionName != StringTable->EmptyString()) + if ((mLoadedState == ScriptLoaded || mLoadedState == DefinitionAlreadyExists) && mMatDefinitionName != StringTable->EmptyString()) { Material* matDef; if (!Sim::findObject(mMatDefinitionName, matDef)) diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h index 07ec0227a..75b1f6b96 100644 --- a/Engine/source/T3D/assets/MaterialAsset.h +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -73,6 +73,7 @@ public: enum MaterialAssetErrCode { ScriptLoaded = AssetErrCode::Extended, + DefinitionAlreadyExists, Extended }; From 112dafd8a82bb4485a0dd0a6668e30da9676467f Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 9 Oct 2021 11:31:26 -0500 Subject: [PATCH 32/38] remove basiconly from decals and decal roads. seems we fixed the bit that was causing that to not render --- .../game/core/rendering/scripts/renderManager.tscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript b/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript index 1eefa6cf5..8c024c222 100644 --- a/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript +++ b/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript @@ -59,8 +59,8 @@ function initRenderManager() DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } ); DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } ); - DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; basicOnly = true;} ); - DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; basicOnly = true;} ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81;} ); DiffuseRenderPassManager.addManager( new RenderOcclusionMgr(OccluderBin){ bintype = "Occluder"; renderOrder = 0.9; processAddOrder = 0.9; } ); // Render the sky last From 0429b5afa56b8d1bf76d86ed4a41eb566f6d97c2 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 9 Oct 2021 18:47:12 -0400 Subject: [PATCH 33/38] Added more tests for torquescript --- Engine/source/console/test/ScriptTest.cpp | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Engine/source/console/test/ScriptTest.cpp b/Engine/source/console/test/ScriptTest.cpp index 05775694f..05f0582ff 100644 --- a/Engine/source/console/test/ScriptTest.cpp +++ b/Engine/source/console/test/ScriptTest.cpp @@ -889,6 +889,40 @@ TEST(Script, InnerObjectTests) ASSERT_EQ(nestedFuncCall.getInt(), 123); } +TEST(Script, MiscTesting) +{ + ConsoleValue test1 = RunScript(R"( + function testNotPassedInParameters(%a, %b, %c, %d) + { + if (%d $= "") + return true; + return false; + } + + return testNotPassedInParameters(1, 2); // skip passing in %c and %d + )"); + + ASSERT_EQ(test1.getBool(), true); + + ConsoleValue test2 = RunScript(R"( + function SimObject::concatNameTest(%this) + { + return true; + } + + new SimObject(WeirdTestObject1); + + function testObjectNameConcatination(%i) + { + return (WeirdTestObject @ %i).concatNameTest(); + } + + return testObjectNameConcatination(1); + )"); + + ASSERT_EQ(test2.getBool(), true); +} + TEST(Script, MiscRegressions) { ConsoleValue regression1 = RunScript(R"( From f7cf1c020c771b191415f26aff6dec1d7d75345d Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 9 Oct 2021 18:20:57 -0500 Subject: [PATCH 34/38] inject getworldtotangent and getworldnormal to ensure var order --- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index b41dfc234..bb09113a4 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -2974,6 +2974,8 @@ void ReflectionProbeFeatGLSL::processPix(Vector& componentList // Now the wsPosition and wsView. Var *wsPosition = getInWsPosition(componentList); + Var *worldToTangent = getInWorldToTangent(componentList); + Var *wsNormal = getInWorldNormal(componentList); Var *wsView = getWsView(wsPosition, meta); //Reflection Probe WIP From d53dcb03c2715d11aaab0fdb73d6bebb7e95f650 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 9 Oct 2021 22:13:06 -0400 Subject: [PATCH 35/38] * [AssetBrowser] BugFix: Correct an error where on Linux the select asset path function would not list any directories. --- .../game/tools/assetBrowser/scripts/directoryHandling.tscript | 4 ++-- .../game/tools/assetBrowser/scripts/selectPath.tscript | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript index 3eb822f21..4f13dfb8b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript @@ -216,7 +216,7 @@ function directoryHandler::getFolderTreeItemFromAddress(%this, %address) //break down the address %folderCount = getTokenCount(%address, "/"); - if(startsWith(%address, "Data/") || startsWith(%address, "Tools/") || startsWith(%address, "Core/")) + if(startsWith(%address, "data/") || startsWith(%address, "tools/") || startsWith(%address, "core/")) { %curItem = %this.treeCtrl.findChildItemByName(1, "Modules"); } @@ -242,7 +242,7 @@ function directoryHandler::expandTreeToAddress(%this, %address) %rootId = AssetBrowser-->filterTree.findItemByName("Content"); %this.treeCtrl.expandItem(%rootId); - if(startsWith(%address, "Data/") || startsWith(%address, "Tools/") || startsWith(%address, "Core/")) + if(startsWith(%address, "data/") || startsWith(%address, "tools/") || startsWith(%address, "core/")) { %curItem = %this.treeCtrl.findChildItemByName(1, "Modules"); } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript index 691a546e0..7db32c752 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript @@ -22,7 +22,7 @@ function SelectAssetPath::showDialog(%this, %startingPath, %callback, %promptTex %this.callback = %callback; %dataItem = SelectAssetPath-->folderTree.insertItem(0, "Data"); - %this.dirHandler.loadFolders("Data", %dataItem); + %this.dirHandler.loadFolders("data", %dataItem); %this.dirHandler.expandTreeToAddress(%startingPath); %id = %this.dirHandler.getFolderTreeItemFromAddress(%startingPath); @@ -60,4 +60,4 @@ function SelectAssetPath::newFolder(%this) { AssetBrowser_newFolderNameTxt.text = "NewFolder"; Canvas.pushDialog(AssetBrowser_newFolder); -} \ No newline at end of file +} From a458c97217ae115361c980ca76ee4b85a4c28f90 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sun, 10 Oct 2021 20:08:03 -0400 Subject: [PATCH 36/38] Implement more extensions to get graphics card memory for OpenGL on windows and Linux. (cherry picked from commit da942cdb79a87b76e629b36415c83067e3620a70) --- Engine/source/gfx/gl/gfxGLDevice.cpp | 36 ++++++++++++++++++++++++++-- Engine/source/gfx/gl/tGL/tGL.cpp | 18 +++++++++++--- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index 1c82b4e74..40884bb05 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -51,6 +51,10 @@ #include "shaderGen/shaderGen.h" #include "gfxGLUtils.h" +#if defined(TORQUE_OS_WIN) +#include "gfx/gl/tGL/tWGL.h" +#endif + GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance); GFXDevice *GFXGLDevice::createInstance( U32 adapterIndex ) @@ -1073,8 +1077,36 @@ U32 GFXGLDevice::getTotalVideoMemory_GL_EXT() return mem / 1024; } - // TODO OPENGL, add supprt for INTEL cards. - + +#if defined(TORQUE_OS_WIN) + else if( (gglHasWExtension(AMD_gpu_association)) ) + { + // Just assume 1 AMD gpu. Who uses crossfire anyways now? And, crossfire doesn't double + // vram anyways, so does it really matter? + UINT id; + if (wglGetGPUIDsAMD(1, &id) != 0) + { + S32 memorySize; + if (wglGetGPUInfoAMD(id, WGL_GPU_RAM_AMD, GL_INT, 1, &memorySize) != -1) + { + // memory size is returned in MB + return memorySize; + } + } + } +#endif + +#if defined(TORQUE_OS_LINUX) + else if ( (gglHasXExtension(MESA_query_renderer)) ) + { + // memory size is in mb + S32 memorySize; + glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &memorySize); + return memorySize; + } +#endif + + // No other way, sad. Probably windows Intel. return 0; } diff --git a/Engine/source/gfx/gl/tGL/tGL.cpp b/Engine/source/gfx/gl/tGL/tGL.cpp index b13fec60a..93e1e5a51 100644 --- a/Engine/source/gfx/gl/tGL/tGL.cpp +++ b/Engine/source/gfx/gl/tGL/tGL.cpp @@ -25,8 +25,10 @@ #include "core/strings/stringFunctions.h" #include "console/console.h" -#ifdef TORQUE_OS_WIN - #include "tWGL.h" +#if defined(TORQUE_OS_WIN) +#include "tWGL.h" +#elif defined(TORQUE_OS_LINUX) +#include "tXGL.h" #endif namespace GL @@ -41,7 +43,17 @@ namespace GL void gglPerformExtensionBinds(void *context) { - +#if defined(TORQUE_OS_WIN) + if (!gladLoadWGL((HDC)context)) + { + AssertFatal(false, "Unable to load WGL in GLAD. Make sure your OpenGL drivers are up to date!"); + } +#elif defined(TORQUE_OS_LINUX) + if (!gladLoadGLX()) + { + AssertFatal(false, "Unable to load GLX in GLAD. Make sure your OpenGL drivers are up to date!"); + } +#endif } } From 1385b29f03b7f643e11e5417c1eb9f860c0a0cfe Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sun, 10 Oct 2021 20:53:55 -0400 Subject: [PATCH 37/38] * Adjustment: Initial testing with extensions to load GPU VRAM. --- Engine/lib/glad/include/KHR/khrplatform.h | 2 +- Engine/lib/glad/include/glad/glad_glx.h | 20 ++++++++++++++++-- Engine/lib/glad/src/glx/glad_glx.c | 25 +++++++++++++++-------- Engine/source/gfx/gl/gfxGLDevice.cpp | 6 ++++-- Engine/source/gfx/gl/tGL/tGL.cpp | 3 ++- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Engine/lib/glad/include/KHR/khrplatform.h b/Engine/lib/glad/include/KHR/khrplatform.h index 5b55ea2b9..dd22d9270 100644 --- a/Engine/lib/glad/include/KHR/khrplatform.h +++ b/Engine/lib/glad/include/KHR/khrplatform.h @@ -119,7 +119,7 @@ * This follows the return type of the function and precedes the function * name in the function prototype. */ -#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC) +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) /* Win32 but not WinCE */ # define KHRONOS_APIENTRY __stdcall #else diff --git a/Engine/lib/glad/include/glad/glad_glx.h b/Engine/lib/glad/include/glad/glad_glx.h index 46abf2c5b..696366e44 100644 --- a/Engine/lib/glad/include/glad/glad_glx.h +++ b/Engine/lib/glad/include/glad/glad_glx.h @@ -1,6 +1,6 @@ /* - GLX loader generated by glad 0.1.33 on Sun Aug 18 11:26:39 2019. + GLX loader generated by glad 0.1.34 on Mon Oct 11 00:48:11 2021. Language/Generator: C/C++ Specification: glx @@ -27,6 +27,7 @@ GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, + GLX_EXT_get_drawable_type, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_no_config_context, @@ -48,6 +49,7 @@ GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, + GLX_NV_multigpu_context, GLX_NV_multisample_coverage, GLX_NV_present_video, GLX_NV_robustness_video_memory_purge, @@ -79,7 +81,7 @@ Reproducible: False Commandline: - --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" + --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_get_drawable_type,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multigpu_context,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" Online: Too many extensions */ @@ -139,6 +141,7 @@ typedef void* (* GLADloadproc)(const char *name); #endif GLAPI int gladLoadGLX(Display *dpy, int screen); +GLAPI void gladUnloadGLX(void); GLAPI int gladLoadGLXLoader(GLADloadproc, Display *dpy, int screen); @@ -616,6 +619,11 @@ GLAPI PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress; #define GLX_3DFX_WINDOW_MODE_MESA 0x1 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 #define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#define GLX_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define GLX_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define GLX_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE #define GLX_COVERAGE_SAMPLES_NV 100001 #define GLX_COLOR_SAMPLES_NV 0x20B3 #define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 @@ -804,6 +812,10 @@ GLAPI int GLAD_GLX_EXT_fbconfig_packed_float; #define GLX_EXT_framebuffer_sRGB 1 GLAPI int GLAD_GLX_EXT_framebuffer_sRGB; #endif +#ifndef GLX_EXT_get_drawable_type +#define GLX_EXT_get_drawable_type 1 +GLAPI int GLAD_GLX_EXT_get_drawable_type; +#endif #ifndef GLX_EXT_import_context #define GLX_EXT_import_context 1 GLAPI int GLAD_GLX_EXT_import_context; @@ -957,6 +969,10 @@ GLAPI PFNGLXDELAYBEFORESWAPNVPROC glad_glXDelayBeforeSwapNV; #define GLX_NV_float_buffer 1 GLAPI int GLAD_GLX_NV_float_buffer; #endif +#ifndef GLX_NV_multigpu_context +#define GLX_NV_multigpu_context 1 +GLAPI int GLAD_GLX_NV_multigpu_context; +#endif #ifndef GLX_NV_multisample_coverage #define GLX_NV_multisample_coverage 1 GLAPI int GLAD_GLX_NV_multisample_coverage; diff --git a/Engine/lib/glad/src/glx/glad_glx.c b/Engine/lib/glad/src/glx/glad_glx.c index 0adb32bd6..69eeb3dd8 100644 --- a/Engine/lib/glad/src/glx/glad_glx.c +++ b/Engine/lib/glad/src/glx/glad_glx.c @@ -1,6 +1,6 @@ /* - GLX loader generated by glad 0.1.33 on Sun Aug 18 11:26:39 2019. + GLX loader generated by glad 0.1.34 on Mon Oct 11 00:48:11 2021. Language/Generator: C/C++ Specification: glx @@ -27,6 +27,7 @@ GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, + GLX_EXT_get_drawable_type, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_no_config_context, @@ -48,6 +49,7 @@ GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, + GLX_NV_multigpu_context, GLX_NV_multisample_coverage, GLX_NV_present_video, GLX_NV_robustness_video_memory_purge, @@ -79,7 +81,7 @@ Reproducible: False Commandline: - --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" + --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_get_drawable_type,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multigpu_context,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" Online: Too many extensions */ @@ -119,7 +121,7 @@ static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #endif static -int open_gl(void) { +int open_glx(void) { #ifndef IS_UWP libGL = LoadLibraryW(L"opengl32.dll"); if(libGL != NULL) { @@ -134,7 +136,7 @@ int open_gl(void) { } static -void close_gl(void) { +void close_glx(void) { if(libGL != NULL) { FreeLibrary((HMODULE) libGL); libGL = NULL; @@ -150,7 +152,7 @@ static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #endif static -int open_gl(void) { +int open_glx(void) { #ifdef __APPLE__ static const char *NAMES[] = { "../Frameworks/OpenGL.framework/OpenGL", @@ -181,7 +183,7 @@ int open_gl(void) { } static -void close_gl(void) { +void close_glx(void) { if(libGL != NULL) { dlclose(libGL); libGL = NULL; @@ -213,14 +215,17 @@ void* get_proc(const char *namez) { int gladLoadGLX(Display *dpy, int screen) { int status = 0; - if(open_gl()) { + if(open_glx()) { status = gladLoadGLXLoader((GLADloadproc)get_proc, dpy, screen); - close_gl(); } return status; } +void gladUnloadGLX(void) { + close_glx(); +} + static Display *GLADGLXDisplay = 0; static int GLADGLXscreen = 0; @@ -326,6 +331,7 @@ int GLAD_GLX_EXT_create_context_es2_profile = 0; int GLAD_GLX_EXT_create_context_es_profile = 0; int GLAD_GLX_EXT_fbconfig_packed_float = 0; int GLAD_GLX_EXT_framebuffer_sRGB = 0; +int GLAD_GLX_EXT_get_drawable_type = 0; int GLAD_GLX_EXT_import_context = 0; int GLAD_GLX_EXT_libglvnd = 0; int GLAD_GLX_EXT_no_config_context = 0; @@ -347,6 +353,7 @@ int GLAD_GLX_NV_copy_buffer = 0; int GLAD_GLX_NV_copy_image = 0; int GLAD_GLX_NV_delay_before_swap = 0; int GLAD_GLX_NV_float_buffer = 0; +int GLAD_GLX_NV_multigpu_context = 0; int GLAD_GLX_NV_multisample_coverage = 0; int GLAD_GLX_NV_present_video = 0; int GLAD_GLX_NV_robustness_video_memory_purge = 0; @@ -752,6 +759,7 @@ static int find_extensionsGLX(void) { GLAD_GLX_EXT_create_context_es_profile = has_ext("GLX_EXT_create_context_es_profile"); GLAD_GLX_EXT_fbconfig_packed_float = has_ext("GLX_EXT_fbconfig_packed_float"); GLAD_GLX_EXT_framebuffer_sRGB = has_ext("GLX_EXT_framebuffer_sRGB"); + GLAD_GLX_EXT_get_drawable_type = has_ext("GLX_EXT_get_drawable_type"); GLAD_GLX_EXT_import_context = has_ext("GLX_EXT_import_context"); GLAD_GLX_EXT_libglvnd = has_ext("GLX_EXT_libglvnd"); GLAD_GLX_EXT_no_config_context = has_ext("GLX_EXT_no_config_context"); @@ -773,6 +781,7 @@ static int find_extensionsGLX(void) { GLAD_GLX_NV_copy_image = has_ext("GLX_NV_copy_image"); GLAD_GLX_NV_delay_before_swap = has_ext("GLX_NV_delay_before_swap"); GLAD_GLX_NV_float_buffer = has_ext("GLX_NV_float_buffer"); + GLAD_GLX_NV_multigpu_context = has_ext("GLX_NV_multigpu_context"); GLAD_GLX_NV_multisample_coverage = has_ext("GLX_NV_multisample_coverage"); GLAD_GLX_NV_present_video = has_ext("GLX_NV_present_video"); GLAD_GLX_NV_robustness_video_memory_purge = has_ext("GLX_NV_robustness_video_memory_purge"); diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index 40884bb05..1cba42143 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -53,6 +53,8 @@ #if defined(TORQUE_OS_WIN) #include "gfx/gl/tGL/tWGL.h" +#elif defined(TORQUE_OS_LINUX) +#include "gfx/gl/tGL/tXGL.h" #endif GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance); @@ -1097,10 +1099,10 @@ U32 GFXGLDevice::getTotalVideoMemory_GL_EXT() #endif #if defined(TORQUE_OS_LINUX) - else if ( (gglHasXExtension(MESA_query_renderer)) ) + else if ( (gglHasXExtension(NULL, NULL, MESA_query_renderer)) ) { // memory size is in mb - S32 memorySize; + U32 memorySize; glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &memorySize); return memorySize; } diff --git a/Engine/source/gfx/gl/tGL/tGL.cpp b/Engine/source/gfx/gl/tGL/tGL.cpp index 93e1e5a51..5d9b4718a 100644 --- a/Engine/source/gfx/gl/tGL/tGL.cpp +++ b/Engine/source/gfx/gl/tGL/tGL.cpp @@ -49,7 +49,8 @@ namespace GL AssertFatal(false, "Unable to load WGL in GLAD. Make sure your OpenGL drivers are up to date!"); } #elif defined(TORQUE_OS_LINUX) - if (!gladLoadGLX()) + + if (!gladLoadGLX(NULL, 0)) { AssertFatal(false, "Unable to load GLX in GLAD. Make sure your OpenGL drivers are up to date!"); } From 8b29dae3b9c08c08033af23322cb0f8bfee29b53 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Mon, 11 Oct 2021 20:12:32 -0400 Subject: [PATCH 38/38] * [AssetBrowser] BugFix: Correct the inability to spawn assorted objects. --- .../BaseGame/game/tools/assetBrowser/scripts/creator.tscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript index 48366f453..8971087c5 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript @@ -174,7 +174,7 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc) %method = "build" @ %class; if( !ObjectBuilderGui.isMethod( %method ) ) - %cmd = "return new " @ %class @ "();"; + %cmd = "new " @ %class @ "();"; else %cmd = "ObjectBuilderGui." @ %method @ "();"; @@ -187,4 +187,4 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc) %args.val[2] = %buildfunc; %this.creatorClassArray.push_back( %group, %args ); -} \ No newline at end of file +}