ModelFormat

Description

[ShutdownSurvive]
abstract class Tinman.Engine.Models.ModelFormat

Derived from

FileFormat abstract

Extended by

AssimpModelFormat sealed
OpenFlightModelFormat sealed

The supported 3D model file formats.

Public / Constants

Any


public static readonly attribute Any → (ModelFormat)

The file format is unknown and will be determined automatically.

Use IFileFormat.Next to walk through all registered formats.

The ReadModel method of this file format may return a ModelReader object, if additional processing is supported.

CMH


public static readonly attribute CMH → (ModelFormat)

The CMH model file format ('Compiled Model Hierarchy', proprietary)

Write supported: yes
IANA media type: none
File extensions: .cmh
Prefix sequence: yes

This file format is self-contained, i.e. all resources are embedded in the model file. Lazy loading is applied for all model geometry objects and all model texture resources.

The ReadModel method of this file format never returns a ModelReader object.

This model format supports ModelFlags.ComplexGeometry.

GLB


public static readonly attribute GLB → (ModelFormat)

Write supported: no
IANA media type: model/gltf-binary
File extensions: .glb
Prefix sequence: no

The binary JSON .glb file format may be self-contained, i.e. all resources are embedded in the model file. Lazy loading is applied for all model geometry objects and all model texture resources. These glTF extensions are supported:

  • KHR_materials_emissive_strength

  • KHR_materials_ior

  • KHR_materials_pbrSpecularGlossiness

  • KHR_materials_specular

  • KHR_materials_transmission

  • KHR_materials_unlit

The following glTF features are not supported:

  • 3.7.3. Skins

  • 3.10. Cameras

  • 3.11. Animations

The ReadModel method of this file format never returns a ModelReader object.

GLTF


public static readonly attribute GLTF → (ModelFormat)

Write supported: no
IANA media type: model/gltf+json
File extensions: .gltf
Prefix sequence: no

The JSON .gltf file format is not necessarily self-contained, i.e. some resources may be present as external files, which are referenced by the model file. Lazy loading is applied for all model geometry objects and all model texture resources. These glTF extensions are supported:

  • KHR_materials_emissive_strength

  • KHR_materials_ior

  • KHR_materials_pbrSpecularGlossiness

  • KHR_materials_specular

  • KHR_materials_transmission

  • KHR_materials_unlit

The following glTF features are not supported:

  • 3.7.3. Skins

  • 3.10. Cameras

  • 3.11. Animations

The ReadModel method of this file format never returns a ModelReader object.

LAS


public static readonly attribute LAS → (ModelFormat)

The LAS model file format.

Write supported: no
IANA media type: application/vnd.las
File extensions: .las
Prefix sequence: yes

The ReadModel method of this file format always returns a ModelReader object, which supports the following processing settings:

OBJ


public static readonly attribute OBJ → (ModelFormat)

The OBJ model file format.

Write supported: yes
IANA media type: model/obj
File extensions: .obj
Prefix sequence: no

The ReadModel method of this file format always returns a ModelReader object, which supports the following processing settings:

The following commands are supported in *.obj files:

  • v X Y Z (vertex coordinates)

  • v X Y Z R G B (vertex coordinates with color)

  • vn X Y Z (vertex normal vector)

  • vt X Y (vertex texture coordinates)

  • s N (smoothing group for normal vectors)

  • f A1 B1 C1 …​ (polygon face)

  • f A1/A2 B1/B2 C1/C2 …​ (polygon face)

  • f A1/A2/A3 B1/B2/B3 C1/C2/C3 …​ (polygon face)

  • mtllib NAME (select material library)

  • usemtl NAME (select material)

The following commands are supported in *.mtl files:

  • newmtl NAME (define new material)

  • Ka R G B (ambient reflectivity)

  • Kd R G B (diffuse reflectivity)

  • Ks R G B (specular reflectivity)

  • Tf R G B (transmission filter)

  • d V (material dissolve)

  • sharpness V (glossiness)

  • map_Ka NAME (ambient texture map)

  • map_Kd NAME (diffuse texture map)

  • map_Ks NAME (specular texture map)

  • map_d NAME (dissolve texture map)

When writing *.obj files, the following information will be lost:

Public / Methods

For​Name


public static method ForName → (1)

name in : string

[not-empty]
The 3D model file format name.

returns → ModelFormat

The 3D model file format or Any if not found.

Returns a 3D model file format by its IFileFormat.Name.

Read​Model


[OwnerReturn]
public method ReadModel → (1)

data in : IFileData

[not-null]
The 3D model data provider.

returns → IModelReader

The 3D model object reader.

Reads the given 3D model.

IOException

If an I/O error has occurred while opening the 3D model data.

ValidatingException

If a validation error has occurred on data in or the returned 3D model reader.

Write​Model


[OwnerReturn]
public method WriteModel → (2)

file in : Path

[not-null]
The output 3D model file.

model in : IModel

[not-null]
The 3D model to write.

returns → IOperation

The operation that writes the 3D model file.

Writes a 3D model to the given file.

IOException

If an I/O error has occurred while writing the 3D model data.

Protected / Constructors

Model​Format


protected constructor ModelFormat → (4)

name in : string

[not-empty]
Value for IFileFormat.Name

description in : string

[not-empty]
Value for IFileFormat.Description

mime in : string

Value for IFileFormat.Mime

isAny opt : bool = false

Is this an automatic file format?

Creates a new instance of ModelFormat.

Protected / Methods

Cannot​Write


protected static method CannotWrite → (2)

source in : string

The error source tag.

file in : Path

The output file path.

returns → IOException

The ready-to-throw exception.

Creates a new instance of IOException for the case when a file format cannot be used for writing a 3D model.

Do​Read​Model


[OwnerReturn]
protected abstract method DoReadModel → (1)

data in : IFileData

The model data provider: will never be null and IValidatable.Validate did not report any errors.

returns → IModelReader

The IModelReader for reading the 3D model data. The IValidatable.Validate has not yet been called on it.

Reads the given 3D model.

IOException

If an I/O error has occurred while opening the 3D model.

Do​Write​Model


[OwnerReturn]
protected virtual method DoWriteModel → (2)

file in : Path

The output 3D model file.

model in : IModel

The 3D model to write.

returns → IOperation

The operation that writes the 3D model file.

Writes a 3D model to the given file.

IOException

If an I/O error has occurred while writing the 3D model.

IOException

If this model format does not support writing (i.e. IFileFormat.CanWrite would return false).