MAGE  v0.171.0
Matthias Advanced Game Engine
mage::rendering::loader Namespace Reference

Namespaces

 anonymous_namespace{texture_loader.cpp}
 

Classes

class  MDLReader
 
class  MDLWriter
 
class  MSHReader
 
class  MSHWriter
 
class  MTLReader
 
class  OBJReader
 
class  SpriteFontReader
 

Functions

void ImportFontFromFile (const std::filesystem::path &path, ID3D11Device &device, SpriteFontOutput &output, const SpriteFontDescriptor &desc)
 
void ImportMaterialFromFile (const std::filesystem::path &path, ResourceManager &resource_manaer, std::vector< Material > &materials)
 
template<typename VertexT , typename IndexT >
void ImportMDLModelFromFile (const std::filesystem::path &path, const ResourceManager &resource_manager, ModelOutput< VertexT, IndexT > &model_output)
 
template<typename VertexT , typename IndexT >
void ExportMDLModelToFile (const std::filesystem::path &path, const ModelOutput< VertexT, IndexT > &model_output)
 
template<typename VertexT , typename IndexT >
void ImportModelFromFile (const std::filesystem::path &path, ResourceManager &resource_manager, ModelOutput< VertexT, IndexT > &model_output, const MeshDescriptor< VertexT, IndexT > &mesh_desc=MeshDescriptor< VertexT, IndexT >())
 
template<typename VertexT , typename IndexT >
void ExportModelToFile (const std::filesystem::path &path, const ModelOutput< VertexT, IndexT > &model_output)
 
template<typename VertexT , typename IndexT >
void ImportMSHMeshFromFile (const std::filesystem::path &path, std::vector< VertexT > &vertices, std::vector< IndexT > &indices)
 
template<typename VertexT , typename IndexT >
void ExportMSHMeshToFile (const std::filesystem::path &path, const std::vector< VertexT > &vertices, const std::vector< IndexT > &indices)
 
void ImportMTLMaterialFromFile (const std::filesystem::path &path, ResourceManager &resource_manager, std::vector< Material > &materials)
 
template<typename VertexT , typename IndexT >
void ImportOBJMeshFromFile (const std::filesystem::path &path, ResourceManager &resource_manager, ModelOutput< VertexT, IndexT > &model_output, const MeshDescriptor< VertexT, IndexT > &mesh_desc=MeshDescriptor< VertexT, IndexT >())
 
void ImportSpriteFontFromFile (const std::filesystem::path &path, ID3D11Device &device, SpriteFontOutput &output, const SpriteFontDescriptor &desc)
 
void ImportTextureFromFile (const std::filesystem::path &path, ID3D11Device &device, NotNull< ID3D11ShaderResourceView ** > texture_srv)
 
void ExportTextureToFile (const std::filesystem::path &path, ID3D11DeviceContext &device_context, ID3D11Resource &texture)
 

Variables

constexpr const_zstring g_font_token_magic = "MAGEfont"
 
constexpr const char g_mdl_token_comment = '#'
 
constexpr const_zstring g_mdl_token_submodel = "s"
 
constexpr const_zstring g_mdl_token_material_library = "mtllib"
 
constexpr const_zstring g_msh_token_magic = "MAGEmesh"
 
constexpr const char g_mtl_token_comment = '#'
 
constexpr const_zstring g_mtl_token_material_declaration = "newmtl"
 
constexpr const_zstring g_mtl_token_base_color = "base_color"
 
constexpr const_zstring g_mtl_token_roughness = "roughness"
 
constexpr const_zstring g_mtl_token_metalness = "metalness"
 
constexpr const_zstring g_mtl_token_radiance = "radiance"
 
constexpr const_zstring g_mtl_token_base_color_texture = "texture_base_color"
 
constexpr const_zstring g_mtl_token_material_texture = "texture_material"
 
constexpr const_zstring g_mtl_token_normal_texture = "texture_normal"
 
constexpr const_zstring g_mtl_token_transparent = "transparent"
 
constexpr const_zstring g_mtl_token_opaque = "opaque"
 
constexpr const char g_obj_token_comment = '#'
 
constexpr const_zstring g_obj_token_vertex = "v"
 
constexpr const_zstring g_obj_token_texture = "vt"
 
constexpr const_zstring g_obj_token_normal = "vn"
 
constexpr const_zstring g_obj_token_face = "f"
 
constexpr const_zstring g_obj_token_material_library = "mtllib"
 
constexpr const_zstring g_obj_token_material_use = "usemtl"
 
constexpr const_zstring g_obj_token_group = "g"
 
constexpr const_zstring g_obj_token_object = "o"
 
constexpr const_zstring g_obj_token_smoothing_group = "s"
 

Function Documentation

