fixed issue 461

http://code.google.com/p/jmonkeyengine/issues/detail?id=461&can=5&q=label%3AProduct-jME3&sort=priority&colspec=ID%20Type%20Status%20Component%20Priority%20Difficulty%20Product%20Milestone%20Owner%20Summary

BatchNode now use an instanceof Geometry statement to know if the spatial can be batched. It Then check the BatchHint on this spatial.
ParticleEmitter, BitmapTextPage and TerrainPatch extends Geometry and should not be batched so their batchHint has been defaulted to Never.
Image also extend Geomety but it may be useful to batch images.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10040 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent a330f83a2d
commit 8a4b204154
  1. 3
      engine/src/core/com/jme3/effect/ParticleEmitter.java
  2. 2
      engine/src/core/com/jme3/font/BitmapTextPage.java
  3. 2
      engine/src/core/com/jme3/scene/BatchNode.java
  4. 3
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java

@ -194,7 +194,7 @@ public class ParticleEmitter extends Geometry {
public ParticleEmitter(String name, Type type, int numParticles) {
super(name);
setBatchHint(BatchHint.Never);
// ignore world transform, unless user sets inLocalSpace
this.setIgnoreTransform(true);
@ -235,6 +235,7 @@ public class ParticleEmitter extends Geometry {
*/
public ParticleEmitter() {
super();
setBatchHint(BatchHint.Never);
}
public void setShape(EmitterShape shape) {

@ -59,7 +59,7 @@ class BitmapTextPage extends Geometry {
BitmapTextPage(BitmapFont font, boolean arrayBased, int page) {
super("BitmapFont", new Mesh());
setBatchHint(BatchHint.Never);
if (font == null) {
throw new IllegalArgumentException("font cannot be null.");
}

@ -247,7 +247,7 @@ public class BatchNode extends Node implements Savable {
private void gatherGeomerties(Map<Material, List<Geometry>> map, Spatial n, boolean rebatch) {
if (n.getClass() == Geometry.class) {
if (n instanceof Geometry) {
if (!isBatch(n) && n.getBatchHint() != BatchHint.Never) {
Geometry g = (Geometry) n;

@ -113,10 +113,12 @@ public class TerrainPatch extends Geometry {
public TerrainPatch() {
super("TerrainPatch");
setBatchHint(BatchHint.Never);
}
public TerrainPatch(String name) {
super(name);
setBatchHint(BatchHint.Never);
}
public TerrainPatch(String name, int size) {
@ -171,6 +173,7 @@ public class TerrainPatch extends Geometry {
float[] heightMap, Vector3f origin, int totalSize,
Vector2f offset, float offsetAmount) {
super(name);
setBatchHint(BatchHint.Never);
this.size = size;
this.stepScale = stepScale;
this.totalSize = totalSize;

Loading…
Cancel
Save