Exemple #1
0
        public void Init()
        {
            Console.WriteLine("GL version: " + GL.GetString(StringName.Version));
            TextureCollection.Load();
            MeshCollection.Load();
            BasicShader.MakeInstance();
            ForAmbientShader.MakeInstance();
            ForDirectionalShader.MakeInstance();
            ForShadowDirShader.MakeInstance();
            ForPointShader.MakeInstance();
            ShadowGenShader.MakeInstance();
            ColorShader.MakeInstance();
            TextureShader.MakeInstance();
            LiquidShader.MakeInstance(new Texture(Util.PATH + "res/textures/liquid.png"));
            BladeShader.MakeInstance();
            OrthoRenderEngine.Init();
            TooltipHelper  = new TooltipHelper();
            ErrortipHelper = new ErrorTooltipHelper();
            Localization.LoadFromFile(Util.PATH + "res/localization/no_NO.txt");
            MainMenu  = new MainMenuView(this);
            PauseMenu = new PauseMenuView(this);

            CurrentScene = MakeMenuScene();
            CurrentView  = MainMenu;
            CurrentView.OnViewUsed(null);
        }
Exemple #2
0
 public static void MakeInstance(Texture texture)
 {
     if (Instance == null)
     {
         Instance = new LiquidShader(texture);
     }
 }
Exemple #3
0
        public override void PostRender(Scene s, Matrix4 VP)
        {
            if (game.GameStats.FoundryAlloy.Amount >= 0.01f)
            {
                Matrix4       m = Matrix4.CreateScale(1, 1, game.GameStats.FoundryAlloy.Amount) * liquidTransform * Modelspace;
                ISimpleShader shader;
                if (game.GameStats.FoundryTemprature > game.GameStats.FoundryAlloy.GetMeltingPoint())
                {
                    shader = LiquidShader.Instance;
                    shader.Bind();
                    LiquidShader.Instance.UseTexture();
                    LiquidShader.Instance.AutoPan();
                    LiquidShader.Instance.SetEmission(Util.DefaultEmission);
                }
                else
                {
                    shader = BasicShader.Instance;
                    shader.Bind();
                }

                shader.SetModelspaceMatrix(m);
                shader.SetMVP(m * VP);
                shader.SetColor(game.GameStats.FoundryAlloy.GetColor());
                molten.Draw();
            }

            if (game.GameStats.CastFilling > 0 & game.GameStats.CastFilling <1 & game.GameStats.CastMetal> -1)
            {
                LiquidShader shader = LiquidShader.Instance;
                shader.Bind();
                shader.SetModelspaceMatrix(Modelspace);
                shader.SetMVP(Modelspace * VP);
                shader.SetColor(KnownMetal.GetColor(game.GameStats.CastMetal));
                shader.UseTexture();
                shader.AutoPan();
                shader.SetEmission(Util.DefaultEmission);
                fall.Draw();
            }

            if (game.TooltipHelper.GetOwner() == this)
            {
                game.TooltipHelper.RenderNormalDialog(Input.OrthoMouseX, Input.OrthoMouseY, Util.White60);
            }
        }