public static void SetAttribute(this GltfPrimitive prim, string semantic, int accessorIndex) { switch (semantic) { case "POSITION": prim.attributes.POSITION = accessorIndex; break; case "NORMAL": prim.attributes.NORMAL = accessorIndex; break; case "TANGENT": prim.attributes.TANGENT = accessorIndex; break; case "TEXCOORD_0": prim.attributes.TEXCOORD_0 = accessorIndex; break; case "COLOR_0": prim.attributes.COLOR_0 = accessorIndex; break; case "JOINTS_0": prim.attributes.JOINTS_0 = accessorIndex; break; case "WEIGHTS_0": prim.attributes.WEIGHTS_0 = accessorIndex; break; default: throw new KeyNotFoundException($"unknown key: {semantic}"); } }
public static bool HasSameVertexBuffer(this GltfPrimitive lhs, GltfPrimitive rhs) { return(lhs.attributes == rhs.attributes); }
public static bool HasVertexColor(this GltfPrimitive p) { return(p.attributes != null && p.attributes.COLOR_0 != -1); }