* BatchNode / GeometryBatchFactory now batch animated models correctly. Note that any control(s) are removed during the batching process, and must be re-added after batching for animation to work.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9712 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 12 years ago
parent 4fa00b6d9a
commit 6aefda2e38
  1. 4
      engine/src/core/com/jme3/scene/BatchNode.java
  2. 4
      engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java

@ -414,6 +414,7 @@ public class BatchNode extends Node implements Savable {
int totalVerts = 0;
int totalTris = 0;
int totalLodLevels = 0;
int maxWeights = -1;
Mesh.Mode mode = null;
for (Geometry geom : geometries) {
@ -450,6 +451,8 @@ public class BatchNode extends Node implements Savable {
compsForBuf[vb.getBufferType().ordinal()] = vb.getNumComponents();
formatForBuf[vb.getBufferType().ordinal()] = vb.getFormat();
}
maxWeights = Math.max(maxWeights, geom.getMesh().getMaxNumWeights());
if (mode != null && mode != listMode) {
throw new UnsupportedOperationException("Cannot combine different"
@ -459,6 +462,7 @@ public class BatchNode extends Node implements Savable {
compsForBuf[VertexBuffer.Type.Index.ordinal()] = components;
}
outMesh.setMaxNumWeights(maxWeights);
outMesh.setMode(mode);
if (totalVerts >= 65536) {
// make sure we create an UnsignedInt buffer so

@ -99,6 +99,7 @@ public class GeometryBatchFactory {
int totalVerts = 0;
int totalTris = 0;
int totalLodLevels = 0;
int maxWeights = -1;
Mode mode = null;
for (Geometry geom : geometries) {
@ -133,6 +134,8 @@ public class GeometryBatchFactory {
compsForBuf[vb.getBufferType().ordinal()] = vb.getNumComponents();
formatForBuf[vb.getBufferType().ordinal()] = vb.getFormat();
}
maxWeights = Math.max(maxWeights, geom.getMesh().getMaxNumWeights());
if (mode != null && mode != listMode) {
throw new UnsupportedOperationException("Cannot combine different"
@ -142,6 +145,7 @@ public class GeometryBatchFactory {
compsForBuf[Type.Index.ordinal()] = components;
}
outMesh.setMaxNumWeights(maxWeights);
outMesh.setMode(mode);
if (totalVerts >= 65536) {
// make sure we create an UnsignedInt buffer so

Loading…
Cancel
Save