-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMeshModule.hpp
More file actions
93 lines (57 loc) · 2.36 KB
/
Copy pathMeshModule.hpp
File metadata and controls
93 lines (57 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
** EPITECH PROJECT, 2020
** MeshModule.hpp
** File description:
** header for MeshModule.c
*/
#pragma once
#include <myxmlpp/myxmlpp.hpp>
#include <memory>
#include "Polymorph/Types.hpp"
#include "Config/XmlComponent.hpp"
#include "GraphicalAPI/GraphicalInterfaces/IModelModule.hpp"
namespace Polymorph
{
class MeshModule
{
////////////////////// CONSTRUCTORS/DESTRUCTORS /////////////////////////
public:
explicit MeshModule() = default;
explicit MeshModule(const std::string &path);
explicit MeshModule(std::shared_ptr<myxmlpp::Node> &data,
Config::XmlComponent &manager);
~MeshModule() = default;
//////////////////////--------------------------/////////////////////////
///////////////////////////// PROPERTIES ////////////////////////////////
public:
private:
using MeshModuleLoader = Polymorph::IModelModule *(*)(
const std::string &objFilepath);
static inline MeshModuleLoader _c_model = nullptr;
std::unique_ptr<Polymorph::IModelModule> _model;
std::string _filepath;
float _rotationAngle;
Color _color;
std::shared_ptr<TextureModule> _internalTexture;
//////////////////////--------------------------/////////////////////////
/////////////////////////////// METHODS /////////////////////////////////
public:
void setPosition(Vector3 position);
void setScale(Vector3 scale);
void setRotationAxis(Vector3 rotationAxis);
void setRotationAngle(float rotationAngle);
float getRotationAngle() const;
void setColor(Color color);
Color getColor() const;
void setTexture(const std::shared_ptr<TextureModule> &texture);
void draw();
Polymorph::IModelModule &getMesh() const;
BoxModule getBoundingBox() const;
bool collideWithBox(const BoxModule &box) const;
bool collideWithSphere(const SphereModule &sphere) const;
bool colliderWithMesh(const Polymorph::MeshModule &mesh) const;
private:
void _loadModule();
//////////////////////--------------------------/////////////////////////
};
}