|
|
@ -62,9 +62,10 @@ import com.jme3.util.clone.JmeCloneable; |
|
|
|
* Sub geoms can be removed but it may be slower than the normal spatial removing |
|
|
|
* Sub geoms can be removed but it may be slower than the normal spatial removing |
|
|
|
* Sub geoms can be added after the batch() method has been called but won't be batched and will just be rendered as normal geometries. |
|
|
|
* Sub geoms can be added after the batch() method has been called but won't be batched and will just be rendered as normal geometries. |
|
|
|
* To integrate them in the batch you have to call the batch() method again on the batchNode. |
|
|
|
* To integrate them in the batch you have to call the batch() method again on the batchNode. |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* TODO normal or tangents or both looks a bit weird |
|
|
|
* TODO normal or tangents or both looks a bit weird |
|
|
|
* TODO more automagic (batch when needed in the updateLogicalState) |
|
|
|
* TODO more automagic (batch when needed in the updateLogicalState) |
|
|
|
|
|
|
|
* |
|
|
|
* @author Nehon |
|
|
|
* @author Nehon |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class BatchNode extends GeometryGroupNode { |
|
|
|
public class BatchNode extends GeometryGroupNode { |
|
|
@ -257,6 +258,7 @@ public class BatchNode extends GeometryGroupNode { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* recursively visit the subgraph and unbatch geometries |
|
|
|
* recursively visit the subgraph and unbatch geometries |
|
|
|
|
|
|
|
* |
|
|
|
* @param s |
|
|
|
* @param s |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void unbatchSubGraph(Spatial s) { |
|
|
|
private void unbatchSubGraph(Spatial s) { |
|
|
@ -343,11 +345,10 @@ public class BatchNode extends GeometryGroupNode { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns the material that is used for the first batch of this BatchNode |
|
|
|
* Returns the material that is used for the first batch of this BatchNode |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* use getMaterial(Material material,int batchIndex) to get a material from a specific batch |
|
|
|
* use getMaterial(Material material,int batchIndex) to get a material from a specific batch |
|
|
|
* |
|
|
|
* |
|
|
|
* @return the material that is used for the first batch of this BatchNode |
|
|
|
* @return the material that is used for the first batch of this BatchNode |
|
|
|
* |
|
|
|
|
|
|
|
* @see #setMaterial(com.jme3.material.Material) |
|
|
|
* @see #setMaterial(com.jme3.material.Material) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Material getMaterial() { |
|
|
|
public Material getMaterial() { |
|
|
@ -428,14 +429,6 @@ public class BatchNode extends GeometryGroupNode { |
|
|
|
+ " primitive types: " + mode + " != " + listMode); |
|
|
|
+ " primitive types: " + mode + " != " + listMode); |
|
|
|
} |
|
|
|
} |
|
|
|
mode = listMode; |
|
|
|
mode = listMode; |
|
|
|
//Not needed anymore as lineWidth is now in RenderState and will be taken into account when merging according to the material
|
|
|
|
|
|
|
|
// if (mode == Mesh.Mode.Lines) {
|
|
|
|
|
|
|
|
// if (lineWidth != 1f && listLineWidth != lineWidth) {
|
|
|
|
|
|
|
|
// throw new UnsupportedOperationException("When using Mesh Line mode, cannot combine meshes with different line width "
|
|
|
|
|
|
|
|
// + lineWidth + " != " + listLineWidth);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// lineWidth = listLineWidth;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
compsForBuf[VertexBuffer.Type.Index.ordinal()] = components; |
|
|
|
compsForBuf[VertexBuffer.Type.Index.ordinal()] = components; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -667,6 +660,7 @@ public class BatchNode extends GeometryGroupNode { |
|
|
|
protected class Batch implements JmeCloneable { |
|
|
|
protected class Batch implements JmeCloneable { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* update the batchesByGeom map for this batch with the given List of geometries |
|
|
|
* update the batchesByGeom map for this batch with the given List of geometries |
|
|
|
|
|
|
|
* |
|
|
|
* @param list |
|
|
|
* @param list |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void updateGeomList(List<Geometry> list) { |
|
|
|
void updateGeomList(List<Geometry> list) { |
|
|
@ -676,6 +670,7 @@ public class BatchNode extends GeometryGroupNode { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Geometry geometry; |
|
|
|
Geometry geometry; |
|
|
|
|
|
|
|
|
|
|
|
public final Geometry getGeometry() { |
|
|
|
public final Geometry getGeometry() { |
|
|
|