@@ -16,22 +16,22 @@ public static BoundingBox ComputeBounds(this VertexBufferBinding vertexBufferBin
1616 {
1717 var helper = new VertexBufferHelper ( vertexBufferBinding , vertexBufferBinding . Buffer . GetSerializationData ( ) . Content , out _ ) ;
1818
19- var computeBoundsStruct = new ComputeBoundsStruct
19+ var box = BoundingBox . Empty ;
20+ boundingSphere = BoundingSphere . Empty ;
21+ var computeBounds = new ComputeBoundsHelper
2022 {
21- Box = BoundingBox . Empty ,
22- Sphere = new BoundingSphere ( ) ,
23+ Box = ref box ,
24+ Sphere = ref boundingSphere ,
2325 Matrix = matrix
2426 } ;
25- helper . Read < PositionSemantic , Vector3 , ComputeBoundsStruct > ( default , computeBoundsStruct ) ;
26-
27- boundingSphere = computeBoundsStruct . Sphere ;
28- return computeBoundsStruct . Box ;
27+ helper . Read < PositionSemantic , Vector3 , ComputeBoundsHelper > ( default , computeBounds ) ;
28+ return box ;
2929 }
3030
31- struct ComputeBoundsStruct : VertexBufferHelper . IReader < Vector3 >
31+ ref struct ComputeBoundsHelper : VertexBufferHelper . IReader < Vector3 >
3232 {
33- public required BoundingBox Box ;
34- public required BoundingSphere Sphere ;
33+ public required ref BoundingBox Box ;
34+ public required ref BoundingSphere Sphere ;
3535 public required Matrix Matrix ;
3636
3737 public unsafe void Read < TConverter , TSource > ( byte * startPointer , int elementCount , int stride , Span < Vector3 > destination ) where TConverter : IConverter < TSource , Vector3 > where TSource : unmanaged
0 commit comments