Changeset 1322


Ignore:
Timestamp:
Apr 30, 2012, 8:41:00 PM (9 years ago)
Author:
sam
Message:

math: fix a bug in mat3::fromeuler().

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/orbital/orbital.cpp

    r1314 r1322  
    114114
    115115    //Doing the query with actual values, cause I want to stay SDL-free for now.
     116    int HMovement = Input::GetButtonState(276 /*SDLK_LEFT*/) - Input::GetButtonState(275 /*SDLK_RIGHT*/);
    116117    int VMovement = Input::GetButtonState(274 /*SDLK_DOWN*/) - Input::GetButtonState(273 /*SDLK_UP*/);
    117     int HMovement = Input::GetButtonState(275 /*SDLK_RIGHT*/) - Input::GetButtonState(276 /*SDLK_LEFT*/);
    118     int RMovement = Input::GetButtonState(305 /*SDLK_RCTRL*/) - Input::GetButtonState(256 /*SDLK_KP0*/);
     118    int RMovement = Input::GetButtonState(256 /*SDLK_KP0*/) - Input::GetButtonState(305 /*SDLK_RCTRL*/);
    119119
    120120    vec3 new_angular_velocity = vec3(0.0f);
     
    122122    if (VMovement != 0 || HMovement != 0 || RMovement != 0)
    123123    {
    124         new_angular_velocity = vec3(VMovement, HMovement, RMovement) * 50.0f;
     124        new_angular_velocity = vec3(HMovement, VMovement, RMovement) * 50.0f;
    125125        m_auto_cam_timer = 2.0f;
    126126    }
     
    128128    {
    129129        /* Order is yaw, pitch, roll */
    130         new_angular_velocity = clamp(-m_angle, vec3(-20.f, 40.f, -40.f),
    131                                                vec3( 20.f, 40.f,  40.f));
     130        new_angular_velocity = clamp(-m_angle, vec3(40.f, -20.f, -40.f),
     131                                               vec3(40.f,  20.f,  40.f));
    132132    }
    133133
     
    145145    }
    146146
    147     mat4 anim = mat4::rotate(quat::fromeuler(m_angle));
     147    quat q = quat::rotate(-90.f, 0.f, 0.f, 1.f);
     148    mat4 anim = mat4(~q * quat::fromeuler(m_angle) * q);
    148149    mat4 model = mat4::translate(vec3(0));
    149150
  • trunk/src/math/vector.cpp

    r1320 r1322  
    520520
    521521    ret[0][0] =   cy * cz;
    522     ret[1][0] =   cx * sz - sx * sy * sz;
    523     ret[2][0] =   sx * sz - cx * sy * cz;
    524 
    525     ret[0][1] = - cy * sz;
    526     ret[1][1] =   cx * cz - sx * sy * sz;
    527     ret[2][1] =   sx * cz + cx * sy * sz;
    528 
    529     ret[0][2] =   sy;
    530     ret[1][2] = - sx * cy;
     522    ret[1][0] = - cx * sz + sx * sy * cz;
     523    ret[2][0] =   sx * sz + cx * sy * cz;
     524
     525    ret[0][1] =   cy * sz;
     526    ret[1][1] =   cx * cz + sx * sy * sz;
     527    ret[2][1] = - sx * cz + cx * sy * sz;
     528
     529    ret[0][2] = - sy;
     530    ret[1][2] =   sx * cy;
    531531    ret[2][2] =   cx * cy;
    532532
Note: See TracChangeset for help on using the changeset viewer.