Nuclide
Software Development Kit for id Technology (BETA)
RenderableEntity.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 RDENT_CHANGED_FRAMETIME
41} nsrenderableentity_changed_t;
42
43typedef enum
44{
45 RM_NORMAL = 0,
46 RM_COLOR = 1,
47 RM_TEXTURE = 2,
48 RM_GLOW = 3,
49 RM_SOLID = 4,
50 RM_ADDITIVE = 5,
51 RM_FULLBRIGHT = 6,
52 RM_ADDFRAC = 7, /* Source 2004 */
53 RM_WORLDGLOW = 9, /* Source 2004 */
54 RM_DONTRENDER = 10, /* Source 2004 */
55} rendermode_t;
56
57typedef enum
58{
59 RFX_NORMAL = 0,
60 RFX_SLOWPULSE = 1,
61 RFX_FASTPULSE = 2,
62 RFX_SLOWWIDEPULSE = 3,
63 RFX_FASTWIDEPULSE = 4,
64 RFX_SLOWFADEAWAY = 5,
65 RFX_FASTFADEAWAY = 6,
66 RFX_SLOWBECOMESOLID = 7,
67 RFX_FASTBECOMESOLID = 8,
68 RFX_SLOWSTROBE = 9,
69 RFX_FASTSTROBE = 10,
70 RFX_FASTERSTROBE = 11,
71 RFX_SLOWFLICKER = 12,
72 RFX_FASTFLICKER = 13,
73 RFX_CONSTANTGLOW = 14,
74 RFX_DISTORT = 15,
75 RFX_HOLOGRAM = 16,
76 RFX_GLOWSHELL = 19,
77 RFX_GLOWSHELL2 = 20,
78 RFX_Q2PULSE = 21
79} renderfx_t;
80
81#ifdef CLIENT
82var int autocvar_rm_unlit_additive = TRUE;
83var int autocvar_rm_unlit_texture = TRUE;
84#endif
85
95{
96public:
97 void ncRenderableEntity(void);
98
99 virtual void OnRemoveEntity(void);
100
101 /* overrides */
102 virtual void SpawnKey(string,string);
103#ifdef SERVER
104 virtual void Input(entity,string,string);
105 virtual void Respawn(void);
106 virtual void Save(float);
107 virtual void Restore(string,string);
108 virtual void EvaluateEntity(void);
109 virtual float SendEntity(entity,float);
110
111 nonvirtual void Event_SpawnDefBone(string, string);
112 nonvirtual void Event_SpawnDefAttachment(string, float);
113#endif
114
115#ifdef CLIENT
116 virtual void RenderDebugSkeleton(void);
117 virtual void ReceiveEntity(float,float);
118 virtual float predraw(void);
119 virtual void postdraw(void);
120 virtual void ReloadVideoResources();
121#endif
122
123 virtual void MakeStatic(void);
124
125 /* model events */
127 virtual void HandleAnimEvent(float,int,string);
128
129 /* set */
131 nonvirtual void SetBody(int);
133 nonvirtual void SetBodyInGroup(int, int);
135 nonvirtual void SetRenderFX(float);
137 nonvirtual void SetRenderMode(float);
139 nonvirtual void SetRenderAmt(float);
141 nonvirtual void SetRenderColor(vector);
143 nonvirtual void SetBoneController1(float);
145 nonvirtual void SetBoneController2(float);
147 nonvirtual void SetBoneController3(float);
149 nonvirtual void SetBoneController4(float);
151 nonvirtual void SetBoneController5(float);
153 nonvirtual void SetAxialScale(vector);
154
156 nonvirtual int GetBody(void);
158 nonvirtual int GetBodyInGroup(int);
160 nonvirtual float GetRenderMode(void);
162 nonvirtual float GetRenderFX(void);
164 nonvirtual float GetRenderAmt(void);
166 nonvirtual vector GetRenderColor(void);
168 nonvirtual float GetBoneController1(void);
170 nonvirtual float GetBoneController2(void);
172 nonvirtual float GetBoneController3(void);
174 nonvirtual float GetBoneController4(void);
176 nonvirtual float GetBoneController5(void);
178 nonvirtual vector GetAxialScale(void);
179
180#ifdef CLIENT
182 nonvirtual void RenderFXPass(void);
183 nonvirtual void RenderAxialScale(void);
184 nonvirtual void RenderGLQuakeShadow(void);
185#endif
186
187private:
188 /* new */
189 NETWORKED_FLOAT(m_studioBoneController1)
190 NETWORKED_FLOAT(m_studioBoneController2)
191 NETWORKED_FLOAT(m_studioBoneController3)
192 NETWORKED_FLOAT(m_studioBoneController4)
193 NETWORKED_FLOAT(m_studioBoneController5)
194 NETWORKED_FLOAT_N(modelflags)
195 NETWORKED_INT(m_geomsetField)
196 NETWORKED_FLOAT_N(colormap)
197 NETWORKED_VECTOR_N(glowmod)
198 NETWORKED_FLOAT_N(frame1time)
199
200 NETWORKED_FLOAT_N(modelindex2)
201 NETWORKED_FLOAT_N(modelindex3)
202 NETWORKED_FLOAT_N(modelindex4)
203 NETWORKED_FLOAT(m_renderFX)
204 NETWORKED_FLOAT(m_renderMode)
205 NETWORKED_FLOAT(m_renderAmount)
206 NETWORKED_VECTOR(m_renderColor)
207 NETWORKED_VECTOR(m_axialScale)
208
209 /* either a sprite model or a particle */
210 NETWORKED_INT(m_iMuzzleModel)
211 NETWORKED_INT(m_iMuzzlePart)
212 NETWORKED_FLOAT(m_flMuzzleScale)
213
214 /* model events */
215 float m_modelEventTime;
216 float m_iNumBones;
217 nonvirtual void _UpdateBoneCount();
218
219#ifdef CLIENT
220 float m_studioBoneController1Spin;
221 float m_studioBoneController2Spin;
222 float m_studioBoneController3Spin;
223 float m_studioBoneController4Spin;
224 float m_studioBoneController5Spin;
225 float m_netEffects;
226
227 /* muzzle cache */
228 string m_muzzPartSmoke;
229 vector m_muzzOffset;
230 vector m_muzzRelativeOffset;
231 float m_fiJointMuzzle; /* World Model only */
232 float m_fiJointBarrel; /* View Model only */
233
234 nonvirtual void _UpdateGeomset();
235#endif
236};
237
238.float modelindex2;
239.float modelindex3;
240.float modelindex4;
ncEntity is the lowest of the user-accessible entity class.
Definition: Entity.h:75
This entity represents any ncEntity with advanced rendering properties.
Definition: RenderableEntity.h:95
nonvirtual void SetBoneController1(float)
Sets the value of the bone controller #1.
Definition: RenderableEntity.qc:990
nonvirtual vector GetRenderColor(void)
Returns the render color of the entity.
Definition: RenderableEntity.qc:1056
nonvirtual int GetBodyInGroup(int)
Returns the body within a given group.
Definition: RenderableEntity.qc:1032
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition: RenderableEntity.qc:133
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: RenderableEntity.qc:1298
nonvirtual void Event_SpawnDefAttachment(string, float)
Definition: RenderableEntity.qc:1374
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition: RenderableEntity.qc:1460
virtual void Restore(string, string)
Similar to ncIO::SpawnKey() but for save-game fields.
Definition: RenderableEntity.qc:1316
nonvirtual void SetAxialScale(vector)
Sets the axial, anisotropic scale of an entity, affecting the individual axis (forward,...
Definition: RenderableEntity.qc:1020
nonvirtual void SetRenderFX(float)
Sets the render FX type of the entity.
Definition: RenderableEntity.qc:961
nonvirtual float GetRenderFX(void)
Returns the render FX of the entity.
Definition: RenderableEntity.qc:1044
virtual void ReloadVideoResources()
Client: Called when video resources need to be allocated or reloaded for the entity.
Definition: RenderableEntity.qc:46
nonvirtual float GetBoneController2(void)
Returns the value of the entity's bone controller #2.
Definition: RenderableEntity.qc:1068
nonvirtual vector GetAxialScale(void)
Returns the axial/anisotropic scale of the entity, same as input format (forward, right,...
Definition: RenderableEntity.qc:1092
nonvirtual void SetBoneController2(float)
Sets the value of the bone controller #2.
Definition: RenderableEntity.qc:996
nonvirtual void SetBoneController4(float)
Sets the value of the bone controller #4.
Definition: RenderableEntity.qc:1008
nonvirtual void SetBody(int)
Sets the bodygroup of the entity.
Definition: RenderableEntity.qc:942
nonvirtual void RenderGLQuakeShadow(void)
virtual void MakeStatic(void)
Tells the engine to make the entity static, effectively making it inaccessible.
Definition: RenderableEntity.qc:112
nonvirtual void SetRenderAmt(float)
Sets the render amount of the entity.
Definition: RenderableEntity.qc:973
virtual float predraw(void)
nonvirtual void SetRenderMode(float)
Sets the render mode type of the entity.
Definition: RenderableEntity.qc:967
nonvirtual float GetRenderAmt(void)
Returns the render amount of the entity.
Definition: RenderableEntity.qc:1050
nonvirtual void RenderFXPass(void)
Called by predraw(); and will set the appropriate rendering specific fields.
nonvirtual void SetBodyInGroup(int, int)
Sets the body inside of a specific group.
Definition: RenderableEntity.qc:952
virtual void postdraw(void)
Client: Run after the rendering of 3D world is complete.
nonvirtual int GetBody(void)
Returns the bodygroup of the entity.
Definition: RenderableEntity.qc:1026
nonvirtual void RenderAxialScale(void)
nonvirtual float GetBoneController5(void)
Returns the value of the entity's bone controller #5.
Definition: RenderableEntity.qc:1086
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
virtual void OnRemoveEntity(void)
Handles what happens before the entity gets removed from the client game.
Definition: RenderableEntity.qc:90
nonvirtual float GetBoneController3(void)
Returns the value of the entity's bone controller #3.
Definition: RenderableEntity.qc:1074
nonvirtual void SetBoneController3(float)
Sets the value of the bone controller #3.
Definition: RenderableEntity.qc:1002
virtual void RenderDebugSkeleton(void)
void ncRenderableEntity(void)
Definition: RenderableEntity.qc:18
nonvirtual float GetRenderMode(void)
Returns the render mode of the entity.
Definition: RenderableEntity.qc:1038
nonvirtual void Event_SpawnDefBone(string, string)
Definition: RenderableEntity.qc:1361
nonvirtual void SetRenderColor(vector)
Sets the render color of the entity.
Definition: RenderableEntity.qc:979
virtual void HandleAnimEvent(float, int, string)
Callback for any model event that gets triggered while playing a framegroup.
Definition: RenderableEntity.qc:1098
nonvirtual float GetBoneController1(void)
Returns the value of the entity's bone controller #1.
Definition: RenderableEntity.qc:1062
virtual void Respawn(void)
Server: Called when the entity first spawns or when game-logic requests the entity to return to its o...
Definition: RenderableEntity.qc:920
nonvirtual void SetBoneController5(float)
Sets the value of the bone controller #5.
Definition: RenderableEntity.qc:1014
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition: RenderableEntity.qc:1387
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition: RenderableEntity.qc:199
nonvirtual float GetBoneController4(void)
Returns the value of the entity's bone controller #4.
Definition: RenderableEntity.qc:1080
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37