![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <obj_reader.hpp>
Classes | |
struct | OBJComparator |
Public Member Functions | |
OBJReader (ResourceManager &resource_manager, ModelOutput< VertexT, IndexT > &model_output, const MeshDescriptor< VertexT, IndexT > &mesh_desc) | |
OBJReader (const OBJReader &reader)=delete | |
OBJReader (OBJReader &&reader) noexcept | |
~OBJReader () | |
OBJReader & | operator= (const OBJReader &reader)=delete |
OBJReader & | operator= (OBJReader &&reader)=delete |
void | ReadFromFile (std::filesystem::path path, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
void | ReadFromMemory (const std::string &input, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
Private Member Functions | |
virtual void | Preprocess () override |
virtual void | ReadLine () override |
virtual void | Postprocess () override |
void | ReadOBJMaterialLibrary () |
void | ReadOBJMaterialUse () |
void | ReadOBJGroup () |
void | ReadOBJObject () |
void | ReadOBJSmoothingGroup () |
void | ReadOBJVertex () |
void | ReadOBJVertexTexture () |
void | ReadOBJVertexNormal () |
void | ReadOBJFace () |
const Point3 | ReadOBJVertexCoordinates () |
const Normal3 | ReadOBJVertexNormalCoordinates () |
const UV | ReadOBJVertexTextureCoordinates () |
const U32x3 | ReadOBJVertexIndices () |
const VertexT | ConstructVertex (const U32x3 &vertex_indices) |
void | FinalizeModelPart () |
![]() | |
LineReader & | operator= (const LineReader &reader)=delete |
LineReader & | operator= (LineReader &&reader) noexcept |
void | ReadFromFile (std::filesystem::path path, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
void | ReadFromMemory (const std::string &input, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
LineReader () | |
LineReader (const LineReader &reader)=delete | |
LineReader (LineReader &&reader) noexcept | |
~LineReader () | |
const std::filesystem::path & | GetPath () const noexcept |
U32 | GetCurrentLineNumber () const noexcept |
template<typename T > | |
const T | Read () |
template<typename T , std::size_t N, size_t A = alignof(T)> | |
const Array< T, N, A > | Read () |
void | ReadRemainingTokens () |
template<typename T > | |
bool | Contains () const noexcept |
bool | ContainsTokens () const noexcept |
Private Attributes | |
ModelPart | m_model_part |
std::vector< Point3 > | m_vertex_coordinates |
std::vector< UV > | m_vertex_texture_coordinates |
std::vector< Normal3 > | m_vertex_normal_coordinates |
std::map< U32x3, IndexT, OBJComparator > | m_mapping |
ResourceManager & | m_resource_manager |
ModelOutput< VertexT, IndexT > & | m_model_output |
const MeshDescriptor< VertexT, IndexT > & | m_mesh_desc |
Additional Inherited Members | |
![]() | |
using | SelectionFunction = std::function< const std::ssub_match(const std::smatch &) > |
![]() | |
static const std::regex | s_default_regex = std::regex(R"((\"([^\"]*)\")|(\S+))") |
static const SelectionFunction | s_default_selection_function |
A class of OBJ file readers for reading meshes.
VertexT | The vertex type. |
IndexT | The index type. |
|
explicit |
Constructs an OBJ reader.
[in,out] | resource_manager | A reference to the resource manager. |
[in,out] | model_output | A reference to a model output for storing the read data from file. |
[in] | mesh_desc | A reference to a mesh descriptor. |
|
delete |
Constructs an OBJ reader from the given OBJ reader.
[in] | reader | A reference to the OBJ reader to copy. |
|
noexcept |
Constructs an OBJ reader by moving the given OBJ reader.
[in] | reader | A reference to the OBJ reader to move. |
mage::rendering::loader::OBJReader< VertexT, IndexT >::~OBJReader | ( | ) |
Destructs this OBJ reader.
|
private |
Constructs or retrieves (if already existing) the vertex matching the given vertex indices.
[in] | vertex_indices | A reference to the vertex indices. |
|
private |
Finalizes the current model part of this OBJ reader and prepare a new current model part.
|
delete |
Copies the given OBJ reader to this OBJ reader.
[in] | reader | A reference to a OBJ reader to copy. |
|
delete |
Moves the given OBJ reader to this OBJ reader.
[in] | reader | A reference to a OBJ reader to move. |
|
overrideprivatevirtual |
Post-processes after reading the current file of this OBJ reader.
Exception | Failed to finish post-processing successfully. |
Reimplemented from mage::LineReader.
|
overrideprivatevirtual |
Pre-process before reading the current file of this OBJ reader.
Exception | Failed to finish the pre-processing successfully. |
Reimplemented from mage::LineReader.
void mage::LineReader::ReadFromFile |
Reads from the file associated with the given path.
[in] | path | The path. |
[in] | regex | The (line) regex. |
[in] | selection_function | The selection function. |
Exception | Failed to read from the file. |
void mage::LineReader::ReadFromMemory |
Reads from the given input string.
[in] | input | A reference to the input string. |
[in] | regex | The (line) regex. |
[in] | selection_function | The selection function. |
Exception | Failed to read from the given input string. |
|
overrideprivatevirtual |
Reads the current line of this OBJ reader.
Exception | Failed to the current line of this OBJ reader. |
Implements mage::LineReader.
|
private |
Reads a Face definition.
Exception | Failed to read a Face definition. |
|
private |
Reads a Group definition.
Exception | Failed to read a Group definition. |
|
private |
|
private |
|
private |
Reads an Object definition.
Exception | Failed to read a Object definition. |
|
private |
Reads a Smoothing Group definition.
Exception | Failed to read a Smoothing Group definition. |
|
private |
Reads a Vertex Position Coordinates definition.
Exception | Failed to read a Vertex Position Coordinates definition. |
|
private |
|
private |
Reads a set of vertex indices.
Exception | Failed to read the vertex indices. |
|
private |
Reads a Vertex Normal Coordinates definition.
Exception | Failed to read a Vertex Normal Coordinates definition. |
|
private |
|
private |
|
private |
|
private |
A mapping between vertex position/texture/normal coordinates' indices and the index of a vertex in the vertex buffer (m_model_output
) of this OBJ reader.
|
private |
A reference to the mesh descriptor for this OBJ reader.
|
private |
A reference to a model output containing the read data of this OBJ reader.
|
private |
The current model part of this OBJ reader.
|
private |
A reference to the resource manager of this OBJ reader.
|
private |
A vector containing the read vertex position coordinates of this OBJ reader.
|
private |
A vector containing the read normal texture coordinates of this OBJ reader.
|
private |
A vector containing the read vertex texture coordinates of this OBJ reader.