I've got the basic gist of it working.
This setup: MeshNode and MaterialResource both receive a std::vector< Uniform > _variables.
When a material is assigned to a mesh node, its existing variables are cleared and then duplicated from the assigned material. When a mesh node is loaded, it will also assign the variables, assuming the texture resource has already been loaded, otherwise there's problems and setNodeParami() has to be used to assign the material currently. I'm still working on a fix for that. Right now I'm looking at checking mesh nodes before drawing them, and if their _variables.size() doesn't match with the material's _variables.size() to perform the setup operation. Then it needs some testing with multiple models all with different mesh settings.
XML syntax: <Variable name="" a="" b="" c="" d="" />
API Addition: setMeshVariable(NodeHandle meshNode, const char *variable, float a, float b, float c, float d)
The attached picture shows the knight model, all meshes use the same material but during initialization their variables have been set differently. No change in performance. HDR isn't on, and the particles are using alpha test.
Attachment:
quicktrial.jpg [ 80.75 KiB | Viewed 9141 times ]