瀏覽代碼

base: move headers around and promote gpu/ to lol/gpu/.

legacy
Sam Hocevar sam 11 年之前
父節點
當前提交
06c4ec01c3
共有 18 個文件被更改,包括 345 次插入244 次删除
  1. +38
    -24
      src/Makefile.am
  2. +4
    -24
      src/core.h
  3. +23
    -0
      src/lol/base/base.h
  4. +3
    -3
      src/lol/gpu/framebuffer.h
  5. +22
    -0
      src/lol/gpu/gpu.h
  6. +3
    -3
      src/lol/gpu/indexbuffer.h
  7. +4
    -4
      src/lol/gpu/lolfx.h
  8. +3
    -3
      src/lol/gpu/shader.h
  9. +3
    -3
      src/lol/gpu/texture.h
  10. +3
    -3
      src/lol/gpu/vertexbuffer.h
  11. +17
    -0
      src/lol/image/image.h
  12. +177
    -0
      src/lol/math/functions.h
  13. +4
    -4
      src/lol/math/geometry.h
  14. +3
    -3
      src/lol/math/half.h
  15. +5
    -161
      src/lol/math/math.h
  16. +19
    -0
      src/lol/sys/sys.h
  17. +3
    -3
      src/lol/sys/thread.h
  18. +11
    -6
      src/lolcore.vcxproj

+ 38
- 24
src/Makefile.am 查看文件

@@ -16,14 +16,44 @@ liblol_a_SOURCES = \
platform.cpp platform.h sprite.cpp sprite.h camera.cpp camera.h \
light.cpp light.h \
\
$(liblol_headers) \
$(liblol_sources) \
\
$(ps3_sources) \
$(xbox_sources) \
$(nacl_sources) \
$(sdl_sources) \
$(d3d9_sources) \
$(android_sources) \
\
$(bullet_sources)
liblol_a_CPPFLAGS = @LOL_CFLAGS@ -I$(srcdir)/bullet

EXTRA_DIST = easymesh/easymesh-scanner.l easymesh/easymesh-parser.y \
gpu/lolfx-scanner.l gpu/lolfx-parser.y

liblol_headers = \
lol/base/base.h \
lol/base/log.h lol/base/array.h lol/base/types.h lol/base/array.h \
lol/base/string.h lol/base/hash.h lol/base/map.h \
lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \
lol/math/math.h lol/math/geometry.h \
\
lol/math/math.h \
lol/math/functions.h lol/math/vector.h lol/math/half.h lol/math/real.h \
lol/math/remez.h lol/math/math.h lol/math/geometry.h \
\
lol/sys/sys.h \
lol/sys/init.h lol/sys/thread.h lol/sys/timer.h \
\
lol/image/image.h \
lol/image/color.h \
lol/unit.h \
\
lol/gpu/gpu.h \
lol/gpu/shader.h lol/gpu/indexbuffer.h lol/gpu/vertexbuffer.h \
lol/gpu/gpu/framebuffer.h lol/gpu/texture.h lol/gpu/lolfx.h \
\
lol/unit.h

liblol_sources = \
generated/location.hh generated/position.hh generated/stack.hh \
\
application/application.cpp application/application.h \
@@ -36,34 +66,24 @@ liblol_a_SOURCES = \
generated/easymesh-parser.cpp generated/easymesh-parser.h \
generated/easymesh-scanner.cpp \
\
$(ps3_sources) \
$(xbox_sources) \
$(nacl_sources) \
$(sdl_sources) \
$(d3d9_sources) \
$(android_sources) \
\
base/hash.cpp base/log.cpp base/string.cpp \
\
math/vector.cpp math/real.cpp math/half.cpp math/trig.cpp \
math/geometry.cpp \
\
gpu/shader.cpp gpu/indexbuffer.cpp gpu/vertexbuffer.cpp \
gpu/framebuffer.cpp gpu/texture.cpp \
\
input/input.cpp input/input.h \
input/keyboard.cpp input/keyboard.h \
input/stick.cpp input/stick.h \
\
gpu/shader.cpp gpu/shader.h \
gpu/indexbuffer.cpp gpu/indexbuffer.h \
gpu/vertexbuffer.cpp gpu/vertexbuffer.h \
gpu/framebuffer.cpp gpu/framebuffer.h \
gpu/texture.cpp gpu/texture.h \
\
gpu/defaultmaterial.lolfx \
gpu/tile.lolfx \
gpu/emptymaterial.lolfx \
gpu/testmaterial.lolfx \
\
gpu/lolfx.cpp gpu/lolfx.h \
gpu/lolfx.cpp \
gpu/lolfx-compiler.cpp gpu/lolfx-compiler.h \
generated/lolfx-parser.cpp generated/lolfx-parser.h \
generated/lolfx-scanner.cpp \
@@ -81,13 +101,7 @@ liblol_a_SOURCES = \
\
loldebug.h \
debug/fps.cpp debug/fps.h \
debug/record.cpp debug/record.h debug/stats.cpp debug/stats.h \
\
$(bullet_sources)
liblol_a_CPPFLAGS = @LOL_CFLAGS@ -I$(srcdir)/bullet

