Changeset 2524
- Timestamp:
- Feb 27, 2013, 7:13:22 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r2500 r2524 32 32 33 33 liblolcore_headers = \ 34 lol/base/ base.h \34 lol/base/all.h \ 35 35 lol/base/log.h lol/base/array.h lol/base/types.h lol/base/array.h \ 36 36 lol/base/assert.h lol/base/string.h lol/base/hash.h lol/base/map.h \ 37 37 \ 38 lol/math/ math.h \38 lol/math/all.h \ 39 39 lol/math/functions.h lol/math/vector.h lol/math/half.h lol/math/real.h \ 40 40 lol/math/remez.h lol/math/math.h lol/math/geometry.h lol/math/interp.h \ 41 lol/math/rand.h \ 41 42 \ 42 lol/sys/ sys.h \43 lol/sys/all.h \ 43 44 lol/sys/init.h lol/sys/file.h lol/sys/thread.h lol/sys/atomic.h \ 44 45 lol/sys/timer.h \ 45 46 \ 46 lol/image/ image.h \47 lol/image/all.h \ 47 48 lol/image/color.h \ 48 49 \ 49 lol/gpu/ gpu.h \50 lol/gpu/all.h \ 50 51 lol/gpu/shader.h lol/gpu/indexbuffer.h lol/gpu/vertexbuffer.h \ 51 52 lol/gpu/framebuffer.h lol/gpu/texture.h lol/gpu/lolfx.h \ 52 53 \ 53 lol/debug/ debug.h \54 lol/debug/all.h \ 54 55 lol/debug/line.h \ 55 56 \ -
trunk/src/core.h
r2506 r2524 92 92 93 93 // Base types 94 #include <lol/base/ base.h>95 #include <lol/math/ math.h>96 #include <lol/sys/ sys.h>97 #include <lol/image/ image.h>98 #include <lol/gpu/ gpu.h>99 #include <lol/debug/ debug.h>94 #include <lol/base/all.h> 95 #include <lol/math/all.h> 96 #include <lol/sys/all.h> 97 #include <lol/image/all.h> 98 #include <lol/gpu/all.h> 99 #include <lol/debug/all.h> 100 100 101 101 #include "numeric.h" -
trunk/src/lol/base/all.h
r2523 r2524 9 9 // 10 10 11 #if !defined __LOL_BASE_ BASE_H__12 #define __LOL_BASE_ BASE_H__11 #if !defined __LOL_BASE_ALL_H__ 12 #define __LOL_BASE_ALL_H__ 13 13 14 14 #include <lol/base/types.h> … … 20 20 #include <lol/base/map.h> 21 21 22 #endif // __LOL_BASE_ BASE_H__22 #endif // __LOL_BASE_ALL_H__ 23 23 -
trunk/src/lol/debug/all.h
r2523 r2524 9 9 // 10 10 11 #if !defined __LOL_DEBUG_ DEBUG_H__12 #define __LOL_DEBUG_ DEBUG_H__11 #if !defined __LOL_DEBUG_ALL_H__ 12 #define __LOL_DEBUG_ALL_H__ 13 13 14 14 #include <lol/debug/lines.h> 15 15 16 #endif // __LOL_DEBUG_ DEBUG_H__16 #endif // __LOL_DEBUG_ALL_H__ 17 17 -
trunk/src/lol/gpu/all.h
r2523 r2524 9 9 // 10 10 11 #if !defined __LOL_GPU_ GPU_H__12 #define __LOL_GPU_ GPU_H__11 #if !defined __LOL_GPU_ALL_H__ 12 #define __LOL_GPU_ALL_H__ 13 13 14 14 #include <lol/gpu/shader.h> … … 19 19 #include <lol/gpu/lolfx.h> 20 20 21 #endif // __LOL_GPU_ GPU_H__21 #endif // __LOL_GPU_ALL_H__ 22 22 -
trunk/src/lol/image/all.h
r2523 r2524 9 9 // 10 10 11 #if !defined __LOL_IMAGE_ IMAGE_H__12 #define __LOL_IMAGE_ IMAGE_H__11 #if !defined __LOL_IMAGE_ALL_H__ 12 #define __LOL_IMAGE_ALL_H__ 13 13 14 14 #include <lol/image/color.h> 15 15 16 #endif // __LOL_IMAGE_ IMAGE_H__16 #endif // __LOL_IMAGE_ALL_H__ 17 17 -
trunk/src/lol/math/all.h
r2523 r2524 9 9 // 10 10 11 #if !defined __LOL_MATH_ MATH_H__12 #define __LOL_MATH_ MATH_H__11 #if !defined __LOL_MATH_ALL_H__ 12 #define __LOL_MATH_ALL_H__ 13 13 14 14 #include <lol/math/functions.h> … … 18 18 #include <lol/math/geometry.h> 19 19 #include <lol/math/interp.h> 20 #include <lol/math/rand.h> 20 21 21 #endif // __LOL_MATH_ MATH_H__22 #endif // __LOL_MATH_ALL_H__ 22 23 -
trunk/src/lol/math/vector.h
r2348 r2524 20 20 #include <ostream> 21 21 22 #include <lol/math/math.h>23 22 #include <lol/math/half.h> 24 23 #include <lol/math/real.h> -
trunk/src/lol/sys/all.h
r2523 r2524 9 9 // 10 10 11 #if !defined __LOL_SYS_ SYS_H__12 #define __LOL_SYS_ SYS_H__11 #if !defined __LOL_SYS_ALL_H__ 12 #define __LOL_SYS_ALL_H__ 13 13 14 14 #include <lol/sys/thread.h> … … 18 18 #include <lol/sys/timer.h> 19 19 20 #endif // __LOL_SYS_ SYS_H__20 #endif // __LOL_SYS_ALL_H__ 21 21 -
trunk/src/lolcore.vcxproj
r2500 r2524 197 197 <ClInclude Include="loldebug.h" /> 198 198 <ClInclude Include="lolgl.h" /> 199 <ClInclude Include="lol\base\all.h" /> 199 200 <ClInclude Include="lol\base\array.h" /> 200 201 <ClInclude Include="lol\base\assert.h" /> 201 <ClInclude Include="lol\base\base.h" />202 202 <ClInclude Include="lol\base\hash.h" /> 203 203 <ClInclude Include="lol\base\log.h" /> … … 205 205 <ClInclude Include="lol\base\string.h" /> 206 206 <ClInclude Include="lol\base\types.h" /> 207 <ClInclude Include="lol\debug\ debug.h" />207 <ClInclude Include="lol\debug\all.h" /> 208 208 <ClInclude Include="lol\debug\lines.h" /> 209 <ClInclude Include="lol\gpu\all.h" /> 209 210 <ClInclude Include="lol\gpu\framebuffer.h" /> 210 <ClInclude Include="lol\gpu\gpu.h" />211 211 <ClInclude Include="lol\gpu\indexbuffer.h" /> 212 212 <ClInclude Include="lol\gpu\lolfx.h" /> … … 214 214 <ClInclude Include="lol\gpu\texture.h" /> 215 215 <ClInclude Include="lol\gpu\vertexbuffer.h" /> 216 <ClInclude Include="lol\image\all.h" /> 216 217 <ClInclude Include="lol\image\color.h" /> 217 <ClInclude Include="lol\ image\image.h" />218 <ClInclude Include="lol\math\all.h" /> 218 219 <ClInclude Include="lol\math\functions.h" /> 219 220 <ClInclude Include="lol\math\geometry.h" /> 220 221 <ClInclude Include="lol\math\half.h" /> 221 222 <ClInclude Include="lol\math\interp.h" /> 222 <ClInclude Include="lol\math\ math.h" />223 <ClInclude Include="lol\math\rand.h" /> 223 224 <ClInclude Include="lol\math\real.h" /> 224 225 <ClInclude Include="lol\math\remez.h" /> 225 226 <ClInclude Include="lol\math\vector.h" /> 227 <ClInclude Include="lol\sys\all.h" /> 226 228 <ClInclude Include="lol\sys\atomic.h" /> 227 229 <ClInclude Include="lol\sys\file.h" /> -
trunk/src/lolcore.vcxproj.filters
r2500 r2524 327 327 <Filter>lol\math</Filter> 328 328 </ClInclude> 329 <ClInclude Include="lol\math\math.h"> 329 <ClInclude Include="lol\math\all.h"> 330 <Filter>lol\math</Filter> 331 </ClInclude> 332 <ClInclude Include="lol\math\rand.h"> 330 333 <Filter>lol\math</Filter> 331 334 </ClInclude> … … 522 525 <Filter>easymesh</Filter> 523 526 </ClInclude> 524 <ClInclude Include="lol\base\ base.h">527 <ClInclude Include="lol\base\all.h"> 525 528 <Filter>lol\base</Filter> 526 529 </ClInclude> … … 540 543 <Filter>lol\gpu</Filter> 541 544 </ClInclude> 542 <ClInclude Include="lol\image\ image.h">545 <ClInclude Include="lol\image\all.h"> 543 546 <Filter>lol\image</Filter> 544 547 </ClInclude> 545 <ClInclude Include="lol\gpu\ gpu.h">548 <ClInclude Include="lol\gpu\all.h"> 546 549 <Filter>lol\gpu</Filter> 547 550 </ClInclude> … … 567 570 <Filter>lol\gpu</Filter> 568 571 </ClInclude> 569 <ClInclude Include="lol\sys\ sys.h">572 <ClInclude Include="lol\sys\all.h"> 570 573 <Filter>lol\sys</Filter> 571 574 </ClInclude> -
trunk/src/numeric.h
r2520 r2524 22 22 namespace lol 23 23 { 24 25 /* Random number generators */26 template<typename T> static inline T rand();27 template<typename T> static inline T rand(T a);28 template<typename T> static inline T rand(T a, T b);29 30 /* One-value random number generators */31 template<typename T> static inline T rand(T a)32 {33 return rand<T>() % a;34 }35 36 template<>37 inline half rand<half>(half a) { return a * std::rand() / RAND_MAX; }38 template<>39 inline float rand<float>(float a) { return a * std::rand() / RAND_MAX; }40 template<>41 inline double rand<double>(double a) { return a * std::rand() / RAND_MAX; }42 template<>43 inline ldouble rand<ldouble>(ldouble a) { return a * std::rand() / RAND_MAX; }44 45 /* Two-value random number generator -- no need for specialisation */46 template<typename T> static inline T rand(T a, T b)47 {48 return a + rand<T>(b - a);49 }50 51 /* Default random number generator */52 template<typename T> static inline T rand()53 {54 switch (sizeof(T))55 {56 case 1:57 return static_cast<T>(std::rand() & 0xff);58 case 2:59 if (RAND_MAX >= 0xffff)60 return static_cast<T>(std::rand());61 else62 return static_cast<T>((std::rand() << 8) ^ std::rand());63 case 4:64 if (RAND_MAX >= 0xffff)65 return static_cast<T>((std::rand() << 16) ^ std::rand());66 else67 return static_cast<T>((std::rand() << 24) ^ (std::rand() << 16)68 ^ (std::rand() << 8) ^ std::rand());69 case 8:70 if (RAND_MAX >= 0xffff)71 return static_cast<T>(((uint64_t)std::rand() << 48)72 ^ ((uint64_t)std::rand() << 32)73 ^ ((uint64_t)std::rand() << 16)74 ^ ((uint64_t)std::rand()));75 else76 return static_cast<T>(((uint64_t)std::rand() << 56)77 ^ ((uint64_t)std::rand() << 48)78 ^ ((uint64_t)std::rand() << 40)79 ^ ((uint64_t)std::rand() << 32)80 ^ ((uint64_t)std::rand() << 24)81 ^ ((uint64_t)std::rand() << 16)82 ^ ((uint64_t)std::rand() << 8)83 ^ ((uint64_t)std::rand()));84 default:85 ASSERT(false, "rand() doesn’t support types of size %d\n",86 (int)sizeof(T));87 }88 }89 90 template<> inline half rand<half>() { return rand<half>(1.f); }91 template<> inline float rand<float>() { return rand<float>(1.f); }92 template<> inline double rand<double>() { return rand<double>(1.0); }93 template<> inline ldouble rand<ldouble>() { return rand<ldouble>(1.0); }94 95 24 96 25 /* Next power of two. */ -
trunk/test/Makefile.am
r2468 r2524 22 22 unit/build.cpp unit/real.cpp unit/image.cpp unit/quat.cpp unit/cmplx.cpp \ 23 23 unit/array.cpp unit/rotation.cpp unit/string.cpp unit/map.cpp \ 24 unit/color.cpp unit/atomic.cpp unit/interp.cpp unit/box.cpp 24 unit/color.cpp unit/atomic.cpp unit/interp.cpp unit/box.cpp \ 25 unit/rand.cpp 25 26 testsuite_CPPFLAGS = $(AM_CPPFLAGS) 26 27 testsuite_DEPENDENCIES = @LOL_DEPENDENCIES@ -
trunk/test/testsuite.vcxproj
r2468 r2524 48 48 <ClCompile Include="unit\matrix.cpp" /> 49 49 <ClCompile Include="unit\quat.cpp" /> 50 <ClCompile Include="unit\rand.cpp" /> 50 51 <ClCompile Include="unit\real.cpp" /> 51 52 <ClCompile Include="unit\rotation.cpp" />
Note: See TracChangeset
for help on using the changeset viewer.