BatchNode now preserves the lineWidth for Line meshes when batching.
This commit is contained in:
parent
a68a9747bb
commit
a655acb8f0
@ -444,6 +444,7 @@ public class BatchNode extends GeometryGroupNode {
|
||||
int maxWeights = -1;
|
||||
|
||||
Mesh.Mode mode = null;
|
||||
float lineWidth = 1f;
|
||||
for (Geometry geom : geometries) {
|
||||
totalVerts += geom.getVertexCount();
|
||||
totalTris += geom.getTriangleCount();
|
||||
@ -452,6 +453,7 @@ public class BatchNode extends GeometryGroupNode {
|
||||
maxVertCount = geom.getVertexCount();
|
||||
}
|
||||
Mesh.Mode listMode;
|
||||
float listLineWidth = 1f;
|
||||
int components;
|
||||
switch (geom.getMesh().getMode()) {
|
||||
case Points:
|
||||
@ -462,6 +464,7 @@ public class BatchNode extends GeometryGroupNode {
|
||||
case LineStrip:
|
||||
case Lines:
|
||||
listMode = Mesh.Mode.Lines;
|
||||
listLineWidth = geom.getMesh().getLineWidth();
|
||||
components = 2;
|
||||
break;
|
||||
case TriangleFan:
|
||||
@ -491,13 +494,21 @@ public class BatchNode extends GeometryGroupNode {
|
||||
if (mode != null && mode != listMode) {
|
||||
throw new UnsupportedOperationException("Cannot combine different"
|
||||
+ " primitive types: " + mode + " != " + listMode);
|
||||
}
|
||||
}
|
||||
mode = listMode;
|
||||
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;
|
||||
}
|
||||
|
||||
outMesh.setMaxNumWeights(maxWeights);
|
||||
outMesh.setMode(mode);
|
||||
outMesh.setLineWidth(lineWidth);
|
||||
if (totalVerts >= 65536) {
|
||||
// make sure we create an UnsignedInt buffer so
|
||||
// we can fit all of the meshes
|
||||
|
Loading…
x
Reference in New Issue
Block a user