gamnit :: Material :: draw_depth
model
, a part of actor
, from the view of camera
This drawing should only produce usable depth data. The default behavior,
uses shadow_depth_program
.
# Optimized draw of `model`, a part of `actor`, from the view of `camera`
#
# This drawing should only produce usable depth data. The default behavior,
# uses `shadow_depth_program`.
protected fun draw_depth(actor: Actor, model: LeafModel, camera: Camera)
do
var program = app.shadow_depth_program
program.use
program.mvp.uniform camera.mvp_matrix
var mesh = model.mesh
program.translation.uniform(actor.center.x, actor.center.y, actor.center.z, 0.0)
program.scale.uniform actor.scale
program.use_map_diffuse.uniform false
program.tex_coord.array_enabled = true
program.tex_coord.array(mesh.texture_coords, 2)
program.coord.array_enabled = true
program.coord.array(mesh.vertices, 3)
program.rotation.uniform new Matrix.gamnit_euler_rotation(actor.pitch, actor.yaw, actor.roll)
if mesh.indices.is_empty then
glDrawArrays(mesh.draw_mode, 0, mesh.vertices.length/3)
else
glDrawElements(mesh.draw_mode, mesh.indices.length, gl_UNSIGNED_SHORT, mesh.indices_c.native_array)
end
end
lib/gamnit/depth/shadow.nit:311,2--340,4