added 3d plotting
This commit is contained in:
parent
5f0e8f9c6e
commit
918f51dc14
16 changed files with 301 additions and 248 deletions
15
backend/include/backend/BoundingBox.hpp
Normal file
15
backend/include/backend/BoundingBox.hpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
struct Rect
|
||||
{
|
||||
float x, y;
|
||||
float w, h;
|
||||
};
|
||||
|
||||
struct BoundingBox
|
||||
{
|
||||
float x, y, z;
|
||||
float w, h, d;
|
||||
};
|
||||
|
||||
typedef BoundingBox BBox;
|
|
@ -13,6 +13,11 @@ public:
|
|||
void SetScale(const glm::vec3&) = delete;
|
||||
void Scale(const glm::vec3&) = delete;
|
||||
|
||||
inline void LookAt(const glm::vec3& target)
|
||||
{
|
||||
transformation = glm::lookAt(position, target, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
}
|
||||
|
||||
inline const glm::mat4& GetView() const
|
||||
{
|
||||
return transformation;
|
||||
|
@ -40,6 +45,11 @@ public:
|
|||
{
|
||||
projection = glm::perspective(glm::radians(fov), aspect, zNear, zFar);
|
||||
}
|
||||
|
||||
inline void Update(float fov, float aspect, float zNear, float zFar)
|
||||
{
|
||||
projection = glm::perspective(glm::radians(fov), aspect, zNear, zFar);
|
||||
}
|
||||
};
|
||||
|
||||
class OrthogonalCamera : public CameraBase
|
||||
|
@ -49,4 +59,9 @@ public:
|
|||
{
|
||||
projection = glm::ortho(left, right, bottom, top, zNear, zFar);
|
||||
}
|
||||
|
||||
inline void Update(float left, float right, float bottom, float top, float zNear, float zFar)
|
||||
{
|
||||
projection = glm::ortho(left, right, bottom, top, zNear, zFar);
|
||||
}
|
||||
};
|
|
@ -23,7 +23,7 @@ public:
|
|||
Drawable(const Drawable& other) = delete;
|
||||
void operator=(const Drawable& other) = delete;
|
||||
|
||||
virtual void InitializeShader(const CameraBase& camera) const = 0;
|
||||
virtual void PreRender(const CameraBase& camera) const { };
|
||||
void Draw(const CameraBase& camera) const;
|
||||
void SetPrimitiveType(PrimitiveType type);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue