@@ -60,12 +60,12 @@ void bench_real(int mode) | |||||
timer.Get(); | timer.Get(); | ||||
for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++) | for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++) | ||||
sin(real(0.01 * i)); | |||||
(void)sin(real(0.01 * i)); | |||||
result[3] += timer.Get() * 128; | result[3] += timer.Get() * 128; | ||||
timer.Get(); | timer.Get(); | ||||
for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++) | for (size_t i = 0; i < REAL_TABLE_SIZE / 128; i++) | ||||
exp((real)(int)(i - REAL_TABLE_SIZE / 256)); | |||||
(void)exp((real)(int)(i - REAL_TABLE_SIZE / 256)); | |||||
result[4] += timer.Get() * 128; | result[4] += timer.Get() * 128; | ||||
} | } | ||||
@@ -138,9 +138,9 @@ public: | |||||
} | } | ||||
void TestStuff() | void TestStuff() | ||||
{ | { | ||||
/* | |||||
lua_State* l = GetLuaState(); | lua_State* l = GetLuaState(); | ||||
/* | |||||
//create property | //create property | ||||
lua_pushnumber(l, 5.0); | lua_pushnumber(l, 5.0); | ||||
lua_setfield(l, -2, "x"); | lua_setfield(l, -2, "x"); | ||||
@@ -1 +1 @@ | |||||
Subproject commit c0aaced0099e0134b707c8c4cd165acc08332fa9 | |||||
Subproject commit ded7874c23e8e6818dca5855def05e7288c24bb9 |
@@ -327,16 +327,16 @@ Shader::Shader(String const &name, | |||||
int attrib_type; | int attrib_type; | ||||
glGetActiveAttrib(data->prog_id, i, max_len, &attrib_len, (GLint*)&attrib_size, (GLenum*)&attrib_type, name_buffer); | glGetActiveAttrib(data->prog_id, i, max_len, &attrib_len, (GLint*)&attrib_size, (GLenum*)&attrib_type, name_buffer); | ||||
String name(name_buffer); | |||||
String attr_name(name_buffer); | |||||
int index = -1; | int index = -1; | ||||
VertexUsage usage = VertexUsage::MAX; | VertexUsage usage = VertexUsage::MAX; | ||||
for (int j = 0; j < (int)VertexUsage::MAX; ++j) | for (int j = 0; j < (int)VertexUsage::MAX; ++j) | ||||
{ | { | ||||
if (name.starts_with(attribute_names[j]) || | |||||
name.starts_with(String(attribute_names[j]).to_lower())) | |||||
if (attr_name.starts_with(attribute_names[j]) || | |||||
attr_name.starts_with(String(attribute_names[j]).to_lower())) | |||||
{ | { | ||||
usage = VertexUsage(j); | usage = VertexUsage(j); | ||||
char* idx_ptr = name.C() + strlen(attribute_names[j]); | |||||
char* idx_ptr = attr_name.C() + strlen(attribute_names[j]); | |||||
index = strtol(idx_ptr, nullptr, 10); | index = strtol(idx_ptr, nullptr, 10); | ||||
break; | break; | ||||
} | } | ||||
@@ -357,7 +357,7 @@ Shader::Shader(String const &name, | |||||
if (data->attrib_locations.has_key(flags)) | if (data->attrib_locations.has_key(flags)) | ||||
{ | { | ||||
msg::error("error while parsing attribute semantics in %s\n", | msg::error("error while parsing attribute semantics in %s\n", | ||||
name.C()); | |||||
attr_name.C()); | |||||
} | } | ||||
#endif | #endif | ||||
data->attrib_locations[flags] = location; | data->attrib_locations[flags] = location; | ||||
@@ -691,6 +691,7 @@ String ShaderData::Patch(String const &code, ShaderType type) | |||||
size_t l0 = strlen(rep[0]); | size_t l0 = strlen(rep[0]); | ||||
size_t l1 = strlen(rep[1]); | size_t l1 = strlen(rep[1]); | ||||
UNUSED(l1); | |||||
String left = patched_code.sub(0, index); | String left = patched_code.sub(0, index); | ||||
String right = patched_code.sub(index + l0, patched_code.count() - (index + l0)); | String right = patched_code.sub(index + l0, patched_code.count() - (index + l0)); | ||||
@@ -44,7 +44,7 @@ float Color::DistanceCIEDE2000(vec3 lab1, vec3 lab2) | |||||
float hp2 = atan2(lab2.z, ap2); | float hp2 = atan2(lab2.z, ap2); | ||||
float dhp = fmod(hp2 - hp1 + 3.f * F_PI, 2.f * F_PI) - F_PI; /* -pi .. pi */ | float dhp = fmod(hp2 - hp1 + 3.f * F_PI, 2.f * F_PI) - F_PI; /* -pi .. pi */ | ||||
float dHp = 2.f * sqrt(Cp1 * Cp2) * sin(0.5f * dhp); | float dHp = 2.f * sqrt(Cp1 * Cp2) * sin(0.5f * dhp); | ||||
float Hp_ = Cp1 * Cp2 ? fmod(hp1 + 0.5f * dhp + 2.f * F_PI, 2.f * F_PI) : hp1 + hp2; /* 0 .. 2pi */ | |||||
float Hp_ = (Cp1 && Cp2) ? fmod(hp1 + 0.5f * dhp + 2.f * F_PI, 2.f * F_PI) : hp1 + hp2; /* 0 .. 2pi */ | |||||
float T = 1.f - 0.17f * cos(Hp_ - F_PI / 6.f) | float T = 1.f - 0.17f * cos(Hp_ - F_PI / 6.f) | ||||
+ 0.24f * cos(2.f * Hp_) | + 0.24f * cos(2.f * Hp_) | ||||
@@ -37,12 +37,12 @@ static String error2string(int errnum) | |||||
return String(tmp); | return String(tmp); | ||||
} | } | ||||
static void ffmpeg_logger(void *ptr, int level, const char *fmt, va_list vl) | |||||
/*static void ffmpeg_logger(void *ptr, int level, const char *fmt, va_list vl) | |||||
{ | { | ||||
// FIXME: use lol::msg::debug | // FIXME: use lol::msg::debug | ||||
UNUSED(ptr, level); | UNUSED(ptr, level); | ||||
vfprintf(stderr, fmt, vl); | vfprintf(stderr, fmt, vl); | ||||
} | |||||
}*/ | |||||
#endif | #endif | ||||
movie::movie(ivec2 size) | movie::movie(ivec2 size) | ||||
@@ -52,12 +52,16 @@ | |||||
#undef LOL_FEATURE_CXX11_SFINAE_FOR_CTORS | #undef LOL_FEATURE_CXX11_SFINAE_FOR_CTORS | ||||
#undef LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD | #undef LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD | ||||
#undef LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH | |||||
/* Features detected through __has_cpp_attribute */ | /* Features detected through __has_cpp_attribute */ | ||||
#ifdef __has_cpp_attribute | #ifdef __has_cpp_attribute | ||||
# if __has_cpp_attribute(nodiscard) | # if __has_cpp_attribute(nodiscard) | ||||
# define LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD 1 | # define LOL_FEATURE_CXX17_ATTRIBUTE_NODISCARD 1 | ||||
# endif | # endif | ||||
# if __has_cpp_attribute(fallthrough) | |||||
# define LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH 1 | |||||
# endif | |||||
#endif | #endif | ||||
/* Features supported by GCC */ | /* Features supported by GCC */ | ||||
@@ -128,6 +132,12 @@ | |||||
# define LOL_ATTR_NODISCARD /* */ | # define LOL_ATTR_NODISCARD /* */ | ||||
#endif | #endif | ||||
#ifdef LOL_FEATURE_CXX17_ATTRIBUTE_FALLTHROUGH | |||||
# define LOL_ATTR_FALLTHROUGH [[fallthrough]] | |||||
#else | |||||
# define LOL_ATTR_FALLTHROUGH /* */ | |||||
#endif | |||||
/* | /* | ||||
* Ensure we have ptrdiff_t. | * Ensure we have ptrdiff_t. | ||||
@@ -243,6 +243,7 @@ template<> real::Real(char const *str) | |||||
finished = true; | finished = true; | ||||
break; | break; | ||||
} | } | ||||
LOL_ATTR_FALLTHROUGH /* FIXME: why doesn’t this seem to work? */ | |||||
case 'a': case 'b': case 'c': case 'd': case 'f': | case 'a': case 'b': case 'c': case 'd': case 'f': | ||||
case 'A': case 'B': case 'C': case 'D': case 'F': | case 'A': case 'B': case 'C': case 'D': case 'F': | ||||
case '0': case '1': case '2': case '3': case '4': | case '0': case '1': case '2': case '3': case '4': | ||||
@@ -201,6 +201,7 @@ private: | |||||
SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | ||||
data(new SdlAppData()) | data(new SdlAppData()) | ||||
{ | { | ||||
UNUSED(title); | |||||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | #if LOL_USE_SDL || LOL_USE_OLD_SDL | ||||
ivec2 window_size = res; | ivec2 window_size = res; | ||||
ivec2 screen_size = res; | ivec2 screen_size = res; | ||||
@@ -68,6 +68,7 @@ static int sdl12_to_scancode(int ch, int sc) | |||||
return false; | return false; | ||||
} | } | ||||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
/* DEBUG STUFF | |||||
static String ScanCodeToText(int sc) | static String ScanCodeToText(int sc) | ||||
{ | { | ||||
switch (sc) | switch (sc) | ||||
@@ -80,7 +81,9 @@ static int sdl12_to_scancode(int ch, int sc) | |||||
} | } | ||||
return String(); | return String(); | ||||
} | } | ||||
*/ | |||||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
/* DEBUG STUFF | |||||
static String ScanCodeToName(int sc) | static String ScanCodeToName(int sc) | ||||
{ | { | ||||
switch (sc) | switch (sc) | ||||
@@ -93,6 +96,7 @@ static int sdl12_to_scancode(int ch, int sc) | |||||
} | } | ||||
return String(); | return String(); | ||||
} | } | ||||
*/ | |||||
#endif | #endif | ||||
/* | /* | ||||
@@ -237,6 +241,9 @@ void SdlInput::TickDraw(float seconds, Scene &scene) | |||||
void SdlInputData::Tick(float seconds) | void SdlInputData::Tick(float seconds) | ||||
{ | { | ||||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | #if LOL_USE_SDL || LOL_USE_OLD_SDL | ||||
/* FIXME: maybe we should make use of this? */ | |||||
UNUSED(seconds); | |||||
/* Pump all joystick events because no event is coming to us. */ | /* Pump all joystick events because no event is coming to us. */ | ||||
# if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN | # if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN | ||||
SDL_JoystickUpdate(); | SDL_JoystickUpdate(); | ||||
@@ -459,6 +466,7 @@ void SdlInputData::SetMousePos(ivec2 position) | |||||
{ | { | ||||
#if LOL_USE_SDL | #if LOL_USE_SDL | ||||
// FIXME: how do I warped mouse? | // FIXME: how do I warped mouse? | ||||
UNUSED(position); | |||||
#elif LOL_USE_OLD_SDL | #elif LOL_USE_OLD_SDL | ||||
SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y); | SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y); | ||||
#else | #else | ||||