/
view_shared.h
136 lines (111 loc) · 3.61 KB
/
view_shared.h
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef VIEW_SHARED_H
#define VIEW_SHARED_H
#ifdef _WIN32
#pragma once
#endif
#include "convar.h"
#include "mathlib/vector.h"
#include "materialsystem/MaterialSystemUtil.h"
//-----------------------------------------------------------------------------
// Flags passed in with view setup
//-----------------------------------------------------------------------------
enum ClearFlags_t
{
VIEW_CLEAR_COLOR = 0x1,
VIEW_CLEAR_DEPTH = 0x2,
VIEW_CLEAR_FULL_TARGET = 0x4,
VIEW_NO_DRAW = 0x8,
VIEW_CLEAR_OBEY_STENCIL = 0x10, // Draws a quad allowing stencil test to clear through portals
VIEW_CLEAR_STENCIL = 0x20,
};
enum StereoEye_t
{
STEREO_EYE_MONO = 0,
STEREO_EYE_LEFT = 1,
STEREO_EYE_RIGHT = 2,
STEREO_EYE_MAX = 3,
};
//-----------------------------------------------------------------------------
// Purpose: Renderer setup data.
//-----------------------------------------------------------------------------
class CViewSetup
{
public:
CViewSetup()
{
m_flAspectRatio = 0.0f;
m_bRenderToSubrectOfLargerScreen = false;
m_bDoBloomAndToneMapping = true;
m_bOrtho = false;
m_bOffCenter = false;
m_bCacheFullSceneState = false;
// m_bUseExplicitViewVector = false;
m_bViewToProjectionOverride = false;
m_eStereoEye = STEREO_EYE_MONO;
}
// shared by 2D & 3D views
// left side of view window
int x;
int m_nUnscaledX;
// top side of view window
int y;
int m_nUnscaledY;
// width of view window
int width;
int m_nUnscaledWidth;
// height of view window
int height;
// which eye are we rendering?
StereoEye_t m_eStereoEye;
int m_nUnscaledHeight;
// the rest are only used by 3D views
// Orthographic projection?
bool m_bOrtho;
// View-space rectangle for ortho projection.
float m_OrthoLeft;
float m_OrthoTop;
float m_OrthoRight;
float m_OrthoBottom;
// horizontal FOV in degrees
float fov;
// horizontal FOV in degrees for in-view model
float fovViewmodel;
// 3D origin of camera
Vector origin;
// heading of camera (pitch, yaw, roll)
QAngle angles;
// local Z coordinate of near plane of camera
float zNear;
// local Z coordinate of far plane of camera
float zFar;
// local Z coordinate of near plane of camera ( when rendering view model )
float zNearViewmodel;
// local Z coordinate of far plane of camera ( when rendering view model )
float zFarViewmodel;
// set to true if this is to draw into a subrect of the larger screen
// this really is a hack, but no more than the rest of the way this class is used
bool m_bRenderToSubrectOfLargerScreen;
// The aspect ratio to use for computing the perspective projection matrix
// (0.0f means use the viewport)
float m_flAspectRatio;
// Controls for off-center projection (needed for poster rendering)
bool m_bOffCenter;
float m_flOffCenterTop;
float m_flOffCenterBottom;
float m_flOffCenterLeft;
float m_flOffCenterRight;
// Control that the SFM needs to tell the engine not to do certain post-processing steps
bool m_bDoBloomAndToneMapping;
// Cached mode for certain full-scene per-frame varying state such as sun entity coverage
bool m_bCacheFullSceneState;
// If using VR, the headset calibration will feed you a projection matrix per-eye.
// This does NOT override the Z range - that will be set up as normal (i.e. the values in this matrix will be ignored).
bool m_bViewToProjectionOverride;
VMatrix m_ViewToProjection;
};
#endif // VIEW_SHARED_H