medfall

A super great game engine
Log | Files | Refs

commit 89df05757ff13d04368dc6302de20c6f39251d9e
parent a59aa57744b04c140991810250b4b3e6a0dac11d
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun May 14 16:40:58 +0300

Spaces -> tabs

Diffstat:
darwin_audio_output.cc | 6+++---
heightmap.cc | 62+++++++++++++++++++++++++++++++-------------------------------
keys.h | 2+-
launcher/main.cc | 8++++----
shaders.cc | 10+++++-----
win32_thread.h | 2+-
6 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/darwin_audio_output.cc b/darwin_audio_output.cc @@ -14,12 +14,12 @@ static OSStatus audio_output_callback( u32 inBusNumber, u32 num_samples, AudioBufferList * buffers ) { - AudioOutputDevice * device = ( AudioOutputDevice * ) data; + AudioOutputDevice * device = ( AudioOutputDevice * ) data; - s16 * samples = ( s16 * ) buffers->mBuffers[ 0 ].mData; + s16 * samples = ( s16 * ) buffers->mBuffers[ 0 ].mData; device->callback( samples, checked_cast< s32 >( num_samples ) ); - return 0; + return 0; } void audio_output_open( AudioOutputDevice * device, AudioOutputCallback callback ) { diff --git a/heightmap.cc b/heightmap.cc @@ -95,46 +95,46 @@ bool ray_vs_aabb( AABB aabb, v3 start, v3 inv_dir, float * t ) { } bool ray_vs_sphere( v3 ray_origin, v3 ray_dir, v3 sphere_origin, float sphere_radius, float * t ) { - v3 m = ray_origin - sphere_origin; + v3 m = ray_origin - sphere_origin; - float b = dot( m, ray_dir ); - float c = dot( m, m ) - sphere_radius * sphere_radius; + float b = dot( m, ray_dir ); + float c = dot( m, m ) - sphere_radius * sphere_radius; - float determinant = b * b - c; - if( determinant < 0 ) { - return false; - } + float determinant = b * b - c; + if( determinant < 0 ) { + return false; + } - *t = -b - sqrtf( determinant ); - return *t >= 0; + *t = -b - sqrtf( determinant ); + return *t >= 0; } bool ray_vs_plane( v3 ray_origin, v3 ray_dir, v3 plane_normal, float plane_distance, float * t ) { - const float epsilon = 0.001f; - float denom = dot( ray_dir, plane_normal ); - if( fabsf( denom ) < epsilon ) { - return false; - } - - *t = ( plane_distance - dot( ray_origin, plane_normal ) ) / denom; - return *t >= 0; + const float epsilon = 0.001f; + float denom = dot( ray_dir, plane_normal ); + if( fabsf( denom ) < epsilon ) { + return false; + } + + *t = ( plane_distance - dot( ray_origin, plane_normal ) ) / denom; + return *t >= 0; } void barycentric( v3 a, v3 b, v3 c, v3 p, float * u, float * v, float * w ) { - v3 ab = b - a; - v3 ac = c - a; - v3 ap = p - a; - - float dabab = dot( ab, ab ); - float dabac = dot( ab, ac ); - float dacac = dot( ac, ac ); - float dapab = dot( ap, ab ); - float dapac = dot( ap, ac ); - float denom = dabab * dacac - dabac * dabac; - - *v = ( dacac * dapab - dabac * dapac ) / denom; - *w = ( dabab * dapac - dabac * dapab ) / denom; - *u = 1.0f - *v - *w; + v3 ab = b - a; + v3 ac = c - a; + v3 ap = p - a; + + float dabab = dot( ab, ab ); + float dabac = dot( ab, ac ); + float dacac = dot( ac, ac ); + float dapab = dot( ap, ab ); + float dapac = dot( ap, ac ); + float denom = dabab * dacac - dabac * dabac; + + *v = ( dacac * dapab - dabac * dapac ) / denom; + *w = ( dabab * dapac - dabac * dapab ) / denom; + *u = 1.0f - *v - *w; } bool point_in_triangle( v3 p, v3 a, v3 b, v3 c ) { diff --git a/keys.h b/keys.h @@ -32,7 +32,7 @@ enum KeyNames { // KEY_X, // KEY_Y, // KEY_Z, - // + // // KEY_1, // KEY_2, // KEY_3, diff --git a/launcher/main.cc b/launcher/main.cc @@ -37,10 +37,10 @@ #endif const u8 PUBLIC_KEY[] = { - 0x3b, 0x0a, 0xc7, 0xa1, 0xd1, 0x9e, 0xbd, 0x0c, - 0x71, 0x75, 0x4f, 0xfc, 0x2a, 0xef, 0xcf, 0x91, - 0x93, 0xd0, 0x58, 0x94, 0x79, 0xc2, 0xeb, 0x16, - 0x30, 0x74, 0x62, 0x88, 0xe8, 0x18, 0x03, 0xb6, + 0x3b, 0x0a, 0xc7, 0xa1, 0xd1, 0x9e, 0xbd, 0x0c, + 0x71, 0x75, 0x4f, 0xfc, 0x2a, 0xef, 0xcf, 0x91, + 0x93, 0xd0, 0x58, 0x94, 0x79, 0xc2, 0xeb, 0x16, + 0x30, 0x74, 0x62, 0x88, 0xe8, 0x18, 0x03, 0xb6, }; struct SHA256 { diff --git a/shaders.cc b/shaders.cc @@ -14,12 +14,12 @@ struct HotloadShader { StaticArray< HotloadShader, SHADER_COUNT > shaders; static time_t file_last_write_time( const char * path ) { - struct stat buf; - if( stat( path, &buf ) == -1 ) { - return 0; - } + struct stat buf; + if( stat( path, &buf ) == -1 ) { + return 0; + } - return buf.st_mtime; + return buf.st_mtime; } void shaders_init() { diff --git a/win32_thread.h b/win32_thread.h @@ -15,7 +15,7 @@ struct Thread { inline void thread_init( Thread * thread, ThreadProc callback, void * data ) { DWORD id; - HANDLE handle = CreateThread( 0, 0, callback, data, 0, &id ); + HANDLE handle = CreateThread( 0, 0, callback, data, 0, &id ); if( handle == NULL ) { FATAL( "CreateThread" ); }