EXTRA_DIST = easymesh/easymesh-scanner.l easymesh/easymesh-parser.y \
gpu/lolfx-scanner.l gpu/lolfx-parser.y
debug/record.cpp debug/record.h debug/stats.cpp debug/stats.h

sdl_sources = \
image/codec/sdl-image.cpp \


+ 4
- 24
src/core.h 查看文件

@@ -79,25 +79,11 @@ static inline int isnan(float f)
#endif

// Base types
#include <lol/base/types.h>
#include <lol/base/log.h>
#include <lol/base/assert.h>
#include <lol/base/array.h>
#include <lol/base/string.h>
#include <lol/base/hash.h>
#include <lol/base/map.h>

#include <lol/base/base.h>
#include <lol/math/math.h>
#include <lol/math/half.h>
#include <lol/math/real.h>
#include <lol/math/vector.h>
#include <lol/math/geometry.h>

#include <lol/sys/init.h>
#include <lol/sys/thread.h>
#include <lol/sys/timer.h>

#include <lol/image/color.h>
#include <lol/sys/sys.h>
#include <lol/image/image.h>
#include <lol/gpu/gpu.h>

#include "numeric.h"

@@ -130,12 +116,6 @@ static inline int isnan(float f)
#include "dict.h"
#include "map.h"
#include "layer.h"
#include "gpu/lolfx.h"
#include "gpu/shader.h"
#include "gpu/texture.h"
#include "gpu/indexbuffer.h"
#include "gpu/vertexbuffer.h"
#include "gpu/framebuffer.h"
#include "mesh/mesh.h"
#include "image/image.h"
#include "application/application.h"


+ 23
- 0
src/lol/base/base.h 查看文件

@@ -0,0 +1,23 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#if !defined __LOL_BASE_BASE_H__
#define __LOL_BASE_BASE_H__

#include <lol/base/types.h>
#include <lol/base/log.h>
#include <lol/base/assert.h>
#include <lol/base/array.h>
#include <lol/base/string.h>
#include <lol/base/hash.h>
#include <lol/base/map.h>

#endif // __LOL_BASE_BASE_H__


src/gpu/framebuffer.h → src/lol/gpu/framebuffer.h 查看文件

@@ -13,8 +13,8 @@
// ---------------------
//

#if !defined __LOL_FRAMEBUFFER_H__
#define __LOL_FRAMEBUFFER_H__
#if !defined __LOL_GPU_FRAMEBUFFER_H__
#define __LOL_GPU_FRAMEBUFFER_H__

#include <cstring>

@@ -38,5 +38,5 @@ private:

} /* namespace lol */

#endif // __LOL_FRAMEBUFFER_H__
#endif // __LOL_GPU_FRAMEBUFFER_H__


+ 22
- 0
src/lol/gpu/gpu.h 查看文件

@@ -0,0 +1,22 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#if !defined __LOL_GPU_GPU_H__
#define __LOL_GPU_GPU_H__

#include <lol/gpu/shader.h>
#include <lol/gpu/indexbuffer.h>
#include <lol/gpu/vertexbuffer.h>
#include <lol/gpu/texture.h>
#include <lol/gpu/framebuffer.h>
#include <lol/gpu/lolfx.h>

