forked from Source-SDK-Resources/source-sdk-vs2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmp.diff
1583 lines (1414 loc) · 51.2 KB
/
mp.diff
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
--- mp/src/game/client/c_baseanimating.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/c_baseanimating.cpp Thu Jul 11 05:13:52 2024
@@ -60,6 +60,8 @@
#include "c_baseobject.h"
#endif
+#include "deferred/deferred_shared_common.h"
+
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -3385,12 +3387,15 @@
//FIXME: We should really use a named attachment for this
if ( m_Attachments.Count() > 0 )
{
- Vector vAttachment;
- QAngle dummyAngles;
- GetAttachment( 1, vAttachment, dummyAngles );
+ Vector vAttachment, vAng;
+ QAngle angles;
+ GetAttachment( 1, vAttachment, angles );
+
+ AngleVectors(angles, &vAng);
+ vAttachment += vAng * 2;
// Make an elight
- dlight_t *el = effects->CL_AllocElight( LIGHT_INDEX_MUZZLEFLASH + m_index );
+ /*dlight_t *el = effects->CL_AllocElight( LIGHT_INDEX_MUZZLEFLASH + m_index );
el->origin = vAttachment;
el->radius = random->RandomInt( 32, 64 );
el->decay = el->radius / 0.05f;
@@ -3398,7 +3403,30 @@
el->color.r = 255;
el->color.g = 192;
el->color.b = 64;
- el->color.exponent = 5;
+ el->color.exponent = 5;*/
+ //el->decay = 512.0f;
+
+ def_light_temp_t *l = new def_light_temp_t( 0.05f );
+
+ l->ang = vec3_angle;
+ l->pos = vAttachment;
+
+ l->col_diffuse = Vector( 0.964705882f, 0.82745098f, 0.403921569f );
+ //l->col_ambient = Vector(20, 20, 20); //GetColor_Ambient();
+
+ l->flRadius = random->RandomFloat( 64, 128 );
+ l->flFalloffPower = 1.0f;
+
+ l->iVisible_Dist = l->flRadius * 2;
+ l->iVisible_Range = l->flRadius * 2;
+ l->iShadow_Dist = l->flRadius;
+ l->iShadow_Range = l->flRadius;
+
+ l->iFlags >>= DEFLIGHTGLOBAL_FLAGS_MAX_SHARED_BITS;
+ l->iFlags <<= DEFLIGHTGLOBAL_FLAGS_MAX_SHARED_BITS;
+ l->iFlags |= DEFLIGHT_SHADOW_ENABLED;
+
+ GetLightingManager()->AddTempLight( l );
}
}
}
--- mp/src/game/client/c_baseentity.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/c_baseentity.cpp Sun Jul 21 17:01:21 2024
@@ -41,6 +41,8 @@
#include "inetchannelinfo.h"
#include "proto_version.h"
+#include "deferred/deferred_shared_common.h"
+
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -1925,6 +1927,61 @@
return NULL;
}
+void C_BaseEntity::InstallBrushSurfaceRenderer( IBrushRenderer* renderer )
+{
+ m_bHasSpecialRenderer = renderer != NULL;
+ render->InstallBrushSurfaceRenderer( renderer );
+}
+
+static class CDefaultBrushRenderer : public IBrushRenderer
+{
+public:
+ bool RenderBrushModelSurface( IClientEntity* pBaseEntity, IBrushSurface* pBrushSurface ) OVERRIDE
+ {
+ const uint32 numVertices = pBrushSurface->GetVertexCount();
+ if ( vertexBufferSize < numVertices )
+ {
+ MEM_ALLOC_CREDIT_CLASS();
+ if ( vertices )
+ MemAlloc_FreeAligned( vertices );
+ vertexBufferSize = numVertices;
+ vertices = static_cast<BrushVertex_t*>( MemAlloc_AllocAligned( numVertices * sizeof( BrushVertex_t ), sizeof( BrushVertex_t ) ) );
+ }
+ pBrushSurface->GetVertexData( vertices );
+ CMatRenderContextPtr pRenderContext( materials );
+ CMeshBuilder builder;
+ builder.Begin( pRenderContext->GetDynamicMesh( true, 0, 0, pBrushSurface->GetMaterial() ), MATERIAL_POLYGON, numVertices );
+ for ( uint32 i = 0; i < numVertices; ++i )
+ {
+ BrushVertex_t& vertex = vertices[i];
+ builder.Position3fv( vertex.m_Pos.Base() );
+ builder.Normal3fv( vertex.m_Normal.Base() );
+ if ( vertex.m_TangentS.IsValid() )
+ builder.TangentS3fv( vertex.m_TangentS.Base() );
+ if ( vertex.m_TangentT.IsValid() )
+ builder.TangentT3fv( vertex.m_TangentT.Base() );
+ builder.TexCoord2fv( 0, vertex.m_TexCoord.Base() );
+ builder.TexCoord2fv( 1, vertex.m_LightmapCoord.Base() );
+ builder.AdvanceVertex();
+ }
+
+ builder.End( false, true );
+
+ return true;
+ }
+
+ CDefaultBrushRenderer() : vertices( NULL ), vertexBufferSize( 0 ) {}
+
+ ~CDefaultBrushRenderer()
+ {
+ if ( vertices )
+ MemAlloc_FreeAligned( vertices );
+ }
+
+private:
+ BrushVertex_t* vertices;
+ uint32 vertexBufferSize;
+} defaultRenderer;
//-----------------------------------------------------------------------------
// Purpose:
@@ -1945,6 +2002,9 @@
DepthMode = DEPTH_MODE_SHADOW;
}
+ if ( !m_bHasSpecialRenderer )
+ render->InstallBrushSurfaceRenderer( &defaultRenderer );
+
if ( DepthMode != DEPTH_MODE_NORMAL )
{
render->DrawBrushModelShadowDepth( this, const_cast<model_t*>(m_model), GetAbsOrigin(), GetAbsAngles(), DepthMode );
@@ -1959,6 +2019,9 @@
render->DrawBrushModelEx( this, const_cast<model_t*>(m_model), GetAbsOrigin(), GetAbsAngles(), mode );
}
+ if ( !m_bHasSpecialRenderer )
+ render->InstallBrushSurfaceRenderer( NULL );
+
return 1;
}
@@ -3524,7 +3587,8 @@
//-----------------------------------------------------------------------------
int C_BaseEntity::GetFxBlend( void )
{
- Assert( m_nFXComputeFrame == gpGlobals->framecount );
+ // spam
+ // Assert( m_nFXComputeFrame == gpGlobals->framecount );
return m_nRenderFXBlend;
}
@@ -4827,25 +4891,46 @@
CON_COMMAND_F( dlight_debug, "Creates a dlight in front of the player", FCVAR_CHEAT )
{
- dlight_t *el = effects->CL_AllocDlight( 1 );
+ //dlight_t *el = effects->CL_AllocDlight( 1 );
C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
if ( !player )
return;
Vector start = player->EyePosition();
Vector forward;
player->EyeVectors( &forward );
- Vector end = start + forward * MAX_TRACE_LENGTH;
+ const Vector& end = start + forward * MAX_TRACE_LENGTH;
trace_t tr;
UTIL_TraceLine( start, end, MASK_SHOT_HULL & (~CONTENTS_GRATE), player, COLLISION_GROUP_NONE, &tr );
- el->origin = tr.endpos - forward * 12.0f;
+ /*el->origin = tr.endpos - forward * 12.0f;
el->radius = 200;
el->decay = el->radius / 5.0f;
el->die = gpGlobals->curtime + 5.0f;
el->color.r = 255;
el->color.g = 192;
el->color.b = 64;
- el->color.exponent = 5;
+ el->color.exponent = 5;*/
+
+ def_light_temp_t *l = new def_light_temp_t( 0.1f );
+
+ l->ang = vec3_angle;
+ l->pos = tr.endpos - forward * 12.0f;
+
+ l->col_diffuse = Vector( 0.964705882f, 0.82745098f, 0.403921569f );
+ //l->col_ambient = Vector(20, 20, 20); //GetColor_Ambient();
+
+ l->flRadius = 256.f;
+ l->flFalloffPower = 3.0f;
+
+ l->iVisible_Dist = l->flRadius * 2;
+ l->iVisible_Range = l->flRadius * 2;
+ l->iShadow_Dist = l->flRadius;
+ l->iShadow_Range = l->flRadius;
+
+ l->iFlags >>= DEFLIGHTGLOBAL_FLAGS_MAX_SHARED_BITS;
+ l->iFlags <<= DEFLIGHTGLOBAL_FLAGS_MAX_SHARED_BITS;
+ l->iFlags |= DEFLIGHT_SHADOW_ENABLED;
+ GetLightingManager()->AddTempLight( l );
}
//-----------------------------------------------------------------------------
// Purpose:
--- mp/src/game/client/c_baseentity.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/c_baseentity.h Sun Jul 7 19:39:45 2024
@@ -59,6 +59,7 @@
class ConVar;
class CDmgAccumulator;
class IHasAttributes;
+class IBrushRenderer;
struct CSoundParameters;
@@ -1690,6 +1691,10 @@
CThreadFastMutex m_CalcAbsolutePositionMutex;
CThreadFastMutex m_CalcAbsoluteVelocityMutex;
+
+ void InstallBrushSurfaceRenderer( IBrushRenderer* );
+private:
+ bool m_bHasSpecialRenderer;
#ifdef TF_CLIENT_DLL
// TF prevents drawing of any entity attached to players that aren't items in the inventory of the player.
--- mp/src/game/client/c_baseplayer.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/c_baseplayer.cpp Sun Jul 21 16:59:39 2024
@@ -54,6 +54,8 @@
#include "econ_wearable.h"
#endif
+#include "deferred/flashlighteffect_deferred.h"
+
// NVNT haptics system interface
#include "haptics/ihaptics.h"
@@ -1227,7 +1229,8 @@
if (!m_pFlashlight)
{
// Turned on the headlight; create it.
- m_pFlashlight = new CFlashlightEffect(m_index);
+ // m_pFlashlight = new CFlashlightEffect(m_index);
+ m_pFlashlight = new CFlashlightEffectDeferred(m_index);
if (!m_pFlashlight)
return;
@@ -1258,11 +1261,11 @@
UpdateFlashlight();
// Check for muzzle flash and apply to view model
- C_BaseAnimating *ve = this;
+ /*C_BaseAnimating *ve = this;
if ( GetObserverMode() == OBS_MODE_IN_EYE )
{
ve = dynamic_cast< C_BaseAnimating* >( GetObserverTarget() );
- }
+ }*/
}
--- mp/src/game/client/c_baseplayer.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/c_baseplayer.h Sun Jul 7 19:40:40 2024
@@ -37,6 +37,7 @@
class C_FuncLadder;
class CFlashlightEffect;
class C_EconWearable;
+class CViewSetup;
extern int g_nKillCamMode;
extern int g_nKillCamTarget1;
--- mp/src/game/client/c_func_breakablesurf.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/c_func_breakablesurf.cpp Wed Jul 10 17:28:42 2024
@@ -516,13 +516,13 @@
// If I'm not broken draw normally
if (m_bIsBroken)
- render->InstallBrushSurfaceRenderer( this );
+ InstallBrushSurfaceRenderer( this );
// If it's broken, always draw it translucent
BaseClass::DrawModel( m_bIsBroken ? flags | STUDIO_TRANSPARENCY : flags );
// Remove our nonstandard brush surface renderer...
- render->InstallBrushSurfaceRenderer( 0 );
+ InstallBrushSurfaceRenderer( NULL );
return 0;
}
--- mp/src/game/client/cdll_client_int.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/cdll_client_int.cpp Sun Jul 21 17:04:14 2024
@@ -170,6 +170,8 @@
#include "sixense/in_sixense.h"
#endif
+#include "deferred/deferred_shared_common.h"
+
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -639,7 +641,7 @@
virtual void View_Render( vrect_t *rect );
- virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw );
+ virtual void RenderView( const CViewSetupEngine &view, int nClearFlags, int whatToDraw );
virtual void View_Fade( ScreenFade_t *pSF );
virtual void SetCrosshairAngle( const QAngle& angle );
@@ -693,7 +695,7 @@
virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded/*=false*/, bool bWriteVTF/*=false*/ );
// Gets the location of the player viewpoint
- virtual bool GetPlayerView( CViewSetup &playerView );
+ virtual bool GetPlayerView( CViewSetupEngine &playerView );
// Matchmaking
virtual void SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties );
@@ -1506,7 +1508,7 @@
//-----------------------------------------------------------------------------
// Gets the location of the player viewpoint
//-----------------------------------------------------------------------------
-bool CHLClient::GetPlayerView( CViewSetup &playerView )
+bool CHLClient::GetPlayerView( CViewSetupEngine &playerView )
{
playerView = *g_pView->GetPlayerViewSetup();
return true;
@@ -1664,6 +1666,8 @@
g_pStringTableClientSideChoreoScenes = NULL;
g_pStringTableServerMapCycle = NULL;
+ g_pStringTable_LightCookies = NULL;
+
#ifdef TF_CLIENT_DLL
g_pStringTableServerPopFiles = NULL;
g_pStringTableServerMapCycleMvM = NULL;
@@ -1894,6 +1898,12 @@
{
g_pStringTableServerMapCycle = networkstringtable->FindTable( tableName );
}
+ else if ( !Q_strcasecmp( tableName, COOKIE_STRINGTBL_NAME ) )
+ {
+ g_pStringTable_LightCookies = networkstringtable->FindTable( tableName );
+
+ g_pStringTable_LightCookies->SetStringChangedCallback( NULL, OnCookieTableChanged );
+ }
#ifdef TF_CLIENT_DLL
else if ( !Q_strcasecmp( tableName, "ServerPopFiles" ) )
{
@@ -2488,9 +2498,10 @@
}
// See RenderViewInfo_t
-void CHLClient::RenderView( const CViewSetup &setup, int nClearFlags, int whatToDraw )
+void CHLClient::RenderView( const CViewSetupEngine &engineSetup, int nClearFlags, int whatToDraw )
{
VPROF("RenderView");
+ CViewSetup setup( engineSetup );
g_pView->RenderView( setup, nClearFlags, whatToDraw );
}
--- mp/src/game/client/flashlighteffect.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/flashlighteffect.cpp Sat Jul 20 17:43:49 2024
@@ -15,6 +15,8 @@
#include "tier1/KeyValues.h"
#include "toolframework_client.h"
+#include "deferred/cdeferred_manager_client.h"
+
#ifdef HL2_CLIENT_DLL
#include "c_basehlplayer.h"
#endif // HL2_CLIENT_DLL
@@ -337,6 +339,11 @@
state.m_flShadowSlopeScaleDepthBias = mat_slopescaledepthbias_shadowmap.GetFloat();
state.m_flShadowDepthBias = mat_depthbias_shadowmap.GetFloat();
+ //UpdateLightProjection(state);
+
+if (GetDeferredManager()->IsDeferredRenderingEnabled()) {
+ UpdateLightProjection( state );
+} else {
if( m_FlashlightHandle == CLIENTSHADOW_INVALID_HANDLE )
{
m_FlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state );
@@ -353,6 +360,7 @@
// Kill the old flashlight method if we have one.
LightOffOld();
+}
#ifndef NO_TOOLFRAMEWORK
if ( clienttools->IsInRecordingMode() )
@@ -425,14 +435,17 @@
{
return;
}
- if( r_newflashlight.GetBool() )
- {
+
UpdateLightNew( vecPos, vecDir, vecRight, vecUp );
- }
- else
- {
- UpdateLightOld( vecPos, vecDir, nDistance );
- }
+
+ // if( r_newflashlight.GetBool())
+ // {
+ // UpdateLightNew( vecPos, vecDir, vecRight, vecUp );
+ // }
+ // else
+ // {
+ // UpdateLightOld( vecPos, vecDir, nDistance );
+ // }
}
@@ -462,6 +475,24 @@
}
}
+void CFlashlightEffect::UpdateLightProjection( FlashlightState_t& state )
+{
+ if( m_FlashlightHandle == CLIENTSHADOW_INVALID_HANDLE )
+ {
+ m_FlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state );
+ }
+ else
+ {
+ if( !r_flashlightlockposition.GetBool() )
+ {
+ g_pClientShadowMgr->UpdateFlashlightState( m_FlashlightHandle, state );
+ }
+ }
+
+ g_pClientShadowMgr->UpdateProjectedTexture( m_FlashlightHandle, true );
+}
+
+
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@@ -526,6 +558,11 @@
state.m_pSpotlightTexture = m_FlashlightTexture;
state.m_nSpotlightTextureFrame = 0;
+// UpdateLightProjection( state );
+
+ if (GetDeferredManager()->IsDeferredRenderingEnabled()) {
+ UpdateLightProjection( state );
+ } else {
if( GetFlashlightHandle() == CLIENTSHADOW_INVALID_HANDLE )
{
SetFlashlightHandle( g_pClientShadowMgr->CreateFlashlight( state ) );
@@ -536,5 +573,6 @@
}
g_pClientShadowMgr->UpdateProjectedTexture( GetFlashlightHandle(), true );
+ }
}
--- mp/src/game/client/flashlighteffect.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/flashlighteffect.h Fri Jul 12 20:26:35 2024
@@ -10,7 +10,7 @@
#pragma once
#endif
-struct dlight_t;
+//struct dlight_t;
class CFlashlightEffect
@@ -30,7 +30,9 @@
protected:
- void LightOff();
+ virtual void UpdateLightProjection( FlashlightState_t &state );
+
+ virtual void LightOff();
void LightOffOld();
void LightOffNew();
@@ -49,7 +51,10 @@
CTextureReference m_FlashlightTexture;
};
-class CHeadlightEffect : public CFlashlightEffect
+#include "deferred/flashlighteffect_deferred.h"
+
+//class CHeadlightEffect : public CFlashlightEffect
+class CHeadlightEffect : public CFlashlightEffectDeferred
{
public:
--- mp/src/game/client/fx_explosion.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/fx_explosion.cpp Tue Jul 9 22:58:27 2024
@@ -19,6 +19,8 @@
#include "fx_line.h"
#include "fx_water.h"
+#include "deferred/deferred_shared_common.h"
+
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -172,6 +174,7 @@
{
m_vecOrigin = position;
m_fFlags = flags;
+ m_flScale = scale;
//Find the force of the explosion
GetForceDirection( m_vecOrigin, force, &m_vecDirection, &m_flForce );
@@ -190,7 +193,7 @@
}
CreateDebris();
- //FIXME: CreateDynamicLight();
+ CreateDynamicLight();
CreateMisc();
}
@@ -697,7 +700,7 @@
//-----------------------------------------------------------------------------
void C_BaseExplosionEffect::CreateDynamicLight( void )
{
- if ( m_fFlags & TE_EXPLFLAG_NODLIGHTS )
+ /*if ( m_fFlags & TE_EXPLFLAG_NODLIGHTS )
return;
dlight_t *dl = effects->CL_AllocDlight( 0 );
@@ -709,7 +712,31 @@
dl->color.r = 255;
dl->color.g = 220;
dl->color.b = 128;
- dl->die = gpGlobals->curtime + 0.1f;
+ dl->die = gpGlobals->curtime + 0.1f;*/
+
+ def_light_temp_t *l = new def_light_temp_t( 0.1f );
+
+ l->ang = vec3_angle;
+ l->pos = m_vecOrigin;
+ l->pos.z += 64.0f;
+
+ l->col_diffuse.Init( 0.964705882f, 0.82745098f, 0.403921569f );
+
+ l->flRadius = m_flScale * 512.f;
+ l->flFalloffPower = 1.0f;
+
+ l->iVisible_Dist = 1024.0f;
+ l->iVisible_Range = 1024.0f;
+ l->iShadow_Dist = 512.0f;
+ l->iShadow_Range = 512.0f;
+
+ l->iFlags >>= DEFLIGHTGLOBAL_FLAGS_MAX_SHARED_BITS;
+ l->iFlags <<= DEFLIGHTGLOBAL_FLAGS_MAX_SHARED_BITS;
+ l->iFlags |= DEFLIGHT_SHADOW_ENABLED;
+
+ DevMsg(1, "Temp deferred light for explosion at: %f %f %f\n", l->pos.x, l->pos.y, l->pos.z );
+
+ GetLightingManager()->AddTempLight( l );
}
//-----------------------------------------------------------------------------
--- mp/src/game/client/fx_explosion.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/fx_explosion.h Sun Jul 7 19:55:42 2024
@@ -53,6 +53,7 @@
Vector m_vecOrigin;
Vector m_vecDirection;
float m_flForce;
+ float m_flScale;
int m_fFlags;
PMaterialHandle m_Material_Smoke;
--- mp/src/game/client/iclientshadowmgr.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/iclientshadowmgr.h Sun Jul 7 19:55:57 2024
@@ -23,6 +23,7 @@
// Forward decls
//-----------------------------------------------------------------------------
struct FlashlightState_t;
+class CViewSetup;
//-----------------------------------------------------------------------------
--- mp/src/game/client/particlemgr.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/particlemgr.h Sun Jul 7 19:56:09 2024
@@ -146,6 +146,7 @@
class CParticleMgr;
class CNewParticleEffect;
class CParticleCollection;
+class CViewSetup;
#define INVALID_MATERIAL_HANDLE NULL
--- mp/src/game/client/viewrender.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/viewrender.cpp Sun Jul 21 17:37:28 2024
@@ -89,7 +89,7 @@
//-----------------------------------------------------------------------------
-static ConVar r_visocclusion( "r_visocclusion", "0", FCVAR_CHEAT );
+ConVar r_visocclusion( "r_visocclusion", "0", FCVAR_CHEAT );
extern ConVar r_flashlightdepthtexture;
extern ConVar vcollide_wireframe;
extern ConVar mat_motion_blur_enabled;
@@ -108,15 +108,15 @@
// Matches the version in the engine
static ConVar r_drawopaqueworld( "r_drawopaqueworld", "1", FCVAR_CHEAT );
static ConVar r_drawtranslucentworld( "r_drawtranslucentworld", "1", FCVAR_CHEAT );
-static ConVar r_3dsky( "r_3dsky","1", 0, "Enable the rendering of 3d sky boxes" );
-static ConVar r_skybox( "r_skybox","1", FCVAR_CHEAT, "Enable the rendering of sky boxes" );
+ConVar r_3dsky( "r_3dsky","1", 0, "Enable the rendering of 3d sky boxes" );
+ConVar r_skybox( "r_skybox","1", FCVAR_CHEAT, "Enable the rendering of sky boxes" );
#ifdef TF_CLIENT_DLL
ConVar r_drawviewmodel( "r_drawviewmodel","1", FCVAR_ARCHIVE );
#else
ConVar r_drawviewmodel( "r_drawviewmodel","1", FCVAR_CHEAT );
#endif
static ConVar r_drawtranslucentrenderables( "r_drawtranslucentrenderables", "1", FCVAR_CHEAT );
-static ConVar r_drawopaquerenderables( "r_drawopaquerenderables", "1", FCVAR_CHEAT );
+ConVar r_drawopaquerenderables( "r_drawopaquerenderables", "1", FCVAR_CHEAT );
static ConVar r_threaded_renderables( "r_threaded_renderables", "0" );
// FIXME: This is not static because we needed to turn it off for TF2 playtests
@@ -137,7 +137,7 @@
static ConVar fog_endskybox( "fog_endskybox", "-1", FCVAR_CHEAT );
static ConVar fog_maxdensityskybox( "fog_maxdensityskybox", "-1", FCVAR_CHEAT );
static ConVar fog_colorskybox( "fog_colorskybox", "-1 -1 -1", FCVAR_CHEAT );
-static ConVar fog_enableskybox( "fog_enableskybox", "1", FCVAR_CHEAT );
+ConVar fog_enableskybox( "fog_enableskybox", "1", FCVAR_CHEAT );
static ConVar fog_maxdensity( "fog_maxdensity", "-1", FCVAR_CHEAT );
@@ -151,9 +151,9 @@
static ConVar r_waterforcereflectentities( "r_waterforcereflectentities", "0" );
static ConVar r_WaterDrawRefraction( "r_WaterDrawRefraction", "1", 0, "Enable water refraction" );
static ConVar r_WaterDrawReflection( "r_WaterDrawReflection", "1", 0, "Enable water reflection" );
-static ConVar r_ForceWaterLeaf( "r_ForceWaterLeaf", "1", 0, "Enable for optimization to water - considers view in leaf under water for purposes of culling" );
+ConVar r_ForceWaterLeaf( "r_ForceWaterLeaf", "1", 0, "Enable for optimization to water - considers view in leaf under water for purposes of culling" );
static ConVar mat_drawwater( "mat_drawwater", "1", FCVAR_CHEAT );
-static ConVar mat_clipz( "mat_clipz", "1" );
+ConVar mat_clipz( "mat_clipz", "1" );
//-----------------------------------------------------------------------------
@@ -162,7 +162,7 @@
static ConVar r_screenfademinsize( "r_screenfademinsize", "0" );
static ConVar r_screenfademaxsize( "r_screenfademaxsize", "0" );
static ConVar cl_drawmonitors( "cl_drawmonitors", "1" );
-static ConVar r_eyewaterepsilon( "r_eyewaterepsilon", "10.0f", FCVAR_CHEAT );
+ConVar r_eyewaterepsilon( "r_eyewaterepsilon", "10.0f", FCVAR_CHEAT );
#ifdef TF_CLIENT_DLL
static ConVar pyro_dof( "pyro_dof", "1", FCVAR_ARCHIVE );
@@ -182,7 +182,7 @@
bool s_bCanAccessCurrentView = false;
IntroData_t *g_pIntroData = NULL;
static bool g_bRenderingView = false; // For debugging...
-static int g_CurrentViewID = VIEW_NONE;
+int g_CurrentViewID = VIEW_NONE;
bool g_bRenderingScreenshot = false;
@@ -221,8 +221,7 @@
}
}
-
-
+/*
//-----------------------------------------------------------------------------
// Describes a pruned set of leaves to be rendered this view. Reference counted
// because potentially shared by a number of views
@@ -250,7 +249,7 @@
bool m_bPooledAlloc;
static CObjectPool<ClientWorldListInfo_t> gm_Pool;
};
-
+*/
//-----------------------------------------------------------------------------
//
@@ -367,6 +366,11 @@
CWorldListCache g_WorldListCache;
+void FlushWorldLists()
+{
+ g_WorldListCache.Flush();
+}
+
//-----------------------------------------------------------------------------
// Standard 3d skybox view
//-----------------------------------------------------------------------------
@@ -747,7 +751,7 @@
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
-static void SetClearColorToFogColor()
+void SetClearColorToFogColor()
{
unsigned char ucFogColor[3];
CMatRenderContextPtr pRenderContext( materials );
@@ -942,7 +946,7 @@
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
-inline bool CViewRender::ShouldDrawEntities( void )
+bool CViewRender::ShouldDrawEntities( void )
{
return ( !m_pDrawEntities || (m_pDrawEntities->GetInt() != 0) );
}
@@ -1324,7 +1328,7 @@
g_pClientShadowMgr->PreRender();
// Shadowed flashlights supported on ps_2_b and up...
- if ( r_flashlightdepthtexture.GetBool() && (viewID == VIEW_MAIN) )
+ if ( r_flashlightdepthtexture.GetBool() && (viewID == VIEW_MAIN) && !view.m_bDrawWorldNormal )
{
g_pClientShadowMgr->ComputeShadowDepthTextures( view );
}
@@ -1370,7 +1374,7 @@
CGlowOverlay::DrawOverlays( view.m_bCacheFullSceneState );
// issue the pixel visibility tests
- if ( IsMainView( CurrentViewID() ) )
+ if ( IsMainView( CurrentViewID() ) && !view.m_bDrawWorldNormal )
{
PixelVisibility_EndCurrentView();
}
@@ -1397,7 +1401,7 @@
FinishCurrentView();
// Free shadow depth textures for use in future view
- if ( r_flashlightdepthtexture.GetBool() )
+ if ( r_flashlightdepthtexture.GetBool() && viewID == VIEW_MAIN && !view.m_bDrawWorldNormal )
{
g_pClientShadowMgr->UnlockAllShadowDepthTextures();
}
@@ -1637,7 +1641,7 @@
//-----------------------------------------------------------------------------
// Purpose: Returns the skybox fog color to use in rendering the current frame.
//-----------------------------------------------------------------------------
-static void GetSkyboxFogColor( float *pColor )
+void GetSkyboxFogColor( float *pColor )
{
C_BasePlayer *pbp = C_BasePlayer::GetLocalPlayer();
if( !pbp )
@@ -1685,7 +1689,7 @@
}
-static float GetSkyboxFogStart( void )
+float GetSkyboxFogStart( void )
{
C_BasePlayer *pbp = C_BasePlayer::GetLocalPlayer();
if( !pbp )
@@ -1711,7 +1715,7 @@
}
}
-static float GetSkyboxFogEnd( void )
+float GetSkyboxFogEnd( void )
{
C_BasePlayer *pbp = C_BasePlayer::GetLocalPlayer();
if( !pbp )
@@ -1738,7 +1742,7 @@
}
-static float GetSkyboxFogMaxDensity()
+float GetSkyboxFogMaxDensity()
{
C_BasePlayer *pbp = C_BasePlayer::GetLocalPlayer();
if ( !pbp )
@@ -3889,7 +3893,7 @@
else
continue;
- if ( g_pStudioStatsEntity != NULL && g_CurrentViewID == VIEW_MAIN && itEntity->m_pRenderable == g_pStudioStatsEntity )
+ if ( g_pStudioStatsEntity != NULL && ( g_CurrentViewID == VIEW_MAIN || g_CurrentViewID == VIEW_DEFERRED_GBUFFER ) && itEntity->m_pRenderable == g_pStudioStatsEntity )
{
DrawOpaqueRenderable( itEntity->m_pRenderable, false, DepthMode, STUDIO_GENERATE_STATS );
continue;
@@ -4782,7 +4786,7 @@
}
render->BeginUpdateLightmaps();
- BuildWorldRenderLists( true, true, -1 );
+ BuildWorldRenderLists( true, -1, true );
BuildRenderableRenderLists( iSkyBoxViewID );
render->EndUpdateLightmaps();
@@ -5386,19 +5390,21 @@
ERenderDepthMode DepthMode = DEPTH_MODE_NORMAL;
+ if (!m_bDrawWorldNormal)
+ {
if ( m_DrawFlags & DF_DRAW_ENTITITES )
{
DrawWorld( waterZAdjust );
DrawOpaqueRenderables( DepthMode );
-#ifdef TF_CLIENT_DLL
+ #ifdef TF_CLIENT_DLL
bool bVisionOverride = ( localplayer_visionflags.GetInt() & ( 0x01 ) ); // Pyro-vision Goggles
if ( g_CurrentViewID == VIEW_MAIN && bVisionOverride && pyro_dof.GetBool() ) // Pyro-vision Goggles
{
DrawDepthOfField();
}
-#endif
+ #endif
DrawTranslucentRenderables( false, false );
DrawNoZBufferTranslucentRenderables();
}
@@ -5406,17 +5412,18 @@
{
DrawWorld( waterZAdjust );
-#ifdef TF_CLIENT_DLL
+ #ifdef TF_CLIENT_DLL
bool bVisionOverride = ( localplayer_visionflags.GetInt() & ( 0x01 ) ); // Pyro-vision Goggles
if ( g_CurrentViewID == VIEW_MAIN && bVisionOverride && pyro_dof.GetBool() ) // Pyro-vision Goggles
{
DrawDepthOfField();
}
-#endif
+ #endif
// Draw translucent world brushes only, no entities
DrawTranslucentWorldInLeaves( false );
}
+ }
// issue the pixel visibility tests for sub-views
if ( !IsMainView( CurrentViewID() ) && CurrentViewID() != VIEW_INTRO_CAMERA )
--- mp/src/game/client/viewrender.h Tue Nov 21 03:17:52 2023
+++ mp/src/game/client/viewrender.h Fri Jul 12 21:23:28 2024
@@ -28,7 +28,7 @@
class IScreenSpaceEffect;
class CClientViewSetup;
class CViewRender;
-struct ClientWorldListInfo_t;
+//struct ClientWorldListInfo_t;
class C_BaseEntity;
struct WriteReplayScreenshotParams_t;
class CReplayScreenshotTaker;
@@ -78,6 +78,10 @@
VIEW_INTRO_CAMERA = 6,
VIEW_SHADOW_DEPTH_TEXTURE = 7,
VIEW_SSAO = 8,
+
+ VIEW_DEFERRED_GBUFFER = 9,
+ VIEW_DEFERRED_SHADOW = 10,
+
VIEW_ID_COUNT
};
view_id_t CurrentViewID();
@@ -182,6 +186,34 @@
CViewRender *m_pMainView;
};
+//-----------------------------------------------------------------------------
+// Describes a pruned set of leaves to be rendered this view. Reference counted
+// because potentially shared by a number of views
+//-----------------------------------------------------------------------------
+struct ClientWorldListInfo_t : public CRefCounted1<WorldListInfo_t>
+{
+ ClientWorldListInfo_t()
+ {
+ memset( (WorldListInfo_t *)this, 0, sizeof(WorldListInfo_t) );
+ m_pActualLeafIndex = NULL;
+ m_bPooledAlloc = false;
+ }
+
+ // Allocate a list intended for pruning
+ static ClientWorldListInfo_t *AllocPooled( const ClientWorldListInfo_t &exemplar );
+
+ // Because we remap leaves to eliminate unused leaves, we need a remap
+ // when drawing translucent surfaces, which requires the *original* leaf index
+ // using m_pActualLeafMap[ remapped leaf index ] == actual leaf index
+ LeafIndex_t *m_pActualLeafIndex;
+
+private:
+ virtual bool OnFinalRelease();
+
+ bool m_bPooledAlloc;
+ static CObjectPool<ClientWorldListInfo_t> gm_Pool;
+};
+
//-----------------------------------------------------------------------------
// Base class for 3d views
//-----------------------------------------------------------------------------
@@ -423,7 +455,7 @@
{
m_UnderWaterOverlayMaterial.Init( pMaterial );
}
-private:
+protected:
int m_BuildWorldListsNumber;
--- mp/src/game/server/gameinterface.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/server/gameinterface.cpp Sun Jul 21 17:38:03 2024
@@ -130,6 +130,8 @@
#include "replay/ireplaysystem.h"
#endif
+#include "deferred/deferred_shared_common.h"
+
extern IToolFrameworkServer *g_pToolFrameworkServer;
extern IParticleSystemQuery *g_pParticleSystemQuery;
@@ -190,6 +192,8 @@
IGameSystem *SoundEmitterSystem();
+IGameSystem *DeferredManagerSystem();
+
bool ModelSoundsCacheInit();
void ModelSoundsCacheShutdown();
@@ -701,6 +705,8 @@
// Add sound emitter
IGameSystem::Add( SoundEmitterSystem() );
+ if (CommandLine() && CommandLine()->FindParm( "-nodeferred" ) == 0) IGameSystem::Add( DeferredManagerSystem() );
+
// load Mod specific game events ( MUST be before InitAllSystems() so it can pickup the mod specific events)
gameeventmanager->LoadEventsFromFile("resource/ModEvents.res");
@@ -1432,6 +1438,8 @@
g_pStringTableClientSideChoreoScenes = networkstringtable->CreateStringTable( "Scenes", MAX_CHOREO_SCENES_STRINGS );
g_pStringTableServerMapCycle = networkstringtable->CreateStringTable( "ServerMapCycle", 128 );
+ g_pStringTable_LightCookies = networkstringtable->CreateStringTable( COOKIE_STRINGTBL_NAME, MAX_COOKIE_TEXTURES );
+
#ifdef TF_DLL
g_pStringTableServerPopFiles = networkstringtable->CreateStringTable( "ServerPopFiles", 128 );
g_pStringTableServerMapCycleMvM = networkstringtable->CreateStringTable( "ServerMapCycleMvM", 128 );
@@ -1451,8 +1459,8 @@
g_pStringTableInfoPanel &&
g_pStringTableClientSideChoreoScenes &&
g_pStringTableServerMapCycle &&
- bPopFilesValid
- );
+ bPopFilesValid &&
+ g_pStringTable_LightCookies );
// Need this so we have the error material always handy
PrecacheMaterial( "debug/debugempty" );
--- mp/src/game/server/lights.cpp Tue Nov 21 03:17:52 2023
+++ mp/src/game/server/lights.cpp Sat Jul 20 16:27:18 2024
@@ -9,6 +9,9 @@
#include "lights.h"
#include "world.h"
+#include "deferred/deferred_shared_common.h"
+#include "deferred/cdeferred_manager_server.h"
+
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -22,6 +25,7 @@
DEFINE_KEYFIELD( m_iStyle, FIELD_INTEGER, "style" ),
DEFINE_KEYFIELD( m_iDefaultStyle, FIELD_INTEGER, "defaultstyle" ),
DEFINE_KEYFIELD( m_iszPattern, FIELD_STRING, "pattern" ),
+ DEFINE_KEYFIELD( m_iszColor, FIELD_STRING, "_light" ),
// Fuctions
DEFINE_FUNCTION( FadeThink ),
@@ -76,7 +80,7 @@
if (FBitSet(m_spawnflags, SF_LIGHT_START_OFF))
engine->LightStyle(m_iStyle, "a");
else if (m_iszPattern != NULL_STRING)
- engine->LightStyle(m_iStyle, (char *)STRING( m_iszPattern ));
+ engine->LightStyle(m_iStyle, STRING( m_iszPattern ));
else
engine->LightStyle(m_iStyle, "m");
}
@@ -101,7 +105,7 @@
{
if ( m_iszPattern != NULL_STRING )
{
- engine->LightStyle( m_iStyle, (char *) STRING( m_iszPattern ) );