|
@@ -147,8 +147,12 @@ namespace SharpGLTF.Runtime
|
|
|
// additional vertex attributes (color + UVs + Skinning)
|
|
// additional vertex attributes (color + UVs + Skinning)
|
|
|
|
|
|
|
|
_Color0 = srcPrim.GetVertexAccessor("COLOR_0")?.AsColorArray() as IReadOnlyList<XYZW>;
|
|
_Color0 = srcPrim.GetVertexAccessor("COLOR_0")?.AsColorArray() as IReadOnlyList<XYZW>;
|
|
|
|
|
+ _Color1 = srcPrim.GetVertexAccessor("COLOR_1")?.AsColorArray() as IReadOnlyList<XYZW>;
|
|
|
|
|
+
|
|
|
_TexCoord0 = srcPrim.GetVertexAccessor("TEXCOORD_0")?.AsVector2Array() as IReadOnlyList<XY>;
|
|
_TexCoord0 = srcPrim.GetVertexAccessor("TEXCOORD_0")?.AsVector2Array() as IReadOnlyList<XY>;
|
|
|
_TexCoord1 = srcPrim.GetVertexAccessor("TEXCOORD_1")?.AsVector2Array() as IReadOnlyList<XY>;
|
|
_TexCoord1 = srcPrim.GetVertexAccessor("TEXCOORD_1")?.AsVector2Array() as IReadOnlyList<XY>;
|
|
|
|
|
+ _TexCoord2 = srcPrim.GetVertexAccessor("TEXCOORD_2")?.AsVector2Array() as IReadOnlyList<XY>;
|
|
|
|
|
+ _TexCoord3 = srcPrim.GetVertexAccessor("TEXCOORD_3")?.AsVector2Array() as IReadOnlyList<XY>;
|
|
|
|
|
|
|
|
_Joints0 = srcPrim.GetVertexAccessor("JOINTS_0")?.AsVector4Array() as IReadOnlyList<XYZW>;
|
|
_Joints0 = srcPrim.GetVertexAccessor("JOINTS_0")?.AsVector4Array() as IReadOnlyList<XYZW>;
|
|
|
_Joints1 = srcPrim.GetVertexAccessor("JOINTS_1")?.AsVector4Array() as IReadOnlyList<XYZW>;
|
|
_Joints1 = srcPrim.GetVertexAccessor("JOINTS_1")?.AsVector4Array() as IReadOnlyList<XYZW>;
|
|
@@ -184,9 +188,12 @@ namespace SharpGLTF.Runtime
|
|
|
internal readonly List<_MorphTargetDecoder> _MorphTargets = new List<_MorphTargetDecoder>();
|
|
internal readonly List<_MorphTargetDecoder> _MorphTargets = new List<_MorphTargetDecoder>();
|
|
|
|
|
|
|
|
private readonly IReadOnlyList<XYZW> _Color0;
|
|
private readonly IReadOnlyList<XYZW> _Color0;
|
|
|
|
|
+ private readonly IReadOnlyList<XYZW> _Color1;
|
|
|
|
|
|
|
|
private readonly IReadOnlyList<XY> _TexCoord0;
|
|
private readonly IReadOnlyList<XY> _TexCoord0;
|
|
|
private readonly IReadOnlyList<XY> _TexCoord1;
|
|
private readonly IReadOnlyList<XY> _TexCoord1;
|
|
|
|
|
+ private readonly IReadOnlyList<XY> _TexCoord2;
|
|
|
|
|
+ private readonly IReadOnlyList<XY> _TexCoord3;
|
|
|
|
|
|
|
|
private readonly IReadOnlyList<XYZW> _Joints0;
|
|
private readonly IReadOnlyList<XYZW> _Joints0;
|
|
|
private readonly IReadOnlyList<XYZW> _Joints1;
|
|
private readonly IReadOnlyList<XYZW> _Joints1;
|
|
@@ -202,9 +209,12 @@ namespace SharpGLTF.Runtime
|
|
|
|
|
|
|
|
public int VertexCount => _Geometry.VertexCount;
|
|
public int VertexCount => _Geometry.VertexCount;
|
|
|
|
|
|
|
|
- public int ColorsCount => _Color0 != null ? 1 : 0;
|
|
|
|
|
|
|
+ public int ColorsCount => (_Color0 != null ? 1 : 0) + (_Color1 != null ? 1 : 0);
|
|
|
|
|
|
|
|
- public int TexCoordsCount => (_TexCoord0 != null ? 1 : 0) + (_TexCoord1 != null ? 1 : 0);
|
|
|
|
|
|
|
+ public int TexCoordsCount => (_TexCoord0 != null ? 1 : 0)
|
|
|
|
|
+ + (_TexCoord1 != null ? 1 : 0)
|
|
|
|
|
+ + (_TexCoord2 != null ? 1 : 0)
|
|
|
|
|
+ + (_TexCoord3 != null ? 1 : 0);
|
|
|
|
|
|
|
|
public int JointsWeightsCount => (_Joints0 != null ? 4 : 0) + (_Joints1 != null ? 4 : 0);
|
|
public int JointsWeightsCount => (_Joints0 != null ? 4 : 0) + (_Joints1 != null ? 4 : 0);
|
|
|
|
|
|
|
@@ -267,6 +277,8 @@ namespace SharpGLTF.Runtime
|
|
|
{
|
|
{
|
|
|
if (set == 0 && _TexCoord0 != null) return _TexCoord0[vertexIndex];
|
|
if (set == 0 && _TexCoord0 != null) return _TexCoord0[vertexIndex];
|
|
|
if (set == 1 && _TexCoord1 != null) return _TexCoord1[vertexIndex];
|
|
if (set == 1 && _TexCoord1 != null) return _TexCoord1[vertexIndex];
|
|
|
|
|
+ if (set == 2 && _TexCoord2 != null) return _TexCoord2[vertexIndex];
|
|
|
|
|
+ if (set == 3 && _TexCoord3 != null) return _TexCoord3[vertexIndex];
|
|
|
|
|
|
|
|
return XY.Zero;
|
|
return XY.Zero;
|
|
|
}
|
|
}
|
|
@@ -274,6 +286,7 @@ namespace SharpGLTF.Runtime
|
|
|
public XYZW GetColor(int vertexIndex, int set)
|
|
public XYZW GetColor(int vertexIndex, int set)
|
|
|
{
|
|
{
|
|
|
if (set == 0 && _Color0 != null) return _Color0[vertexIndex];
|
|
if (set == 0 && _Color0 != null) return _Color0[vertexIndex];
|
|
|
|
|
+ if (set == 1 && _Color1 != null) return _Color1[vertexIndex];
|
|
|
|
|
|
|
|
return XYZW.One;
|
|
return XYZW.One;
|
|
|
}
|
|
}
|