mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
added error codes
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <omath/Vector3.h>
|
||||
#include <omath/Matrix.h>
|
||||
#include <string_view>
|
||||
#include "ErrorCodes.h"
|
||||
|
||||
|
||||
namespace omath::projection
|
||||
@@ -18,7 +19,7 @@ namespace omath::projection
|
||||
float m_width;
|
||||
float m_height;
|
||||
|
||||
[[nodiscard]] float AspectRatio() const {return m_width / m_height;}
|
||||
[[nodiscard]] constexpr float AspectRatio() const {return m_width / m_height;}
|
||||
};
|
||||
|
||||
class Camera
|
||||
@@ -29,7 +30,7 @@ namespace omath::projection
|
||||
|
||||
[[nodiscard]] Matrix GetViewMatrix() const;
|
||||
|
||||
[[nodiscard]] std::expected<Vector3, std::string_view> WorldToScreen(const Vector3& worldPosition) const;
|
||||
[[nodiscard]] std::expected<Vector3, Error> WorldToScreen(const Vector3& worldPosition) const;
|
||||
|
||||
ViewPort m_viewPort{};
|
||||
float m_fieldOfView;
|
||||
|
||||
16
include/omath/projection/ErrorCodes.h
Normal file
16
include/omath/projection/ErrorCodes.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Vlad on 03.09.2024.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace omath::projection
|
||||
{
|
||||
enum class Error : uint16_t
|
||||
{
|
||||
WORLD_POSITION_IS_BEHIND_CAMERA = 0,
|
||||
WORLD_POSITION_IS_OUT_OF_SCREEN_BOUNDS,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user