Nuclide
Software Development Kit for id Technology
NSRenderableEntity.h
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{
44 RM_NORMAL = 0,
45 RM_COLOR = 1,
46 RM_TEXTURE = 2,
47 RM_GLOW = 3,
48 RM_SOLID = 4,
49 RM_ADDITIVE = 5,
50 RM_FULLBRIGHT = 6,
51 RM_ADDFRAC = 7, /* Source 2004 */
52 RM_WORLDGLOW = 9, /* Source 2004 */
53 RM_DONTRENDER = 10, /* Source 2004 */
54} rendermode_t;
55
56typedef enum
57{
58 RFX_NORMAL = 0,
59 RFX_SLOWPULSE = 1,
60 RFX_FASTPULSE = 2,
61 RFX_SLOWWIDEPULSE = 3,
62 RFX_FASTWIDEPULSE = 4,
63 RFX_SLOWFADEAWAY = 5,
64 RFX_FASTFADEAWAY = 6,
65 RFX_SLOWBECOMESOLID = 7,
66 RFX_FASTBECOMESOLID = 8,
67 RFX_SLOWSTROBE = 9,
68 RFX_FASTSTROBE = 10,
69 RFX_FASTERSTROBE = 11,
70 RFX_SLOWFLICKER = 12,
71 RFX_FASTFLICKER = 13,
72 RFX_CONSTANTGLOW = 14,
73 RFX_DISTORT = 15,
74 RFX_HOLOGRAM = 16,
75 RFX_GLOWSHELL = 19,
76 RFX_GLOWSHELL2 = 20,
77 RFX_Q2PULSE = 21
78} renderfx_t;
79
80#ifdef CLIENT
81var int autocvar_rm_unlit_additive = TRUE;
82var int autocvar_rm_unlit_texture = TRUE;
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
108 nonvirtual void Event_SpawnDefBone(string, string);
109 nonvirtual void Event_SpawnDefAttachment(string, float);
110#endif
111
112#ifdef CLIENT
113 virtual void RenderDebugSkeleton(void);
114 virtual void ReceiveEntity(float,float);
115 virtual float predraw(void);
116 virtual void postdraw(void);
117 virtual void RendererRestarted();
118#endif
119
120 virtual void MakeStatic(void);
121
122 /* model events */
124 virtual void HandleAnimEvent(float,int,string);
125
126 /* set */
128 nonvirtual void SetBody(int);
130 nonvirtual void SetBodyInGroup(int, int);
132 nonvirtual void SetRenderFX(float);
134 nonvirtual void SetRenderMode(float);
136 nonvirtual void SetRenderAmt(float);
138 nonvirtual void SetRenderColor(vector);
140 nonvirtual void SetBoneControl1(float);
142 nonvirtual void SetBoneControl2(float);
144 nonvirtual void SetBoneControl3(float);
146 nonvirtual void SetBoneControl4(float);
148 nonvirtual void SetBoneControl5(float);
150 nonvirtual void SetAxialScale(vector);
151
153 nonvirtual int GetBody(void);
155 nonvirtual int GetBodyInGroup(int);
157 nonvirtual float GetRenderMode(void);
159 nonvirtual float GetRenderFX(void);
161 nonvirtual float GetRenderAmt(void);
163 nonvirtual vector GetRenderColor(void);
165 nonvirtual float GetBoneControl1(void);
167 nonvirtual float GetBoneControl2(void);
169 nonvirtual float GetBoneControl3(void);
171 nonvirtual float GetBoneControl4(void);
173 nonvirtual float GetBoneControl5(void);
175 nonvirtual vector GetAxialScale(void);
176
177#ifdef CLIENT
179 nonvirtual void RenderFXPass(void);
180 nonvirtual void RenderAxialScale(void);
181 nonvirtual void RenderGLQuakeShadow(void);
182#endif
183
184private:
185 /* new */
186 PREDICTED_FLOAT(m_flBoneControl1)
187 PREDICTED_FLOAT(m_flBoneControl2)
188 PREDICTED_FLOAT(m_flBoneControl3)
189 PREDICTED_FLOAT(m_flBoneControl4)
190 PREDICTED_FLOAT(m_flBoneControl5)
191 PREDICTED_FLOAT_N(modelflags)
192 PREDICTED_INT(m_iBody)
193 PREDICTED_FLOAT_N(colormap)
194 PREDICTED_VECTOR_N(glowmod)
195 PREDICTED_FLOAT_N(frame1time)
196
197 PREDICTED_FLOAT(m_iRenderFX)
198 PREDICTED_FLOAT(m_iRenderMode)
199 PREDICTED_FLOAT(m_flRenderAmt)
200 PREDICTED_VECTOR(m_vecRenderColor)
201 PREDICTED_VECTOR(m_vecAxialScale)
202
203 /* either a sprite model or a particle */
204 PREDICTED_INT(m_iMuzzleModel)
205 PREDICTED_INT(m_iMuzzlePart)
206 PREDICTED_FLOAT(m_flMuzzleScale)
207
208 /* model events */
209 float m_flBaseTime;
210 float m_iNumBones;
211 nonvirtual void _UpdateBoneCount();
212
213#ifdef CLIENT
214 float m_netEffects;
215
216 nonvirtual void _UpdateGeomset();
217#endif
218};
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:923
nonvirtual float GetRenderMode(void)
Returns the render mode of the entity.
Definition: NSRenderableEntity.qc:911
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:45
nonvirtual void SetBody(int)
Sets the bodygroup of the entity.
Definition: NSRenderableEntity.qc:815
nonvirtual float GetBoneControl4(void)
Returns the value of the entity's bone controller #4.
Definition: NSRenderableEntity.qc:953
nonvirtual void SetBoneControl1(float)
Sets the value of the bone controller #1.
Definition: NSRenderableEntity.qc:863
nonvirtual void SetAxialScale(vector)
Sets the axial, anisotropic scale of an entity, affecting the individual axis (forward,...
Definition: NSRenderableEntity.qc:893
nonvirtual float GetBoneControl1(void)
Returns the value of the entity's bone controller #1.
Definition: NSRenderableEntity.qc:935
nonvirtual int GetBodyInGroup(int)
Returns the body within a given group.
Definition: NSRenderableEntity.qc:905
nonvirtual void SetBoneControl5(float)
Sets the value of the bone controller #5.
Definition: NSRenderableEntity.qc:887
nonvirtual void SetRenderColor(vector)
Sets the render color of the entity.
Definition: NSRenderableEntity.qc:852
nonvirtual void SetBoneControl3(float)
Sets the value of the bone controller #3.
Definition: NSRenderableEntity.qc:875
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:165
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:971
nonvirtual void SetRenderAmt(float)
Sets the render amount of the entity.
Definition: NSRenderableEntity.qc:846
nonvirtual float GetRenderFX(void)
Returns the render FX of the entity.
Definition: NSRenderableEntity.qc:917
nonvirtual void SetBoneControl4(float)
Sets the value of the bone controller #4.
Definition: NSRenderableEntity.qc:881
nonvirtual void SetBoneControl2(float)
Sets the value of the bone controller #2.
Definition: NSRenderableEntity.qc:869
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:112
nonvirtual void Event_SpawnDefBone(string, string)
Definition: NSRenderableEntity.qc:1138
nonvirtual void SetBodyInGroup(int, int)
Sets the body inside of a specific group.
Definition: NSRenderableEntity.qc:825
nonvirtual float GetBoneControl5(void)
Returns the value of the entity's bone controller #5.
Definition: NSRenderableEntity.qc:959
nonvirtual void SetRenderFX(float)
Sets the render FX type of the entity.
Definition: NSRenderableEntity.qc:834
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:899
virtual void Restore(string, string)
Similar to NSIO::SpawnKey but for save-game fields.
Definition: NSRenderableEntity.qc:1084
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition: NSRenderableEntity.qc:1222
virtual float predraw(void)
nonvirtual float GetBoneControl3(void)
Returns the value of the entity's bone controller #3.
Definition: NSRenderableEntity.qc:947
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition: NSRenderableEntity.qc:1164
nonvirtual vector GetRenderColor(void)
Returns the render color of the entity.
Definition: NSRenderableEntity.qc:929
nonvirtual float GetBoneControl2(void)
Returns the value of the entity's bone controller #2.
Definition: NSRenderableEntity.qc:941
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSRenderableEntity.qc:1063
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:794
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:965
virtual void MakeStatic(void)
Tells the engine to make the entity static, effectively making it inaccessible.
Definition: NSRenderableEntity.qc:91
nonvirtual void Event_SpawnDefAttachment(string, float)
Definition: NSRenderableEntity.qc:1151
nonvirtual void SetRenderMode(float)
Sets the render mode type of the entity.
Definition: NSRenderableEntity.qc:840
void NSRenderableEntity(void)
Definition: NSRenderableEntity.qc:18
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37