mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
opengl: Faster conversion from []float32 to Float32Array
This commit is contained in:
parent
840c4d24df
commit
702a429afb
@ -316,10 +316,8 @@ func (c *Context) UniformFloats(p Program, location string, v []float32) {
|
|||||||
case 4:
|
case 4:
|
||||||
gl.Call("uniform4f", js.Value(l), v[0], v[1], v[2], v[3])
|
gl.Call("uniform4f", js.Value(l), v[0], v[1], v[2], v[3])
|
||||||
case 16:
|
case 16:
|
||||||
m := js.Global.Get("Float32Array").New(16)
|
u8 := js.ValueOf(v)
|
||||||
for i := range v {
|
m := js.Global.Get("Float32Array").New(u8.Get("buffer"), u8.Get("byteOffset").Int(), 16)
|
||||||
m.SetIndex(i, v[i])
|
|
||||||
}
|
|
||||||
gl.Call("uniformMatrix4fv", js.Value(l), false, m)
|
gl.Call("uniformMatrix4fv", js.Value(l), false, m)
|
||||||
default:
|
default:
|
||||||
panic("not reached")
|
panic("not reached")
|
||||||
|
Loading…
Reference in New Issue
Block a user