mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-05 10:59:48 +00:00
drawables 3D + lib compiling
This commit is contained in:
@@ -68,6 +68,15 @@ set(SRC
|
||||
src/Drawables/2D/Rectangle.cpp
|
||||
src/Drawables/2D/Text.cpp
|
||||
src/Drawables/2D/Triangle.cpp
|
||||
src/Drawables/3D/Circle.cpp
|
||||
src/Drawables/3D/Cylinder.cpp
|
||||
src/Drawables/3D/Grid.cpp
|
||||
src/Drawables/3D/Line.cpp
|
||||
src/Drawables/3D/Plane.cpp
|
||||
src/Drawables/3D/Point.cpp
|
||||
src/Drawables/3D/Ray.cpp
|
||||
src/Drawables/3D/Sphere.cpp
|
||||
src/Drawables/3D/Triangle.cpp
|
||||
src/Drawables/ADrawable2D.cpp
|
||||
src/Drawables/ADrawable3D.cpp
|
||||
src/Drawables/Image.cpp
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace RAY::Drawables::Drawables2D {
|
||||
//! @param centerPos position of center point
|
||||
//! @param radius radius of the circle
|
||||
//! @param Color Color of the circle
|
||||
Circle(const Vector2 ¢erPos, int radius, Color color);
|
||||
Circle(const Vector2 ¢erPos, int radius, const Color &color);
|
||||
|
||||
//! @brief Circle constructor
|
||||
//! @param centerPosX x-position of center point
|
||||
//! @param centerPosY y-position of center point
|
||||
//! @param radius radius of the circle
|
||||
//! @param Color Color of the circle
|
||||
Circle(int centerPosX, int centerPosY, int radius, Color color);
|
||||
Circle(int centerPosX, int centerPosY, int radius, const Color &color);
|
||||
|
||||
//! @brief A default copy constructor
|
||||
Circle(const Circle &) = default;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables2D {
|
||||
//! @param position position of top-left point
|
||||
//! @param dimensions dimensions of the rectangle
|
||||
//! @param Color Color of the rectangle
|
||||
Rectangle(const Vector2 &position, Vector2 dimensions, const Color &color);
|
||||
Rectangle(const Vector2 &position, const Vector2 &dimensions, const Color &color);
|
||||
|
||||
//! @brief Rectangle constructor
|
||||
//! @param x x-position of top-left point
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace RAY::Drawables::Drawables2D {
|
||||
//! @param fontSize size of the text
|
||||
//! @param position position of top-left point
|
||||
//! @param Color Color of the text
|
||||
Text(const std::string &content, int fontSize, Vector2 position, const Color &color);
|
||||
Text(const std::string &content, int fontSize, const Vector2 &position, const Color &color);
|
||||
|
||||
//! @brief Text constructor
|
||||
//! @param content text
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace RAY::Drawables::Drawables2D {
|
||||
//! @param positionB position of B point
|
||||
//! @param positionC position of C point
|
||||
//! @param Color Color of the circle
|
||||
Triangle(const Vector2 &positionA, Vector2 positionB, Vector2 positionC, const Color &color);
|
||||
Triangle(const Vector2 &positionA, const Vector2 &positionB, const Vector2 &positionC, const Color &color);
|
||||
|
||||
|
||||
//! @brief A default copy constructor
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param centerPosition position of the center
|
||||
//! @param radius radius of the circle
|
||||
//! @param Color Color of the circle
|
||||
Circle(const Vector3 ¢erPosition, int radius, Vector3 rotationAxis, float rotationAngle, Color color);
|
||||
Circle(const Vector3 ¢erPosition, int radius, const Color &color, const Vector3 &rotationAxis, float rotationAngle = 0);
|
||||
|
||||
|
||||
//! @brief A default copy constructor
|
||||
@@ -35,7 +35,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
int getRadius(void) const;
|
||||
|
||||
//! @brief set radius
|
||||
Circle &setRadius(int radius) const;
|
||||
Circle &setRadius(int radius);
|
||||
|
||||
//! @return the position of the center
|
||||
const Vector3 &getCenterPos(void) const;
|
||||
@@ -43,10 +43,8 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @brief set pos of center
|
||||
Circle &setRadius(const Vector3 &pos) const;
|
||||
|
||||
//! @brief Draw point on window
|
||||
//! @brief Draw circle on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief Radius of the circle
|
||||
@@ -56,10 +54,10 @@ namespace RAY::Drawables::Drawables3D {
|
||||
Vector3 _centerPos;
|
||||
|
||||
//! @brief rotation axis
|
||||
Vector3 rotationAxis;
|
||||
Vector3 _rotationAxis;
|
||||
|
||||
//! @brief rotation angle
|
||||
float rotationAngle;
|
||||
float _rotationAngle;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param radiusBottom radius at the bottom of the cylinder
|
||||
//! @param radiusBottom heighth of the cylinder
|
||||
//! @param Color Color of the cylinder
|
||||
Cylinder(const Vector3 &position, float radiusTop, float radiusBottom, float height, Color color);
|
||||
Cylinder(const Vector3 &position, float radiusTop, float radiusBottom, float height, const Color &color);
|
||||
|
||||
|
||||
//! @brief A default copy constructor
|
||||
@@ -37,37 +37,35 @@ namespace RAY::Drawables::Drawables3D {
|
||||
int getTopRadius(void) const;
|
||||
|
||||
//! @brief set radius
|
||||
Cylinder &setTopRadius(float radius) const;
|
||||
Cylinder &setTopRadius(float radius);
|
||||
|
||||
//! @return the radius of the cylinder
|
||||
int getBottomRadius(void) const;
|
||||
|
||||
//! @brief set radius
|
||||
Cylinder &setBottopRadius(float radius) const;
|
||||
Cylinder &setBottopRadius(float radius);
|
||||
|
||||
//! @return the position of the center
|
||||
const Vector3 &getPosition(void) const;
|
||||
|
||||
//! @brief the position of the center
|
||||
Cylinder &setPosition(const Vector3 &) const;
|
||||
Cylinder &setPosition(const Vector3 &);
|
||||
|
||||
//! @return the Heigth
|
||||
const Vector3 &getHeigth(void) const;
|
||||
float getHeigth(void) const;
|
||||
|
||||
//! @brief the Heigth
|
||||
Cylinder &setHeigth(float heigth) const;
|
||||
Cylinder &setHeigth(float heigth);
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief Radius of the cylinder
|
||||
float _topRadius;
|
||||
|
||||
//! @brief Radius of the cylinder
|
||||
float _bootomRadius;
|
||||
float _bottomRadius;
|
||||
|
||||
//! @brief heigth of the cylinder
|
||||
float _heigth;
|
||||
|
||||
@@ -43,8 +43,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief Grid slices
|
||||
int _slices;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param startPosition position of top-left point
|
||||
//! @param startPosition position of bottom-rigth point
|
||||
//! @param Color Color of the line
|
||||
Line(const Vector3 &startPosition, Vector3 endPosition, Color color);
|
||||
Line(const Vector3 &startPosition, const Vector3 &endPosition, const Color &color);
|
||||
|
||||
//! @brief A default copy constructor
|
||||
Line(const Line &) = default;
|
||||
@@ -30,8 +30,6 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @brief A default destructor
|
||||
~Line() = default;
|
||||
|
||||
//! @return the length of the line
|
||||
int getLength(void) const;
|
||||
|
||||
//! @return the start position of the line
|
||||
const Vector3 &getStartPosition(void) const;
|
||||
@@ -47,8 +45,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief start position
|
||||
Vector3 _startPosition;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param position position of plane
|
||||
//! @param dimensions dimensions of plane
|
||||
//! @param Color Color of the plane
|
||||
Plane(const Vector3 &position, Vector2 dimensions, const Color &color);
|
||||
Plane(const Vector3 &position, const Vector2 &dimensions, const Color &color);
|
||||
|
||||
//! @brief A default copy constructor
|
||||
Plane(const Plane &) = default;
|
||||
@@ -40,12 +40,10 @@ namespace RAY::Drawables::Drawables3D {
|
||||
const Vector2 &getDimensions(void) const;
|
||||
|
||||
//! @brief Set dimensions
|
||||
Plane &setDimensions(const Vector3 &dimensions);
|
||||
Plane &setDimensions(const Vector2 &dimensions);
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief plane position
|
||||
|
||||
@@ -37,8 +37,6 @@ namespace RAY::Drawables::Drawables3D {
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief point position
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param startPosition position of top-left point
|
||||
//! @param direction direction of the ray
|
||||
//! @param Color Color of the line
|
||||
Ray(const Vector3 &startPosition, Vector3 direction, Color color);
|
||||
Ray(const Vector3 &startPosition, const Vector3 &direction, const Color &color);
|
||||
|
||||
//! @brief A default copy constructor
|
||||
Ray(const Ray &) = default;
|
||||
@@ -30,31 +30,24 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @brief A default destructor
|
||||
~Ray() = default;
|
||||
|
||||
//! @return the length of the line
|
||||
int getLength(void) const;
|
||||
|
||||
//! @return the start position of the line
|
||||
const Vector3 &getPosition(void) const;
|
||||
const Vector3 &getStartPosition(void) const;
|
||||
|
||||
//! @return the end position of the line
|
||||
const Vector3 &getDirection(void) const;
|
||||
|
||||
//! @brief Set start position
|
||||
Ray &setPosition(const Vector3 &startPosition);
|
||||
Ray &setStartPosition(const Vector3 &startPosition);
|
||||
|
||||
//! @brief Set end position
|
||||
Ray &setDirection(const Vector3 &dimensions);
|
||||
Ray &setDirection(const Vector3 &direction);
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief start position
|
||||
Vector3 _startPosition;
|
||||
//! @brief direction
|
||||
Vector3 _direction;
|
||||
::Ray _ray;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param centerPosition position of the center
|
||||
//! @param radius radius of the sphere
|
||||
//! @param Color Color of the sphere
|
||||
Sphere(const Vector3 ¢erPosition, int radius, Color color);
|
||||
Sphere(const Vector3 ¢erPosition, int radius, const Color &color);
|
||||
|
||||
|
||||
//! @brief A default copy constructor
|
||||
@@ -35,18 +35,16 @@ namespace RAY::Drawables::Drawables3D {
|
||||
int getRadius(void) const;
|
||||
|
||||
//! @brief set radius
|
||||
Sphere &setRadius(int radius) const;
|
||||
Sphere &setRadius(int radius);
|
||||
|
||||
//! @return the position of the center
|
||||
const Vector3 &getCenterPos(void) const;
|
||||
|
||||
//! @brief set pos of center
|
||||
Sphere &setRadius(const Vector3 &pos) const;
|
||||
Sphere &setRadius(const Vector3 &pos);
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief Radius of the sphere
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace RAY::Drawables::Drawables3D {
|
||||
//! @param positionB position of B point
|
||||
//! @param positionC position of C point
|
||||
//! @param Color Color of the circle
|
||||
Triangle(const Vector3 &positionA, Vector3 positionB, Vector3 positionC,int length, const Color &color);
|
||||
Triangle(const Vector3 &positionA, const Vector3 &positionB, const Vector3 &positionC, const Color &color);
|
||||
|
||||
|
||||
//! @brief A default copy constructor
|
||||
@@ -34,27 +34,25 @@ namespace RAY::Drawables::Drawables3D {
|
||||
~Triangle() = default;
|
||||
|
||||
//! @return the position of A of the Triangle
|
||||
Vector3 getPositionA(void) const;
|
||||
const Vector3 &getPositionA(void) const;
|
||||
|
||||
//! @return the position of B of the Triangle
|
||||
Vector3 getPositionB(void) const;
|
||||
const Vector3 &getPositionB(void) const;
|
||||
|
||||
//! @return the position of C of the Triangle
|
||||
Vector3 getPositionC(void) const;
|
||||
const Vector3 &getPositionC(void) const;
|
||||
|
||||
//! @brief the position of A of the Triangle
|
||||
Triangle &setPositionA(Vector3);
|
||||
Triangle &setPositionA(const Vector3 &);
|
||||
|
||||
//! @brief the position of B of the Triangle
|
||||
Triangle &setPositionB(Vector3);
|
||||
Triangle &setPositionB(const Vector3 &);
|
||||
|
||||
//! @brief the position of C of the Triangle
|
||||
Triangle &setPositionC(Vector3);
|
||||
Triangle &setPositionC(const Vector3 &);
|
||||
|
||||
//! @brief Draw point on window
|
||||
void drawOn(RAY::Window &window);
|
||||
//! @brief Draw point on image
|
||||
void drawOn(RAY::Image &image);
|
||||
|
||||
private:
|
||||
//! @brief Position of A
|
||||
|
||||
@@ -21,9 +21,6 @@ namespace RAY
|
||||
virtual ~IDrawable() = 0;
|
||||
|
||||
virtual void drawOn(RAY::Window &window) = 0;
|
||||
|
||||
virtual void drawOn(RAY::Image &image) = 0;
|
||||
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
#include <string>
|
||||
#include "Canvas.hpp"
|
||||
#include "IRessource.hpp"
|
||||
#include "Drawables/IDrawable.hpp"
|
||||
|
||||
namespace RAY
|
||||
{
|
||||
namespace Drawables {
|
||||
class ADrawable2D;
|
||||
}
|
||||
class IRessource;
|
||||
class Image: public Canvas, public IRessource {
|
||||
public:
|
||||
@@ -50,7 +52,7 @@ namespace RAY
|
||||
::Image &getImage(void);
|
||||
|
||||
//! @brief draw drawable
|
||||
void draw(Drawables::IDrawable &);
|
||||
void draw(Drawables::ADrawable2D &);
|
||||
|
||||
private:
|
||||
//! @brief Image, really, that's just it...
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace RAY {
|
||||
//! @param texture The object to render
|
||||
//! @param position The position of the texture relative to the top left window corner
|
||||
//! @param tint
|
||||
void draw(const RAY::Texture &texture, Vector2 position, const Color &tint);
|
||||
void draw(const RAY::Texture &texture, const Vector2 &position, const Color &tint);
|
||||
|
||||
//! @brief Draw a 3d mesh with material and transform
|
||||
void draw(const Mesh &mesh, const Material &material, const Matrix &transform);
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
#include "Drawables/2D/Circle.hpp"
|
||||
|
||||
RAY::Drawables::Drawables2D::Circle::Circle(const Vector2 ¢erPos, int radius, Color color):
|
||||
RAY::Drawables::Drawables2D::Circle::Circle(const Vector2 ¢erPos, int radius, const Color &color):
|
||||
ADrawable2D(centerPos, color), _radius(radius)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables2D::Circle::Circle(int centerPosX, int centerPosY, int radius, Color color):
|
||||
RAY::Drawables::Drawables2D::Circle::Circle(int centerPosX, int centerPosY, int radius, const Color &color):
|
||||
ADrawable2D(centerPosX, centerPosY, color), _radius(radius)
|
||||
{
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "Drawables/2D/Rectangle.hpp"
|
||||
#include <cmath>
|
||||
|
||||
RAY::Drawables::Drawables2D::Rectangle::Rectangle(const Vector2 &position, Vector2 dimensions, const Color &color):
|
||||
RAY::Drawables::Drawables2D::Rectangle::Rectangle(const Vector2 &position, const Vector2 &dimensions, const Color &color):
|
||||
ADrawable2D(position, color), _dimensions(dimensions)
|
||||
{
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "Drawables/2D/Text.hpp"
|
||||
|
||||
RAY::Drawables::Drawables2D::Text::Text(const std::string &content, int fontSize, Vector2 position, const Color &color):
|
||||
RAY::Drawables::Drawables2D::Text::Text(const std::string &content, int fontSize, const Vector2 &position, const Color &color):
|
||||
ADrawable2D(position, color), _text(content), _size(fontSize), _spacing(DEFAULT_LETTER_SPACING)
|
||||
{
|
||||
this->_font.recs = nullptr;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "Drawables/2D/Triangle.hpp"
|
||||
#include <exception>
|
||||
|
||||
RAY::Drawables::Drawables2D::Triangle::Triangle(const Vector2 &positionA, Vector2 positionB, Vector2 positionC, const Color &color):
|
||||
RAY::Drawables::Drawables2D::Triangle::Triangle(const Vector2 &positionA, const Vector2 &positionB, const Vector2 &positionC, const Color &color):
|
||||
ADrawable2D(positionA, color), _posB(positionB), _posC(positionC)
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Circle
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Circle.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Circle::Circle(const Vector3 ¢erPosition, int radius, const Color &color, const Vector3 &rotationAxis, float rotationAngle):
|
||||
ADrawable3D(color), _radius(radius), _centerPos(centerPosition), _rotationAxis(rotationAxis), _rotationAngle(rotationAngle)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
int RAY::Drawables::Drawables3D::Circle::getRadius(void) const
|
||||
{
|
||||
return this->_radius;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Circle &RAY::Drawables::Drawables3D::Circle::setRadius(int radius)
|
||||
{
|
||||
this->_radius = radius;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Circle::getCenterPos(void) const
|
||||
{
|
||||
return this->_centerPos;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Circle::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawCircle3D(this->_centerPos, this->_radius,this->_rotationAxis,
|
||||
this->_rotationAngle, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Cylinder
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Cylinder.hpp"
|
||||
|
||||
|
||||
RAY::Drawables::Drawables3D::Cylinder::Cylinder(const Vector3 &position, float radiusTop, float radiusBottom, float height, const Color &color):
|
||||
ADrawable3D(color), _topRadius(radiusTop), _bottomRadius(radiusBottom), _heigth(height), _centerPos(position)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
int RAY::Drawables::Drawables3D::Cylinder::getTopRadius(void) const
|
||||
{
|
||||
return this->_topRadius;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Cylinder &RAY::Drawables::Drawables3D::Cylinder::setTopRadius(float radius)
|
||||
{
|
||||
this->_topRadius = radius;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int RAY::Drawables::Drawables3D::Cylinder::getBottomRadius(void) const
|
||||
{
|
||||
return this->_bottomRadius;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Cylinder &RAY::Drawables::Drawables3D::Cylinder::setBottopRadius(float radius)
|
||||
{
|
||||
this->_bottomRadius = radius;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Cylinder::getPosition(void) const
|
||||
{
|
||||
return this->_centerPos;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Cylinder &RAY::Drawables::Drawables3D::Cylinder::setPosition(const Vector3 &position)
|
||||
{
|
||||
this->_centerPos = position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
float RAY::Drawables::Drawables3D::Cylinder::getHeigth(void) const
|
||||
{
|
||||
return this->_heigth;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Cylinder &RAY::Drawables::Drawables3D::Cylinder::setHeigth(float heigth)
|
||||
{
|
||||
this->_heigth = heigth;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Cylinder::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawCylinder(this->_centerPos, this->_topRadius, this->_bottomRadius, this->_heigth, 0, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Grid
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Grid.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Grid::Grid(int slices, float spacing):
|
||||
ADrawable3D(LIGHTGRAY), _slices(slices), _spacing(spacing)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int RAY::Drawables::Drawables3D::Grid::getSlices(void) const
|
||||
{
|
||||
return this->_slices;
|
||||
}
|
||||
|
||||
float RAY::Drawables::Drawables3D::Grid::getSpacing(void) const
|
||||
{
|
||||
return this->_spacing;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Grid &RAY::Drawables::Drawables3D::Grid::setSlices(int slices)
|
||||
{
|
||||
this->_slices = slices;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Grid &RAY::Drawables::Drawables3D::Grid::setSpacing(float spacing)
|
||||
{
|
||||
this->_spacing = spacing;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Grid::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawGrid(this->_slices, this->_spacing);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Line
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Line.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Line::Line(const Vector3 &startPosition, const Vector3 &endPosition, const Color &color):
|
||||
ADrawable3D(color), _startPosition(startPosition), _endPosition(endPosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Line::getStartPosition(void) const
|
||||
{
|
||||
return this->_startPosition;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Line::getEndPosition(void) const
|
||||
{
|
||||
return this->_endPosition;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Line &RAY::Drawables::Drawables3D::Line::setStartPosition(const Vector3 &startPosition)
|
||||
{
|
||||
this->_startPosition = startPosition;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Line &RAY::Drawables::Drawables3D::Line::setEndPosition(const Vector3 &endPosition)
|
||||
{
|
||||
this->_endPosition = endPosition;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Line::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawLine3D(this->_startPosition, this->_endPosition, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Line
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Plane.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Plane::Plane(const Vector3 &position, const Vector2 &dimensions, const Color &color):
|
||||
ADrawable3D(color), _position(position), _dimensions(dimensions)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Plane::getPosition(void) const
|
||||
{
|
||||
return this->_position;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Plane &RAY::Drawables::Drawables3D::Plane::setPosition(const Vector3 &Position)
|
||||
{
|
||||
this->_position = Position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Vector2 &RAY::Drawables::Drawables3D::Plane::getDimensions(void) const
|
||||
{
|
||||
return this->_dimensions;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Plane &RAY::Drawables::Drawables3D::Plane::setDimensions(const Vector2 &dimensions)
|
||||
{
|
||||
this->_dimensions = dimensions;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Plane::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawPlane(this->_position, this->_dimensions, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Point
|
||||
*/
|
||||
|
||||
|
||||
#include "Drawables/3D/Point.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Point::Point(const Vector3 &position, const Color &color):
|
||||
ADrawable3D(color), _position(position)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Point::getPosition(void) const
|
||||
{
|
||||
return this->_position;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Point &RAY::Drawables::Drawables3D::Point::setPosition(const Vector3 &Position)
|
||||
{
|
||||
this->_position = Position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Point::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawPoint3D(this->_position, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Ray
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Ray.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Ray::Ray(const Vector3 &startPosition, const Vector3 &direction, const Color &color):
|
||||
ADrawable3D(color), _ray({startPosition, direction})
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Ray::getStartPosition(void) const
|
||||
{
|
||||
return this->_ray.position;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Ray::getDirection(void) const
|
||||
{
|
||||
return this->_ray.direction;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Ray &RAY::Drawables::Drawables3D::Ray::setStartPosition(const Vector3 &startPosition)
|
||||
{
|
||||
this->_ray.position = startPosition;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Ray &RAY::Drawables::Drawables3D::Ray::setDirection(const Vector3 &direction)
|
||||
{
|
||||
this->_ray.direction = direction;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Ray::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawRay(this->_ray, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Sphere
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Sphere.hpp"
|
||||
|
||||
RAY::Drawables::Drawables3D::Sphere::Sphere(const Vector3 ¢erPosition, int radius, const Color &color):
|
||||
ADrawable3D(color), _radius(radius), _centerPos(centerPosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int RAY::Drawables::Drawables3D::Sphere::getRadius(void) const
|
||||
{
|
||||
return this->_radius;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Sphere &RAY::Drawables::Drawables3D::Sphere::setRadius(int radius)
|
||||
{
|
||||
this->_radius = radius;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Sphere::getCenterPos(void) const
|
||||
{
|
||||
return this->_centerPos;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Sphere &RAY::Drawables::Drawables3D::Sphere::setRadius(const Vector3 &pos)
|
||||
{
|
||||
this->_centerPos = pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Sphere::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawSphere(this->_centerPos, this->_radius, this->_color.getColor());
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2021
|
||||
** Bomberman
|
||||
** File description:
|
||||
** Triangle
|
||||
*/
|
||||
|
||||
#include "Drawables/3D/Triangle.hpp"
|
||||
#include <exception>
|
||||
|
||||
RAY::Drawables::Drawables3D::Triangle::Triangle(const Vector3 &positionA, const Vector3 &positionB, const Vector3 &positionC, const Color &color):
|
||||
ADrawable3D(color), _posA(positionA), _posB(positionB), _posC(positionC)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Triangle::getPositionA(void) const
|
||||
{
|
||||
return this->_posA;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Triangle::getPositionB(void) const
|
||||
{
|
||||
return this->_posB;
|
||||
}
|
||||
|
||||
const Vector3 &RAY::Drawables::Drawables3D::Triangle::getPositionC(void) const
|
||||
{
|
||||
return this->_posC;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Triangle &RAY::Drawables::Drawables3D::Triangle::setPositionA(const Vector3 &position)
|
||||
{
|
||||
this->_posA = position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Triangle &RAY::Drawables::Drawables3D::Triangle::setPositionB(const Vector3 &position)
|
||||
{
|
||||
this->_posB = position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RAY::Drawables::Drawables3D::Triangle &RAY::Drawables::Drawables3D::Triangle::setPositionC(const Vector3 &position)
|
||||
{
|
||||
this->_posC = position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void RAY::Drawables::Drawables3D::Triangle::drawOn(RAY::Window &window)
|
||||
{
|
||||
(void)window;
|
||||
DrawTriangle3D(this->_posA, this->_posB, this->_posC, this->_color.getColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,3 @@ bool RAY::Image::unload()
|
||||
{
|
||||
return _image;
|
||||
}
|
||||
|
||||
void RAY::Image::draw(Drawables::IDrawable & drawable)
|
||||
{
|
||||
drawable.drawOn(*this);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ void RAY::Window::draw(RAY::Drawables::IDrawable &drawable)
|
||||
drawable.drawOn(*this);
|
||||
}
|
||||
|
||||
void RAY::Window::draw(const RAY::Texture &texture, Vector2 position, const Color &tint)
|
||||
void RAY::Window::draw(const RAY::Texture &texture, const Vector2 &position, const Color &tint)
|
||||
{
|
||||
DrawTexture(texture.getTexture(), position.x, position.y, tint.getColor());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user