Hi ,
I’m trying to use GeometryBatchFactory with Lines :
[java]
Material matRed = new Material(app.getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);
matRed.setColor(“Color”, new ColorRGBA(ColorRGBA.Red.getRed(), ColorRGBA.Red.getGreen(), ColorRGBA.Red.getBlue(), 0.75f));
Material matBlue = new Material(app.getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);
matBlue.setColor(“Color”, new ColorRGBA(ColorRGBA.Blue.getRed(), ColorRGBA.Blue.getGreen(), ColorRGBA.Blue.getBlue(), 0.75f));
Node testNode = new Node(“test Node”);
Line line1 = new Line(
new Vector3f(0,0,0),
new Vector3f(100,0,0));
Geometry geomLine1 = new Geometry(“line1”, line1);
Line line2 = new Line(
new Vector3f(100,0,0),
new Vector3f(100,100,0));
Geometry geomLine2 = new Geometry(“line2”,line2);
Line line3 = new Line(
new Vector3f(100,100,0),
new Vector3f(200,200,0));
Geometry geomLine3 = new Geometry(“line3”,line3);
Line line4 = new Line(
new Vector3f(200,200,0),
new Vector3f(300,200,0));
Geometry geomLine4 = new Geometry(“line4”,line4);
Line line5 = new Line(
new Vector3f(300,200,0),
new Vector3f(300,300,0));
Geometry geomLine5 = new Geometry(“line5”,line5);
Line line6 = new Line(
new Vector3f(300,300,0),
new Vector3f(500,300,0));
Geometry geomLine6 = new Geometry(“line5”,line6);
geomLine1.setMaterial(matRed); geomLine2.setMaterial(matBlue); geomLine3.setMaterial(matRed); geomLine4.setMaterial(matBlue); geomLine5.setMaterial(matRed);geomLine6.setMaterial(matBlue);
testNode.attachChild(geomLine1); testNode.attachChild(geomLine2); testNode.attachChild(geomLine3); testNode.attachChild(geomLine4); testNode.attachChild(geomLine5);
Node finalNode = null;
try {
finalNode = (Node) GeometryBatchFactory.optimize(testNode);
}catch(Exception e) {
e.printStackTrace();
}
rootNode.attachChild(finalNode);
[/java]
i have this exception :
[java]
java.lang.UnsupportedOperationException: The geometry line4 (Geometry) buffer Index has different number of components than the rest of the meshes (this: 3, expected: 2)
[/java]
Any ideas to help me please ?