コード例 #1
0
        public static void NormalStart()
        {
            //render form
            Form = new RenderForm( );
            Form.Text = "MMD Model Viewer";

            ModForm.Show( );
            ModForm.SetFactorBoxChanged( OnFactorTextChanged );
            ModForm.SetRadiusBoxChanged( OnFactorTextChanged );
            ModForm.SetAlphaBarChanged( OnAlphaBarChanged );
            ModForm.SetOffsetBoxChanged( OnOffsetBoxChanged );
            ModForm.SetMorphNameChanged( OnMorphNameChanged );
            ModForm.SetScaleChanged( OnScaleChanged );
            ModForm.SetRotChanged( OnRotTextChanged );

            #region addEvent
            Form.MouseClick += Form_MouseClick;
            Form.MouseMove += Form_MouseMove;
            Form.MouseWheel += Form_MouseWheel;
            Form.KeyUp += Form_KeyUp;
            Form.FormClosed += Form_FormClosed;
            ;
            Debug = new VDBDebugger( );
            #endregion

            using ( SharpDevice device = new SharpDevice( Form ) )
            {
#if Lattice
                LatticeForm = new LatticeForm( Model , device );
                LatticeForm.Show( );
#endif

                Model.LoadTexture( device );
                Axis.LoadTexture( device );
#if Lattice
                LatticeForm.LoadTexture( device );
#endif
#if DEBUGLINE
                Line.LoadTexture(device);
                Line.AfterLoaded();
#endif

                //init frame counter
                FpsCounter.Reset( );
                device.SetBlend( BlendOperation.Add , BlendOption.SourceAlpha , BlendOption.InverseSourceAlpha );
                OnResizeForm( ( float )Form.ClientRectangle.Width / Form.ClientRectangle.Height , device );

                //main loop
                RenderLoop.Run( Form , () => OnUpdate( device ) );

                //release resource

                Model.Dispose( );
                RefModel?.Dispose( );
                Axis.Dispose( );
#if DEBUGLINE
                Line.Dispose();
#endif
            }
        }