◆ ExportMDLModelToFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ExportMDLModelToFile ( const std::filesystem::path &  path,
const ModelOutput< VertexT, IndexT > &  model_output 
)

Exports the given model to the MDL file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]pathA reference to the path.
[in]model_outputA reference to the model output.
Exceptions
ExceptionFailed to export the model to file.

◆ ExportModelToFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ExportModelToFile ( const std::filesystem::path &  path,
const ModelOutput< VertexT, IndexT > &  model_output 
)

Exports the model to the file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]pathA reference to the path.
[in]model_outputA reference to the model output.
Exceptions
ExceptionFailed to export the model to file.

◆ ExportMSHMeshToFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ExportMSHMeshToFile ( const std::filesystem::path &  path,
const std::vector< VertexT > &  vertices,
const std::vector< IndexT > &  indices 
)

Exports the given mesh to the MSH file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]pathA reference to the path.
[in]verticesA reference to a vector containing the vertices of the mesh.
[in]indicesA reference to a vector containing the indices of the mesh.
Exceptions
ExceptionFailed to export the mesh to file.

◆ ExportTextureToFile()

void mage::rendering::loader::ExportTextureToFile ( const std::filesystem::path &  path,
ID3D11DeviceContext &  device_context,
ID3D11Resource &  texture 
)

Exports the texture to the file associated with the given path.

Parameters
[in]pathA reference to the path.
[in,out]device_contextA reference to the device context.
[in,out]textureA reference to the texture.
Exceptions
ExceptionFailed to export the texture to file.

◆ ImportFontFromFile()

void mage::rendering::loader::ImportFontFromFile ( const std::filesystem::path &  path,
ID3D11Device &  device,
SpriteFontOutput output,
const SpriteFontDescriptor desc = SpriteFontDescriptor() 
)

Imports the font from the FONT file associated with the given path.

Parameters
[in]pathA reference to the path.
[in,out]deviceA reference to the device.
[in,out]outputA reference to the sprite font output.
[in]descA reference to the sprite font descriptor.
Exceptions
ExceptionFailed to import the sprite font from file.

◆ ImportMaterialFromFile()

void mage::rendering::loader::ImportMaterialFromFile ( const std::filesystem::path &  path,
ResourceManager resource_manaer,
std::vector< Material > &  materials 
)

Imports the materials from the file associated with the given path.

Parameters
[in]pathA reference to the path.
[in,out]resource_manaerA reference to the resource manager.
[in,out]materialsA reference to a vector containing the materials.
Exceptions
ExceptionFailed to import the materials from file.

◆ ImportMDLModelFromFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ImportMDLModelFromFile ( const std::filesystem::path &  path,
const ResourceManager resource_manager,
ModelOutput< VertexT, IndexT > &  model_output 
)

Imports the model from the MDL file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]resource_managerA reference to the resource manager.
[in]pathA reference to the path.
[in,out]model_outputA reference to the model output.
Exceptions
ExceptionFailed to import the model from file.

◆ ImportModelFromFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ImportModelFromFile ( const std::filesystem::path &  path,
ResourceManager resource_manager,
ModelOutput< VertexT, IndexT > &  model_output,
const MeshDescriptor< VertexT, IndexT > &  mesh_desc = MeshDescriptor< VertexT, IndexT >() 
)

Imports the model from the file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]pathA reference to the path.
[in,out]resource_managerA reference to the resource manager.
[in,out]model_outputA reference to the model output.
[in]mesh_descA reference to the mesh descriptor.
Exceptions
ExceptionFailed to import the model from file.

◆ ImportMSHMeshFromFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ImportMSHMeshFromFile ( const std::filesystem::path &  path,
std::vector< VertexT > &  vertices,
std::vector< IndexT > &  indices 
)

Imports the mesh from the MSH file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]pathA reference to the path.
[in,out]verticesA reference to a vector containing the vertices of the mesh.
[in,out]indicesA reference to a vector containing the indices of the mesh.
Exceptions
ExceptionFailed to import the mesh from file.

◆ ImportMTLMaterialFromFile()

void mage::rendering::loader::ImportMTLMaterialFromFile ( const std::filesystem::path &  path,
ResourceManager resource_manager,
std::vector< Material > &  materials 
)

Imports the materials from the MTL file associated with the given path.

Parameters
[in]pathA reference to the path.
[in,out]resource_managerA reference to the resource manager.
[in,out]materialsA reference to a vector containing the materials.
Exceptions
ExceptionFailed to import the mesh from file.

◆ ImportOBJMeshFromFile()

template<typename VertexT , typename IndexT >
void mage::rendering::loader::ImportOBJMeshFromFile ( const std::filesystem::path &  path,
ResourceManager resource_manager,
ModelOutput< VertexT, IndexT > &  model_output,
const MeshDescriptor< VertexT, IndexT > &  mesh_desc = MeshDescriptor< VertexT, IndexT >() 
)

