|
RigsofRods
Soft-body Physics Simulation
|
Go to the documentation of this file.
36 #include <OgreString.h>
146 Exception(Ogre::String
const & message):runtime_error(message) {}
233 Ogre::String
const & airfoil,
247 unsigned int num_rays,
255 std::shared_ptr<RigDef::BeamDefaults> beam_defaults,
257 float max_extension = 0.f);
265 std::shared_ptr<RigDef::BeamDefaults> beam_defaults,
266 float max_contraction = -1.f,
267 float max_extension = -1.f,
275 unsigned int num_rays,
278 node_t *reference_arm_node,
279 unsigned int reserve_nodes,
280 unsigned int reserve_beams,
284 std::shared_ptr<RigDef::NodeDefaults> node_defaults,
286 float wheel_width = -1.f);
291 void InitNode(
unsigned int node_index, Ogre::Vector3
const & position);
292 void InitNode(
node_t & node, Ogre::Vector3
const & position, std::shared_ptr<RigDef::NodeDefaults> node_defaults);
323 std::string
ComposeName(
const std::string&
object,
int number = -1);
338 Ogre::Vector3
const & ref,
339 Ogre::Vector3
const &
x,
340 Ogre::Vector3
const &
y,
341 Ogre::Vector3
const & aref);
346 std::vector<RigDef::Node::Range> & node_ranges,
347 std::vector<NodeNum_t> & out_node_indices);
377 void CreateBeamVisuals(
beam_t const& beam,
int beam_index,
bool visible, std::shared_ptr<RigDef::BeamDefaults>
const& beam_defaults, std::string material_override=
"");
382 Ogre::ParticleSystem*
CreateParticleSystem(std::string
const & name, std::string
const & template_name);
387 void SetupNewEntity(Ogre::Entity* e, Ogre::ColourValue simple_color);
388 Ogre::MaterialPtr
InstantiateManagedMaterial(Ogre::String
const & rg_name, Ogre::String
const & source_name, Ogre::String
const & clone_name);
398 unsigned int def_num_rays,
399 Ogre::String
const& face_material_name,
400 Ogre::String
const& face_material_rg,
401 Ogre::String
const& band_material_name,
402 Ogre::String
const& band_material_rg,
404 float rim_ratio = 1.f
415 std::string rim_mesh_name,
416 std::string rim_mesh_rg,
417 std::string tire_mesh_name,
418 std::string tire_mesh_rg);
425 unsigned int num_rays,
427 Ogre::String mesh_name,
428 Ogre::String mesh_rg,
429 Ogre::String material_name,
430 Ogre::String material_rg,
457 std::list<std::shared_ptr<RigDef::Document::Module>>
void ProcessWing(RigDef::Wing &def)
std::shared_ptr< RigDef::Document::Module > m_current_module
For resolving addonparts.
bool CheckSubmeshLimit(unsigned int count)
void ProcessHook(RigDef::Hook &def)
static void AddSoundSource(ActorPtr const &vehicle, SoundScriptInstancePtr sound_script, NodeNum_t node_index, int type=-2)
void ProcessHydro(RigDef::Hydro &def)
Legacy parser resolved references on-the-fly and the condition to check named nodes was "are there an...
RigDef::Keyword m_current_keyword
For error reports.
void ProcessSubmesh(RigDef::Submesh &def)
void ProcessGlobals(RigDef::Globals &def)
std::string m_custom_resource_group
void ProcessFlare2(RigDef::Flare2 &def)
beam_t & GetBeam(unsigned int index)
void ProcessRope(RigDef::Rope &def)
bool CheckCameraRailLimit(unsigned int count)
void ProcessSoundSource(RigDef::SoundSource &def)
RigDef::MaterialFlareBinding * FindFlareBindingForMaterial(std::string const &material_name)
Returns NULL if none found.
void ConfigureSections(Ogre::String const §ionconfig, RigDef::DocumentPtr def)
WheelID_t AddWheel2(RigDef::Wheel2 &wheel_2_def)
void ProcessMinimass(RigDef::Minimass &def)
void ProcessEngine(RigDef::Engine &def)
void ProcessGuiSettings(RigDef::GuiSettings &def)
RigDef::DocumentPtr m_file
void ProcessBrakes(RigDef::Brakes &def)
A series of RailSegment-s for SlideNode to slide along. Can be closed in a loop.
Ogre::SceneNode * m_particles_parent_scenenode
this isn't used for moving/hiding things, just helps developers inspect the scene graph.
Ogre::SceneNode * m_actor_grouping_scenenode
Topmost common parent; this isn't used for moving things, just helps developers inspect the scene gra...
std::string ComposeName(const std::string &object, int number=-1)
Creates name containing actor ID token, i.e. "Object#1 (filename.truck [Instance ID 1])".
void ProcessExtCamera(RigDef::ExtCamera &def)
void ProcessRotator(RigDef::Rotator &def)
void ProcessHelp(RigDef::Help &def)
void SetBeamDeformationThreshold(beam_t &beam, std::shared_ptr< RigDef::BeamDefaults > beam_defaults)
void BuildWheelBeams(unsigned int num_rays, NodeNum_t base_node_index, node_t *axis_node_1, node_t *axis_node_2, float tyre_spring, float tyre_damping, float rim_spring, float rim_damping, std::shared_ptr< RigDef::BeamDefaults > beam_defaults, RigDef::Node::Ref const &rigidity_node_id, float max_extension=0.f)
'wheels', 'meshwheels'
void AddExhaust(NodeNum_t emitter_node_idx, NodeNum_t direction_node_idx)
void ProcessShock(RigDef::Shock &def)
void ProcessLockgroup(RigDef::Lockgroup &lockgroup)
void CreateWheelSkidmarks(WheelID_t wheel_index)
Ogre::MaterialPtr m_simple_material_base
Ogre::SceneNode * m_flexbodies_parent_scenenode
this isn't used for moving/hiding things, just helps developers inspect the scene graph.
NodeNum_t FindNodeIndex(RigDef::Node::Ref &node_ref, bool silent=false)
void ProcessCamera(RigDef::Camera &def)
void ProcessContacter(RigDef::Node::Ref &node_ref)
void SetCurrentKeyword(RigDef::Keyword keyword)
void ProcessMeshWheel2(RigDef::MeshWheel2 &def)
void ProcessFusedrag(RigDef::Fusedrag &def)
void ProcessAirbrake(RigDef::Airbrake &def)
void ProcessTorqueCurve(RigDef::TorqueCurve &def)
Ogre::SceneNode * mirror_prop_scenenode
float ComputeWingArea(Ogre::Vector3 const &ref, Ogre::Vector3 const &x, Ogre::Vector3 const &y, Ogre::Vector3 const &aref)
bool m_generate_wing_position_lights
void ConfigureAddonParts(TuneupDefPtr &tuneup_def)
RoR::FlexFactory m_flex_factory
Designed to be run on main/rendering loop (FPS)
std::map< std::string, Ogre::MaterialPtr > m_managed_materials
void SetBeamSpring(beam_t &beam, float spring)
void ValidateRotator(int id, int axis1, int axis2, NodeNum_t *nodes1, NodeNum_t *nodes2)
RigDef::VideoCamera * FindVideoCameraByMaterial(std::string const &material_name)
Returns NULL if none found.
void CalcMemoryRequirements(ActorMemoryRequirements &req, RigDef::Document::Module *module_def)
void _ProcessKeyInertia(RigDef::Inertia &inertia, RigDef::Inertia &inertia_defaults, RoR::CmdKeyInertia &contract_key, RoR::CmdKeyInertia &extend_key)
node_t & GetAndInitFreeNode(Ogre::Vector3 const &position)
void _ProcessSimpleInertia(RigDef::Inertia &def, RoR::SimpleInertia &obj)
void ProcessAxle(RigDef::Axle &def)
void ProcessEngturbo(RigDef::Engturbo &def)
Processes a RigDef::Document (parsed from 'truck' file format) into a simulated gameplay object (Acto...
Ogre::MaterialPtr m_cab_trans_material
void ProcessEngoption(RigDef::Engoption &def)
bool CheckCabLimit(unsigned int count)
void ProcessShock3(RigDef::Shock3 &def)
void AddMessage(Message type, Ogre::String const &text)
Maintenance.
void ProcessAnimator(RigDef::Animator &def)
void SetupNewEntity(Ogre::Entity *e, Ogre::ColourValue simple_color)
Full texture and material setup.
Ogre::MaterialPtr InstantiateManagedMaterial(Ogre::String const &rg_name, Ogre::String const &source_name, Ogre::String const &clone_name)
Simulation: An edge in the softbody structure.
void ProcessShock2(RigDef::Shock2 &def)
Ogre::MaterialPtr FindOrCreateCustomizedMaterial(const std::string &mat_lookup_name, const std::string &mat_lookup_rg)
bool CheckParticleLimit(unsigned int count)
RoR::Renderdash * m_oldstyle_renderdash
void CreateVideoCamera(RigDef::VideoCamera *def)
NodeNum_t ResolveNodeRef(RigDef::Node::Ref const &node_ref)
bool CheckAeroEngineLimit(unsigned int count)
void ProcessMeshWheel(RigDef::MeshWheel &def)
static const float DEFAULT_MINIMASS
minimum node mass in Kg
void ProcessRopable(RigDef::Ropable &def)
uint16_t NodeNum_t
Node position within Actor::ar_nodes; use RoR::NODENUM_INVALID as empty value.
Core data structures for simulation; Everything affected by by either physics, network or user intera...
unsigned int AddTyreBeam(RigDef::Wheel2 &wheel_2_def, node_t *node_1, node_t *node_2)
std::vector< CabTexcoord > m_oldstyle_cab_texcoords
void ProcessTurboprop2(RigDef::Turboprop2 &def)
wheel_t::BrakeCombo TranslateBrakingDef(RigDef::WheelBraking def)
WheelID_t AddWheel(RigDef::Wheel &wheel)
void ProcessAuthor(RigDef::Author &def)
bool CheckTexcoordLimit(unsigned int count)
Ogre::ParticleSystem * CreateParticleSystem(std::string const &name, std::string const &template_name)
Ogre::SceneNode * m_props_parent_scenenode
this isn't used for moving/hiding things, just helps developers inspect the scene graph.
void ConfigureAssetPacks(ActorPtr actor, RigDef::DocumentPtr def)
void ProcessSpeedLimiter(RigDef::SpeedLimiter &def)
std::string m_help_material_name
CustomMaterial(Ogre::MaterialPtr &mat)
RigDef::VideoCamera * video_camera_def
void GetWheelAxisNodes(RigDef::BaseWheel &def, node_t *&out_node_1, node_t *&out_node_2)
int WheelID_t
Index to Actor::ar_wheels, use RoR::WHEELID_INVALID as empty value.
void ProcessFlare3(RigDef::Flare3 &def)
void ProcessNewActor(ActorPtr actor, ActorSpawnRequest rq, RigDef::DocumentPtr def)
void ProcessFlexbody(RigDef::Flexbody &def)
void ProcessFixedNode(RigDef::Node::Ref node_ref)
beam_t & GetAndInitFreeBeam(node_t &node_1, node_t &node_2)
void ProcessScrewprop(RigDef::Screwprop &def)
std::map< std::string, CustomMaterial > m_material_substitutions
Maps original material names (shared) to their actor-specific substitutes; There's 1 substitute per 1...
unsigned int AddWheelBeam(node_t *node_1, node_t *node_2, float spring, float damping, std::shared_ptr< RigDef::BeamDefaults > beam_defaults, float max_contraction=-1.f, float max_extension=-1.f, BeamType type=BEAM_NORMAL)
'wheels', 'meshwheels', 'meshwheels2'
std::map< Ogre::String, unsigned int > m_named_nodes
Central state/object manager and communications hub.
void ProcessBeam(RigDef::Beam &def)
std::pair< unsigned int, bool > AddNode(RigDef::Node::Id &id)
unsigned int AddWheelRimBeam(RigDef::Wheel2 &wheel_2_def, node_t *node_1, node_t *node_2)
void ProcessCollisionRange(RigDef::CollisionRange &def)
Physics: A vertex in the softbody structure.
std::string GetCurrentElementMediaRG()
Where to load media from (the addonpart's bundle or vehicle's bundle?)
float global_minimass
'minimass' - used where 'set_default_minimass' is not applied.
void AdjustNodeBuoyancy(node_t &node, RigDef::Node &node_def, std::shared_ptr< RigDef::NodeDefaults > defaults)
For user-defined nodes.
void ProcessNode(RigDef::Node &def)
BrakeCombo
Wheels are braked by three mechanisms: A footbrake, a handbrake/parkingbrake, and directional brakes ...
Ogre::MaterialPtr m_managedmat_placeholder_template
An 'error marker' material (bright magenta) to generate managedmaterial placeholders from.
Designed to be run in physics loop (2khz)
void CreateMirrorPropVideoCam(Ogre::MaterialPtr custom_mat, CustomMaterial::MirrorPropType type, Ogre::SceneNode *prop_scenenode)
void ProcessSlidenode(RigDef::SlideNode &def)
void ProcessRailGroup(RigDef::RailGroup &def)
'renderdash' is a name of a classic Render-To-Texture animated material with gauges and other dashboa...
Ogre::SceneNode * m_flares_parent_scenenode
this isn't used for moving/hiding things, just helps developers inspect the scene graph.
void SetBeamStrength(beam_t &beam, float strength)
static bool CheckSoundScriptLimit(ActorPtr const &vehicle, unsigned int count)
void ProcessDescription(Ogre::String const &line)
std::string m_cab_material_name
Original name defined in truckfile/globals.
void ProcessInterAxle(RigDef::InterAxle &def)
void ProcessParticle(RigDef::Particle &def)
void ProcessCollisionBox(RigDef::CollisionBox &def)
Exception(Ogre::String const &message)
void ProcessTie(RigDef::Tie &def)
void CreateMeshWheelVisuals(WheelID_t wheel_id, NodeNum_t base_node_index, NodeNum_t axis_node_1_index, NodeNum_t axis_node_2_index, unsigned int num_rays, WheelSide side, Ogre::String mesh_name, Ogre::String mesh_rg, Ogre::String material_name, Ogre::String material_rg, float rim_radius)
void UpdateCollcabContacterNodes()
void SetBeamDamping(beam_t &beam, float damping)
Ogre::SceneNode * m_curr_mirror_prop_scenenode
bool CheckAxleLimit(unsigned int count)
bool CollectNodesFromRanges(std::vector< RigDef::Node::Range > &node_ranges, std::vector< NodeNum_t > &out_node_indices)
Parses list of node-ranges into list of individual nodes.
void ProcessSoundSource2(RigDef::SoundSource2 &def)
void ProcessAntiLockBrakes(RigDef::AntiLockBrakes &def)
void BuildWheelObjectAndNodes(WheelID_t wheel_id, unsigned int num_rays, node_t *axis_node_1, node_t *axis_node_2, node_t *reference_arm_node, unsigned int reserve_nodes, unsigned int reserve_beams, float wheel_radius, RigDef::WheelPropulsion propulsion, RigDef::WheelBraking braking, std::shared_ptr< RigDef::NodeDefaults > node_defaults, float wheel_mass, float wheel_width=-1.f)
Sets up wheel and builds nodes for sections 'wheels', 'meshwheels' and 'meshwheels2'.
void ProcessWheel(RigDef::Wheel &def)
void ProcessCameraRail(RigDef::CameraRail &def)
static void AddSoundSourceInstance(ActorPtr const &vehicle, Ogre::String const &sound_script_name, int node_index, int type=-2)
int m_airplane_left_light
void ProcessExhaust(RigDef::Exhaust &def)
MirrorPropType mirror_prop_type
Abstract node ID (numbered or named) Node name is always available.
Unified game event system - all requests and state changes are reported using a message.
node_t * GetNodePointer(RigDef::Node::Ref const &node_ref)
void ProcessProp(RigDef::Prop &def)
Resource group override is used with addonparts.
Checks the rig-def file syntax and loads data to memory.
void ProcessPistonprop(RigDef::Pistonprop &def)
void CreateWheelVisuals(WheelID_t wheel_id, NodeNum_t node_base_index, unsigned int def_num_rays, Ogre::String const &face_material_name, Ogre::String const &face_material_rg, Ogre::String const &band_material_name, Ogre::String const &band_material_rg, bool separate_rim, float rim_ratio=1.f)
void ProcessTurbojet(RigDef::Turbojet &def)
void CalculateBeamLength(beam_t &beam)
Ogre::Vector3 m_spawn_position
void ProcessCruiseControl(RigDef::CruiseControl &def)
RailGroup * CreateRail(std::vector< RigDef::Node::Range > &node_ranges)
Ogre::SceneNode * m_wheels_parent_scenenode
this isn't used for moving/hiding things, just helps developers inspect the scene graph.
RigDef::MaterialFlareBinding * material_flare_def
bool m_apply_simple_materials
void ProcessRotator2(RigDef::Rotator2 &def)
void CreateMaterialFlare(int flare_index, Ogre::MaterialPtr mat)
void CreateFlexBodyWheelVisuals(WheelID_t wheel_id, NodeNum_t node_base_index, NodeNum_t axis_node_1, NodeNum_t axis_node_2, int num_rays, float radius, WheelSide side, std::string rim_mesh_name, std::string rim_mesh_rg, std::string tire_mesh_name, std::string tire_mesh_rg)
void CreateBeamVisuals(beam_t const &beam, int beam_index, bool visible, std::shared_ptr< RigDef::BeamDefaults > const &beam_defaults, std::string material_override="")
static void SetupDefaultSoundSources(ActorPtr const &actor)
bool AssignWheelToAxle(int &_out_axle_wheel, node_t *axis_node_1, node_t *axis_node_2)
Finds wheel with given axle nodes and returns it's index.
CustomMaterial::MirrorPropType m_curr_mirror_prop_type
void BuildAeroEngine(NodeNum_t ref_node_index, NodeNum_t back_node_index, NodeNum_t blade_1_node_index, NodeNum_t blade_2_node_index, NodeNum_t blade_3_node_index, NodeNum_t blade_4_node_index, NodeNum_t couplenode_index, bool is_turboprops, Ogre::String const &airfoil, float power, float pitch)
unsigned int _SectionWheels2AddBeam(RigDef::Wheel2 &wheel_2_def, node_t *node_1, node_t *node_2)
std::shared_ptr< Document > DocumentPtr
void ProcessCommand(RigDef::Command2 &def)
WheelSide
Used by rig-def/addonpart/tuneup formats to specify wheel rim mesh orientation.
NodeNum_t GetNodeIndexOrThrow(RigDef::Node::Ref const &id)
ActorMemoryRequirements m_memory_requirements
std::string GetSubmeshGroundmodelName()
int m_airplane_right_light
beam_t & AddBeam(node_t &node_1, node_t &node_2, std::shared_ptr< RigDef::BeamDefaults > &defaults, int detacher_group)
void ProcessWheelDetacher(RigDef::WheelDetacher &def)
void InitBeam(beam_t &beam, node_t *node_1, node_t *node_2)
void AssignManagedMaterialTexture(Ogre::TextureUnitState *tus, const std::string &mm_name, int media_id, const std::string &tex_name)
Helper for ProcessManagedMaterial()
void ProcessFlexBodyWheel(RigDef::FlexBodyWheel &def)
beam_t * FindBeamInRig(NodeNum_t node_a, NodeNum_t node_b)
void ProcessTractionControl(RigDef::TractionControl &def)
node_t * GetBeamNodePointer(RigDef::Node::Ref const &node_ref)
Ogre::MaterialPtr CreateSimpleMaterial(Ogre::ColourValue color)
ActorMemoryRequirements const & GetMemoryRequirements()
void ProcessTrigger(RigDef::Trigger &def)
std::list< std::shared_ptr< RigDef::Document::Module > > m_selected_modules
void ProcessTransferCase(RigDef::TransferCase &def)
node_t * GetNodePointerOrThrow(RigDef::Node::Ref const &node_ref)
void ProcessCinecam(RigDef::Cinecam &def)
Ogre::MaterialPtr material
void InitNode(node_t &node, Ogre::Vector3 const &position)
void ProcessManagedMaterial(RigDef::ManagedMaterial &def)
void ProcessWheel2(RigDef::Wheel2 &def)
std::vector< CabSubmesh > m_oldstyle_cab_submeshes
bool CheckScrewpropLimit(unsigned int count)