Package com.irurueta.geometry.io
Class MeshWriterJson
java.lang.Object
com.irurueta.geometry.io.MeshWriter
com.irurueta.geometry.io.MeshWriterJson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CharsetIndicates charset to use in resulting JSON file.static final booleanIndicates if textures must be embedded into resulting file.static final booleanIndicates if by default an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.static final booleanIndicates if by default a URL indicating where the texture can be located should be included into resulting file.private booleanIndicates if textures will be embedded into resulting JSON stream of data.private booleanIndicates if an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.private booleanIndicates if a URL indicating where the texture can be located should be included into resulting file.private intCounter for the number of textures that have been read.private BufferedWriterWriter to write resulting JSON into output stream.Fields inherited from class com.irurueta.geometry.io.MeshWriter
ignoreTextureValidation, internalListeners, listener, loader, locked, stream -
Constructor Summary
ConstructorsConstructorDescriptionMeshWriterJson(Loader loader, OutputStream stream) Constructor.MeshWriterJson(Loader loader, OutputStream stream, MeshWriterListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns charset to use in resulting JSON file.booleanIndicates if default charset will be used or not.booleanIndicates if textures are embedded into resulting JSON or not.booleanIndicates if an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.booleanIndicates if a URL indicating where the texture can be located should be included into resulting file.protected voidprocessTextureFile(Texture texture, File textureFile) Processes texture file.voidsetCharset(Charset charset) Sets charset to use in resulting JSON file.voidsetEmbedTexturedEnabled(boolean embedTexturesEnabled) Specified whether textures are embedded into resulting JSON or not.voidsetRemoteTextureIdEnabled(boolean remoteTextureIdEnabled) Specifies whether an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.voidsetRemoteTextureUrlEnabled(boolean remoteTextureUrlEnabled) Specifies whether a URL indicating where the texture can be located should be included into resulting file.voidwrite()Processes input file provided to loader and writes it trans-coded into output stream.private voidwriteMaterial(Material material) Writes material into output JSON file.Methods inherited from class com.irurueta.geometry.io.MeshWriter
getListener, getStream, isLocked, isReady, setListener
-
Field Details
-
DEFAULT_EMBED_TEXTURES
public static final boolean DEFAULT_EMBED_TEXTURESIndicates if textures must be embedded into resulting file.- See Also:
-
DEFAULT_USE_REMOTE_TEXTURE_URL
public static final boolean DEFAULT_USE_REMOTE_TEXTURE_URLIndicates if by default a URL indicating where the texture can be located should be included into resulting file.- See Also:
-
DEFAULT_USE_REMOTE_TEXTURE_ID
public static final boolean DEFAULT_USE_REMOTE_TEXTURE_IDIndicates if by default an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.- See Also:
-
charset
Indicates charset to use in resulting JSON file. By default, this will be UTF-8. -
writer
Writer to write resulting JSON into output stream. -
textureCounter
private int textureCounterCounter for the number of textures that have been read. -
embedTexturesEnabled
private boolean embedTexturesEnabledIndicates if textures will be embedded into resulting JSON stream of data. When embedding textures their stream of bytes is written using BASE64 to the output stream. -
remoteTextureUrlEnabled
private boolean remoteTextureUrlEnabledIndicates if a URL indicating where the texture can be located should be included into resulting file. -
remoteTextureIdEnabled
private boolean remoteTextureIdEnabledIndicates if an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.
-
-
Constructor Details
-
MeshWriterJson
Constructor.- Parameters:
loader- loader to load a 3D file.stream- stream where trans-coded data will be written to.
-
MeshWriterJson
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
-
getCharset
Returns charset to use in resulting JSON file. By default, this will be UTF-8.- Returns:
- charset to use in resulting JSON file.
-
setCharset
Sets charset to use in resulting JSON file. By default, this will be UTF-8.- Parameters:
charset- charset to use in resulting JSON file.- Throws:
LockedException- if this mesh writer is locked processing a file.
-
isDefaultCharsetBeingUsed
public boolean isDefaultCharsetBeingUsed()Indicates if default charset will be used or not.- Returns:
- true if default charset (UTF-8) will be used, false otherwise.
-
isEmbedTexturesEnabled
public boolean isEmbedTexturesEnabled()Indicates if textures are embedded into resulting JSON or not. When embedding textures their stream of bytes is written using BASE64 to the output stream.- Returns:
- true if textures are embedded into resulting JSON, false otherwise.
-
setEmbedTexturedEnabled
Specified whether textures are embedded into resulting JSON or not. When embedding textures their stream of bytes is written using BASE64 to the output stream.- Parameters:
embedTexturesEnabled- true if textures will be embedded into resulting JSON, false.- Throws:
LockedException- if this mesh writer is locked processing a file.
-
isRemoteTextureUrlEnabled
public boolean isRemoteTextureUrlEnabled()Indicates if a URL indicating where the texture can be located should be included into resulting file.- Returns:
- true if a URL indicating where the texture can be located will be included into resulting file, false otherwise.
-
setRemoteTextureUrlEnabled
Specifies whether a URL indicating where the texture can be located should be included into resulting file.- Parameters:
remoteTextureUrlEnabled- true if a URL indicating where the texture can be located will be included into resulting file, false otherwise.- Throws:
LockedException- if this mesh writer is locked processing a file.
-
isRemoteTextureIdEnabled
public boolean isRemoteTextureIdEnabled()Indicates if an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.- Returns:
- true if an identifier for the texture should be included into. resulting file so that texture image can be fetched by some other mean.
-
setRemoteTextureIdEnabled
Specifies whether an identifier for the texture should be included into resulting file so that texture image can be fetched by some other mean.- Parameters:
remoteTextureIdEnabled- true if identifier for the texture should be included into resulting file.- Throws:
LockedException- if this mesh writer is locked processing file.
-
write
Processes input file provided to loader and writes it trans-coded into output stream.- Specified by:
writein classMeshWriter- 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
Processes texture file. By reading provided texture file that has been created in a temporal location and embedding it into resulting output stream.- Specified by:
processTextureFilein classMeshWriter- Parameters:
texture- reference to texture that uses texture imagetextureFile- file containing texture image. File will usually be created in a temporal location.- Throws:
IOException- if an I/O error occurs
-
writeMaterial
Writes material into output JSON file.- Parameters:
material- material to be written.- Throws:
IOException- if an I/O error occurs.
-