Hi team,
I am having some what of a problem.
When I add Line Mesh Geometries to a BatchNode after calling the batchNode.batch(); it seems as if the line width of each line which is 5f is reset to 1f.
Is this a known bug and is there some way to fix it.
Thanks
Here is the sample code:
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.BatchNode;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Line;
public class TestBatchLine extends SimpleApplication {
private BatchNode batchNode;
public static void main(String[] args) {
TestBatchLine app = new TestBatchLine();
app.start();
}
@Override
public void simpleInitApp() {
batchNode = new BatchNode("drawing");
addLine(Vector3f.ZERO, new Vector3f(0, 2, 0));
addLine(new Vector3f(0, 2, 0), new Vector3f(2, 2, 0));
rootNode.attachChild(batchNode);
batchNode.batch();
}
protected void addLine(Vector3f start, Vector3f end) {
Material mat = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
Line line = new Line(start, end);
line.setLineWidth(10);
Geometry geometry = new Geometry("line_geom", line);
geometry.setMaterial(mat);
batchNode.attachChild(geometry);
}
}
1 Like
nehon
August 7, 2015, 4:48am
3
Never tested to batch lines tbh, I’m gona look into it.
Thanks for the test case.
nehon
August 7, 2015, 4:54am
4
I guess Line is a class of yours isn’t it?
Could you post it too?
Thanks @nehon ,
No, line is a jME3 class.
I have updated the imports for the test case above.
nehon
August 7, 2015, 6:33am
7
Ok that’s fixed, though all meshes needs to have the same line width.
committed 06:34AM - 07 Aug 15 UTC
1 Like
@nehon , can I only get that fix in the latest github?
Is there any other way to get it?
I am using stable jME3.0.
nehon
August 7, 2015, 12:28pm
10
You can try to grab the BatchNode code and make it a MyOwnBatchNode in your project.
It doesn’t have any interaction with thte rest of the engine so it should work.