mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Merge pull request #963 from Azaezel/alpha41/terrainNormSafety
terrain safeties
This commit is contained in:
commit
c1d417806a
2 changed files with 4 additions and 4 deletions
|
|
@ -250,7 +250,7 @@ void TerrainBaseMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentLis
|
||||||
{
|
{
|
||||||
Var* inNormal = (Var*)LangElement::find("normal");
|
Var* inNormal = (Var*)LangElement::find("normal");
|
||||||
meta->addStatement(
|
meta->addStatement(
|
||||||
new GenOp(" @.z = dot( normalize( vec3( @.x, @.y, 0 ) ), vec3( 0, 1, 0 ) );\r\n",
|
new GenOp(" @.z = abs(dot( normalize( vec3( @.x, @.y, 0.0001 ) ), vec3( 0, 1, 0 ) ));\r\n",
|
||||||
outTex, inNormal, inNormal));
|
outTex, inNormal, inNormal));
|
||||||
meta->addStatement(
|
meta->addStatement(
|
||||||
new GenOp(" @.w = 1.0 - dot( normalize( @.xyz ), vec3( 0, 0, 1 ) );\r\n",
|
new GenOp(" @.w = 1.0 - dot( normalize( @.xyz ), vec3( 0, 0, 1 ) );\r\n",
|
||||||
|
|
@ -1300,7 +1300,7 @@ void TerrainHeightMapBlendGLSL::processPix(Vector<ShaderComponent*>& componentLi
|
||||||
{
|
{
|
||||||
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", idx));
|
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", idx));
|
||||||
Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx));
|
Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx));
|
||||||
meta->addStatement(new GenOp(" @ = (@-@.x)/(@.y-@.x);\r\n", detailH, detailH, heightRange, heightRange, heightRange));
|
meta->addStatement(new GenOp(" @ = (@-@.x)/(@.y-@.x)-@.x;\r\n", detailH, detailH, heightRange, heightRange, heightRange));
|
||||||
|
|
||||||
}
|
}
|
||||||
meta->addStatement(new GenOp("\r\n"));
|
meta->addStatement(new GenOp("\r\n"));
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ void TerrainBaseMapFeatHLSL::processVert(Vector<ShaderComponent*>& componentList
|
||||||
{
|
{
|
||||||
Var* inNormal = (Var*)LangElement::find("normal");
|
Var* inNormal = (Var*)LangElement::find("normal");
|
||||||
meta->addStatement(
|
meta->addStatement(
|
||||||
new GenOp(" @.z = dot( normalize( float3( @.x, @.y, 0 ) ), float3( 0, 1, 0 ) );\r\n",
|
new GenOp(" @.z = abs(dot( normalize( float3( @.x, @.y, 0.0001 ) ), float3( 0, 1, 0 ) ));\r\n",
|
||||||
outTex, inNormal, inNormal));
|
outTex, inNormal, inNormal));
|
||||||
meta->addStatement(
|
meta->addStatement(
|
||||||
new GenOp(" @.w = 1.0 - dot( normalize( @.xyz ), float3( 0, 0, 1 ) );\r\n",
|
new GenOp(" @.w = 1.0 - dot( normalize( @.xyz ), float3( 0, 0, 1 ) );\r\n",
|
||||||
|
|
@ -1381,7 +1381,7 @@ void TerrainHeightMapBlendHLSL::processPix(Vector<ShaderComponent*>& componentLi
|
||||||
{
|
{
|
||||||
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", idx));
|
Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", idx));
|
||||||
Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx));
|
Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx));
|
||||||
meta->addStatement(new GenOp(" @ = (@-@.x)/(@.y-@.x);\r\n", detailH, detailH, heightRange, heightRange, heightRange));
|
meta->addStatement(new GenOp(" @ = (@-@.x)/(@.y-@.x)-@.x;\r\n", detailH, detailH, heightRange, heightRange, heightRange, heightRange));
|
||||||
}
|
}
|
||||||
meta->addStatement(new GenOp("\r\n"));
|
meta->addStatement(new GenOp("\r\n"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue