MCPcopy
hub / github.com/g3n/engine / isInterleaved

Method isInterleaved

loader/gltf/loader.go:1012–1029  ·  view source on GitHub ↗

isInterleaves returns whether the BufferView used by the provided accessor is interleaved.

(accessor Accessor)

Source from the content-addressed store, hash-verified

1010
1011// isInterleaves returns whether the BufferView used by the provided accessor is interleaved.
1012func (g *GLTF) isInterleaved(accessor Accessor) bool {
1013
1014 // Get the Accessor's BufferView
1015 if accessor.BufferView == nil {
1016 return false
1017 }
1018 bv := g.BufferViews[*accessor.BufferView]
1019
1020 // Calculates the size in bytes of a complete attribute
1021 itemSize := TypeSizes[accessor.Type]
1022 itemBytes := int(gls.FloatSize) * itemSize
1023
1024 // If the BufferView stride is equal to the item size, the buffer is not interleaved
1025 if bv.ByteStride == nil || *bv.ByteStride == itemBytes {
1026 return false
1027 }
1028 return true
1029}
1030
1031// loadBufferView loads and returns a byte slice with data from the specified BufferView.
1032func (g *GLTF) loadBufferView(bvIdx int) ([]byte, error) {

Callers 1

loadAttributesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected