mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/atlas, internal/graphicscommand: refactoring
This commit is contained in:
parent
1fdc45e652
commit
2f55bb1b3d
@ -459,8 +459,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
||||
swf, shf := float32(sw), float32(sh)
|
||||
n := len(vertices)
|
||||
for i := 0; i < n; i += graphics.VertexFloatCount {
|
||||
vertices[i] = vertices[i] + dx
|
||||
vertices[i+1] = vertices[i+1] + dy
|
||||
vertices[i] += dx
|
||||
vertices[i+1] += dy
|
||||
vertices[i+2] = (vertices[i+2] + oxf) / swf
|
||||
vertices[i+3] = (vertices[i+3] + oyf) / shf
|
||||
}
|
||||
@ -473,8 +473,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
||||
} else {
|
||||
n := len(vertices)
|
||||
for i := 0; i < n; i += graphics.VertexFloatCount {
|
||||
vertices[i] = vertices[i] + dx
|
||||
vertices[i+1] = vertices[i+1] + dy
|
||||
vertices[i] += dx
|
||||
vertices[i+1] += dy
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,12 +590,13 @@ func (q *commandQueue) prependPreservedUniforms(uniforms []uint32, shader *Shade
|
||||
|
||||
// Set the source texture sizes.
|
||||
for i, src := range srcs {
|
||||
if src != nil {
|
||||
if src == nil {
|
||||
continue
|
||||
}
|
||||
w, h := src.InternalSize()
|
||||
uniforms[idx+2*i] = math.Float32bits(float32(w))
|
||||
uniforms[idx+2*i+1] = math.Float32bits(float32(h))
|
||||
}
|
||||
}
|
||||
idx += len(srcs) * 2
|
||||
|
||||
// Set the destination region.
|
||||
|
Loading…
Reference in New Issue
Block a user