Day 43 complete

This commit is contained in:
2023-10-28 17:10:30 -04:00
parent dddf8a1653
commit e1a481f4f6
19 changed files with 745 additions and 210 deletions

View File

@ -0,0 +1,17 @@
#pragma once
#if INTELLISENSE_DIRECTIVES
#include "types.hpp"
#include "intrinsics.hpp"
#endif
#define mili_accuracy 0.001
#define micro_accuracy 0.00001
#define nano_accuracy 0.000000001
b32 is_nearly_zero( f32 value, f32 accuracy = mili_accuracy ) {
return abs(value) < accuracy;
}
f32 square( f32 value ) {
return value * value;
}

View File

@ -12,3 +12,10 @@ void swap( Type& a, Type& b )
#define Zero( type ) tmpl_zero<type>()
template< class Type >
constexpr Type tmpl_zero();
// Custom casting trait for when you cannot define an implicit cast ergonomically.
#define cast( type, obj ) tmpl_cast<type, decltype(obj)>( obj )
template< class Type, class OtherType >
constexpr Type tmpl_cast( OtherType obj ) {
static_assert( false, "No overload templated cast defined for type combination. Define this using an overload of tmpl_cast specialization." );
}

View File

@ -38,6 +38,9 @@
#define F64_MIN 2.2250738585072014e-308
#define F64_MAX 1.7976931348623157e+308
#define F32_EPSILON 1.1920929e-7f
#define F64_EPSILON 2.220446049250313e-16
#if defined( COMPILER_MSVC )
# if _MSC_VER < 1300
typedef unsigned char u8;

View File

@ -936,6 +936,7 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
engine_api_load_time = engine_api_current_time;
unload_engine_module_api( & engine_api );
engine_api = load_engine_module_api();
engine_api.on_module_reload( & engine_memory, & platform_api );
} while (0);