示例#1
0
        public int AddChannelAndGetSampler(int nodeIndex, string path)
        {
            // find channel
            var channel = channels.FirstOrDefault(x => x.target.node == nodeIndex && x.target.path == path);

            if (channel != null)
            {
                return(channel.sampler);
            }

            // not found. create new
            var samplerIndex = samplers.Count;
            var sampler      = new glTFAnimationSampler();

            samplers.Add(sampler);

            channel = new glTFAnimationChannel
            {
                sampler = samplerIndex,
                target  = new glTFAnimationTarget
                {
                    node = nodeIndex,
                    path = path,
                },
            };
            channels.Add(channel);

            return(samplerIndex);
        }
示例#2
0
        public static void Serialize_gltf_animations__channels_ITEM(JsonFormatter f, glTFAnimationChannel value)
        {
            f.BeginMap();


            if (value.sampler >= 0)
            {
                f.Key("sampler");
                f.Value(value.sampler);
            }

            if (value.target != null)
            {
                f.Key("target");
                Serialize_gltf_animations__channels__target(f, value.target);
            }

            if (value.extensions != null)
            {
                f.Key("extensions");
                value.extensions.Serialize(f);
            }

            if (value.extras != null)
            {
                f.Key("extras");
                value.extras.Serialize(f);
            }

            f.EndMap();
        }