mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Initial implementation of Custom Shader Features
This commit is contained in:
parent
13fb5cd5b9
commit
529558f671
31 changed files with 1772 additions and 17 deletions
|
|
@ -483,6 +483,11 @@ void Material::initPersistFields()
|
|||
|
||||
endGroup( "Behavioral" );
|
||||
|
||||
addProtectedField("customShaderFeature", TypeRealString, NULL, &protectedSetCustomShaderFeature, &defaultProtectedGetFn,
|
||||
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors);
|
||||
addProtectedField("CustomShaderFeatureUniforms", TypeRealString, NULL, &protectedSetCustomShaderFeatureUniforms, &defaultProtectedGetFn,
|
||||
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
|
|
@ -500,6 +505,35 @@ bool Material::writeField( StringTableEntry fieldname, const char *value )
|
|||
return Parent::writeField( fieldname, value );
|
||||
}
|
||||
|
||||
bool Material::protectedSetCustomShaderFeature(void *object, const char *index, const char *data)
|
||||
{
|
||||
Material *material = static_cast< Material* >(object);
|
||||
|
||||
CustomShaderFeatureData* customFeature;
|
||||
if (!Sim::findObject(data, customFeature))
|
||||
return false;
|
||||
|
||||
material->mCustomShaderFeatures.push_back(customFeature);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char *index, const char *data)
|
||||
{
|
||||
Material *material = static_cast< Material* >(object);
|
||||
|
||||
if (index != NULL)
|
||||
{
|
||||
char featureName[256] = { 0 };
|
||||
U32 id = 0;
|
||||
dSscanf(index, "%s_%i", featureName, id);
|
||||
|
||||
String uniformName = data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Material::onAdd()
|
||||
{
|
||||
if (Parent::onAdd() == false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue