@@ -139,7 +139,7 @@ void DefaultShaderData::SetupDefaultData(bool with_UV) | |||||
{ | { | ||||
UNUSED(with_UV); | UNUSED(with_UV); | ||||
for (int i = 0; i < 7; i++) | for (int i = 0; i < 7; i++) | ||||
AddUniform(DefaultUniforms[i].C()); | |||||
AddUniform(DefaultUniforms[i]); | |||||
} | } | ||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
@@ -163,14 +163,14 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model) | |||||
light_data << vec4::zero << vec4::zero; | light_data << vec4::zero << vec4::zero; | ||||
int i = 0; | int i = 0; | ||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), light_data); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), modelview); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), view); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), inverse(view)); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), proj); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), normalmat); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++].C()), f); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), light_data); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), modelview); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), view); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), inverse(view)); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), proj); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), normalmat); | |||||
m_shader->SetUniform(*GetUniform(DefaultUniforms[i++]), f); | |||||
} | } | ||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
@@ -210,6 +210,8 @@ int32_t lol::AndroidAppData::HandleInput(AInputEvent* event) | |||||
switch (AInputEvent_getType(event)) | switch (AInputEvent_getType(event)) | ||||
{ | { | ||||
case AINPUT_EVENT_TYPE_MOTION: | case AINPUT_EVENT_TYPE_MOTION: | ||||
//We need the max if we want coherent mouse speed between axis | |||||
float max_screen_size = lol::max(m_wanted_resolution.x, m_wanted_resolution.y); | |||||
/* FIXME: we flip the Y axis here, but is it the right place? */ | /* FIXME: we flip the Y axis here, but is it the right place? */ | ||||
ivec2 pos(AMotionEvent_getX(event, 0), | ivec2 pos(AMotionEvent_getX(event, 0), | ||||
AMotionEvent_getY(event, 0)); | AMotionEvent_getY(event, 0)); | ||||
@@ -217,9 +219,9 @@ int32_t lol::AndroidAppData::HandleInput(AInputEvent* event) | |||||
pos.y = m_wanted_resolution.y - 1 - pos.y; | pos.y = m_wanted_resolution.y - 1 - pos.y; | ||||
m_mouse->SetCursor(0, vec2(pos) / vec2(m_wanted_resolution), pos); | m_mouse->SetCursor(0, vec2(pos) / vec2(m_wanted_resolution), pos); | ||||
// Note: 100.0f is an arbitrary value that makes it feel about the same than an xbox controller joystick | // Note: 100.0f is an arbitrary value that makes it feel about the same than an xbox controller joystick | ||||
m_mouse->SetAxis(0, (pos.x - m_prev_pos.x) / m_wanted_resolution.x * 100.f); | |||||
// Y Axis is also negated to match the usual joystick Y axis (negatives values are for the upper direction) | |||||
m_mouse->SetAxis(1, (pos.y - m_prev_pos.y) / m_wanted_resolution.y * -100.f); | |||||
m_mouse->SetAxis(0, (pos.x - m_prev_pos.x) / max_screen_size * 100.f); | |||||
// Unlike SDL, no need to negate Y axis | |||||
m_mouse->SetAxis(1, (pos.y - m_prev_pos.y) / max_screen_size * -100.f); | |||||
m_prev_pos = pos; | m_prev_pos = pos; | ||||
switch (AKeyEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK) | switch (AKeyEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK) | ||||
{ | { | ||||
@@ -220,13 +220,15 @@ void SdlInputData::Tick(float seconds) | |||||
if (mouse.x >= 0 && mouse.x < m_app.x && mouse.y >= 0 && mouse.y < m_app.y) | if (mouse.x >= 0 && mouse.x < m_app.x && mouse.y >= 0 && mouse.y < m_app.y) | ||||
{ | { | ||||
//We need the max if we want coherent mouse speed between axis | |||||
float max_screen_size = lol::max(m_screen.x, m_screen.y); | |||||
vec2 vmouse = vec2(mouse); | vec2 vmouse = vec2(mouse); | ||||
vec2 vprevmouse = vec2(m_prevmouse); | vec2 vprevmouse = vec2(m_prevmouse); | ||||
m_mouse->SetCursor(0, vmouse / m_app, mouse); | m_mouse->SetCursor(0, vmouse / m_app, mouse); | ||||
// Note: 100.0f is an arbitrary value that makes it feel about the same than an xbox controller joystick | // Note: 100.0f is an arbitrary value that makes it feel about the same than an xbox controller joystick | ||||
m_mouse->SetAxis(0, (mouse.x - vprevmouse.x) * 100.0f / m_screen.x); | |||||
m_mouse->SetAxis(0, (mouse.x - vprevmouse.x) * 100.0f / max_screen_size); | |||||
// Y Axis is also negated to match the usual joystick Y axis (negatives values are for the upper direction) | // Y Axis is also negated to match the usual joystick Y axis (negatives values are for the upper direction) | ||||
m_mouse->SetAxis(1,-(mouse.y - vprevmouse.y) * 100.0f / m_screen.y); | |||||
m_mouse->SetAxis(1,-(mouse.y - vprevmouse.y) * 100.0f / max_screen_size); | |||||
} | } | ||||
if (m_mousecapture) | if (m_mousecapture) | ||||