// Joints用 public UShort4[] GetAsUShort4() { if (AccessorType != AccessorVectorType.VEC4) { throw new InvalidOperationException("not vec4"); } switch (ComponentType) { case AccessorValueType.UNSIGNED_SHORT: return(SpanLike.Wrap <UShort4>(Bytes).ToArray()); case AccessorValueType.UNSIGNED_BYTE: { var array = new UShort4[Count]; var span = SpanLike.Wrap <Byte4>(Bytes); for (int i = 0; i < span.Length; ++i) { array[i].X = span[i].X; array[i].Y = span[i].Y; array[i].Z = span[i].Z; array[i].W = span[i].W; } return(array); } default: throw new NotImplementedException(); } }
public static void Write(byte[] bytes, int i, UShort4 value) { Write(bytes, i, value.X); Write(bytes, i + 2, value.Y); Write(bytes, i + 4, value.Z); Write(bytes, i + 6, value.W); }