Exemple #1
0
func (r *Image) Draw(args render.DrawArgs) {
	args.Transform = r.Element.Transform.Matrix.Mul4(args.Transform) //args.Transform.Mul4(r.Element.Transform.Matrix)
	r.Quad.Draw(args)
	for _, el := range r.Element.children {
		el.Draw(args)
	}
}
Exemple #2
0
func (e *Element) Draw(args render.DrawArgs) {
	/* Multiply transform to args */
	args.Transform = e.Transform.Matrix.Mul4(args.Transform)
	for _, el := range e.children {
		el.Draw(args)
	}
}
Exemple #3
0
func (o *Object) Draw(args render.DrawArgs) {
	/* Apply transform */
	args.Transform = o.Transform.Matrix.Mul4(args.Transform)

	/* Draw components */
	args.MVP = args.VP.Mul4(args.Transform)
	args.Shader.Matrix4f("mvp", &args.MVP[0])

	// model matrix is required to calculate vertex normals during the geometry pass
	if args.Pass == "geometry" {
		args.Shader.Matrix4f("model", &args.Transform[0])
	}

	for _, comp := range o.Components {
		comp.Draw(args)
	}

	/* Draw children */
	for _, child := range o.Children {
		child.Draw(args)
	}
}