Browse Source

math: add constant vectors vec2::zero, vec2::axis_x, etc.

undefined
Sam Hocevar 11 years ago
parent
commit
5f3ad5cc15
22 changed files with 160 additions and 80 deletions
  1. +5
    -5
      demos/tutorial/12_voronoi.cpp
  2. +1
    -1
      src/Makefile.am
  3. +1
    -1
      src/camera.cpp
  4. +0
    -8
      src/core.h
  5. +1
    -1
      src/debug/record.cpp
  6. +1
    -1
      src/easymesh/easymesh.cpp
  7. +1
    -1
      src/font.cpp
  8. +1
    -1
      src/gpu/framebuffer.cpp
  9. +1
    -1
      src/gpu/renderer.cpp
  10. +1
    -1
      src/image/color/cie1931.cpp
  11. +1
    -1
      src/input/input.cpp
  12. +1
    -1
      src/light.cpp
  13. +61
    -37
      src/lol/math/vector.h
  14. +2
    -1
      src/lolcore.vcxproj
  15. +1
    -1
      src/map.cpp
  16. +63
    -0
      src/math/constants.cpp
  17. +1
    -1
      src/math/vector.cpp
  18. +1
    -1
      src/platform/sdl/sdlinput.cpp
  19. +4
    -4
      src/worldentity.cpp
  20. +1
    -1
      test/btphystest.cpp
  21. +9
    -9
      test/meshviewer.cpp
  22. +2
    -2
      test/unit/camera.cpp

+ 5
- 5
demos/tutorial/12_voronoi.cpp View File

@@ -187,7 +187,7 @@ public:
while (i-- > 0)
voronoi_points.Push(vec3(rand<float>(512.f), rand<float>(512.f), .0f),
vec2(64.f + rand<float>(64.f), 64.f + rand<float>(64.f))
//vec2(0.f)
//vec2::zero
);
mode = 1;
}
@@ -316,7 +316,7 @@ public:
Framebuffer *src_buf;
Shader *shader;

if (curres == ivec2(0))
if (curres == ivec2::zero)
shader = m_screen_shader;
else
shader = m_fbos[m_cur_fbo].m2;
@@ -352,7 +352,7 @@ public:
#endif

int i = 0;
if (curres == ivec2(0))
if (curres == ivec2::zero)
m_screen_shader->SetUniform(m_screen_texture, src_buf->GetTexture(), 0);
else if (m_cur_fbo == VoronoiFbo)
{
@@ -368,12 +368,12 @@ public:
m_fbos[m_cur_fbo].m2->Unbind();
dst_buf->Unbind();

if (curres == ivec2(0))
if (curres == ivec2::zero)
break;
if (curres == ivec2(1))
{
if (buf == 1)
curres = ivec2(0);
curres = ivec2::zero;
else
break;
}


+ 1
- 1
src/Makefile.am View File

@@ -76,7 +76,7 @@ liblolcore_sources = \
base/assert.cpp base/hash.cpp base/log.cpp base/string.cpp \
\
math/vector.cpp math/real.cpp math/half.cpp math/trig.cpp \
math/geometry.cpp \
math/constants.cpp math/geometry.cpp \
\
gpu/shader.cpp gpu/indexbuffer.cpp gpu/vertexbuffer.cpp \
gpu/framebuffer.cpp gpu/texture.cpp gpu/renderer.cpp \


+ 1
- 1
src/camera.cpp View File

@@ -46,7 +46,7 @@ Camera::Camera()

/* Create a default perspective */
SetProjection(m_fov, m_near, m_far, m_screen_size, m_screen_ratio);
SetView(mat4::lookat(vec3(0.f, 50.f, 50.f), vec3(0.f), vec3(0.f, 1.f, 0.f)));
SetView(mat4::lookat(vec3(0.f, 50.f, 50.f), vec3::zero, vec3::axis_y));
}

Camera::~Camera()


+ 0
- 8
src/core.h View File

@@ -55,16 +55,8 @@

#if LOL_FEATURE_CXX11_CONSTEXPR
# define LOL_CONSTEXPR constexpr
# define LOL_CONSTEXPR_DECLARATION(type, name, value) \
static type constexpr name = value;
# define LOL_CONSTEXPR_DEFINITION(type, name, value) \
/* Nothing */
#else
# define LOL_CONSTEXPR /* Nothing */
# define LOL_CONSTEXPR_DECLARATION(type, name, value) \
static type const name;
# define LOL_CONSTEXPR_DEFINITION(type, name, value) \
type const name = value;
#endif




+ 1
- 1
src/debug/record.cpp View File

@@ -53,7 +53,7 @@ DebugRecord::DebugRecord(char const *path, float fps)
Ticker::StartRecording();

data->path = strdup(path);
data->size = ivec2(0);
data->size = ivec2::zero;
data->fps = (int)(fps + 0.5f);
#if defined USE_PIPI
data->sequence = nullptr;


+ 1
- 1
src/easymesh/easymesh.cpp View File

@@ -146,7 +146,7 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model)
for (int i = 0; i < lights.Count(); ++i)
light_data << lights[i]->GetPosition() << lights[i]->GetColor();
while (light_data.Count() < 8)
light_data << vec4(0.f) << vec4(0.f);
light_data << vec4::zero << vec4::zero;
m_shader->SetUniform(*GetUniform("u_Lights"), light_data);

m_shader->SetUniform(*GetUniform("in_ModelView"), modelview);


+ 1
- 1
src/font.cpp View File

@@ -45,7 +45,7 @@ Font::Font(char const *path)
{
data->m_name = String("<font> ") + path;

data->tileset = Tiler::Register(path, ivec2(0), ivec2(16));
data->tileset = Tiler::Register(path, ivec2::zero, ivec2(16));
data->size = data->tileset->GetTileSize(0);

m_drawgroup = DRAWGROUP_BEFORE;


+ 1
- 1
src/gpu/framebuffer.cpp View File

@@ -471,7 +471,7 @@ void Framebuffer::Bind()
* instead, maybe by getting rid of Framebuffer::Bind() and
* creating RenderContext::SetFramebuffer() instead. */
m_data->m_saved_viewport = g_renderer->GetViewport();
g_renderer->SetViewport(ibox2(ivec2(0), m_data->m_size));
g_renderer->SetViewport(ibox2(ivec2::zero, m_data->m_size));
m_data->m_bound = true;
}



+ 1
- 1
src/gpu/renderer.cpp View File

@@ -138,7 +138,7 @@ Renderer::Renderer(ivec2 size)

/* Initialise rendering states */
m_data->m_viewport = ibox2(0, 0, 0, 0);
SetViewport(ibox2(vec2(0), size));
SetViewport(ibox2(vec2::zero, size));

m_data->m_clear_color = vec4(-1.f);
SetClearColor(vec4(0.1f, 0.2f, 0.3f, 1.0f));


+ 1
- 1
src/image/color/cie1931.cpp View File

@@ -582,7 +582,7 @@ vec3 Color::WavelengthToCIExyY(float nm)

int i = (int)nm;
if (i < 0 || i > 830 - 360)
return vec3(0.0f);
return vec3::zero;

float t = nm - i, s = 1.0 - t;
float x = s * cie_1931_xyz[i * 3 + 0] + t * cie_1931_xyz[i * 3 + 3];


+ 1
- 1
src/input/input.cpp View File

@@ -47,7 +47,7 @@ void InputDeviceInternal::AddAxis(const char* name, float sensitivity)
void InputDeviceInternal::AddCursor(const char* name)
{
m_cursornames.Push(name);
m_cursors.Push(vec2(0.0), ivec2(0));
m_cursors.Push(vec2::zero, ivec2::zero);
}

InputDeviceInternal* InputDeviceInternal::CreateStandardKeyboard()


+ 1
- 1
src/light.cpp View File

@@ -27,7 +27,7 @@ Light::Light()
m_gamegroup = GAMEGROUP_BEFORE;
m_drawgroup = DRAWGROUP_CAMERA;

SetPosition(vec4(0.f));
SetPosition(vec4::zero);
}

Light::~Light()


+ 61
- 37
src/lol/math/vector.h View File

@@ -168,8 +168,8 @@ template<typename T, int N> struct XVec4

template <typename T> struct BVec2
{
explicit inline BVec2() {}
explicit inline BVec2(T X, T Y) : x(X), y(Y) {}
explicit inline LOL_CONSTEXPR BVec2() {}
explicit inline LOL_CONSTEXPR BVec2(T X, T Y) : x(X), y(Y) {}

union
{
@@ -236,21 +236,25 @@ template <> struct BVec2<real>

template <typename T> struct Vec2 : BVec2<T>
{
inline Vec2() {}
inline Vec2(T X, T Y) : BVec2<T>(X, Y) {}
inline LOL_CONSTEXPR Vec2() {}
inline LOL_CONSTEXPR Vec2(T X, T Y) : BVec2<T>(X, Y) {}

explicit inline Vec2(T X) : BVec2<T>(X, X) {}
explicit LOL_CONSTEXPR inline Vec2(T X) : BVec2<T>(X, X) {}

template<int N>
inline Vec2(XVec2<T, N> const &v)
inline LOL_CONSTEXPR Vec2(XVec2<T, N> const &v)
: BVec2<T>(v[0], v[1]) {}

template<typename U, int N>
explicit inline Vec2(XVec2<U, N> const &v)
explicit inline LOL_CONSTEXPR Vec2(XVec2<U, N> const &v)
: BVec2<T>(v[0], v[1]) {}

LOL_MEMBER_OPS(Vec2, x)

static const Vec2<T> zero;
static const Vec2<T> axis_x;
static const Vec2<T> axis_y;

template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Vec2<U> const &v);
};
@@ -261,9 +265,9 @@ template <typename T> struct Vec2 : BVec2<T>

template <typename T> struct Cmplx
{
inline Cmplx() {}
inline Cmplx(T X) : x(X), y(0) {}
inline Cmplx(T X, T Y) : x(X), y(Y) {}
inline LOL_CONSTEXPR Cmplx() {}
inline LOL_CONSTEXPR Cmplx(T X) : x(X), y(0) {}
inline LOL_CONSTEXPR Cmplx(T X, T Y) : x(X), y(Y) {}

LOL_MEMBER_OPS(Cmplx, x)

@@ -331,8 +335,8 @@ static inline bool operator !=(T a, Cmplx<T> const &b) { return b != a; }

template <typename T> struct BVec3
{
explicit inline BVec3() {}
explicit inline BVec3(T X, T Y, T Z) : x(X), y(Y), z(Z) {}
explicit inline LOL_CONSTEXPR BVec3() {}
explicit inline LOL_CONSTEXPR BVec3(T X, T Y, T Z) : x(X), y(Y), z(Z) {}

union
{
@@ -473,7 +477,8 @@ template <typename T> struct BVec3
template <> struct BVec3<half>
{
explicit inline BVec3() {}
explicit inline BVec3(half X, half Y, half Z) : x(X), y(Y), z(Z) {}
explicit inline BVec3(half X, half Y, half Z)
: x(X), y(Y), z(Z) {}

half x, y, z;
};
@@ -488,19 +493,19 @@ template <> struct BVec3<real>

template <typename T> struct Vec3 : BVec3<T>
{
inline Vec3() {}
inline Vec3(T X, T Y, T Z) : BVec3<T>(X, Y, Z) {}
inline Vec3(Vec2<T> XY, T Z) : BVec3<T>(XY.x, XY.y, Z) {}
inline Vec3(T X, Vec2<T> YZ) : BVec3<T>(X, YZ.x, YZ.y) {}
inline LOL_CONSTEXPR Vec3() {}
inline LOL_CONSTEXPR Vec3(T X, T Y, T Z) : BVec3<T>(X, Y, Z) {}
inline LOL_CONSTEXPR Vec3(Vec2<T> XY, T Z) : BVec3<T>(XY.x, XY.y, Z) {}
inline LOL_CONSTEXPR Vec3(T X, Vec2<T> YZ) : BVec3<T>(X, YZ.x, YZ.y) {}

explicit inline Vec3(T X) : BVec3<T>(X, X, X) {}
explicit inline LOL_CONSTEXPR Vec3(T X) : BVec3<T>(X, X, X) {}

template<int N>
inline Vec3(XVec3<T, N> const &v)
inline LOL_CONSTEXPR Vec3(XVec3<T, N> const &v)
: BVec3<T>(v[0], v[1], v[2]) {}

template<typename U, int N>
explicit inline Vec3(XVec3<U, N> const &v)
explicit inline LOL_CONSTEXPR Vec3(XVec3<U, N> const &v)
: BVec3<T>(v[0], v[1], v[2]) {}

static Vec3<T> toeuler_xyx(Quat<T> const &q);
@@ -519,6 +524,11 @@ template <typename T> struct Vec3 : BVec3<T>

LOL_MEMBER_OPS(Vec3, x)

static const Vec3<T> zero;
static const Vec3<T> axis_x;
static const Vec3<T> axis_y;
static const Vec3<T> axis_z;

template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Vec3<U> const &v);
};
@@ -529,8 +539,9 @@ template <typename T> struct Vec3 : BVec3<T>

template <typename T> struct BVec4
{
explicit inline BVec4() {}
explicit inline BVec4(T X, T Y, T Z, T W) : x(X), y(Y), z(Z), w(W) {}
explicit inline LOL_CONSTEXPR BVec4() {}
explicit inline LOL_CONSTEXPR BVec4(T X, T Y, T Z, T W)
: x(X), y(Y), z(Z), w(W) {}

union
{
@@ -907,27 +918,40 @@ template <> struct BVec4<real>

template <typename T> struct Vec4 : BVec4<T>
{
inline Vec4() {}
inline Vec4(T X, T Y, T Z, T W) : BVec4<T>(X, Y, Z, W) {}
inline Vec4(Vec2<T> XY, T Z, T W) : BVec4<T>(XY.x, XY.y, Z, W) {}
inline Vec4(T X, Vec2<T> YZ, T W) : BVec4<T>(X, YZ.x, YZ.y, W) {}
inline Vec4(T X, T Y, Vec2<T> ZW) : BVec4<T>(X, Y, ZW.x, ZW.y) {}
inline Vec4(Vec2<T> XY, Vec2<T> ZW) : BVec4<T>(XY.x, XY.y, ZW.x, ZW.y) {}
inline Vec4(Vec3<T> XYZ, T W) : BVec4<T>(XYZ.x, XYZ.y, XYZ.z, W) {}
inline Vec4(T X, Vec3<T> YZW) : BVec4<T>(X, YZW.x, YZW.y, YZW.z) {}

explicit inline Vec4(T X) : BVec4<T>(X, X, X, X) {}
inline LOL_CONSTEXPR Vec4() {}
inline LOL_CONSTEXPR Vec4(T X, T Y, T Z, T W)
: BVec4<T>(X, Y, Z, W) {}
inline LOL_CONSTEXPR Vec4(Vec2<T> XY, T Z, T W)
: BVec4<T>(XY.x, XY.y, Z, W) {}
inline LOL_CONSTEXPR Vec4(T X, Vec2<T> YZ, T W)
: BVec4<T>(X, YZ.x, YZ.y, W) {}
inline LOL_CONSTEXPR Vec4(T X, T Y, Vec2<T> ZW)
: BVec4<T>(X, Y, ZW.x, ZW.y) {}
inline LOL_CONSTEXPR Vec4(Vec2<T> XY, Vec2<T> ZW)
: BVec4<T>(XY.x, XY.y, ZW.x, ZW.y) {}
inline LOL_CONSTEXPR Vec4(Vec3<T> XYZ, T W)
: BVec4<T>(XYZ.x, XYZ.y, XYZ.z, W) {}
inline LOL_CONSTEXPR Vec4(T X, Vec3<T> YZW)
: BVec4<T>(X, YZW.x, YZW.y, YZW.z) {}

explicit inline LOL_CONSTEXPR Vec4(T X) : BVec4<T>(X, X, X, X) {}

template<int N>
inline Vec4(XVec4<T, N> const &v)
inline LOL_CONSTEXPR Vec4(XVec4<T, N> const &v)
: BVec4<T>(v[0], v[1], v[2], v[3]) {}

template<typename U, int N>
explicit inline Vec4(XVec4<U, N> const &v)
explicit inline LOL_CONSTEXPR Vec4(XVec4<U, N> const &v)
: BVec4<T>(v[0], v[1], v[2], v[3]) {}

LOL_MEMBER_OPS(Vec4, x)

static const Vec4<T> zero;
static const Vec4<T> axis_x;
static const Vec4<T> axis_y;
static const Vec4<T> axis_z;
static const Vec4<T> axis_w;

template<typename U>
friend std::ostream &operator<<(std::ostream &stream, Vec4<U> const &v);
};
@@ -938,9 +962,9 @@ template <typename T> struct Vec4 : BVec4<T>

template <typename T> struct Quat
{
inline Quat() {}
inline Quat(T W) : w(W), x(0), y(0), z(0) {}
inline Quat(T W, T X, T Y, T Z) : w(W), x(X), y(Y), z(Z) {}
inline LOL_CONSTEXPR Quat() {}
inline LOL_CONSTEXPR Quat(T W) : w(W), x(0), y(0), z(0) {}
inline LOL_CONSTEXPR Quat(T W, T X, T Y, T Z) : w(W), x(X), y(Y), z(Z) {}

Quat(Mat3<T> const &m);
Quat(Mat4<T> const &m);


+ 2
- 1
src/lolcore.vcxproj View File

@@ -149,6 +149,7 @@
<ClCompile Include="layer.cpp" />
<ClCompile Include="light.cpp" />
<ClCompile Include="map.cpp" />
<ClCompile Include="math\constants.cpp" />
<ClCompile Include="math\geometry.cpp" />
<ClCompile Include="math\half.cpp" />
<ClCompile Include="math\real.cpp" />
@@ -314,4 +315,4 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\Lol.Fx.targets" />
</ImportGroup>
</Project>
</Project>

+ 1
- 1
src/map.cpp View File

@@ -131,7 +131,7 @@ LevelMap::LevelMap(char const *path)
{
/* This is a tileset image file. Associate it with firstgid. */
data->tilesets[data->ntilers] = Tiler::Register(str, ivec2(32),
ivec2(0));
ivec2::zero);
data->ntilers++;
//Log::Debug("new tiler %s\n", str);
}


+ 63
- 0
src/math/constants.cpp View File

@@ -0,0 +1,63 @@
//
// 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 HAVE_CONFIG_H
# include "config.h"
#endif

#include "core.h"

namespace lol {

#define LOL_VEC_2_CONST(type, name, a, b) \
template<> \
Vec2<type> const Vec2<type>::name = Vec2<type>((type)a, (type)b);

#define LOL_VEC_3_CONST(type, name, a, b, c) \
template<> \
Vec3<type> const Vec3<type>::name = Vec3<type>((type)a, (type)b, (type)c);

#define LOL_VEC_4_CONST(type, name, a, b, c, d) \
template<> \
Vec4<type> const Vec4<type>::name = Vec4<type>((type)a, (type)b, (type)c, (type)d);

#define LOL_ALL_VECTOR_CONST_INNER(type) \
LOL_VEC_2_CONST(type, zero, 0, 0) \
LOL_VEC_2_CONST(type, axis_x, 1, 0) \
LOL_VEC_2_CONST(type, axis_y, 0, 1) \
\
LOL_VEC_3_CONST(type, zero, 0, 0, 0) \
LOL_VEC_3_CONST(type, axis_x, 1, 0, 0) \
LOL_VEC_3_CONST(type, axis_y, 0, 1, 0) \
LOL_VEC_3_CONST(type, axis_z, 0, 0, 1) \
\
LOL_VEC_4_CONST(type, zero, 0, 0, 0, 0) \
LOL_VEC_4_CONST(type, axis_x, 1, 0, 0, 0) \
LOL_VEC_4_CONST(type, axis_y, 0, 1, 0, 0) \
LOL_VEC_4_CONST(type, axis_z, 0, 0, 1, 0) \
LOL_VEC_4_CONST(type, axis_w, 0, 0, 0, 1)

LOL_ALL_VECTOR_CONST_INNER(half)
LOL_ALL_VECTOR_CONST_INNER(float)
LOL_ALL_VECTOR_CONST_INNER(double)
LOL_ALL_VECTOR_CONST_INNER(ldouble)
LOL_ALL_VECTOR_CONST_INNER(real)

LOL_ALL_VECTOR_CONST_INNER(int8_t)
LOL_ALL_VECTOR_CONST_INNER(uint8_t)
LOL_ALL_VECTOR_CONST_INNER(int16_t)
LOL_ALL_VECTOR_CONST_INNER(uint16_t)
LOL_ALL_VECTOR_CONST_INNER(int32_t)
LOL_ALL_VECTOR_CONST_INNER(uint32_t)
LOL_ALL_VECTOR_CONST_INNER(int64_t)
LOL_ALL_VECTOR_CONST_INNER(uint64_t)

}; /* namespace lol */


+ 1
- 1
src/math/vector.cpp View File

@@ -535,7 +535,7 @@ static inline vec3 quat_toeuler_generic(quat const &q, int i, int j, int k)
float n = norm(q);

if (!n)
return vec3(0.f);
return vec3::zero;

/* (2 + i - j) % 3 means x-y-z direct order; otherwise indirect */
float const sign = ((2 + i - j) % 3) ? 1.f : -1.f;


+ 1
- 1
src/platform/sdl/sdlinput.cpp View File

@@ -48,7 +48,7 @@ private:

#if USE_SDL
SdlInputData(int app_w, int app_h, int screen_w, int screen_h) :
m_prevmouse(ivec2(0)),
m_prevmouse(ivec2::zero),
m_app_w((float)app_w),
m_app_h((float)app_h),
m_screen_w((float)screen_w),


+ 4
- 4
src/worldentity.cpp View File

@@ -25,11 +25,11 @@ namespace lol

WorldEntity::WorldEntity()
{
m_position = vec3(0);
m_position = vec3::zero;
m_rotation = quat(1);
m_velocity = vec3(0);
m_rotation_velocity = vec3(0);
m_bbox[0] = m_bbox[1] = vec3(0);
m_velocity = vec3::zero;
m_rotation_velocity = vec3::zero;
m_bbox[0] = m_bbox[1] = vec3::zero;
}

WorldEntity::~WorldEntity()


+ 1
- 1
test/btphystest.cpp View File

@@ -66,7 +66,7 @@ void BtPhysTest::InitApp()

#if CAT_MODE
/* cat datas setup */
m_cat_texture = Tiler::Register("data/CatsSheet.png", ivec2(0), ivec2(0,1));
m_cat_texture = Tiler::Register("data/CatsSheet.png", ivec2::zero, ivec2(0,1));
m_fov_dp = .0f;
m_loc_dp = .0f;
#endif //CAT_MODE


+ 9
- 9
test/meshviewer.cpp View File

@@ -136,12 +136,12 @@ public:
m_zoom_mesh = 0.f;
m_zoom_speed = 0.f;
m_rot = vec2(45.f);
m_rot_mesh = vec2(0.f);
m_rot_speed = vec2(0.f);
m_pos = vec2(0.f);
m_pos_mesh = vec2(0.f);
m_pos_speed = vec2(0.f);
m_screen_offset = vec2(0.f);
m_rot_mesh = vec2::zero;
m_rot_speed = vec2::zero;
m_pos = vec2::zero;
m_pos_mesh = vec2::zero;
m_pos_speed = vec2::zero;
m_screen_offset = vec2::zero;

m_camera = new Camera();
m_camera->SetView(vec3(0.f, 0.f, 10.f), vec3(0.f, 0.f, 0.f), vec3(0.f, 1.f, 0.f));
@@ -206,7 +206,7 @@ public:
//Camera update
bool is_pos = false;
bool is_fov = false;
vec2 tmp = vec2(0.f);
vec2 tmp = vec2::zero;

#if !__native_client__
is_pos = m_controller->GetKey(KEY_CAM_POS).IsDown();
@@ -252,7 +252,7 @@ public:
#if !__native_client__
if (m_controller->GetKey(KEY_CAM_RESET).IsDown())
{
pos_mesh = vec2(0.f);
pos_mesh = vec2::zero;
zoom_mesh = 0.f;
}
#endif //!__native_client__
@@ -426,7 +426,7 @@ public:
{
m_texture_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinymvtexture));
m_texture_uni = m_texture_shader->GetUniformLocation("u_Texture");
m_default_texture = Tiler::Register("data/test-texture.png", ivec2(0), ivec2(0,1));
m_default_texture = Tiler::Register("data/test-texture.png", ivec2::zero, ivec2(0,1));
}
else if (m_texture && m_default_texture)
m_texture_shader->SetUniform(m_texture_uni, m_default_texture->GetTexture(), 0);


+ 2
- 2
test/unit/camera.cpp View File

@@ -38,8 +38,8 @@ LOLUNIT_FIXTURE(CameraTest)
void SetUp()
{
eye = vec3(0.f, 0.f, 50.f);
target = vec3(0.f);
up = vec3(0.f, 1.f, 0.f);
target = vec3::zero;
up = vec3::axis_y;
m_lookat = mat4::lookat(eye, target, up);
q_lookat = quat(m_lookat);
v_lookat = vec3::toeuler_zyx(q_lookat);


Loading…
Cancel
Save