mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
build 180928. heater sound, minor precipitation tweaks, minor bug fixes
This commit is contained in:
17
DynObj.cpp
17
DynObj.cpp
@@ -2157,7 +2157,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
btShutters1.Init( "shutters1", mdModel, false );
|
btShutters1.Init( "shutters1", mdModel, false );
|
||||||
}
|
}
|
||||||
if( MoverParameters->dizel_heat.water_aux.config.shutters ) {
|
if( MoverParameters->dizel_heat.water_aux.config.shutters ) {
|
||||||
btShutters1.Init( "shutters2", mdModel, false );
|
btShutters2.Init( "shutters2", mdModel, false );
|
||||||
}
|
}
|
||||||
TurnOff(); // resetowanie zmiennych submodeli
|
TurnOff(); // resetowanie zmiennych submodeli
|
||||||
|
|
||||||
@@ -3971,6 +3971,13 @@ void TDynamicObject::RenderSounds() {
|
|||||||
sSmallCompressor.stop();
|
sSmallCompressor.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// heating sound
|
||||||
|
if( MoverParameters->Heating ) {
|
||||||
|
sHeater.play( sound_flags::exclusive | sound_flags::looping );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sHeater.stop();
|
||||||
|
}
|
||||||
|
|
||||||
// brake system and braking sounds:
|
// brake system and braking sounds:
|
||||||
|
|
||||||
@@ -5393,6 +5400,12 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
|||||||
sConverter.owner( this );
|
sConverter.owner( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if( token == "heater:" ) {
|
||||||
|
// train heating device
|
||||||
|
sHeater.deserialize( parser, sound_type::single );
|
||||||
|
sHeater.owner( this );
|
||||||
|
}
|
||||||
|
|
||||||
else if( token == "turbo:" ) {
|
else if( token == "turbo:" ) {
|
||||||
// pliki z turbogeneratorem
|
// pliki z turbogeneratorem
|
||||||
m_powertrainsounds.engine_turbo.deserialize( parser, sound_type::multipart, sound_parameters::range );
|
m_powertrainsounds.engine_turbo.deserialize( parser, sound_type::multipart, sound_parameters::range );
|
||||||
@@ -5827,7 +5840,7 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
|||||||
// other engine compartment sounds
|
// other engine compartment sounds
|
||||||
auto const nullvector { glm::vec3() };
|
auto const nullvector { glm::vec3() };
|
||||||
std::vector<sound_source *> enginesounds = {
|
std::vector<sound_source *> enginesounds = {
|
||||||
&sConverter, &sCompressor, &sSmallCompressor
|
&sConverter, &sCompressor, &sSmallCompressor, &sHeater
|
||||||
};
|
};
|
||||||
for( auto sound : enginesounds ) {
|
for( auto sound : enginesounds ) {
|
||||||
if( sound->offset() == nullvector ) {
|
if( sound->offset() == nullvector ) {
|
||||||
|
|||||||
1
DynObj.h
1
DynObj.h
@@ -409,6 +409,7 @@ private:
|
|||||||
sound_source sConverter { sound_placement::engine };
|
sound_source sConverter { sound_placement::engine };
|
||||||
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
|
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
|
||||||
sound_source sSmallCompressor { sound_placement::engine };
|
sound_source sSmallCompressor { sound_placement::engine };
|
||||||
|
sound_source sHeater { sound_placement::engine };
|
||||||
// braking sounds
|
// braking sounds
|
||||||
sound_source dsbPneumaticRelay { sound_placement::external };
|
sound_source dsbPneumaticRelay { sound_placement::external };
|
||||||
sound_source rsBrake { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab
|
sound_source rsBrake { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ void
|
|||||||
TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
|
TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
|
||||||
|
|
||||||
auto const desiredtimes100 = static_cast<int>( std::round( 100.0 * fNewDesired ) );
|
auto const desiredtimes100 = static_cast<int>( std::round( 100.0 * fNewDesired ) );
|
||||||
if( desiredtimes100 == static_cast<int>( 100.0 * m_targetvalue ) ) {
|
if( desiredtimes100 == static_cast<int>( std::round( 100.0 * m_targetvalue ) ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_targetvalue = fNewDesired;
|
m_targetvalue = fNewDesired;
|
||||||
|
|||||||
@@ -814,14 +814,17 @@ void
|
|||||||
texture_manager::bind( std::size_t const Unit, texture_handle const Texture ) {
|
texture_manager::bind( std::size_t const Unit, texture_handle const Texture ) {
|
||||||
|
|
||||||
m_textures[ Texture ].second = m_garbagecollector.timestamp();
|
m_textures[ Texture ].second = m_garbagecollector.timestamp();
|
||||||
|
if( m_units[ Unit ].unit == 0 ) {
|
||||||
|
// no texture unit, nothing to bind the texture to
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// even if we may skip texture binding make sure the relevant texture unit is activated
|
||||||
|
unit( m_units[ Unit ].unit );
|
||||||
if( Texture == m_units[ Unit ].texture ) {
|
if( Texture == m_units[ Unit ].texture ) {
|
||||||
// don't bind again what's already active
|
// don't bind again what's already active
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TBD, TODO: do binding in texture object, add support for other types than 2d
|
// TBD, TODO: do binding in texture object, add support for other types than 2d
|
||||||
if( m_units[ Unit ].unit == 0 ) { return; }
|
|
||||||
unit( m_units[ Unit ].unit );
|
|
||||||
if( Texture != null_handle ) {
|
if( Texture != null_handle ) {
|
||||||
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
|
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
|
||||||
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid
|
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
// encapsulation of the fixed pipeline opengl color
|
// encapsulation of the fixed pipeline opengl color
|
||||||
class opengl_color {
|
class opengl_color {
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ public:
|
|||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
color4( glm::vec4 const &Color ) {
|
color4( glm::vec4 const &Color ) {
|
||||||
if( Color != m_color ) {
|
if( ( Color != m_color ) || ( false == Global.bUseVBO ) ) {
|
||||||
m_color = Color;
|
m_color = Color;
|
||||||
::glColor4fv( glm::value_ptr( m_color ) ); } }
|
::glColor4fv( glm::value_ptr( m_color ) ); } }
|
||||||
inline
|
inline
|
||||||
|
|||||||
@@ -341,7 +341,6 @@ opengl_dlgeometrybank::draw_( gfx::geometry_handle const &Geometry, gfx::stream_
|
|||||||
auto const &chunk = gfx::geometry_bank::chunk( Geometry );
|
auto const &chunk = gfx::geometry_bank::chunk( Geometry );
|
||||||
::glNewList( chunkrecord.list, GL_COMPILE );
|
::glNewList( chunkrecord.list, GL_COMPILE );
|
||||||
|
|
||||||
::glColor3f( -1.f, -1.f, -1.f ); // HACK: force the opengl color wrapper to include color call in the display list regardless of currently active color
|
|
||||||
::glBegin( chunk.type );
|
::glBegin( chunk.type );
|
||||||
for( auto const &vertex : chunk.vertices ) {
|
for( auto const &vertex : chunk.vertices ) {
|
||||||
if( Streams & gfx::stream::normal ) { ::glNormal3fv( glm::value_ptr( vertex.normal ) ); }
|
if( Streams & gfx::stream::normal ) { ::glNormal3fv( glm::value_ptr( vertex.normal ) ); }
|
||||||
|
|||||||
22
renderer.cpp
22
renderer.cpp
@@ -2837,17 +2837,10 @@ opengl_renderer::Render_precipitation() {
|
|||||||
colors::white,
|
colors::white,
|
||||||
0.5f * clamp<float>( Global.fLuminance, 0.f, 1.f ) ) ) );
|
0.5f * clamp<float>( Global.fLuminance, 0.f, 1.f ) ) ) );
|
||||||
::glPushMatrix();
|
::glPushMatrix();
|
||||||
|
// tilt the precipitation cone against the velocity vector for crude motion blur
|
||||||
auto const velocity { simulation::Environment.m_precipitation.m_cameramove * -1.0 };
|
auto const velocity { simulation::Environment.m_precipitation.m_cameramove * -1.0 };
|
||||||
if( glm::length2( velocity ) > 0.0 ) {
|
if( glm::length2( velocity ) > 0.0 ) {
|
||||||
auto const forward{ glm::normalize( velocity ) };
|
auto const forward{ glm::normalize( velocity ) };
|
||||||
if( false == FreeFlyModeFlag ) {
|
|
||||||
// counter potential vehicle roll
|
|
||||||
auto const roll { simulation::Train->Dynamic()->Roll() };
|
|
||||||
if( roll != 0.0 ) {
|
|
||||||
::glRotated( roll, forward.x, 0.0, forward.z );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto left { glm::cross( forward, {0.0,1.0,0.0} ) };
|
auto left { glm::cross( forward, {0.0,1.0,0.0} ) };
|
||||||
auto const rotationangle {
|
auto const rotationangle {
|
||||||
std::min(
|
std::min(
|
||||||
@@ -2857,6 +2850,19 @@ opengl_renderer::Render_precipitation() {
|
|||||||
simulation::Train->Dynamic()->GetVelocity() * 0.2 ) ) };
|
simulation::Train->Dynamic()->GetVelocity() * 0.2 ) ) };
|
||||||
::glRotated( rotationangle, left.x, 0.0, left.z );
|
::glRotated( rotationangle, left.x, 0.0, left.z );
|
||||||
}
|
}
|
||||||
|
if( false == FreeFlyModeFlag ) {
|
||||||
|
// counter potential vehicle roll
|
||||||
|
auto const roll { 0.5 * glm::degrees( simulation::Train->Dynamic()->Roll() ) };
|
||||||
|
if( roll != 0.0 ) {
|
||||||
|
auto const forward { simulation::Train->Dynamic()->VectorFront() };
|
||||||
|
auto const vehicledirection = simulation::Train->Dynamic()->DirectionGet();
|
||||||
|
::glRotated( roll, forward.x, 0.0, forward.z );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( Global.Weather == "rain:" ) {
|
||||||
|
// oddly enough random streaks produce more natural looking rain than ones the eye can follow
|
||||||
|
::glRotated( Random() * 360, 0.0, 1.0, 0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
// TBD: leave lighting on to allow vehicle lights to affect it?
|
// TBD: leave lighting on to allow vehicle lights to affect it?
|
||||||
::glDisable( GL_LIGHTING );
|
::glDisable( GL_LIGHTING );
|
||||||
|
|||||||
Reference in New Issue
Block a user