-
-
Notifications
You must be signed in to change notification settings - Fork 469
/
Copy pathxrRender_console.cpp
1183 lines (1027 loc) · 44.1 KB
/
xrRender_console.cpp
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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "stdafx.h"
#pragma hdrstop
#include "xrRender_console.h"
#include "xrCore/xr_token.h"
#include "xrCore/Animation/SkeletonMotions.hpp"
u32 ps_Preset = 2;
u32 ps_ShaderPreset = 0;
u32 ps_ColorGradingPreset = 0;
const xr_token qpreset_token[] =
{
{ "Minimum", 0 },
{ "Low", 1 },
{ "Default", 2 },
{ "High", 3 },
{ "Extreme", 4 },
{ nullptr, 0 }
};
const xr_token qshader_preset_token[] =
{
{ "ui_mm_shader_preset_vanilla", 0 },
{ "ui_mm_shader_preset_enhanced_default", 1 },
{ "ui_mm_shader_preset_enhanced_high", 2 },
{ nullptr, 0 }
};
const xr_token qcolorgrading_preset_token[] =
{
{ "ui_mm_color_grading_default", 0 },
{ "ui_mm_color_grading_cold", 1 },
{ "ui_mm_color_grading_filmic_01", 2 },
{ "ui_mm_color_grading_filmic_02", 3 },
{ "ui_mm_color_grading_filmic_03", 4 },
{ "ui_mm_color_grading_hollywood", 5 },
{ "ui_mm_color_grading_vanilla", 6 },
{ "ui_mm_color_grading_vibrant", 7 },
{ "ui_mm_color_grading_warm", 8 },
{ nullptr, 0 }
};
u32 ps_r2_smapsize = 2048;
const xr_token qsmapsize_token[] =
{
#if !defined(MASTER_GOLD) || RENDER == R_R1
{ "256", 256 }, // Too bad for R2+
{ "512", 512 }, // But works
#endif
{ "1024", 1024 },
{ "1032", 1032 },
{ "1536", 1536 },
{ "2048", 2048 },
{ "2560", 2560 },
{ "3072", 3072 },
{ "3584", 3584 },
{ "4096", 4096 },
#if defined(USE_DX11) || defined(USE_OGL) // XXX: check if values more than 8192 are supported on OpenGL
{ "5120", 5120 },
{ "6144", 6144 },
{ "7168", 7168 },
{ "8192", 8192 },
{ "9216", 9216 },
{ "10240", 10240 },
{ "11264", 11264 },
{ "12288", 12288 },
{ "13312", 13312 },
{ "14336", 14336 },
{ "15360", 15360 },
{ "16384", 16384 },
#endif // !USE_DX9
{ nullptr, 0 }
};
u32 ps_r_ssao_mode = 2;
const xr_token qssao_mode_token[] = {{"disabled", 0}, {"default", 1}, {"hdao", 2}, {"hbao", 3}, {nullptr, 0}};
u32 ps_r_sun_shafts = 2;
const xr_token qsun_shafts_token[] = {{"st_opt_off", 0}, {"st_opt_low", 1}, {"st_opt_medium", 2}, {"st_opt_high", 3}, {nullptr, 0}};
u32 ps_r_ssao = 3;
const xr_token qssao_token[] = {{"st_opt_off", 0}, {"st_opt_low", 1}, {"st_opt_medium", 2}, {"st_opt_high", 3},
#if defined(USE_DX11) || defined(USE_OGL)
{"st_opt_ultra", 4},
#endif
{nullptr, 0}};
u32 ps_r_sun_quality = 1; // = 0;
const xr_token qsun_quality_token[] = {{"st_opt_low", 0}, {"st_opt_medium", 1}, {"st_opt_high", 2},
#if defined(USE_DX11) // TODO: OGL: fix ultra and extreme settings
{"st_opt_ultra", 3}, {"st_opt_extreme", 4},
#endif // !USE_DX9
{nullptr, 0}};
u32 ps_r_water_reflection = 3;
const xr_token qwater_reflection_quality_token[] =
{
{ "st_opt_off", 0 },
{ "st_opt_low", 1 },
{ "st_opt_medium", 2 },
{ "st_opt_high", 3 },
{ "st_opt_ultra", 4 },
{ nullptr, -1 }
};
u32 ps_r3_msaa = 0; // = 0;
const xr_token qmsaa_token[] = {{"st_opt_off", 0}, {"2x", 1}, {"4x", 2}, {"8x", 3},
{nullptr, 0}};
u32 ps_r3_msaa_atest = 0; // = 0;
const xr_token qmsaa__atest_token[] = {
{"st_opt_off", 0}, {"st_opt_atest_msaa_dx10_0", 1}, {"st_opt_atest_msaa_dx10_1", 2}, {nullptr, 0}};
u32 ps_r3_minmax_sm = 3; // = 0;
const xr_token qminmax_sm_token[] = {{"off", 0}, {"on", 1}, {"auto", 2}, {"autodetect", 3}, {nullptr, 0}};
u32 ps_r3_rendering_space = 0; // = 0;
const xr_token rendering__space_token[] = {
{"gamma", 0}, {"linear", 1}, {nullptr, 0}};
// “Off”
// “DX10.0 style [Standard]”
// “DX10.1 style [Higher quality]”
// Common
extern int psSkeletonUpdate;
extern float r__dtex_range;
Flags32 ps_r__common_flags = { RFLAG_ACTOR_SHADOW }; // All renders
//int ps_r__Supersample = 1;
int ps_r__LightSleepFrames = 10;
float ps_r__Detail_l_ambient = 0.9f;
float ps_r__Detail_l_aniso = 0.25f;
float ps_r__Detail_density = 0.3f;
float ps_r__Detail_height = 1.f;
float ps_r__Detail_rainbow_hemi = 0.75f;
float ps_r__Tree_w_rot = 10.0f;
float ps_r__Tree_w_speed = 1.00f;
float ps_r__Tree_w_amp = 0.005f;
Fvector ps_r__Tree_Wave = {.1f, .01f, .11f};
float ps_r__Tree_SBC = 1.5f; // scale bias correct
float ps_r__WallmarkTTL = 50.f;
float ps_r__WallmarkSHIFT = 0.0001f;
float ps_r__WallmarkSHIFT_V = 0.0001f;
float ps_r__GLOD_ssa_start = 256.f;
float ps_r__GLOD_ssa_end = 64.f;
float ps_r__LOD = 0.75f;
//float ps_r__LOD_Power = 1.5f;
float ps_r__ssaDISCARD = 3.5f; // RO
float ps_r__ssaDONTSORT = 32.f; // RO
float ps_r__ssaHZBvsTEX = 96.f; // RO
int ps_r__tf_Anisotropic = 8;
float ps_r__tf_Mipbias = 0.0f;
// R1
float ps_r1_ssaLOD_A = 64.f;
float ps_r1_ssaLOD_B = 48.f;
Flags32 ps_r1_flags = {R1FLAG_DLIGHTS}; // r1-only
float ps_r1_lmodel_lerp = 0.1f;
float ps_r1_dlights_clip = 40.f;
float ps_r1_pps_u = 0.f;
float ps_r1_pps_v = 0.f;
int ps_r1_force_geomx = 0;
// R1-specific
int ps_r1_GlowsPerFrame = 16; // r1-only
float ps_r1_fog_luminance = 1.1f; // r1-only
int ps_r1_SoftwareSkinning = 0; // r1-only
// R2
bool ps_r2_sun_static = false;
bool ps_r2_advanced_pp = true; // advanced post process and effects
float ps_r2_ssaLOD_A = 64.f;
float ps_r2_ssaLOD_B = 48.f;
// R2-specific
Flags32 ps_r2_ls_flags = {R2FLAG_SUN
//| R2FLAG_SUN_IGNORE_PORTALS
| R2FLAG_EXP_DONT_TEST_UNSHADOWED | R2FLAG_USE_NVSTENCIL | R2FLAG_EXP_SPLIT_SCENE | R2FLAG_EXP_MT_CALC |
R3FLAG_DYN_WET_SURF | R3FLAG_VOLUMETRIC_SMOKE
//| R3FLAG_MSAA
//| R3FLAG_MSAA_OPT
| R3FLAG_GBUFFER_OPT | R2FLAG_DETAIL_BUMP | R2FLAG_DOF | R2FLAG_SOFT_PARTICLES | R2FLAG_SOFT_WATER |
R2FLAG_STEEP_PARALLAX | R2FLAG_SUN_FOCUS | R2FLAG_SUN_TSM | R2FLAG_TONEMAP | R2FLAG_VOLUMETRIC_LIGHTS}; // r2-only
Flags32 ps_r2_ls_flags_ext = {
/*R2FLAGEXT_SSAO_OPT_DATA |*/ R2FLAGEXT_SSAO_HALF_DATA | R2FLAGEXT_ENABLE_TESSELLATION | R3FLAGEXT_SSR_HALF_DEPTH |
R3FLAGEXT_SSR_JITTER};
float ps_r2_df_parallax_h = 0.02f;
float ps_r2_df_parallax_range = 75.f;
float ps_r2_tonemap_middlegray = 1.f; // r2-only
float ps_r2_tonemap_adaptation = 1.f; // r2-only
float ps_r2_tonemap_low_lum = 0.0001f; // r2-only
float ps_r2_tonemap_amount = 0.7f; // r2-only
float ps_r2_ls_bloom_kernel_g = 3.f; // r2-only
float ps_r2_ls_bloom_kernel_b = .7f; // r2-only
float ps_r2_ls_bloom_speed = 100.f; // r2-only
float ps_r2_ls_bloom_kernel_scale = .7f; // r2-only // gauss
float ps_r2_ls_dsm_kernel = .7f; // r2-only
float ps_r2_ls_psm_kernel = .7f; // r2-only
float ps_r2_ls_ssm_kernel = .7f; // r2-only
float ps_r2_ls_bloom_threshold = .00001f; // r2-only
Fvector ps_r2_aa_barier = {.8f, .1f, 0}; // r2-only
Fvector ps_r2_aa_weight = {.25f, .25f, 0}; // r2-only
float ps_r2_aa_kernel = .5f; // r2-only
float ps_r2_mblur = .0f; // .5f
int ps_r2_GI_depth = 1; // 1..5
int ps_r2_GI_photons = 16; // 8..64
float ps_r2_GI_clip = EPS_L; // EPS
float ps_r2_GI_refl = .9f; // .9f
float ps_r2_ls_depth_scale = 1.00001f; // 1.00001f
float ps_r2_ls_depth_bias = -0.0003f; // -0.0001f
float ps_r2_ls_squality = 1.0f; // 1.00f
float ps_r2_sun_tsm_projection = 0.3f; // 0.18f
float ps_r2_sun_tsm_bias = -0.01f; //
float ps_r2_sun_near = 20.f; // 12.0f
extern float OLES_SUN_LIMIT_27_01_07; // actually sun_far
float ps_r2_sun_near_border = 0.75f; // 1.0f
float ps_r2_sun_depth_far_scale = 1.00000f; // 1.00001f
float ps_r2_sun_depth_far_bias = -0.00002f; // -0.0000f
float ps_r2_sun_depth_near_scale = 1.0000f; // 1.00001f
float ps_r2_sun_depth_near_bias = 0.00001f; // -0.00005f
float ps_r2_sun_lumscale = 1.0f; // 1.0f
float ps_r2_sun_lumscale_hemi = 1.0f; // 1.0f
float ps_r2_sun_lumscale_amb = 1.0f;
float ps_r2_gmaterial = 2.2f; //
float ps_r2_zfill = 0.25f; // .1f
float ps_r2_dhemi_sky_scale = 0.08f; // 1.5f
float ps_r2_dhemi_light_scale = 0.2f;
float ps_r2_dhemi_light_flow = 0.1f;
int ps_r2_dhemi_count = 5; // 5
int ps_r2_wait_sleep = 0;
int ps_r2_wait_timeout = 500;
float ps_r2_lt_smooth = 1.f; // 1.f
float ps_r2_slight_fade = 0.5f; // 1.f
// Anomaly
extern ENGINE_API float ps_r2_img_exposure; // r2-only
extern ENGINE_API float ps_r2_img_gamma; // r2-only
extern ENGINE_API float ps_r2_img_saturation; // r2-only
extern ENGINE_API Fvector ps_r2_img_cg; // r2-only
extern ENGINE_API Fvector4 ps_r2_mask_control; // r2-only
extern ENGINE_API Fvector ps_r2_drops_control; // r2-only
extern ENGINE_API int ps_r2_nightvision;
//debug
extern ENGINE_API Fvector4 ps_dev_param_1;
extern ENGINE_API Fvector4 ps_dev_param_2;
extern ENGINE_API Fvector4 ps_dev_param_3;
extern ENGINE_API Fvector4 ps_dev_param_4;
extern ENGINE_API Fvector4 ps_dev_param_5;
extern ENGINE_API Fvector4 ps_dev_param_6;
extern ENGINE_API Fvector4 ps_dev_param_7;
extern ENGINE_API Fvector4 ps_dev_param_8;
// Ascii1457's Screen Space Shaders
extern ENGINE_API Fvector4 ps_ssfx_hud_drops_1;
extern ENGINE_API Fvector4 ps_ssfx_hud_drops_2;
extern ENGINE_API Fvector4 ps_ssfx_hud_drops_1_cfg;
extern ENGINE_API Fvector4 ps_ssfx_hud_drops_2_cfg;
extern ENGINE_API Fvector4 ps_ssfx_blood_decals;
extern ENGINE_API Fvector4 ps_ssfx_rain_1;
extern ENGINE_API Fvector4 ps_ssfx_rain_2;
extern ENGINE_API Fvector4 ps_ssfx_rain_3;
extern ENGINE_API Fvector3 ps_ssfx_shadow_cascades;
extern ENGINE_API Fvector4 ps_ssfx_grass_shadows;
extern ENGINE_API Fvector4 ps_ssfx_grass_interactive;
extern ENGINE_API Fvector4 ps_ssfx_int_grass_params_1;
extern ENGINE_API Fvector4 ps_ssfx_int_grass_params_2;
extern ENGINE_API Fvector4 ps_ssfx_wpn_dof_1;
extern ENGINE_API Fvector4 ps_ssfx_wpn_dof_2;
extern ENGINE_API Fvector4 ps_ssfx_florafixes_1;
extern ENGINE_API Fvector4 ps_ssfx_florafixes_2;
extern ENGINE_API Fvector4 ps_ssfx_wetsurfaces_1;
extern ENGINE_API Fvector4 ps_ssfx_wetsurfaces_2;
extern ENGINE_API int ps_ssfx_is_underground;
extern ENGINE_API int ps_ssfx_gloss_method;
extern ENGINE_API float ps_ssfx_gloss_factor;
extern ENGINE_API Fvector3 ps_ssfx_gloss_minmax;
extern ENGINE_API Fvector4 ps_ssfx_lightsetup_1;
// x - min (0), y - focus (1.4), z - max (100)
Fvector3 ps_r2_dof = Fvector3().set(-1.25f, 1.4f, 600.f);
float ps_r2_dof_sky = 30; // distance to sky
float ps_r2_dof_kernel_size = 5.0f; // 7.0f
extern ENGINE_API float ps_r3_dyn_wet_surf_near;
extern ENGINE_API float ps_r3_dyn_wet_surf_far;
extern ENGINE_API int ps_r3_dyn_wet_surf_sm_res;
u32 ps_steep_parallax = 0;
int ps_r__detail_radius = 49;
u32 dm_size = 24;
u32 dm_cache1_line = 12; //dm_size*2/dm_cache1_count
u32 dm_cache_line = 49; //dm_size+1+dm_size
u32 dm_cache_size = 2401; //dm_cache_line*dm_cache_line
float dm_fade = 47.5; //float(2*dm_size)-.5f;
u32 dm_current_size = 24;
u32 dm_current_cache1_line = 12; //dm_current_size*2/dm_cache1_count
u32 dm_current_cache_line = 49; //dm_current_size+1+dm_current_size
u32 dm_current_cache_size = 2401; //dm_current_cache_line*dm_current_cache_line
float dm_current_fade = 47.5; //float(2*dm_current_size)-.5f;
float ps_current_detail_density = 0.6f;
float ps_current_detail_height = 1.f;
int ps_r2_mt_calculate = 0;
int ps_r2_mt_render = 0;
xr_token ext_quality_token[] = {{"qt_off", 0}, {"qt_low", 1}, {"qt_medium", 2},
{"qt_high", 3}, {"qt_extreme", 4}, {nullptr, 0}};
//-AVO
//- Mad Max
float ps_r2_gloss_factor = 4.0f;
float ps_r2_gloss_min = 0.0f;
//- Mad Max
#ifndef _EDITOR
#include "xrEngine/XR_IOConsole.h"
#include "xrEngine/xr_ioc_cmd.h"
#if defined(USE_DX11)
#include "Layers/xrRenderDX11/StateManager/dx11SamplerStateCache.h"
#endif
//-----------------------------------------------------------------------
//AVO: detail draw radius
class CCC_detail_radius : public CCC_Integer
{
public:
void apply()
{
dm_current_size = iFloor((float)ps_r__detail_radius / 4) * 2;
dm_current_cache1_line = dm_current_size * 2 / 4; // assuming cache1_count = 4
dm_current_cache_line = dm_current_size + 1 + dm_current_size;
dm_current_cache_size = dm_current_cache_line * dm_current_cache_line;
dm_current_fade = float(2 * dm_current_size) - .5f;
}
CCC_detail_radius(LPCSTR N, int* V, int _min = 0, int _max = 999) : CCC_Integer(N, V, _min, _max) {};
void Execute(LPCSTR args) override
{
CCC_Integer::Execute(args);
apply();
}
void GetStatus(TStatus& S) override
{
CCC_Integer::GetStatus(S);
}
};
//-AVO
class CCC_tf_Aniso : public CCC_Integer
{
public:
void apply()
{
#if defined(USE_DX9) || defined(USE_DX11)
if (nullptr == HW.pDevice)
return;
#endif
int val = *value;
clamp(val, 1, 16);
#if defined(USE_DX9)
for (u32 i = 0; i < HW.Caps.raster.dwStages; i++)
CHK_DX(HW.pDevice->SetSamplerState(i, D3DSAMP_MAXANISOTROPY, val));
#elif defined(USE_DX11)
SSManager.SetMaxAnisotropy(val);
#elif defined(USE_OGL)
// OGL: don't set aniso here because it will be updated after vid restart
#else
# error No graphics API selected or enabled!
#endif
}
CCC_tf_Aniso(LPCSTR N, int* v) : CCC_Integer(N, v, 1, 16){};
virtual void Execute(LPCSTR args)
{
CCC_Integer::Execute(args);
apply();
}
virtual void GetStatus(TStatus& S)
{
CCC_Integer::GetStatus(S);
apply();
}
};
class CCC_tf_MipBias : public CCC_Float
{
public:
void apply()
{
#if defined(USE_DX9) || defined(USE_DX11)
if (nullptr == HW.pDevice)
return;
#endif
#if defined(USE_DX9)
for (u32 i = 0; i < HW.Caps.raster.dwStages; i++)
CHK_DX(HW.pDevice->SetSamplerState(i, D3DSAMP_MIPMAPLODBIAS, *((u32*)value)));
#elif defined(USE_DX11)
SSManager.SetMipLODBias(*value);
#endif
}
CCC_tf_MipBias(LPCSTR N, float* v) : CCC_Float(N, v, -3.f, +3.f) {}
virtual void Execute(LPCSTR args)
{
CCC_Float::Execute(args);
apply();
}
virtual void GetStatus(TStatus& S)
{
CCC_Float::GetStatus(S);
apply();
}
};
class CCC_R2GM : public CCC_Float
{
public:
CCC_R2GM(LPCSTR N, float* v) : CCC_Float(N, v, 0.f, 4.f) { *v = 0; };
virtual void Execute(LPCSTR args)
{
if (0 == xr_strcmp(args, "on"))
{
ps_r2_ls_flags.set(R2FLAG_GLOBALMATERIAL, TRUE);
}
else if (0 == xr_strcmp(args, "off"))
{
ps_r2_ls_flags.set(R2FLAG_GLOBALMATERIAL, FALSE);
}
else
{
CCC_Float::Execute(args);
if (ps_r2_ls_flags.test(R2FLAG_GLOBALMATERIAL))
{
static LPCSTR name[4] = {"oren", "blin", "phong", "metal"};
float mid = *value;
int m0 = iFloor(mid) % 4;
int m1 = (m0 + 1) % 4;
float frc = mid - float(iFloor(mid));
Msg("* material set to [%s]-[%s], with lerp of [%f]", name[m0], name[m1], frc);
}
}
}
};
class CCC_Screenshot : public IConsole_Command
{
public:
CCC_Screenshot(LPCSTR N) : IConsole_Command(N){};
virtual void Execute(LPCSTR args)
{
if (GEnv.isDedicatedServer)
return;
string_path name;
name[0] = 0;
sscanf(args, "%s", name);
LPCSTR image = xr_strlen(name) ? name : 0;
RImplementation.Screenshot(IRender::SM_NORMAL, image);
}
};
class CCC_ModelPoolStat : public IConsole_Command
{
public:
CCC_ModelPoolStat(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = TRUE; };
virtual void Execute(LPCSTR /*args*/) { RImplementation.Models->dump(); }
};
class CCC_SSAO_Mode : public CCC_Token
{
public:
CCC_SSAO_Mode(LPCSTR N, u32* V, const xr_token* T) : CCC_Token(N, V, T){};
virtual void Execute(LPCSTR args)
{
CCC_Token::Execute(args);
switch (*value)
{
case 0:
{
ps_r_ssao = 0;
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HBAO, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HDAO, 0);
break;
}
case 1:
{
if (ps_r_ssao == 0)
{
ps_r_ssao = 1;
}
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HBAO, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HDAO, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HALF_DATA, 0);
break;
}
case 2:
{
if (ps_r_ssao == 0)
{
ps_r_ssao = 1;
}
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HBAO, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HDAO, 1);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_OPT_DATA, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HALF_DATA, 0);
break;
}
case 3:
{
if (ps_r_ssao == 0)
{
ps_r_ssao = 1;
}
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HBAO, 1);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_HDAO, 0);
ps_r2_ls_flags_ext.set(R2FLAGEXT_SSAO_OPT_DATA, 1);
break;
}
}
}
};
//-----------------------------------------------------------------------
class CCC_Preset : public CCC_Token
{
public:
CCC_Preset(LPCSTR N, u32* V, const xr_token* T) : CCC_Token(N, V, T){};
virtual void Execute(LPCSTR args)
{
CCC_Token::Execute(args);
string_path _cfg;
string_path cmd;
switch (*value)
{
case 0: xr_strcpy(_cfg, "rspec_minimum.ltx"); break;
case 1: xr_strcpy(_cfg, "rspec_low.ltx"); break;
case 2: xr_strcpy(_cfg, "rspec_default.ltx"); break;
case 3: xr_strcpy(_cfg, "rspec_high.ltx"); break;
case 4: xr_strcpy(_cfg, "rspec_extreme.ltx"); break;
}
FS.update_path(_cfg, "$game_config$", _cfg);
strconcat(sizeof(cmd), cmd, "cfg_load", " ", _cfg);
Console->Execute(cmd);
}
};
class CCC_Shader_Preset : public CCC_Token
{
public:
CCC_Shader_Preset(LPCSTR N, u32* V, const xr_token* T) : CCC_Token(N, V, T) {};
virtual void Execute(LPCSTR args)
{
CCC_Token::Execute(args);
string_path _cfg;
string_path cmd;
switch (*value)
{
case 0: xr_strcpy(_cfg, "shaders_vanilla.ltx"); break;
case 1: xr_strcpy(_cfg, "shaders_new_default.ltx"); break;
case 2: xr_strcpy(_cfg, "shaders_new_high.ltx"); break;
}
FS.update_path(_cfg, "$game_config$", _cfg);
strconcat(sizeof(cmd), cmd, "cfg_load", " ", _cfg);
Console->Execute(cmd);
}
};
class CCC_ColorGrading_Preset : public CCC_Token
{
public:
CCC_ColorGrading_Preset(LPCSTR N, u32* V, const xr_token* T) : CCC_Token(N, V, T) {};
virtual void Execute(LPCSTR args)
{
CCC_Token::Execute(args);
string_path _cfg;
string_path cmd;
switch (*value)
{
case 0: xr_strcpy(_cfg, "grading_default.ltx"); break;
case 1: xr_strcpy(_cfg, "grading_cold.ltx"); break;
case 2: xr_strcpy(_cfg, "grading_filmic01.ltx"); break;
case 3: xr_strcpy(_cfg, "grading_filmic02.ltx"); break;
case 4: xr_strcpy(_cfg, "grading_filmic03.ltx"); break;
case 5: xr_strcpy(_cfg, "grading_hollywood.ltx"); break;
case 6: xr_strcpy(_cfg, "grading_vanilla.ltx"); break;
case 7: xr_strcpy(_cfg, "grading_vibrant.ltx"); break;
case 8: xr_strcpy(_cfg, "grading_warm.ltx"); break;
}
FS.update_path(_cfg, "$game_config$", _cfg);
strconcat(sizeof(cmd), cmd, "cfg_load", " ", _cfg);
Console->Execute(cmd);
}
};
class CCC_memory_stats : public IConsole_Command
{
public:
CCC_memory_stats(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = true; };
virtual void Execute(LPCSTR /*args*/)
{
// TODO: OGL: Implement memory usage statistics.
#if defined(USE_DX9) || defined(USE_DX11)
u32 m_base = 0;
u32 c_base = 0;
u32 m_lmaps = 0;
u32 c_lmaps = 0;
RImplementation.ResourcesGetMemoryUsage(m_base, c_base, m_lmaps, c_lmaps);
Msg("memory usage mb \t \t video \t managed \t system \n");
const float MiB = 1024*1024; // XXX: use it as common enum value (like in X-Ray 2.0)
const u32* mem_usage = HW.stats_manager.memory_usage_summary[enum_stats_buffer_type_vertex];
float vb_video = mem_usage[D3DPOOL_DEFAULT] / MiB;
float vb_managed = mem_usage[D3DPOOL_MANAGED] / MiB;
float vb_system = mem_usage[D3DPOOL_SYSTEMMEM] / MiB;
Msg("vertex buffer \t \t %f \t %f \t %f ", vb_video, vb_managed, vb_system);
float ib_video = mem_usage[D3DPOOL_DEFAULT] / MiB;
float ib_managed = mem_usage[D3DPOOL_MANAGED] / MiB;
float ib_system = mem_usage[D3DPOOL_SYSTEMMEM] / MiB;
Msg("index buffer \t \t %f \t %f \t %f ", ib_video, ib_managed, ib_system);
float textures_video = (m_base+m_lmaps)/MiB;
Msg("textures \t \t %f \t %f \t %f ", textures_video, 0.f, 0.f);
mem_usage = HW.stats_manager.memory_usage_summary[enum_stats_buffer_type_rtarget];
float rt_video = mem_usage[D3DPOOL_DEFAULT] / MiB;
float rt_managed = mem_usage[D3DPOOL_MANAGED] / MiB;
float rt_system = mem_usage[D3DPOOL_SYSTEMMEM] / MiB;
Msg("R-Targets \t \t %f \t %f \t %f ", rt_video, rt_managed, rt_system);
Msg("\nTotal \t \t %f \t %f \t %f ", vb_video + ib_video + textures_video + rt_video,
vb_managed + ib_managed + rt_managed, vb_system + ib_system + rt_system);
#endif // !USE_OGL
}
};
class CCC_DumpResources final : public IConsole_Command
{
public:
CCC_DumpResources(pcstr name) : IConsole_Command(name) { bEmptyArgsHandled = true; }
void Execute(pcstr /*args*/) override
{
RImplementation.Models->dump();
RImplementation.Resources->Dump(false);
}
};
class CCC_MotionsStat final : public IConsole_Command
{
public:
CCC_MotionsStat(pcstr name) : IConsole_Command(name) { bEmptyArgsHandled = true; }
void Execute(pcstr /*args*/) override
{
g_pMotionsContainer->dump();
}
};
class CCC_TexturesStat final : public IConsole_Command
{
public:
CCC_TexturesStat(pcstr name) : IConsole_Command(name) { bEmptyArgsHandled = true; }
void Execute(pcstr /*args*/) override
{
RImplementation.Resources->_DumpMemoryUsage();
}
};
#if RENDER != R_R1
#include "r__pixel_calculator.h"
class CCC_BuildSSA : public IConsole_Command
{
public:
CCC_BuildSSA(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = TRUE; };
virtual void Execute(LPCSTR /*args*/)
{
r_pixel_calculator c;
c.run();
}
};
#endif
class CCC_DofFar : public CCC_Float
{
public:
CCC_DofFar(LPCSTR N, float* V, float _min = 0.0f, float _max = 10000.0f) : CCC_Float(N, V, _min, _max) {}
virtual void Execute(LPCSTR args)
{
float v = float(atof(args));
if (v < ps_r2_dof.y + 0.1f)
{
char pBuf[256];
_snprintf(pBuf, sizeof(pBuf) / sizeof(pBuf[0]), "float value greater or equal to r2_dof_focus+0.1");
Msg("~ Invalid syntax in call to '%s'", cName);
Msg("~ Valid arguments: %s", pBuf);
Console->Execute("r2_dof_focus");
}
else
{
CCC_Float::Execute(args);
if (g_pGamePersistent)
g_pGamePersistent->SetBaseDof(ps_r2_dof);
}
}
// CCC_Dof should save all data as well as load from config
virtual void Save(IWriter* /*F*/) { ; }
};
class CCC_DofNear : public CCC_Float
{
public:
CCC_DofNear(LPCSTR N, float* V, float _min = 0.0f, float _max = 10000.0f) : CCC_Float(N, V, _min, _max) {}
virtual void Execute(LPCSTR args)
{
float v = float(atof(args));
if (v > ps_r2_dof.y - 0.1f)
{
char pBuf[256];
_snprintf(pBuf, sizeof(pBuf) / sizeof(pBuf[0]), "float value less or equal to r2_dof_focus-0.1");
Msg("~ Invalid syntax in call to '%s'", cName);
Msg("~ Valid arguments: %s", pBuf);
Console->Execute("r2_dof_focus");
}
else
{
CCC_Float::Execute(args);
if (g_pGamePersistent)
g_pGamePersistent->SetBaseDof(ps_r2_dof);
}
}
// CCC_Dof should save all data as well as load from config
virtual void Save(IWriter* /*F*/) { ; }
};
class CCC_DofFocus : public CCC_Float
{
public:
CCC_DofFocus(LPCSTR N, float* V, float _min = 0.0f, float _max = 10000.0f) : CCC_Float(N, V, _min, _max) {}
virtual void Execute(LPCSTR args)
{
float v = float(atof(args));
if (v > ps_r2_dof.z - 0.1f)
{
char pBuf[256];
_snprintf(pBuf, sizeof(pBuf) / sizeof(pBuf[0]), "float value less or equal to r2_dof_far-0.1");
Msg("~ Invalid syntax in call to '%s'", cName);
Msg("~ Valid arguments: %s", pBuf);
Console->Execute("r2_dof_far");
}
else if (v < ps_r2_dof.x + 0.1f)
{
char pBuf[256];
_snprintf(pBuf, sizeof(pBuf) / sizeof(pBuf[0]), "float value greater or equal to r2_dof_far-0.1");
Msg("~ Invalid syntax in call to '%s'", cName);
Msg("~ Valid arguments: %s", pBuf);
Console->Execute("r2_dof_near");
}
else
{
CCC_Float::Execute(args);
if (g_pGamePersistent)
g_pGamePersistent->SetBaseDof(ps_r2_dof);
}
}
// CCC_Dof should save all data as well as load from config
virtual void Save(IWriter* /*F*/) { ; }
};
class CCC_Dof : public CCC_Vector3
{
public:
CCC_Dof(LPCSTR N, Fvector* V, const Fvector _min, const Fvector _max) : CCC_Vector3(N, V, _min, _max) { ; }
virtual void Execute(LPCSTR args)
{
Fvector v;
if (3 != sscanf(args, "%f,%f,%f", &v.x, &v.y, &v.z))
InvalidSyntax();
else if ((v.x > v.y - 0.1f) || (v.z < v.y + 0.1f))
{
InvalidSyntax();
Msg("x <= y - 0.1");
Msg("y <= z - 0.1");
}
else
{
CCC_Vector3::Execute(args);
if (g_pGamePersistent)
g_pGamePersistent->SetBaseDof(ps_r2_dof);
}
}
virtual void GetStatus(TStatus& S) { xr_sprintf(S, "%f,%f,%f", value->x, value->y, value->z); }
virtual void Info(TInfo& I)
{
xr_sprintf(I, "vector3 in range [%f,%f,%f]-[%f,%f,%f]", min.x, min.y, min.z, max.x, max.y, max.z);
}
};
#ifdef DEBUG
class CCC_SunshaftsIntensity : public CCC_Float
{
public:
CCC_SunshaftsIntensity(LPCSTR N, float* V, float _min, float _max) : CCC_Float(N, V, _min, _max) {}
virtual void Save(IWriter*) { ; }
};
#endif
// Allow real-time fog config reload
#if (RENDER == R_R3) || (RENDER == R_R4)
# ifndef MASTER_GOLD
# include "Layers/xrRenderDX11/3DFluid/dx113DFluidManager.h"
class CCC_Fog_Reload : public IConsole_Command
{
public:
CCC_Fog_Reload(LPCSTR N) : IConsole_Command(N) { bEmptyArgsHandled = TRUE; };
virtual void Execute(LPCSTR /*args*/) { FluidManager.UpdateProfiles(); }
};
# endif // MASTER_GOLD
#endif // (RENDER == R_R3) || (RENDER == R_R4)
//-----------------------------------------------------------------------
void xrRender_initconsole()
{
CMD3(CCC_Preset, "_preset", &ps_Preset, qpreset_token);
CMD3(CCC_Shader_Preset, "_shader_preset", &ps_ShaderPreset, qshader_preset_token);
CMD3(CCC_ColorGrading_Preset, "_colorgrading_preset", &ps_ColorGradingPreset, qcolorgrading_preset_token);
CMD4(CCC_Integer, "rs_skeleton_update", &psSkeletonUpdate, 2, 128);
#ifndef MASTER_GOLD
CMD1(CCC_DumpResources, "dump_resources");
CMD1(CCC_MotionsStat, "stat_motions");
CMD1(CCC_TexturesStat, "stat_textures");
#endif
CMD4(CCC_Float, "r__dtex_range", &r__dtex_range, 5, 175);
// Common
CMD1(CCC_Screenshot, "screenshot");
#ifdef DEBUG
#if RENDER != R_R1
CMD1(CCC_BuildSSA, "build_ssa");
#endif
CMD4(CCC_Integer, "r__lsleep_frames", &ps_r__LightSleepFrames, 4, 30);
CMD4(CCC_Float, "r__ssa_glod_start", &ps_r__GLOD_ssa_start, 128, 512);
CMD4(CCC_Float, "r__ssa_glod_end", &ps_r__GLOD_ssa_end, 16, 96);
CMD4(CCC_Float, "r__wallmark_shift_pp", &ps_r__WallmarkSHIFT, 0.0f, 1.f);
CMD4(CCC_Float, "r__wallmark_shift_v", &ps_r__WallmarkSHIFT_V, 0.0f, 1.f);
CMD1(CCC_ModelPoolStat, "stat_models");
#endif // DEBUG
CMD4(CCC_Float, "r__wallmark_ttl", &ps_r__WallmarkTTL, 1.0f, 10.f * 60.f);
CMD4(CCC_Integer, "r__supersample", &ps_r__Supersample, 1, 8);
// Anomaly
CMD4(CCC_Float, "r__exposure", &ps_r2_img_exposure, 0.5f, 4.0f);
CMD4(CCC_Float, "r__gamma", &ps_r2_img_gamma, 0.5f, 2.2f);
CMD4(CCC_Float, "r__saturation", &ps_r2_img_saturation, 0.0f, 2.0f);
Fvector tw_min, tw_max;
CMD4(CCC_Float, "r__geometry_lod", &ps_r__LOD, 0.1f, 2.f);
//CMD4(CCC_Float, "r__geometry_lod_pow", &ps_r__LOD_Power, 0, 2);
CMD4(CCC_Float, "r__detail_density", &ps_current_detail_density/*&ps_r__Detail_density*/, 0.1f, 0.99f);
CMD4(CCC_detail_radius, "r__detail_radius", &ps_r__detail_radius, 49, 300);
CMD4(CCC_Float, "r__detail_height", &ps_r__Detail_height, 1, 2);
#ifdef DEBUG
CMD4(CCC_Float, "r__detail_l_ambient", &ps_r__Detail_l_ambient, .5f, .95f);
CMD4(CCC_Float, "r__detail_l_aniso", &ps_r__Detail_l_aniso, .1f, .5f);
CMD4(CCC_Float, "r__d_tree_w_amp", &ps_r__Tree_w_amp, .001f, 1.f);
CMD4(CCC_Float, "r__d_tree_w_rot", &ps_r__Tree_w_rot, .01f, 100.f);
CMD4(CCC_Float, "r__d_tree_w_speed", &ps_r__Tree_w_speed, 1.0f, 10.f);
tw_min.set(EPS, EPS, EPS);
tw_max.set(2, 2, 2);
CMD4(CCC_Vector3, "r__d_tree_wave", &ps_r__Tree_Wave, tw_min, tw_max);
#endif // DEBUG
CMD3(CCC_Mask, "r__actor_shadow", &ps_r__common_flags, RFLAG_ACTOR_SHADOW);
CMD2(CCC_tf_Aniso, "r__tf_aniso", &ps_r__tf_Anisotropic); // {1..16}
CMD2(CCC_tf_MipBias, "r1_tf_mipbias", &ps_r__tf_Mipbias); // {-3 +3}
CMD2(CCC_tf_MipBias, "r2_tf_mipbias", &ps_r__tf_Mipbias); // {-3 +3}
// R1
CMD4(CCC_Float, "r1_ssa_lod_a", &ps_r1_ssaLOD_A, 16, 96);
CMD4(CCC_Float, "r1_ssa_lod_b", &ps_r1_ssaLOD_B, 16, 64);
CMD4(CCC_Float, "r1_lmodel_lerp", &ps_r1_lmodel_lerp, 0, 0.333f);
CMD3(CCC_Mask, "r1_dlights", &ps_r1_flags, R1FLAG_DLIGHTS);
CMD4(CCC_Float, "r1_dlights_clip", &ps_r1_dlights_clip, 10.f, 150.f);
CMD4(CCC_Float, "r1_pps_u", &ps_r1_pps_u, -1.f, +1.f);
CMD4(CCC_Float, "r1_pps_v", &ps_r1_pps_v, -1.f, +1.f);
CMD4(CCC_Integer, "r1_force_geomx", &ps_r1_force_geomx, 0, 1);
// R1-specific
CMD4(CCC_Integer, "r1_glows_per_frame", &ps_r1_GlowsPerFrame, 2, 32);
CMD3(CCC_Mask, "r1_detail_textures", &ps_r2_ls_flags, R1FLAG_DETAIL_TEXTURES);
CMD4(CCC_Float, "r1_fog_luminance", &ps_r1_fog_luminance, 0.2f, 5.f);
// Software Skinning
// 0 - disabled (renderer can override)
// 1 - enabled
// 2 - forced hardware skinning (renderer can not override)
CMD4(CCC_Integer, "r1_software_skinning", &ps_r1_SoftwareSkinning, 0, 2);
CMD3(CCC_Mask, "r1_ffp", &ps_r1_flags, R1FLAG_FFP);
CMD3(CCC_Mask, "r1_ffp_lightmaps", &ps_r1_flags, R1FLAG_FFP_LIGHTMAPS);
// R2
CMD4(CCC_Float, "r2_ssa_lod_a", &ps_r2_ssaLOD_A, 16, 96);
CMD4(CCC_Float, "r2_ssa_lod_b", &ps_r2_ssaLOD_B, 32, 64);
// R2-specific
CMD2(CCC_R2GM, "r2em", &ps_r2_gmaterial);
CMD3(CCC_Mask, "r2_tonemap", &ps_r2_ls_flags, R2FLAG_TONEMAP);
CMD4(CCC_Float, "r2_tonemap_middlegray", &ps_r2_tonemap_middlegray, 0.0f, 2.0f);
CMD4(CCC_Float, "r2_tonemap_adaptation", &ps_r2_tonemap_adaptation, 0.01f, 10.0f);
CMD4(CCC_Float, "r2_tonemap_lowlum", &ps_r2_tonemap_low_lum, 0.0001f, 1.0f);
CMD4(CCC_Float, "r2_tonemap_amount", &ps_r2_tonemap_amount, 0.0000f, 1.0f);
CMD4(CCC_Float, "r2_ls_bloom_kernel_scale", &ps_r2_ls_bloom_kernel_scale, 0.5f, 2.f);
CMD4(CCC_Float, "r2_ls_bloom_kernel_g", &ps_r2_ls_bloom_kernel_g, 1.f, 7.f);
CMD4(CCC_Float, "r2_ls_bloom_kernel_b", &ps_r2_ls_bloom_kernel_b, 0.01f, 1.f);
CMD4(CCC_Float, "r2_ls_bloom_threshold", &ps_r2_ls_bloom_threshold, 0.f, 1.f);
CMD4(CCC_Float, "r2_ls_bloom_speed", &ps_r2_ls_bloom_speed, 0.f, 100.f);
CMD3(CCC_Mask, "r2_ls_bloom_fast", &ps_r2_ls_flags, R2FLAG_FASTBLOOM);
CMD4(CCC_Float, "r2_ls_dsm_kernel", &ps_r2_ls_dsm_kernel, .1f, 3.f);
CMD4(CCC_Float, "r2_ls_psm_kernel", &ps_r2_ls_psm_kernel, .1f, 3.f);
CMD4(CCC_Float, "r2_ls_ssm_kernel", &ps_r2_ls_ssm_kernel, .1f, 3.f);
CMD4(CCC_Float, "r2_ls_squality", &ps_r2_ls_squality, .5f, 1.f);
CMD3(CCC_Mask, "r2_zfill", &ps_r2_ls_flags, R2FLAG_ZFILL);
CMD4(CCC_Float, "r2_zfill_depth", &ps_r2_zfill, .001f, .5f);
CMD3(CCC_Mask, "r2_allow_r1_lights", &ps_r2_ls_flags, R2FLAG_R1LIGHTS);
//- Mad Max
CMD4(CCC_Float, "r2_gloss_factor", &ps_r2_gloss_factor, .0f, 10.f);
CMD4(CCC_Float, "r2_gloss_min", &ps_r2_gloss_min, .0f, 1.f);
//- Mad Max
#ifdef DEBUG
CMD3(CCC_Mask, "r2_use_nvdbt", &ps_r2_ls_flags, R2FLAG_USE_NVDBT);
CMD3(CCC_Mask, "r2_mt", &ps_r2_ls_flags, R2FLAG_EXP_MT_CALC);
#endif // DEBUG
CMD3(CCC_Mask, "r2_sun", &ps_r2_ls_flags, R2FLAG_SUN);
CMD3(CCC_Mask, "r2_sun_details", &ps_r2_ls_flags, R2FLAG_SUN_DETAILS);
CMD3(CCC_Mask, "r2_sun_focus", &ps_r2_ls_flags, R2FLAG_SUN_FOCUS);
//CMD3(CCC_Mask, "r2_sun_static", &ps_r2_ls_flags, R2FLAG_SUN_STATIC);
//CMD3(CCC_Mask, "r2_exp_splitscene", &ps_r2_ls_flags, R2FLAG_EXP_SPLIT_SCENE);
//CMD3(CCC_Mask, "r2_exp_donttest_uns", &ps_r2_ls_flags, R2FLAG_EXP_DONT_TEST_UNSHADOWED);
CMD3(CCC_Mask, "r2_exp_donttest_shad", &ps_r2_ls_flags, R2FLAG_EXP_DONT_TEST_SHADOWED);
CMD3(CCC_Mask, "r2_sun_tsm", &ps_r2_ls_flags, R2FLAG_SUN_TSM);
CMD4(CCC_Float, "r2_sun_tsm_proj", &ps_r2_sun_tsm_projection, .001f, 0.8f);
CMD4(CCC_Float, "r2_sun_tsm_bias", &ps_r2_sun_tsm_bias, -0.5, +0.5);
CMD4(CCC_Float, "r2_sun_near", &ps_r2_sun_near, 1.f, 150.f); //AVO: extended from 50.f to 150.f
#if RENDER != R_R1
CMD4(CCC_Float, "r2_sun_far", &OLES_SUN_LIMIT_27_01_07, 51.f, 180.f);