public class WavefrontWriter extends MeshWriterBase
MeshWriter.DataFormat, MeshWriter.FloatType
DEFAULT_FORMAT
Constructor and Description |
---|
WavefrontWriter(java.io.File file) |
WavefrontWriter(java.io.OutputStream os) |
WavefrontWriter(java.lang.String fileName) |
Modifier and Type | Method and Description |
---|---|
boolean |
getFacesClockwise() |
boolean |
getZeroIndexed() |
void |
setFacesClockwise(boolean enable) |
void |
setZeroIndexed(boolean enable) |
static void |
writeMesh(java.io.File file,
MeshBase mesh) |
void |
writeMesh(MeshBase mesh) |
void |
writeMesh(java.io.PrintWriter pw,
PointMesh mesh)
Writes a PointMesh to a PrintWriter, using an Alias Wavefront "obj" file
format.
|
void |
writeMesh(java.io.PrintWriter pw,
PolygonalMesh mesh)
Writes a PolygonalMesh to a PrintWriter, using an Alias Wavefront "obj"
file format.
|
void |
writeMesh(java.io.PrintWriter pw,
PolylineMesh mesh)
Writes a PolylineMesh to a PrintWriter, using an Alias Wavefront "obj"
file format.
|
static void |
writeMesh(java.lang.String fileName,
MeshBase mesh) |
void |
writeString(java.lang.String str) |
close, flush, getFormat, getWriteColors, getWriteNormals, setFormat, setFormat, setWriteColors, setWriteNormals
public WavefrontWriter(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public WavefrontWriter(java.io.File file) throws java.io.IOException
java.io.IOException
public WavefrontWriter(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public boolean getFacesClockwise()
public void setFacesClockwise(boolean enable)
public boolean getZeroIndexed()
public void setZeroIndexed(boolean enable)
public void writeString(java.lang.String str) throws java.io.IOException
java.io.IOException
public void writeMesh(MeshBase mesh) throws java.io.IOException
writeMesh
in interface MeshWriter
writeMesh
in class MeshWriterBase
java.io.IOException
public void writeMesh(java.io.PrintWriter pw, PolygonalMesh mesh) throws java.io.IOException
getZeroIndexed()
returns true
, these indices are
1-based, and unless getFacesClockwise()
returns
true
, they are printed in counter-clockwise order. For
example, a mesh consisting of a simple tetrahedron might be written like
this:
v 0.0 0.0 0.0 v 1.0 0.0 0.0 v 0.0 1.0 0.0 v 0.0 0.0 1.0 f 1 2 3 f 0 2 1 f 0 3 2 f 0 1 3
The format used to print the vertex, normal, and texture coordinates can be
controlled by
MeshWriterBase.setFormat(String)
or MeshWriterBase.setFormat(NumberFormat)
.
The default format has eight decimal places and is specified
by the string "%.8g"
.
pw
- PrintWriter to write the mesh tomesh
- PolygonalMesh to be written.java.io.IOException
public void writeMesh(java.io.PrintWriter pw, PolylineMesh mesh) throws java.io.IOException
getZeroIndexed()
returns true
, these indices are
1-based. An example of a simple three point line is:
v 1.0 0.0 0.0 v 0.0 1.0 0.0 v 0.0 0.0 1.0 l 0 1 2
The format used to print the vertex coordinates can be
controlled by
MeshWriterBase.setFormat(String)
or MeshWriterBase.setFormat(NumberFormat)
.
The default format has eight decimal places and is specified
by the string "%.8g"
.
pw
- PrintWriter to write the mesh tomesh
- PolylineMesh to be writtenjava.io.IOException
public void writeMesh(java.io.PrintWriter pw, PointMesh mesh) throws java.io.IOException
The format used to print the vertex and normal coordinates can be
controlled by
MeshWriterBase.setFormat(String)
or MeshWriterBase.setFormat(NumberFormat)
.
The default format has eight decimal places and is specified
by the string "%.8g"
.
pw
- PrintWriter to write this mesh tomesh
- PointMesh to be writtenjava.io.IOException
public static void writeMesh(java.lang.String fileName, MeshBase mesh) throws java.io.IOException
java.io.IOException
public static void writeMesh(java.io.File file, MeshBase mesh) throws java.io.IOException
java.io.IOException