Download Now

    Reference TShadowBuffer

    Declared in Codebot.Render.Buffers.pas on line 49

    TShadowBuffer records depth into a square depth texture for shadow mapping. The texture compares depths when sampled, so shaders read it using a sampler2DShadow which returns how lit a point is from 0 to 1 with filtered edges. Points outside the texture are lit.
      TShadowBuffer = class(TContextManagedObject)
      public
        { Create a shadow buffer using a size in pixels }
        constructor Create(Size: Integer = 2048);
        destructor Destroy; override;
        { Start recording depth. Nothing is drawn to color, and depths are offset
          slightly to prevent surfaces from shadowing themselves. }
        procedure StartRecording;
        { Stop recording, restoring the prior frame buffer and viewport }
        procedure StopRecording;
        { The depth texture }
        property Texture: Integer read FTexture;
        { The width and height of the depth texture in pixels }
        property Size: Integer read FSize;
      end;

    See also

    TContextManagedObject in Codebot.Render.Contexts.pas