public final class ObjWriter.MeshBuffer extends Object
Ideally, no vertices or normals would be duplicated in an OBJ file. However, when working with very large
geometries it may not be desirable to store values in memory before writing to the output. This
is where the batchSize
property comes into play. The batchSize
represents the maximum
number of faces that the buffer will store before automatically flushing its contents to the output and
resetting its state. This reduces the amount of memory used by the buffer at the cost of increasing the
likelihood of duplicate vertices and/or normals in the output.
Modifier and Type | Method and Description |
---|---|
void |
add(FacetDefinition facet)
Add a facet to this buffer.
|
void |
add(PlaneConvexSubset boundary)
Add a boundary to this buffer.
|
int |
addNormal(Vector3D normal)
Add a normal to the buffer.
|
int |
addVertex(Vector3D vertex)
Add a vertex to the buffer.
|
void |
flush()
Flush the buffer content to the output and reset its state.
|
public void add(FacetDefinition facet)
batchSize
is greater than -1
and the number
of currently stored faces is greater than or equal to batchSize
, then the buffer
content is written to the output and the buffer state is reset.facet
- facet to addUncheckedIOException
- if an I/O error occurspublic void add(PlaneConvexSubset boundary)
batchSize
is greater than -1
and the number
of currently stored faces is greater than or equal to batchSize
, then the buffer
content is written to the output and the buffer state is reset.boundary
- boundary to addIllegalArgumentException
- if the boundary is infiniteUncheckedIOException
- if an I/O error occurspublic int addVertex(Vector3D vertex)
vertex
- vertex to addpublic int addNormal(Vector3D normal)
normal
- normal to addpublic void flush()
UncheckedIOException
- if an I/O error occursCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.