예제 #1
0
        /// <summary>
        /// Thread to animate the model.
        /// </summary>
        private void _animation()
        {
            Rsm rsm = new Rsm(_baseLoadData[3]);

            this.Dispatch(delegate {
                _slider.Maximum = rsm.AnimationLength;
            });

            foreach (var mesh in rsm.Meshes)
            {
                Console.WriteLine(mesh.Name);
            }

            while (!_terminateThread)
            {
                _mainModelGroup.Dispatch(delegate {
                    _mainModelGroup.Children.Clear();
                    LoadModel(rsm, _mainModelGroup);
                });

                if (_animationStartState == "++")
                {
                    _animationFrame++;
                }

                if (_animationFrame >= rsm.AnimationLength)
                {
                    _animationFrame = 0;
                }

                int delay = (int)(1000 / rsm.FrameRatePerSecond);

                if (delay < 5)
                {
                    delay = 33;
                }

                Thread.Sleep(delay);
            }
        }