Beispiel #1
0
/* Sets up a geometry pass.
 * A geometry buffer of the given bufferWidth x bufferHeight will be created automatically */
func NewGeometryPass(bufferWidth, bufferHeight int32) *GeometryPass {
	mat := assets.GetMaterial("color_geometry")
	p := &GeometryPass{
		Buffer:   render.CreateGeometryBuffer(bufferWidth, bufferHeight),
		Material: mat,
	}
	return p
}
Beispiel #2
0
func (m *Manager) NewDepthImage(image *render.Texture, x, y, w, h, z float32) *Image {
	el := m.NewElement(x, y, w, h, z)
	mat := assets.GetMaterial("depth_texture")
	mat.AddTexture("image", image)
	img := &Image{
		Element: el,
		Image:   image,
		Quad:    geometry.NewImageQuad(mat, w, h, z),
	}
	return img
}
Beispiel #3
0
func (m *Manager) NewRect(color render.Color, x, y, w, h, z float32) *Rect {
	// UI Manager should provide access to some resource manager thingy
	// mat := m.Resources.GetMaterial("assets/materials/ui_color.json")
	mat := assets.GetMaterial("ui_color")

	el := m.NewElement(x, y, w, h, z)
	r := &Rect{
		Element: el,
		Color:   color,
		quad:    geometry.NewQuad(mat, color, w, h, z),
	}
	r.quad.SetBorderWidth(5)
	return r
}