forked from thargor6/mb3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAniProcess.pas
209 lines (195 loc) · 6.67 KB
/
AniProcess.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
unit AniProcess;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Vcl.ComCtrls;
type
TAniProcessForm = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Label16: TLabel;
Label18: TLabel;
Label13: TLabel;
Edit25: TEdit;
CheckBox1: TCheckBox;
Label1: TLabel;
CheckBox2: TCheckBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
Button5: TButton;
CheckBox6: TCheckBox;
Edit1: TEdit;
Label15: TLabel;
Bevel1: TBevel;
Bevel2: TBevel;
Button6: TButton;
CheckBox8: TCheckBox;
Bevel3: TBevel;
Bevel4: TBevel;
Label5: TLabel;
Edit4: TEdit;
CheckBox11: TCheckBox;
Label6: TLabel;
Edit5: TEdit;
CheckBox12: TCheckBox;
Label7: TLabel;
Edit6: TEdit;
CheckBox13: TCheckBox;
Button7: TButton;
CheckBox14: TCheckBox;
CheckBox16: TCheckBox;
Label22: TLabel;
Edit7: TEdit;
CheckBox3: TCheckBox;
CheckBox15: TCheckBox;
CheckBox17: TCheckBox;
CheckBox18: TCheckBox;
CheckBox19: TCheckBox;
CheckBox20: TCheckBox;
Label2: TLabel;
CheckBox7: TCheckBox;
Edit2: TEdit;
CheckBox9: TCheckBox;
CheckBox10: TCheckBox;
CheckBox21: TCheckBox;
Bevel5: TBevel;
Edit21: TEdit;
UpDown3: TUpDown;
UpDown1: TUpDown;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
bRerenderPreviewImages: LongBool;
actKeyFame: Integer;
end;
var
AniProcessForm: TAniProcessForm;
implementation
uses Animation, DivUtils, Mand, LightAdjust, TypeDefinitions,
PostProcessForm, Math, Math3D;
{$R *.dfm}
procedure TAniProcessForm.Button1Click(Sender: TObject);
begin
Visible := False;
end;
procedure TAniProcessForm.Button2Click(Sender: TObject);
var t, i, kf, j, start, stop, bch: Integer;
d: Double;
PH: TPMandHeader10;
begin
t := (Sender as TButton).Tag;
if t in [1..4] then
begin
kf := AnimationForm.CurrentNr - 1;
start := 0;
stop := AnimationForm.HeaderCount - 1;
case t of
2: start := kf;
3: stop := kf;
4: begin
start := kf;
stop := kf;
end;
end;
if CheckBox14.Checked then bch := PostProForm.HSoptions else bch := 0;
for i := start to stop do
begin
j := AnimationForm.KFposLUT[i];
PH := @AnimationForm.KeyFrames[j].HeaderParas;
if CheckBox1.Checked then PH.iOptions := UpDown1.Position shl 6; //Smooth normals
if CheckBox2.Checked then PH.sDEstop := StrToFloatK(Edit25.Text);
if CheckBox3.Checked then PostProForm.PutAmbientParsToHeader(PH); //AO
if CheckBox4.Checked then PH.mZstepDiv := Min(1, Max(0.01, StrToFloatK(Edit7.Text)));
if CheckBox5.Checked then PH.bStepsafterDEStop := UpDown3.Position;
if CheckBox6.Checked then AnimationForm.KeyFrames[j].KFcount := StrToIntTrim(Edit1.Text);
if CheckBox7.Checked then PH.sRaystepLimiter := StrToFloatK(Edit2.Text);
if CheckBox8.Checked then LightAdjustForm.PutLightFInHeader(AnimationForm.KeyFrames[j].HeaderParas);
if CheckBox9.Checked then PostProForm.PutReflectionParsToHeader(PH); //reflections
if CheckBox11.Checked then PH.Iterations := StrToIntTrim(Edit4.Text);
if CheckBox12.Checked then PH.MinimumIterations := StrToIntTrim(Edit5.Text);
if CheckBox13.Checked then AnimationForm.KeyFrames[j].KFcount :=
Round(AnimationForm.KeyFrames[j].KFcount * StrToFloatK(Edit6.Text));
if CheckBox14.Checked then
begin //HS settings
PH.bCalculateHardShadow := bch and $FF;
PH.HSmaxLengthMultiplier := StrToFloatK(PostProForm.Edit5.Text);
PH.bCalc1HSsoft := bch shr 8;
if not StrToFloatKtry(PostProForm.Edit7.Text, d) then d := 1;
PH.MCSoftShadowRadius := SingleToShortFloat(MinMaxCS(0.01, d, 20));
end;
if CheckBox15.Checked then PH.iOptions := (PH.iOptions and $7FFFFFFE) or
(Byte(CheckBox17.Checked) and 1);
if CheckBox16.Checked then PostProForm.PutDOFparsToHeader(PH); //DOF
if CheckBox18.Checked then
begin
PH.byColor2Option := Mand3DForm.RadioGroup1.ItemIndex;
PH.bColorOnIt := StrToIntTry(Mand3DForm.Edit35.Text, -1) + 1;
PH.sColorMul := StrToFloatK(Mand3DForm.Edit2.Text);
if Mand3DForm.ButtonVolLight.Caption = 'Dyn. fog on It.:' then
begin
PH.bVolLightNr := 2 shl 4;
PH.bDFogIt := StrToIntTry(Mand3DForm.Edit16.Text, 0);
end
else PH.bVolLightNr := Min(6, Max(1, StrToIntTry(Mand3DForm.Edit16.Text, 0))) or
((Mand3DForm.UpDown5.Position + 2) shl 4);
end;
if CheckBox19.Checked then
begin
PH.StereoScreenWidth := StrToFloatK(Mand3DForm.Edit15.Text);
PH.StereoScreenDistance := StrToFloatK(Mand3DForm.Edit18.Text);
PH.StereoMinDistance := StrToFloatK(Mand3DForm.Edit13.Text);
end;
if CheckBox20.Checked then //camera
begin
PH.dFOVy := StrToFloatK(Mand3DForm.Edit14.Text);
PH.bPlanarOptic := Mand3DForm.RadioGroup2.ItemIndex;
end;
if CheckBox21.Checked then PH.byCalcNsOnZBufAuto := Byte(CheckBox10.Checked) and 1; //N's on ZBuf
end;
end;
end;
procedure TAniProcessForm.FormShow(Sender: TObject);
begin
Button2.Enabled := AnimationForm.HeaderCount > 0;
Button5.Enabled := Button2.Enabled;
Button3.Enabled := AnimationForm.CurrentNr <= AnimationForm.HeaderCount;
Button4.Enabled := Button3.Enabled;
Button6.Enabled := Button3.Enabled;
end;
procedure TAniProcessForm.Button5Click(Sender: TObject); //Rerender all keyframe images
begin
bRerenderPreviewImages := True;
actKeyFame := 0;
AnimationForm.RenderPrevBMP(AnimationForm.KFposLUT[0]);
Screen.Cursor := crHourGlass;
end;
procedure TAniProcessForm.FormCreate(Sender: TObject);
begin
bRerenderPreviewImages := False;
end;
procedure TAniProcessForm.Button7Click(Sender: TObject); //reverse order
var i, i2, it: Integer;
begin
with AnimationForm do
begin
for i := 0 to (HeaderCount - 1) div 2 do
begin
i2 := HeaderCount - 1 - i;
it := KFposLUT[i];
KFposLUT[i] := KFposLUT[i2];
KFposLUT[i2] := it;
end;
PaintBox1.Invalidate;
end;
end;
end.