From 3fa66de047927a1c029692c038ab186405f75f41 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 19 Mar 2015 15:40:48 +0000 Subject: [PATCH] math: remove confusing vector members and fix compilation. --- configure.ac | 1 + src/imgui/lolimgui.cpp | 11 +++-------- src/lol/math/vector.h | 28 ++++++++++++---------------- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 1562d7f6..6f0fbc8b 100644 --- a/configure.ac +++ b/configure.ac @@ -485,6 +485,7 @@ AC_CONFIG_FILES( src/Makefile src/bullet/Makefile src/lua/Makefile + src/imgui/Makefile src/data/Makefile src/data/font/Makefile src/t/Makefile diff --git a/src/imgui/lolimgui.cpp b/src/imgui/lolimgui.cpp index 9bbd4e61..cdf99ce9 100644 --- a/src/imgui/lolimgui.cpp +++ b/src/imgui/lolimgui.cpp @@ -10,15 +10,10 @@ // See http://www.wtfpl.net/ for more details. // -#if HAVE_CONFIG_H -# include "config.h" -#endif +#include #include -#include -#include "loldebug.h" - using namespace lol; //----------------------------------------------------------------------------- @@ -145,7 +140,7 @@ void LolImGui::TickGame(float seconds) // Build texture unsigned char* pixels; ivec2 size; - io.Fonts->GetTexDataAsAlpha8(&pixels, &size.w, &size.h); + io.Fonts->GetTexDataAsAlpha8(&pixels, &size.x, &size.y); Image* image = new Image(); image->Copy(pixels, size, PixelFormat::RGBA_8); @@ -174,7 +169,7 @@ void LolImGui::TickGame(float seconds) // Setup display size (every frame to accommodate for window resizing) vec2 video_size = vec2(0); video_size = vec2(Video::GetSize()); - io.DisplaySize = ImVec2(video_size.w, video_size.h); + io.DisplaySize = ImVec2(video_size.x, video_size.y); // Setup time step io.DeltaTime = seconds; diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 7816411d..56268973 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -280,8 +280,6 @@ struct vec_t struct { T x, y; }; /* axis */ struct { T r, g; }; /* red, green */ struct { T s, t; }; - struct { T r, t; }; /* radius, theta */ - struct { T w, h; }; /* width, height */ #if !_DOXYGEN_SKIP_ME vec_t const xx, rr, ss/**/, ww; @@ -438,8 +436,6 @@ struct vec_t struct { T x, y, z; }; /* axis */ struct { T r, g, b; }; /* red, green, blue */ struct { T s, t, p; }; - struct { T r, t, p; }; /* radius, theta, phi */ - struct { T w, h, d; }; /* width, height, depth */ #if !_DOXYGEN_SKIP_ME vec_t const xx, rr, ss/**/, ww; @@ -1230,13 +1226,13 @@ static inline vec_t radians(vec_t const &a) return ret; } -//Cartesian operation consider that you're in spherical coordinate +// Cartesian operation consider that you're in spherical coordinate template static inline vec_t cartesian(vec_t const &a) { vec_t ret; - ret.x = r * lol::cos(t); - ret.y = r * lol::sin(t); + ret.x = a[0] * lol::cos(a[1]); + ret.y = a[0] * lol::sin(a[1]); return ret; } @@ -1244,19 +1240,19 @@ template static inline vec_t cartesian(vec_t const &a) { vec_t ret; - ret.x = r * lol::sin(t) * lol::cos(p); - ret.y = r * lol::sin(t) * lol::sin(p); - ret.z = r * lol::cos(t); + ret.x = a[0] * lol::sin(a[1]) * lol::cos(a[2]); + ret.y = a[0] * lol::sin(a[1]) * lol::sin(a[2]); + ret.z = a[0] * lol::cos(a[1]); return ret; } -//Spherical operation consider that you're in cartesian coordinate +// Spherical operation consider that you're in cartesian coordinate template static inline vec_t spherical(vec_t const &a) { vec_t ret; - ret.r = lol::sqrt(lol::sq(x) + lol::sq(y)); - ret.t = lol::atan2(y, x); + ret[0] = sqlength(a); + ret[1] = lol::atan2(a.y, a.x); return ret; } @@ -1264,9 +1260,9 @@ template static inline vec_t spherical(vec_t const &a) { vec_t ret; - ret.r = lol::sqrt(lol::sq(x) + lol::sq(y) + lol::sq(z)); - ret.t = lol::acos(z / ret.x); - ret.p = lol::atan(y / x); + ret[0] = sqlength(a); + ret[1] = lol::acos(a.z / ret[a.x]); + ret[2] = lol::atan(a.y / a.x); return ret; }