AMFP Enhanced
C++ reference: the code this unofficial fork added
Toggle main menu visibility
Loading...
Searching...
No Matches
MeshLoaderUfbx.h
Go to the documentation of this file.
1
/*
2
* AMFP-2026: .FBX loading through ufbx, in place of the Autodesk FBX SDK loader the original
3
* exe used (MeshLoaderFBX.cpp, compiled out with HPL_NO_FBX). Same results as that loader:
4
* it uses the .anm / .msh cache next to the file when it is newer, otherwise reads the FBX,
5
* builds the skeleton from the skin clusters' bind pose and samples each bone at its key
6
* times (FbxAnimTimes.h). Unlike that loader it never writes a cache into the game folder.
7
*
8
* Meshes are read from their .msh cache only for now (9 of the game's 10 FBX meshes ship one);
9
* animations are read from the FBX when no cache exists.
10
*/
11
#ifndef HPL_MESH_LOADER_UFBX_H
12
#define HPL_MESH_LOADER_UFBX_H
13
14
#include "math/MathTypes.h"
15
#include "resources/MeshLoader.h"
16
17
struct
ufbx_scene;
18
struct
ufbx_node;
19
struct
ufbx_anim_stack;
20
21
namespace
hpl
{
22
23
class
cMesh;
24
class
cBone;
25
class
cSkeleton;
26
class
cAnimation;
27
class
cMeshLoaderMSH;
28
29
class
cMeshLoaderUfbx
:
public
iMeshLoader
30
{
31
public
:
32
cMeshLoaderUfbx
(iLowLevelGraphics *apLowLevelGraphics, cMeshLoaderMSH *apMeshLoaderMSH,
bool
abLoadAndSaveMSHFormat);
33
~cMeshLoaderUfbx
();
34
35
cMesh*
LoadMesh
(
const
tWString& asFile, tMeshLoadFlag aFlags);
36
bool
SaveMesh
(cMesh* apMesh,
const
tWString& asFile) {
return
false
; }
37
38
cAnimation*
LoadAnimation
(
const
tWString& asFile);
39
bool
SaveAnimation
(cAnimation* apAnimation,
const
tWString& asFile) {
return
false
; }
40
41
/** Reads the animation from the FBX itself, ignoring and not writing any cache.
42
* Used by the dev check that compares against the original loader's .anm files. */
43
cAnimation*
LoadAnimationFromFbx
(
const
tWString& asFile);
44
45
private
:
46
cSkeleton* BuildSkeleton(ufbx_scene* apScene);
47
void
LoadSkeletonRec(cBone* apBone, ufbx_node* apNode);
48
void
LoadBindPoseRec(cSkeleton* apSkeleton, ufbx_node* apNode);
49
void
MakeFinalBonesRec(cBone* apBone, cMatrixf a_mtxParentGlobal, cMatrixf a_mtxParentGlobalUnscaled);
50
void
LoadAnimationRec(ufbx_scene* apScene, ufbx_anim_stack* apStack, ufbx_node* apNode, cAnimation* apAnimation, cSkeleton* apSkeleton);
51
52
cMeshLoaderMSH *mpMeshLoaderMSH;
53
bool
mbLoadAndSaveMSHFormat;
54
};
55
56
};
57
#endif
// HPL_MESH_LOADER_UFBX_H
hpl::cMeshLoaderUfbx::SaveAnimation
bool SaveAnimation(cAnimation *apAnimation, const tWString &asFile)
Definition
MeshLoaderUfbx.h:39
hpl::cMeshLoaderUfbx::SaveMesh
bool SaveMesh(cMesh *apMesh, const tWString &asFile)
Definition
MeshLoaderUfbx.h:36
hpl::cMeshLoaderUfbx::LoadAnimationFromFbx
cAnimation * LoadAnimationFromFbx(const tWString &asFile)
Reads the animation from the FBX itself, ignoring and not writing any cache.
hpl::cMeshLoaderUfbx::LoadAnimation
cAnimation * LoadAnimation(const tWString &asFile)
hpl::cMeshLoaderUfbx::cMeshLoaderUfbx
cMeshLoaderUfbx(iLowLevelGraphics *apLowLevelGraphics, cMeshLoaderMSH *apMeshLoaderMSH, bool abLoadAndSaveMSHFormat)
hpl::cMeshLoaderUfbx::~cMeshLoaderUfbx
~cMeshLoaderUfbx()
hpl::cMeshLoaderUfbx::LoadMesh
cMesh * LoadMesh(const tWString &asFile, tMeshLoadFlag aFlags)
hpl
Definition
ShadowMapSizes.h:8
HPL2
core
include
impl
MeshLoaderUfbx.h
Generated by
1.18.0