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;
|
int maxWeights = -1;
|
||||||
|
|
||||||
Mesh.Mode mode = null;
|
Mesh.Mode mode = null;
|
||||||
|
float lineWidth = 1f;
|
||||||
for (Geometry geom : geometries) {
|
for (Geometry geom : geometries) {
|
||||||
totalVerts += geom.getVertexCount();
|
totalVerts += geom.getVertexCount();
|
||||||
totalTris += geom.getTriangleCount();
|
totalTris += geom.getTriangleCount();
|
||||||
@ -452,6 +453,7 @@ public class BatchNode extends GeometryGroupNode {
|
|||||||
maxVertCount = geom.getVertexCount();
|
maxVertCount = geom.getVertexCount();
|
||||||
}
|
}
|
||||||
Mesh.Mode listMode;
|
Mesh.Mode listMode;
|
||||||
|
float listLineWidth = 1f;
|
||||||
int components;
|
int components;
|
||||||
switch (geom.getMesh().getMode()) {
|
switch (geom.getMesh().getMode()) {
|
||||||
case Points:
|
case Points:
|
||||||
@ -462,6 +464,7 @@ public class BatchNode extends GeometryGroupNode {
|
|||||||
case LineStrip:
|
case LineStrip:
|
||||||
case Lines:
|
case Lines:
|
||||||
listMode = Mesh.Mode.Lines;
|
listMode = Mesh.Mode.Lines;
|
||||||
|
listLineWidth = geom.getMesh().getLineWidth();
|
||||||
components = 2;
|
components = 2;
|
||||||
break;
|
break;
|
||||||
case TriangleFan:
|
case TriangleFan:
|
||||||
@ -493,11 +496,19 @@ public class BatchNode extends GeometryGroupNode {
|
|||||||
+ " primitive types: " + mode + " != " + listMode);
|
+ " primitive types: " + mode + " != " + listMode);
|
||||||
}
|
}
|
||||||
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;
|
compsForBuf[VertexBuffer.Type.Index.ordinal()] = components;
|
||||||
}
|
}
|
||||||
|
|
||||||
outMesh.setMaxNumWeights(maxWeights);
|
outMesh.setMaxNumWeights(maxWeights);
|
||||||
outMesh.setMode(mode);
|
outMesh.setMode(mode);
|
||||||
|
outMesh.setLineWidth(lineWidth);
|
||||||
if (totalVerts >= 65536) {
|
if (totalVerts >= 65536) {
|
||||||
// make sure we create an UnsignedInt buffer so
|
// make sure we create an UnsignedInt buffer so
|
||||||
// we can fit all of the meshes
|
// we can fit all of the meshes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user