mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
graphicsutil: Remove dependency on graphicscommand
This commit is contained in:
parent
7767bcfdd8
commit
395b46d8da
@ -225,11 +225,6 @@ type drawImageCommand struct {
|
||||
filter graphics.Filter
|
||||
}
|
||||
|
||||
// VertexFloatNum returns the number of floats for one vertex.
|
||||
func VertexFloatNum() int {
|
||||
return theArrayBufferLayout.totalBytes() / opengl.Float.SizeInBytes()
|
||||
}
|
||||
|
||||
func (c *drawImageCommand) String() string {
|
||||
return fmt.Sprintf("draw-image: dst: %p <- src: %p, colorm: %v, mode %d, filter: %d", c.dst, c.src, c.color, c.mode, c.filter)
|
||||
}
|
||||
|
@ -14,10 +14,6 @@
|
||||
|
||||
package graphicsutil
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
||||
)
|
||||
|
||||
var (
|
||||
theVerticesBackend = &verticesBackend{}
|
||||
)
|
||||
@ -28,20 +24,22 @@ type verticesBackend struct {
|
||||
}
|
||||
|
||||
func (v *verticesBackend) slice(n int) []float32 {
|
||||
const num = 256
|
||||
const (
|
||||
num = 1024
|
||||
vertexFloatNum = 10
|
||||
)
|
||||
if n > num {
|
||||
panic("not reached")
|
||||
}
|
||||
|
||||
need := n * graphicscommand.VertexFloatNum()
|
||||
need := n * vertexFloatNum
|
||||
if v.head+need > len(v.backend) {
|
||||
v.backend = nil
|
||||
v.head = 0
|
||||
}
|
||||
|
||||
if v.backend == nil {
|
||||
size := 4 * graphicscommand.VertexFloatNum()
|
||||
v.backend = make([]float32, size*num)
|
||||
v.backend = make([]float32, vertexFloatNum*num)
|
||||
}
|
||||
|
||||
s := v.backend[v.head : v.head+need]
|
||||
|
Loading…
Reference in New Issue
Block a user