gamnit: add camera parameter to `draw` method
[nit.git] / contrib / model_viewer / src / globe.nit
index 12c6ffc..be54bce 100644 (file)
@@ -98,7 +98,7 @@ class GlobeMaterial
        init atmo do init(null, false, [0.0, 0.8*atmo_a, 1.0*atmo_a, atmo_a])
        private var atmo_a = 0.05
 
-       redef fun draw(actor, model)
+       redef fun draw(actor, model, camera)
        do
                var gl_error = glGetError
                assert gl_error == gl_NO_ERROR else print gl_error
@@ -108,9 +108,6 @@ class GlobeMaterial
                var program = app.globe_program
                program.use
 
-               # Set constant program values
-               program.use
-
                # Bind textures
                glActiveTexture gl_TEXTURE0
                glBindTexture(gl_TEXTURE_2D, app.texture_earth.gl_texture)
@@ -135,7 +132,7 @@ class GlobeMaterial
                # Update camera view and light
                var p = app.world_camera.position
                program.camera.uniform(p.x, p.y, p.z)
-               program.mvp.uniform app.world_camera.mvp_matrix
+               program.mvp.uniform camera.mvp_matrix
                program.light_center.uniform(app.light.position.x, app.light.position.y, app.light.position.z)
 
                # Set attributes