Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
GfxData.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2016-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22/*
23 @file
24 @brief Constants and data structures dedicated exclusively to visualization.
25 For simulation-related data structures, see 'physics/SimData.h'
26*/
27
28#pragma once
29
30#include "MeshObject.h"
31#include "SimConstants.h"
32
33#include <Ogre.h>
34#include <stdint.h>
35#include <string>
36
37namespace RoR {
38
41
43
80
82
92
93
101
118{
119 return (dv == DEBUGVIEWTYPE_LAST) ? DEBUGVIEWTYPE_FIRST : static_cast<DebugViewType>(static_cast<int>(dv) + 1);
120}
121
131
133{
134 float animratio = 0;
137
144 float animOpt3 = 0;
145 float animOpt5 = 0;
146 float lower_limit = 0;
147 float upper_limit = 0;
148
149 // Only for SHIFTER
150 float shifterSmooth = 0.f;
151 float shifterStep = 0.f;
152 float shifterTarget = 0.f;
153};
154
156struct Prop
157{
162 Ogre::Vector3 pp_offset = Ogre::Vector3::ZERO;
163 Ogre::Vector3 pp_offset_orig = Ogre::Vector3::ZERO;
164 Ogre::Vector3 pp_rota = Ogre::Vector3::ZERO;
165 Ogre::Quaternion pp_rot = Ogre::Quaternion::IDENTITY;
166 Ogre::SceneNode* pp_scene_node = nullptr;
168 std::string pp_media[2];
169 std::vector<PropAnim> pp_animations;
170
176
177 // Special prop - steering wheel
179 Ogre::Vector3 pp_wheel_pos = Ogre::Vector3::ZERO;
180 Ogre::SceneNode* pp_wheel_scene_node = nullptr;
182
183 // Special prop - beacon
184 char pp_beacon_type = 0;
185 Ogre::BillboardSet* pp_beacon_bbs[4] = {};
186 Ogre::SceneNode* pp_beacon_scene_node[4] = {};
187 Ogre::Light* pp_beacon_light[4] = {};
188 float pp_beacon_rot_rate[4] = {};
189 float pp_beacon_rot_angle[4] = {};
190
191 // Special prop - aero engine
195
196 void setPropMeshesVisible(bool visible)
197 {
198 if (pp_mesh_obj)
199 pp_mesh_obj->setVisible(visible);
203 pp_beacon_scene_node[0]->setVisible(visible);
205 pp_beacon_scene_node[1]->setVisible(visible);
207 pp_beacon_scene_node[2]->setVisible(visible);
209 pp_beacon_scene_node[3]->setVisible(visible);
210 }
211};
212
235
238{
240 nx_node_idx(node_idx),
241 nx_no_particles(false), // Bitfields can't be initialized in-class :(
242 nx_may_get_wet(false),
243 nx_is_hot(false),
244 nx_no_sparks(true),
246 {}
247
248 float nx_wet_time_sec = -1;
250
251 // Bit flags
254 bool nx_is_hot:1;
257
258};
259
262{
263 BeamGfx();
264 ~BeamGfx();
265
266 // We don't keep pointer to the Ogre::Entity - we rely on the SceneNode keeping it attached all the time.
267 Ogre::SceneNode* rod_scenenode = nullptr;
268 uint16_t rod_beam_index = 0;
269 float rod_diameter = 0.f;
270
274 bool rod_is_visible = false;
275};
276
279{
281
284
285 // We don't keep pointer to the Ogre::Entity - we rely on the SceneNode keeping it attached all the time.
286 Ogre::SceneNode* fbx_scenenode = nullptr;
288 bool fbx_is_visible = false;
289};
290
293{
294 // AngelScript `dictionary` converts all primitives to `double` or `int64`, see 'scriptdictionary.cpp', function `Set()`
295
296 /*FreeBeamGfxID_t*/int64_t fbr_id = FREEBEAMGFXID_INVALID;
297
298 /*FreeForceID_t*/ int64_t fbr_freeforce_primary = FREEFORCEID_INVALID;
299 /*FreeForceID_t*/ int64_t fbr_freeforce_secondary = FREEFORCEID_INVALID;
300
301 std::string fbr_mesh_name = "beam.mesh";
302 std::string fbr_material_name = "tracks/beam";
304};
305
314
325
326struct FlareMaterial // materialflares
327{
329 Ogre::MaterialPtr mat_instance;
330 Ogre::ColourValue emissive_color;
331};
332
334{
337 Ogre::SceneNode *smokeNode = nullptr;
338 Ogre::ParticleSystem* smoker = nullptr;
339 std::string particleSystemName;
340};
341
343{
346 Ogre::SceneNode *snode = nullptr;
347 Ogre::ParticleSystem* psys = nullptr;
348};
349
351
352} // namespace RoR
#define BITMASK(OFFSET)
Definition BitFlags.h:10
uint64_t BitMask64_t
Definition BitFlags.h:8
#define BITMASK64(OFFSET)
Definition BitFlags.h:11
uint32_t BitMask_t
Definition BitFlags.h:7
void setVisible(bool b)
const PropAnimFlag_t PROP_ANIM_FLAG_ROLL
Definition GfxData.h:50
const PropAnimFlag_t PROP_ANIM_FLAG_AESTATUS
Definition GfxData.h:64
const PropAnimFlag_t PROP_ANIM_FLAG_ARUDDER
Definition GfxData.h:71
const PropAnimFlag_t PROP_ANIM_FLAG_TACHO
Definition GfxData.h:57
const PropAnimFlag_t PROP_ANIM_FLAG_ALTIMETER
Definition GfxData.h:46
const PropAnimFlag_t PROP_ANIM_FLAG_CLUTCH
Definition GfxData.h:56
const PropAnimFlag_t PROP_ANIM_FLAG_PITCH
Definition GfxData.h:51
const PropAnimMode_t PROP_ANIM_MODE_BOUNCE
Definition GfxData.h:91
const PropAnimFlag_t PROP_ANIM_FLAG_TORQUE
Definition GfxData.h:65
const PropAnimFlag_t PROP_ANIM_FLAG_ELEVATORS
Definition GfxData.h:75
const PropAnimMode_t PROP_ANIM_MODE_OFFSET_X
Definition GfxData.h:86
const PropAnimFlag_t PROP_ANIM_FLAG_AIRBRAKE
Definition GfxData.h:49
constexpr DebugViewType DEBUGVIEWTYPE_LAST
Definition GfxData.h:116
ShifterPropAnim
< PropAnim::animOpt3 values for PROP_ANIM_FLAG_SHIFTER
Definition GfxData.h:123
const PropAnimMode_t PROP_ANIM_MODE_NOFLIP
Definition GfxData.h:90
const PropAnimFlag_t PROP_ANIM_FLAG_SIGNALSTALK
Turn indicator stalk position (-1=left, 0=off, 1=right)
Definition GfxData.h:77
DebugViewType
Definition GfxData.h:103
const PropAnimFlag_t PROP_ANIM_FLAG_FLAP
Definition GfxData.h:48
const PropAnimFlag_t PROP_ANIM_FLAG_AILERONS
Definition GfxData.h:70
const PropAnimMode_t PROP_ANIM_MODE_ROTA_Z
Definition GfxData.h:85
VideoCamState
Definition GfxData.h:95
const PropAnimFlag_t PROP_ANIM_FLAG_DASHBOARD
Used with dashboard system inputs, see enum DashData in file DashBoardManager.h.
Definition GfxData.h:76
const PropAnimMode_t PROP_ANIM_MODE_OFFSET_Y
Definition GfxData.h:87
BitMask_t PropAnimMode_t
Definition GfxData.h:81
const PropAnimFlag_t PROP_ANIM_FLAG_BRUDDER
Definition GfxData.h:72
const PropAnimMode_t PROP_ANIM_MODE_AUTOANIMATE
Definition GfxData.h:89
const PropAnimFlag_t PROP_ANIM_FLAG_AIRSPEED
Definition GfxData.h:44
const PropAnimFlag_t PROP_ANIM_FLAG_TURBO
Definition GfxData.h:60
const PropAnimMode_t PROP_ANIM_MODE_ROTA_Y
Definition GfxData.h:84
DebugViewType NextDebugViewType(DebugViewType dv)
Definition GfxData.h:117
const PropAnimFlag_t PROP_ANIM_FLAG_AOA
Definition GfxData.h:47
const PropAnimFlag_t PROP_ANIM_FLAG_VVI
Definition GfxData.h:45
const PropAnimFlag_t PROP_ANIM_FLAG_BTHROTTLE
Definition GfxData.h:73
const PropAnimFlag_t PROP_ANIM_FLAG_THROTTLE
Definition GfxData.h:52
const PropAnimFlag_t PROP_ANIM_FLAG_PBRAKE
Definition GfxData.h:59
const PropAnimFlag_t PROP_ANIM_FLAG_IGNITION
Definition GfxData.h:79
constexpr DebugViewType DEBUGVIEWTYPE_FIRST
Definition GfxData.h:115
const PropAnimFlag_t PROP_ANIM_FLAG_PERMANENT
Definition GfxData.h:74
const PropAnimFlag_t PROP_ANIM_FLAG_RPM
Definition GfxData.h:53
const PropAnimFlag_t PROP_ANIM_FLAG_HEADING
Definition GfxData.h:66
const PropAnimFlag_t PROP_ANIM_FLAG_AETORQUE
Definition GfxData.h:62
const PropAnimFlag_t PROP_ANIM_FLAG_EVENT
Definition GfxData.h:69
const PropAnimFlag_t PROP_ANIM_FLAG_GEAR
'gearreverse' (animOpt3=-1), 'gearneutral' (animOpt3=0), 'gear#' (animOpt3=#)
Definition GfxData.h:78
const PropAnimFlag_t PROP_ANIM_FLAG_DIFFLOCK
Definition GfxData.h:67
BitMask64_t PropAnimFlag_t
Definition GfxData.h:42
const PropAnimFlag_t PROP_ANIM_FLAG_ACCEL
Definition GfxData.h:54
const PropAnimFlag_t PROP_ANIM_FLAG_STEERING
Definition GfxData.h:68
const PropAnimMode_t PROP_ANIM_MODE_OFFSET_Z
Definition GfxData.h:88
const PropAnimFlag_t PROP_ANIM_FLAG_BRAKE
Definition GfxData.h:55
const PropAnimFlag_t PROP_ANIM_FLAG_SHIFTER
'shifterman1, shifterman2, sequential, shifterlin, autoshifterlin'; animOpt3: see RoR::ShifterPropAni...
Definition GfxData.h:61
const PropAnimFlag_t PROP_ANIM_FLAG_AEPITCH
Definition GfxData.h:63
const PropAnimMode_t PROP_ANIM_MODE_ROTA_X
Definition GfxData.h:83
const PropAnimFlag_t PROP_ANIM_FLAG_SPEEDO
Definition GfxData.h:58
@ SHIFTERMAN1
Definition GfxData.h:125
@ SHIFTER_INVALID
Definition GfxData.h:124
@ SHIFTERSEQ
Definition GfxData.h:127
@ AUTOSHIFTERLIN
Definition GfxData.h:129
@ SHIFTERMAN2
Definition GfxData.h:126
@ SHIFTERLIN
Definition GfxData.h:128
static const float DEFAULT_BEAM_DIAMETER
5 centimeters default beam width
static const NodeNum_t NODENUM_INVALID
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
WheelSide
Used by rig-def/addonpart/tuneup formats to specify wheel rim mesh orientation.
static const FreeBeamGfxID_t FREEBEAMGFXID_INVALID
VideoCamRole
@ VCAM_ROLE_INVALID
int WheelID_t
Index to Actor::ar_wheels, use RoR::WHEELID_INVALID as empty value.
static const WheelID_t WHEELID_INVALID
int PropID_t
Index to GfxActor::m_props, use RoR::PROPID_INVALID as empty value.
static CameraMode_t CAMERA_MODE_ALWAYS_VISIBLE
int CameraMode_t
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
static const PropID_t PROPID_INVALID
int FreeBeamGfxID_t
Index into GfxScene::m_gfx_freebeams, use RoR::FREEBEAMGFXID_INVALID as empty value.
static const FreeForceID_t FREEFORCEID_INVALID
Ogre::MeshPtr abx_mesh
Definition GfxData.h:317
Ogre::Vector3 abx_offset
Definition GfxData.h:320
NodeNum_t abx_y_node
Definition GfxData.h:323
Ogre::SceneNode * abx_scenenode
Definition GfxData.h:318
NodeNum_t abx_ref_node
Definition GfxData.h:321
NodeNum_t abx_x_node
Definition GfxData.h:322
Ogre::Entity * abx_entity
Definition GfxData.h:319
Visuals of softbody beam (beam_t struct); Partially updated along with SimBuffer.
Definition GfxData.h:262
NodeNum_t rod_node2
Node index - may change during simulation!
Definition GfxData.h:272
uint16_t rod_beam_index
Definition GfxData.h:268
float rod_diameter
meters
Definition GfxData.h:269
Ogre::SceneNode * rod_scenenode
Definition GfxData.h:267
ActorPtr rod_target_actor
Definition GfxData.h:273
NodeNum_t rod_node1
Node index - may change during simulation!
Definition GfxData.h:271
bool rod_is_visible
Definition GfxData.h:274
NodeNum_t emitterNode
Definition GfxData.h:344
NodeNum_t directionNode
Definition GfxData.h:345
Ogre::ParticleSystem * psys
Definition GfxData.h:347
Ogre::SceneNode * snode
Definition GfxData.h:346
Ogre::ParticleSystem * smoker
This remains nullptr if removed via addonpart_unwanted_exhaust or Tuning UI.
Definition GfxData.h:338
NodeNum_t directionNode
Definition GfxData.h:336
Ogre::SceneNode * smokeNode
Definition GfxData.h:337
NodeNum_t emitterNode
Definition GfxData.h:335
std::string particleSystemName
Name in .particle file ~ for display in Tuning UI.
Definition GfxData.h:339
Ogre::ColourValue emissive_color
Definition GfxData.h:330
Ogre::MaterialPtr mat_instance
Definition GfxData.h:329
Visuals of a 'freebeam' (a pair of HALFBEAM_ freeforces)
Definition GfxData.h:279
FreeForceID_t fbx_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:283
FreeBeamGfxID_t fbx_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:280
float fbx_diameter
meters
Definition GfxData.h:287
Ogre::SceneNode * fbx_scenenode
Definition GfxData.h:286
bool fbx_is_visible
Definition GfxData.h:288
FreeForceID_t fbx_freeforce_primary
Required.
Definition GfxData.h:282
Used by MSG_EDI_[ADD/MODIFY]_FREEBEAMGFX_REQUESTED; tailored for use with AngelScript thru GameScript...
Definition GfxData.h:293
std::string fbr_material_name
Definition GfxData.h:302
double fbr_diameter
meters
Definition GfxData.h:303
int64_t fbr_freeforce_primary
Required.
Definition GfxData.h:298
int64_t fbr_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:296
int64_t fbr_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:299
std::string fbr_mesh_name
Definition GfxData.h:301
Gfx attributes/state of a softbody node.
Definition GfxData.h:238
NodeNum_t nx_node_idx
Definition GfxData.h:249
bool nx_no_sparks
User-defined attr;.
Definition GfxData.h:256
NodeGfx(NodeNum_t node_idx)
Definition GfxData.h:239
bool nx_is_hot
User-defined attr; emits vapour particles when in contact with water.
Definition GfxData.h:254
bool nx_under_water_prev
State.
Definition GfxData.h:255
float nx_wet_time_sec
'Wet' means "already out of water, producing dripping particles". Set to -1 when not 'wet'.
Definition GfxData.h:248
bool nx_no_particles
User-defined attr; disable all particles.
Definition GfxData.h:252
bool nx_may_get_wet
Attr; enables water drip and vapour.
Definition GfxData.h:253
float upper_limit
The upper limit for the animation.
Definition GfxData.h:147
float shifterTarget
Definition GfxData.h:152
float shifterSmooth
Definition GfxData.h:150
float shifterStep
Definition GfxData.h:151
float lower_limit
The lower limit for the animation.
Definition GfxData.h:146
float animratio
A coefficient for the animation, prop degree if used with mode: rotation and propoffset if used with ...
Definition GfxData.h:134
PropAnimFlag_t animFlags
Definition GfxData.h:135
PropAnimMode_t animMode
Definition GfxData.h:136
float animOpt3
MULTIPURPOSE.
Definition GfxData.h:144
float animOpt5
Definition GfxData.h:145
A mesh attached to vehicle frame via 3 nodes.
Definition GfxData.h:157
float pp_beacon_rot_angle[4]
Radians.
Definition GfxData.h:189
Ogre::Quaternion pp_rot
Definition GfxData.h:165
MeshObject * pp_wheel_mesh_obj
Definition GfxData.h:178
void setPropMeshesVisible(bool visible)
Definition GfxData.h:196
Ogre::SceneNode * pp_beacon_scene_node[4]
Definition GfxData.h:186
CameraMode_t pp_camera_mode_active
Dynamic visibility mode {0 and higher = cinecam index}.
Definition GfxData.h:173
int pp_aero_engine_idx
Special - a turboprop/pistonprop reference.
Definition GfxData.h:192
CameraMode_t pp_camera_mode_orig
Dynamic visibility mode {0 and higher = cinecam index}.
Definition GfxData.h:174
NodeNum_t pp_node_ref
Definition GfxData.h:159
Ogre::Vector3 pp_rota
Definition GfxData.h:164
bool pp_aero_propeller_spin
Special - blurred spinning propeller effect.
Definition GfxData.h:194
NodeNum_t pp_node_y
Definition GfxData.h:161
Ogre::Vector3 pp_offset_orig
Used with ANIM_FLAG_OFFSET*.
Definition GfxData.h:163
Ogre::SceneNode * pp_scene_node
The pivot scene node (parented to root-node).
Definition GfxData.h:166
Ogre::Vector3 pp_offset
Definition GfxData.h:162
PropID_t pp_id
Definition GfxData.h:158
std::vector< PropAnim > pp_animations
Definition GfxData.h:169
std::string pp_media[2]
Redundant, for Tuning UI. Media1 = prop mesh name, Media2 = steeringwheel mesh/beaconprop flare mat.
Definition GfxData.h:168
NodeNum_t pp_node_x
Definition GfxData.h:160
Ogre::BillboardSet * pp_beacon_bbs[4]
Definition GfxData.h:185
char pp_beacon_type
Special prop: beacon {0 = none, 'b' = user-specified, 'r' = red, 'p' = police lightbar,...
Definition GfxData.h:184
bool pp_aero_propeller_blade
Special - single blade mesh.
Definition GfxData.h:193
Ogre::Light * pp_beacon_light[4]
Definition GfxData.h:187
Ogre::Vector3 pp_wheel_pos
Definition GfxData.h:179
Ogre::SceneNode * pp_wheel_scene_node
Definition GfxData.h:180
float pp_wheel_rot_degree
Definition GfxData.h:181
MeshObject * pp_mesh_obj
Optional; NULL if removed via tuneup/addonpart.
Definition GfxData.h:167
float pp_beacon_rot_rate[4]
Radians per second.
Definition GfxData.h:188
An Ogre::Camera mounted on the actor and rendering into either in-scene texture or external window.
Definition GfxData.h:216
Ogre::TexturePtr vcam_render_tex
Definition GfxData.h:230
NodeNum_t vcam_node_center
Definition GfxData.h:218
NodeNum_t vcam_node_alt_pos
Definition GfxData.h:221
Ogre::RenderWindow * vcam_render_window
Definition GfxData.h:232
VideoCamRole vcam_role
Definition GfxData.h:217
std::string vcam_off_tex_name
Used when videocamera is offline.
Definition GfxData.h:227
Ogre::RenderTexture * vcam_render_target
Definition GfxData.h:229
std::string vcam_mat_name_orig
For display in Tuning UI: Original material name from rig-def file, without per-actor stamping.
Definition GfxData.h:225
NodeNum_t vcam_node_lookat
Only for VCAM_ROLE_TRACK_CAM.
Definition GfxData.h:222
Ogre::Quaternion vcam_rotation
Definition GfxData.h:223
NodeNum_t vcam_node_dir_y
Definition GfxData.h:219
Ogre::Vector3 vcam_pos_offset
Definition GfxData.h:224
Ogre::SceneNode * vcam_debug_node
Definition GfxData.h:231
Ogre::SceneNode * vcam_prop_scenenode
Only for VCAM_ROLE_MIRROR_PROP_*.
Definition GfxData.h:233
Ogre::MaterialPtr vcam_material
Definition GfxData.h:226
Ogre::Camera * vcam_ogre_camera
Definition GfxData.h:228
NodeNum_t vcam_node_dir_z
Definition GfxData.h:220
Flexable * wx_flex_mesh
Definition GfxData.h:309
WheelID_t wx_wheel_id
Definition GfxData.h:308
std::string wx_rim_mesh_name
Redundant, for Tuning UI. Only for 'meshwheels[2]' and 'flexbodywheels'.
Definition GfxData.h:312
Ogre::SceneNode * wx_scenenode
Definition GfxData.h:310
WheelSide wx_side
Definition GfxData.h:311