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

experimental
shadowislord 10 years ago
parent 8d5f3829ca
commit 1d29bc3197
  1. 7
      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.GL1Renderer;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.Renderer; import com.jme3.renderer.Renderer;
import com.jme3.renderer.RendererException;
import com.jme3.renderer.queue.RenderQueue.Bucket; import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Geometry; import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh; import com.jme3.scene.Mesh;
@ -717,7 +718,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
if (numInstances == 0) { if (numInstances == 0) {
return; return;
} }
renderer.renderMesh(mesh, lodLevel, numInstances, instGeom.getAllInstanceData()); 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 { } else {
renderer.renderMesh(mesh, lodLevel, 1, null); renderer.renderMesh(mesh, lodLevel, 1, null);
} }

Loading…
Cancel
Save