mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/ui: refactoring: unexport ConvertUniforms
This commit is contained in:
parent
f4ad12987d
commit
b5bb576a58
7
image.go
7
image.go
@ -512,9 +512,7 @@ func (i *Image) DrawTrianglesShader(vertices []Vertex, indices []uint16, shader
|
|||||||
offsets[i][1] = -sy + float32(b.Min.Y)
|
offsets[i][1] = -sy + float32(b.Min.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
us := shader.convertUniforms(options.Uniforms)
|
i.image.DrawTriangles(imgs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dstRegion, sr, offsets, shader.shader, options.Uniforms, options.FillRule == EvenOdd, false)
|
||||||
|
|
||||||
i.image.DrawTriangles(imgs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dstRegion, sr, offsets, shader.shader, us, options.FillRule == EvenOdd, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DrawRectShaderOptions represents options for DrawRectShader.
|
// DrawRectShaderOptions represents options for DrawRectShader.
|
||||||
@ -625,8 +623,7 @@ func (i *Image) DrawRectShader(width, height int, shader *Shader, options *DrawR
|
|||||||
offsets[i][1] = -sy + float32(b.Min.Y)
|
offsets[i][1] = -sy + float32(b.Min.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
us := shader.convertUniforms(options.Uniforms)
|
i.image.DrawTriangles(imgs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dstRegion, sr, offsets, shader.shader, options.Uniforms, false, canSkipMipmap(options.GeoM, graphicsdriver.FilterNearest))
|
||||||
i.image.DrawTriangles(imgs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, dstRegion, sr, offsets, shader.shader, us, false, canSkipMipmap(options.GeoM, graphicsdriver.FilterNearest))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubImage returns an image representing the portion of the image p visible through r.
|
// SubImage returns an image representing the portion of the image p visible through r.
|
||||||
|
@ -51,7 +51,7 @@ func (i *Image) MarkDisposed() {
|
|||||||
i.mipmap = nil
|
i.mipmap = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []float32, indices []uint16, colorm affine.ColorM, mode graphicsdriver.CompositeMode, filter graphicsdriver.Filter, address graphicsdriver.Address, dstRegion, srcRegion graphicsdriver.Region, subimageOffsets [graphics.ShaderImageNum - 1][2]float32, shader *Shader, uniforms [][]float32, evenOdd bool, canSkipMipmap bool) {
|
func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []float32, indices []uint16, colorm affine.ColorM, mode graphicsdriver.CompositeMode, filter graphicsdriver.Filter, address graphicsdriver.Address, dstRegion, srcRegion graphicsdriver.Region, subimageOffsets [graphics.ShaderImageNum - 1][2]float32, shader *Shader, uniforms map[string]interface{}, evenOdd bool, canSkipMipmap bool) {
|
||||||
var srcMipmaps [graphics.ShaderImageNum]*mipmap.Mipmap
|
var srcMipmaps [graphics.ShaderImageNum]*mipmap.Mipmap
|
||||||
for i, src := range srcs {
|
for i, src := range srcs {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
@ -61,11 +61,13 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []f
|
|||||||
}
|
}
|
||||||
|
|
||||||
var s *mipmap.Shader
|
var s *mipmap.Shader
|
||||||
|
var us [][]float32
|
||||||
if shader != nil {
|
if shader != nil {
|
||||||
s = shader.shader
|
s = shader.shader
|
||||||
|
us = shader.convertUniforms(uniforms)
|
||||||
}
|
}
|
||||||
|
|
||||||
i.mipmap.DrawTriangles(srcMipmaps, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, subimageOffsets, s, uniforms, evenOdd, canSkipMipmap)
|
i.mipmap.DrawTriangles(srcMipmaps, vertices, indices, colorm, mode, filter, address, dstRegion, srcRegion, subimageOffsets, s, us, evenOdd, canSkipMipmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) ReplacePixels(pix []byte, x, y, width, height int) {
|
func (i *Image) ReplacePixels(pix []byte, x, y, width, height int) {
|
||||||
|
@ -169,7 +169,7 @@ func __vertex(position vec2, texCoord vec2, color vec4) (vec4, vec2, vec4) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Shader) ConvertUniforms(uniforms map[string]interface{}) [][]float32 {
|
func (s *Shader) convertUniforms(uniforms map[string]interface{}) [][]float32 {
|
||||||
type index struct {
|
type index struct {
|
||||||
resultIndex int
|
resultIndex int
|
||||||
shaderUniformIndex int
|
shaderUniformIndex int
|
||||||
|
Loading…
Reference in New Issue
Block a user