mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
Merge pull request #1 from JeffProgrammer/moreshadergenforkermitthefrog
More shadergen fixes for poor kermit
This commit is contained in:
commit
e8d7258d91
3 changed files with 34 additions and 16 deletions
|
|
@ -1982,6 +1982,7 @@ void ReflectCubeFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
Var *envColor = new Var("envColor", "vec3");
|
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(dColor), targ, targ, metalness));
|
||||||
meta->addStatement(new GenOp(" @ = @.rgb*(@).rgb;\r\n", new DecOp(envColor), targ, texCube));
|
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)
|
else if (lerpVal)
|
||||||
meta->addStatement(new GenOp(" @ *= vec4(@.rgb*@.a, @.a);\r\n", targ, texCube, lerpVal, targ));
|
meta->addStatement(new GenOp(" @ *= vec4(@.rgb*@.a, @.a);\r\n", targ, texCube, lerpVal, targ));
|
||||||
|
|
|
||||||
|
|
@ -892,6 +892,14 @@ Var* ShaderFeatureHLSL::getSurface(Vector<ShaderComponent*>& componentList, Mult
|
||||||
}
|
}
|
||||||
|
|
||||||
Var* wsEyePos = (Var*)LangElement::find("eyePosWorld");
|
Var* wsEyePos = (Var*)LangElement::find("eyePosWorld");
|
||||||
|
|
||||||
|
if (!wsEyePos)
|
||||||
|
{
|
||||||
|
wsEyePos = new Var("eyePosWorld", "float3");
|
||||||
|
wsEyePos->uniform = true;
|
||||||
|
wsEyePos->constSortPos = cspPass;
|
||||||
|
}
|
||||||
|
|
||||||
Var* wsPosition = getInWsPosition(componentList);
|
Var* wsPosition = getInWsPosition(componentList);
|
||||||
Var* wsView = getWsView(wsPosition, meta);
|
Var* wsView = getWsView(wsPosition, meta);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,8 @@ void TerrainBaseMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentLis
|
||||||
Var *squareSize = _getUniformVar( "squareSize", "float", cspPass );
|
Var *squareSize = _getUniformVar( "squareSize", "float", cspPass );
|
||||||
meta->addStatement( new GenOp( " @ = normalize( vec3( @, 0, @ ) );\r\n",
|
meta->addStatement( new GenOp( " @ = normalize( vec3( @, 0, @ ) );\r\n",
|
||||||
new DecOp( inTanget ), squareSize, inTangentZ ) );
|
new DecOp( inTanget ), squareSize, inTangentZ ) );
|
||||||
|
|
||||||
|
getOutViewToTangent(componentList, meta, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
|
|
@ -331,6 +333,8 @@ void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
||||||
meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig));
|
||||||
|
|
||||||
output = meta;
|
output = meta;
|
||||||
|
|
||||||
|
Var* viewToTangent = getInViewToTangent(componentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFeatureData &fd )
|
ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFeatureData &fd )
|
||||||
|
|
@ -781,6 +785,22 @@ void TerrainMacroMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentL
|
||||||
meta->addStatement( new GenOp( " @ = calcBlend( @.x, @.xy, @, @ );\r\n",
|
meta->addStatement( new GenOp( " @ = calcBlend( @.x, @.xy, @, @ );\r\n",
|
||||||
new DecOp( detailBlend ), detailInfo, inTex, layerSize, layerSample ) );
|
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" );
|
Var *detailColor = (Var*)LangElement::find( "macroColor" );
|
||||||
if ( !detailColor )
|
if ( !detailColor )
|
||||||
{
|
{
|
||||||
|
|
@ -1224,21 +1244,7 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||||
ShaderFeature::Resources TerrainORMMapFeatGLSL::getResources(const MaterialFeatureData &fd)
|
ShaderFeature::Resources TerrainORMMapFeatGLSL::getResources(const MaterialFeatureData &fd)
|
||||||
{
|
{
|
||||||
Resources res;
|
Resources res;
|
||||||
|
res.numTex = 1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1283,7 +1289,10 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
||||||
|
|
||||||
String matinfoName(String::ToString("matinfoCol%d", compositeIndex));
|
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;
|
output = meta;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue