Procházet zdrojové kódy

math: remove confusing vector members and fix compilation.

undefined
Sam Hocevar před 9 roky
rodič
revize
3fa66de047
3 změnil soubory, kde provedl 16 přidání a 24 odebrání
  1. +1
    -0
      configure.ac
  2. +3
    -8
      src/imgui/lolimgui.cpp
  3. +12
    -16
      src/lol/math/vector.h

+ 1
- 0
configure.ac Zobrazit soubor

@@ -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


+ 3
- 8
src/imgui/lolimgui.cpp Zobrazit soubor

@@ -10,15 +10,10 @@
// See http://www.wtfpl.net/ for more details.
//

#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <lol/engine-internal.h>

#include <cstdio>

#include <lol/engine.h>
#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;


+ 12
- 16
src/lol/math/vector.h Zobrazit soubor

@@ -280,8 +280,6 @@ struct vec_t<T,2>
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<T, 2, 9000> const xx, rr, ss/**/, ww;
@@ -438,8 +436,6 @@ struct vec_t<T,3>
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<T, 2, 9000> const xx, rr, ss/**/, ww;
@@ -1230,13 +1226,13 @@ static inline vec_t<T, N> radians(vec_t<T, N, SWIZZLE> const &a)
return ret;
}

//Cartesian operation consider that you're in spherical coordinate
// Cartesian operation consider that you're in spherical coordinate
template<typename T, int SWIZZLE>
static inline vec_t<T, 2> cartesian(vec_t<T, 2, SWIZZLE> const &a)
{
vec_t<T, 2> 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<typename T, int SWIZZLE>
static inline vec_t<T, 3> cartesian(vec_t<T, 3, SWIZZLE> const &a)
{
vec_t<T, 3> 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<typename T, int SWIZZLE>
static inline vec_t<T, 2> spherical(vec_t<T, 2, SWIZZLE> const &a)
{
vec_t<T, 2> 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<typename T, int SWIZZLE>
static inline vec_t<T, 3> spherical(vec_t<T, 3, SWIZZLE> const &a)
{
vec_t<T, 3> 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;
}



Načítá se…
Zrušit
Uložit