-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Currently CastArrayProperty handles all types except strings, the problem comes when we have variable types such as face indices, key frames, etc. This currently results in ugly code at runtime to do checks for which type it is.
Could possibly stored data in a raw byte buffer, with the ID, stride, etc. and allow scalar conversions at runtime using INumber from System.Numerics?
Also need a solution that caters to Vectors, maybe separate methods for them and methods for Scalars?
// methods of CastBuffer or CastArray or keep existing CastArrayProperty name
public TOut GetScalar<TOut>(int index) where TOut : unmanaged, INumberBase<TOut> // should handle widening via TOut.CreateChecked/CreateSaturated
public TOut Get<TOut>(int index) where TOut : unmanaged // throw error if The underlying buffers should remain inaccessible (or provide a GetRawBuffer method) and the conversions should be invisible to the end user
Other solution would be to create NumericBuffer, etc.
Metadata
Metadata
Assignees
Labels
No labels