EliasFarhan / NekoEngine

Generic 3d engine based on SDL2 and OpenGL ES 3/WebGL2
13 stars 5 forks source link

Les transforms à modifier sont const?... [Oleg] #6

Closed LoshkinOleg closed 4 years ago

LoshkinOleg commented 4 years ago

Si j'ai bien compris, je dois implémenter ces fonctions là?


//TODO Implement Matrix Translation
template<>
inline Transform3d Transform3d::Translate(const Transform3d& transform, Vec3f pos)
{
    (void) pos;
    return transform;
}

//TODO Implement Matrix Scale
template<>
inline Transform3d Transform3d::Scale(const Transform3d& transform, Vec3f scale)
{
    (void) scale;
    return transform;
}

//TODO Implement Matrix Rotation with angle and axis
template<>
inline Transform3d Transform3d::Rotate(const Transform3d& transform, float angle, Vec3f axis)
{
    (void) angle;
    (void) axis;
    return transform;
}

//TODO Implement Matrix Rotation with Quaternion
template<>
inline Transform3d Transform3d::Rotate(const Transform3d& transform, Quaternion quaternion)
{
    (void) quaternion;
    return transform;
}

//TODO Implement Matrix Rotation with Simple Euler Angles
template<>
inline Transform3d Transform3d::Rotate(const Transform3d& transform, Vec3f eulerAngles)
{
    (void)eulerAngles;
    return transform;
}

Mais les transform, qui logiquement sont à modifier sont const? On est d'accord, je suis bien sensé les modifier?

Edit: le "return transform" c'est juste là pour que ça compile c'est ça? Faut bien retourner une AUTRE matrice?

EliasFarhan commented 4 years ago

Oui, parce que tu retournes une nouvelle valeur de transform, tu ne modifies pas celui qui est en argument.