Initial implementation of Custom Shader Features.

This commit is contained in:
Areloch 2017-10-05 17:04:51 -05:00
parent f9b7f66571
commit dc5e502dec
12 changed files with 595 additions and 9 deletions

View file

@ -483,6 +483,9 @@ void Material::initPersistFields()
endGroup( "Behavioral" );
addProtectedField("customShaderFeature", TypeRealString, NULL, &protectedSetCustomShaderFeature, &defaultProtectedGetFn,
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors);
Parent::initPersistFields();
}
@ -500,6 +503,19 @@ 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::onAdd()
{
if (Parent::onAdd() == false)