Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public static void MakeInstance()
 {
     if (Instance == null)
     {
         Instance = new BladeShader();
     }
 }
Ejemplo n.º 3
0
        public void RenderBlade(Matrix4 VP, float x, float y, float z, float zRot, float[] heat, Vector3 eyePos)
        {
            Matrix4     modelspace = Type.MeshScaleMatrix * Matrix4.CreateRotationZ(zRot) * Matrix4.CreateTranslation(x, y, z);
            BladeShader Instance   = BladeShader.Instance;

            Instance.Bind();
            Instance.SetModelspaceMatrix(modelspace);
            Instance.SetMVP(modelspace * VP);
            Instance.SetColor(KnownMetal.GetColor(Metal));
            UpdateHeatMap(heat);
            Instance.SetMaps(sharpnessMap, heatMap);
            Instance.SetEyePos(eyePos);
            Type.Mesh.Draw();

            BasicShader Instance0 = BasicShader.Instance;

            Instance0.Bind();
            for (int i = 0; i < Type.Points.Length; i++)
            {
                Matrix4 diamondModelspace = Matrix4.CreateTranslation(Type.Points [i], -0.15f + (float)Math.Sin(Time.CurrentTime() * 4 + Type.Points [i] * Util.PI) * 0.03f, 0) * modelspace;
                Instance0.SetModelspaceMatrix(diamondModelspace);
                Instance0.SetMVP(diamondModelspace * VP);
                Instance0.SetColor(Sharpness[i] < 0.95f?diamondColor * (1 - Sharpness[i]) + sharperDiamondColor * Sharpness[i]:sharpDiamondColor);
                MeshCollection.Diamond.Draw();
            }
        }
Ejemplo n.º 4
0
        public override void RenderItem(float x, float y, float width, float height)
        {
            BladeShader Instance = BladeShader.Instance;

            Instance.Bind();
            Instance.SetMVP(OrthoRenderEngine.GetMVPForMesh(Type.CenteredScaledMeshMatirx * ItemMatrix, x + 4, y + 4, width - 8, height - 8));
            Instance.SetModelspaceMatrix(OrthoRenderEngine.DefaultModelspace);
            Instance.SetColor(KnownMetal.GetColor(Metal));
            Instance.SetMaps(sharpnessMap);
            Type.Mesh.Draw();
        }