mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-23 05:15:34 +00:00
Working on shader const binding
This commit is contained in:
parent
ccdc93fc25
commit
d674ac5817
11 changed files with 96 additions and 33 deletions
|
|
@ -45,14 +45,22 @@ void CustomFeatureHLSL::processVert(Vector<ShaderComponent*> &componentList,
|
|||
|
||||
output = meta;*/
|
||||
|
||||
meta = new MultiLine;
|
||||
|
||||
mFeatureData = fd;
|
||||
|
||||
if (mOwner->isMethod("processVertHLSL"))
|
||||
Con::executef(mOwner, "processVertHLSL");
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
||||
void CustomFeatureHLSL::processPix(Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
meta = new MultiLine;
|
||||
|
||||
mFeatureData = fd;
|
||||
|
||||
/*MultiLine *meta = new MultiLine;
|
||||
|
||||
|
|
@ -216,7 +224,7 @@ void CustomFeatureHLSL::addUniform(String name, String type, String defaultValue
|
|||
newVarHolder.arraySize = arraySize;
|
||||
newVarHolder.sampler = false;
|
||||
newVarHolder.uniform = true;
|
||||
newVarHolder.constSortPos = cspPrimitive;
|
||||
newVarHolder.constSortPos = cspPotentialPrimitive;
|
||||
|
||||
mVars.push_back(newVarHolder);
|
||||
|
||||
|
|
@ -391,4 +399,16 @@ void CustomFeatureHLSL::writeLine(String format, S32 argc, ConsoleValueRef *argv
|
|||
meta->addStatement(new GenOp(format + "\n", varList[0], varList[1], varList[2], varList[3], varList[4]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CustomFeatureHLSL::hasFeature(String name)
|
||||
{
|
||||
for (U32 i = 0; i < mFeatureData.materialFeatures.getCount(); i++)
|
||||
{
|
||||
String featureName = mFeatureData.materialFeatures.getAt(i).getName();
|
||||
if (name == featureName)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -66,6 +66,8 @@ class CustomFeatureHLSL : public ShaderFeatureHLSL
|
|||
public:
|
||||
CustomShaderFeatureData* mOwner;
|
||||
|
||||
MaterialFeatureData mFeatureData;
|
||||
|
||||
protected:
|
||||
MultiLine *meta;
|
||||
|
||||
|
|
@ -100,6 +102,8 @@ public:
|
|||
return mOwner->getName();
|
||||
}
|
||||
|
||||
bool hasFeature(String name);
|
||||
|
||||
void addUniform(String name, String type, String defaultValue, U32 arraySize = 0);
|
||||
void addVariable(String name, String type, String defaultValue);
|
||||
void addSampler(String name, String type, U32 arraySize = 0);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,11 @@ void CustomShaderFeatureData::addTexture(String name, String type, String sample
|
|||
mFeatureHLSL->addTexture(name, type, samplerState, arraySize);
|
||||
}
|
||||
|
||||
bool CustomShaderFeatureData::hasFeature(String name)
|
||||
{
|
||||
return mFeatureHLSL->hasFeature(name);
|
||||
}
|
||||
|
||||
void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef *argv)
|
||||
{
|
||||
/*mOnObject = onObject;
|
||||
|
|
@ -172,4 +177,9 @@ ConsoleMethod(CustomShaderFeatureData, writeLine, void, 3, 0, "( string format,
|
|||
"@return The result of the method call.")
|
||||
{
|
||||
object->writeLine(argv[2], argc - 3, argv + 3);
|
||||
}
|
||||
|
||||
DefineEngineMethod(CustomShaderFeatureData, hasFeature, bool, (String name), (""), "")
|
||||
{
|
||||
return object->hasFeature(name);
|
||||
}
|
||||
|
|
@ -65,6 +65,8 @@ public:
|
|||
void addSampler(String name, String type, U32 arraySize);
|
||||
void addTexture(String name, String type, String samplerState, U32 arraySize);
|
||||
|
||||
bool hasFeature(String name);
|
||||
|
||||
void writeLine(String format, S32 argc, ConsoleValueRef *argv);
|
||||
|
||||
//shader generation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue