|
ModelViewer 0.1
Template for CPP projects
|
Class for managing model loading and providing geometry and material. More...
#include <ModelManager.hpp>


Signals | |
| void | geometryChanged () |
| Signal emitted when the geometry changes. | |
| void | materialChanged () |
| Signal emitted when the material changes. | |
| void | loadingChanged () |
| Signal emitted when the loading state changes. | |
| void | readyChanged () |
| Signal emitted when the ready state changes. | |
Public Member Functions | |
| ModelManager (QObject *parent=nullptr) | |
| Constructor. | |
| ~ModelManager () override=default | |
| Destructor. | |
| QQuick3DGeometry * | geometry () const |
| Get the geometry of the loaded model. | |
| material::MTLMaterial * | material () const |
| Get the material of the loaded model. | |
| Q_INVOKABLE void | loadModel (const QString &filepath) |
| Load a model from a file asynchronously. | |
| bool | isLoading () const |
| Check if a model is currently loading. | |
| void | setLoading (bool isLoading) |
| Set the loading state, emits loadingChanged signal. | |
| bool | isReady () const |
| Check if a model is ready. | |
| void | setReady (bool isReady) |
| Set the ready state, emits readyChanged signal. | |
| const std::unordered_map< std::string, loaders::ILoader * > & | getLoaders () const |
Properties | |
| QQuick3DGeometry * | geometry |
| model_viewer::material::MTLMaterial * | material |
| bool | loading |
| bool | ready |
Private Attributes | |
| loaders::ObjLoader | _objLoader |
| OBJ loader instance. | |
| std::unordered_map< std::string, loaders::ILoader * > | _loaders |
| Map of file extensions to their respective loaders. | |
| loaders::ILoader * | _lastLoaded = &_objLoader |
| Pointer to the last used loader. | |
| std::unique_ptr< geometry::ObjGeometry > | _geometry |
| Geometry of the currently loaded model. | |
| bool | _loading = false |
| Boolean indicating if a model is currently loading. | |
| bool | _ready = false |
| Boolean indicating if a model is ready. | |
Class for managing model loading and providing geometry and material.
|
explicit |
Constructor.
| parent | Parent QObject, nullptr by default |
References _loaders, and _objLoader.
|
overridedefault |
Destructor.
|
inline |
Get the geometry of the loaded model.
References _lastLoaded, and model_viewer::loaders::ILoader::geometry().

|
signal |
Signal emitted when the geometry changes.
Referenced by loadModel().

|
inline |
|
inline |
Check if a model is currently loading.
References _loading.
Referenced by setLoading().

|
inline |
Check if a model is ready.
References _ready.
Referenced by setReady().

|
signal |
Signal emitted when the loading state changes.
Referenced by setLoading().

| void model_viewer::ModelManager::loadModel | ( | const QString & | filepath | ) |
Load a model from a file asynchronously.
Emits geometryChanged and materialChanged signals upon completion and is invokable from QML
| filepath | Path to the model file |
References _lastLoaded, _loaders, geometryChanged(), materialChanged(), and setReady().

|
inline |
Get the material of the loaded model.
References _lastLoaded, and model_viewer::loaders::ILoader::material().

|
signal |
Signal emitted when the material changes.
Referenced by loadModel().

|
signal |
Signal emitted when the ready state changes.
Referenced by setReady().

| void model_viewer::ModelManager::setLoading | ( | bool | isLoading | ) |
Set the loading state, emits loadingChanged signal.
| isLoading | New loading state |
References _loading, isLoading(), and loadingChanged().
Referenced by setReady().


| void model_viewer::ModelManager::setReady | ( | bool | isReady | ) |
Set the ready state, emits readyChanged signal.
| isReady | New ready state |
References _ready, isReady(), readyChanged(), and setLoading().
Referenced by loadModel().


|
private |
Geometry of the currently loaded model.
|
private |
Pointer to the last used loader.
Referenced by geometry(), loadModel(), and material().
|
private |
Map of file extensions to their respective loaders.
Referenced by getLoaders(), loadModel(), and ModelManager().
|
private |
Boolean indicating if a model is currently loading.
Referenced by isLoading(), and setLoading().
|
private |
OBJ loader instance.
Referenced by ModelManager().
|
private |
Boolean indicating if a model is ready.
Referenced by isReady(), and setReady().
|
read |
|
read |
|
read |
|
read |