#endif // __LOL_GPU_GPU_H__


src/gpu/indexbuffer.h → src/lol/gpu/indexbuffer.h 查看文件

@@ -13,8 +13,8 @@
// ---------------------
//

#if !defined __LOL_INDEXBUFFER_H__
#define __LOL_INDEXBUFFER_H__
#if !defined __LOL_GPU_INDEXBUFFER_H__
#define __LOL_GPU_INDEXBUFFER_H__

#include <cstring>

@@ -39,5 +39,5 @@ private:

} /* namespace lol */

#endif // __LOL_INDEXBUFFER_H__
#endif // __LOL_GPU_INDEXBUFFER_H__


src/gpu/lolfx.h → src/lol/gpu/lolfx.h 查看文件

@@ -13,10 +13,10 @@
// ---------------
//

#if !defined __GPU_LOLFX_H__
#define __GPU_LOLFX_H__
#if !defined __LOL_GPU_LOLFX_H__
#define __LOL_GPU_LOLFX_H__

#include "gpu/shader.h"
#include <lol/gpu/shader.h>

namespace lol
{
@@ -44,5 +44,5 @@ private:

} /* namespace lol */

#endif /* __GPU_LOLFX_H__ */
#endif /* __LOL_GPU_LOLFX_H__ */


src/gpu/shader.h → src/lol/gpu/shader.h 查看文件

@@ -13,8 +13,8 @@
// ----------------
//

#if !defined __LOL_SHADER_H__
#define __LOL_SHADER_H__
#if !defined __LOL_GPU_SHADER_H__
#define __LOL_GPU_SHADER_H__

#include <stdint.h>

@@ -102,5 +102,5 @@ private:

} /* namespace lol */

#endif // __LOL_SHADER_H__
#endif // __LOL_GPU_SHADER_H__


src/gpu/texture.h → src/lol/gpu/texture.h 查看文件

@@ -13,8 +13,8 @@
// -----------------
//

#if !defined __LOL_TEXTURE_H__
#define __LOL_TEXTURE_H__
#if !defined __LOL_GPU_TEXTURE_H__
#define __LOL_GPU_TEXTURE_H__

namespace lol
{
@@ -55,5 +55,5 @@ private:

} /* namespace lol */

#endif // __LOL_TEXTURE_H__
#endif // __LOL_GPU_TEXTURE_H__


src/gpu/vertexbuffer.h → src/lol/gpu/vertexbuffer.h 查看文件

@@ -13,8 +13,8 @@
// ----------------------------------------------
//

#if !defined __LOL_VERTEXBUFFER_H__
#define __LOL_VERTEXBUFFER_H__
#if !defined __LOL_GPU_VERTEXBUFFER_H__
#define __LOL_GPU_VERTEXBUFFER_H__

#include <cstring>

@@ -222,5 +222,5 @@ private:

} /* namespace lol */

#endif // __LOL_VERTEXBUFFER_H__
#endif // __LOL_GPU_VERTEXBUFFER_H__


+ 17
- 0
src/lol/image/image.h 查看文件

@@ -0,0 +1,17 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#if !defined __LOL_IMAGE_IMAGE_H__
#define __LOL_IMAGE_IMAGE_H__

#include <lol/image/color.h>

#endif // __LOL_IMAGE_IMAGE_H__


+ 177
- 0
src/lol/math/functions.h 查看文件

@@ -0,0 +1,177 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2012-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

//
// Various maths functions
// -----------------------
//

#if !defined __LOL_MATH_FUNCTIONS_H__
#define __LOL_MATH_FUNCTIONS_H__

#include <cmath>
#include <cstdio>
#include <algorithm>

#include <stdint.h>

