Nuclide
Software Development Kit for id Tech
NSRenderableEntity.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-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
17typedef enumflags
18{
19 RDENT_CHANGED_ORIGIN_X,
20 RDENT_CHANGED_ORIGIN_Y,
21 RDENT_CHANGED_ORIGIN_Z,
22 RDENT_CHANGED_ANGLES_X,
23 RDENT_CHANGED_ANGLES_Y,
24 RDENT_CHANGED_ANGLES_Z,
25 RDENT_CHANGED_MODELINDEX,
26 RDENT_CHANGED_SIZE,
27 RDENT_CHANGED_FLAGS,
28 RDENT_CHANGED_SOLIDMOVETYPE,
29 RDENT_CHANGED_FRAME,
30 RDENT_CHANGED_SKIN,
31 RDENT_CHANGED_EFFECTS,
32 RDENT_CHANGED_BODY,
33 RDENT_CHANGED_SCALE,
34 RDENT_CHANGED_VELOCITY,
35 RDENT_CHANGED_ANGULARVELOCITY,
36 RDENT_CHANGED_RENDERCOLOR,
37 RDENT_CHANGED_RENDERAMT,
38 RDENT_CHANGED_RENDERMODE,
39 RDENT_CHANGED_CONTROLLER
40} nsrenderableentity_changed_t;
41
42typedef enum
43{
51 RM_ADDFRAC = 7, /* Source 2004 */
52 RM_WORLDGLOW = 9, /* Source 2004 */
53 RM_DONTRENDER = 10, /* Source 2004 */
55
56typedef enum
57{
77 RFX_Q2PULSE = 21
79
80#ifdef CLIENT
83#endif
84
94{
95public:
96 void NSRenderableEntity(void);
97
98 /* overrides */
99 virtual void SpawnKey(string,string);
100#ifdef SERVER
101 virtual void Input(entity,string,string);
102 virtual void Respawn(void);
103 virtual void Save(float);
104 virtual void Restore(string,string);
105 virtual void EvaluateEntity(void);
106 virtual float SendEntity(entity,float);
107#endif
108
109#ifdef CLIENT
110 virtual void RenderDebugSkeleton(void);
111 virtual void ReceiveEntity(float,float);
112 virtual float predraw(void);
113 virtual void postdraw(void);
114 virtual void RendererRestarted();
115#endif
116
117 virtual void MakeStatic(void);
118
119 /* model events */
121 virtual void HandleAnimEvent(float,int,string);
122
123 /* set */
125 nonvirtual void SetBody(int);
127 nonvirtual void SetBodyInGroup(int, int);
129 nonvirtual void SetRenderFX(float);
131 nonvirtual void SetRenderMode(float);
133 nonvirtual void SetRenderAmt(float);
135 nonvirtual void SetRenderColor(vector);
137 nonvirtual void SetBoneControl1(float);
139 nonvirtual void SetBoneControl2(float);
141 nonvirtual void SetBoneControl3(float);
143 nonvirtual void SetBoneControl4(float);
145 nonvirtual void SetBoneControl5(float);
147 nonvirtual void SetAxialScale(vector);
148
150 nonvirtual int GetBody(void);
152 nonvirtual int GetBodyInGroup(int);
154 nonvirtual float GetRenderMode(void);
156 nonvirtual float GetRenderFX(void);
158 nonvirtual float GetRenderAmt(void);
160 nonvirtual vector GetRenderColor(void);
162 nonvirtual float GetBoneControl1(void);
164 nonvirtual float GetBoneControl2(void);
166 nonvirtual float GetBoneControl3(void);
168 nonvirtual float GetBoneControl4(void);
170 nonvirtual float GetBoneControl5(void);
172 nonvirtual vector GetAxialScale(void);
173
174#ifdef CLIENT
176 nonvirtual void RenderFXPass(void);
177 nonvirtual void RenderAxialScale(void);
178 nonvirtual void RenderGLQuakeShadow(void);
179#endif
180
181private:
182 /* new */
183 PREDICTED_FLOAT(m_flBoneControl1)
184 PREDICTED_FLOAT(m_flBoneControl2)
185 PREDICTED_FLOAT(m_flBoneControl3)
186 PREDICTED_FLOAT(m_flBoneControl4)
187 PREDICTED_FLOAT(m_flBoneControl5)
188 PREDICTED_FLOAT_N(modelflags)
189 PREDICTED_INT(m_iBody)
190 PREDICTED_FLOAT_N(colormap)
191 PREDICTED_VECTOR_N(glowmod)
193
194 PREDICTED_FLOAT(m_iRenderFX)
195 PREDICTED_FLOAT(m_iRenderMode)
196 PREDICTED_FLOAT(m_flRenderAmt)
197 PREDICTED_VECTOR(m_vecRenderColor)
198 PREDICTED_VECTOR(m_vecAxialScale)
199
200 /* either a sprite model or a particle */
201 PREDICTED_INT(m_iMuzzleModel)
202 PREDICTED_INT(m_iMuzzlePart)
203 PREDICTED_FLOAT(m_flMuzzleScale)
204
205 /* model events */
206 float m_flBaseTime;
207
208#ifdef CLIENT
209 float m_iNumBones;
210 nonvirtual void _UpdateGeomset();
211 nonvirtual void _UpdateBoneCount();
212#endif
213};
rendermode_t
Definition: NSRenderableEntity.h:43
@ RM_ADDITIVE
Definition: NSRenderableEntity.h:49
@ RM_ADDFRAC
Definition: NSRenderableEntity.h:51
@ RM_WORLDGLOW
Definition: NSRenderableEntity.h:52
@ RM_COLOR
Definition: NSRenderableEntity.h:45
@ RM_NORMAL
Definition: NSRenderableEntity.h:44
@ RM_FULLBRIGHT
Definition: NSRenderableEntity.h:50
@ RM_GLOW
Definition: NSRenderableEntity.h:47
@ RM_DONTRENDER
Definition: NSRenderableEntity.h:53
@ RM_TEXTURE
Definition: NSRenderableEntity.h:46
@ RM_SOLID
Definition: NSRenderableEntity.h:48
var int autocvar_rm_unlit_texture
Definition: NSRenderableEntity.h:82
renderfx_t
Definition: NSRenderableEntity.h:57
@ RFX_FASTWIDEPULSE
Definition: NSRenderableEntity.h:62
@ RFX_SLOWFLICKER
Definition: NSRenderableEntity.h:70
@ RFX_FASTPULSE
Definition: NSRenderableEntity.h:60
@ RFX_Q2PULSE
Definition: NSRenderableEntity.h:77
@ RFX_FASTSTROBE
Definition: NSRenderableEntity.h:68
@ RFX_SLOWBECOMESOLID
Definition: NSRenderableEntity.h:65
@ RFX_FASTBECOMESOLID
Definition: NSRenderableEntity.h:66
@ RFX_FASTERSTROBE
Definition: NSRenderableEntity.h:69
@ RFX_HOLOGRAM
Definition: NSRenderableEntity.h:74
@ RFX_SLOWPULSE
Definition: NSRenderableEntity.h:59
@ RFX_SLOWFADEAWAY
Definition: NSRenderableEntity.h:63
@ RFX_DISTORT
Definition: NSRenderableEntity.h:73
@ RFX_FASTFADEAWAY
Definition: NSRenderableEntity.h:64
@ RFX_NORMAL
Definition: NSRenderableEntity.h:58
@ RFX_CONSTANTGLOW
Definition: NSRenderableEntity.h:72
@ RFX_SLOWSTROBE
Definition: NSRenderableEntity.h:67
@ RFX_SLOWWIDEPULSE
Definition: NSRenderableEntity.h:61
@ RFX_GLOWSHELL
Definition: NSRenderableEntity.h:75
@ RFX_FASTFLICKER
Definition: NSRenderableEntity.h:71
@ RFX_GLOWSHELL2
Definition: NSRenderableEntity.h:76
var int autocvar_rm_unlit_additive
Definition: NSRenderableEntity.h:81
typedef enumflags
Definition: NSRenderableEntity.h:18
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:54
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:94
nonvirtual float GetRenderAmt(void)
Returns the render amount of the entity.
Definition: NSRenderableEntity.qc:906
nonvirtual float GetRenderMode(void)
Returns the render mode of the entity.
Definition: NSRenderableEntity.qc:894
nonvirtual void RenderFXPass(void)
Called by predraw(); and will set the appropriate rendering specific fields.
virtual void RendererRestarted()
Client: Called when video resources need to be allocated or reloaded for the entity.
Definition: NSRenderableEntity.qc:48
nonvirtual void SetBody(int)
Sets the bodygroup of the entity.
Definition: NSRenderableEntity.qc:799
nonvirtual float GetBoneControl4(void)
Returns the value of the entity's bone controller #4.
Definition: NSRenderableEntity.qc:936
nonvirtual void SetBoneControl1(float)
Sets the value of the bone controller #1.
Definition: NSRenderableEntity.qc:846
nonvirtual void SetAxialScale(vector)
Sets the axial, anisotropic scale of an entity, affecting the individual axis (forward,...
Definition: NSRenderableEntity.qc:876
nonvirtual float GetBoneControl1(void)
Returns the value of the entity's bone controller #1.
Definition: NSRenderableEntity.qc:918
nonvirtual int GetBodyInGroup(int)
Returns the body within a given group.
Definition: NSRenderableEntity.qc:888
nonvirtual void SetBoneControl5(float)
Sets the value of the bone controller #5.
Definition: NSRenderableEntity.qc:870
nonvirtual void SetRenderColor(vector)
Sets the render color of the entity.
Definition: NSRenderableEntity.qc:836
nonvirtual void SetBoneControl3(float)
Sets the value of the bone controller #3.
Definition: NSRenderableEntity.qc:858
nonvirtual void RenderGLQuakeShadow(void)
virtual void postdraw(void)
Client: Run after the rendering of 3D world is complete.
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition: NSRenderableEntity.qc:164
virtual void RenderDebugSkeleton(void)
virtual void HandleAnimEvent(float, int, string)
Callback for any model event that gets triggered while playing a framegroup.
Definition: NSRenderableEntity.qc:954
nonvirtual void SetRenderAmt(float)
Sets the render amount of the entity.
Definition: NSRenderableEntity.qc:830
nonvirtual float GetRenderFX(void)
Returns the render FX of the entity.
Definition: NSRenderableEntity.qc:900
nonvirtual void SetBoneControl4(float)
Sets the value of the bone controller #4.
Definition: NSRenderableEntity.qc:864
nonvirtual void SetBoneControl2(float)
Sets the value of the bone controller #2.
Definition: NSRenderableEntity.qc:852
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition: NSRenderableEntity.qc:111
nonvirtual void SetBodyInGroup(int, int)
Sets the body inside of a specific group.
Definition: NSRenderableEntity.qc:809
nonvirtual float GetBoneControl5(void)
Returns the value of the entity's bone controller #5.
Definition: NSRenderableEntity.qc:942
nonvirtual void SetRenderFX(float)
Sets the render FX type of the entity.
Definition: NSRenderableEntity.qc:818
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
nonvirtual int GetBody(void)
Returns the bodygroup of the entity.
Definition: NSRenderableEntity.qc:882
virtual void Restore(string, string)
Similar to NSIO::SpawnKey but for save-game fields.
Definition: NSRenderableEntity.qc:1061
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition: NSRenderableEntity.qc:1155
virtual float predraw(void)
nonvirtual float GetBoneControl3(void)
Returns the value of the entity's bone controller #3.
Definition: NSRenderableEntity.qc:930
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition: NSRenderableEntity.qc:1115
nonvirtual vector GetRenderColor(void)
Returns the render color of the entity.
Definition: NSRenderableEntity.qc:912
nonvirtual float GetBoneControl2(void)
Returns the value of the entity's bone controller #2.
Definition: NSRenderableEntity.qc:924
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSRenderableEntity.qc:1040
virtual void Respawn(void)
Server: Called when the entity first spawns or when game-logic requests the entity to return to its o...
Definition: NSRenderableEntity.qc:775
nonvirtual void RenderAxialScale(void)
nonvirtual vector GetAxialScale(void)
Returns the axial/anisotropic scale of the entity, same as input format (forward, right,...
Definition: NSRenderableEntity.qc:948
virtual void MakeStatic(void)
Tells the engine to make the entity static, effectively making it inaccessible.
Definition: NSRenderableEntity.qc:90
nonvirtual void SetRenderMode(float)
Sets the render mode type of the entity.
Definition: NSRenderableEntity.qc:824
void NSRenderableEntity(void)
Definition: NSRenderableEntity.qc:20
#define PREDICTED_FLOAT_N(x)
Definition: defs.h:41
#define PREDICTED_FLOAT(x)
Definition: defs.h:34
#define PREDICTED_VECTOR_N(x)
Definition: defs.h:42
#define PREDICTED_VECTOR(x)
Definition: defs.h:35
#define PREDICTED_INT(x)
Definition: defs.h:33
noref float frame1time
Definition: ui_3dview.qc:22