Example #1
0
 public void Render()
 {
     Raylib.BeginShaderMode(shader);
     Raylib.DrawTexturePro(
         texture,
         new Rectangle(0, 0, texture.width, texture.height),
         new Rectangle(0, 0, ScreenController.windowWidth, ScreenController.windowHeight),
         Vector2.Zero,
         0,
         Color.RAYWHITE
         );
     Raylib.EndShaderMode();
 }
Example #2
0
        public void Update()
        {
            drawScreen.Update();

            Raylib.BeginDrawing();

            Raylib.BeginTextureMode(renderTexture);
            Raylib.ClearBackground(Color.BLACK);
            Raylib.BeginMode3D(camera);
            ModelRenderer.RenderQueue();
            Raylib.EndMode3D();
            Raylib.EndTextureMode();

            Raylib.ClearBackground(Color.BLACK);
            //Console.WriteLine(renderTexture.depth.id);

            Raylib.BeginShaderMode(postProcessShader);
            Raylib.SetShaderValueTexture(postProcessShader, Raylib.GetShaderLocation(postProcessShader, "depthTexture"), renderTexture.depth);
            unsafe
            {
                Vector4 screenDims = new Vector4(screenWidth, screenHeight, windowWidth, windowHeight);
                IntPtr  pointer    = new IntPtr(&screenDims);
                Raylib.SetShaderValue(
                    postProcessShader,
                    Raylib.GetShaderLocation(postProcessShader, "screenSize"),
                    pointer,
                    ShaderUniformDataType.SHADER_UNIFORM_VEC4
                    );
            }

            Raylib.DrawTexturePro(
                renderTexture.texture,
                new Rectangle(0, 0, renderTexture.texture.width, -renderTexture.texture.height),
                new Rectangle(0, 0, windowWidth, windowHeight),
                Vector2.Zero,
                0,
                Color.WHITE
                );
            Raylib.EndShaderMode();
            drawScreen.Render();
            Rlgl.rlDrawRenderBatchActive();

            Raylib.EndDrawing();

            Debug.Label("swap window");
        }