-
Notifications
You must be signed in to change notification settings - Fork 3
/
NGraphicsMaterial.bt
543 lines (523 loc) · 13.3 KB
/
NGraphicsMaterial.bt
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
#ifndef _NGRAPHICSMATERIAL
#define _NGRAPHICSMATERIAL
#include "Common.bt"
// NMaterialInstance::ETrait
enum <uint32> ETrait {
TRAIT_RFBC = 1,
TRAIT_RFBD = 2,
TRAIT_RFDS = 3,
TRAIT_RLTG = 4,
TRAIT_BKLT = 5,
};
ETrait MapTrait(FourCC value) {
switch (value) {
case "RFBC":
return TRAIT_RFBC;
case "RFBD":
return TRAIT_RFBD;
case "RFDS":
return TRAIT_RFDS;
case "RLTG":
return TRAIT_RLTG;
case "BKLT":
return TRAIT_BKLT;
}
}
string ReadTrait(FourCC value) {
ETrait id = MapTrait(value);
return EnumToString(id);
}
enum <uint32> EMaterialDataId {
DATA_ID_DEBUG = 0,
// TXTR data IDs
DATA_ID_CBUF = 1,
DATA_ID_ZBUF = 2, // depth_map
DATA_ID_GBUF = 3,
DATA_ID_GFLG = 4,
DATA_ID_OPCT = 5, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_DIFT = 6,
DATA_ID_ICAN = 7,
DATA_ID_SINC = 8,
DATA_ID_NMAP = 9,
DATA_ID_MNMP = 10,
DATA_ID_REFL = 11,
DATA_ID_REFS = 12,
DATA_ID_REFV = 13,
DATA_ID_SPCT = 14,
DATA_ID_LIBD = 15,
DATA_ID_LIBS = 16,
DATA_ID_FOGR = 17,
DATA_ID_INDI = 18, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_OTMP = 19, // CParticleDescription::GetThresholdTexture
DATA_ID_CGMP = 20, // CParticleDescription::GetColorGradientTexture
DATA_ID_OGMP = 21, // CParticleDescription::GetOpacityGradientTexture
DATA_ID_VAND = 22,
DATA_ID_BLAT = 23,
DATA_ID_BCLR = 24,
DATA_ID_METL = 25,
DATA_ID_TCH0 = 26, // bloom_texture, blur_texture, NMaterialClearRect depth_texture_values
DATA_ID_TCH1 = 27, // bloom_texture2, NMaterialGuiMap color_blind_texture, NMaterialTonemap color_grade_lut
DATA_ID_TCH2 = 28, // NMaterialToneMap color_accessibility_lut
DATA_ID_TCH3 = 29,
DATA_ID_TCH4 = 30,
DATA_ID_TCH5 = 31,
// COLR data IDs
DATA_ID_DIFC = 32,
DATA_ID_SHRC = 33,
DATA_ID_SPCC = 34,
DATA_ID_ICNC = 35,
DATA_ID_ICMC = 36,
DATA_ID_ODAT = 37,
DATA_ID_MDCI = 38,
DATA_ID_MDOI = 39,
DATA_ID_LODC = 40,
DATA_ID_LODP = 41,
DATA_ID_VANP = 42,
DATA_ID_BLAL = 43, // CBasedLightingAtlasMaterialLookupData
DATA_ID_BLCM = 44,
DATA_ID_INDP = 45,
DATA_ID_PVLO = 46, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_PSXT = 47, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_PTAI = 48, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_PCMD = 49, // used in CParticleSceneNode::BuildParticleMaterialInstanceCustom
DATA_ID_BSAO = 50,
// blur_sample_param uses CCH0-6
// NMaterialClearRect clear_color CCH0-1
DATA_ID_CCH0 = 51, // bloom_texture_size_params, NMaterialSimpleColor color_sample, NMaterialDataView_Model color_view, NMaterialReflectionProbe params
DATA_ID_CCH1 = 52, // bloom_bright_pass_params, NMaterialGuiMap color, NMaterialLightShafts color_modulate, NMaterialSimpleTexture color_sample, NRenderThermalVisor::NMaterialThermalBlendPassHot::get_hot_params_data_id
DATA_ID_CCH2 = 53, // bloom_color_mod, NMaterialClearRect clear_bounds
DATA_ID_CCH3 = 54,
DATA_ID_CCH4 = 55, // NMaterialTonemap color_grade_params
DATA_ID_CCH5 = 56, // NMaterialTonemap::get_heatmap_params_data_id0
DATA_ID_CCH6 = 57, // NMaterialTonemap::get_heatmap_params_data_id1
DATA_ID_BKLT = 58,
DATA_ID_BKLB = 59,
DATA_ID_BKLA = 60,
DATA_ID_BKGL = 61,
DATA_ID_DYIN = 62,
DATA_ID_CLP0 = 63,
DATA_ID_HOTP = 64,
// INT1 data IDs
DATA_ID_SHID = 65, // shader ID?
DATA_ID_GBFF = 66,
DATA_ID_PMOD = 67, // particle_orientation
DATA_ID_PFLG = 68, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_BLPI = 69,
DATA_ID_ICH0 = 70, // NMaterialTonemap flags, NMaterialClusteredLightPRePass flags_material
DATA_ID_ICH1 = 71,
DATA_ID_ICH2 = 72,
// INT4 data IDs
DATA_ID_AUVI = 73,
DATA_ID_ECH0 = 74, // NMaterialLumaUpdate params
// SCLR data IDs
DATA_ID_OPCS = 75,
DATA_ID_SPCP = 76,
DATA_ID_INDS = 77,
DATA_ID_BLSM = 78,
DATA_ID_LITS = 79,
DATA_ID_MDOE = 80,
DATA_ID_VANF = 81,
DATA_ID_OTHS = 82, // related to CParticleDescription::GetThresholdTexture
DATA_ID_PZSO = 83, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_RCH0 = 84, // NMaterialClearRect clear_depth, NMaterialSimpleTexture mip_level
DATA_ID_RCH1 = 85,
DATA_ID_RCH2 = 86,
// MAT4 data IDs
DATA_ID_PXFM = 87, // used in CParticleSceneNode::BuildParticleMaterialInstance
DATA_ID_MCH0 = 88, // NMaterialNV12 nv12_color_transform
// CPLX data IDs
DATA_ID_BCRL = 89, // texture_layered
DATA_ID_MTLL = 90, // texture_layered
DATA_ID_NRML = 91, // texture_layered
DATA_ID_SHDD = 92,
DATA_ID_SKIN = 93,
DATA_ID_DIMD = 94,
DATA_ID_LIT = 95, // NMaterialLightPrePass light
DATA_ID_ALLD = 96, // ambient_source
DATA_ID_DLLD = 97,
DATA_ID_CLLD = 98,
DATA_ID_AUXF = 99,
DATA_ID_WIND = 100,
DATA_ID_WATR = 101,
DATA_ID_DFXS = 102,
DATA_ID_DFXN = 103,
DATA_ID_MCDD = 104, // cascaded_depth
DATA_ID_CAUS = 105,
DATA_ID_BLPD = 106,
DATA_ID_BLPT = 107,
DATA_ID_FOGS = 108,
DATA_ID_VOLF = 109,
DATA_ID_VFXB = 110,
DATA_ID_VFXD = 111,
DATA_ID_REFP = 112,
DATA_ID_RAIN = 113,
DATA_ID_XCH0 = 114, // blend_params, NMaterialComputeTest compute_test_input_buffer
DATA_ID_XCH1 = 115, // NMaterialLumaUpdate lightmap_source, NMaterialComputeTest compute_test_output_buffer
DATA_ID_BLND = 116, //Maybe move this idk
};
// NMaterialFeatures::is_debug_material_data_id
byte IsDebugMaterialDataId(EMaterialDataId id) { return id == DATA_ID_DEBUG; }
// NMaterialFeatures::is_texture_material_data_id
byte IsTextureMaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_CBUF && id <= DATA_ID_TCH5;
}
// NMaterialFeatures::is_float4_material_data_id
byte IsFloat4MaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_DIFC && id <= DATA_ID_HOTP;
}
// NMaterialFeatures::is_int_material_data_id
byte IsIntMaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_SHID && id <= DATA_ID_ICH2;
}
// NMaterialFeatures::is_int4_material_data_id
byte IsInt4MaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_AUVI && id <= DATA_ID_ECH0;
}
// NMaterialFeatures::is_float_material_data_id
byte IsFloatMaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_OPCS && id <= DATA_ID_RCH2;
}
// NMaterialFeatures::is_float4x4_material_data_id
byte IsFloat4x4MaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_PXFM && id <= DATA_ID_MCH0;
}
// NMaterialFeatures::is_complex_material_data_id
byte IsComplexMaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_BCRL && id <= DATA_ID_XCH1;
}
// NMaterialFeatures::is_texture_layered_material_data_id
byte IsTextureLayeredMaterialDataId(EMaterialDataId id) {
return id >= DATA_ID_BCRL && id <= DATA_ID_NRML;
}
EMaterialDataId MapMaterialDataId(FourCC value) {
switch (value) {
case "BLND":
return DATA_ID_BLND;
case "CBUF":
return DATA_ID_CBUF;
case "ZBUF":
return DATA_ID_ZBUF;
case "GBUF":
return DATA_ID_GBUF;
case "GFLG":
return DATA_ID_GFLG;
case "OPCT":
return DATA_ID_OPCT;
case "DIFT":
return DATA_ID_DIFT;
case "ICAN":
return DATA_ID_ICAN;
case "SINC":
return DATA_ID_SINC;
case "NMAP":
return DATA_ID_NMAP;
case "MNMP":
return DATA_ID_MNMP;
case "REFL":
return DATA_ID_REFL;
case "REFS":
return DATA_ID_REFS;
case "REFV":
return DATA_ID_REFV;
case "SPCT":
return DATA_ID_SPCT;
case "LIBD":
return DATA_ID_LIBD;
case "LIBS":
return DATA_ID_LIBS;
case "FOGR":
return DATA_ID_FOGR;
case "INDI":
return DATA_ID_INDI;
case "OTMP":
return DATA_ID_OTMP;
case "CGMP":
return DATA_ID_CGMP;
case "OGMP":
return DATA_ID_OGMP;
case "VAND":
return DATA_ID_VAND;
case "BLAT":
return DATA_ID_BLAT;
case "BCLR":
return DATA_ID_BCLR;
case "METL":
return DATA_ID_METL;
case "TCH0":
return DATA_ID_TCH0;
case "TCH1":
return DATA_ID_TCH1;
case "TCH2":
return DATA_ID_TCH2;
case "TCH3":
return DATA_ID_TCH3;
case "TCH4":
return DATA_ID_TCH4;
case "TCH5":
return DATA_ID_TCH5;
case "DIFC":
return DATA_ID_DIFC;
case "SHRC":
return DATA_ID_SHRC;
case "SPCC":
return DATA_ID_SPCC;
case "ICNC":
return DATA_ID_ICNC;
case "ICMC":
return DATA_ID_ICMC;
case "ODAT":
return DATA_ID_ODAT;
case "MDCI":
return DATA_ID_MDCI;
case "MDOI":
return DATA_ID_MDOI;
case "LODC":
return DATA_ID_LODC;
case "LODP":
return DATA_ID_LODP;
case "VANP":
return DATA_ID_VANP;
case "BLAL":
return DATA_ID_BLAL;
case "BLCM":
return DATA_ID_BLCM;
case "INDP":
return DATA_ID_INDP;
case "PVLO":
return DATA_ID_PVLO;
case "PSXT":
return DATA_ID_PSXT;
case "PTAI":
return DATA_ID_PTAI;
case "PCMD":
return DATA_ID_PCMD;
case "BSAO":
return DATA_ID_BSAO;
case "CCH0":
return DATA_ID_CCH0;
case "CCH1":
return DATA_ID_CCH1;
case "CCH2":
return DATA_ID_CCH2;
case "CCH3":
return DATA_ID_CCH3;
case "CCH4":
return DATA_ID_CCH4;
case "CCH5":
return DATA_ID_CCH5;
case "CCH6":
return DATA_ID_CCH6;
case "BKLT":
return DATA_ID_BKLT;
case "BKLB":
return DATA_ID_BKLB;
case "BKLA":
return DATA_ID_BKLA;
case "BKGL":
return DATA_ID_BKGL;
case "DYIN":
return DATA_ID_DYIN;
case "CLP0":
return DATA_ID_CLP0;
case "HOTP":
return DATA_ID_HOTP;
case "SHID":
return DATA_ID_SHID;
case "GBFF":
return DATA_ID_GBFF;
case "PMOD":
return DATA_ID_PMOD;
case "PFLG":
return DATA_ID_PFLG;
case "BLPI":
return DATA_ID_BLPI;
case "ICH0":
return DATA_ID_ICH0;
case "ICH1":
return DATA_ID_ICH1;
case "ICH2":
return DATA_ID_ICH2;
case "AUVI":
return DATA_ID_AUVI;
case "ECH0":
return DATA_ID_ECH0;
case "OPCS":
return DATA_ID_OPCS;
case "SPCP":
return DATA_ID_SPCP;
case "INDS":
return DATA_ID_INDS;
case "BLSM":
return DATA_ID_BLSM;
case "LITS":
return DATA_ID_LITS;
case "MDOE":
return DATA_ID_MDOE;
case "VANF":
return DATA_ID_VANF;
case "OTHS":
return DATA_ID_OTHS;
case "PZSO":
return DATA_ID_PZSO;
case "RCH0":
return DATA_ID_RCH0;
case "RCH1":
return DATA_ID_RCH1;
case "RCH2":
return DATA_ID_RCH2;
case "PXFM":
return DATA_ID_PXFM;
case "MCH0":
return DATA_ID_MCH0;
case "BCRL":
return DATA_ID_BCRL;
case "MTLL":
return DATA_ID_MTLL;
case "NRML":
return DATA_ID_NRML;
case "SHDD":
return DATA_ID_SHDD;
case "SKIN":
return DATA_ID_SKIN;
case "DIMD":
return DATA_ID_DIMD;
case "LIT ":
return DATA_ID_LIT;
case "ALLD":
return DATA_ID_ALLD;
case "DLLD":
return DATA_ID_DLLD;
case "CLLD":
return DATA_ID_CLLD;
case "AUXF":
return DATA_ID_AUXF;
case "WIND":
return DATA_ID_WIND;
case "WATR":
return DATA_ID_WATR;
case "DFXS":
return DATA_ID_DFXS;
case "DFXN":
return DATA_ID_DFXN;
case "MCDD":
return DATA_ID_MCDD;
case "CAUS":
return DATA_ID_CAUS;
case "BLPD":
return DATA_ID_BLPD;
case "BLPT":
return DATA_ID_BLPT;
case "FOGS":
return DATA_ID_FOGS;
case "VOLF":
return DATA_ID_VOLF;
case "VFXB":
return DATA_ID_VFXB;
case "VFXD":
return DATA_ID_VFXD;
case "REFP":
return DATA_ID_REFP;
case "RAIN":
return DATA_ID_RAIN;
case "XCH0":
return DATA_ID_XCH0;
case "XCH1":
return DATA_ID_XCH1;
}
}
string ReadMaterialDataId(FourCC value) {
EMaterialDataId id = MapMaterialDataId(value);
return EnumToString(id);
}
enum<uint32> EMaterialFlag {
DATA_FLAG_MFTR = 0,
DATA_FLAG_MFMT = 1,
DATA_FLAG_MFSR = 2,
DATA_FLAG_MFSK = 3,
DATA_FLAG_MFVC = 4,
DATA_FLAG_MF1B = 5,
DATA_FLAG_MFAV = 6,
DATA_FLAG_MFIN = 7,
DATA_FLAG_MFCA = 8,
DATA_FLAG_MFIM = 9,
DATA_FLAG_MTSM = 10,
DATA_FLAG_MFRL = 11,
DATA_FLAG_MFOE = 12,
DATA_FLAG_MFOT = 13,
DATA_FLAG_MFCI = 14,
DATA_FLAG_MFOI = 15,
DATA_FLAG_MFVA = 16,
DATA_FLAG_MFSU = 17,
DATA_FLAG_MFBP = 18,
DATA_FLAG_MFBL = 19,
DATA_FLAG_MFLB = 20,
DATA_FLAG_MF1E = 21,
DATA_FLAG_MFC0 = 22,
DATA_FLAG_MFC1 = 23,
DATA_FLAG_MFC2 = 24,
DATA_FLAG_MFC3 = 25,
DATA_FLAG_MFC4 = 26,
};
EMaterialFlag MapMaterialFlag(FourCC value) {
switch (value) {
case "MFTR":
return DATA_FLAG_MFTR;
case "MFMT":
return DATA_FLAG_MFMT;
case "MFSR":
return DATA_FLAG_MFSR;
case "MFSK":
return DATA_FLAG_MFSK;
case "MFVC":
return DATA_FLAG_MFVC;
case "MF1B":
return DATA_FLAG_MF1B;
case "MFAV":
return DATA_FLAG_MFAV;
case "MFIN":
return DATA_FLAG_MFIN;
case "MFCA":
return DATA_FLAG_MFCA;
case "MFIM":
return DATA_FLAG_MFIM;
case "MTSM":
return DATA_FLAG_MTSM;
case "MFRL":
return DATA_FLAG_MFRL;
case "MFOE":
return DATA_FLAG_MFOE;
case "MFOT":
return DATA_FLAG_MFOT;
case "MFCI":
return DATA_FLAG_MFCI;
case "MFOI":
return DATA_FLAG_MFOI;
case "MFVA":
return DATA_FLAG_MFVA;
case "MFSU":
return DATA_FLAG_MFSU;
case "MFBP":
return DATA_FLAG_MFBP;
case "MFBL":
return DATA_FLAG_MFBL;
case "MFLB":
return DATA_FLAG_MFLB;
case "MF1E":
return DATA_FLAG_MF1E;
case "MFC0":
return DATA_FLAG_MFC0;
case "MFC1":
return DATA_FLAG_MFC1;
case "MFC2":
return DATA_FLAG_MFC2;
case "MFC3":
return DATA_FLAG_MFC3;
case "MFC4":
return DATA_FLAG_MFC4;
}
}
string ReadMaterialFlag(FourCC value) {
EMaterialFlag flag = MapMaterialFlag(value);
return EnumToString(flag);
}
#endif // _NGRAPHICSMATERIAL