-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathBaseConflict.DebugForm.pas
99 lines (83 loc) · 2 KB
/
BaseConflict.DebugForm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
unit BaseConflict.DebugForm;
interface
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
System.Variants,
System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.ComCtrls,
Engine.Core,
Engine.Helferlein,
Engine.Math;
type
TForm2 = class(TForm)
OutputMemo : TMemo;
OutputLabel : TLabel;
DebugTrack : TTrackBar;
DebugValueEdit : TEdit;
PrintBtn : TButton;
ValueMinEdit : TEdit;
ValueMaxEdit : TEdit;
procedure FormCreate(Sender : TObject);
procedure ValueMinEditChange(Sender : TObject);
procedure DebugTrackChange(Sender : TObject);
private
FMini, FMaxi, FTrackValue, FRealValue : single;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
procedure RefreshSpan;
procedure RefreshValue;
procedure ApplyValue;
end;
var
Form2 : TForm2;
implementation
{$R *.dfm}
function f(float : single) : string;
begin
Result := FloatToStrF(float, ffGeneral, 4, 4, EngineFloatFormatSettings);
end;
procedure TForm2.ApplyValue;
begin
GFXD.Rendermanager.Shadowmapping.Shadowbias := FRealValue;
end;
procedure TForm2.DebugTrackChange(Sender : TObject);
begin
FTrackValue := DebugTrack.Position / DebugTrack.Max;
RefreshValue;
end;
procedure TForm2.FormCreate(Sender : TObject);
begin
assert(assigned(GFXD));
OutputLabel.Caption := f(GFXD.Camera.Position.Distance(GFXD.Camera.Target));
DebugValueEdit.Text := f(GFXD.Rendermanager.Shadowmapping.Shadowbias);
end;
procedure TForm2.RefreshSpan;
var
mini, maxi : single;
begin
if TryStrToFloat(ValueMinEdit.Text, mini, EngineFloatFormatSettings) and TryStrToFloat(ValueMaxEdit.Text, maxi, EngineFloatFormatSettings) then
begin
FMini := mini;
FMaxi := maxi;
end;
end;
procedure TForm2.RefreshValue;
begin
FRealValue := FTrackValue * (FMaxi - FMini) + FMini;
DebugValueEdit.Text := f(FRealValue);
ApplyValue;
end;
procedure TForm2.ValueMinEditChange(Sender : TObject);
begin
RefreshSpan;
RefreshValue;
end;
end.