-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfrmLODGenForm.pas
152 lines (137 loc) · 3.74 KB
/
frmLODGenForm.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
unit frmLODGenForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, CheckLst, Menus, wbInterface;
type
TfrmLODGen = class(TForm)
clbWorldspace: TCheckListBox;
pnlBottom: TPanel;
btnOk: TButton;
btnCancel: TButton;
pnlBevel: TPanel;
Label1: TLabel;
cbObjectsLOD: TCheckBox;
Label2: TLabel;
cbTreesLOD: TCheckBox;
Label3: TLabel;
Label4: TLabel;
btnSplitTreesLOD: TButton;
PopupMenu1: TPopupMenu;
SelectAll1: TMenuItem;
SelectNone1: TMenuItem;
gbObjectsOptions: TGroupBox;
cbBuildAtlas: TCheckBox;
cbNoTangents: TCheckBox;
cbNoVertexColors: TCheckBox;
cmbAtlasWidth: TComboBox;
cmbAtlasHeight: TComboBox;
Label5: TLabel;
Label6: TLabel;
cmbAtlasTextureSize: TComboBox;
Label7: TLabel;
cmbAtlasTextureUVRange: TComboBox;
Label8: TLabel;
cmbTreesLODBrightness: TComboBox;
Label9: TLabel;
procedure cbObjectsLODClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnSplitTreesLODClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure SelectAll1Click(Sender: TObject);
procedure SelectNone1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
SplitTreesLOD: procedure (const aWorldspace: IwbMainRecord) of object;
end;
var
frmLODGen: TfrmLODGen;
implementation
{$R *.dfm}
procedure TfrmLODGen.btnSplitTreesLODClick(Sender: TObject);
var
i: integer;
begin
if not Assigned(SplitTreesLOD) then
Exit;
for i := 0 to Pred(clbWorldspace.Count) do
if clbWorldspace.Checked[i] then
SplitTreesLOD(IwbMainRecord(Integer(clbWorldspace.Items.Objects[i])));
end;
procedure TfrmLODGen.cbObjectsLODClick(Sender: TObject);
begin
gbObjectsOptions.Enabled := cbObjectsLOD.Checked;
gbObjectsOptions.Visible := cbObjectsLOD.Checked;
if wbGameMode in [gmFO3, gmFNV] then begin
gbObjectsOptions.Enabled := False;
gbObjectsOptions.Visible := False;
end;
cmbTreesLODBrightness.Enabled := cbTreesLOD.Checked;
end;
procedure TfrmLODGen.FormCreate(Sender: TObject);
var
i: integer;
v: double;
begin
i := 1024;
while i <= 8192 do begin
cmbAtlasWidth.Items.Add(IntToStr(i));
cmbAtlasHeight.Items.Add(IntToStr(i));
i := i * 2;
end;
i := 256;
while i <= 1024 do begin
cmbAtlasTextureSize.Items.Add(IntToStr(i));
i := i * 2;
end;
v := 1.0;
while v <= 10.0 do begin
cmbAtlasTextureUVRange.Items.Add(Format('%1.1f', [v]));
v := v + 0.1;
end;
i := -30;
while i <= 30 do begin
cmbTreesLODBrightness.Items.Add(IntToStr(i));
Inc(i);
end;
end;
procedure TfrmLODGen.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_ESCAPE then
ModalResult := mrCancel;
end;
procedure TfrmLODGen.FormShow(Sender: TObject);
begin
cbObjectsLODClick(nil);
end;
procedure TfrmLODGen.SelectAll1Click(Sender: TObject);
var
i: Integer;
begin
clbWorldspace.Items.BeginUpdate;
try
for i := 0 to Pred(clbWorldspace.Items.Count) do
if clbWorldspace.ItemEnabled[i] then
clbWorldspace.Checked[i] := True;
finally
clbWorldspace.Items.EndUpdate;
end;
end;
procedure TfrmLODGen.SelectNone1Click(Sender: TObject);
var
i: Integer;
begin
clbWorldspace.Items.BeginUpdate;
try
for i := 0 to Pred(clbWorldspace.Items.Count) do
if clbWorldspace.ItemEnabled[i] then
clbWorldspace.Checked[i] := False;
finally
clbWorldspace.Items.EndUpdate;
end;
end;
end.