Skip to content

Commit 1b2cc6a

Browse files
committed
SkeletonControl now falls back to software skinning when there are more than 255 bones instead of crashing when the shader compiles.
1 parent a59b9e6 commit 1b2cc6a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,20 @@
3535
import com.jme3.material.MatParamOverride;
3636
import com.jme3.math.FastMath;
3737
import com.jme3.math.Matrix4f;
38-
import com.jme3.renderer.RenderManager;
39-
import com.jme3.renderer.RendererException;
40-
import com.jme3.renderer.ViewPort;
38+
import com.jme3.renderer.*;
4139
import com.jme3.scene.*;
4240
import com.jme3.scene.VertexBuffer.Type;
4341
import com.jme3.scene.control.AbstractControl;
4442
import com.jme3.scene.control.Control;
4543
import com.jme3.scene.mesh.IndexBuffer;
4644
import com.jme3.shader.VarType;
47-
import com.jme3.util.*;
45+
import com.jme3.util.SafeArrayList;
46+
import com.jme3.util.TempVars;
4847
import com.jme3.util.clone.Cloner;
4948
import com.jme3.util.clone.JmeCloneable;
49+
5050
import java.io.IOException;
5151
import java.nio.Buffer;
52-
import java.nio.ByteBuffer;
5352
import java.nio.FloatBuffer;
5453
import java.util.logging.Level;
5554
import java.util.logging.Logger;
@@ -145,6 +144,12 @@ private void switchToSoftware() {
145144
}
146145

147146
private boolean testHardwareSupported(RenderManager rm) {
147+
148+
//Only 255 bones max supported with hardware skinning
149+
if (skeleton.getBoneCount() > 255) {
150+
return false;
151+
}
152+
148153
switchToHardware();
149154

150155
try {

0 commit comments

Comments
 (0)