mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 11:19:19 +02:00
build 200322. coupler adapter, automatic coupling vehicle setting, parked vehicle manual brake activation, ai braking logic enhancement, opengl 3.3 renderer diffuse color visualization fix, minor cab control logic bug fixes
This commit is contained in:
@@ -1083,6 +1083,30 @@ bool opengl33_renderer::Render_lowpoly( TDynamicObject *Dynamic, float const Squ
|
||||
return true;
|
||||
}
|
||||
|
||||
bool opengl33_renderer::Render_coupler_adapter( TDynamicObject *Dynamic, float const Squaredistance, int const End, bool const Alpha ) {
|
||||
|
||||
if( Dynamic->m_coupleradapters[ End ] == nullptr ) { return false; }
|
||||
|
||||
auto const position { Math3D::vector3 {
|
||||
0.f,
|
||||
Dynamic->MoverParameters->Couplers[ End ].adapter_height,
|
||||
( Dynamic->MoverParameters->Couplers[ End ].adapter_length + Dynamic->MoverParameters->Dim.L * 0.5 ) * ( End == end::front ? 1 : -1 ) } };
|
||||
|
||||
auto const angle { glm::vec3{
|
||||
0,
|
||||
( End == end::front ? 0 : 180 ),
|
||||
0 } };
|
||||
|
||||
if( Alpha ) {
|
||||
Render_Alpha( Dynamic->m_coupleradapters[ End ], Dynamic->Material(), Squaredistance, position, angle );
|
||||
}
|
||||
else {
|
||||
Render( Dynamic->m_coupleradapters[ End ], Dynamic->Material(), Squaredistance, position, angle );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// creates dynamic environment cubemap
|
||||
bool opengl33_renderer::Render_reflections(viewport_config &vp)
|
||||
{
|
||||
@@ -1813,13 +1837,17 @@ void opengl33_renderer::Bind_Material( material_handle const Material, TSubModel
|
||||
// material-based parameters
|
||||
switch( entry.defaultparam ) {
|
||||
case gl::shader::defaultparam_e::glossiness: {
|
||||
src = glm::vec4( material.glossiness );
|
||||
src = glm::vec4 { material.glossiness };
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( entry.size == 1 ) {
|
||||
// HACK: convert color to luminosity, if it's passed as single value
|
||||
src == glm::vec4 { colors::RGBtoHSV( glm::vec3 { src } ).s };
|
||||
}
|
||||
for (size_t j = 0; j < entry.size; j++)
|
||||
model_ubs.param[entry.location][entry.offset + j] = src[j];
|
||||
}
|
||||
@@ -2487,8 +2515,11 @@ bool opengl33_renderer::Render(TDynamicObject *Dynamic)
|
||||
for( auto *attachment : Dynamic->mdAttachments ) {
|
||||
Render( attachment, Dynamic->Material(), squaredistance );
|
||||
}
|
||||
// optional coupling adapters
|
||||
Render_coupler_adapter( Dynamic, squaredistance, end::front );
|
||||
Render_coupler_adapter( Dynamic, squaredistance, end::rear );
|
||||
|
||||
// post-render cleanup
|
||||
// post-render cleanup
|
||||
if (Dynamic->fShade > 0.0f)
|
||||
{
|
||||
// restore regular light level
|
||||
@@ -2510,6 +2541,9 @@ bool opengl33_renderer::Render(TDynamicObject *Dynamic)
|
||||
for( auto *attachment : Dynamic->mdAttachments ) {
|
||||
Render( attachment, Dynamic->Material(), squaredistance );
|
||||
}
|
||||
// optional coupling adapters
|
||||
Render_coupler_adapter( Dynamic, squaredistance, end::front );
|
||||
Render_coupler_adapter( Dynamic, squaredistance, end::rear );
|
||||
if( Dynamic->mdLoad ) {
|
||||
// renderowanie nieprzezroczystego ładunku
|
||||
Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} );
|
||||
@@ -2687,11 +2721,6 @@ void opengl33_renderer::Render(TSubModel *Submodel)
|
||||
|
||||
if ((Submodel->iVisible) && (TSubModel::fSquareDist >= Submodel->fSquareMinDist) && (TSubModel::fSquareDist < Submodel->fSquareMaxDist))
|
||||
{
|
||||
|
||||
// debug data
|
||||
++m_renderpass.draw_stats.submodels;
|
||||
++m_renderpass.draw_stats.drawcalls;
|
||||
|
||||
glm::mat4 future_stack = model_ubs.future;
|
||||
|
||||
if (Submodel->iFlags & 0xC000)
|
||||
@@ -2714,6 +2743,11 @@ void opengl33_renderer::Render(TSubModel *Submodel)
|
||||
if (Submodel->iAlpha & Submodel->iFlags & 0x1F)
|
||||
{
|
||||
// rysuj gdy element nieprzezroczysty
|
||||
|
||||
// debug data
|
||||
++m_renderpass.draw_stats.submodels;
|
||||
++m_renderpass.draw_stats.drawcalls;
|
||||
|
||||
switch (m_renderpass.draw_mode)
|
||||
{
|
||||
case rendermode::color:
|
||||
@@ -3440,6 +3474,9 @@ bool opengl33_renderer::Render_Alpha(TDynamicObject *Dynamic)
|
||||
for( auto *attachment : Dynamic->mdAttachments ) {
|
||||
Render_Alpha( attachment, Dynamic->Material(), squaredistance );
|
||||
}
|
||||
// optional coupling adapters
|
||||
Render_coupler_adapter( Dynamic, squaredistance, end::front, true );
|
||||
Render_coupler_adapter( Dynamic, squaredistance, end::rear, true );
|
||||
if( Dynamic->mdLoad ) {
|
||||
// renderowanie nieprzezroczystego ładunku
|
||||
Render_Alpha( Dynamic->mdLoad, Dynamic->Material(), squaredistance, { 0.f, Dynamic->LoadOffset, 0.f }, {} );
|
||||
@@ -3512,11 +3549,6 @@ void opengl33_renderer::Render_Alpha(TSubModel *Submodel)
|
||||
// renderowanie przezroczystych przez DL
|
||||
if ((Submodel->iVisible) && (TSubModel::fSquareDist >= Submodel->fSquareMinDist) && (TSubModel::fSquareDist < Submodel->fSquareMaxDist))
|
||||
{
|
||||
|
||||
// debug data
|
||||
++m_renderpass.draw_stats.submodels;
|
||||
++m_renderpass.draw_stats.drawcalls;
|
||||
|
||||
glm::mat4 future_stack = model_ubs.future;
|
||||
|
||||
if (Submodel->iFlags & 0xC000)
|
||||
@@ -3538,7 +3570,12 @@ void opengl33_renderer::Render_Alpha(TSubModel *Submodel)
|
||||
// renderowanie obiektów OpenGL
|
||||
if (Submodel->iAlpha & Submodel->iFlags & 0x2F)
|
||||
{
|
||||
// rysuj gdy element przezroczysty
|
||||
// rysuj gdy element przezroczysty
|
||||
|
||||
// debug data
|
||||
++m_renderpass.draw_stats.submodels;
|
||||
++m_renderpass.draw_stats.drawcalls;
|
||||
|
||||
switch (m_renderpass.draw_mode)
|
||||
{
|
||||
case rendermode::color:
|
||||
|
||||
Reference in New Issue
Block a user