Skip to content

Commit

Permalink
Merge branch 'fix-startpad-ring-and-marble'
Browse files Browse the repository at this point in the history
  • Loading branch information
HumanGamer committed Jan 17, 2023
2 parents 9cadac2 + b64f4d7 commit 9af6145
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 211 deletions.
2 changes: 1 addition & 1 deletion engine/source/gfx/glowBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void GlowBuffer::blur()
{
// PASS 3
//-------------------------------
setupPixelOffsets(pixelOffsets * -1.0f, false);
setupPixelOffsets(pixelOffsets, false);
mTarget->attachTexture( GFXTextureTarget::Color0, mSurface[1] );

GFX->setTexture(0, mSurface[0]);
Expand Down
90 changes: 45 additions & 45 deletions engine/source/shaderGen/bump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,50 @@ Var* BumpFeat::setupLightVec(Vector<ShaderComponent*>& componentList,
lightVec->setStructName("OUT");
lightVec->setType("float3");

if (fd.features[GFXShaderFeatureData::DynamicLight])
{
Var* inpos = (Var*)LangElement::find("position");
Var* lightpos = (Var*)LangElement::find("lightPos");
Var* dlightcoord = (Var*)LangElement::find("dlightCoord");
Var* N = (Var*)LangElement::find("N");

// setup language elements to output incoming tex coords to output
if (inpos && lightpos)
{
meta->addStatement(new GenOp(" @.xyz = normalize(@.xyz - @.xyz);\r\n", lightVec, lightpos, inpos));
if (dlightcoord && N && (GFX->getPixelShaderVersion() >= 2.0))
meta->addStatement(new GenOp(" @.w = saturate(dot(@, @) * 4.0);\r\n", dlightcoord, lightVec, N));
}

if (fd.features[GFXShaderFeatureData::DynamicLightDual])
{
Var* lightVecSec = connectComp->getElement(RT_TEXCOORD);
lightVecSec->setName("outLightVecSec");
lightVecSec->setStructName("OUT");
lightVecSec->setType("float3");

lightpos = (Var*)LangElement::find("lightPosSec");
dlightcoord = (Var*)LangElement::find("dlightCoordSec");

// setup language elements to output incoming tex coords to output
if (inpos && lightpos)
{
meta->addStatement(new GenOp(" @.xyz = normalize(@.xyz - @.xyz);\r\n", lightVecSec, lightpos, inpos));
if (dlightcoord && N && (GFX->getPixelShaderVersion() >= 2.0))
meta->addStatement(new GenOp(" @.w = saturate(dot(@, @) * 4.0);\r\n", dlightcoord, lightVecSec, N));
}
}
}
else if (fd.features[GFXShaderFeatureData::SelfIllumination])
{
Var* N = (Var*)LangElement::find("N");
if (N)
{
meta->addStatement(new GenOp(" @.xyz = @;\r\n", lightVec, N));
}
}
else
{
//if (fd.features[GFXShaderFeatureData::DynamicLight])
//{
// Var* inpos = (Var*)LangElement::find("position");
// Var* lightpos = (Var*)LangElement::find("lightPos");
// Var* dlightcoord = (Var*)LangElement::find("dlightCoord");
// Var* N = (Var*)LangElement::find("N");

// // setup language elements to output incoming tex coords to output
// if (inpos && lightpos)
// {
// meta->addStatement(new GenOp(" @.xyz = normalize(@.xyz - @.xyz);\r\n", lightVec, lightpos, inpos));
// if (dlightcoord && N && (GFX->getPixelShaderVersion() >= 2.0))
// meta->addStatement(new GenOp(" @.w = saturate(dot(@, @) * 4.0);\r\n", dlightcoord, lightVec, N));
// }

// if (fd.features[GFXShaderFeatureData::DynamicLightDual])
// {
// Var* lightVecSec = connectComp->getElement(RT_TEXCOORD);
// lightVecSec->setName("outLightVecSec");
// lightVecSec->setStructName("OUT");
// lightVecSec->setType("float3");

// lightpos = (Var*)LangElement::find("lightPosSec");
// dlightcoord = (Var*)LangElement::find("dlightCoordSec");

// // setup language elements to output incoming tex coords to output
// if (inpos && lightpos)
// {
// meta->addStatement(new GenOp(" @.xyz = normalize(@.xyz - @.xyz);\r\n", lightVecSec, lightpos, inpos));
// if (dlightcoord && N && (GFX->getPixelShaderVersion() >= 2.0))
// meta->addStatement(new GenOp(" @.w = saturate(dot(@, @) * 4.0);\r\n", dlightcoord, lightVecSec, N));
// }
// }
//}
//else if (fd.features[GFXShaderFeatureData::SelfIllumination])
//{
// Var* N = (Var*)LangElement::find("N");
// if (N)
// {
// meta->addStatement(new GenOp(" @.xyz = @;\r\n", lightVec, N));
// }
//}
//else
//{
if (fd.useLightDir)
{
// grab light direction var
Expand All @@ -94,7 +94,7 @@ Var* BumpFeat::setupLightVec(Vector<ShaderComponent*>& componentList,
LangElement* assign = new GenOp(" @.xyz = normalize(@ - @.xyz);\r\n", lightVec, lightPos, position);
meta->addStatement(assign);
}
}
//}

return lightVec;
}
Expand Down
20 changes: 10 additions & 10 deletions engine/source/shaderGen/pixSpecular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ void PixelSpecular::processVert(Vector<ShaderComponent*>& componentList,
Var* inLightVec = (Var*)LangElement::find("inLightVec");
Var* outLightVec = (Var*)LangElement::find("outLightVec");

if (fd.features[GFXShaderFeatureData::SelfIllumination])
{
inLightVec = (Var*)LangElement::find("N");
useneg = false;
}
else
{
//if (fd.features[GFXShaderFeatureData::SelfIllumination])
//{
// inLightVec = (Var*)LangElement::find("N");
// useneg = false;
//}
//else
//{
if (!inLightVec)
{
// grab light direction var
Expand All @@ -133,7 +133,7 @@ void PixelSpecular::processVert(Vector<ShaderComponent*>& componentList,
inLightVec->uniform = true;
inLightVec->constNum = VC_LIGHT_DIR1;
}
}
//}

if (!outLightVec)
{
Expand All @@ -158,9 +158,9 @@ void PixelSpecular::processVert(Vector<ShaderComponent*>& componentList,
Var* inNorm = (Var*)LangElement::find("normal");

if (useneg)
meta->addStatement(new GenOp(" @.w = step( 0.0, dot( -@, @ ) );", outLightVec, inLightVec, inNorm));
meta->addStatement(new GenOp(" @.w = step( -0.5, dot( -@, @ ) );", outLightVec, inLightVec, inNorm));
else
meta->addStatement(new GenOp(" @.w = step( 0.0, dot( @, @ ) );", outLightVec, inLightVec, inNorm));
meta->addStatement(new GenOp(" @.w = step( -0.5, dot( @, @ ) );", outLightVec, inLightVec, inNorm));

}

Expand Down
Loading

0 comments on commit 9af6145

Please sign in to comment.