mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 18:56:49 +01:00
refactor(render): the renderer reads a vehicle through TDynamicObject, not its physics
No file of rendering/ includes physics/vehicle.h any more. What the renderers read of a vehicle comes through a few queries of TDynamicObject (vehicle/dynamic/lights.cpp): its dimensions, its speed, its active cab, the light of its compartments, the adapters of its couplers, the lights switched on at an end, the low voltage for them, and the multiplier and the colour of its headlights. The shares of the speed and the opacity of the exhaust smoke (ExhaustScales()) move out of the particles into the vehicle, as they are. The headlights pick their multiplier once, by the dimming and the high beam switches, where the light array repeated the same four branches twice; the light of a switched off end still goes to zero as before.
This commit is contained in:
@@ -13,7 +13,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "vehicle/DynObj.h"
|
||||
#include "gl/ubo.h"
|
||||
#include "utilities/Globals.h"
|
||||
#include "physics/vehicle.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -60,7 +59,7 @@ void gfx::screen_reflections::begin_frame(glm::mat4 const &Projection, glm::dmat
|
||||
{
|
||||
m_reprojectioncab = glm::mat4{m_history.projection * glm::dmat4{m_history.view} * m_history.cab * glm::inverse(m_current.cab) * toworld};
|
||||
// the vehicle stands on the origin of its model, along z, up to its height
|
||||
auto const &dimensions{Cab->physics->Dim};
|
||||
auto const &dimensions{Cab->Dimensions()};
|
||||
glm::dvec3 const lower{-0.5 * dimensions.W - CAB_BOX_MARGIN, -CAB_BOX_MARGIN, -0.5 * dimensions.L - CAB_BOX_MARGIN};
|
||||
glm::dvec3 const upper{0.5 * dimensions.W + CAB_BOX_MARGIN, dimensions.H + CAB_BOX_MARGIN, 0.5 * dimensions.L + CAB_BOX_MARGIN};
|
||||
auto const centre{0.5 * (lower + upper)};
|
||||
|
||||
Reference in New Issue
Block a user