示例#1
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => name);
     if (!string.IsNullOrEmpty(uri))
     {
         f.KeyValue(() => uri);
     }
     else
     {
         f.KeyValue(() => bufferView);
         f.KeyValue(() => mimeType);
     }
 }
示例#2
0
 void PrimitiveMembers(GLTFJsonFormatter f)
 {
     if (targetNames.Count > 0)
     {
         f.Key("targetNames");
         f.BeginList();
         foreach (var x in targetNames)
         {
             f.Value(x);
         }
         f.EndList();
     }
 }
示例#3
0
        protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            if (children != null && children.Any())
            {
                f.Key("children"); f.BeginList();
                foreach (var child in children)
                {
                    f.Value(child);
                }
                f.EndList();
            }

            if (!string.IsNullOrEmpty(name))
            {
                f.KeyValue(() => name);
            }
            if (matrix != null)
            {
                f.KeyValue(() => matrix);
            }
            if (translation != null)
            {
                f.KeyValue(() => translation);
            }
            if (rotation != null)
            {
                f.KeyValue(() => rotation);
            }
            if (scale != null)
            {
                f.KeyValue(() => scale);
            }

            if (mesh >= 0)
            {
                f.KeyValue(() => mesh);
            }
            if (camera >= 0)
            {
                f.KeyValue(() => camera);
            }
            if (skin >= 0)
            {
                f.KeyValue(() => skin);

                if (extras.__count > 0)
                {
                    f.Key("extras"); f.GLTFValue(extras);
                }
            }
        }
示例#4
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => mode);
     f.KeyValue(() => indices);
     f.Key("attributes"); f.GLTFValue(attributes);
     f.KeyValue(() => material);
     if (targets != null && targets.Count > 0)
     {
         f.Key("targets"); f.GLTFValue(targets);
     }
     if (extras.targetNames.Count > 0)
     {
         f.Key("extras"); f.GLTFValue(extras);
     }
 }
示例#5
0
        protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            f.KeyValue(() => buffer);
            f.KeyValue(() => byteOffset);
            f.KeyValue(() => byteLength);
            if (target != glBufferTarget.NONE)
            {
                f.Key("target"); f.Value((int)target);
            }

            /* When this is not defined, data is tightly packed. When two or more accessors use the same bufferView, this field must be defined.
             * if (byteStride >= 4)
             * {
             *  f.KeyValue(() => byteStride);
             * }
             */
        }
示例#6
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     if (baseColorTexture != null)
     {
         f.Key("baseColorTexture"); f.GLTFValue(baseColorTexture);
     }
     if (baseColorFactor != null)
     {
         f.KeyValue(() => baseColorFactor);
     }
     if (metallicRoughnessTexture != null)
     {
         f.Key("metallicRoughnessTexture"); f.GLTFValue(metallicRoughnessTexture);
     }
     f.KeyValue(() => metallicFactor);
     f.KeyValue(() => roughnessFactor);
 }
示例#7
0
        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.Serialize(emissiveFactor);
            }

            f.KeyValue(() => doubleSided);

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

            if (extensions != null)
            {
                f.Key("extensions"); f.GLTFValue(extensions);
            }
        }
示例#8
0
        protected override void SerializeMembers(GLTFJsonFormatter f)
        {
            f.KeyValue(() => bufferView);
            f.KeyValue(() => byteOffset);
            f.KeyValue(() => type);
            f.Key("componentType"); f.Value((int)componentType);
            f.KeyValue(() => count);
            if (max != null && max.Any())
            {
                f.KeyValue(() => max);
            }
            if (min != null && min.Any())
            {
                f.KeyValue(() => min);
            }

            if (sparse != null && sparse.count > 0)
            {
                f.Key("sparse"); f.GLTFValue(sparse);
            }

            f.KeyValue(() => normalized);
            f.KeyValue(() => name);
        }
示例#9
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.Key("generator"); f.Value(generator);
     f.Key("version"); f.Value(version);
 }
示例#10
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => sampler);
     f.Key("target"); f.GLTFValue(target);
 }
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     //throw new System.NotImplementedException();
 }
示例#12
0
 void SerializeMembers_draco(GLTFJsonFormatter f)
 {
     //throw new NotImplementedException();
 }
示例#13
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => sampler);
     f.KeyValue(() => source);
 }
示例#14
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => bufferView);
     f.KeyValue(() => byteOffset);
     f.Key("componentType"); f.Value((int)componentType);
 }
示例#15
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => strength);
     base.SerializeMembers(f);
 }
示例#16
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => index);
     f.KeyValue(() => texCoord);
 }
示例#17
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => nodes);
 }
示例#18
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => count);
     f.Key("indices"); f.GLTFValue(indices);
     f.Key("values"); f.GLTFValue(values);
 }
示例#19
0
 protected override void SerializeMembers(GLTFJsonFormatter f)
 {
     f.KeyValue(() => bufferView);
     f.KeyValue(() => byteOffset);
 }
示例#20
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);
            }
        }
 protected abstract void SerializeMembers(GLTFJsonFormatter f);