Hey, I’d like to propose the color() function be moved out of the Text class and into the GameObject class. Why? Because the Text() class extends the GameObject() class already, and the final color of the object is something all game objects should be able to alter, not just Text classes.
The GameObject.color() version would probably loop through all materials of the model instance and set the diffuse color to the specified R, G, B, and Alpha values. The Text.color() function would override this, calling the GameObject’s color() function, but without the alpha value. So basically, it would be super.color(r, g, b, 1). However, if the text object can support transparency (by setting a new BlendingAttribute on the material) then BDX could detect that and add the attribute automatically, though it might be better to allow that on a case-by-case basis.
Why now instead of waiting until later (beta or stable)? Because it doesn’t really make sense to go through and document things that are subject to change in the near future - better to get the API in a stable state, and then document it, than to document the API, change it, and then re-document it. In addition, this isn’t really a new feature - it’s already functionally there, just for only Text objects.
Basically, if we know that per-object coloring is something that could (and I think should) be added, and it’s not difficult to add, maybe it should be added before documentation? Unless maybe I’m missing something. Maybe we could add different color() functions for different portions (colorDiffuse, colorSpecular, colorFinal)? I’m looking at this LibGDX ColorAttribute page, by the way, with the Text class using it like so.
What do you guys think?
EDIT: After doing some testing and reading up on avoiding depth problems with transparent objects (that you can see if you change the alpha value of the diffuse color of a material), it’d probably be best to handle that all later. It doesn’t seem too difficult, though.
In any case, I modded the color() function and moved it from the Text class to the Gameobject class and have it working with no apparent repercussions.