Rigs of Rods 2023.09
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
79
81
91
92
100
117{
118 return (dv == DEBUGVIEWTYPE_LAST) ? DEBUGVIEWTYPE_FIRST : static_cast<DebugViewType>(static_cast<int>(dv) + 1);
119}
120
130
132{
133 float animratio = 0;
136
143 float animOpt3 = 0;
144 float animOpt5 = 0;
145 float lower_limit = 0;
146 float upper_limit = 0;
147
148 // Only for SHIFTER
149 float shifterSmooth = 0.f;
150 float shifterStep = 0.f;
151 float shifterTarget = 0.f;
152};
153
155struct Prop
156{
161 Ogre::Vector3 pp_offset = Ogre::Vector3::ZERO;
162 Ogre::Vector3 pp_offset_orig = Ogre::Vector3::ZERO;
163 Ogre::Vector3 pp_rota = Ogre::Vector3::ZERO;
164 Ogre::Quaternion pp_rot = Ogre::Quaternion::IDENTITY;
165 Ogre::SceneNode* pp_scene_node = nullptr;
167 std::string pp_media[2];
168 std::vector<PropAnim> pp_animations;
169
175
176 // Special prop - steering wheel
178 Ogre::Vector3 pp_wheel_pos = Ogre::Vector3::ZERO;
179 Ogre::SceneNode* pp_wheel_scene_node = nullptr;
181
182 // Special prop - beacon
183 char pp_beacon_type = 0;
184 Ogre::BillboardSet* pp_beacon_bbs[4] = {};
185 Ogre::SceneNode* pp_beacon_scene_node[4] = {};
186 Ogre::Light* pp_beacon_light[4] = {};
187 float pp_beacon_rot_rate[4] = {};
188 float pp_beacon_rot_angle[4] = {};
189
190 // Special prop - aero engine
194
195 void setPropMeshesVisible(bool visible)
196 {
197 if (pp_mesh_obj)
198 pp_mesh_obj->setVisible(visible);
202 pp_beacon_scene_node[0]->setVisible(visible);
204 pp_beacon_scene_node[1]->setVisible(visible);
206 pp_beacon_scene_node[2]->setVisible(visible);
208 pp_beacon_scene_node[3]->setVisible(visible);
209 }
210};
211
234
237{
239 nx_node_idx(node_idx),
240 nx_no_particles(false), // Bitfields can't be initialized in-class :(
241 nx_may_get_wet(false),
242 nx_is_hot(false),
243 nx_no_sparks(true),
245 {}
246
247 float nx_wet_time_sec = -1;
249
250 // Bit flags
253 bool nx_is_hot:1;
256
257};
258
261{
262 BeamGfx();
263 ~BeamGfx();
264
265 // We don't keep pointer to the Ogre::Entity - we rely on the SceneNode keeping it attached all the time.
266 Ogre::SceneNode* rod_scenenode = nullptr;
267 uint16_t rod_beam_index = 0;
268 float rod_diameter = 0.f;
269
273 bool rod_is_visible = false;
274};
275
278{
280
283
284 // We don't keep pointer to the Ogre::Entity - we rely on the SceneNode keeping it attached all the time.
285 Ogre::SceneNode* fbx_scenenode = nullptr;
287 bool fbx_is_visible = false;
288};
289
292{
293 // AngelScript `dictionary` converts all primitives to `double` or `int64`, see 'scriptdictionary.cpp', function `Set()`
294
295 /*FreeBeamGfxID_t*/int64_t fbr_id = FREEBEAMGFXID_INVALID;
296
297 /*FreeForceID_t*/ int64_t fbr_freeforce_primary = FREEFORCEID_INVALID;
298 /*FreeForceID_t*/ int64_t fbr_freeforce_secondary = FREEFORCEID_INVALID;
299
300 std::string fbr_mesh_name = "beam.mesh";
301 std::string fbr_material_name = "tracks/beam";
303};
304
313
324
325struct FlareMaterial // materialflares
326{
328 Ogre::MaterialPtr mat_instance;
329 Ogre::ColourValue emissive_color;
330};
331
333{
336 Ogre::SceneNode *smokeNode = nullptr;
337 Ogre::ParticleSystem* smoker = nullptr;
338 std::string particleSystemName;
339};
340
342{
345 Ogre::SceneNode *snode = nullptr;
346 Ogre::ParticleSystem* psys = nullptr;
347};
348
350
351} // 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:90
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:85
const PropAnimFlag_t PROP_ANIM_FLAG_AIRBRAKE
Definition GfxData.h:49
constexpr DebugViewType DEBUGVIEWTYPE_LAST
Definition GfxData.h:115
ShifterPropAnim
< PropAnim::animOpt3 values for PROP_ANIM_FLAG_SHIFTER
Definition GfxData.h:122
const PropAnimMode_t PROP_ANIM_MODE_NOFLIP
Definition GfxData.h:89
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:102
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:84
VideoCamState
Definition GfxData.h:94
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:86
BitMask_t PropAnimMode_t
Definition GfxData.h:80
const PropAnimFlag_t PROP_ANIM_FLAG_BRUDDER
Definition GfxData.h:72
const PropAnimMode_t PROP_ANIM_MODE_AUTOANIMATE
Definition GfxData.h:88
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:83
DebugViewType NextDebugViewType(DebugViewType dv)
Definition GfxData.h:116
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
constexpr DebugViewType DEBUGVIEWTYPE_FIRST
Definition GfxData.h:114
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:87
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:82
const PropAnimFlag_t PROP_ANIM_FLAG_SPEEDO
Definition GfxData.h:58
@ SHIFTERMAN1
Definition GfxData.h:124
@ SHIFTER_INVALID
Definition GfxData.h:123
@ SHIFTERSEQ
Definition GfxData.h:126
@ AUTOSHIFTERLIN
Definition GfxData.h:128
@ SHIFTERMAN2
Definition GfxData.h:125
@ SHIFTERLIN
Definition GfxData.h:127
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:316
Ogre::Vector3 abx_offset
Definition GfxData.h:319
NodeNum_t abx_y_node
Definition GfxData.h:322
Ogre::SceneNode * abx_scenenode
Definition GfxData.h:317
NodeNum_t abx_ref_node
Definition GfxData.h:320
NodeNum_t abx_x_node
Definition GfxData.h:321
Ogre::Entity * abx_entity
Definition GfxData.h:318
Visuals of softbody beam (beam_t struct); Partially updated along with SimBuffer.
Definition GfxData.h:261
NodeNum_t rod_node2
Node index - may change during simulation!
Definition GfxData.h:271
uint16_t rod_beam_index
Definition GfxData.h:267
float rod_diameter
meters
Definition GfxData.h:268
Ogre::SceneNode * rod_scenenode
Definition GfxData.h:266
ActorPtr rod_target_actor
Definition GfxData.h:272
NodeNum_t rod_node1
Node index - may change during simulation!
Definition GfxData.h:270
bool rod_is_visible
Definition GfxData.h:273
NodeNum_t emitterNode
Definition GfxData.h:343
NodeNum_t directionNode
Definition GfxData.h:344
Ogre::ParticleSystem * psys
Definition GfxData.h:346
Ogre::SceneNode * snode
Definition GfxData.h:345
Ogre::ParticleSystem * smoker
This remains nullptr if removed via addonpart_unwanted_exhaust or Tuning UI.
Definition GfxData.h:337
NodeNum_t directionNode
Definition GfxData.h:335
Ogre::SceneNode * smokeNode
Definition GfxData.h:336
NodeNum_t emitterNode
Definition GfxData.h:334
std::string particleSystemName
Name in .particle file ~ for display in Tuning UI.
Definition GfxData.h:338
Ogre::ColourValue emissive_color
Definition GfxData.h:329
Ogre::MaterialPtr mat_instance
Definition GfxData.h:328
Visuals of a 'freebeam' (a pair of HALFBEAM_ freeforces)
Definition GfxData.h:278
FreeForceID_t fbx_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:282
FreeBeamGfxID_t fbx_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:279
float fbx_diameter
meters
Definition GfxData.h:286
Ogre::SceneNode * fbx_scenenode
Definition GfxData.h:285
bool fbx_is_visible
Definition GfxData.h:287
FreeForceID_t fbx_freeforce_primary
Required.
Definition GfxData.h:281
Used by MSG_EDI_[ADD/MODIFY]_FREEBEAMGFX_REQUESTED; tailored for use with AngelScript thru GameScript...
Definition GfxData.h:292
std::string fbr_material_name
Definition GfxData.h:301
double fbr_diameter
meters
Definition GfxData.h:302
int64_t fbr_freeforce_primary
Required.
Definition GfxData.h:297
int64_t fbr_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Definition GfxData.h:295
int64_t fbr_freeforce_secondary
Not required for fixed-end beams.
Definition GfxData.h:298
std::string fbr_mesh_name
Definition GfxData.h:300
Gfx attributes/state of a softbody node.
Definition GfxData.h:237
NodeNum_t nx_node_idx
Definition GfxData.h:248
bool nx_no_sparks
User-defined attr;.
Definition GfxData.h:255
NodeGfx(NodeNum_t node_idx)
Definition GfxData.h:238
bool nx_is_hot
User-defined attr; emits vapour particles when in contact with water.
Definition GfxData.h:253
bool nx_under_water_prev
State.
Definition GfxData.h:254
float nx_wet_time_sec
'Wet' means "already out of water, producing dripping particles". Set to -1 when not 'wet'.
Definition GfxData.h:247
bool nx_no_particles
User-defined attr; disable all particles.
Definition GfxData.h:251
bool nx_may_get_wet
Attr; enables water drip and vapour.
Definition GfxData.h:252
float upper_limit
The upper limit for the animation.
Definition GfxData.h:146
float shifterTarget
Definition GfxData.h:151
float shifterSmooth
Definition GfxData.h:149
float shifterStep
Definition GfxData.h:150
float lower_limit
The lower limit for the animation.
Definition GfxData.h:145
float animratio
A coefficient for the animation, prop degree if used with mode: rotation and propoffset if used with ...
Definition GfxData.h:133
PropAnimFlag_t animFlags
Definition GfxData.h:134
PropAnimMode_t animMode
Definition GfxData.h:135
float animOpt3
MULTIPURPOSE.
Definition GfxData.h:143
float animOpt5
Definition GfxData.h:144
A mesh attached to vehicle frame via 3 nodes.
Definition GfxData.h:156
float pp_beacon_rot_angle[4]
Radians.
Definition GfxData.h:188
Ogre::Quaternion pp_rot
Definition GfxData.h:164
MeshObject * pp_wheel_mesh_obj
Definition GfxData.h:177
void setPropMeshesVisible(bool visible)
Definition GfxData.h:195
Ogre::SceneNode * pp_beacon_scene_node[4]
Definition GfxData.h:185
CameraMode_t pp_camera_mode_active
Dynamic visibility mode {0 and higher = cinecam index}.
Definition GfxData.h:172
int pp_aero_engine_idx
Special - a turboprop/pistonprop reference.
Definition GfxData.h:191
CameraMode_t pp_camera_mode_orig
Dynamic visibility mode {0 and higher = cinecam index}.
Definition GfxData.h:173
NodeNum_t pp_node_ref
Definition GfxData.h:158
Ogre::Vector3 pp_rota
Definition GfxData.h:163
bool pp_aero_propeller_spin
Special - blurred spinning propeller effect.
Definition GfxData.h:193
NodeNum_t pp_node_y
Definition GfxData.h:160
Ogre::Vector3 pp_offset_orig
Used with ANIM_FLAG_OFFSET*.
Definition GfxData.h:162
Ogre::SceneNode * pp_scene_node
The pivot scene node (parented to root-node).
Definition GfxData.h:165
Ogre::Vector3 pp_offset
Definition GfxData.h:161
PropID_t pp_id
Definition GfxData.h:157
std::vector< PropAnim > pp_animations
Definition GfxData.h:168
std::string pp_media[2]
Redundant, for Tuning UI. Media1 = prop mesh name, Media2 = steeringwheel mesh/beaconprop flare mat.
Definition GfxData.h:167
NodeNum_t pp_node_x
Definition GfxData.h:159
Ogre::BillboardSet * pp_beacon_bbs[4]
Definition GfxData.h:184
char pp_beacon_type
Special prop: beacon {0 = none, 'b' = user-specified, 'r' = red, 'p' = police lightbar,...
Definition GfxData.h:183
bool pp_aero_propeller_blade
Special - single blade mesh.
Definition GfxData.h:192
Ogre::Light * pp_beacon_light[4]
Definition GfxData.h:186
Ogre::Vector3 pp_wheel_pos
Definition GfxData.h:178
Ogre::SceneNode * pp_wheel_scene_node
Definition GfxData.h:179
float pp_wheel_rot_degree
Definition GfxData.h:180
MeshObject * pp_mesh_obj
Optional; NULL if removed via tuneup/addonpart.
Definition GfxData.h:166
float pp_beacon_rot_rate[4]
Radians per second.
Definition GfxData.h:187
An Ogre::Camera mounted on the actor and rendering into either in-scene texture or external window.
Definition GfxData.h:215
Ogre::TexturePtr vcam_render_tex
Definition GfxData.h:229
NodeNum_t vcam_node_center
Definition GfxData.h:217
NodeNum_t vcam_node_alt_pos
Definition GfxData.h:220
Ogre::RenderWindow * vcam_render_window
Definition GfxData.h:231
VideoCamRole vcam_role
Definition GfxData.h:216
std::string vcam_off_tex_name
Used when videocamera is offline.
Definition GfxData.h:226
Ogre::RenderTexture * vcam_render_target
Definition GfxData.h:228
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:224
NodeNum_t vcam_node_lookat
Only for VCAM_ROLE_TRACK_CAM.
Definition GfxData.h:221
Ogre::Quaternion vcam_rotation
Definition GfxData.h:222
NodeNum_t vcam_node_dir_y
Definition GfxData.h:218
Ogre::Vector3 vcam_pos_offset
Definition GfxData.h:223
Ogre::SceneNode * vcam_debug_node
Definition GfxData.h:230
Ogre::SceneNode * vcam_prop_scenenode
Only for VCAM_ROLE_MIRROR_PROP_*.
Definition GfxData.h:232
Ogre::MaterialPtr vcam_material
Definition GfxData.h:225
Ogre::Camera * vcam_ogre_camera
Definition GfxData.h:227
NodeNum_t vcam_node_dir_z
Definition GfxData.h:219
Flexable * wx_flex_mesh
Definition GfxData.h:308
WheelID_t wx_wheel_id
Definition GfxData.h:307
std::string wx_rim_mesh_name
Redundant, for Tuning UI. Only for 'meshwheels[2]' and 'flexbodywheels'.
Definition GfxData.h:311
Ogre::SceneNode * wx_scenenode
Definition GfxData.h:309
WheelSide wx_side
Definition GfxData.h:310