Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualShotoReaper

Posted 29 November 2012 - 01:34 PM

Hi!
I want to transform a glm::vec3 ( camera.target) by a glm::mat4(camera.rotationMatrix). I try multiply this give me an error:error: no match for 'operator*' in 'originalTarget * ((Camera*)this)->Camera::rotationMatrix'. I suppose that I can´t multiply a vec3 * mat4.
Does GLM some function to transform this? Other way to do the transform?

The code:

void Camera::Update(void)
{
    // Aplicamos la rotacion sobre el target
    glm::vec3 originalTarget = target;
    glm::vec3 rotatedTarget = originalTarget * rotationMatrix;

    // Aplicamos la rotacion sobre el Up
    glm::vec3 originalUp = up;
    glm::vec3 rotatedUp = originalUp * rotationMatrix;

    // Establecemos las matrices de vista y proyeccion
    view = lookAt(
                        position,    //eye
                        rotatedTarget,   //direction
                        rotatedUp     //up
                        );
    projection = perspective(
                             FOV,
                             (float) getParent()->getEngine()->GetCurrentWidth() / getParent()->getEngine()->GetCurrentWidth() ,
                              near_plane,
                              far_plane);
}

#3ShotoReaper

Posted 29 November 2012 - 01:34 PM

Hi!
I want to transform a glm::vec3 ( camera.target) by a glm::mat4(camera.rotationMatrix). I try multiply this give me an error:error: no match for 'operator*' in 'originalTarget * ((Camera*)this)->Camera::rotationMatrix'. I suppose that I can´t multiply a vec3 * mat4.
Does GLM some function to transform this? Other way to do the transform?

The code:

void Camera::Update(void)
{
    // Aplicamos la rotacion sobre el target
    glm::vec3 originalTarget = target;
    glm::vec3 rotatedTarget = originalTarget * rotationMatrix;

    // Aplicamos la rotacion sobre el Up
    glm::vec3 originalUp = up;
    glm::vec3 rotatedUp = originalUp * rotationMatrix;

    // Establecemos las matrices de vista y proyeccion
    view = lookAt(
                        position,    //eye
                        rotatedTarget,   //direction
                        rotatedUp     //up
                        );
    projection = perspective(
                             FOV,
                             (float) getParent()->getEngine()->GetCurrentWidth() / getParent()->getEngine()->GetCurrentWidth() ,
                              near_plane,
                              far_plane);
}

#2ShotoReaper

Posted 29 November 2012 - 01:34 PM

Hi!
I want to transform a glm::vec3 ( camera.target) by a glm::mat4(camera.rotationMatrix). I try multiply this give me an error:error: no match for 'operator*' in 'originalTarget * ((Camera*)this)->Camera::rotationMatrix'. I suppose that I can´t multiply a vec3 * mat4.
Does GLM some function to transform this? Other way to do the transform?

The code:

void Camera::Update(void)
{
    // Aplicamos la rotacion sobre el target
    glm::vec3 originalTarget = target;
    glm::vec3 rotatedTarget = originalTarget * rotationMatrix;

    // Aplicamos la rotacion sobre el Up
    glm::vec3 originalUp = up;
    glm::vec3 rotatedUp = originalUp * rotationMatrix;

    // Establecemos las matrices de vista y proyeccion
    view = lookAt(
                        position,    //eye
                        rotatedTarget,   //direction
                        rotatedUp     //up
                        );
    projection = perspective(
                             FOV,
                             (float) getParent()->getEngine()->GetCurrentWidth() / getParent()->getEngine()->GetCurrentWidth() ,
                              near_plane,
                              far_plane);
}

#1ShotoReaper

Posted 29 November 2012 - 01:33 PM

Hi!
I want to transform a glm::vec3 ( camera.target) by a glm::mat4(camera.rotationMatrix). I try multiply this give me an error:error: no match for 'operator*' in 'originalTarget * ((Camera*)this)->Camera::rotationMatrix'. I suppose that I can´t multiply a vec3 * mat4.
Does GLM some function to transform this? Other way to do the transform?

PARTNERS