mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 22:10:36 +00:00
Merge remote-tracking branch 'main/Preview4_0' into bugfix-msvc-compiler-warnings
This commit is contained in:
commit
aba091a97a
22 changed files with 315 additions and 275 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public:
|
|||
enum MaterialAssetErrCode
|
||||
{
|
||||
ScriptLoaded = AssetErrCode::Extended,
|
||||
DefinitionAlreadyExists,
|
||||
Extended
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -562,6 +562,7 @@ void GFXGLShader::initConstantDescs()
|
|||
|
||||
if(!maxNameLength)
|
||||
return;
|
||||
maxNameLength++;
|
||||
|
||||
FrameTemp<GLchar> uniformName(maxNameLength);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#ifndef INCLUDED_TYPES_VISUALC_H
|
||||
#define INCLUDED_TYPES_VISUALC_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// For more information on VisualC++ predefined macros
|
||||
// http://support.microsoft.com/default.aspx?scid=kb;EN-US;q65472
|
||||
|
|
@ -69,7 +70,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 +116,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
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ GFXTextureObject* PostEffectManager::getBackBufferTex()
|
|||
|
||||
mBackBufferCopyTex.set( targetSize.x, targetSize.y,
|
||||
targetFormat,
|
||||
&PostFxTargetProfile, "mBackBufferCopyTex" );
|
||||
&PostFxTextureSRGBProfile, "mBackBufferCopyTex" );
|
||||
|
||||
target->resolveTo( mBackBufferCopyTex );
|
||||
mLastBackBufferTarget = target;
|
||||
|
|
|
|||
|
|
@ -474,25 +474,11 @@ Var* ShaderFeatureGLSL::getInVpos( MultiLine *meta,
|
|||
return inVpos;
|
||||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector*>( 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<ShaderComponent*> &componentList )
|
||||
|
|
@ -779,6 +765,21 @@ Var* ShaderFeatureGLSL::getWsView( Var *wsPosition, MultiLine *meta )
|
|||
return wsView;
|
||||
}
|
||||
|
||||
Var* ShaderFeatureGLSL::getInWorldNormal(Vector<ShaderComponent*>& componentList)
|
||||
{
|
||||
Var* wsNormal = (Var*)LangElement::find("wsNormal");
|
||||
if (!wsNormal)
|
||||
{
|
||||
ShaderConnector* connectComp = dynamic_cast<ShaderConnector*>(componentList[C_CONNECTOR]);
|
||||
wsNormal = connectComp->getElement(RT_TEXCOORD);
|
||||
wsNormal->setName("wsNormal");
|
||||
wsNormal->setStructName("IN");
|
||||
wsNormal->setType("float3");
|
||||
}
|
||||
|
||||
return wsNormal;
|
||||
}
|
||||
|
||||
Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &componentList,
|
||||
MultiLine *meta,
|
||||
bool useTexAnim,
|
||||
|
|
@ -865,21 +866,23 @@ Var* ShaderFeatureGLSL::getSurface(Vector<ShaderComponent*>& 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");
|
||||
|
|
@ -1979,6 +1982,7 @@ void ReflectCubeFeatGLSL::processPix( Vector<ShaderComponent*> &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));
|
||||
|
|
@ -2067,7 +2071,6 @@ RTLightingFeatGLSL::RTLightingFeatGLSL()
|
|||
void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
if (fd.features[MFT_ImposterVert]) return;
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
|
@ -2104,12 +2107,15 @@ void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &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] ||
|
||||
|
|
@ -2118,8 +2124,7 @@ void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &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" );
|
||||
|
|
@ -2131,13 +2136,8 @@ void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// Transform the normal to world space.
|
||||
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<ShaderComponent*> &componentList,
|
||||
|
|
@ -2158,14 +2158,10 @@ void RTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &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" );
|
||||
|
|
@ -2473,7 +2469,7 @@ void VisibilityFeatGLSL::processPix( Vector<ShaderComponent*> &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 +2612,7 @@ void FoliageFeatureGLSL::processVert( Vector<ShaderComponent*> &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<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
|
@ -2978,6 +2974,8 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& 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
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ public:
|
|||
MultiLine *meta );
|
||||
|
||||
Var* getSurface(Vector<ShaderComponent*>& componentList, MultiLine* meta, const MaterialFeatureData& fd);
|
||||
Var* getInWorldNormal(Vector<ShaderComponent*>& componentList);
|
||||
|
||||
// ShaderFeature
|
||||
Var* getVertTexCoord( const String &name );
|
||||
|
|
|
|||
|
|
@ -879,12 +879,10 @@ Var* ShaderFeatureHLSL::getSurface(Vector<ShaderComponent*>& 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
|
||||
|
|
@ -894,6 +892,14 @@ Var* ShaderFeatureHLSL::getSurface(Vector<ShaderComponent*>& 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);
|
||||
|
||||
|
|
@ -2138,8 +2144,6 @@ RTLightingFeatHLSL::RTLightingFeatHLSL()
|
|||
void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
{
|
||||
if (fd.features[MFT_ImposterVert]) return;
|
||||
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
|
@ -2178,11 +2182,14 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &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] ||
|
||||
|
|
@ -2191,7 +2198,6 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &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 );
|
||||
|
|
@ -2205,11 +2211,6 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &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<ShaderComponent*> &componentList,
|
||||
|
|
@ -2229,10 +2230,9 @@ void RTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &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
|
||||
|
|
@ -2686,7 +2686,7 @@ void FoliageFeatureHLSL::processVert( Vector<ShaderComponent*> &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<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
|
|
|||
|
|
@ -281,6 +281,8 @@ void TerrainBaseMapFeatGLSL::processVert( Vector<ShaderComponent*> &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<ShaderComponent*> &componentList,
|
||||
|
|
@ -304,34 +306,35 @@ void TerrainBaseMapFeatGLSL::processPix( Vector<ShaderComponent*> &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));
|
||||
|
||||
output = meta;
|
||||
|
||||
Var* viewToTangent = getInViewToTangent(componentList);
|
||||
}
|
||||
|
||||
ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFeatureData &fd )
|
||||
|
|
@ -347,7 +350,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()
|
||||
|
|
@ -782,6 +785,22 @@ void TerrainMacroMapFeatGLSL::processPix( Vector<ShaderComponent*> &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 )
|
||||
{
|
||||
|
|
@ -1167,24 +1186,36 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &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 +1223,6 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &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))
|
||||
|
|
@ -1218,58 +1244,44 @@ void TerrainORMMapFeatGLSL::processPix(Vector<ShaderComponent*> &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;
|
||||
}
|
||||
|
||||
|
||||
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<ShaderComponent*> &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 +1289,10 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector<ShaderComponent*> &component
|
|||
|
||||
String matinfoName(String::ToString("matinfoCol%d", compositeIndex));
|
||||
|
||||
meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", material, detailBlend, detailBlend));
|
||||
if (!fd.features.hasFeature(MFT_TerrainHeightBlend))
|
||||
{
|
||||
meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend));
|
||||
}
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@ public:
|
|||
virtual void processPix(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd);
|
||||
|
||||
virtual U32 getOutputTargets(const MaterialFeatureData &fd) const;
|
||||
virtual String getName() { return "Blank Matinfo map"; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -337,27 +337,27 @@ void TerrainBaseMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentLis
|
|||
new DecOp( inTanget ), squareSize, inTangentZ ) );
|
||||
}
|
||||
|
||||
void TerrainBaseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd )
|
||||
void TerrainBaseMapFeatHLSL::processPix(Vector<ShaderComponent*>& 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<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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;
|
||||
|
|
|
|||
|
|
@ -179,8 +179,6 @@ public:
|
|||
|
||||
virtual void processPix(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd);
|
||||
|
||||
virtual U32 getOutputTargets(const MaterialFeatureData &fd) const;
|
||||
virtual String getName() { return "Blank Matinfo map"; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue