Beispiel #1
0
        public override void Draw(bool is_shadowmap)
        {
            var game_main = GameMain.GetInstance();

            game_main.g3d_map.Draw();
            game_main.unit_manager.Draw();
            game_main.action_manager.Draw();
            game_main.user_interface.Draw();

            var screen = new SDrawImageByScreen();

            screen.FilterGauss(2, 200);

            var alpha = timer * 4;

            if (alpha < 0)
            {
                alpha = 0;
            }
            if (alpha > 255)
            {
                alpha = 255;
            }
            screen.Draw(new SDPoint(0, 0), new Rectangle(0, 0, GameMain.WindowSizeW, GameMain.WindowSizeH), (double)alpha / 255.0, false);
            screen.Dispose();

            alpha = timer * 4;
            if (alpha < 0)
            {
                alpha = 0;
            }
            if (alpha > 255)
            {
                alpha = 255;
            }
            DX.SetDrawBlendMode(DX.DX_BLENDMODE_ALPHA, alpha);
            {
                var text = mode_title;
                int sw   = 0;
                int sh   = 0;
                int sc   = 0;
                DX.GetDrawStringSizeToHandle(out sw, out sh, out sc, text, text.Length, font.GetHandle());
                var x = GameMain.WindowSizeW / 2 - sw / 2;
                var y = GameMain.WindowSizeH / 2 - sh / 2;
                DX.DrawStringFToHandle(x, y, text, DX.GetColor(255, 255, 255), font.GetHandle(), edge_color);
            }
            DX.SetDrawBlendMode(DX.DX_BLENDMODE_NOBLEND, 0);

            ui_box_restart.Draw();
        }
Beispiel #2
0
        public void MainLoop()
        {
            stask_manager.Update();

            if (scene != null)
            {
                scene.Update();
            }

            // ライト
            //DX.ChangeLightTypePoint(DX.VGet(0.0f, 300.0f, 0.0f), 2000.0f, 0.040f, 0.0025f, 0.000f);
            DX.ChangeLightTypePoint(DX.VGet(50.0f, 300.0f, 50.0f), 2000.0f, 0.040f, 0.0025f, 0.000f);

            // 影
            if (is_use_shadowmap)
            {
                //DX.SetShadowMapLightDirection(ShadowMapHandle, DX.VGet(20.0f, -50.0f, 20.0f));
                DX.SetShadowMapLightDirection(ShadowMapHandle, DX.VGet(-20.0f, -50.0f, 20.0f));
                DX.SetShadowMapDrawArea(ShadowMapHandle, DX.VGet(-10.0f, 0.0f, -10.0f), DX.VGet(150.0f, 10.0f, 150.0f));
                //DX.SetShadowMapAdjustDepth(ShadowMapHandle, 0.1000f); // 初期値 0.002f
                DX.SetShadowMapAdjustDepth(ShadowMapHandle, 0.002f); // 初期値 0.002f
            }

            if (is_use_shadowmap)
            {
                DX.ShadowMap_DrawSetup(ShadowMapHandle);
                MainLoop_Draw3DObjects(true);
                DX.ShadowMap_DrawEnd();
            }

            DX.ClearDrawScreen();
            DX.SetUseShadowMap(0, ShadowMapHandle);

            //
            if (debug_is_view)
            {
                uint color  = DX.GetColor(255, 255, 255);
                uint colorR = DX.GetColor(255, 0, 0);
                uint colorG = DX.GetColor(0, 255, 0);
                uint colorB = DX.GetColor(0, 0, 255);
                var  w      = 10;
                var  num    = 10;
                for (int x = 0; x < num; x++)
                {
                    DX.DrawLine3D(DX.VGet(0, 0, 0 + x * w), DX.VGet(w * num, 0, 0 + x * w), color);
                    DX.DrawLine3D(DX.VGet(0 + x * w, 0, 0), DX.VGet(0 + x * w, 0, w * num), color);
                }
                DX.DrawLine3D(DX.VGet(0, 0, 0), DX.VGet(300, 0, 0), colorR);
                DX.DrawLine3D(DX.VGet(0, 0, 0), DX.VGet(0, 300, 0), colorG);
                DX.DrawLine3D(DX.VGet(0, 0, 0), DX.VGet(0, 0, 300), colorB);
            }

            MainLoop_Draw3DObjects(false);


            // 確認ようにシャドウマップの描画
            if (is_use_shadowmap)
            {
                DX.SetUseShadowMap(0, -1);

                var screen = new SDrawImageByScreen();

                DX.ClearDrawScreen();
                MainLoop_Draw3DObjects(false);

                var alpha = 128;
                screen.Draw(new SDPoint(0, 0), new Rectangle(0, 0, GameMain.WindowSizeW, GameMain.WindowSizeH), (double)alpha / 255.0, false);
                screen.Dispose();

                //DX.TestDrawShadowMap(ShadowMapHandle, 5, 300, 5 + 100, 300 + 100);
            }

            DrawDebug();
        }