build 180928. heater sound, minor precipitation tweaks, minor bug fixes

This commit is contained in:
tmj-fstate
2018-09-28 19:18:24 +02:00
parent 7c60829f54
commit 226ddb6291
8 changed files with 42 additions and 18 deletions

View File

@@ -2157,7 +2157,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
btShutters1.Init( "shutters1", mdModel, false );
}
if( MoverParameters->dizel_heat.water_aux.config.shutters ) {
btShutters1.Init( "shutters2", mdModel, false );
btShutters2.Init( "shutters2", mdModel, false );
}
TurnOff(); // resetowanie zmiennych submodeli
@@ -3971,6 +3971,13 @@ void TDynamicObject::RenderSounds() {
sSmallCompressor.stop();
}
// heating sound
if( MoverParameters->Heating ) {
sHeater.play( sound_flags::exclusive | sound_flags::looping );
}
else {
sHeater.stop();
}
// brake system and braking sounds:
@@ -5393,6 +5400,12 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
sConverter.owner( this );
}
else if( token == "heater:" ) {
// train heating device
sHeater.deserialize( parser, sound_type::single );
sHeater.owner( this );
}
else if( token == "turbo:" ) {
// pliki z turbogeneratorem
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
auto const nullvector { glm::vec3() };
std::vector<sound_source *> enginesounds = {
&sConverter, &sCompressor, &sSmallCompressor
&sConverter, &sCompressor, &sSmallCompressor, &sHeater
};
for( auto sound : enginesounds ) {
if( sound->offset() == nullvector ) {

View File

@@ -409,6 +409,7 @@ private:
sound_source sConverter { sound_placement::engine };
sound_source sCompressor { sound_placement::engine }; // NBMX wrzesien 2003
sound_source sSmallCompressor { sound_placement::engine };
sound_source sHeater { sound_placement::engine };
// braking sounds
sound_source dsbPneumaticRelay { sound_placement::external };
sound_source rsBrake { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab

View File

@@ -209,7 +209,7 @@ void
TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
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;
}
m_targetvalue = fNewDesired;

View File

@@ -814,14 +814,17 @@ void
texture_manager::bind( std::size_t const Unit, texture_handle const Texture ) {
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 ) {
// don't bind again what's already active
return;
}
// 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 ) {
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid

View File

@@ -9,6 +9,8 @@ http://mozilla.org/MPL/2.0/.
#pragma once
#include "globals.h"
// encapsulation of the fixed pipeline opengl color
class opengl_color {
@@ -32,7 +34,7 @@ public:
inline
void
color4( glm::vec4 const &Color ) {
if( Color != m_color ) {
if( ( Color != m_color ) || ( false == Global.bUseVBO ) ) {
m_color = Color;
::glColor4fv( glm::value_ptr( m_color ) ); } }
inline

View File

@@ -341,7 +341,6 @@ opengl_dlgeometrybank::draw_( gfx::geometry_handle const &Geometry, gfx::stream_
auto const &chunk = gfx::geometry_bank::chunk( Geometry );
::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 );
for( auto const &vertex : chunk.vertices ) {
if( Streams & gfx::stream::normal ) { ::glNormal3fv( glm::value_ptr( vertex.normal ) ); }

View File

@@ -2837,17 +2837,10 @@ opengl_renderer::Render_precipitation() {
colors::white,
0.5f * clamp<float>( Global.fLuminance, 0.f, 1.f ) ) ) );
::glPushMatrix();
// tilt the precipitation cone against the velocity vector for crude motion blur
auto const velocity { simulation::Environment.m_precipitation.m_cameramove * -1.0 };
if( glm::length2( velocity ) > 0.0 ) {
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 const rotationangle {
std::min(
@@ -2857,6 +2850,19 @@ opengl_renderer::Render_precipitation() {
simulation::Train->Dynamic()->GetVelocity() * 0.2 ) ) };
::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?
::glDisable( GL_LIGHTING );

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 18
#define VERSION_MINOR 923
#define VERSION_REVISION 1
#define VERSION_MINOR 928
#define VERSION_REVISION 0