utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
model.hpp
1/*
2** ETIB PROJECT, 2026
3** xider
4** File description:
5** model
6*/
7
8#pragma once
9
10#include <sstream>
11#include <filesystem>
12#include <istream>
13#include <iostream>
14
15#include <tiny_obj_loader.h>
16
17#include <utility/system_io/file.hpp>
18
19#include <utility/graphic/renderable.hpp>
20#include <utility/graphic/size.hpp>
21
24
25namespace utility::graphic
26{
37 class Model:
38 public Renderable,
39 protected utility::logging::Loggable<Model,
40 utility::logging::DefaultLogger>
41 {
42 public:
52 enum class ModelType {
53 OBJ,
54 FBX, // Not implemented yet
55 GLTF, // Not implemented yet
56 // Add more model types as needed
57 };
58
76 Model(std::shared_ptr<utility::File> modelAsset, const PoseF &pose,
77 uint32_t materialID);
78
94 Model(std::shared_ptr<utility::File> modelAsset, ModelType type,
95 const PoseF &pose, uint32_t materialID);
96
100 ~Model() = default;
101
108 [[nodiscard]] ModelType type() const;
109
116
122 uint32_t getMaterialID(void) const;
123
124 protected:
140 void loadOBJ(std::shared_ptr<utility::File> modelAsset);
141
145
146 uint32_t _materialID;
147
148 using Loggable::getLogger;
149 };
150} // namespace utility::graphic
The Model class represents a 3D model in the graphics application.
Definition model.hpp:41
ModelType
The ModelType enum represents the different types of 3D models that can be loaded and rendered in the...
Definition model.hpp:52
utility::graphic::SizeF _boundingBox
The bounding box of the model.
Definition model.hpp:144
~Model()=default
Destructs the Model object, releasing any allocated resources.
void loadOBJ(std::shared_ptr< utility::File > modelAsset)
Loads a model from a given File containing the model data.
Definition model.cpp:87
utility::graphic::SizeF computeBoundingSize(void)
Computes the bounding size of the model.
Definition model.cpp:73
uint32_t _materialID
The material associated with the model.
Definition model.hpp:146
ModelType type() const
Get the type of the model.
Definition model.cpp:68
uint32_t getMaterialID(void) const
Get the material ID associated with the model.
Definition model.cpp:78
ModelType _type
The type of the model (e.g., OBJ, FBX, GLTF)
Definition model.hpp:142
The Renderable class represents an object that can be rendered in the graphics application.
Mixin base class providing logging capabilities to derived classes.
Definition loggable.hpp:55
Platform-specific default logger alias.
Mixin class to provide logging capabilities to derived classes.