Beispiel #1
0
        public void UpdateShadowMap(Scene s, Matrix4 VP)
        {
            var viewportBounds = new int[4];

            GL.GetInteger(GetPName.Viewport, viewportBounds);

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBuffer);
            GL.DrawBuffer(DrawBufferMode.None);

            GL.Disable(EnableCap.Blend);
            GL.ClearDepth(1);

            GL.Clear(ClearBufferMask.DepthBufferBit);

            GL.Viewport(0, 0, ShadowMapSize, ShadowMapSize);

            ShadowGenShader Instance = ShadowGenShader.Instance;

            Instance.Bind();

            //GL.Disable (EnableCap.CullFace);
            s.RenderWithShader(VP, Instance);
            GL.Enable(EnableCap.CullFace);

            GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
            GL.DrawBuffer(DrawBufferMode.Back);
            GL.Viewport(viewportBounds[0], viewportBounds[1], viewportBounds[2], viewportBounds[3]);

            /*GL.DepthFunc (DepthFunction.Always);
             * OrthoRenderEngine.DrawColoredTextureOnEntireScreen (Util.White, shadowMap);
             * GL.DepthFunc (DepthFunction.Never);*/

            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.Blend);
        }
Beispiel #2
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);
        }
Beispiel #3
0
 public static void MakeInstance()
 {
     if (Instance == null)
     {
         Instance = new ShadowGenShader();
     }
 }