예제 #1
0
        private void WriteTextureSequence(TextureSequence textureSequence)
        {
            output.Write(textureSequence.TextureFileName);
            output.Write(textureSequence.IsUseStaticTime);
            output.Write(textureSequence.IsRepeat);
            output.Write(textureSequence.IsRandomMode);
            output.Write(textureSequence.IsFixedFrameMode);
            output.Write(textureSequence.FrameWidth);
            output.Write(textureSequence.FrameHeight);
            output.Write(textureSequence.StaticInterval);
            output.Write(textureSequence.Count);
            output.Write(textureSequence.StartIndex);

            if (textureSequence.TimeTable != null)
            {
                output.Write(textureSequence.TimeTable.Count);

                for (int i = 0; i < textureSequence.TimeTable.Count; i++)
                {
                    output.Write(textureSequence.TimeTable[i]);
                }
            }
            else
            {
                output.Write((int)0);
            }
        }
예제 #2
0
        public override Texture CreateResource(ResourceManager resourceManager)
        {
            var frames = GetFrames(FileName, clone: false, out bool video, out PixelInternalFormat? internalFormat);

            if (video)
            {
                frames.Reset();
            }

            var sequence = new TextureSequence(frames.Count);

            using var enumerator = sequence.GetEnumerator(false);
            try
            {
                while (enumerator.MoveNext())
                {
                    ConfigureTexture(sequence, frames.Width, frames.Height);
                    if (!frames.MoveNext())
                    {
                        continue;
                    }
                    TextureHelper.UpdateTexture(TextureTarget.Texture2D, internalFormat, frames.Current);
                }
            }
            finally { frames.Dispose(); }
            GL.BindTexture(TextureTarget.Texture2D, 0);
            sequence.PlaybackRate = frames.PlaybackRate;
            return((Texture)sequence);
        }
예제 #3
0
 private void animateSequence(TextureSequence sequence)
 {
     if (_frame < sequence.frames.Count - 1)
         _frame += 1;
     else
         _frame = 0;
 }
예제 #4
0
 public Sampler2D(TextureSequence seq)
 {
     animated = true;
     sequence = seq;
 }