TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class ModelFormat in Tinman.Engine.Models

The supported 3D model file formats.

[ShutdownSurvive]
abstract class ModelFormat extends FileFormat
  base of AssimpModelFormat

Public / Constants

Any

The file format is unknown and will be determined automatically.

public static readonly field Any
type ModelFormat

Remarks:

Use 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

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

public static readonly field CMH
type ModelFormat

Remarks:

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.

GLB

The GL Transmission Format Version 2.0 - Binary (.glb)

public static readonly field GLB
type ModelFormat

Remarks:

The binary .glb 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.

GLTF

The GL Transmission Format Version 2.0 - JSON (.gltf)

public static readonly field GLTF
type ModelFormat

Remarks:

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.

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

LAS

The LAS model file format.

public static readonly field LAS
type ModelFormat

Remarks:

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

OBJ

The OBJ model file format.

public static readonly field OBJ
type ModelFormat

Remarks:

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

Public / Attributes

Description

Long description of this file format.

public virtual property Description { get }
type string
value [not-null] The description string.
inherited FileFormat.Description

Name

The file format name.

public property Name { get }
type string
value [not-null] The file format name.
inherited FileFormat.Name

Next

Returns the next file format.

[ThreadSafe]
public property Next { get }
type IFileFormat
value The next file format or null.
inherited FileFormat.Next

Remarks:

The first file format can be obtained from implementing classes. This property can be used to cycle all available file formats of the same type.

Type

The type of this file format (e.g. images, shapes, 3D models).

public property Type { get }
type string
value [not-null] The human-readable type name.
inherited FileFormat.Type

Public / Methods

CanRead

Can this file format object be used to read the given path?

public virtual method CanRead (string suffix, bool directory = false)
type bool
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
  directory Does the path refer to a directory (true) or to a file (false)? Defaults to false.
returns true if this file format can be used, false if not.
inherited FileFormat.CanRead

CanReadFind

Returns the first file format in the chain (see IFileFormat) that can read the given path.

public method CanReadFind (string suffix, bool directory = false)
type IFileFormat
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
  directory Does the path refer to a directory (true) or to a file (false)? Defaults to false.
returns The found file format or null.
inherited FileFormat.CanReadFind

CanWrite

Can this file format object be used to write the given path?

public virtual method CanWrite (string suffix)
type bool
params suffix [not-null] The lower-case pathname suffix (without '.'). Will be empty if the path does not have a pathname suffix.
returns true if this file format can be used, false if not.
inherited FileFormat.CanWrite

ForName

Returns a 3D model file format by its Name.

public static method ForName (string name)
type ModelFormat
params name [not-empty] The 3D model file format name.
returns [not-null] The 3D model file format or Any if not found.

PleaseIncludeInBinaryThanks

This is a no-op method that forces the compiler / linker to include this type in the resulting binary.

public virtual method PleaseIncludeInBinaryThanks ()
inherited FileFormat.PleaseIncludeInBinaryThanks

Remarks:

Calling this stub method makes sure that all lazy constructor calls have been made.

To initialize everything, an application needs to call this method on its root module(s) (see TinmanModule), followed by a call to Initialize.

ReadModel

Reads the given 3D model.

[OwnerReturn]
public method ReadModel (IFileData data)
type IModelReader
params data [not-null] The 3D model data provider.
returns [not-null] The 3D model object reader.

Exceptions:

ToString

[Pure]
public override sealed method ToString ()
type string
inherited FileFormat.ToString

WriteModel

Writes a 3D model to the given file.

[OwnerReturn]
public method WriteModel (Path file, IModel model)
type IOperation
params file [not-null] The output 3D model file.
  model [not-null] The 3D model to write.
returns [not-null] The operation that writes the 3D model file.

Exceptions:

Protected / Attributes

IsRegistered

Has this file format been registered?

protected property IsRegistered { get }
type bool
value true if this file format has been registered, false if not.
inherited FileFormat.IsRegistered

See also:

FileFormat.Register

Protected / Constructors

ModelFormat

Creates a new instance of ModelFormat.

protected constructor ModelFormat (string name, string description, bool isAny = false)
params name [not-empty] Value for Name
  description [not-empty] Value for Description
  isAny Is this an automatic file format?

Protected / Methods

CannotWrite

protected static method CannotWrite (string source, Path file)
type TinmanException
params source
  file

DoReadModel

Reads the given 3D model.

[OwnerReturn]
protected abstract method DoReadModel (IFileData data)
type IModelReader
params data The model data provider: will never be null and Validate did not report any errors.
returns [not-null] The IModelReader for reading the 3D model data. The Validate has not yet been called on it.

Exceptions:

DoWriteModel

Writes a 3D model to the given file.

[OwnerReturn]
protected virtual method DoWriteModel (Path file, IModel model)
type IOperation
params file The output 3D model file.
  model The 3D model to write.
returns [not-null] The operation that writes the 3D model file.

Exceptions:

NameFind

Finds the IFileFormat that has the given name.

protected method NameFind (string name)
type IFileFormat
params name [not-empty] The file format name.
returns The found file format or null.
inherited FileFormat.NameFind

Register

Appends this file format to the chain of the given file format.

[ThreadSafe]
protected method Register (FileFormat any)
params any [not-null] The file format chain to append to.
inherited FileFormat.Register

ThrowIfNotRegistered

protected method ThrowIfNotRegistered ()
inherited FileFormat.ThrowIfNotRegistered