# HG changeset patch # User John Tsiombikas # Date 1415536237 -7200 # Node ID 92695e89164b195043567a2e8be175625b0df2c0 # Parent f234630e38ff9d8cda8d139c3d33d6e6a87e07e0 vc project diff -r f234630e38ff -r 92695e89164b anim/anim.c --- a/anim/anim.c Sun Nov 09 13:03:36 2014 +0200 +++ b/anim/anim.c Sun Nov 09 14:30:37 2014 +0200 @@ -19,9 +19,11 @@ memset(node, 0, sizeof *node); +#ifdef ANIM_THREAD_SAFE /* initialize thread-local matrix cache */ pthread_key_create(&node->cache_key, 0); pthread_mutex_init(&node->cache_list_lock, 0); +#endif for(i=0; itracks + i) == -1) { @@ -43,8 +45,10 @@ anm_destroy_track(node->tracks + i); } +#ifdef ANIM_THREAD_SAFE /* destroy thread-specific cache */ pthread_key_delete(node->cache_key); +#endif while(node->cache_list) { struct mat_cache *tmp = node->cache_list; @@ -383,19 +387,27 @@ void anm_get_matrix(struct anm_node *node, mat4_t mat, anm_time_t tm) { +#ifdef ANIM_THREAD_SAFE struct mat_cache *cache = pthread_getspecific(node->cache_key); +#else + struct mat_cache *cache = node->cache_list; +#endif if(!cache) { cache = malloc(sizeof *cache); assert(cache); + cache->time = ANM_TIME_INVAL; + cache->inv_time = ANM_TIME_INVAL; +#ifdef ANIM_THREAD_SAFE pthread_mutex_lock(&node->cache_list_lock); cache->next = node->cache_list; node->cache_list = cache; pthread_mutex_unlock(&node->cache_list_lock); - - cache->time = ANM_TIME_INVAL; - cache->inv_time = ANM_TIME_INVAL; pthread_setspecific(node->cache_key, cache); +#else + cache->next = node->cache_list; + node->cache_list = cache; +#endif } if(cache->time != tm) { @@ -414,19 +426,27 @@ void anm_get_inv_matrix(struct anm_node *node, mat4_t mat, anm_time_t tm) { +#ifdef ANIM_THREAD_SAFE struct mat_cache *cache = pthread_getspecific(node->cache_key); +#else + struct mat_cache *cache = node->cache_list; +#endif if(!cache) { cache = malloc(sizeof *cache); assert(cache); + cache->time = ANM_TIME_INVAL; + cache->inv_time = ANM_TIME_INVAL; +#ifdef ANIM_THREAD_SAFE pthread_mutex_lock(&node->cache_list_lock); cache->next = node->cache_list; node->cache_list = cache; pthread_mutex_unlock(&node->cache_list_lock); - - cache->inv_time = ANM_TIME_INVAL; - cache->inv_time = ANM_TIME_INVAL; pthread_setspecific(node->cache_key, cache); +#else + cache->next = node->cache_list; + node->cache_list = cache; +#endif } if(cache->inv_time != tm) { @@ -491,7 +511,11 @@ static void invalidate_cache(struct anm_node *node) { +#ifdef ANIM_THREAD_SAFE struct mat_cache *cache = pthread_getspecific(node->cache_key); +#else + struct mat_cache *cache = node->cache_list; +#endif if(cache) { cache->time = cache->inv_time = ANM_TIME_INVAL; } diff -r f234630e38ff -r 92695e89164b anim/anim.h --- a/anim/anim.h Sun Nov 09 13:03:36 2014 +0200 +++ b/anim/anim.h Sun Nov 09 14:30:37 2014 +0200 @@ -39,8 +39,10 @@ anm_time_t time, inv_time; struct mat_cache *next; } *cache_list; +#ifdef ANIM_THREAD_SAFE pthread_key_t cache_key; pthread_mutex_t cache_list_lock; +#endif struct anm_node *parent; struct anm_node *child; diff -r f234630e38ff -r 92695e89164b gpuray_glsl.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpuray_glsl.sln Sun Nov 09 14:30:37 2014 +0200 @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpuray_glsl", "gpuray_glsl.vcxproj", "{67C47591-86E2-42F7-A6CA-6A494F80FFCA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {67C47591-86E2-42F7-A6CA-6A494F80FFCA}.Debug|Win32.ActiveCfg = Debug|Win32 + {67C47591-86E2-42F7-A6CA-6A494F80FFCA}.Debug|Win32.Build.0 = Debug|Win32 + {67C47591-86E2-42F7-A6CA-6A494F80FFCA}.Release|Win32.ActiveCfg = Release|Win32 + {67C47591-86E2-42F7-A6CA-6A494F80FFCA}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r f234630e38ff -r 92695e89164b gpuray_glsl.vcxproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpuray_glsl.vcxproj Sun Nov 09 14:30:37 2014 +0200 @@ -0,0 +1,164 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {67C47591-86E2-42F7-A6CA-6A494F80FFCA} + Win32Proj + gpuray_glsl + + + + Application + true + v120 + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\imago;$(SolutionDir)\vmath;$(SolutionDir)\anim + 4244;4996 + + + Console + true + opengl32.lib;glut32.lib;glew32.lib;libpng.lib;jpeglib.lib;zlib.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\imago;$(SolutionDir)\vmath;$(SolutionDir)\anim + 4244;4996 + + + Console + true + true + true + opengl32.lib;glut32.lib;glew32.lib;libpng.lib;jpeglib.lib;zlib.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r f234630e38ff -r 92695e89164b gpuray_glsl.vcxproj.filters --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpuray_glsl.vcxproj.filters Sun Nov 09 14:30:37 2014 +0200 @@ -0,0 +1,240 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;inl;inc + + + {5946a165-6c38-4913-96d8-0365f17329b2} + + + {af4eb374-7991-43ab-a961-2477351ca47d} + + + {d750317b-ef2d-4b6b-afa6-3820784d5b3d} + + + {03007862-3db1-4979-b8ef-6af8304727d9} + + + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + anim + + + anim + + + anim + + + imago + + + imago + + + imago + + + imago + + + imago + + + imago + + + imago + + + imago + + + imago + + + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + anim + + + anim + + + anim + + + anim + + + imago + + + imago + + + + + vmath + + + vmath + + + vmath + + + vmath + + + vmath + + + sdr + + + sdr + + + sdr + + + \ No newline at end of file diff -r f234630e38ff -r 92695e89164b src/texture.cc --- a/src/texture.cc Sun Nov 09 13:03:36 2014 +0200 +++ b/src/texture.cc Sun Nov 09 14:30:37 2014 +0200 @@ -1,10 +1,17 @@ #include -#include #include #include #include "texture.h" #include "object.h" +#ifndef WIN32 +#include +#else +#include + +#define R_OK 4 +#endif + static inline Color sample_image(const Image &img, float u, float v, Texture::WrapMode wrapping); Texture::Texture() diff -r f234630e38ff -r 92695e89164b vmath/vmath.h --- a/vmath/vmath.h Sun Nov 09 13:03:36 2014 +0200 +++ b/vmath/vmath.h Sun Nov 09 14:30:37 2014 +0200 @@ -44,10 +44,6 @@ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) -#ifndef __GNUC__ -#define round(x) ((x) >= 0 ? (x) + 0.5 : (x) - 0.5) -#endif - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff -r f234630e38ff -r 92695e89164b vmath/vmath_config.h --- a/vmath/vmath_config.h Sun Nov 09 13:03:36 2014 +0200 +++ b/vmath/vmath_config.h Sun Nov 09 14:30:37 2014 +0200 @@ -1,7 +1,7 @@ #ifndef VMATH_CONFIG_H_ #define VMATH_CONFIG_H_ -#if (__STDC_VERSION__ < 199999) +#if (__STDC_VERSION__ < 199999) && !defined(__cplusplus) #if defined(__GNUC__) || defined(_MSC_VER) #define inline __inline #else