mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
graphicsutil: Remove dependency on opengl
This commit is contained in:
parent
ff54d3b681
commit
fde9fd2d0e
@ -127,7 +127,7 @@ func (q *commandQueue) EnqueueDrawImageCommand(dst, src *Image, vertices []float
|
|||||||
|
|
||||||
q.appendVertices(vertices)
|
q.appendVertices(vertices)
|
||||||
q.appendIndices(indices, uint16(q.nextIndex))
|
q.appendIndices(indices, uint16(q.nextIndex))
|
||||||
q.nextIndex += len(vertices) * opengl.Float.SizeInBytes() / VertexSizeInBytes()
|
q.nextIndex += len(vertices) * opengl.Float.SizeInBytes() / theArrayBufferLayout.totalBytes()
|
||||||
q.tmpNumIndices += len(indices)
|
q.tmpNumIndices += len(indices)
|
||||||
|
|
||||||
q.doEnqueueDrawImageCommand(dst, src, len(vertices), len(indices), color, mode, filter, split)
|
q.doEnqueueDrawImageCommand(dst, src, len(vertices), len(indices), color, mode, filter, split)
|
||||||
@ -225,9 +225,9 @@ type drawImageCommand struct {
|
|||||||
filter graphics.Filter
|
filter graphics.Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
// VertexSizeInBytes returns the size in bytes of one vertex.
|
// VertexFloatNum returns the number of floats for one vertex.
|
||||||
func VertexSizeInBytes() int {
|
func VertexFloatNum() int {
|
||||||
return theArrayBufferLayout.totalBytes()
|
return theArrayBufferLayout.totalBytes() / opengl.Float.SizeInBytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *drawImageCommand) String() string {
|
func (c *drawImageCommand) String() string {
|
||||||
|
@ -16,7 +16,6 @@ package graphicsutil
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
|
||||||
"github.com/hajimehoshi/ebiten/internal/opengl"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -30,7 +29,7 @@ type verticesBackend struct {
|
|||||||
|
|
||||||
func (v *verticesBackend) sliceForOneQuad() []float32 {
|
func (v *verticesBackend) sliceForOneQuad() []float32 {
|
||||||
const num = 256
|
const num = 256
|
||||||
size := 4 * graphicscommand.VertexSizeInBytes() / opengl.Float.SizeInBytes()
|
size := 4 * graphicscommand.VertexFloatNum()
|
||||||
if v.backend == nil {
|
if v.backend == nil {
|
||||||
v.backend = make([]float32, size*num)
|
v.backend = make([]float32, size*num)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user