gg/ox/tri.go

21 lines
404 B
Go
Raw Normal View History

2024-05-28 11:24:12 +03:00
package ox
type DrawableTriangles struct {
Triangles
Colority
}
func (r *DrawableTriangles) MakeEVertices(c *Context) []EVertex {
m := c.Camera.RealMatrix()
vs := make([]ebiten.Vertex, len(r.Triangles) * 3)
var buf Vertex
buf.Color = r.Color
for i := range r.Triangles {
for j := range r.Triangles[i] {
buf.Dst = r.Triangles[i][j].Apply(m)
vs[i*3 + j] = buf.Ebiten()
}
}
return vs
}