Пример #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__samplers_ITEM(JsonFormatter f, glTFAnimationSampler value)
        {
            f.BeginMap();


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

            if (!string.IsNullOrEmpty(value.interpolation))
            {
                f.Key("interpolation");
                f.Value(value.interpolation);
            }

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

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

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

            f.EndMap();
        }