namespace lol
{

/* This is OUR namespace. Don't let Windows headers fuck with it. */
#undef min
#undef max

/* Standard cmath functions */
static inline double sqrt(double const &x) { return std::sqrt(x); }
static inline float sqrt(float const &x) { return std::sqrt(x); }

static inline double exp(double const &x) { return std::exp(x); }
static inline float exp(float const &x) { return std::exp(x); }

static inline double sin(double const &x) { return std::sin(x); }
static inline double cos(double const &x) { return std::cos(x); }
static inline double tan(double const &x) { return std::tan(x); }
static inline float sin(float const &x) { return std::sin(x); }
static inline float cos(float const &x) { return std::cos(x); }
static inline float tan(float const &x) { return std::tan(x); }

static inline double asin(double const &x) { return std::asin(x); }
static inline double acos(double const &x) { return std::acos(x); }
static inline double atan(double const &x) { return std::atan(x); }
static inline float asin(float const &x) { return std::asin(x); }
static inline float acos(float const &x) { return std::acos(x); }
static inline float atan(float const &x) { return std::atan(x); }

static inline double atan2(double const &y, double const &x)
{
return std::atan2(y, x);
}

static inline float atan2(float const &y, float const &x)
{
return std::atan2(y, x);
}

static inline double pow(double const &x, double const &y)
{
return std::pow(x, y);
}

static inline float pow(float const &x, float const &y)
{
return std::pow(x, y);
}

/* Our extensions */
static inline void sincos(double const &x, double *s, double *c)
{
*s = std::sin(x);
*c = std::cos(x);
}

static inline void sincos(float const &x, float *s, float *c)
{
*s = std::sin(x);
*c = std::cos(x);
}

static inline float lerp(float const &a, float const &b, float const &x)
{
return a + (b - a) * x;
}

static inline double lerp(double const &a, double const &b, double const &x)
{
return a + (b - a) * x;
}

static inline ldouble lerp(ldouble const &a, ldouble const &b, ldouble const &x)
{
return a + (b - a) * x;
}


/* These accelerated functions will be merged into the above, one day */
double lol_sin(double);
double lol_cos(double);
double lol_tan(double);
void lol_sincos(double, double*, double*);
void lol_sincos(float, float*, float*);
double lol_asin(double);
double lol_acos(double);
double lol_atan(double);
double lol_atan2(double, double);

/* C++ doesn't define abs() and fmod() for all types; we add these for
* convenience to avoid adding complexity to vector.h. */
static inline int8_t abs(int8_t x) { return std::abs(x); }
static inline uint8_t abs(uint8_t x) { return x; }
static inline int16_t abs(int16_t x) { return std::abs(x); }
static inline uint16_t abs(uint16_t x) { return x; }
static inline int32_t abs(int32_t x) { return std::abs(x); }
static inline uint32_t abs(uint32_t x) { return x; }
#if defined __native_client__
/* The pepper 19 toolchain doesn't provide abs() for long long int. */
static inline int64_t abs(int64_t x) { return x > 0 ? x : -x; }
#else
static inline int64_t abs(int64_t x) { return std::abs(x); }
#endif
static inline uint64_t abs(uint64_t x) { return x; }
static inline float abs(float x) { return std::abs(x); }
static inline double abs(double x) { return std::abs(x); }
static inline ldouble abs(ldouble x) { return std::abs(x); }

static inline uint8_t fmod(uint8_t x, uint8_t y) { return x % y; }
static inline int8_t fmod(int8_t x, int8_t y) { return x % y; }
static inline uint16_t fmod(uint16_t x, uint16_t y) { return x % y; }
static inline int16_t fmod(int16_t x, int16_t y) { return x % y; }
static inline uint32_t fmod(uint32_t x, uint32_t y) { return x % y; }
static inline int32_t fmod(int32_t x, int32_t y) { return x % y; }
static inline uint64_t fmod(uint64_t x, uint64_t y) { return x % y; }
static inline int64_t fmod(int64_t x, int64_t y) { return x % y; }
static inline float fmod(float x, float y) { return std::fmod(x, y); }
static inline double fmod(double x, double y) { return std::fmod(x, y); }
static inline ldouble fmod(ldouble x, ldouble y) { return std::fmod(x, y); }

static inline uint8_t fract(uint8_t x) { (void)x; return 0; }
static inline int8_t fract(int8_t x) { (void)x; return 0; }
static inline uint16_t fract(uint16_t x) { (void)x; return 0; }
static inline int16_t fract(int16_t x) { (void)x; return 0; }
static inline uint32_t fract(uint32_t x) { (void)x; return 0; }
static inline int32_t fract(int32_t x) { (void)x; return 0; }
static inline uint64_t fract(uint64_t x) { (void)x; return 0; }
static inline int64_t fract(int64_t x) { (void)x; return 0; }
static inline float fract(float x) { return x - std::floor(x); }
static inline double fract(double x) { return x - std::floor(x); }
static inline ldouble fract(ldouble x) { return x - std::floor(x); }

#define LOL_MIN_MAX_CLAMP(T) \
static inline T min(T x, T y) { return std::min(x, y); } \
static inline T max(T x, T y) { return std::max(x, y); } \
static inline T clamp(T x, T y, T z) { return min(max(x, y), z); }
LOL_MIN_MAX_CLAMP(uint8_t)
LOL_MIN_MAX_CLAMP(int8_t)
LOL_MIN_MAX_CLAMP(uint16_t)
LOL_MIN_MAX_CLAMP(int16_t)
LOL_MIN_MAX_CLAMP(uint32_t)
LOL_MIN_MAX_CLAMP(int32_t)
LOL_MIN_MAX_CLAMP(uint64_t)
LOL_MIN_MAX_CLAMP(int64_t)
LOL_MIN_MAX_CLAMP(float)
LOL_MIN_MAX_CLAMP(double)
LOL_MIN_MAX_CLAMP(ldouble)
#undef LOL_CLAMP

} /* namespace lol */

