SkeletonControl now falls back to software skinning when there are more than 255 bones instead of crashing when the shader compiles.

empirephoenix-patch-1
Nehon 7 years ago
parent a59b9e6a94
commit 1b2cc6a63b
  1. 15
      jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java

@ -35,21 +35,20 @@ import com.jme3.export.*;
import com.jme3.material.MatParamOverride;
import com.jme3.math.FastMath;
import com.jme3.math.Matrix4f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.RendererException;
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.*;
import com.jme3.scene.*;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.control.AbstractControl;
import com.jme3.scene.control.Control;
import com.jme3.scene.mesh.IndexBuffer;
import com.jme3.shader.VarType;
import com.jme3.util.*;
import com.jme3.util.SafeArrayList;
import com.jme3.util.TempVars;
import com.jme3.util.clone.Cloner;
import com.jme3.util.clone.JmeCloneable;
import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -145,6 +144,12 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
}
private boolean testHardwareSupported(RenderManager rm) {
//Only 255 bones max supported with hardware skinning
if (skeleton.getBoneCount() > 255) {
return false;
}
switchToHardware();
try {

Loading…
Cancel
Save