protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            if (!String.IsNullOrEmpty(name))
            {
                f.Key("name"); f.Value(name);
            }
            if (pbrMetallicRoughness != null)
            {
                f.Key("pbrMetallicRoughness"); f.GLTFValue(pbrMetallicRoughness);
            }
            if (normalTexture != null)
            {
                f.Key("normalTexture"); f.GLTFValue(normalTexture);
            }
            if (occlusionTexture != null)
            {
                f.Key("occlusionTexture"); f.GLTFValue(occlusionTexture);
            }
            if (emissiveTexture != null)
            {
                f.Key("emissiveTexture"); f.GLTFValue(emissiveTexture);
            }
            if (emissiveFactor != null)
            {
                f.Key("emissiveFactor"); f.Value(emissiveFactor);
            }

            f.KeyValue(() => doubleSided);

            if (!string.IsNullOrEmpty(alphaMode))
            {
                f.KeyValue(() => alphaMode);
            }

            if (extensions != null)
            {
                f.KeyValue(() => extensions);
            }
        }
Beispiel #2
0
        protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            if (extensionsUsed.Count > 0)
            {
                f.Key("extensionsUsed"); f.GLTFValue(extensionsUsed);
            }
            if (extensions.__count > 0)
            {
                f.Key("extensions"); f.GLTFValue(extensions);
            }
            if (extras.__count > 0)
            {
                f.Key("extras"); f.GLTFValue(extras);
            }

            f.Key("asset"); f.GLTFValue(asset);

            // buffer
            if (buffers.Any())
            {
                f.Key("buffers"); f.GLTFValue(buffers);
            }
            if (bufferViews.Any())
            {
                f.Key("bufferViews"); f.GLTFValue(bufferViews);
            }
            if (accessors.Any())
            {
                f.Key("accessors"); f.GLTFValue(accessors);
            }

            // materials
            if (images.Any())
            {
                f.Key("images"); f.GLTFValue(images);
                if (samplers.Count == 0)
                {
                    samplers.Add(new glTFTextureSampler());
                }
            }

            if (samplers.Any())
            {
                f.Key("samplers"); f.GLTFValue(samplers);
            }

            if (textures.Any())
            {
                f.Key("textures"); f.GLTFValue(textures);
            }
            if (materials.Any())
            {
                f.Key("materials"); f.GLTFValue(materials);
            }

            // meshes
            if (meshes.Any())
            {
                f.Key("meshes"); f.GLTFValue(meshes);
            }
            if (skins.Any())
            {
                f.Key("skins"); f.GLTFValue(skins);
            }

            // scene
            if (nodes.Any())
            {
                f.Key("nodes"); f.GLTFValue(nodes);
            }
            if (scenes.Any())
            {
                f.Key("scenes"); f.GLTFValue(scenes);
                if (scene >= 0)
                {
                    f.KeyValue(() => scene);
                }
            }

            // animations
            if (animations.Any())
            {
                f.Key("animations"); f.GLTFValue(animations);
            }
        }
Beispiel #3
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => bufferView);
     f.KeyValue(() => byteOffset);
     f.Key("componentType"); f.Value((int)componentType);
 }
Beispiel #4
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => sampler);
     f.Key("target"); f.GLTFValue(target);
 }
Beispiel #5
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => count);
     f.Key("indices"); f.GLTFValue(indices);
     f.Key("values"); f.GLTFValue(values);
 }
Beispiel #6
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => name);
     f.Key("primitives"); f.GLTFValue(primitives);
 }
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.Key("generator"); f.Value(generator);
     f.Key("version"); f.Value(version);
 }
Beispiel #8
0
 void VRMSerializeMembers(GLTFJsonFormatter f)
 {
     f.Key("VRM"); f.GLTFValue(VRM);
 }