Importing Morph Meshes¶
Morph-Meshes are triangular 3d models which can have animations on each vertex. They are used for mouth-movement animations on talking characters or flags moving in the wind.
In Gothic, all human characters are using morph meshes as heads.
Note
Morph-meshes are not completely supported by ZenLib, so only a static representation will be imported.
The following example will load and cache a morph-mesh:
Res::HMeshWithMaterials head = BsZenLib::ImportAndCacheMorphMesh("HEAD.MMB", vdfs);
Where vdfs
is a VDFS FileIndex containing HEAD.MMB
.
-
namespace
BsZenLib
Functions
-
Res::HMeshWithMaterials
ImportAndCacheMorphMesh
(const bs::String &originalFileName, const VDFS::FileIndex &vdfs)¶ Import a Gothic Morph-Mesh and save the results to disk.
Imports the given Morph-Mesh and saves them into the cache-folder. The imported Morph-Mesh will also be added to the default resource manifest.
- Return
- Handle to the cached mesh (Empty handle if none was found)
- Parameters
originalFileName
: Name of the MorphMesh in the original games files (ie.HEAD.MMB
)vdfs
: Virtual Filesystem to load the MorphMesh from.
-
Res::HMeshWithMaterials
LoadCachedMorphMesh
(const bs::String &originalFileName)¶ Load a cached MorphMesh from disk using the original files name.
Given the name of the MorphMesh used in the original game files (ie. “HEAD.MMB”), this function will search for a cached version representing that MorphMesh.
If unsure whether the cached file exists, call HasCachedMorphMesh(). To create the cache, call ImportAndCacheMorphMesh() first.
- Return
- Handle to the cached MorphMesh (Empty handle if none was found)
- Parameters
originalFileName
: Name of the MorphMesh in the original games files (ie.HEAD.MMB
)
-
bool
HasCachedMorphMesh
(const bs::String &originalFileName)¶ Checks whether the cache for the given original MorphMesh name exists.
To create the cache, call ImportAndCacheMorphMesh().
- Return
- Whether the cache exists for the given MorphMesh.
- Parameters
originalFileName
: Name of the MorphMesh in the original games files (ie.HEAD.MMB
)
-
Res::HMeshWithMaterials