Esempio n. 1
0
    public void WriteAsNamedJObject(GlTF_Globals G, string name)
    {
        // Recreates the ordering of the old code, for easier diffing.

        G.WriteKeyAndIndentIn(name, "{");
        // Recreate ordering of the old code for easier diffing.
        int OldOrder(string attribute)
        {
            switch (attribute)
            {
            case "POSITION": return(0);

            case "NORMAL": return(1);

            case "COLOR_0":
            case "COLOR": return(2);

            case "TANGENT": return(3);

            case "VERTEXID": return(4);

            default: return(5);
            }
        }

        // Sort dictionary to make output deterministic.
        foreach (var keyValue in m_accessors.OrderBy(kvp => (OldOrder(kvp.Key), kvp.Key)))
        {
            G.CNI.WriteNamedReference(keyValue.Key, keyValue.Value);
        }
        G.NewlineAndIndentOut("}");
    }
Esempio n. 2
0
    public void WriteAsUnnamedJObject(GlTF_Globals G)
    {
        G.jsonWriter.Write("{\n"); G.IndentIn();

        if (attributes != null)
        {
            G.CommaNL(); G.Indent(); attributes.WriteAsNamedJObject(G, "attributes");
        }
        G.CNI.WriteNamedReference("indices", indices);
        G.CNI.WriteNamedReference <GlTF_Material>("material", materialName);
        G.CNI.WriteNamedInt("mode", kPrimitiveMode_Triangles);
        G.NewlineAndIndentOut("}");
    }