mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 15:03:27 +00:00
refactored tests
This commit is contained in:
@@ -12,15 +12,27 @@ namespace omath::opengl
|
||||
constexpr Vector3 kAbsRight = {1, 0, 0};
|
||||
constexpr Vector3 kAbsForward = {0, 0, -1};
|
||||
|
||||
template<class Type> requires std::is_floating_point_v<Type> || std::is_integral_v<Type>
|
||||
[[nodiscard]] Mat<4, 4, Type, MatStoreType::COLUMN_MAJOR> PerspectiveProjectionMatrix()
|
||||
{
|
||||
|
||||
template<class Type = float>
|
||||
requires std::is_floating_point_v<Type> || std::is_integral_v<Type>
|
||||
[[nodiscard]] Mat<4, 4, Type, MatStoreType::COLUMN_MAJOR> ViewMatrix(const Vector3& forward,
|
||||
const Vector3& right,
|
||||
const Vector3& up,
|
||||
const Vector3& cam_origin)
|
||||
{
|
||||
return
|
||||
{
|
||||
{right.x, up.x, -forward.x, 0},
|
||||
{right.y, up.y, -forward.y, 0},
|
||||
{right.z, up.z, -forward.z, 0},
|
||||
{-cam_origin.x, -cam_origin.y, -cam_origin.z, 1},
|
||||
};
|
||||
}
|
||||
|
||||
template<class Type> requires std::is_floating_point_v<Type> || std::is_integral_v<Type>
|
||||
template<class Type>
|
||||
requires std::is_floating_point_v<Type> || std::is_integral_v<Type>
|
||||
[[nodiscard]] Mat<4, 4, Type, MatStoreType::COLUMN_MAJOR> PerspectiveProjectionMatrix(
|
||||
const float fieldOfView, const Type &aspectRatio, const Type &near, const Type &far)
|
||||
const float fieldOfView, const Type& aspectRatio, const Type& near, const Type& far)
|
||||
{
|
||||
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2);
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// Created by Orange on 11/24/2024.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "omath/Vector3.hpp"
|
||||
#include "omath/Mat.hpp"
|
||||
|
||||
namespace omath::source
|
||||
{
|
||||
|
||||
12
include/omath/engines/unity.hpp
Normal file
12
include/omath/engines/unity.hpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Created by Orange on 11/27/2024.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <omath/Vector3.hpp>
|
||||
|
||||
|
||||
namespace omath::unity
|
||||
{
|
||||
|
||||
};
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <expected>
|
||||
#include <omath/Vector3.hpp>
|
||||
#include <omath/Mat.hpp>
|
||||
#include <string_view>
|
||||
#include "ErrorCodes.hpp"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user