DRAW_MODEL
this callback is called right before a model is drawn and allows to override various stuff
passed into the callback is:
- an instance of the model_context_t
local glow_material = materials.create( "glow_material", [[
"VertexLitGeneric" {
"$additive" "1"
"$envmap" "models/effects/cube_white"
"$envmaptint" "[1 1 1]"
"$envmapfresnel" "1"
"$envmapfresnelminmaxexp" "[0 1 2]"
"$alpha" "1.0"
}
]]
)
function on_draw_model(ctx)
if ctx.model_name:find("weapons/v_") == nil then
return
end
ctx.override_original = true
glow_material:set_shader_param("$envmaptint", vec3_t(1,1,0))
glow_material:set_shader_param("$alpha", 0.3)
ctx:draw_original()
ctx:draw_material(glow_material)
end
callbacks.add(e_callbacks.DRAW_MODEL, on_draw_model)