fast functions of common math (untested!)
parent
b2666dc39e
commit
b77638436e
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.24)
|
||||
project(BLT VERSION 0.5.0)
|
||||
project(BLT VERSION 0.5.1)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
|||
CMAKE_PROJECT_NAME:STATIC=BLT_TESTS
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION:STATIC=0.5.0
|
||||
CMAKE_PROJECT_VERSION:STATIC=0.5.1
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_MAJOR:STATIC=0
|
||||
|
@ -190,7 +190,7 @@ CMAKE_PROJECT_VERSION_MAJOR:STATIC=0
|
|||
CMAKE_PROJECT_VERSION_MINOR:STATIC=5
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_PATCH:STATIC=0
|
||||
CMAKE_PROJECT_VERSION_PATCH:STATIC=1
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_TWEAK:STATIC=
|
||||
|
|
|
@ -3,7 +3,7 @@ Standard Files /home/brett/Documents/code/c++/BLT/src/blt/std/filesystem.cpp;/ho
|
|||
Profiler Files /home/brett/Documents/code/c++/BLT/src/blt/profiling/profiler.cpp
|
||||
Source: /home/brett/Documents/code/c++/BLT
|
||||
Current Source: /home/brett/Documents/code/c++/BLT
|
||||
BLT 0.5.0 Successfully included!
|
||||
BLT 0.5.1 Successfully included!
|
||||
BLT tests included!
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
|
|
|
@ -11,6 +11,30 @@
|
|||
#include <blt/math/matrix.h>
|
||||
|
||||
namespace blt {
|
||||
|
||||
/**
|
||||
* fast number integer
|
||||
*/
|
||||
unsigned int f_randi(unsigned int seed) {
|
||||
seed = (seed << 13) ^ seed;
|
||||
return ((seed * (seed * seed * 15731 + 789221) + 1376312589) & 0x7fffffff);
|
||||
}
|
||||
|
||||
/**
|
||||
* fast inverse sqrt
|
||||
*/
|
||||
float fsqrt(float n){
|
||||
int i;
|
||||
float x, y;
|
||||
x = n * 0.5f;
|
||||
y = n;
|
||||
i = * (int*) &y;
|
||||
i = 0x5f3759df - (i >> 1);
|
||||
y = * (float*) &i;
|
||||
y = y * (1.5f - (x * y * y));
|
||||
y = y * (1.5f - (x * y * y));
|
||||
return y;
|
||||
}
|
||||
|
||||
// inline std::ostream& operator<<(std::ostream& out, const mat4x4& v) {
|
||||
// return out << "\rMatrix4x4{" << v.m00() << ", " << v.m01() << ", " << v.m02() << ", " << v.m03() << "} \n"\
|
||||
|
|
|
@ -262,6 +262,7 @@ namespace blt {
|
|||
|
||||
// https://www.scratchapixel.com/lessons/3d-basic-rendering/perspective-and-orthographic-projection-matrix/building-basic-perspective-projection-matrix.html
|
||||
// https://ogldev.org/www/tutorial12/tutorial12.html
|
||||
// http://www.songho.ca/opengl/gl_projectionmatrix.html
|
||||
static inline mat4x4 perspective(float fov, float aspect_ratio, float near, float far){
|
||||
mat4x4 perspectiveMat4x4 {emptyMatrix};
|
||||
|
||||
|
|
Loading…
Reference in New Issue