zworld-demo/plugin/math/vec4/array.go

22 lines
430 B
Go
Raw Normal View History

2023-12-22 22:04:27 +08:00
package vec4
import "unsafe"
// Array holds an array of 4-component vectors
type Array []T
// Elements returns the number of elements in the array
func (a Array) Elements() int {
return len(a)
}
// Size return the byte size of an element
func (a Array) Size() int {
return 16
}
// Pointer returns an unsafe pointer to the first element in the array
func (a Array) Pointer() unsafe.Pointer {
return unsafe.Pointer(&a[0])
}