I am trying to have a model transition from its normal textured color to red. I was going to try doing this by creating a new material and reapplying it to the model every frame. Seems kinda slow to do it that way, but Im not really sure of another way (im a new to this).
Anyways, I was trying it and I keep getting the following error:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: ColorMap
The code that is running when I get this error is:
if(this.currentColor != this.changeToColor)
//must change color to next phase in colors.
Texture ninjaTexture = assetManager.loadTexture(“Models/Ninja/Ninja.jpg”);
//Material newMat = new Material(assetManager, “Models/Ninja/Ninja.material”);
Material newMat = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);
line 66, the problem line
newMat.setColor("Color", new ColorRGBA(1.0f,0.0f,0.0f,0.5f));
this.currentColor = this.changeToColor;
Anybody know whats going wrong? Thanks for any advise. I would also be interested in more run-time friendly ways of doing this, than reloading the texture everytime, I was hoping there was a way to get the material from the model and then just set the color, and then reapply it without having to touch the assetManager.
Here is the code used for initially loading the model:
dogModel = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
dogModel.scale(0.028f, 0.028f, 0.028f);
dogModel.rotate(0.0f, -3.0f, 0.0f);
dogModel.setLocalTranslation(0.0f, -2.5f, -2.0f);
THe ninja is just a stand in for now, to be replaced soon.