Imports a mesh from the OBJ file associated with the given path.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in]pathA reference to the path.
[in,out]resource_managerA reference to the resource manager.
[in,out]model_outputA reference to the model output.
[in]mesh_descA reference to the mesh descriptor.
Exceptions
ExceptionFailed to import the mesh from file.

◆ ImportSpriteFontFromFile()

void mage::rendering::loader::ImportSpriteFontFromFile ( const std::filesystem::path &  path,
ID3D11Device &  device,
SpriteFontOutput output,
const SpriteFontDescriptor desc = SpriteFontDescriptor() 
)

Imports the sprite font from the file associated with the given path.

Parameters
[in]pathA reference to the path.
[in,out]deviceA reference to the device.
[in,out]outputA reference to the sprite font output.
[in]descA reference to the sprite font descriptor.
Exceptions
ExceptionFailed to import the sprite font from file.

◆ ImportTextureFromFile()

void mage::rendering::loader::ImportTextureFromFile ( const std::filesystem::path &  path,
ID3D11Device &  device,
NotNull< ID3D11ShaderResourceView **>  texture_srv 
)

Imports the texture from the file associated with the given path.

Parameters
[in]pathA reference to the path.
[in,out]deviceA reference to the device.
[out]texture_srvA pointer to a pointer to a shader resource view.
Exceptions
ExceptionFailed to import the texture from file.

Variable Documentation

◆ g_font_token_magic

constexpr const_zstring mage::rendering::loader::g_font_token_magic = "MAGEfont"

◆ g_mdl_token_comment

constexpr const char mage::rendering::loader::g_mdl_token_comment = '#'

◆ g_mdl_token_material_library

constexpr const_zstring mage::rendering::loader::g_mdl_token_material_library = "mtllib"

◆ g_mdl_token_submodel

constexpr const_zstring mage::rendering::loader::g_mdl_token_submodel = "s"

◆ g_msh_token_magic

constexpr const_zstring mage::rendering::loader::g_msh_token_magic = "MAGEmesh"

◆ g_mtl_token_base_color

constexpr const_zstring mage::rendering::loader::g_mtl_token_base_color = "base_color"

◆ g_mtl_token_base_color_texture

constexpr const_zstring mage::rendering::loader::g_mtl_token_base_color_texture = "texture_base_color"

◆ g_mtl_token_comment

constexpr const char mage::rendering::loader::g_mtl_token_comment = '#'

◆ g_mtl_token_material_declaration

constexpr const_zstring mage::rendering::loader::g_mtl_token_material_declaration = "newmtl"

◆ g_mtl_token_material_texture

constexpr const_zstring mage::rendering::loader::g_mtl_token_material_texture = "texture_material"

◆ g_mtl_token_metalness

constexpr const_zstring mage::rendering::loader::g_mtl_token_metalness = "metalness"

◆ g_mtl_token_normal_texture

constexpr const_zstring mage::rendering::loader::g_mtl_token_normal_texture = "texture_normal"

◆ g_mtl_token_opaque

constexpr const_zstring mage::rendering::loader::g_mtl_token_opaque = "opaque"

◆ g_mtl_token_radiance

constexpr const_zstring mage::rendering::loader::g_mtl_token_radiance = "radiance"

◆ g_mtl_token_roughness

constexpr const_zstring mage::rendering::loader::g_mtl_token_roughness = "roughness"

◆ g_mtl_token_transparent

constexpr const_zstring mage::rendering::loader::g_mtl_token_transparent = "transparent"

◆ g_obj_token_comment

constexpr const char mage::rendering::loader::g_obj_token_comment = '#'

◆ g_obj_token_face

constexpr const_zstring mage::rendering::loader::g_obj_token_face = "f"

◆ g_obj_token_group

constexpr const_zstring mage::rendering::loader::g_obj_token_group = "g"

◆ g_obj_token_material_library

constexpr const_zstring mage::rendering::loader::g_obj_token_material_library = "mtllib"

◆ g_obj_token_material_use

constexpr const_zstring mage::rendering::loader::g_obj_token_material_use = "usemtl"

◆ g_obj_token_normal

constexpr const_zstring mage::rendering::loader::g_obj_token_normal = "vn"

◆ g_obj_token_object

constexpr const_zstring mage::rendering::loader::g_obj_token_object = "o"

◆ g_obj_token_smoothing_group

constexpr const_zstring mage::rendering::loader::g_obj_token_smoothing_group = "s"

◆ g_obj_token_texture

constexpr const_zstring mage::rendering::loader::g_obj_token_texture = "vt"

◆ g_obj_token_vertex

constexpr const_zstring mage::rendering::loader::g_obj_token_vertex = "v"