#endif // __LOL_MATH_FUNCTIONS_H__


+ 4
- 4
src/lol/math/geometry.h 查看文件

@@ -11,11 +11,11 @@

//
// Various geometry functions
// -----------------------
// --------------------------
//

#if !defined __LOL_GEOMETRY_GEOMETRY_H__
#define __LOL_GEOMETRY_GEOMETRY_H__
#if !defined __LOL_MATH_GEOMETRY_H__
#define __LOL_MATH_GEOMETRY_H__

#include <cmath>
#include <cstdio>
@@ -51,5 +51,5 @@ namespace lol

} /* namespace lol */

#endif // __LOL_GEOMETRY_GEOMETRY_H__
#endif // __LOL_MATH_GEOMETRY_H__


+ 3
- 3
src/lol/math/half.h 查看文件

@@ -13,8 +13,8 @@
// --------------
//

#if !defined __LOL_HALF_H__
#define __LOL_HALF_H__
#if !defined __LOL_MATH_HALF_H__
#define __LOL_MATH_HALF_H__

#include <cstdio>
#include <stdint.h>
@@ -181,5 +181,5 @@ DECLARE_COERCE_FROM_HALF_OPS(long double)

} /* namespace lol */

#endif // __LOL_HALF_H__
#endif // __LOL_MATH_HALF_H__


+ 5
- 161
src/lol/math/math.h 查看文件

@@ -2,176 +2,20 @@
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2012-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

//
// Various maths functions
// -----------------------
//

#if !defined __LOL_MATH_MATH_H__
#define __LOL_MATH_MATH_H__

#include <cmath>
#include <cstdio>
#include <algorithm>

#include <stdint.h>

