ModelReader
Description
- Derived from
-
ModelReaderBase abstract
- Extended by
-
OpenFlightModelReader sealed
Abstract base class for implementations of the IModelReader interface that perform additional processing while reading 3D models.
Public / Methods
TextureFileReplace
Replaces a texture file.
The given texture file path will be resolved (see ResolveTexturePath), if necessary.
Public / Attributes
BadTextureNames
Returns the texture names (see TextureName1 and TextureName2) that could not have been resolved.
A warning message is generated for each bad texture name during validation (see IValidatable.Validate).
BumpScale
Relative height of bump maps.
Instead of a normal map, a model may define a bump height map. In this case, a tangent-space normal map can be generated from the bump map, using the given bump height.
Defaults to 0
.
- See also
FixWinding
Fix vertex winding of indexed triangle list primitives?
If the model does not have normal vectors, vertex winding will never be fixed. This fix is applied after ReadModelFlags.FlipWinding.
Defaults to 0
.
GlossinessScale
Scale factor to apply to IMaterial.Glossiness. MaterialPart.Value of all read materials.
Defaults to 1.0
.
ModelNames
Names of the model nodes to keep, including their hierarchical structure.
If ReadModelFlags.ModelNames is present, this property is ignored.
ReflectivityScale
Modulation color to apply to IMaterial.Reflectivity. MaterialPart.Value of all read materials.
Defaults to ColorF.White.
Simplify
The model simplification actions that will be performed by IModelReader.ReadModel before returning the final IModel.
Defaults to ModelSimplifyFlags.All.
TexturePath
The base directory to use for resolving relative texture file paths in the 3D model.
The given base directory can be relative; in this case, it will be resolved using the path of the directory that contains the model file. If there is no path info for the model data (see IFileData.IsPathInfoValid), the current filesystem directory is used instead.
Defaults to Path.Current.
Transform
Optional transformation matrix to apply to the model geometry.
The transformation matrix is applied as the last transformation step, before the custom post processors are invoked.
Defaults to Mat4D.Identity.
Protected / Methods
ComputeNormals
Computes smooth per-vertex normal vectors given vertex arrays.
Vertex positions are read from Semantic.Position, non unit-length normal vectors are written to Semantic.Normal. If Semantic.Normal is already present, normal vectors will only be computed for vertex array entries that are equal to Vec3F.Zero. To produce per-face normals, vertices must have been duplicated accordingly, before this method is called.
- See also
NormalizeNormals
Normalizes the normal vectors in the given vertex arrays to unit-length.
Undefined normal vectors will be set to Vec3F.Zero.
- See also
PostProcessVertices
2 overloads
Returns a transformation matrix for performing post processing on vertex data:
Performs in-place post processing on the given vertex data:
ReadTextLine
Reads a line of text from stream in, using the CharacterEncodingSimple.ISO_8859_1 encoding.
- IOException
-
If an I/O error has occurred while reading from stream in.
TextureFile
2 overloads
Returns the model texture object that has been specified for the given texture file.
The model texture object for the given texture file in is obtained by the following steps:
-
The given texture path is resolved (see ResolveTexturePath).
-
If a model texture object has been specified earlier for the resolved texture path via TextureFileReplace, that object is used.
Returns the model texture object for the given texture file.
The model texture object for the given texture file in is obtained by the following steps:
-
The given texture path is resolved (see ResolveTexturePath).
-
If a model texture object has been specified earlier for the resolved texture path via TextureFileReplace, that object is used (the srgb in parameter is ignored in this case). Otherwise, a new model texture object is created and cached, using the canonical path value as the key.
- IOException
-
An I/O error has occurred while reading the image metadata in order to determine the texture format.
- ValidatingException
-
The image reader has reported an error while reading the image metadata for determining the texture format, for example because of a missing file format feature.
TextureName
2 overloads
Returns the model texture name replacement for the given texture name.
- See also
Returns the model texture object for the given texture name.
The model texture object for the given texture name in is obtained by the following steps:
-
The texture name in is replaced, according to the mappings that have been established earlier via TextureNameReplace. If there is no mapping for name in and it is an absolute path to a non-existent file, it will be replaced with the last path element (i.e. the file name).
-
The texture name is interpreted as a file path and resolved (see Path.Resolve) using the configured texture path (see TexturePath).
-
This method delegates to TextureFile2, using the resolved texture path.
- IOException
-
An I/O error has occurred while reading the image metadata in order to determine the texture format.
- ValidatingException
-
The image reader has reported an error while reading the image metadata for determining the texture format, for example because of a missing file format feature.