mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
selected pantograph control switches, minor bug fixes
This commit is contained in:
13
Gauge.cpp
13
Gauge.cpp
@@ -150,16 +150,21 @@ double TGauge::GetValue() const {
|
||||
return ( fValue - fOffset ) / fScale;
|
||||
}
|
||||
|
||||
void TGauge::Update()
|
||||
{
|
||||
void TGauge::Update() {
|
||||
|
||||
float dt = Timer::GetDeltaTime();
|
||||
if( ( fFriction > 0 ) && ( dt < 0.5 * fFriction ) ) {
|
||||
// McZapkie-281102: zabezpieczenie przed oscylacjami dla dlugich czasow
|
||||
fValue += dt * ( fDesiredValue - fValue ) / fFriction;
|
||||
}
|
||||
else
|
||||
else {
|
||||
fValue = fDesiredValue;
|
||||
if (SubModel)
|
||||
}
|
||||
if( std::abs( fDesiredValue - fValue ) <= 0.001 ) {
|
||||
// close enough, we can stop updating the model
|
||||
fValue = fDesiredValue; // set it exactly as requested just in case it matters
|
||||
}
|
||||
if( SubModel )
|
||||
{ // warunek na wszelki wypadek, gdyby się submodel nie podłączył
|
||||
TSubModel *sm;
|
||||
switch (eType)
|
||||
|
||||
55
Model3d.cpp
55
Model3d.cpp
@@ -102,7 +102,7 @@ int TSubModel::SeekFaceNormal(std::vector<unsigned int> const &Masks, int const
|
||||
// pętla po trójkątach, od trójkąta (f)
|
||||
if( Masks[ faceidx ] & Mask ) {
|
||||
// jeśli wspólna maska powierzchni
|
||||
for( int vertexidx = 0; vertexidx < 2; ++vertexidx ) {
|
||||
for( int vertexidx = 0; vertexidx < 3; ++vertexidx ) {
|
||||
if( Vertices[ 3 * faceidx + vertexidx ].position == Position ) {
|
||||
return 3 * faceidx + vertexidx;
|
||||
}
|
||||
@@ -370,11 +370,27 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
|
||||
// transformation matrix
|
||||
fMatrix = new float4x4();
|
||||
readMatrix(parser, *fMatrix); // wczytanie transform
|
||||
if (!fMatrix->IdentityIs())
|
||||
iFlags |= 0x8000; // transform niejedynkowy - trzeba go przechować
|
||||
if( std::abs( Det( *fMatrix ) - 1.0f ) > 0.01f ) {
|
||||
ErrorLog( "Bad model: transformation matrix for sub-model \"" + pName + "\" imposes geometry scaling (factor: " + to_string( Det( *fMatrix ), 2 ) + ")" );
|
||||
m_normalizenormals = true;
|
||||
if( !fMatrix->IdentityIs() ) {
|
||||
iFlags |= 0x8000; // transform niejedynkowy - trzeba go przechować
|
||||
// check the scaling
|
||||
auto const matrix = glm::make_mat4( fMatrix->readArray() );
|
||||
glm::vec3 const scale{
|
||||
glm::length( glm::vec3( glm::column( matrix, 0 ) ) ),
|
||||
glm::length( glm::vec3( glm::column( matrix, 1 ) ) ),
|
||||
glm::length( glm::vec3( glm::column( matrix, 2 ) ) ) };
|
||||
if( ( std::abs( scale.x - 1.0f ) > 0.01 )
|
||||
|| ( std::abs( scale.y - 1.0f ) > 0.01 )
|
||||
|| ( std::abs( scale.z - 1.0f ) > 0.01 ) ) {
|
||||
ErrorLog(
|
||||
"Bad model: transformation matrix for sub-model \"" + pName + "\" imposes geometry scaling (factors: "
|
||||
+ to_string( scale.x, 2 ) + ", "
|
||||
+ to_string( scale.y, 2 ) + ", "
|
||||
+ to_string( scale.z, 2 ) + ")" );
|
||||
m_normalizenormals = (
|
||||
( ( std::abs( scale.x - scale.y ) < 0.01f ) && ( std::abs( scale.y - scale.z ) < 0.01f ) ) ?
|
||||
rescale :
|
||||
normalize );
|
||||
}
|
||||
}
|
||||
if (eType < TP_ROTATOR)
|
||||
{ // wczytywanie wierzchołków
|
||||
@@ -1538,7 +1554,7 @@ void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||
auto normallength = glm::length2( vertex.normal );
|
||||
if( ( false == submodel.m_normalizenormals )
|
||||
&& ( std::abs( normallength - 1.0f ) > 0.01f ) ) {
|
||||
submodel.m_normalizenormals = true;
|
||||
submodel.m_normalizenormals = TSubModel::normalize; // we don't know if uniform scaling would suffice
|
||||
WriteLog( "Bad model: non-unit normal vector(s) encountered during sub-model geometry deserialization" );
|
||||
}
|
||||
}
|
||||
@@ -1694,13 +1710,26 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
|
||||
|
||||
iFlags &= ~0x0200; // wczytano z pliku binarnego (nie jest właścicielem tablic)
|
||||
|
||||
if( ( fMatrix != nullptr )
|
||||
&& ( std::abs( Det( *fMatrix ) - 1.0f ) > 0.01f ) ) {
|
||||
// check whether we need to enable normal vectors normalization for this submodel
|
||||
ErrorLog( "Bad model: transformation matrix for sub-model \"" + pName + "\" imposes geometry scaling (factor: " + to_string( Det( *fMatrix ), 2 ) + ")" );
|
||||
m_normalizenormals = true;
|
||||
if( fMatrix != nullptr ) {
|
||||
auto const matrix = glm::make_mat4( fMatrix->readArray() );
|
||||
glm::vec3 const scale {
|
||||
glm::length( glm::vec3( glm::column( matrix, 0 ) ) ),
|
||||
glm::length( glm::vec3( glm::column( matrix, 1 ) ) ),
|
||||
glm::length( glm::vec3( glm::column( matrix, 2 ) ) ) };
|
||||
if( ( std::abs( scale.x - 1.0f ) > 0.01 )
|
||||
|| ( std::abs( scale.y - 1.0f ) > 0.01 )
|
||||
|| ( std::abs( scale.z - 1.0f ) > 0.01 ) ) {
|
||||
ErrorLog(
|
||||
"Bad model: transformation matrix for sub-model \"" + pName + "\" imposes geometry scaling (factors: "
|
||||
+ to_string( scale.x, 2 ) + ", "
|
||||
+ to_string( scale.y, 2 ) + ", "
|
||||
+ to_string( scale.z, 2 ) + ")" );
|
||||
m_normalizenormals = (
|
||||
( ( std::abs( scale.x - scale.y ) < 0.01f ) && ( std::abs( scale.y - scale.z ) < 0.01f ) ) ?
|
||||
rescale :
|
||||
normalize );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void TModel3d::LoadFromBinFile(std::string const &FileName, bool dynamic)
|
||||
|
||||
@@ -58,6 +58,13 @@ class TSubModel
|
||||
friend class TModel3d; // temporary workaround. TODO: clean up class content/hierarchy
|
||||
friend class TDynamicObject; // temporary etc
|
||||
|
||||
public:
|
||||
enum normalization {
|
||||
none = 0,
|
||||
rescale,
|
||||
normalize
|
||||
};
|
||||
|
||||
private:
|
||||
int iNext{ NULL };
|
||||
int iChild{ NULL };
|
||||
@@ -96,7 +103,7 @@ private:
|
||||
f4Diffuse { 1.0f,1.0f,1.0f,1.0f },
|
||||
f4Specular { 0.0f,0.0f,0.0f,1.0f },
|
||||
f4Emision { 1.0f,1.0f,1.0f,1.0f };
|
||||
bool m_normalizenormals { false }; // indicates vectors need to be normalized due to scaling etc
|
||||
normalization m_normalizenormals { normalization::none }; // indicates vectors need to be normalized due to scaling etc
|
||||
float fWireSize { 0.0f }; // nie używane, ale wczytywane
|
||||
float fSquareMaxDist { 10000.0f * 10000.0f };
|
||||
float fSquareMinDist { 0.0f };
|
||||
|
||||
@@ -815,7 +815,7 @@ texture_manager::bind( texture_handle const Texture ) {
|
||||
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
|
||||
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid
|
||||
::glBindTexture( GL_TEXTURE_2D, texture(Texture).id );
|
||||
m_activetexture = texture(Texture).id;
|
||||
m_activetexture = Texture;
|
||||
#else
|
||||
if( texture( Texture ).bind() == resource_state::good ) {
|
||||
m_activetexture = Texture;
|
||||
|
||||
170
Train.cpp
170
Train.cpp
@@ -1225,24 +1225,28 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantFrontButton.SubModel ) {
|
||||
Train->ggPantFrontButton.UpdateValue( 1.0 );
|
||||
}
|
||||
if( Train->ggPantFrontButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
Train->ggPantFrontButton.UpdateValue( 1.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedButton.UpdateValue( 1.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 0.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ...or turn off
|
||||
if( ( Train->mvOccupied->PantSwitchType == "impulse" )
|
||||
&& ( Train->ggPantFrontButtonOff.SubModel == nullptr ) ) {
|
||||
// with impulse buttons we expect a dedicated switch to lower the pantograph, and if the cabin lacks it
|
||||
// then another control has to be used (like pantographlowerall)
|
||||
// TODO: we should have a way to define presense of cab controls without having to bind these to 3d submodels
|
||||
return;
|
||||
if( Train->mvOccupied->PantSwitchType == "impulse" ) {
|
||||
if( ( Train->ggPantFrontButtonOff.SubModel == nullptr )
|
||||
&& ( Train->ggPantSelectedDownButton.SubModel == nullptr ) ) {
|
||||
// with impulse buttons we expect a dedicated switch to lower the pantograph, and if the cabin lacks it
|
||||
// then another control has to be used (like pantographlowerall)
|
||||
// TODO: we should have a way to define presense of cab controls without having to bind these to 3d submodels
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
@@ -1252,8 +1256,14 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantFrontButton.UpdateValue( 0.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 1.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1264,9 +1274,10 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
if( Train->ggPantFrontButton.GetValue() > 0.35 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
if( Train->ggPantFrontButton.SubModel ) {
|
||||
Train->ggPantFrontButton.UpdateValue( 0.0 );
|
||||
}
|
||||
Train->ggPantFrontButton.UpdateValue( 0.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedButton.UpdateValue( 0.0 );
|
||||
// also the switch off button, in cabs which have it
|
||||
if( Train->ggPantFrontButtonOff.GetValue() > 0.35 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
@@ -1274,6 +1285,11 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
if( Train->ggPantFrontButtonOff.SubModel ) {
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
if( Train->ggPantSelectedDownButton.SubModel ) {
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1290,24 +1306,28 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantRearButton.SubModel ) {
|
||||
Train->ggPantRearButton.UpdateValue( 1.0 );
|
||||
}
|
||||
if( Train->ggPantRearButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
Train->ggPantRearButton.UpdateValue( 1.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedButton.UpdateValue( 1.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 0.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ...or turn off
|
||||
if( ( Train->mvOccupied->PantSwitchType == "impulse" )
|
||||
&& ( Train->ggPantRearButtonOff.SubModel == nullptr ) ) {
|
||||
// with impulse buttons we expect a dedicated switch to lower the pantograph, and if the cabin lacks it
|
||||
// then another control has to be used (like pantographlowerall)
|
||||
// TODO: we should have a way to define presense of cab controls without having to bind these to 3d submodels
|
||||
return;
|
||||
if( Train->mvOccupied->PantSwitchType == "impulse" ) {
|
||||
if( ( Train->ggPantRearButtonOff.SubModel == nullptr )
|
||||
&& ( Train->ggPantSelectedDownButton.SubModel == nullptr ) ) {
|
||||
// with impulse buttons we expect a dedicated switch to lower the pantograph, and if the cabin lacks it
|
||||
// then another control has to be used (like pantographlowerall)
|
||||
// TODO: we should have a way to define presense of cab controls without having to bind these to 3d submodels
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
@@ -1317,8 +1337,14 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantRearButton.UpdateValue( 0.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 1.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1329,9 +1355,10 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
if( Train->ggPantRearButton.GetValue() > 0.35 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
if( Train->ggPantRearButton.SubModel ) {
|
||||
Train->ggPantRearButton.UpdateValue( 0.0 );
|
||||
}
|
||||
Train->ggPantRearButton.UpdateValue( 0.0 );
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedButton.UpdateValue( 0.0 );
|
||||
// also the switch off button, in cabs which have it
|
||||
if( Train->ggPantRearButtonOff.GetValue() > 0.35 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
@@ -1339,6 +1366,11 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
if( Train->ggPantRearButtonOff.SubModel ) {
|
||||
Train->ggPantRearButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
if( Train->ggPantSelectedDownButton.SubModel ) {
|
||||
// NOTE: currently we animate the selectable pantograph control based on standard key presses
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1400,7 +1432,8 @@ void TTrain::OnCommand_pantographcompressoractivate( TTrain *Train, command_data
|
||||
|
||||
void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Train->ggPantAllDownButton.SubModel == nullptr ) {
|
||||
if( ( Train->ggPantAllDownButton.SubModel == nullptr )
|
||||
&& ( Train->ggPantSelectedDownButton.SubModel == nullptr ) ) {
|
||||
// TODO: expand definition of cab controls so we can know if the control is present without testing for presence of 3d switch
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
WriteLog( "Lower All Pantographs switch is missing, or wasn't defined" );
|
||||
@@ -1423,6 +1456,9 @@ void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Co
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggPantAllDownButton.UpdateValue( 1.0 );
|
||||
if( Train->ggPantSelectedDownButton.SubModel != nullptr ) {
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// release the button
|
||||
@@ -1436,6 +1472,9 @@ void TTrain::OnCommand_pantographlowerall( TTrain *Train, command_data const &Co
|
||||
*/
|
||||
// visual feedback
|
||||
Train->ggPantAllDownButton.UpdateValue( 0.0 );
|
||||
if( Train->ggPantSelectedDownButton.SubModel != nullptr ) {
|
||||
Train->ggPantSelectedDownButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4830,15 +4869,10 @@ bool TTrain::Update( double const Deltatime )
|
||||
// NBMX wrzesien 2003 - drzwi
|
||||
ggDoorLeftButton.Update();
|
||||
ggDoorRightButton.Update();
|
||||
ggDepartureSignalButton.Update();
|
||||
ggDoorSignallingButton.Update();
|
||||
// NBMX dzwignia sprezarki
|
||||
ggCompressorButton.Update();
|
||||
ggCompressorLocalButton.Update();
|
||||
ggMainButton.Update();
|
||||
ggRadioButton.Update();
|
||||
ggConverterButton.Update();
|
||||
ggConverterLocalButton.Update();
|
||||
ggConverterOffButton.Update();
|
||||
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) == 0 ) && ( ( DynamicObject->iLights[ 1 ] ) == 0 ) )
|
||||
@@ -4989,15 +5023,6 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
ggDimHeadlightsButton.Update();
|
||||
//---------
|
||||
// Winger 010304 - pantografy
|
||||
// NOTE: shouldn't the pantograph updates check whether it's front or rear cabin?
|
||||
ggPantFrontButton.Update();
|
||||
ggPantRearButton.Update();
|
||||
ggPantFrontButtonOff.Update();
|
||||
ggTrainHeatingButton.Update();
|
||||
ggSignallingButton.Update();
|
||||
ggDoorSignallingButton.Update();
|
||||
// Winger 020304 - ogrzewanie
|
||||
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
||||
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
||||
(mvControlled->ConvOvldFlag == false)) ||
|
||||
@@ -5813,10 +5838,15 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggStLinOffButton.Update();
|
||||
ggRadioButton.Update();
|
||||
ggDepartureSignalButton.Update();
|
||||
|
||||
ggPantFrontButton.Update();
|
||||
ggPantRearButton.Update();
|
||||
ggPantSelectedButton.Update();
|
||||
ggPantFrontButtonOff.Update();
|
||||
ggPantRearButtonOff.Update();
|
||||
ggPantSelectedDownButton.Update();
|
||||
ggPantAllDownButton.Update();
|
||||
|
||||
ggUpperLightButton.Update();
|
||||
ggLeftLightButton.Update();
|
||||
ggRightLightButton.Update();
|
||||
@@ -5829,8 +5859,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggRearLeftEndLightButton.Update();
|
||||
ggRearRightEndLightButton.Update();
|
||||
//------------
|
||||
ggPantAllDownButton.Update();
|
||||
ggConverterButton.Update();
|
||||
ggConverterLocalButton.Update();
|
||||
ggConverterOffButton.Update();
|
||||
ggTrainHeatingButton.Update();
|
||||
ggSignallingButton.Update();
|
||||
@@ -6630,7 +6660,6 @@ void TTrain::SetLights()
|
||||
// clears state of all cabin controls
|
||||
void TTrain::clear_cab_controls()
|
||||
{
|
||||
|
||||
ggMainCtrl.Clear();
|
||||
ggMainCtrlAct.Clear();
|
||||
ggScndCtrl.Clear();
|
||||
@@ -6670,7 +6699,10 @@ void TTrain::clear_cab_controls()
|
||||
ggConverterButton.Clear();
|
||||
ggPantFrontButton.Clear();
|
||||
ggPantRearButton.Clear();
|
||||
ggPantSelectedButton.Clear();
|
||||
ggPantFrontButtonOff.Clear();
|
||||
ggPantRearButtonOff.Clear();
|
||||
ggPantSelectedDownButton.Clear();
|
||||
ggPantAllDownButton.Clear();
|
||||
ggZbS.Clear();
|
||||
ggI1B.Clear();
|
||||
@@ -6787,6 +6819,16 @@ void TTrain::set_cab_controls() {
|
||||
( mvControlled->PantFrontUp ?
|
||||
0.0 :
|
||||
1.0 ) );
|
||||
// NOTE: currently we animate the selectable pantograph control for both pantographs
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
ggPantSelectedButton.PutValue(
|
||||
( mvControlled->PantFrontUp ?
|
||||
1.0 :
|
||||
0.0 ) );
|
||||
ggPantSelectedDownButton.PutValue(
|
||||
( mvControlled->PantFrontUp ?
|
||||
0.0 :
|
||||
1.0 ) );
|
||||
}
|
||||
if( mvOccupied->PantSwitchType != "impulse" ) {
|
||||
ggPantRearButton.PutValue(
|
||||
@@ -6797,6 +6839,16 @@ void TTrain::set_cab_controls() {
|
||||
( mvControlled->PantRearUp ?
|
||||
0.0 :
|
||||
1.0 ) );
|
||||
// NOTE: currently we animate the selectable pantograph control for both pantographs
|
||||
// TODO: implement actual selection control, and refactor handling this control setup in a separate method
|
||||
ggPantSelectedButton.PutValue(
|
||||
( mvControlled->PantRearUp ?
|
||||
1.0 :
|
||||
0.0 ) );
|
||||
ggPantSelectedDownButton.PutValue(
|
||||
( mvControlled->PantRearUp ?
|
||||
0.0 :
|
||||
1.0 ) );
|
||||
}
|
||||
// converter
|
||||
if( mvOccupied->ConvSwitchType != "impulse" ) {
|
||||
@@ -7397,16 +7449,22 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
||||
ggPantFrontButtonOff.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if( Label == "pantrearoff_sw:" ) {
|
||||
// patyk przedni w dol
|
||||
// rear pant down
|
||||
ggPantRearButtonOff.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
else if( Label == "pantalloff_sw:" )
|
||||
{
|
||||
// patyk przedni w dol
|
||||
else if( Label == "pantalloff_sw:" ) {
|
||||
// both pantographs down
|
||||
ggPantAllDownButton.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "trainheating_sw:")
|
||||
{
|
||||
else if( Label == "pantselected_sw:" ) {
|
||||
// operate selected pantograph(s)
|
||||
ggPantSelectedButton.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
else if( Label == "pantselectedoff_sw:" ) {
|
||||
// operate selected pantograph(s)
|
||||
ggPantSelectedDownButton.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
else if (Label == "trainheating_sw:") {
|
||||
// grzanie skladu
|
||||
ggTrainHeatingButton.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
|
||||
2
Train.h
2
Train.h
@@ -285,6 +285,8 @@ public: // reszta może by?publiczna
|
||||
TGauge ggPantFrontButtonOff; // EZT
|
||||
TGauge ggPantRearButtonOff;
|
||||
TGauge ggPantAllDownButton;
|
||||
TGauge ggPantSelectedButton;
|
||||
TGauge ggPantSelectedDownButton;
|
||||
// Winger 020304 - wlacznik ogrzewania
|
||||
TGauge ggTrainHeatingButton;
|
||||
TGauge ggSignallingButton;
|
||||
|
||||
39
renderer.cpp
39
renderer.cpp
@@ -360,7 +360,7 @@ opengl_renderer::Bind( texture_handle const Texture ) {
|
||||
m_textures.bind( Texture );
|
||||
}
|
||||
|
||||
opengl_texture &
|
||||
opengl_texture const &
|
||||
opengl_renderer::Texture( texture_handle const Texture ) {
|
||||
|
||||
return m_textures.texture( Texture );
|
||||
@@ -758,9 +758,15 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
// renderowanie obiektów OpenGL
|
||||
if( Submodel->iAlpha & Submodel->iFlags & 0x1F ) // rysuj gdy element nieprzezroczysty
|
||||
{
|
||||
if( true == Submodel->m_normalizenormals ) {
|
||||
::glEnable( GL_NORMALIZE );
|
||||
switch( Submodel->m_normalizenormals ) {
|
||||
case TSubModel::normalize: {
|
||||
::glEnable( GL_NORMALIZE ); break; }
|
||||
case TSubModel::rescale: {
|
||||
::glEnable( GL_RESCALE_NORMAL ); break; }
|
||||
default: {
|
||||
break; }
|
||||
}
|
||||
|
||||
// material configuration:
|
||||
// textures...
|
||||
if( Submodel->TextureID < 0 )
|
||||
@@ -794,8 +800,13 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
// restore default (lack of) brightness
|
||||
::glMaterialfv( GL_FRONT, GL_EMISSION, glm::value_ptr( colors::none ) );
|
||||
}
|
||||
if( true == Submodel->m_normalizenormals ) {
|
||||
::glDisable( GL_NORMALIZE );
|
||||
switch( Submodel->m_normalizenormals ) {
|
||||
case TSubModel::normalize: {
|
||||
::glDisable( GL_NORMALIZE ); break; }
|
||||
case TSubModel::rescale: {
|
||||
::glDisable( GL_RESCALE_NORMAL ); break; }
|
||||
default: {
|
||||
break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1217,8 +1228,13 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
// renderowanie obiektów OpenGL
|
||||
if( Submodel->iAlpha & Submodel->iFlags & 0x2F ) // rysuj gdy element przezroczysty
|
||||
{
|
||||
if( true == Submodel->m_normalizenormals ) {
|
||||
::glEnable( GL_NORMALIZE );
|
||||
switch( Submodel->m_normalizenormals ) {
|
||||
case TSubModel::normalize: {
|
||||
::glEnable( GL_NORMALIZE ); break; }
|
||||
case TSubModel::rescale: {
|
||||
::glEnable( GL_RESCALE_NORMAL ); break; }
|
||||
default: {
|
||||
break; }
|
||||
}
|
||||
// textures...
|
||||
if( Submodel->TextureID < 0 ) { // zmienialne skóry
|
||||
@@ -1250,8 +1266,13 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
// restore default (lack of) brightness
|
||||
::glMaterialfv( GL_FRONT, GL_EMISSION, glm::value_ptr( colors::none ) );
|
||||
}
|
||||
if( true == Submodel->m_normalizenormals ) {
|
||||
::glDisable( GL_NORMALIZE );
|
||||
switch( Submodel->m_normalizenormals ) {
|
||||
case TSubModel::normalize: {
|
||||
::glDisable( GL_NORMALIZE ); break; }
|
||||
case TSubModel::rescale: {
|
||||
::glDisable( GL_RESCALE_NORMAL ); break; }
|
||||
default: {
|
||||
break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
GetTextureId( std::string Filename, std::string const &Dir, int const Filter = -1, bool const Loadnow = true );
|
||||
void
|
||||
Bind( texture_handle const Texture );
|
||||
opengl_texture &
|
||||
opengl_texture const &
|
||||
Texture( texture_handle const Texture );
|
||||
|
||||
// members
|
||||
|
||||
1
stdafx.h
1
stdafx.h
@@ -84,6 +84,7 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <glm/gtx/rotate_vector.hpp>
|
||||
|
||||
Reference in New Issue
Block a user