From 1b2cc6a63b5a14e51cffbabafa576c7f8d927a60 Mon Sep 17 00:00:00 2001 From: Nehon Date: Sun, 10 Dec 2017 19:56:32 +0100 Subject: [PATCH] SkeletonControl now falls back to software skinning when there are more than 255 bones instead of crashing when the shader compiles. --- .../java/com/jme3/animation/SkeletonControl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java b/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java index 4cefd721c..8e31f4d9d 100644 --- a/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java +++ b/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 {