ModelViewer 0.1
Template for CPP projects
Loading...
Searching...
No Matches
ObjGeometry.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** ObjGeometry.hpp
4** File description:
5** ObjGeometry.hpp
6*/
7
8#ifndef MODELVIEWER_OBJGEOMETRY_HPP
9#define MODELVIEWER_OBJGEOMETRY_HPP
10
11#include <QObject>
12#include <QQuick3DGeometry>
13#include <sstream>
14
15#include "GeometryStructs.hpp"
16
17namespace model_viewer::geometry {
18
22class ObjGeometry final : public QQuick3DGeometry {
23 Q_OBJECT
24 private:
26 bool _hasNormals = false;
27
29 bool _hasTextureCoords = false;
30
31 public:
36 explicit ObjGeometry(QQuick3DObject *parent = nullptr);
37
44 void setMesh(const std::vector<Vector3> &vertices,
45 const std::vector<Vector3> &normals,
46 const std::vector<TextureCoordinate> &textureCoords);
47
48 private:
55 void setModelData(const std::vector<Vector3> &vertices,
56 const std::vector<Vector3> &normals,
57 const std::vector<TextureCoordinate> &textureCoords);
58
61};
62
63} // namespace model_viewer::geometry
64
65#endif // MODELVIEWER_OBJGEOMETRY_HPP
Class representing the geometry of an OBJ model.
Definition ObjGeometry.hpp:22
bool _hasNormals
Whether the geometry contains normals.
Definition ObjGeometry.hpp:26
void setMesh(const std::vector< Vector3 > &vertices, const std::vector< Vector3 > &normals, const std::vector< TextureCoordinate > &textureCoords)
Set the mesh data.
Definition ObjGeometry.cpp:14
void setModelData(const std::vector< Vector3 > &vertices, const std::vector< Vector3 > &normals, const std::vector< TextureCoordinate > &textureCoords)
Set the model data to the geometry.
Definition ObjGeometry.cpp:25
bool _hasTextureCoords
Whether the geometry contains texture coordinates.
Definition ObjGeometry.hpp:29
ObjGeometry(QQuick3DObject *parent=nullptr)
Constructor.
Definition ObjGeometry.cpp:12
void configureVertexLayout()
Configure the vertex layout of the geometry based on the data.
Definition ObjGeometry.cpp:59
Definition ObjGeometry.cpp:10