mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-04 10:09:31 +01:00
Light the cab with cablight/dashboardlight light points of the cab model
This commit is contained in:
@@ -34,7 +34,9 @@ class TDynamicObject;
|
||||
// light along the -z axis of its submodel, with the cone of its glare. lamps of scenery models switched with Light_On / Light_Off
|
||||
// and the self-illumination of vehicle compartments (TDynamicObject::Sections) work through the same state
|
||||
// - the lit compartments of vehicles (low poly interior sections) without light points of their own: a point light in the middle
|
||||
// - the lamp of the occupied cab: a point light under the top of the cab model, in place of the ambient light it used to add
|
||||
// - the lights of the occupied cab, in place of the ambient light its lamp used to add: the light points of the cab model (mdKabina)
|
||||
// named cablight... (the lamps of the cab, switched and dimmed with them) and dashboardlight... (the lights of the desk, switched
|
||||
// with the dashboard light, i-dashboardlight:). a cab model without any cablight... gets a point light under its top instead
|
||||
// gathered once per frame around the camera, written to the light buffers by the renderers (Update_Lights())
|
||||
namespace gfx
|
||||
{
|
||||
@@ -79,20 +81,28 @@ class local_lights
|
||||
{
|
||||
return m_lights;
|
||||
}
|
||||
// the lamp of the occupied cab, when it is on and the cab is drawn; nullptr otherwise
|
||||
light const *cab_lamp() const
|
||||
// a light of the occupied cab: the light (part names it from frame to frame: the light point, or the vehicle for the lamp put
|
||||
// under the top of the cab) and its position in the space of the cab model (mdKabina)
|
||||
struct cab_light
|
||||
{
|
||||
return m_cablampon ? &m_cablamp : nullptr;
|
||||
light source;
|
||||
glm::vec3 local{0.f};
|
||||
};
|
||||
// the lights of the occupied cab which are on, when the cab is drawn, the brightest first; empty otherwise
|
||||
std::vector<cab_light> const &cab_lights() const
|
||||
{
|
||||
return m_cablights;
|
||||
}
|
||||
// the vehicle of the cab lamp and the position of the lamp in the space of its cab model (mdKabina), when the lamp is on
|
||||
// the brightest light of the cab, which lights its probe; nullptr when there is none
|
||||
cab_light const *cab_principal() const
|
||||
{
|
||||
return m_cablights.empty() ? nullptr : &m_cablights.front();
|
||||
}
|
||||
// the vehicle of the lights of the cab, when any of them is on
|
||||
TDynamicObject const *cab_lamp_vehicle() const
|
||||
{
|
||||
return m_cablampon ? m_cablampvehicle : nullptr;
|
||||
}
|
||||
glm::vec3 const &cab_lamp_local() const
|
||||
{
|
||||
return m_cablamplocal;
|
||||
}
|
||||
// the box of the cab model Cab (model space): its middle and half its size; false when the model has no geometry
|
||||
bool cab_bounds(TModel3d *Cab, gfx::geometrybank_manager const &Geometry, glm::vec3 &Center, glm::vec3 &Extent);
|
||||
// counts of the last pass which wrote the lights to the light buffer: placed, and left out for the lack of room
|
||||
@@ -124,21 +134,28 @@ class local_lights
|
||||
// lights of the light points of the submodel tree, gone through the way the render goes through it. Transform: model space of
|
||||
// Submodel's parent, Placement: model space to world space, Brightness: of a light point of white colour
|
||||
void walk(TSubModel *Submodel, glm::mat4 const &Transform, glm::dmat4 const &Placement, float const Brightness);
|
||||
void add_light_point(TSubModel const &Submodel, glm::mat4 const &Transform, glm::dmat4 const &Placement, float const Brightness);
|
||||
void add_light_point(TSubModel const &Submodel, glm::mat4 const &Transform, glm::dmat4 const &Placement, float Brightness);
|
||||
void gather_instance(TAnimModel *Instance, glm::dvec3 const &Camera, float const Brightness, unsigned int const Framestamp);
|
||||
void gather_vehicle(TDynamicObject *Vehicle, glm::dvec3 const &Camera, gfx::geometrybank_manager const &Geometry, float const Freespotbrightness, float const Compartmentbrightness);
|
||||
void gather_cab_lamp(gfx::geometrybank_manager const &Geometry);
|
||||
void gather_cab_lights(gfx::geometrybank_manager const &Geometry);
|
||||
bool has_light_points(TModel3d *Model);
|
||||
// the kinds of the light points of a cab model by their names, CAB_LIGHT_LAMP | CAB_LIGHT_DASHBOARD (locallights.cpp)
|
||||
std::uint8_t cab_light_kinds(TModel3d *Model);
|
||||
cell_data const &cell_instances(scene::basic_cell &Cell, bool const Rebuild);
|
||||
section_data const §ion(TModel3d *Model, TSubModel *Section, gfx::geometrybank_manager const &Geometry);
|
||||
section_data const &model_bounds(TModel3d *Model, gfx::geometrybank_manager const &Geometry);
|
||||
|
||||
std::vector<light> m_lights;
|
||||
light m_cablamp;
|
||||
std::vector<cab_light> m_cablights;
|
||||
bool m_cablampon{false};
|
||||
TDynamicObject const *m_cablampvehicle{nullptr};
|
||||
glm::vec3 m_cablamplocal{0.f};
|
||||
// walk() goes through the cab model: only its light points of the cab and of the desk, at these levels (0-1) of their switches,
|
||||
// whatever the self-illumination threshold
|
||||
bool m_walkcab{false};
|
||||
float m_walkcablevel{0.f};
|
||||
float m_walkdashboardlevel{0.f};
|
||||
std::unordered_map<TModel3d const *, bool> m_modellights; // whether the model has light points
|
||||
std::unordered_map<TModel3d const *, std::uint8_t> m_cabkinds; // the kinds of light points of cab models
|
||||
std::unordered_map<scene::basic_cell const *, cell_data> m_cells;
|
||||
std::unordered_map<TSubModel const *, section_data> m_sections; // compartments, by their submodel
|
||||
std::unordered_map<TModel3d const *, section_data> m_models; // bounds of cab models
|
||||
|
||||
Reference in New Issue
Block a user