Finality Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
ModelAsset.h
Go to the documentation of this file.
1
11
#pragma once
12
13
#include <
Core/Core.h
>
14
#include "
MeshImporter.h
"
15
#include "
ModelImportOptions.h
"
16
#include <filesystem>
17
#include <map>
18
19
namespace
FINALITY
20
{
21
class
Scene
;
22
class
Entity
;
23
struct
RenderPacket
;
24
26
struct
ModelMesh
27
{
28
std::string
Name
;
29
std::string
Key
;
30
uint32_t
Material
= 0;
31
MeshGeometry
Geometry
;
32
};
33
35
struct
ModelMaterial
36
{
37
std::string
Name
;
38
glm::vec4
Color
{1};
39
std::string
Texture
;
40
std::string
Asset
;
41
bool
DoubleSided
=
false
;
42
std::map<std::string,std::string>
Properties
;
43
};
44
46
struct
ModelNode
47
{
48
std::string
Name
;
49
int
Parent
= -1;
50
glm::mat4
Transform
{1};
51
std::vector<uint32_t>
Meshes
;
52
};
53
55
struct
ModelData
56
{
57
std::vector<ModelMesh>
Meshes
;
58
std::vector<ModelMaterial>
Materials
;
59
std::vector<ModelNode>
Nodes
;
60
std::vector<std::string>
Dependencies
;
61
std::vector<std::string>
Diagnostics
;
62
glm::vec3
Minimum
{0},
Maximum
{0};
63
};
64
74
class
FAPI
ModelAsset
75
{
76
public
:
77
static
void
Configure
(
const
std::filesystem::path& engineAssets,
const
ModelImportOptions
& options = {});
78
static
std::shared_ptr<ModelData>
Load
(
const
std::string& reference,
bool
force =
false
);
79
static
bool
Import
(
const
std::filesystem::path& source,
const
std::filesystem::path& target);
80
static
void
MakePortable
(
const
std::filesystem::path& path,
const
std::filesystem::path& sourceDirectory = {});
81
static
std::shared_ptr<Mesh>
LoadMesh
(
const
std::string& reference);
82
static
Entity
Instantiate
(
Scene
& scene,
const
std::string& reference);
83
static
std::vector<RenderPacket>
BuildPreview
(
const
std::string& reference);
84
static
void
Clear
();
85
static
bool
Supports
(
const
std::filesystem::path& path);
86
static
ModelImportOptions
GetImportOptions
(
const
std::string& reference);
87
static
bool
SaveImportOptions
(
const
std::string& reference,
const
ModelImportOptions
& options, std::string& error);
88
static
bool
ExtractMaterials
(
const
std::string& reference,
const
std::filesystem::path& directory, std::string& error);
89
};
90
}
Core.h
FAPI
#define FAPI
Definition
Core.h:22
MeshImporter.h
ModelImportOptions.h
Defines model conversion and import policy.
FINALITY::Entity
Provides a scene-bound handle for component and hierarchy operations.
Definition
Entity.h:34
FINALITY::ModelAsset
Loads imported model data and instantiates preserved model hierarchies.
Definition
ModelAsset.h:75
FINALITY::ModelAsset::Instantiate
static Entity Instantiate(Scene &scene, const std::string &reference)
FINALITY::ModelAsset::MakePortable
static void MakePortable(const std::filesystem::path &path, const std::filesystem::path &sourceDirectory={})
FINALITY::ModelAsset::Configure
static void Configure(const std::filesystem::path &engineAssets, const ModelImportOptions &options={})
FINALITY::ModelAsset::Load
static std::shared_ptr< ModelData > Load(const std::string &reference, bool force=false)
FINALITY::ModelAsset::Supports
static bool Supports(const std::filesystem::path &path)
FINALITY::ModelAsset::ExtractMaterials
static bool ExtractMaterials(const std::string &reference, const std::filesystem::path &directory, std::string &error)
FINALITY::ModelAsset::GetImportOptions
static ModelImportOptions GetImportOptions(const std::string &reference)
FINALITY::ModelAsset::LoadMesh
static std::shared_ptr< Mesh > LoadMesh(const std::string &reference)
FINALITY::ModelAsset::Import
static bool Import(const std::filesystem::path &source, const std::filesystem::path &target)
FINALITY::ModelAsset::BuildPreview
static std::vector< RenderPacket > BuildPreview(const std::string &reference)
FINALITY::ModelAsset::SaveImportOptions
static bool SaveImportOptions(const std::string &reference, const ModelImportOptions &options, std::string &error)
FINALITY::ModelAsset::Clear
static void Clear()
FINALITY::Scene
Owns entities and dispatches script simulation.
Definition
Scene.h:36
FINALITY
Definition
Asset.h:12
FINALITY::MeshGeometry
Definition
MeshImporter.h:14
FINALITY::ModelData
Imported nodes, submeshes, materials, dependencies, diagnostics and model-space bounds.
Definition
ModelAsset.h:56
FINALITY::ModelData::Dependencies
std::vector< std::string > Dependencies
Definition
ModelAsset.h:60
FINALITY::ModelData::Materials
std::vector< ModelMaterial > Materials
Definition
ModelAsset.h:58
FINALITY::ModelData::Minimum
glm::vec3 Minimum
Definition
ModelAsset.h:62
FINALITY::ModelData::Nodes
std::vector< ModelNode > Nodes
Definition
ModelAsset.h:59
FINALITY::ModelData::Maximum
glm::vec3 Maximum
Definition
ModelAsset.h:62
FINALITY::ModelData::Meshes
std::vector< ModelMesh > Meshes
Definition
ModelAsset.h:57
FINALITY::ModelData::Diagnostics
std::vector< std::string > Diagnostics
Definition
ModelAsset.h:61
FINALITY::ModelImportOptions
Definition
ModelImportOptions.h:17
FINALITY::ModelMaterial
Imported material appearance, texture reference and extracted asset mapping.
Definition
ModelAsset.h:36
FINALITY::ModelMaterial::DoubleSided
bool DoubleSided
Definition
ModelAsset.h:41
FINALITY::ModelMaterial::Texture
std::string Texture
Definition
ModelAsset.h:39
FINALITY::ModelMaterial::Color
glm::vec4 Color
Definition
ModelAsset.h:38
FINALITY::ModelMaterial::Properties
std::map< std::string, std::string > Properties
Definition
ModelAsset.h:42
FINALITY::ModelMaterial::Asset
std::string Asset
Definition
ModelAsset.h:40
FINALITY::ModelMaterial::Name
std::string Name
Definition
ModelAsset.h:37
FINALITY::ModelMesh
One imported submesh, with geometry and an index into ModelData::Materials.
Definition
ModelAsset.h:27
FINALITY::ModelMesh::Name
std::string Name
Definition
ModelAsset.h:28
FINALITY::ModelMesh::Geometry
MeshGeometry Geometry
Definition
ModelAsset.h:31
FINALITY::ModelMesh::Material
uint32_t Material
Definition
ModelAsset.h:30
FINALITY::ModelMesh::Key
std::string Key
Definition
ModelAsset.h:29
FINALITY::ModelNode
One hierarchy node with a parent index, local transform and attached mesh indices.
Definition
ModelAsset.h:47
FINALITY::ModelNode::Meshes
std::vector< uint32_t > Meshes
Definition
ModelAsset.h:51
FINALITY::ModelNode::Transform
glm::mat4 Transform
Definition
ModelAsset.h:50
FINALITY::ModelNode::Name
std::string Name
Definition
ModelAsset.h:48
FINALITY::ModelNode::Parent
int Parent
Definition
ModelAsset.h:49
FINALITY::RenderPacket
Scene draw submission retaining geometry, material and visibility inputs until backend recording.
Definition
RenderDevice.h:36
FinalityEngine
src
Assets
ModelAsset.h
Generated by
1.18.0