mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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)
|
swf, shf := float32(sw), float32(sh)
|
||||||
n := len(vertices)
|
n := len(vertices)
|
||||||
for i := 0; i < n; i += graphics.VertexFloatCount {
|
for i := 0; i < n; i += graphics.VertexFloatCount {
|
||||||
vertices[i] = vertices[i] + dx
|
vertices[i] += dx
|
||||||
vertices[i+1] = vertices[i+1] + dy
|
vertices[i+1] += dy
|
||||||
vertices[i+2] = (vertices[i+2] + oxf) / swf
|
vertices[i+2] = (vertices[i+2] + oxf) / swf
|
||||||
vertices[i+3] = (vertices[i+3] + oyf) / shf
|
vertices[i+3] = (vertices[i+3] + oyf) / shf
|
||||||
}
|
}
|
||||||
@ -473,8 +473,8 @@ func (i *Image) drawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
|||||||
} else {
|
} else {
|
||||||
n := len(vertices)
|
n := len(vertices)
|
||||||
for i := 0; i < n; i += graphics.VertexFloatCount {
|
for i := 0; i < n; i += graphics.VertexFloatCount {
|
||||||
vertices[i] = vertices[i] + dx
|
vertices[i] += dx
|
||||||
vertices[i+1] = vertices[i+1] + dy
|
vertices[i+1] += dy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,11 +590,12 @@ func (q *commandQueue) prependPreservedUniforms(uniforms []uint32, shader *Shade
|
|||||||
|
|
||||||
// Set the source texture sizes.
|
// Set the source texture sizes.
|
||||||
for i, src := range srcs {
|
for i, src := range srcs {
|
||||||
if src != nil {
|
if src == nil {
|
||||||
w, h := src.InternalSize()
|
continue
|
||||||
uniforms[idx+2*i] = math.Float32bits(float32(w))
|
|
||||||
uniforms[idx+2*i+1] = math.Float32bits(float32(h))
|
|
||||||
}
|
}
|
||||||
|
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
|
idx += len(srcs) * 2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user