Пример #1
0
        void DrawXWingMRT(Xwing xwing, DrawType dt)
        {
            int meshCount = 0;

            if (dt == DrawType.Regular)
            {
                MasterMRT.CurrentTechnique = MRTbasicColor;
            }

            //MRTapplyLightEffect.SetValue(0f);

            MRTaddToBloomFilter.SetValue(1f);
            DrawModelMRT(XwingEnginesModel, xwing.EnginesSRT, xwing.EnginesColor);
            MRTaddToBloomFilter.SetValue(0f);

            //MRTapplyLightEffect.SetValue(1f);

            if (dt == DrawType.Regular)
            {
                MasterMRT.CurrentTechnique = MRTtextured;
            }

            foreach (var mesh in XwingModel.Meshes)
            {
                xwing.World = mesh.ParentBone.Transform * xwing.SRT;

                var wvp = xwing.World * Game.SelectedCamera.View * Game.SelectedCamera.Projection;

                MRTtexture.SetValue(XwingTextures[meshCount]);
                MRTmodelNormal.SetValue(XwingNormalTex[meshCount]);
                MRTworld.SetValue(xwing.World);
                MRTworldViewProjection.SetValue(wvp);
                MRTinverseTransposeWorld.SetValue(Matrix.Transpose(Matrix.Invert(xwing.World)));
                meshCount++;

                mesh.Draw();
            }
        }
Пример #2
0
        void DrawSceneMRT(DrawType dt)
        {
            var CameraView       = Game.SelectedCamera.View;
            var CameraProjection = Game.SelectedCamera.Projection;
            var CameraPosition   = Game.SelectedCamera.Position;

            //MRTapplyLightEffect.SetValue(0f);
            //MRTinvertViewProjection.SetValue(Matrix.Invert(CameraView * CameraProjection));
            MRTcameraPosition.SetValue(CameraPosition);
            MRTlightDirection.SetValue(Game.LightCamera.FrontDirection);
            MRTspecularIntensity.SetValue(SpecularIntensity);
            MRTspecularPower.SetValue(SpecularPower);

            if (dt == DrawType.Regular)
            {
                MasterMRT.CurrentTechnique = MRTskybox;
                SkyBox.Draw(CameraView, CameraProjection, CameraPosition);
            }
            if (dt == DrawType.DepthMap)
            {
                MasterMRT.CurrentTechnique = MRTshadowMap;
            }

            //MasterMRT.Parameters["ApplyLightEffect"]?.SetValue(1f);
            if (Game.GameState.Equals(TGCGame.GmState.Running) ||
                Game.GameState.Equals(TGCGame.GmState.Paused) ||
                Game.GameState.Equals(TGCGame.GmState.Defeat))
            {
                if (showXwing)
                {
                    DrawXWingMRT(Game.Xwing, dt);
                }
                foreach (var enemy in tiesToDraw)
                {
                    DrawTieMRT(enemy);
                }
                foreach (var ship in shipsToDraw)
                {
                    if (ship.Allied)
                    {
                        DrawXwingMRT(ship);
                    }
                    else
                    {
                        DrawTieMRT(ship);
                    }
                }
                if (dt == DrawType.Regular)
                {
                    MasterMRT.CurrentTechnique = MRTbasicColor;
                    MRTaddToBloomFilter.SetValue(1f);
                    //MasterMRT.Parameters["ApplyLightEffect"]?.SetValue(0f);
                    //MRTapplyLightEffect.SetValue(0f);

                    foreach (var laser in lasersToDraw)
                    {
                        DrawModelMRT(LaserModel, laser.SRT, laser.Color);
                    }

                    MRTaddToBloomFilter.SetValue(0f);
                    //MasterMRT.Parameters["ApplyLightEffect"]?.SetValue(1f);
                    //MRTapplyLightEffect.SetValue(1f);

                    MRTcolor.SetValue(new Vector3(0.5f, 0.5f, 0.5f));

                    MasterMRT.CurrentTechnique = MasterMRT.Techniques["TrenchDraw"];
                }

                DrawMapMRT();
            }
        }