namespace lol
{

/* This is OUR namespace. Don't let Windows headers fuck with it. */
#undef min
#undef max

/* Standard cmath functions */
static inline double sqrt(double const &x) { return std::sqrt(x); }
static inline float sqrt(float const &x) { return std::sqrt(x); }

static inline double exp(double const &x) { return std::exp(x); }
static inline float exp(float const &x) { return std::exp(x); }

static inline double sin(double const &x) { return std::sin(x); }
static inline double cos(double const &x) { return std::cos(x); }
static inline double tan(double const &x) { return std::tan(x); }
static inline float sin(float const &x) { return std::sin(x); }
static inline float cos(float const &x) { return std::cos(x); }
static inline float tan(float const &x) { return std::tan(x); }

static inline double asin(double const &x) { return std::asin(x); }
static inline double acos(double const &x) { return std::acos(x); }
static inline double atan(double const &x) { return std::atan(x); }
static inline float asin(float const &x) { return std::asin(x); }
static inline float acos(float const &x) { return std::acos(x); }
static inline float atan(float const &x) { return std::atan(x); }

static inline double atan2(double const &y, double const &x)
{
return std::atan2(y, x);
}

static inline float atan2(float const &y, float const &x)
{
return std::atan2(y, x);
}

static inline double pow(double const &x, double const &y)
{
return std::pow(x, y);
}

static inline float pow(float const &x, float const &y)
{
return std::pow(x, y);
}

/* Our extensions */
static inline void sincos(double const &x, double *s, double *c)
{
*s = std::sin(x);
*c = std::cos(x);
}

static inline void sincos(float const &x, float *s, float *c)
{
*s = std::sin(x);
*c = std::cos(x);
}

static inline float lerp(float const &a, float const &b, float const &x)
{
return a + (b - a) * x;
}

static inline double lerp(double const &a, double const &b, double const &x)
{
return a + (b - a) * x;
}

static inline ldouble lerp(ldouble const &a, ldouble const &b, ldouble const &x)
{
return a + (b - a) * x;
}


/* These accelerated functions will be merged into the above, one day */
double lol_sin(double);
double lol_cos(double);
double lol_tan(double);
void lol_sincos(double, double*, double*);
void lol_sincos(float, float*, float*);
double lol_asin(double);
double lol_acos(double);
double lol_atan(double);
double lol_atan2(double, double);

/* C++ doesn't define abs() and fmod() for all types; we add these for
* convenience to avoid adding complexity to vector.h. */
static inline int8_t abs(int8_t x) { return std::abs(x); }
static inline uint8_t abs(uint8_t x) { return x; }
static inline int16_t abs(int16_t x) { return std::abs(x); }
static inline uint16_t abs(uint16_t x) { return x; }
static inline int32_t abs(int32_t x) { return std::abs(x); }
static inline uint32_t abs(uint32_t x) { return x; }
#if defined __native_client__
/* The pepper 19 toolchain doesn't provide abs() for long long int. */
static inline int64_t abs(int64_t x) { return x > 0 ? x : -x; }
#else
static inline int64_t abs(int64_t x) { return std::abs(x); }
#endif
static inline uint64_t abs(uint64_t x) { return x; }
static inline float abs(float x) { return std::abs(x); }
static inline double abs(double x) { return std::abs(x); }
static inline ldouble abs(ldouble x) { return std::abs(x); }

static inline uint8_t fmod(uint8_t x, uint8_t y) { return x % y; }
static inline int8_t fmod(int8_t x, int8_t y) { return x % y; }
static inline uint16_t fmod(uint16_t x, uint16_t y) { return x % y; }
static inline int16_t fmod(int16_t x, int16_t y) { return x % y; }
static inline uint32_t fmod(uint32_t x, uint32_t y) { return x % y; }
static inline int32_t fmod(int32_t x, int32_t y) { return x % y; }
static inline uint64_t fmod(uint64_t x, uint64_t y) { return x % y; }
static inline int64_t fmod(int64_t x, int64_t y) { return x % y; }
static inline float fmod(float x, float y) { return std::fmod(x, y); }
static inline double fmod(double x, double y) { return std::fmod(x, y); }
static inline ldouble fmod(ldouble x, ldouble y) { return std::fmod(x, y); }

static inline uint8_t fract(uint8_t x) { (void)x; return 0; }
static inline int8_t fract(int8_t x) { (void)x; return 0; }
static inline uint16_t fract(uint16_t x) { (void)x; return 0; }
static inline int16_t fract(int16_t x) { (void)x; return 0; }
static inline uint32_t fract(uint32_t x) { (void)x; return 0; }
static inline int32_t fract(int32_t x) { (void)x; return 0; }
static inline uint64_t fract(uint64_t x) { (void)x; return 0; }
static inline int64_t fract(int64_t x) { (void)x; return 0; }
static inline float fract(float x) { return x - std::floor(x); }
static inline double fract(double x) { return x - std::floor(x); }
static inline ldouble fract(ldouble x) { return x - std::floor(x); }

#define LOL_MIN_MAX_CLAMP(T) \
static inline T min(T x, T y) { return std::min(x, y); } \
static inline T max(T x, T y) { return std::max(x, y); } \
static inline T clamp(T x, T y, T z) { return min(max(x, y), z); }
LOL_MIN_MAX_CLAMP(uint8_t)
LOL_MIN_MAX_CLAMP(int8_t)
LOL_MIN_MAX_CLAMP(uint16_t)
LOL_MIN_MAX_CLAMP(int16_t)
LOL_MIN_MAX_CLAMP(uint32_t)
LOL_MIN_MAX_CLAMP(int32_t)
LOL_MIN_MAX_CLAMP(uint64_t)
LOL_MIN_MAX_CLAMP(int64_t)
LOL_MIN_MAX_CLAMP(float)
LOL_MIN_MAX_CLAMP(double)
LOL_MIN_MAX_CLAMP(ldouble)
#undef LOL_CLAMP

} /* namespace lol */
#include <lol/math/functions.h>
#include <lol/math/half.h>
#include <lol/math/real.h>
#include <lol/math/vector.h>
#include <lol/math/geometry.h>

