Make sure to throw exception if trying to use instancing but its not supported

experimental
shadowislord 10 years ago
parent 8d5f3829ca
commit 1d29bc3197
  1. 5
      jme3-core/src/main/java/com/jme3/material/Material.java

@ -45,6 +45,7 @@ import com.jme3.renderer.Caps;
import com.jme3.renderer.GL1Renderer;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.Renderer;
import com.jme3.renderer.RendererException;
import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
@ -717,7 +718,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
if (numInstances == 0) {
return;
}
if (renderer.getCaps().contains(Caps.MeshInstancing)) {
renderer.renderMesh(mesh, lodLevel, numInstances, instGeom.getAllInstanceData());
} else {
throw new RendererException("Mesh instancing is not supported by the video hardware");
}
} else {
renderer.renderMesh(mesh, lodLevel, 1, null);
}

Loading…
Cancel
Save