Merge branch 'CustomShaderFeatures' of https://github.com/Areloch/Torque3D into development

This commit is contained in:
Areloch 2019-05-11 21:53:08 -05:00
commit 741fcaed5a
37 changed files with 1365 additions and 38 deletions

View file

@ -504,6 +504,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();
}
@ -521,6 +526,42 @@ 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);
//CustomShaderFeatureData* customFeature;
//if (!Sim::findObject(data, customFeature))
// return false;
//material->mCustomShaderFeatures.push_back(customFeature);
if (index != NULL)
{
char featureName[256] = { 0 };
U32 id = 0;
dSscanf(index, "%s_%i", featureName, id);
String uniformName = data;
bool tmp = true;
}
return false;
}
bool Material::onAdd()
{
if (Parent::onAdd() == false)