Nuclide
Software Development Kit for id Tech
NSView.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
30typedef enum
31{
37
41class
43{
44public:
45 void NSView(void);
46
48 virtual void SetupView(void);
50 virtual void RenderView(void);
51
53 virtual void StairSmooth(void);
54
56 virtual void UpdateView(void);
57
59 nonvirtual void AddPunchAngle(vector);
60
61 /* set/get */
63 nonvirtual void SetViewMode(viewmode_t);
65 nonvirtual viewmode_t GetViewMode(void);
66
68 nonvirtual void SetViewPosition(vector);
70 nonvirtual void SetViewSize(vector);
72 nonvirtual void SetViewTarget(NSEntity);
77 nonvirtual void SetClientOwner(NSClient);
78
80 nonvirtual void SetDrawLocalPlayer(bool);
81
83 nonvirtual void SetCameraOrigin(vector);
85 nonvirtual void SetCameraAngle(vector);
87 nonvirtual void SetClientAngle(vector);
89 nonvirtual void SetSeatID(int);
91 nonvirtual void SetAFOV(float);
93 nonvirtual float GetAFOV(void);
95 nonvirtual void SetSensitivity(float);
97 nonvirtual float GetSensitivity(void);
98
100 nonvirtual vector GetHUDCanvasSize(void);
102 nonvirtual vector GetHUDCanvasPos(void);
103
105 nonvirtual float GetViewWidth(void);
107 nonvirtual float GetViewHeight(void);
108
110 nonvirtual vector GetCameraOrigin(void);
112 nonvirtual vector GetCameraAngle(void);
113
114private:
115 int m_iSeat;
116
117 /* the dimensions of our view */
118 vector m_vecPosition;
119 vector m_vecSize;
120 float m_flFieldOfView;
121 viewmode_t m_viewmode;
122 float m_flSensitivity;
123
124 vector m_vecLastOrigin;
125
126 /* the entity we're targetting */
127 NSEntity m_viewTarget;
128
129 NSClient m_client;
130
131 vector m_vecClientAngle;
132 bool m_bSetClientAngle;
133
134 bool m_bDrawLocalPlayer;
135 bool m_bDrawEntities;
136
137 bool _m_bWasAlive;
138};
139
142
NSView g_viewSeats[4]
one NSView for each seat
Definition: NSView.h:141
viewmode_t
The view mode type of the NSView.
Definition: NSView.h:31
@ VIEWMODE_FPS
uses view target position + view offset
Definition: NSView.h:33
@ VIEWMODE_NORMAL
just a regular camera with no special logic
Definition: NSView.h:32
@ VIEWMODE_SPECTATING
spectating, mixed viewmodes inside
Definition: NSView.h:35
@ VIEWMODE_THIRDPERSON
third person view, fixed
Definition: NSView.h:34
NSView g_view
the current seat run for each draw call, for each player.
Definition: NSView.h:144
This entity class is the lowest client/player class.
Definition: NSClient.h:24
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:52
This class represents 3D views, used for rendering the game.
Definition: NSView.h:43
vector(vector) normalize