Package com.irurueta.geometry.io
Class MeshWriter
java.lang.Object
com.irurueta.geometry.io.MeshWriter
- Direct Known Subclasses:
MeshWriterBinary,MeshWriterJson
Abstract class that defines the interface for writers. A MeshWriter will be
able to transcode a given 3D file into another format.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classInternal class implementing listeners for different specific loaders. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIndicates if texture validation will be ignored or not.(package private) final MeshWriter.ListenersInternal class implementing specific listeners for some specific loader implementations.protected MeshWriterListenerListener to be notified when transcoding process starts, stops or when progress changes.protected final LoaderLoader to load a file to be trans-coded.protected booleanIndicates if mesh writer is locked because a file is being processed.protected final OutputStreamStream where trans-coded data will be written to. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMeshWriter(Loader loader, OutputStream stream) Constructor.protectedMeshWriter(Loader loader, OutputStream stream, MeshWriterListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns listener to be notified when transcoding process starts, stops or when progress changes.Returns stream where trans-coded data will be written to.booleanisLocked()Boolean indicating whether this mesh writer is locked because a file is being processed.booleanisReady()Indicates if this mesh writer is ready because a file and a loader have been provided.protected abstract voidprocessTextureFile(Texture texture, File textureFile) Abstract method to processes texture file.voidsetListener(MeshWriterListener listener) Sets listener to be notified when transcoding process starts, stops or when progress changes.abstract voidwrite()Abstract method to process input file and write it into output stream.
-
Field Details
-
loader
Loader to load a file to be trans-coded. -
stream
Stream where trans-coded data will be written to. -
listener
Listener to be notified when transcoding process starts, stops or when progress changes. -
locked
protected boolean lockedIndicates if mesh writer is locked because a file is being processed. -
ignoreTextureValidation
protected boolean ignoreTextureValidationIndicates if texture validation will be ignored or not. If not ignored, it will be ensured that textures are valid image files. -
internalListeners
Internal class implementing specific listeners for some specific loader implementations.
-
-
Constructor Details
-
MeshWriter
Constructor.- Parameters:
loader- loader to load a 3D file.stream- stream where trans-coded data will be written to.
-
MeshWriter
Constructor.- Parameters:
loader- loader to load a 3D file.stream- stream where trans-coded data will be written to.listener- listener to be notified of progress changes or when transcoding process starts or finishes.
-
-
Method Details
-
isLocked
public boolean isLocked()Boolean indicating whether this mesh writer is locked because a file is being processed.- Returns:
- true if this instance is locked, false otherwise.
-
getStream
Returns stream where trans-coded data will be written to.- Returns:
- stream where trans-coded data will be written to.
-
getListener
Returns listener to be notified when transcoding process starts, stops or when progress changes.- Returns:
- listener of this mesh writer.
-
setListener
Sets listener to be notified when transcoding process starts, stops or when progress changes.- Parameters:
listener- listener to be set.- Throws:
LockedException- if this instance is locked because this mesh writer is already processing a file.
-
isReady
public boolean isReady()Indicates if this mesh writer is ready because a file and a loader have been provided.- Returns:
- true if mesh writer is ready, false otherwise.
-
write
public abstract void write() throws LoaderException, IOException, NotReadyException, LockedExceptionAbstract method to process input file and write it into output stream.- Throws:
LoaderException- if 3D file loading fails.IOException- if an I/O error occurs.NotReadyException- if mesh writer is not ready because either a loader has not been provided or an output stream has not been provided.LockedException- if this mesh writer is locked processing a file.
-
processTextureFile
Abstract method to processes texture file. Usually this will imply validating that image file is not corrupt and has proper size (power of 2). If not image will be resized.- Parameters:
texture- reference to texture.textureFile- file where texture is temporarily copied.- Throws:
IOException- if an I/O error occurs.
-