lib/gamnit flat: rotation follows the right hand rule on the Z axis
[nit.git] / lib / gamnit / flat.nit
index 1936763..b74da82 100644 (file)
@@ -52,7 +52,7 @@ class Sprite
        # Position of this sprite in world coordinates
        var center: Point3d[Float] is writable
 
-       # Rotation on the Z axis
+       # Rotation on the Z axis, where 0.0 points right and `0.5*pi` points up
        var rotation = 0.0 is writable
 
        # Mirror `texture` horizontally, inverting each pixel on the X axis
@@ -83,7 +83,7 @@ class Sprite
                simple_2d_program.color.array_enabled = false
                simple_2d_program.scale.array_enabled = false
 
-               simple_2d_program.translation.uniform(center.x, -center.y, center.z, 0.0)
+               simple_2d_program.translation.uniform(center.x, center.y, center.z, 0.0)
                simple_2d_program.color.uniform(tint[0], tint[1], tint[2], tint[3])
                simple_2d_program.scale.uniform scale
 
@@ -95,7 +95,7 @@ class Sprite
                        else texture.texture_coords, 2)
                simple_2d_program.coord.array(texture.vertices, 3)
 
-               simple_2d_program.rotation.uniform new Matrix.rotation(rotation, 0.0, 0.0, 1.0)
+               simple_2d_program.rotation.uniform new Matrix.rotation(rotation, 0.0, 0.0, -1.0)
 
                glDrawArrays(gl_TRIANGLE_STRIP, 0, 4)
        end