2
// This unit is part of the GLScene Engine https://github.com/glscene
5
A shader that passes control of the DoApply and DoUnApply
6
methods through published events. This component is
7
designed to make it a little easier to implement a
8
customized shader. Be sure to keep the shader balanced
9
by returning the OpenGL state to how you found it.
12
25/02/07 - DaStr - Moved registration to GLSceneRegister.pas
13
05/08/03 - SG - Creation
20
Classes, GLMaterial, GLRenderContextInfo;
23
TOnDoApplyEvent = procedure (Sender : TObject; var rci : TGLRenderContextInfo) of Object;
24
TOnDoUnApplyEvent = procedure (Sender : TObject; Pass:Integer; var rci : TGLRenderContextInfo; var Continue : Boolean) of Object;
26
TGLUserShader = class(TGLShader)
29
FOnDoApply : TOnDoApplyEvent;
30
FOnDoUnApply : TOnDoUnApplyEvent;
32
procedure DoApply(var rci : TGLRenderContextInfo; Sender : TObject); override;
33
function DoUnApply(var rci : TGLRenderContextInfo) : Boolean; override;
35
property OnDoApply : TOnDoApplyEvent read FOnDoApply write FOnDoApply;
36
property OnDoUnApply : TOnDoUnApplyEvent read FOnDoUnApply write FOnDoUnApply;
40
// ------------------------------------------------------------------
41
// ------------------------------------------------------------------
42
// ------------------------------------------------------------------
44
// ------------------------------------------------------------------
45
// ------------------------------------------------------------------
46
// ------------------------------------------------------------------
49
// ------------------ TGLUserShader ------------------
54
procedure TGLUserShader.DoApply(var rci: TGLRenderContextInfo; Sender : TObject);
57
if Assigned(FOnDoApply) and (not (csDesigning in ComponentState)) then
63
function TGLUserShader.DoUnApply(var rci: TGLRenderContextInfo): Boolean;
66
if Assigned(FOnDoUnApply) and (not (csDesigning in ComponentState)) then begin
67
FOnDoUnApply(Self,FPass,rci,Result);