import gamnit::cameras
import gamnit::limit_fps
+import android_two_fingers_motion is conditional(android)
+
# Image to draw on screen
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
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
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
# Prepare to draw
for tex in all_root_textures do
tex.load
+ gamnit_error = tex.error
+ if gamnit_error != null then print_error gamnit_error
glTexParameteri(gl_TEXTURE_2D, gl_TEXTURE_MIN_FILTER, gl_LINEAR)
glTexParameteri(gl_TEXTURE_2D, gl_TEXTURE_MAG_FILTER, gl_LINEAR)
-
- gamnit_error = tex.error
- assert gamnit_error == null else print_error gamnit_error
end
end
uniform bool use_texture;
// Texture to apply on this object
- uniform sampler2D texture;
+ uniform sampler2D texture0;
// Input from the vertex shader
varying vec4 v_color;
void main()
{
if(use_texture) {
- gl_FragColor = v_color * texture2D(texture, v_coord);
+ gl_FragColor = v_color * texture2D(texture0, v_coord);
if (gl_FragColor.a == 0.0) discard;
} else {
gl_FragColor = v_color;
var use_texture = uniforms["use_texture"].as(UniformBool) is lazy
# Visible texture unit
- var texture = uniforms["texture"].as(UniformSampler2D) is lazy
+ var texture = uniforms["texture0"].as(UniformSampler2D) is lazy
# Coordinates on the textures, per vertex
var tex_coord = attributes["tex_coord"].as(AttributeVec2) is lazy