gg/ox/tri.go
2024-05-28 13:24:12 +05:00

20 lines
404 B
Go

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
}