#endif // __LOL_MATH_MATH_H__


+ 19
- 0
src/lol/sys/sys.h 查看文件

@@ -0,0 +1,19 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

#if !defined __LOL_SYS_SYS_H__
#define __LOL_SYS_SYS_H__

#include <lol/sys/init.h>
#include <lol/sys/thread.h>
#include <lol/sys/timer.h>

#endif // __LOL_SYS_SYS_H__


+ 3
- 3
src/lol/sys/thread.h 查看文件

@@ -13,8 +13,8 @@
// ---------------------
//

#if !defined __LOL_THREAD_H__
#define __LOL_THREAD_H__
#if !defined __LOL_SYS_THREAD_H__
#define __LOL_SYS_THREAD_H__

#if defined __CELLOS_LV2__
# include "platform/ps3/threadbase.h"
@@ -46,5 +46,5 @@ public:

} /* namespace lol */

#endif // __LOL_THREAD_H__
#endif // __LOL_SYS_THREAD_H__


+ 11
- 6
src/lolcore.vcxproj 查看文件

@@ -570,13 +570,7 @@
<ClInclude Include="generated\lolfx-parser.h" />
<ClInclude Include="generated\position.hh" />
<ClInclude Include="generated\stack.hh" />
<ClInclude Include="gpu\framebuffer.h" />
<ClInclude Include="gpu\indexbuffer.h" />
<ClInclude Include="gpu\lolfx-compiler.h" />
<ClInclude Include="gpu\lolfx.h" />
<ClInclude Include="gpu\shader.h" />
<ClInclude Include="gpu\texture.h" />
<ClInclude Include="gpu\vertexbuffer.h" />
<ClInclude Include="gradient.h" />
<ClInclude Include="image\image-private.h" />
<ClInclude Include="image\image.h" />
@@ -589,12 +583,22 @@
<ClInclude Include="lolgl.h" />
<ClInclude Include="lol\base\array.h" />
<ClInclude Include="lol\base\assert.h" />
<ClInclude Include="lol\base\base.h" />
<ClInclude Include="lol\base\hash.h" />
<ClInclude Include="lol\base\log.h" />
<ClInclude Include="lol\base\map.h" />
<ClInclude Include="lol\base\string.h" />
<ClInclude Include="lol\base\types.h" />
<ClInclude Include="lol\gpu\framebuffer.h" />
<ClInclude Include="lol\gpu\gpu.h" />
<ClInclude Include="lol\gpu\indexbuffer.h" />
<ClInclude Include="lol\gpu\lolfx.h" />
<ClInclude Include="lol\gpu\shader.h" />
<ClInclude Include="lol\gpu\texture.h" />
<ClInclude Include="lol\gpu\vertexbuffer.h" />
<ClInclude Include="lol\image\color.h" />
<ClInclude Include="lol\image\image.h" />
<ClInclude Include="lol\math\functions.h" />
<ClInclude Include="lol\math\geometry.h" />
<ClInclude Include="lol\math\half.h" />
<ClInclude Include="lol\math\math.h" />
@@ -602,6 +606,7 @@
<ClInclude Include="lol\math\remez.h" />
<ClInclude Include="lol\math\vector.h" />
<ClInclude Include="lol\sys\init.h" />
<ClInclude Include="lol\sys\sys.h" />
<ClInclude Include="lol\sys\thread.h" />
<ClInclude Include="lol\sys\timer.h" />
<ClInclude Include="lol\unit.h" />


Loading…
取消
儲存