diff --git a/jme3-core/src/main/java/com/jme3/scene/BatchNode.java b/jme3-core/src/main/java/com/jme3/scene/BatchNode.java index 1b0d5e051..1358830a8 100644 --- a/jme3-core/src/main/java/com/jme3/scene/BatchNode.java +++ b/jme3-core/src/main/java/com/jme3/scene/BatchNode.java @@ -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 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. - * + *
* TODO normal or tangents or both looks a bit weird * TODO more automagic (batch when needed in the updateLogicalState) + * * @author Nehon */ public class BatchNode extends GeometryGroupNode { @@ -108,7 +109,7 @@ public class BatchNode extends GeometryGroupNode { public void onMaterialChange(Geometry geom) { throw new UnsupportedOperationException( "Cannot set the material of a batched geometry, " - + "change the material of the parent BatchNode."); + + "change the material of the parent BatchNode."); } @Override @@ -122,7 +123,7 @@ public class BatchNode extends GeometryGroupNode { setNeedsFullRebatch(true); } - protected Matrix4f getTransformMatrix(Geometry g){ + protected Matrix4f getTransformMatrix(Geometry g) { return g.cachedWorldMat; } @@ -234,7 +235,7 @@ public class BatchNode extends GeometryGroupNode { logger.log(Level.FINE, "Batched {0} geometries in {1} batches.", new Object[]{nbGeoms, batches.size()}); //init the temp arrays if something has been batched only. - if(matMap.size()>0){ + if (matMap.size() > 0) { //TODO these arrays should be allocated by chunk instead to avoid recreating them each time the batch is changed. //init temp float arrays tmpFloat = new float[maxVertCount * 3]; @@ -257,6 +258,7 @@ public class BatchNode extends GeometryGroupNode { /** * recursively visit the subgraph and unbatch geometries + * * @param 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 - * + *
* 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
- *
* @see #setMaterial(com.jme3.material.Material)
*/
public Material getMaterial() {
@@ -428,14 +429,6 @@ public class BatchNode extends GeometryGroupNode {
+ " primitive types: " + 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;
}
@@ -574,7 +567,7 @@ public class BatchNode extends GeometryGroupNode {
bufNorm.put(tmpFloatN, 0, length);
}
- private void doTransformsTangents(FloatBuffer bindBufPos, FloatBuffer bindBufNorm, FloatBuffer bindBufTangents,FloatBuffer bufPos, FloatBuffer bufNorm, FloatBuffer bufTangents, int start, int end, Matrix4f transform) {
+ private void doTransformsTangents(FloatBuffer bindBufPos, FloatBuffer bindBufNorm, FloatBuffer bindBufTangents, FloatBuffer bufPos, FloatBuffer bufNorm, FloatBuffer bufTangents, int start, int end, Matrix4f transform) {
TempVars vars = TempVars.get();
Vector3f pos = vars.vect1;
Vector3f norm = vars.vect2;
@@ -667,6 +660,7 @@ public class BatchNode extends GeometryGroupNode {
protected class Batch implements JmeCloneable {
/**
* update the batchesByGeom map for this batch with the given List of geometries
+ *
* @param list
*/
void updateGeomList(List