Fix jme constanly trying to upload image data every frame with mips

There is a little bug that causes caues jME to reupload image data on opengl every frame if we are using mipmaps slightly wrong.

Here is example of code that creates a bug:
// Load some texture
Texture tex = someAssetManager.loadTexture(“sometexture.png”);
// Ensure that mip mapping is disabled
// Generate mipmaps
MipMapGenerator.generateMipMaps(tex.getImage()); // You can find MipMapGenerator on jme3-desktop at jme3tools/converters
// MipMap generator will call images method Image.setMipMapSizes()
// Then we are enabling using of mipmaps
// Last call sets Image.needGeneratedMips to true, but Image.mipsWereGenerated is still false cause we are uploading mips, not generating them by OpenGL
Next, in lwjgl renderer at com.jme3.renderer.LwjglRenderer.setTexture:1946
public void setTexture(int unit, Texture tex) {
Image image = tex.getImage();
if (image.isUpdateNeeded() || (image.isGeneratedMipmapsRequired() && !image.isMipmapsGenerated())) {
updateTexImageData(image, tex.getType(), unit);
image.isGeneratedMipmapsRequired() is true. But we already have mipmaps in image, it causes that updateTexImageData() is using them, not using generated mipmaps therefore not setting mipsWereGenerated to true. So every time we are using texture, updateTexImageData() is called, reuploading image data to opengl every time. It causes enormous fps lowering.

Fix is not setting Image.needGeneratedMips to true when we already have mipmaps in image.


I’ve merged this PR thanks