Skip to content

Commit

Permalink
Merge pull request #1153 from ousttrue/fix1/add_color_type
Browse files Browse the repository at this point in the history
implement Mesh.colors
  • Loading branch information
PoChang007 authored Aug 16, 2021
2 parents 2ecba6c + e530c4c commit 0172e4a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Assets/VRM10/vrmlib/Runtime/SpanLike.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ public static void Write(byte[] bytes, int i, UnityEngine.Vector4 value)
Write(bytes, i + 8, value.z);
Write(bytes, i + 12, value.w);
}

public static void Write(byte[] bytes, int i, UnityEngine.Color value)
{
Write(bytes, i, value.r);
Write(bytes, i + 4, value.g);
Write(bytes, i + 8, value.b);
Write(bytes, i + 12, value.a);
}

public static void Write(byte[] bytes, int i, UnityEngine.Matrix4x4 value)
{
Write(bytes, i, value.m00);
Expand Down Expand Up @@ -436,6 +445,16 @@ struct GetSet<T> where T : struct
),
Setter = BitWriter.Write
}},
{typeof(UnityEngine.Color), new GetSet<UnityEngine.Color>{
Getter = (array, start) =>
new UnityEngine.Color(
BitConverter.ToSingle(array, start),
BitConverter.ToSingle(array, start + 4),
BitConverter.ToSingle(array, start + 8),
BitConverter.ToSingle(array, start + 12)
),
Setter = BitWriter.Write
}},
{typeof(UnityEngine.Matrix4x4), new GetSet<UnityEngine.Matrix4x4>{
Getter = (array, start) =>
// UnityEngine.Matrix4x4
Expand Down

0 comments on commit 0172e4a

Please sign in to comment.