-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSphereModule.hpp
More file actions
89 lines (54 loc) · 2.23 KB
/
Copy pathSphereModule.hpp
File metadata and controls
89 lines (54 loc) · 2.23 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
/*
** EPITECH PROJECT, 2020
** SphereModule.hpp
** File description:
** header for SphereModule.c
*/
#pragma once
#include "myxmlpp/myxmlpp.hpp"
#include "Polymorph/Types.hpp"
#include "GraphicalAPI/GraphicalInterfaces/IBoxModule.hpp"
#include "GraphicalAPI/GraphicalInterfaces/ISphereModule.hpp"
#include "GraphicalAPI/modules/BoxModule.hpp"
#include "Config/XmlComponent.hpp"
namespace Polymorph
{
class SphereModule
{
////////////////////// CONSTRUCTORS/DESTRUCTORS /////////////////////////
public:
explicit SphereModule(std::shared_ptr<myxmlpp::Node> &data,
Config::XmlComponent &manager);
explicit SphereModule();
~SphereModule() = default;
//////////////////////--------------------------/////////////////////////
///////////////////////////// PROPERTIES ////////////////////////////////
public:
private:
using SphereModuleLoader = Polymorph::ISphereModule *(*)(float x,
float y,
float z,
float radius);
static inline SphereModuleLoader _c_sphere = nullptr;
Polymorph::Vector3 _center;
float _radius;
Polymorph::Color _color;
std::unique_ptr<Polymorph::ISphereModule> _sphere;
//////////////////////--------------------------/////////////////////////
/////////////////////////////// METHODS /////////////////////////////////
public:
void setCenter(Polymorph::Vector3);
void setRadius(float radius);
void setColor(Color color);
bool collideWithBox(const BoxModule &box) const;
bool collideWithSphere(const Polymorph::SphereModule &sphere) const;
Polymorph::ISphereModule &getSphere() const;
void draw();
Polymorph::Vector3 getCenter() const;
float getRadius() const;
Polymorph::Color getColor() const;
private:
void _loadModule();
//////////////////////--------------------------/////////////////////////
};
}