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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//===========================================================================//
#ifndef RENDER_H
#define RENDER_H
#ifdef _WIN32
#pragma once
#endif
#include "mathlib/vector.h"
// render.h -- public interface to refresh functions
extern float r_blend; // Global blending factor for the current entity
extern float r_colormod[3]; // Global color modulation for the current entity
extern bool g_bIsBlendingOrModulating;
//-----------------------------------------------------------------------------
// Current view
//-----------------------------------------------------------------------------
inline const Vector &CurrentViewOrigin()
{
#ifdef DBGFLAG_ASSERT
extern bool g_bCanAccessCurrentView;
#endif
extern Vector g_CurrentViewOrigin;
Assert( g_bCanAccessCurrentView );
return g_CurrentViewOrigin;
}
inline const Vector &CurrentViewForward()
{
#ifdef DBGFLAG_ASSERT
extern bool g_bCanAccessCurrentView;
#endif
extern Vector g_CurrentViewForward;
Assert( g_bCanAccessCurrentView );
return g_CurrentViewForward;
}
inline const Vector &CurrentViewRight()
{
#ifdef DBGFLAG_ASSERT
extern bool g_bCanAccessCurrentView;
#endif
extern Vector g_CurrentViewRight;
Assert( g_bCanAccessCurrentView );
return g_CurrentViewRight;
}
inline const Vector &CurrentViewUp()
{
#ifdef DBGFLAG_ASSERT
extern bool g_bCanAccessCurrentView;
#endif
extern Vector g_CurrentViewUp;
Assert( g_bCanAccessCurrentView );
return g_CurrentViewUp;
}
//-----------------------------------------------------------------------------
// Main view
//-----------------------------------------------------------------------------
inline const Vector &MainViewOrigin()
{
extern Vector g_MainViewOrigin;
return g_MainViewOrigin;
}
inline const Vector &MainViewForward()
{
extern Vector g_MainViewForward;
return g_MainViewForward;
}
inline const Vector &MainViewRight()
{
extern Vector g_MainViewRight;
return g_MainViewRight;
}
inline const Vector &MainViewUp()
{
extern Vector g_MainViewUp;
return g_MainViewUp;
}
void R_Init (void);
void R_LevelInit(void);
void R_LevelShutdown(void);
// Loads world geometry. Called when map changes or dx level changes
void R_LoadWorldGeometry( bool bDXChange = false );
#include "view_shared.h"
#include "ivrenderview.h"
class VMatrix;
abstract_class IRender
{
public:
virtual void FrameBegin( void ) = 0;
virtual void FrameEnd( void ) = 0;
virtual void ViewSetupVis( bool novis, int numorigins, const Vector origin[] ) = 0;
virtual void ViewDrawFade( byte *color, IMaterial* pFadeMaterial ) = 0;
virtual void DrawSceneBegin( void ) = 0;
virtual void DrawSceneEnd( void ) = 0;
virtual IWorldRenderList * CreateWorldList() = 0;
virtual void BuildWorldLists( IWorldRenderList *pList, WorldListInfo_t* pInfo, int iForceViewLeaf, const VisOverrideData_t* pVisData, bool bShadowDepth, float *pReflectionWaterHeight ) = 0;
virtual void DrawWorldLists( IWorldRenderList *pList, unsigned long flags, float waterZAdjust ) = 0;
// UNDONE: these are temporary functions that will end up on the other
// side of this interface
// accessors
// virtual const Vector& UnreflectedViewOrigin() = 0;
virtual const Vector& ViewOrigin( void ) = 0;
virtual const QAngle& ViewAngles( void ) = 0;
virtual CViewSetup const &ViewGetCurrent( void ) = 0;
virtual const VMatrix& ViewMatrix( void ) = 0;
virtual const VMatrix& WorldToScreenMatrix( void ) = 0;
virtual float GetFramerate( void ) = 0;
virtual float GetZNear( void ) = 0;
virtual float GetZFar( void ) = 0;
// Query current fov and view model fov
virtual float GetFov( void ) = 0;
virtual float GetFovY( void ) = 0;
virtual float GetFovViewmodel( void ) = 0;
// Compute the clip-space coordinates of a point in 3D
// Clip-space is normalized screen coordinates (-1 to 1 in x and y)
// Returns true if the point is behind the camera
virtual bool ClipTransformWithProjection ( const VMatrix& worldToScreen, const Vector& point, Vector* pClip ) = 0;
// Same, using the current engine's matrices.
virtual bool ClipTransform( Vector const& point, Vector* pClip ) = 0;
// Compute the screen-space coordinates of a point in 3D
// This returns actual pixels
// Returns true if the point is behind the camera
virtual bool ScreenTransform( Vector const& point, Vector* pScreen ) = 0;
virtual void Push3DView( const CViewSetup &view, int nFlags, ITexture* pRenderTarget, Frustum frustumPlanes ) = 0;
virtual void Push3DView( const CViewSetup &view, int nFlags, ITexture* pRenderTarget, Frustum frustumPlanes, ITexture* pDepthTexture ) = 0;
virtual void Push2DView( const CViewSetup &view, int nFlags, ITexture* pRenderTarget, Frustum frustumPlanes ) = 0;
virtual void PopView( Frustum frustumPlanes ) = 0;
virtual void SetMainView( const Vector &vecOrigin, const QAngle &angles ) = 0;
virtual void ViewSetupVisEx( bool novis, int numorigins, const Vector origin[], unsigned int &returnFlags ) = 0;
virtual void OverrideViewFrustum( Frustum custom ) = 0;
virtual void UpdateBrushModelLightmap( model_t *model, IClientRenderable *Renderable ) = 0;
virtual void BeginUpdateLightmaps( void ) = 0;
virtual void EndUpdateLightmaps( void ) = 0;
virtual bool InLightmapUpdate( void ) const = 0;
};
void R_PushDlights (void);
// UNDONE Remove this - pass this around to functions/systems that need it.
extern IRender *g_EngineRenderer;
#endif // RENDER_H
|