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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//===========================================================================//
#if !defined( IVIEWRENDER_H )
#define IVIEWRENDER_H
#ifdef _WIN32
#pragma once
#endif
#include "ivrenderview.h"
// These are set as it draws reflections, refractions, etc, so certain effects can avoid
// drawing themselves in reflections.
enum DrawFlags_t
{
DF_RENDER_REFRACTION = 0x1,
DF_RENDER_REFLECTION = 0x2,
DF_CLIP_Z = 0x4,
DF_CLIP_BELOW = 0x8,
DF_RENDER_UNDERWATER = 0x10,
DF_RENDER_ABOVEWATER = 0x20,
DF_RENDER_WATER = 0x40,
DF_SSAO_DEPTH_PASS = 0x100,
DF_WATERHEIGHT = 0x200,
DF_DRAW_SSAO = 0x400,
DF_DRAWSKYBOX = 0x800,
DF_FUDGE_UP = 0x1000,
DF_DRAW_ENTITITES = 0x2000,
DF_UNUSED3 = 0x4000,
DF_UNUSED4 = 0x8000,
DF_UNUSED5 = 0x10000,
DF_SAVEGAMESCREENSHOT = 0x20000,
DF_CLIP_SKYBOX = 0x40000,
DF_SHADOW_DEPTH_MAP = 0x100000 // Currently rendering a shadow depth map
};
//-----------------------------------------------------------------------------
// Purpose: View setup and rendering
//-----------------------------------------------------------------------------
class CViewSetup;
class C_BaseEntity;
struct vrect_t;
class C_BaseViewModel;
struct WriteReplayScreenshotParams_t;
class IReplayScreenshotSystem;
abstract_class IViewRender
{
public:
// SETUP
// Initialize view renderer
virtual void Init( void ) = 0;
// Clear any systems between levels
virtual void LevelInit( void ) = 0;
virtual void LevelShutdown( void ) = 0;
// Shutdown
virtual void Shutdown( void ) = 0;
// RENDERING
// Called right before simulation. It must setup the view model origins and angles here so
// the correct attachment points can be used during simulation.
virtual void OnRenderStart() = 0;
// Called to render the entire scene
virtual void Render( vrect_t *rect ) = 0;
// Called to render just a particular setup ( for timerefresh and envmap creation )
virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
// What are we currently rendering? Returns a combination of DF_ flags.
virtual int GetDrawFlags() = 0;
// MISC
// Start and stop pitch drifting logic
virtual void StartPitchDrift( void ) = 0;
virtual void StopPitchDrift( void ) = 0;
// This can only be called during rendering (while within RenderView).
virtual VPlane* GetFrustum() = 0;
virtual bool ShouldDrawBrushModels( void ) = 0;
virtual const CViewSetup *GetPlayerViewSetup( void ) const = 0;
virtual const CViewSetup *GetViewSetup( void ) const = 0;
virtual void DisableVis( void ) = 0;
virtual int BuildWorldListsNumber() const = 0;
virtual void SetCheapWaterStartDistance( float flCheapWaterStartDistance ) = 0;
virtual void SetCheapWaterEndDistance( float flCheapWaterEndDistance ) = 0;
virtual void GetWaterLODParams( float &flCheapWaterStartDistance, float &flCheapWaterEndDistance ) = 0;
virtual void DriftPitch (void) = 0;
virtual void SetScreenOverlayMaterial( IMaterial *pMaterial ) = 0;
virtual IMaterial *GetScreenOverlayMaterial( ) = 0;
virtual void WriteSaveGameScreenshot( const char *pFilename ) = 0;
virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded = false, bool bWriteVTF = false ) = 0;
virtual void WriteReplayScreenshot( WriteReplayScreenshotParams_t ¶ms ) = 0;
virtual void UpdateReplayScreenshotCache() = 0;
// Draws another rendering over the top of the screen
virtual void QueueOverlayRenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
// Returns znear and zfar
virtual float GetZNear() = 0;
virtual float GetZFar() = 0;
virtual void GetScreenFadeDistances( float *min, float *max ) = 0;
virtual C_BaseEntity *GetCurrentlyDrawingEntity() = 0;
virtual void SetCurrentlyDrawingEntity( C_BaseEntity *pEnt ) = 0;
virtual bool UpdateShadowDepthTexture( ITexture *pRenderTarget, ITexture *pDepthTexture, const CViewSetup &shadowView ) = 0;
virtual void FreezeFrame( float flFreezeTime ) = 0;
virtual IReplayScreenshotSystem *GetReplayScreenshotSystem() = 0;
};
extern IViewRender *view;
#endif // IVIEWRENDER_H
|