43#include "imgui_internal.h"
102 gfx_actor->UpdateFlexbodies();
103 gfx_actor->UpdateWheelVisuals();
107 GfxActor* player_gfx_actor =
nullptr;
127 float dt_actor = (!gfx_actor->GetSimDataBuffer().simbuf_physics_paused) ? dt : 0.f;
128 gfx_actor->UpdateParticles(dt_actor);
134 itor.second->update();
140 if (player_gfx_actor !=
nullptr)
157 if (player_gfx_actor !=
nullptr)
163 gfx_water->SetReflectionPlaneHeight(water->GetStaticWaterHeight());
165 gfx_water->FrameStepWater(dt);
173 sky->DetectSkyUpdate();
178 if (skyx_man !=
nullptr)
209 gfx_actor->UpdateNetLabels(dt);
215 a->UpdateCharacterInScene();
221 float dt_actor = (!gfx_actor->GetSimDataBuffer().simbuf_physics_paused) ? dt : 0.f;
222 if (gfx_actor->IsActorLive())
224 gfx_actor->UpdateRods();
225 gfx_actor->UpdateCabMesh();
226 gfx_actor->UpdateWingMeshes();
227 gfx_actor->UpdateAirbrakes();
228 gfx_actor->UpdateCParticles();
229 gfx_actor->UpdateExhausts();
230 gfx_actor->UpdateAeroEngines();
231 gfx_actor->UpdatePropAnimations(dt_actor);
232 gfx_actor->UpdateRenderdashRTT();
235 gfx_actor->UpdateProps(dt_actor, (gfx_actor == player_gfx_actor));
237 gfx_actor->UpdateFlares(dt_actor, (gfx_actor == player_gfx_actor));
239 if (player_gfx_actor !=
nullptr)
264 gfx_actor->FinishWheelUpdates();
265 gfx_actor->FinishFlexbodyTasks();
273 itor.second->setVisible(visible);
282 return found->second;
316 if (a->IsActorLive() || !a->IsActorInitialized())
318 a->UpdateSimDataBuffer();
320 a->InitializeActor();
326 a->BufferSimulationData();
379 float font_size = std::max(0.6, cam_dist / 40.0);
384 nick +
" (" +
TOSTRING((
float)(ceil(cam_dist / 100) / 10.0) ) +
" km)";
386 else if (cam_dist > 20)
389 nick +
" (" +
TOSTRING((
int)cam_dist) +
" m)";
398 ImVec2 screen_size = ImGui::GetIO().DisplaySize;
402 Ogre::Vector3 pos_xyz = world2screen.
Convert(scene_pos);
408 ImVec2 pos((
int)pos_xyz.x+0.5, (
int)pos_xyz.y+0.5);
410 ImVec2 text_size = ImGui::CalcTextSize(caption.c_str());
414 ImGuiContext* g = ImGui::GetCurrentContext();
416 ImVec2 text_pos(pos.x - ((text_size.x / 2)), pos.y - ((text_size.y / 2)));
419 const float PADDING = 4.f;
420 drawlist->AddRectFilled(
421 text_pos - ImVec2(PADDING, PADDING),
422 text_pos + text_size + ImVec2(PADDING, PADDING),
424 ImGui::GetStyle().WindowRounding);
428 ImVec4 text_color(color.r, color.g, color.b, 1.f);
429 drawlist->AddText(g->Font, g->FontSize, text_pos, ImColor(text_color), caption.c_str());
437 float speed_factor = 0.f;
443 psys->setSpeedFactor(speed_factor);
449 [rq](
const FreeBeamGfx& obj) { return obj.fbx_id == rq->fbr_id; });
453 fmt::format(
"FreeBeamGfx with ID %d already exists, ignoring request.",rq->
fbr_id));
476 [rq](
const FreeBeamGfx& obj) { return obj.fbx_id == rq->fbr_id; });
480 fmt::format(
"FreeBeamGfx with ID %d not found, ignoring request.", rq->
fbr_id));
492 [
id](
const FreeBeamGfx& obj) { return obj.fbx_id == id; });
496 fmt::format(
"FreeBeamGfx with ID %d not found, ignoring request.",
id));
513 ActorManager::FreeForceVec_t::iterator itor;
543 freebeam.fbx_scenenode->setPosition(basenode_pos.midPoint(targetnode_pos));
545 freebeam.fbx_scenenode->setScale(freebeam.fbx_diameter, basenode_pos.distance(targetnode_pos), freebeam.fbx_diameter);
552 [
id](
const FreeBeamGfx& obj) { return obj.fbx_freeforce_secondary == id; });
561 [
id](
const FreeBeamGfx& obj) { return obj.fbx_freeforce_primary == id; });
573 [
id](
const FreeBeamGfx& obj) { return obj.fbx_freeforce_primary == id || obj.fbx_freeforce_secondary == id; });
586 Ogre::Vector3 v0 = src;
587 Ogre::Vector3 v1 = dest;
593 Ogre::Real d = v0.dotProduct(v1);
597 return Ogre::Quaternion::IDENTITY;
599 if (d < (1e-6f - 1.0f))
602 Ogre::Vector3 axis = Ogre::Vector3::UNIT_X.crossProduct(src);
603 if (axis.isZeroLength())
604 axis = Ogre::Vector3::UNIT_Y.crossProduct(src);
606 q.FromAngleAxis(Ogre::Radian(Ogre::Math::PI), axis);
612 return Ogre::Quaternion::IDENTITY;
614 Ogre::Vector3 c = v0.crossProduct(v1);
615 Ogre::Real invs = 1 / s;
System integration layer; inspired by OgreBites::ApplicationContext.
#define ROR_ASSERT(_EXPR)
float fast_sqrt(const float x)
Race direction arrow and text info (using OGRE Overlay)
Game state manager and message-queue provider.
ActorType ar_driveable
Sim attr; marks vehicle type and features.
bool IsSimulationPaused() const
float GetSimulationSpeed() const
bool FindFreeForce(FreeForceID_t id, FreeForceVec_t::iterator &out_itor)
Ogre::Root * GetOgreRoot()
void ReCreateCameraNode()
Needed since we call Ogre::SceneManager::ClearScene() after end of sim. session.
@ CAMERA_BEHAVIOR_VEHICLE_CINECAM
CameraBehaviors GetCurrentBehavior() const
Ogre::Camera * GetCamera()
Ogre::Vector3 getPosition()
@ CONSOLE_MSGTYPE_INFO
Generic message.
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
void CreateArrow()
Must be called again after OGRE scenemanager is cleared.
void DrawSimGuiBuffered(GfxActor *player_gfx_actor)
Reads data from simbuffer.
GUI::DirectionArrow DirectionArrow
Character * GetPlayerCharacter()
const ActorPtr & GetPlayerActor()
const TerrainPtr & GetTerrain()
SceneMouse & GetSceneMouse()
ActorManager * GetActorManager()
RaceSystem & GetRaceSystem()
void UpdateVideoCameras(float dt)
void UpdateWheelVisuals()
ActorSB & GetSimDataBuffer()
void FinishFlexbodyTasks()
NodeSB * GetSimNodeBuffer()
void FinishWheelUpdates()
void UpdateEnvMap(Ogre::Vector3 center, GfxActor *gfx_actor, bool full=false)
Ogre::SceneNode * m_gfx_freebeams_grouping_node
Only for nicer scenegraph when viewing through Inspector gadget.
void ForceUpdateSingleGfxActor(RoR::GfxActor *gfx_actor)
std::vector< GfxActor * > m_live_gfx_actors
void RegisterGfxActor(RoR::GfxActor *gfx_actor)
static Ogre::Quaternion SpecialGetRotationTo(const Ogre::Vector3 &src, const Ogre::Vector3 &dest)
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys)
void DrawNetLabel(Ogre::Vector3 pos, float cam_dist, std::string const &nick, int colornum)
void SetParticlesVisible(bool visible)
std::vector< FreeBeamGfx > m_gfx_freebeams
std::vector< GfxActor * > m_all_gfx_actors
void RegisterGfxCharacter(RoR::GfxCharacter *gfx_character)
std::map< std::string, DustPool * > m_dustpools
void RemoveGfxActor(RoR::GfxActor *gfx_actor)
DustPool * GetDustPool(const char *name)
void RemoveFreeBeamGfx(FreeBeamGfxID_t id)
Ogre::SceneManager * m_scene_manager
std::vector< GfxCharacter * > m_all_gfx_characters
void OnFreeForceBroken(FreeForceID_t id)
void RemoveGfxCharacter(RoR::GfxCharacter *gfx_character)
void ModifyFreeBeamGfx(FreeBeamGfxRequest *rq)
void OnFreeForceRemoved(FreeForceID_t id)
void BufferSimulationData()
Run this when simulation is halted.
SkidmarkConfig m_skidmark_conf
void UpdateScene(float dt)
void AddFreeBeamGfx(FreeBeamGfxRequest *rq)
void UpdateFreeBeamGfx(float dt)
virtual void SetReflectionPlaneHeight(float)
Ogre::ColourValue GetPlayerColor(int color_num)
void UpdatePressureOverlay(RoR::GfxActor *ga)
void UpdateRacingGui(RoR::GfxScene *gs)
void UpdateLandVehicleHUD(RoR::GfxActor *ga)
void UpdateAerialHUD(RoR::GfxActor *ga)
float GetRaceTime() const
std::string const & GetDirArrowText() const
Ogre::Vector3 GetDirArrowTarget()
float GetRaceTimeDiff() const
bool IsRaceInProgress() const
float GetRaceBestTime() const
bool IsDirArrowVisible() const
void LoadDefaultSkidmarkDefs()
void UpdateMainLightPosition()
SkyXManager * getSkyXManager()
TerrainObjectManager * getObjectManager()
SkyManager * getSkyManager()
TerrainGeometryManager * getGeometryManager()
IGfxWater * getGfxWater()
bool UpdateTerrainObjects(float dt)
< Keeps data close for faster access.
Ogre::Vector3 Convert(Ogre::Vector3 world_pos)
@ TRUCK
its a truck (or other land vehicle)
@ AIRPLANE
its an airplane
@ DISPOSED
removed from simulation, still in memory to satisfy pointers.
AppContext * GetAppContext()
OverlayWrapper * GetOverlayWrapper()
CameraManager * GetCameraManager()
CVar * gfx_particles_mode
GUIManager * GetGuiManager()
GameContext * GetGameContext()
static const NodeNum_t NODENUM_INVALID
int FreeForceID_t
Unique sequentially generated ID of FreeForce; use ActorManager::GetFreeForceNextId().
static const FreeBeamGfxID_t FREEBEAMGFXID_INVALID
ImDrawList * GetImDummyFullscreenWindow(const std::string &name="RoR_TransparentFullscreenWindow")
int FreeBeamGfxID_t
Index into GfxScene::m_gfx_freebeams, use RoR::FREEBEAMGFXID_INVALID as empty value.
static const FreeForceID_t FREEFORCEID_INVALID
bool simbuf_physics_paused
Visuals of a 'freebeam' (a pair of HALFBEAM_ freeforces)
FreeForceID_t fbx_freeforce_secondary
Not required for fixed-end beams.
FreeBeamGfxID_t fbx_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
Ogre::SceneNode * fbx_scenenode
FreeForceID_t fbx_freeforce_primary
Required.
Used by MSG_EDI_[ADD/MODIFY]_FREEBEAMGFX_REQUESTED; tailored for use with AngelScript thru GameScript...
std::string fbr_material_name
double fbr_diameter
meters
int64_t fbr_freeforce_primary
Required.
int64_t fbr_id
ID of the freebeam gfx, use GfxScene::GetFreeBeamGfxNextId()
int64_t fbr_freeforce_secondary
Not required for fixed-end beams.
std::string fbr_mesh_name
Global force affecting particular (base) node of particular (base) actor; added ad-hoc by scripts.
ActorPtr ffc_target_actor
NodeNum_t ffc_target_node
ImVec4 semitransparent_window_bg
Ogre::Vector3 simbuf_character_pos
bool simbuf_dir_arrow_visible
float simbuf_race_time_diff
ActorPtr simbuf_player_actor
CameraManager::CameraBehaviors simbuf_camera_behavior
Ogre::Vector3 simbuf_dir_arrow_target
float simbuf_race_best_time
bool simbuf_race_in_progress_prev
bool simbuf_race_in_progress
std::string simbuf_dir_arrow_text
Ogre::Vector3 AbsPosition