public static string ToJson(this glTFAttributes self) { var f = new JsonFormatter(); GltfSerializer.Serialize_gltf_meshes__primitives__attributes(f, self); return(f.ToString()); }
public static VertexBuffer FromGltf(this glTFAttributes attributes, Vrm10Storage storage) { var b = new VertexBuffer(); if (storage.TryCreateAccessor(attributes.POSITION, out BufferAccessor position)) { b.Add(VertexBuffer.PositionKey, position); } else { // position required throw new Exception(); } if (storage.TryCreateAccessor(attributes.NORMAL, out BufferAccessor normal)) { b.Add(VertexBuffer.NormalKey, normal); } if (storage.TryCreateAccessor(attributes.COLOR_0, out BufferAccessor color)) { b.Add(VertexBuffer.ColorKey, color); } if (storage.TryCreateAccessor(attributes.TEXCOORD_0, out BufferAccessor tex0)) { b.Add(VertexBuffer.TexCoordKey, tex0); } if (storage.TryCreateAccessor(attributes.TEXCOORD_1, out BufferAccessor tex1)) { b.Add(VertexBuffer.TexCoordKey2, tex1); } // if(storage.TryCreateAccessor(attributes.TANGENT, out BufferAccessor tangent))b.Add(VertexBuffer.TangentKey, tangent); if (storage.TryCreateAccessor(attributes.WEIGHTS_0, out BufferAccessor weights)) { b.Add(VertexBuffer.WeightKey, weights); } if (storage.TryCreateAccessor(attributes.JOINTS_0, out BufferAccessor joints)) { b.Add(VertexBuffer.JointKey, joints); } return(b); }