mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
internal/affine: Use a pointer of an array for UnsafeElements
This commit is contained in:
parent
2c26e85183
commit
7e5b259dd2
@ -173,15 +173,15 @@ func (c *colorMImplBodyTranslate) Apply(clr color.Color) color.Color {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ColorM) UnsafeElements() ([]float32, []float32) {
|
func (c *ColorM) UnsafeElements() (*[16]float32, *[4]float32) {
|
||||||
if c.isIdentity() {
|
if c.isIdentity() {
|
||||||
return colorMIdentityBody[:], colorMIdentityTranslate[:]
|
return &colorMIdentityBody, &colorMIdentityTranslate
|
||||||
}
|
}
|
||||||
return c.impl.UnsafeElements()
|
return c.impl.UnsafeElements()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *colorMImplBodyTranslate) UnsafeElements() ([]float32, []float32) {
|
func (c *colorMImplBodyTranslate) UnsafeElements() (*[16]float32, *[4]float32) {
|
||||||
return c.body[:], c.translate[:]
|
return &c.body, &c.translate
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ColorM) det() float32 {
|
func (c *ColorM) det() float32 {
|
||||||
|
@ -917,8 +917,8 @@ func (g *Graphics) DrawTriangles(dstID driver.ImageID, srcIDs [graphics.ShaderIm
|
|||||||
uniformVars = []interface{}{
|
uniformVars = []interface{}{
|
||||||
[]float32{float32(w), float32(h)},
|
[]float32{float32(w), float32(h)},
|
||||||
sourceSize,
|
sourceSize,
|
||||||
esBody,
|
esBody[:],
|
||||||
esTranslate,
|
esTranslate[:],
|
||||||
scale,
|
scale,
|
||||||
[]float32{
|
[]float32{
|
||||||
srcRegion.X,
|
srcRegion.X,
|
||||||
|
@ -192,11 +192,11 @@ func (g *Graphics) DrawTriangles(dstID driver.ImageID, srcIDs [graphics.ShaderIm
|
|||||||
esBody, esTranslate := colorM.UnsafeElements()
|
esBody, esTranslate := colorM.UnsafeElements()
|
||||||
uniformVars = append(uniformVars, uniformVariable{
|
uniformVars = append(uniformVars, uniformVariable{
|
||||||
name: "color_matrix_body",
|
name: "color_matrix_body",
|
||||||
value: esBody,
|
value: esBody[:],
|
||||||
typ: shaderir.Type{Main: shaderir.Mat4},
|
typ: shaderir.Type{Main: shaderir.Mat4},
|
||||||
}, uniformVariable{
|
}, uniformVariable{
|
||||||
name: "color_matrix_translation",
|
name: "color_matrix_translation",
|
||||||
value: esTranslate,
|
value: esTranslate[:],
|
||||||
typ: shaderir.Type{Main: shaderir.Vec4},
|
typ: shaderir.Type{Main: shaderir.Vec4},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user