mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
extracted some methods
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
namespace omath
|
||||
{
|
||||
@@ -13,11 +13,20 @@ namespace omath
|
||||
public:
|
||||
Matrix(size_t rows, size_t columns);
|
||||
|
||||
explicit Matrix(const std::vector<std::vector<float>> &rows);
|
||||
Matrix(const std::initializer_list<std::initializer_list<float>>& rows);
|
||||
|
||||
[[nodiscard]]
|
||||
static Matrix ToScreenMatrix(float screenWidth, float screenHeight);
|
||||
|
||||
[[nodiscard]]
|
||||
static Matrix TranslationMatrix(const Vector3& diff);
|
||||
|
||||
[[nodiscard]]
|
||||
static Matrix OrientationMatrix(const Vector3& forward, const Vector3& right, const Vector3& up);
|
||||
|
||||
[[nodiscard]]
|
||||
static Matrix ProjectionMatrix(float fielOfView, float aspectRatio,float near, float far);
|
||||
|
||||
Matrix(const Matrix &other);
|
||||
|
||||
Matrix(size_t rows, size_t columns, const float *pRaw);
|
||||
@@ -42,7 +51,7 @@ namespace omath
|
||||
void SetDataFromRaw(const float* pRawMatrix);
|
||||
|
||||
[[nodiscard]]
|
||||
Matrix Transpose();
|
||||
Matrix Transpose() const;
|
||||
|
||||
void Set(float val);
|
||||
|
||||
|
||||
@@ -12,10 +12,19 @@
|
||||
|
||||
namespace omath::projection
|
||||
{
|
||||
class ViewPort final
|
||||
{
|
||||
public:
|
||||
float m_width;
|
||||
float m_height;
|
||||
|
||||
[[nodiscard]] float AspectRatio() const {return m_width / m_height;}
|
||||
};
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
Camera(const Vector3& position, const Vector3& viewAngles, const Vector3& viewPort, float fov, float near, float far);
|
||||
Camera(const Vector3& position, const Vector3& viewAngles, const ViewPort& viewPort, float fov, float near, float far);
|
||||
void SetViewAngles(const Vector3& viewAngles);
|
||||
[[nodiscard]] const Vector3& GetViewAngles() const;
|
||||
static float& GetFloat1();
|
||||
@@ -29,7 +38,7 @@ namespace omath::projection
|
||||
|
||||
[[nodiscard]] std::expected<Vector3, std::string_view> WorldToScreen(const Vector3& worldPosition) const;
|
||||
|
||||
Vector3 m_viewPort;
|
||||
ViewPort m_viewPort{};
|
||||
float m_fieldOfView;
|
||||
|
||||
float m_farPlaneDistance;
|
||||
|
||||
Reference in New Issue
Block a user