Class TLcdOGC3DTilesModelEncoder
- All Implemented Interfaces:
ILcdOutputStreamFactoryCapable,ILcdModelEncoder,ILcdStatusSource,Serializable
Supported input models
This model encoder handles only models with ILcd3DMesh data that is already tiled and multi-leveled.
LuciadLightspeed and LuciadFusion currently don't expose API to write such a model yourself.
So in practice you can pass models created by our decoders, such as the TLcdOSGBModelDecoder, TLcdIFCModelDecoder
or TLcdBINZModelDecoder.
Luciad's 3D Tiles Processing Engine
If you want to make a 3D mesh model that is not tiled or multi-leveled available for streaming through OGC 3D Tiles, you can make use of the 3D Tiles Processing Engine. It comes as a part of the optional Infrastructure Standards component. The 3D Tiles Processing Engine is an advanced converter that (re)tiles your mesh and makes it multi-leveled, and optimizes it for fast streaming while retaining mesh and texture quality.
Output
This encoder can output version 1.0 or 1.1 of the OGC 3D Tiles specification. Specifically, it supports:
tileset.jsonmetadata files that hold the LOD tree information.- OGC 3D Tiles 1.0: Batched 3D Model (
.b3dm) tile format with a glTF 2.0 payload - OGC 3D Tiles 1.1: glTF 2.0 tile format, written as binary glTF (
.glb) - Payloads with or without textures, and with or without mesh compression.
setTileSetVersion method to specify the version. See
ELcdOGC3DTilesVersion for more details on the differences.
Supported transfer protocols
This model decoder supports all transfer protocols that are supported by the output stream factory of this decoder.
By default this file output only.
Example
Decoding an OSGB dataset and encoding it into OGC 3D Tiles. // Load an OSGB dataset
ILcdModelDecoder decoder = new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode("/path/to/osgb/dataset.desc");
// Encode to OGC 3D Tiles
TLcdOGC3DTilesModelEncoder encoder = new TLcdOGC3DTilesModelEncoder();
// Use draco mesh compression when encoding a mesh model
encoder.setMeshCompression(ELcdOGC3DTilesMeshCompressionType.DRACO);
encoder.export(model, "/path/to/ogc3dtiles/tileset.json");
Thread-safety
This encoder is not thread-safe for concurrent writing.
Other notes
- This encoder transforms coordinates from the input model reference to geocentric reference (as mandated by the OGC 3D Tiles specification).
- This encoder saves only mesh data. In the future, it will also support saving point clouds to PNTS.
- This encoder splits metadata hierarchically over multiple json files referred from the root
tileset.json, if the LOD tree is large. - This encoder supports Draco mesh compression through
setMeshCompression(ELcdOGC3DTilesMeshCompressionType), which results in significantly smaller file sizes. You can also use this feature to compress existing OGC 3D Tiles datasets.
- Since:
- 2020.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStatusListener(ILcdStatusListener aListener) Registers the given listener so it will receive status events from this source.booleanReturns whether this encoder can export the specified model to the specified destination.booleanReturns false: this model encoder can not save a model to the location it originally came from.voidExports the specified model to the specified destination.Returns a short, displayable name for the format thisILcdModelEncoderencodes to.Get the mesh compression algorithm that is used while encoding.Returns the output stream factory that is used.voidremoveStatusListener(ILcdStatusListener aListener) Removes the specified listener so it is no longer notified.voidThrows anUnsupportedOperationException: this model encoder can not save a model to the location it originally came from.voidsetMeshCompression(ELcdOGC3DTilesMeshCompressionType aMeshCompressionType) Set the mesh compression algorithm to use while encoding.voidsetOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory) Sets the output stream factory to be used.voidsetTileSetVersion(ELcdOGC3DTilesVersion aVersion) Set the OGC 3D Tiles version to use while encoding.
-
Constructor Details
-
TLcdOGC3DTilesModelEncoder
public TLcdOGC3DTilesModelEncoder()Create a newTLcdOGC3DTilesModelEncoder.
-
-
Method Details
-
setTileSetVersion
Set the OGC 3D Tiles version to use while encoding. If not set, version 1.0 is used.- Parameters:
aVersion- VERSION_1_0 as default; Should not benull.- Since:
- 2025.0
-
setMeshCompression
Set the mesh compression algorithm to use while encoding. If not set, no compression is used.- Parameters:
aMeshCompressionType- NONE as default; Should not benull.- Since:
- 2021.1
-
getMeshCompression
Get the mesh compression algorithm that is used while encoding.- Returns:
- the mesh compression type
- Since:
- 2021.1
-
getDisplayName
Description copied from interface:ILcdModelEncoderReturns a short, displayable name for the format thisILcdModelEncoderencodes to.- Specified by:
getDisplayNamein interfaceILcdModelEncoder- Returns:
- the displayable name of this
ILcdModelEncoder.
-
canSave
Returns false: this model encoder can not save a model to the location it originally came from.- Specified by:
canSavein interfaceILcdModelEncoder- Parameters:
aModel- the model to be verified.- Returns:
- false
- See Also:
-
save
Throws anUnsupportedOperationException: this model encoder can not save a model to the location it originally came from.- Specified by:
savein interfaceILcdModelEncoder- Parameters:
aModel- the model to be saved.- Throws:
UnsupportedOperationException- this model encoder can not save a model to the location it originally came from.
-
canExport
Returns whether this encoder can export the specified model to the specified destination. This check does not verify if the destination is writable, already exists etc, it is only meant to verify compatibility of the model. Seeclass javadocfor details on which models can be exported.- Specified by:
canExportin interfaceILcdModelEncoder- Parameters:
aModel- the model to be verified.aDestinationName- the location where the model should be exported to, can be either a directory or a specific tileset.json.- Returns:
trueif the model can be exported,falseotherwise.- See Also:
-
export
public void export(ILcdModel aModel, String aDestinationName) throws IllegalArgumentException, IOException Exports the specified model to the specified destination. Seeclass javadocfor details on which models can be exported. You can either provide a json file name as destination, typicallytileset.json, or a directory name where the encoder will place atileset.jsonfile.- The encoder will write metadata to the json file, and place the tile data into a
Datasubdirectory. - If the directory path to the json file does not exist, it will be created.
- If the json file already exists, the export fails.
- If a previous, partial export result already exists, the export overwrites this result. You can recognize this by a json file ending in
lcd_lock.
- Specified by:
exportin interfaceILcdModelEncoder- Parameters:
aModel- the model to be exported.aDestinationName- the location where the model should be exported to, can be either a directory or a specific tileset.json.- Throws:
IllegalArgumentException- if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)).IOException- if an I/O error occurs during encoding.
- The encoder will write metadata to the json file, and place the tile data into a
-
addStatusListener
Description copied from interface:ILcdStatusSourceRegisters the given listener so it will receive status events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source, you can use a
ALcdWeakStatusListenerinstance as status listener.- Specified by:
addStatusListenerin interfaceILcdStatusSource- Parameters:
aListener- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeStatusListenerin interfaceILcdStatusSource- Parameters:
aListener- The listener to remove.
-
setOutputStreamFactory
Description copied from interface:ILcdOutputStreamFactoryCapableSets the output stream factory to be used.- Specified by:
setOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Parameters:
aOutputStreamFactory- the output stream factory to be used.
-
getOutputStreamFactory
Description copied from interface:ILcdOutputStreamFactoryCapableReturns the output stream factory that is used.- Specified by:
getOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Returns:
- the output stream factory that is used.
-