コード例 #1
0
        public void InitTextures()
        {
            //Used for dynamic lights. Ie spot, point, lights
            //Dynamic lights are setup using the g buffer pass (normals) and depth information before material pass is drawn
            //Additional slices may be used for bloom intensity
            LightPrepassTexture = GLTexture2DArray.CreateUncompressedTexture(4, 4, 1, 1,
                                                                             PixelInternalFormat.Rgba16f, PixelFormat.Rgba, PixelType.Float);

            LightPrepassTexture.Bind();
            LightPrepassTexture.MagFilter = TextureMagFilter.Linear;
            LightPrepassTexture.MinFilter = TextureMinFilter.Linear;
            LightPrepassTexture.UpdateParameters();
            LightPrepassTexture.Unbind();

            //Shadows
            //Channel usage:
            //Red - Dynamic shadows
            //Green - Static shadows (course, for casting onto objects)
            //Blue - Soft shading (under kart, dynamic AO?)
            //Alpha - Usually gray
            ShadowPrepassTexture = GLTexture2D.CreateWhiteTexture(4, 4);

            foreach (var lmap in Resources.LightMapFiles.Values)
            {
                lmap.Setup();
            }
        }
コード例 #2
0
 public void UpdateLightPrepass(GLContext control, GLTexture gbuffer, GLTexture linearDepth)
 {
     if (LightPrepassTexture == null)
     {
         LightPrepassTexture = GLTexture2DArray.CreateUncompressedTexture(control.Width, control.Height, 1, 1,
                                                                          PixelInternalFormat.R11fG11fB10f, PixelFormat.Rgb, PixelType.UnsignedInt10F11F11FRev);
         LightPrepassTexture.Bind();
         LightPrepassTexture.MagFilter = TextureMagFilter.Linear;
         LightPrepassTexture.MinFilter = TextureMinFilter.Linear;
         LightPrepassTexture.UpdateParameters();
         LightPrepassTexture.Unbind();
     }
     LightPrepassManager.CreateLightPrepassTexture(control, gbuffer, linearDepth, LightPrepassTexture);
 }