BatchNode and GeometryBatchFactory now uses the material's isEqual method to gather the geometries to batch
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9257 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
55b8188d20
commit
1945a0c1c0
@ -236,6 +236,14 @@ public class BatchNode extends Node implements Savable {
|
|||||||
throw new IllegalStateException("No material is set for Geometry: " + g.getName() + " please set a material before batching");
|
throw new IllegalStateException("No material is set for Geometry: " + g.getName() + " please set a material before batching");
|
||||||
}
|
}
|
||||||
List<Geometry> list = map.get(g.getMaterial());
|
List<Geometry> list = map.get(g.getMaterial());
|
||||||
|
if (list == null) {
|
||||||
|
//trying to compare materials with the isEqual method
|
||||||
|
for (Material mat : map.keySet()) {
|
||||||
|
if (g.getMaterial().isEqual(mat)) {
|
||||||
|
list = map.get(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = new ArrayList<Geometry>();
|
list = new ArrayList<Geometry>();
|
||||||
map.put(g.getMaterial(), list);
|
map.put(g.getMaterial(), list);
|
||||||
|
@ -288,6 +288,14 @@ public class GeometryBatchFactory {
|
|||||||
|
|
||||||
for (Geometry geom : geometries) {
|
for (Geometry geom : geometries) {
|
||||||
List<Geometry> outList = matToGeom.get(geom.getMaterial());
|
List<Geometry> outList = matToGeom.get(geom.getMaterial());
|
||||||
|
if (outList == null) {
|
||||||
|
//trying to compare materials with the isEqual method
|
||||||
|
for (Material mat : matToGeom.keySet()) {
|
||||||
|
if (geom.getMaterial().isEqual(mat)) {
|
||||||
|
outList = matToGeom.get(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (outList == null) {
|
if (outList == null) {
|
||||||
outList = new ArrayList<Geometry>();
|
outList = new ArrayList<Geometry>();
|
||||||
matToGeom.put(geom.getMaterial(), outList);
|
matToGeom.put(geom.getMaterial(), outList);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user