partial render code revert, oerlikon brakes fix, sound fixes

This commit is contained in:
tmj-fstate
2017-03-16 22:18:14 +01:00
parent b878b3e407
commit 441b39ce5f
26 changed files with 518 additions and 437 deletions

View File

@@ -128,6 +128,10 @@ void TAdvancedSound::Update(bool ListenerInside, vector3 NewPosition)
void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition)
{ // update, ale z amplituda i czestotliwoscia
if( State == ss_Off ) {
return;
}
if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
{
SoundShut.Stop(); // hunter-311211

View File

@@ -411,6 +411,13 @@ TAnimModel::TAnimModel()
pModel = NULL;
iNumLights = 0;
fBlinkTimer = 0;
#ifdef EU07_USE_OLD_RENDERCODE
ReplacableSkinId[ 0 ] = 0;
ReplacableSkinId[ 1 ] = 0;
ReplacableSkinId[ 2 ] = 0;
ReplacableSkinId[ 3 ] = 0;
ReplacableSkinId[ 4 ] = 0;
#endif
for (int i = 0; i < iMaxNumLights; i++)
{
LightsOn[i] = LightsOff[i] = NULL; // normalnie nie ma
@@ -436,7 +443,28 @@ bool TAnimModel::Init(TModel3d *pNewModel)
pModel = pNewModel;
return (pModel != NULL);
}
#ifdef EU07_USE_OLD_RENDERCODE
bool TAnimModel::Init(std::string const &asName, std::string const &asReplacableTexture)
{
if (asReplacableTexture.substr(0, 1) ==
"*") // od gwiazdki zaczynają się teksty na wyświetlaczach
asText = asReplacableTexture.substr(1, asReplacableTexture.length() - 1); // zapamiętanie tekstu
else if (asReplacableTexture != "none")
ReplacableSkinId[1] =
GfxRenderer.GetTextureId( asReplacableTexture, "" );
if( ( ReplacableSkinId[ 1 ] != 0 )
&& ( GfxRenderer.Texture( ReplacableSkinId[ 1 ] ).has_alpha ) ) {
// tekstura z kanałem alfa - nie renderować w cyklu nieprzezroczystych
iTexAlpha = 0x31310031;
}
else{
// tekstura nieprzezroczysta - nie renderować w cyklu
iTexAlpha = 0x30300030;
}
// przezroczystych
return (Init(TModelsManager::GetModel(asName)));
}
#else
bool TAnimModel::Init(std::string const &asName, std::string const &asReplacableTexture)
{
if (asReplacableTexture.substr(0, 1) ==
@@ -457,6 +485,7 @@ bool TAnimModel::Init(std::string const &asName, std::string const &asReplacable
// przezroczystych
return (Init(TModelsManager::GetModel(asName)));
}
#endif
bool TAnimModel::Load(cParser *parser, bool ter)
{ // rozpoznanie wpisu modelu i ustawienie świateł
@@ -624,6 +653,21 @@ void TAnimModel::RenderAlphaDL(vector3 pPosition, double fAngle)
pModel->RenderAlpha(pPosition, fAngle, ReplacableSkinId, iTexAlpha);
};
*/
#ifdef EU07_USE_OLD_RENDERCODE
int TAnimModel::Flags()
{ // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed
int i = pModel ? pModel->Flags() : 0; // pobranie flag całego modelu
if (ReplacableSkinId[1] > 0) // jeśli ma wymienną teksturę 0
i |= (i & 0x01010001) * ((iTexAlpha & 1) ? 0x20 : 0x10);
// if (ReplacableSkinId[2]>0) //jeśli ma wymienną teksturę 1
// i|=(i&0x02020002)*((iTexAlpha&1)?0x10:0x08);
// if (ReplacableSkinId[3]>0) //jeśli ma wymienną teksturę 2
// i|=(i&0x04040004)*((iTexAlpha&1)?0x08:0x04);
// if (ReplacableSkinId[4]>0) //jeśli ma wymienną teksturę 3
// i|=(i&0x08080008)*((iTexAlpha&1)?0x04:0x02);
return i;
};
#else
int TAnimModel::Flags()
{ // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed
int i = pModel ? pModel->Flags() : 0; // pobranie flag całego modelu
@@ -637,6 +681,7 @@ int TAnimModel::Flags()
// i|=(i&0x08080008)*((iTexAlpha&1)?0x04:0x02);
return i;
};
#endif
//-----------------------------------------------------------------------------
// 2011-03-16 cztery nowe funkcje renderowania z możliwością pochylania obiektów
@@ -647,13 +692,21 @@ void TAnimModel::RenderDL(vector3 *vPosition)
RaAnimate(); // jednorazowe przeliczenie animacji
RaPrepare();
if( pModel ) // renderowanie rekurencyjne submodeli
#ifdef EU07_USE_OLD_RENDERCODE
pModel->Render(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
#else
GfxRenderer.Render( pModel, Material(), *vPosition, vAngle );
#endif
};
void TAnimModel::RenderAlphaDL(vector3 *vPosition)
{
RaPrepare();
if (pModel) // renderowanie rekurencyjne submodeli
#ifdef EU07_USE_OLD_RENDERCODE
pModel->RenderAlpha(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
#else
GfxRenderer.Render_Alpha( pModel, Material(), *vPosition, vAngle );
#endif
};
/*
void TAnimModel::RenderVBO(vector3 *vPosition)

View File

@@ -139,10 +139,11 @@ class TAnimModel
TSubModel *LightsOn[iMaxNumLights]; // Ra: te wskaźniki powinny być w ramach TModel3d
TSubModel *LightsOff[iMaxNumLights];
vector3 vAngle; // bazowe obroty egzemplarza względem osi
/*
#ifdef EU07_USE_OLD_RENDERCODE
int iTexAlpha; //żeby nie sprawdzać za każdym razem, dla 4 wymiennych tekstur
*/
#else
material_data m_materialdata;
#endif
std::string asText; // tekst dla wyświetlacza znakowego
TAnimAdvanced *pAdvanced;
@@ -154,12 +155,14 @@ class TAnimModel
void RaAnimate(); // przeliczenie animacji egzemplarza
void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
public:
/*
#ifdef EU07_USE_OLD_RENDERCODE
texture_manager::size_type ReplacableSkinId[5]; // McZapkie-020802: zmienialne skory
*/
#endif
static TAnimContainer *acAnimList; // lista animacji z eventem, które muszą być przeliczane również bez wyświetlania
#ifndef EU07_USE_OLD_RENDERCODE
inline
material_data const *Material() const { return &m_materialdata; }
#endif
TAnimModel();
~TAnimModel();

View File

@@ -1692,6 +1692,14 @@ TDynamicObject::TDynamicObject()
//}
mdModel = NULL;
mdKabina = NULL;
#ifdef EU07_USE_OLD_RENDERCODE
ReplacableSkinID[ 0 ] = 0;
ReplacableSkinID[ 1 ] = 0;
ReplacableSkinID[ 2 ] = 0;
ReplacableSkinID[ 3 ] = 0;
ReplacableSkinID[ 4 ] = 0;
iAlpha = 0x30300030; // tak gdy tekstury wymienne nie mają przezroczystości
#endif
// smWiazary[0]=smWiazary[1]=NULL;
smWahacze[0] = smWahacze[1] = smWahacze[2] = smWahacze[3] = NULL;
fWahaczeAmp = 0;
@@ -3690,12 +3698,12 @@ void TDynamicObject::TurnOff()
btMechanik1.TurnOff();
btMechanik2.TurnOff();
};
/*
#ifdef EU07_USE_OLD_RENDERCODE
void TDynamicObject::Render()
{ // rysowanie elementów nieprzezroczystych
// youBy - sprawdzamy, czy jest sens renderowac
if (Global::pCamera->IsVisible(this))
if (GfxRenderer.Visible(this))
{
TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
// AnsiString asLoadName="";
@@ -3766,8 +3774,6 @@ void TDynamicObject::Render()
mdModel->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad) // renderowanie nieprzezroczystego ładunku
mdLoad->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdPrzedsionek)
mdPrzedsionek->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha);
}
else
{ // wersja Display Lists
@@ -3794,8 +3800,6 @@ void TDynamicObject::Render()
mdModel->Render(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad) // renderowanie nieprzezroczystego ładunku
mdLoad->Render(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdPrzedsionek)
mdPrzedsionek->Render(ObjSqrDist, ReplacableSkinID, iAlpha);
}
// Ra: czy ta kabina tu ma sens?
@@ -3868,12 +3872,84 @@ void TDynamicObject::Render()
TurnOff(); // przywrócenie domyślnych pozycji submodeli
} // yB - koniec mieszania z grafika
};
*/
void TDynamicObject::RenderAlpha()
{ // rysowanie elementów półprzezroczystych
if (renderme)
{
TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
double ObjSqrDist = SquareMagnitude(Global::pCameraPosition - vPosition);
ABuLittleUpdate(ObjSqrDist); // ustawianie zmiennych submodeli dla wspólnego modelu
glPushMatrix();
if (this == Global::pUserDynamic)
{ // specjalne ustawienie, aby nie trzęsło
glPopMatrix(); // to trzeba zebrać przed wyściem
return;
glLoadIdentity(); // zacząć od macierzy jedynkowej
Global::pCamera->SetCabMatrix(vPosition); // specjalne ustawienie kamery
}
else
glTranslated(vPosition.x, vPosition.y,
vPosition.z); // standardowe przesunięcie względem początku scenerii
glMultMatrixd(mMatrix.getArray());
#ifdef EU07_USE_OLD_LIGHTING_MODEL
// TODO: re-implement this
if (fShade > 0.0)
{ // Ra: zmiana oswietlenia w tunelu, wykopie
GLfloat ambientLight[4] = {0.5f, 0.5f, 0.5f, 1.0f};
GLfloat diffuseLight[4] = {0.5f, 0.5f, 0.5f, 1.0f};
GLfloat specularLight[4] = {0.5f, 0.5f, 0.5f, 1.0f};
// trochę problem z ambientem w wykopie...
for (int li = 0; li < 3; li++)
{
ambientLight[li] = Global::ambientDayLight[li] * fShade;
diffuseLight[li] = Global::diffuseDayLight[li] * fShade;
specularLight[li] = Global::specularDayLight[li] * fShade;
}
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
}
#endif
if (Global::bUseVBO)
{ // wersja VBO
if (mdLowPolyInt)
if (FreeFlyModeFlag ? true : !mdKabina || !bDisplayCab)
mdLowPolyInt->RaRenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
mdModel->RaRenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad)
mdLoad->RaRenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
}
else
{ // wersja Display Lists
if (mdLowPolyInt)
if (FreeFlyModeFlag ? true : !mdKabina || !bDisplayCab)
mdLowPolyInt->RenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
mdModel->RenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad)
mdLoad->RenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
}
#ifdef EU07_USE_OLD_LIGHTING_MODEL
// TODO: re-implement this
if (fShade != 0.0) // tylko jeśli było zmieniane
{ // przywrócenie standardowego oświetlenia
glLightfv(GL_LIGHT0, GL_AMBIENT, Global::ambientDayLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, Global::diffuseDayLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, Global::specularDayLight);
}
#endif
glPopMatrix();
if (btnOn)
TurnOff(); // przywrócenie domyślnych pozycji submodeli
}
return;
} // koniec renderalpha
#endif
void TDynamicObject::RenderSounds()
{ // przeliczanie dźwięków, bo będzie
// słychać bez wyświetlania sektora z
// pojazdem
{ // przeliczanie dźwięków, bo będzie słychać bez wyświetlania sektora z pojazdem
// if( Global::iPause > 0 ) { return; }
// McZapkie-010302: ulepszony dzwiek silnika
double freq;
double vol = 0;
@@ -3884,11 +3960,10 @@ void TDynamicObject::RenderSounds()
if (MoverParameters->Power > 0)
{
if ((rsSilnik.AM != 0) && ((MoverParameters->Mains) || (MoverParameters->EngineType ==
DieselEngine))) // McZapkie-280503:
// zeby dla dumb
// dzialal silnik na
// jalowych obrotach
if ((rsSilnik.AM != 0)
&& ((MoverParameters->Mains)
// McZapkie-280503: zeby dla dumb dzialal silnik na jalowych obrotach
|| (MoverParameters->EngineType == DieselEngine)))
{
if ((fabs(MoverParameters->enrot) > 0.01) ||
(MoverParameters->EngineType == Dumb)) //&& (MoverParameters->EnginePower>0.1))
@@ -4093,9 +4168,8 @@ void TDynamicObject::RenderSounds()
sSmallCompressor.Update(MechInside, GetPosition());
// youBy - przenioslem, bo diesel tez moze miec turbo
if ((MoverParameters->MainCtrlPos) >=
(MoverParameters->TurboTest)) // hunter-250312: dlaczego zakomentowane?
// Ra: bo nie działało dobrze
if( (MoverParameters->TurboTest > 0)
&& (MoverParameters->MainCtrlPos >= MoverParameters->TurboTest))
{
// udawanie turbo: (6.66*(eng_vol-0.85))
if (eng_turbo > 6.66 * (enginevolume - 0.8) + 0.2 * dt)
@@ -4238,86 +4312,6 @@ void TDynamicObject::RenderSounds()
}
*/
};
/*
void TDynamicObject::RenderAlpha()
{ // rysowanie elementów półprzezroczystych
if (renderme)
{
TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
double ObjSqrDist = SquareMagnitude(Global::pCameraPosition - vPosition);
ABuLittleUpdate(ObjSqrDist); // ustawianie zmiennych submodeli dla wspólnego modelu
glPushMatrix();
if (this == Global::pUserDynamic)
{ // specjalne ustawienie, aby nie trzęsło
if (Global::bSmudge)
{ // jak smuga, to rysować po smudze
glPopMatrix(); // to trzeba zebrać przed wyściem
return;
}
glLoadIdentity(); // zacząć od macierzy jedynkowej
Global::pCamera->SetCabMatrix(vPosition); // specjalne ustawienie kamery
}
else
glTranslated(vPosition.x, vPosition.y,
vPosition.z); // standardowe przesunięcie względem początku scenerii
glMultMatrixd(mMatrix.getArray());
#ifdef EU07_USE_OLD_LIGHTING_MODEL
// TODO: re-implement this
if (fShade > 0.0)
{ // Ra: zmiana oswietlenia w tunelu, wykopie
GLfloat ambientLight[4] = {0.5f, 0.5f, 0.5f, 1.0f};
GLfloat diffuseLight[4] = {0.5f, 0.5f, 0.5f, 1.0f};
GLfloat specularLight[4] = {0.5f, 0.5f, 0.5f, 1.0f};
// trochę problem z ambientem w wykopie...
for (int li = 0; li < 3; li++)
{
ambientLight[li] = Global::ambientDayLight[li] * fShade;
diffuseLight[li] = Global::diffuseDayLight[li] * fShade;
specularLight[li] = Global::specularDayLight[li] * fShade;
}
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
}
#endif
if (Global::bUseVBO)
{ // wersja VBO
if (mdLowPolyInt)
if (FreeFlyModeFlag ? true : !mdKabina || !bDisplayCab)
mdLowPolyInt->RaRenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
mdModel->RaRenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad)
mdLoad->RaRenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
// if (mdPrzedsionek) //Ra: przedsionków tu wcześniej nie było - włączyć?
// mdPrzedsionek->RaRenderAlpha(ObjSqrDist,ReplacableSkinID,iAlpha);
}
else
{ // wersja Display Lists
if (mdLowPolyInt)
if (FreeFlyModeFlag ? true : !mdKabina || !bDisplayCab)
mdLowPolyInt->RenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
mdModel->RenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad)
mdLoad->RenderAlpha(ObjSqrDist, ReplacableSkinID, iAlpha);
// if (mdPrzedsionek) //Ra: przedsionków tu wcześniej nie było - włączyć?
// mdPrzedsionek->RenderAlpha(ObjSqrDist,ReplacableSkinID,iAlpha);
}
#ifdef EU07_USE_OLD_LIGHTING_MODEL
// TODO: re-implement this
if (fShade != 0.0) // tylko jeśli było zmieniane
{ // przywrócenie standardowego oświetlenia
glLightfv(GL_LIGHT0, GL_AMBIENT, Global::ambientDayLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, Global::diffuseDayLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, Global::specularDayLight);
}
#endif
glPopMatrix();
if (btnOn)
TurnOff(); // przywrócenie domyślnych pozycji submodeli
}
return;
} // koniec renderalpha
*/
// McZapkie-250202
// wczytywanie pliku z danymi multimedialnymi (dzwieki)
@@ -4344,6 +4338,26 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
if( token == "models:") {
// modele i podmodele
#ifdef EU07_USE_OLD_RENDERCODE
iMultiTex = 0; // czy jest wiele tekstur wymiennych?
parser.getTokens();
parser >> asModel;
if( asModel[asModel.size() - 1] == '#' ) // Ra 2015-01: nie podoba mi siê to
{ // model wymaga wielu tekstur wymiennych
iMultiTex = 1;
asModel.erase( asModel.length() - 1 );
}
std::size_t i = asModel.find( ',' );
if ( i != std::string::npos )
{ // Ra 2015-01: może szukać przecinka w nazwie modelu, a po przecinku była by liczba tekstur?
if (i < asModel.length())
iMultiTex = asModel[i + 1] - '0';
if (iMultiTex < 0)
iMultiTex = 0;
else if (iMultiTex > 1)
iMultiTex = 1; // na razie ustawiamy na 1
}
#else
m_materialdata.multi_textures = 0; // czy jest wiele tekstur wymiennych?
parser.getTokens();
parser >> asModel;
@@ -4354,86 +4368,80 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
}
std::size_t i = asModel.find( ',' );
if ( i != std::string::npos )
{ // Ra 2015-01: może szukać przecinka w
// nazwie modelu, a po przecinku była by
// liczba
// tekstur?
{ // Ra 2015-01: może szukać przecinka w nazwie modelu, a po przecinku była by liczba tekstur?
if (i < asModel.length())
m_materialdata.multi_textures = asModel[i + 1] - '0';
m_materialdata.multi_textures = clamp( m_materialdata.multi_textures, 0, 1 ); // na razie ustawiamy na 1
}
#endif
asModel = BaseDir + asModel; // McZapkie 2002-07-20: dynamics maja swoje
// modele w dynamics/basedir
Global::asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/...
mdModel = TModelsManager::GetModel(asModel, true);
assert( mdModel != nullptr ); // TODO: handle this more gracefully than all going to shit
if (ReplacableSkin != "none")
#ifdef EU07_USE_OLD_RENDERCODE
{ // tekstura wymienna jest raczej jedynie w "dynamic\"
ReplacableSkin =
Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
if (!x.empty())
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9 );
/*
if ((i = ReplacableSkin.Pos("|")) > 0) // replacable dzielone
{
iMultiTex = -1;
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID(
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(),
Global::iDynamicFiltering);
ReplacableSkin.Delete(1, i); // usunięcie razem z pionową kreską
ReplacableSkin = Global::asCurrentTexturePath +
ReplacableSkin; // odtworzenie początku ścieżki
// sprawdzić, ile jest i ustawić iMultiTex na liczbę podanych tekstur
if (!ReplacableSkin.IsEmpty())
{ // próba wycięcia drugiej nazwy
iMultiTex = -2; // skoro zostało coś po kresce, to są co najmniej dwie
if ((i = ReplacableSkin.Pos("|")) == 0) // gdy nie ma już kreski
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID(
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(),
Global::iDynamicFiltering);
else
{ // jak jest kreska, to wczytać drugą i próbować trzecią
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID(
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(),
Global::iDynamicFiltering);
ReplacableSkin.Delete(1, i); // usunięcie razem z pionową kreską
ReplacableSkin = Global::asCurrentTexturePath +
ReplacableSkin; // odtworzenie początku ścieżki
if (!ReplacableSkin.IsEmpty())
{ // próba wycięcia trzeciej nazwy
iMultiTex =
-3; // skoro zostało coś po kresce, to są co najmniej trzy
if ((i = ReplacableSkin.Pos("|")) == 0) // gdy nie ma już kreski
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID(
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(),
Global::iDynamicFiltering);
else
{ // jak jest kreska, to wczytać trzecią i próbować czwartą
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID(
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(),
Global::iDynamicFiltering);
ReplacableSkin.Delete(1, i); // usunięcie razem z pionową kreską
ReplacableSkin = Global::asCurrentTexturePath +
ReplacableSkin; // odtworzenie początku ścieżki
if (!ReplacableSkin.IsEmpty())
{ // próba wycięcia trzeciej nazwy
iMultiTex = -4; // skoro zostało coś po kresce, to są co
// najmniej cztery
ReplacableSkinID[-iMultiTex] =
TTexturesManager::GetTextureID(
NULL, NULL,
ReplacableSkin.SubString(1, i - 1).c_str(),
Global::iDynamicFiltering);
// więcej na razie nie zadziała, a u tak trzeba to do modeli
// przenieść
}
}
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
if (!x.empty())
ReplacableSkinID[4] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9);
if (iMultiTex > 0)
{ // jeśli model ma 4 tekstury
ReplacableSkinID[1] = GfxRenderer.GetTextureId(
ReplacableSkin + ",1", "", Global::iDynamicFiltering);
if (ReplacableSkinID[1])
{ // pierwsza z zestawu znaleziona
ReplacableSkinID[2] = GfxRenderer.GetTextureId(
ReplacableSkin + ",2", "", Global::iDynamicFiltering);
if (ReplacableSkinID[2])
{
iMultiTex = 2; // już są dwie
ReplacableSkinID[3] = GfxRenderer.GetTextureId(
ReplacableSkin + ",3", "", Global::iDynamicFiltering);
if (ReplacableSkinID[3])
{
iMultiTex = 3; // a teraz nawet trzy
ReplacableSkinID[4] = GfxRenderer.GetTextureId(
ReplacableSkin + ",4", "", Global::iDynamicFiltering);
if (ReplacableSkinID[4])
iMultiTex = 4; // jak są cztery, to blokujemy podmianę tekstury rozkładem
}
}
}
else
{ // zestaw nie zadziałał, próbujemy normanie
iMultiTex = 0;
ReplacableSkinID[1] = GfxRenderer.GetTextureId(
ReplacableSkin, "", Global::iDynamicFiltering);
}
}
*/
else
ReplacableSkinID[1] = GfxRenderer.GetTextureId(
ReplacableSkin, "", Global::iDynamicFiltering);
if (GfxRenderer.Texture(ReplacableSkinID[1]).has_alpha)
iAlpha = 0x31310031; // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
else
iAlpha = 0x30300030; // wszystkie tekstury nieprzezroczyste - nie renderować w cyklu przezroczystych
if (ReplacableSkinID[2])
if (GfxRenderer.Texture(ReplacableSkinID[2]).has_alpha)
iAlpha |= 0x02020002; // tekstura -2 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
if (ReplacableSkinID[3])
if (GfxRenderer.Texture(ReplacableSkinID[3]).has_alpha)
iAlpha |= 0x04040004; // tekstura -3 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
if (ReplacableSkinID[4])
if (GfxRenderer.Texture(ReplacableSkinID[4]).has_alpha)
iAlpha |= 0x08080008; // tekstura -4 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
}
#else
{ // tekstura wymienna jest raczej jedynie w "dynamic\"
ReplacableSkin = Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
if (!x.empty())
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9 );
if (m_materialdata.multi_textures > 0)
{ // jeśli model ma 4 tekstury
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
@@ -4482,6 +4490,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
if( GfxRenderer.Texture( m_materialdata.replacable_skins[ 4 ] ).has_alpha )
m_materialdata.textures_alpha |= 0x08080008; // tekstura -4 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
}
#endif
if (!MoverParameters->LoadAccepted.empty())
// if (MoverParameters->LoadAccepted!=AnsiString("")); // &&
// MoverParameters->LoadType!=AnsiString("passengers"))
@@ -5763,6 +5772,54 @@ std::string TDynamicObject::TextureTest(std::string const &name)
return ""; // nie znaleziona
};
#ifdef EU07_USE_OLD_RENDERCODE
void TDynamicObject::DestinationSet(std::string to, std::string numer)
{ // ustawienie stacji
// docelowej oraz wymiennej
// tekstury 4, jeśli
// istnieje plik
// w zasadzie, to każdy wagon mógłby mieć inną stację docelową
// zwłaszcza w towarowych, pod kątem zautomatyzowania maewrów albo pracy górki
// ale to jeszcze potrwa, zanim będzie możliwe, na razie można wpisać stację z
// rozkładu
if (abs(iMultiTex) >= 4)
return; // jak są 4 tekstury wymienne, to nie zmieniać rozkładem
numer = Global::Bezogonkow(numer);
asDestination = to;
to = Global::Bezogonkow(to); // do szukania pliku obcinamy ogonki
std::string x = TextureTest(asBaseDir + numer + "@" + MoverParameters->TypeName);
if (!x.empty())
{
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
return;
}
x = TextureTest(asBaseDir + numer );
if (!x.empty())
{
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
return;
}
if (to.empty())
to = "nowhere";
x = TextureTest(asBaseDir + to + "@" + MoverParameters->TypeName); // w pierwszej kolejności z nazwą FIZ/MMD
if (!x.empty())
{
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
return;
}
x = TextureTest(asBaseDir + to); // na razie prymitywnie
if (!x.empty())
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
else
{
x = TextureTest(asBaseDir + "nowhere"); // jak nie znalazł dedykowanej, to niech daje nowhere
if (!x.empty())
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9);
}
// Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa
// tekstury nr 4
};
#else
void TDynamicObject::DestinationSet(std::string to, std::string numer)
{ // ustawienie stacji docelowej oraz wymiennej tekstury 4, jeśli istnieje plik
// w zasadzie, to każdy wagon mógłby mieć inną stację docelową
@@ -5806,6 +5863,7 @@ void TDynamicObject::DestinationSet(std::string to, std::string numer)
// Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa
// tekstury nr 4
};
#endif
void TDynamicObject::OverheadTrack(float o)
{ // ewentualne wymuszanie jazdy

View File

@@ -141,6 +141,7 @@ class TAnim
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef EU07_USE_OLD_RENDERCODE
// parameters for the material object, as currently used by various simulator models
struct material_data {
@@ -152,6 +153,7 @@ struct material_data {
::SecureZeroMemory( replacable_skins, sizeof( replacable_skins ) );
}
};
#endif
class TDynamicObject { // klasa pojazdu
@@ -198,11 +200,15 @@ public: // modele składowe pojazdu
float fShade; // zacienienie: 0:normalnie, -1:w ciemności, +1:dodatkowe światło (brak koloru?)
private: // zmienne i metody do animacji submodeli; Ra: sprzatam animacje w pojeździe
#ifndef EU07_USE_OLD_RENDERCODE
material_data m_materialdata;
#endif
public:
#ifndef EU07_USE_OLD_RENDERCODE
inline
material_data const *Material() const { return &m_materialdata; }
#endif
// tymczasowo udostępnione do wyszukiwania drutu
int iAnimType[ ANIM_TYPES ]; // 0-osie,1-drzwi,2-obracane,3-zderzaki,4-wózki,5-pantografy,6-tłoki
private:
@@ -415,11 +421,11 @@ public: // modele składowe pojazdu
int iCabs; // maski bitowe modeli kabin
TTrack *MyTrack; // McZapkie-030303: tor na ktorym stoi, ABu
std::string asBaseDir;
/*
#ifdef EU07_USE_OLD_RENDERCODE
texture_manager::size_type ReplacableSkinID[5]; // McZapkie:zmienialne nadwozie
int iAlpha; // maska przezroczystości tekstur
int iMultiTex; //<0 tekstury wskazane wpisem, >0 tekstury z przecinkami, =0 jedna
*/
#endif
int iOverheadMask; // maska przydzielana przez AI pojazdom posiadającym pantograf, aby wymuszały
// jazdę bezprądową
TTractionParam tmpTraction;
@@ -438,10 +444,10 @@ public: // modele składowe pojazdu
bool FastUpdate(double dt);
void Move(double fDistance);
void FastMove(double fDistance);
/*
#ifdef EU07_USE_OLD_RENDERCODE
void Render();
void RenderAlpha();
*/
#endif
void RenderSounds();
inline vector3 GetPosition() const
{

View File

@@ -134,13 +134,13 @@ void key_callback( GLFWwindow *window, int key, int scancode, int action, int mo
}
#endif
case GLFW_KEY_ESCAPE: {
/*
if( ( DebugModeFlag ) //[Esc] pauzuje tylko bez Debugmode
&& ( Global::iPause == 0 ) ) { // but unpausing should work always
break;
}
*/
if( Global::iPause & 1 ) // jeśli pauza startowa
Global::iPause &= ~1; // odpauzowanie, gdy po wczytaniu miało nie startować
else if( !( Global::iMultiplayer & 2 ) ) // w multiplayerze pauza nie ma sensu
@@ -277,7 +277,9 @@ int main(int argc, char *argv[])
glfwWindowHint(GLFW_REFRESH_RATE, vmode->refreshRate);
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
glfwWindowHint(GLFW_SAMPLES, 1 << Global::iMultisampling);
if( Global::iMultisampling > 0 ) {
glfwWindowHint( GLFW_SAMPLES, 1 << Global::iMultisampling );
}
if (Global::bFullScreen)
{

View File

@@ -2085,9 +2085,12 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
// if the vehicle has defined light source, it can (potentially) emit light, so add it to the light array
*/
if( ( tmp != nullptr )
&& ( tmp->DynamicObject->MoverParameters->SecuritySystem.SystemType != 0 ) ) {
// we check for presence of security system, as a way to determine whether the vehicle is a controllable engine
// NOTE: this isn't 100% precise, e.g. middle EZT module comes with security system, while it has no lights
&& ( tmp->DynamicObject->MoverParameters->CategoryFlag == 1 ) // trains only
&& ( ( tmp->DynamicObject->MoverParameters->SecuritySystem.SystemType != 0 )
|| ( tmp->DynamicObject->MoverParameters->SandCapacity > 0.0 ) ) ) {
// we check for presence of security system or sand load, as a way to determine whether the vehicle is a controllable engine
// NOTE: this isn't 100% precise, e.g. middle EZT module comes with security system, while it has no lights, and some engines
// don't have security systems fitted
m_lights.insert( tmp->DynamicObject );
}

View File

@@ -1127,6 +1127,7 @@ private:
void LoadFIZ_Circuit( std::string const &Input );
void LoadFIZ_RList( std::string const &Input );
void LoadFIZ_DList( std::string const &Input );
void LoadFIZ_FFList( std::string const &Input );
void LoadFIZ_LightsList( std::string const &Input );
void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input );
TPowerType LoadFIZ_PowerDecode( std::string const &Power );

View File

@@ -2421,7 +2421,7 @@ bool TMoverParameters::DecBrakeLevelOld(void)
bool TMoverParameters::IncLocalBrakeLevel(int CtrlSpeed)
{
bool IBL;
if ((LocalBrakePos < LocalBrakePosNo) /*and (BrakeCtrlPos<1)*/)
if ((LocalBrakePos < LocalBrakePosNo) /*and (BrakeCtrlPos<1)*/)
{
while ((LocalBrakePos < LocalBrakePosNo) && (CtrlSpeed > 0))
{
@@ -6139,7 +6139,8 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if( issection( "ffList:", inputline ) ) {
startBPT = false;
startFFLIST = true; LISTLINE = 0;
continue;
LoadFIZ_FFList( inputline );
continue;
}
if( issection( "WWList:", inputline ) )
@@ -6324,7 +6325,8 @@ void TMoverParameters::LoadFIZ_Wheels( std::string const &line ) {
void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
BrakeValveDecode( extract_value( "BrakeValve", line ) );
extract_value( BrakeValveParams, "BrakeValve", line, "" );
BrakeValveDecode( BrakeValveParams );
BrakeSubsystemDecode();
extract_value( NBpA, "NBpA", line, "" );
@@ -6951,6 +6953,11 @@ void TMoverParameters::LoadFIZ_DList( std::string const &Input ) {
extract_value( dizel_Mstand, "Mstand", Input, "" );
}
void TMoverParameters::LoadFIZ_FFList( std::string const &Input ) {
extract_value( RlistSize, "Size", Input, "" );
}
void TMoverParameters::LoadFIZ_LightsList( std::string const &Input ) {
extract_value( LightsPosNo, "Size", Input, "" );

View File

@@ -63,10 +63,12 @@ void TPrzekladnik::Update(double dt)
if ( BCP > P() )
dV = -PFVd(BCP, 0, d2A(10), P()) * dt;
else if ( BCP < P() )
dV = PFVa(BVP, BCP, d2A(10), P()) * dt;
else
dV = 0;
else {
if( BCP < P() )
dV = PFVa( BVP, BCP, d2A( 10 ), P() ) * dt;
else
dV = 0;
}
Next->Flow(dV);
if (dV > 0)
@@ -86,8 +88,8 @@ void TRapid::SetRapidParams(double mult, double size)
}
else
{
DN = d2A(5);
DL = d2A(5);
DN = d2A(5.0);
DL = d2A(5.0);
}
}
@@ -117,10 +119,10 @@ void TRapid::Update(double dt)
else if ((BCP * RapidMult) < (P() * ActMult))
dV = PFVa(BVP, BCP, DN, P() * ActMult / RapidMult) * dt;
else
dV = 0;
dV = 0.0;
Next->Flow(dV);
if (dV > 0)
if (dV > 0.0)
BrakeRes->Flow(-dV);
}
@@ -128,7 +130,7 @@ void TRapid::Update(double dt)
void TPrzekCiagly::SetMult(double m)
{
mult = m;
Mult = m;
}
void TPrzekCiagly::Update(double dt)
@@ -137,15 +139,15 @@ void TPrzekCiagly::Update(double dt)
double const BCP{ Next->P() };
double dV;
if ( BCP > (P() * mult))
dV = -PFVd(BCP, 0, d2A(8), P() * mult) * dt;
else if (BCP < (P() * mult))
dV = PFVa(BVP, BCP, d2A(8), P() * mult) * dt;
if ( BCP > (P() * Mult))
dV = -PFVd(BCP, 0, d2A(8.0), P() * Mult) * dt;
else if (BCP < (P() * Mult))
dV = PFVa(BVP, BCP, d2A(8.0), P() * Mult) * dt;
else
dV = 0;
dV = 0.0;
Next->Flow(dV);
if (dV > 0)
if (dV > 0.0)
BrakeRes->Flow(-dV);
}
@@ -165,14 +167,14 @@ void TPrzek_PZZ::Update(double dt)
double dV;
if (BCP > Pgr)
dV = -PFVd(BCP, 0, d2A(8), Pgr) * dt;
dV = -PFVd(BCP, 0, d2A(8.0), Pgr) * dt;
else if (BCP < Pgr)
dV = PFVa(BVP, BCP, d2A(8), Pgr) * dt;
dV = PFVa(BVP, BCP, d2A(8.0), Pgr) * dt;
else
dV = 0;
dV = 0.0;
Next->Flow(dV);
if (dV > 0)
if (dV > 0.0)
BrakeRes->Flow(-dV);
}
@@ -188,11 +190,11 @@ void TPrzekED::Update(double dt)
if (Next->P() > MaxP)
{
BrakeRes->Flow(dVol);
Next->Flow(PFVd(Next->P(), 0, d2A(10) * dt, MaxP));
Next->Flow(PFVd(Next->P(), 0, d2A(10.0) * dt, MaxP));
}
else
Next->Flow(dVol);
dVol = 0;
dVol = 0.0;
}
// ------ OERLIKON EST NA BOGATO ------
@@ -216,15 +218,17 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
// luzowanie
if ((BrakeStatus & b_hld) == b_off)
dV = PF(0, BCP, Nozzles[dTO] * nastG + (1.0 - nastG) * Nozzles[dOO]) * dt *
(0.1 + 4.9 * std::min(0.2, BCP - ((CVP - 0.05 - VVP) * BVM + 0.1)));
dV =
PF(0.0, BCP, Nozzles[dTO] * nastG + (1.0 - nastG) * Nozzles[dOO])
* dt * (0.1 + 4.9 * std::min(0.2, BCP - ((CVP - 0.05 - VVP) * BVM + 0.1)));
else
dV = 0;
dV = 0.0;
// BrakeCyl.Flow(-dV);
Przekladniki[1]->Flow(-dV);
if ( ((BrakeStatus & b_on) == b_on) && (Przekladniki[1]->P() * HBG300 < MaxBP) )
dV = PF( BVP, BCP, Nozzles[dTN] * (nastG + 2.0 * (BCP < Podskok ? 1.0 : 0.0)) + Nozzles[dON] * (1 - nastG) )
* dt * (0.1 + 4.9 * std::min( 0.2, (CVP - 0.05 - VVP) * BVM - BCP ) );
dV =
PF( BVP, BCP, Nozzles[dTN] * (nastG + 2.0 * (BCP < Podskok ? 1.0 : 0.0)) + Nozzles[dON] * (1.0 - nastG) )
* dt * (0.1 + 4.9 * std::min( 0.2, (CVP - 0.05 - VVP) * BVM - BCP ) );
else
dV = 0;
// BrakeCyl.Flow(-dV);
@@ -236,30 +240,32 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
Przekladniki[i]->Update(dt);
if (typeid(*Przekladniki[i]) == typeid(TRapid))
{
RapidStatus =
(((BrakeDelayFlag & bdelay_R) == bdelay_R) &&
((abs(Vel) > 70) || ((RapidStatus) && (abs(Vel) > 50)) || (RapidStaly)));
RapidStatus = ( ( ( BrakeDelayFlag & bdelay_R ) == bdelay_R )
&& ( ( std::abs( Vel ) > 70.0 )
|| ( ( std::abs( Vel ) > 50.0 ) && ( RapidStatus ) )
|| ( RapidStaly ) ) );
Przekladniki[i]->SetRapidStatus(RapidStatus);
}
else if (typeid(*Przekladniki[i]) == typeid(TPrzeciwposlizg))
else if( typeid( *Przekladniki[i] ) == typeid( TPrzeciwposlizg ) )
Przekladniki[i]->SetPoslizg((BrakeStatus & b_asb) == b_asb);
else if (typeid(*Przekladniki[i]) == typeid(TPrzekED))
if (Vel < -15)
Przekladniki[i]->SetP(0);
else if( typeid( *Przekladniki[ i ] ) == typeid( TPrzekED ) ) {
if( Vel < -15.0 )
Przekladniki[ i ]->SetP( 0.0 );
else
Przekladniki[i]->SetP(MaxBP * 3);
else if (typeid(*Przekladniki[i]) == typeid(TPrzekCiagly))
Przekladniki[ i ]->SetP( MaxBP * 3.0 );
}
else if( typeid( *Przekladniki[i] ) == typeid( TPrzekCiagly ) )
Przekladniki[i]->SetMult(LoadC);
else if (typeid(*Przekladniki[i]) == typeid(TPrzek_PZZ))
else if( typeid( *Przekladniki[i] ) == typeid( TPrzek_PZZ ) )
Przekladniki[i]->SetLBP(LBP);
}
// przeplyw testowy miedzypojemnosci
dV = PF(MPP, VVP, BVs(BCP)) + PF(MPP, CVP, CVs(BCP));
if ((MPP - 0.05 > BVP))
if ((MPP - 0.05) > BVP)
dV += PF(MPP - 0.05, BVP, Nozzles[dPT] * nastG + (1.0 - nastG) * Nozzles[dPO]);
if (MPP > VVP)
dV += PF(MPP, VVP, d2A(5));
dV += PF(MPP, VVP, d2A(5.0));
Miedzypoj->Flow(dV * dt * 0.15);
// przeplyw ZS <-> PG
@@ -270,10 +276,10 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
dV1 += 0.98 * dV;
// przeplyw ZP <-> MPJ
if (MPP - 0.05 > BVP)
if ((MPP - 0.05) > BVP)
dV = PF(BVP, MPP - 0.05, Nozzles[dPT] * nastG + (1.0 - nastG) * Nozzles[dPO]) * dt;
else
dV = 0;
dV = 0.0;
BrakeRes->Flow(dV);
dV1 += dV * 0.98;
ValveRes->Flow(-0.02 * dV);
@@ -303,21 +309,23 @@ void TNESt3::Init( double const PP, double const HPP, double const LPP, double c
BrakeCyl->CreatePress(BP);
BrakeRes->CreatePress(PP);
CntrlRes = std::make_shared<TReservoir>();
CntrlRes->CreateCap(15);
CntrlRes->CreateCap(15.0);
CntrlRes->CreatePress(HPP);
BrakeStatus = static_cast<int>(BP > 1.0);
BrakeStatus = (BP > 1.0 ? 1 : 0);
Miedzypoj = std::make_shared<TReservoir>();
Miedzypoj->CreateCap(5);
Miedzypoj->CreateCap(5.0);
Miedzypoj->CreatePress(PP);
BVM = 1.0 / (HPP - 0.05 - LPP) * MaxBP;
BrakeDelayFlag = BDF;
if (!(typeid(*FM) == typeid(TDisk1) || typeid(*FM) == typeid(TDisk2))) // jesli zeliwo to schodz
RapidStaly = false;
else
Zamykajacy = false;
if ( (typeid(*FM) == typeid(TDisk1)) || (typeid(*FM) == typeid(TDisk2)) ) // jesli zeliwo to schodz
RapidStaly = true;
else
RapidStaly = false;
}
double TNESt3::GetCRP()
@@ -339,19 +347,19 @@ void TNESt3::CheckState(double const BCP, double &dV1) // glowny przyrzad rozrza
// sprawdzanie stanu
// if ((BrakeStatus and 1)=1)and(BCP>0.25)then
if ((VVP + 0.01 + BCP / BVM < CVP - 0.05) && (Przys_blok))
if (((VVP + 0.01 + BCP / BVM) < (CVP - 0.05)) && (Przys_blok))
BrakeStatus |= ( b_on | b_hld ); // hamowanie stopniowe;
else if (VVP - 0.01 + (BCP - 0.1) / BVM > CVP - 0.05)
else if ((VVP - 0.01 + (BCP - 0.1) / BVM) > (CVP - 0.05))
BrakeStatus &= ~( b_on | b_hld ); // luzowanie;
else if (VVP + BCP / BVM > CVP - 0.05)
else if ((VVP + BCP / BVM) > (CVP - 0.05))
BrakeStatus &= ~b_on; // zatrzymanie napelaniania;
else if ((VVP + (BCP - 0.1) / BVM < CVP - 0.05) && (BCP > 0.25)) // zatrzymanie luzowania
else if (((VVP + (BCP - 0.1) / BVM) < (CVP - 0.05)) && (BCP > 0.25)) // zatrzymanie luzowania
BrakeStatus |= b_hld;
if( ( BrakeStatus & b_hld ) == 0 )
SoundFlag |= sf_CylU;
if ((VVP + 0.10 < CVP) && (BCP < 0.25)) // poczatek hamowania
if (((VVP + 0.10) < CVP) && (BCP < 0.25)) // poczatek hamowania
if (false == Przys_blok)
{
ValveRes->CreatePress(0.1 * VVP);
@@ -362,7 +370,7 @@ void TNESt3::CheckState(double const BCP, double &dV1) // glowny przyrzad rozrza
if (BCP > 0.5)
Zamykajacy = true;
else if (VVP - 0.6 < MPP)
else if ((VVP - 0.6) < MPP)
Zamykajacy = false;
}
@@ -375,7 +383,7 @@ void TNESt3::CheckReleaser(double const dt) // odluzniacz
if ((BrakeStatus & b_rls) == b_rls)
{
CntrlRes->Flow(PF(CVP, 0, 0.02) * dt);
if ((CVP < VVP + 0.3) || (false == autom))
if ((CVP < (VVP + 0.3)) || (false == autom))
BrakeStatus &= ~b_rls;
}
}
@@ -386,9 +394,9 @@ double TNESt3::CVs(double const BP) // napelniacz sterujacego
double const MPP{ Miedzypoj->P() };
// przeplyw ZS <-> PG
if (MPP < CVP - 0.17)
return 0;
else if (MPP > CVP - 0.08)
if (MPP < (CVP - 0.17))
return 0.0;
else if (MPP > (CVP - 0.08))
return Nozzles[dSd];
else
return Nozzles[dSm];
@@ -400,15 +408,16 @@ double TNESt3::BVs(double const BCP) // napelniacz pomocniczego
double const MPP{ Miedzypoj->P() };
// przeplyw ZP <-> rozdzielacz
if (MPP < CVP - 0.3)
if (MPP < (CVP - 0.3))
return Nozzles[dP];
else if (BCP < 0.5)
if ( true == Zamykajacy)
return Nozzles[dPm]; // 1.25
else if( BCP < 0.5 ) {
if( true == Zamykajacy )
return Nozzles[ dPm ]; // 1.25
else
return Nozzles[dPd];
return Nozzles[ dPd ];
}
else
return 0;
return 0.0;
}
void TNESt3::PLC(double const mass)
@@ -461,7 +470,7 @@ void TNESt3::SetSize( int const size, std::string const &params ) // ustawianie
}
else
{
Podskok = -1;
Podskok = -1.0;
Przekladniki[1] = std::make_shared<TRapid>();
if (params.find("-s216") != std::string::npos)
Przekladniki[1]->SetRapidParams(2, 16);
@@ -489,9 +498,9 @@ void TNESt3::SetSize( int const size, std::string const &params ) // ustawianie
else
autom = true;
if ((params.find("HBG300") != std::string::npos))
HBG300 = 1;
HBG300 = 1.0;
else
HBG300 = 0;
HBG300 = 0.0;
switch (size)
{

View File

@@ -133,7 +133,7 @@ class TRapid : public TPrzekladnik {
class TPrzekCiagly : public TPrzekladnik {
private:
double mult = 0.0;
double Mult = 0.0;
public:
void SetMult(double m);

View File

@@ -193,7 +193,7 @@ double TBrakeCyl::P()
static double const cD = 1;
static double const pD = VD - cD;
double VtoC = ( Cap > 0.0 ) ? Vol / Cap : 0.0; // stosunek cisnienia do objetosci.
double VtoC = ( Cap > 0.0 ? Vol / Cap : 0.0 ); // stosunek cisnienia do objetosci.
// Added div/0 trap for vehicles with incomplete definitions (cars etc)
// P:=VtoC;
if (VtoC < VS)

View File

@@ -137,10 +137,10 @@ static int const i_bcpno = 6;
//klasa obejmujaca pojedyncze zbiorniki
class TReservoir {
protected:
double Cap = 1.0;
double Vol = 0.0;
double dVol = 0.0;
protected:
double Cap{ 1.0 };
double Vol{ 0.0 };
double dVol{ 0.0 };
public:
void CreateCap(double Capacity);
@@ -500,7 +500,7 @@ class TDriverHandle {
public:
bool Time = false;
bool TimeEP = false;
double Sounds[ 5 ]; //wielkosci przeplywow dla dzwiekow
double Sounds[ 5 ]; //wielkosci przeplywow dla dzwiekow
virtual double GetPF(double i_bcp, double PP, double HP, double dt, double ep);
virtual void Init(double Press);
@@ -509,6 +509,8 @@ class TDriverHandle {
virtual double GetSound(int i);
virtual double GetPos(int i);
virtual double GetEP(double pos);
inline TDriverHandle() { ::SecureZeroMemory( Sounds, sizeof( Sounds ) ); }
};
class TFV4a : public TDriverHandle {

View File

@@ -2164,39 +2164,7 @@ void TModel3d::BreakHierarhy()
Error("Not implemented yet :(");
};
/*
void TModel3d::Render(vector3 pPosition,double fAngle,GLuint
ReplacableSkinId,int iAlpha)
{
// glColor3f(1.0f,1.0f,1.0f);
// glColor3f(0.0f,0.0f,0.0f);
glPushMatrix();
glTranslated(pPosition.x,pPosition.y,pPosition.z);
if (fAngle!=0)
glRotatef(fAngle,0,1,0);
/*
matrix4x4 Identity;
Identity.Identity();
matrix4x4 CurrentMatrix;
glGetdoublev(GL_MODELVIEW_MATRIX,CurrentMatrix.getArray());
vector3 pos=vector3(0,0,0);
pos=CurrentMatrix*pos;
fSquareDist=SquareMagnitude(pos);
* /
fSquareDist=SquareMagnitude(pPosition-Global::GetCameraPosition());
#ifdef _DEBUG
if (Root)
Root->Render(ReplacableSkinId,iAlpha);
#else
Root->Render(ReplacableSkinId,iAlpha);
#endif
glPopMatrix();
};
*/
/*
#ifdef EU07_USE_OLD_RENDERCODE
void TModel3d::Render(double fSquareDistance, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{
iAlpha ^= 0x0F0F000F; // odwrócenie flag tekstur, aby wyłapać nieprzezroczyste
@@ -2217,40 +2185,6 @@ void TModel3d::RenderAlpha(double fSquareDistance, texture_manager::size_type *R
Root->RenderAlphaDL();
}
};
*/
/*
void TModel3d::RaRender(vector3 pPosition,double fAngle,GLuint
*ReplacableSkinId,int
iAlpha)
{
// glColor3f(1.0f,1.0f,1.0f);
// glColor3f(0.0f,0.0f,0.0f);
glPushMatrix(); //zapamiętanie matrycy przekształcenia
glTranslated(pPosition.x,pPosition.y,pPosition.z);
if (fAngle!=0)
glRotatef(fAngle,0,1,0);
/*
matrix4x4 Identity;
Identity.Identity();
matrix4x4 CurrentMatrix;
glGetdoublev(GL_MODELVIEW_MATRIX,CurrentMatrix.getArray());
vector3 pos=vector3(0,0,0);
pos=CurrentMatrix*pos;
fSquareDist=SquareMagnitude(pos);
*/
/*
fSquareDist=SquareMagnitude(pPosition-Global::GetCameraPosition()); //zmienna
globalna!
if (StartVBO())
{//odwrócenie flag, aby wyłapać nieprzezroczyste
Root->ReplacableSet(ReplacableSkinId,iAlpha^0x0F0F000F);
Root->RaRender();
EndVBO();
}
glPopMatrix(); //przywrócenie ustawień przekształcenia
};
*/
void TModel3d::RaRender(double fSquareDistance, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ // renderowanie specjalne, np. kabiny
@@ -2282,30 +2216,10 @@ void TModel3d::RaRenderAlpha(double fSquareDistance, texture_manager::size_type
}
};
/*
void TModel3d::RaRenderAlpha(vector3 pPosition,double fAngle,GLuint
*ReplacableSkinId,int
iAlpha)
{
glPushMatrix();
glTranslatef(pPosition.x,pPosition.y,pPosition.z);
if (fAngle!=0)
glRotatef(fAngle,0,1,0);
fSquareDist=SquareMagnitude(pPosition-Global::GetCameraPosition()); //zmienna
globalna!
if (StartVBO())
{Root->ReplacableSet(ReplacableSkinId,iAlpha);
Root->RaRenderAlpha();
EndVBO();
}
glPopMatrix();
};
*/
//-----------------------------------------------------------------------------
// 2011-03-16 cztery nowe funkcje renderowania z możliwością pochylania obiektów
//-----------------------------------------------------------------------------
/*
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ // nieprzezroczyste, Display List
glPushMatrix();
@@ -2340,7 +2254,7 @@ void TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager:
Root->RenderAlphaDL();
glPopMatrix();
};
*/
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ // nieprzezroczyste, VBO
glPushMatrix();
@@ -2382,6 +2296,7 @@ void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manage
}
glPopMatrix();
};
#endif
//-----------------------------------------------------------------------------
// 2012-02 funkcje do tworzenia terenu z E3D

View File

@@ -360,19 +360,17 @@ public:
void SaveToBinFile(char const *FileName);
void BreakHierarhy();
// renderowanie specjalne
/*
#ifdef EU07_USE_OLD_RENDERCODE
void Render(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
void RenderAlpha(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
*/
void RaRender(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
void RaRenderAlpha(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
// trzy kąty obrotu
/*
void Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
void RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
*/
void RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
#endif
// inline int GetSubModelsCount() { return (SubModelsCount); };
int Flags() const
{

View File

@@ -2645,7 +2645,11 @@ void TTrack::RenderDyn()
#else
for( auto dynamic : Dynamics ) {
// sam sprawdza, czy VBO; zmienia kontekst VBO!
#ifdef EU07_USE_OLD_RENDERCODE
dynamic->Render();
#else
GfxRenderer.Render( dynamic );
#endif
}
#endif
};
@@ -2662,7 +2666,11 @@ void TTrack::RenderDynAlpha()
#else
for( auto dynamic : Dynamics ) {
// sam sprawdza, czy VBO; zmienia kontekst VBO!
#ifdef EU07_USE_OLD_RENDERCODE
dynamic->RenderAlpha();
#else
GfxRenderer.Render_Alpha( dynamic );
#endif
}
#endif
};

View File

@@ -2685,10 +2685,9 @@ bool TTrain::Update( double const Deltatime )
iSekunda=floor(GlobalTime->mr);
}
*/
// Ra 2014-09: napięcia i prądy muszą być ustalone najpierw, bo wysyłane są
// ewentualnie na
// PoKeys
if ((mvControlled->EngineType != DieselElectric) && (mvControlled->EngineType != ElectricInductionMotor)) // Ra 2014-09: czy taki rozdzia? ma sens?
// Ra 2014-09: napięcia i prądy muszą być ustalone najpierw, bo wysyłane są ewentualnie na PoKeys
if ((mvControlled->EngineType != DieselElectric)
&& (mvControlled->EngineType != ElectricInductionMotor)) // Ra 2014-09: czy taki rozdzia? ma sens?
fHVoltage = mvControlled->RunningTraction.TractionVoltage; // Winger czy to nie jest zle?
// *mvControlled->Mains);
else

147
World.cpp
View File

@@ -769,6 +769,7 @@ bool TWorld::Update()
// poprzednie jakoś tam działało
// fixed step, simulation time based updates
double dt = Timer::GetDeltaTime(); // 0.0 gdy pauza
/*
fTimeBuffer += dt; //[s] dodanie czasu od poprzedniej ramki
@@ -834,6 +835,7 @@ bool TWorld::Update()
}
*/
// secondary fixed step simulation time routines
while( m_secondaryupdateaccumulator >= m_secondaryupdaterate ) {
Global::tranTexts.Update(); // obiekt obsługujący stenogramy dźwięków na ekranie
@@ -856,6 +858,7 @@ bool TWorld::Update()
}
// variable step simulation time routines
if( Global::changeDynObj ) {
// ABu zmiana pojazdu - przejście do innego
ChangeDynamic();
@@ -874,9 +877,11 @@ bool TWorld::Update()
Ground.Update_Lights();
// render time routines follow:
dt = Timer::GetDeltaRenderTime(); // nie uwzględnia pauzowania ani mnożenia czasu
// fixed step render time routines
fTime50Hz += dt; // w pauzie też trzeba zliczać czas, bo przy dużym FPS będzie problem z odczytem ramek
while( fTime50Hz >= 1.0 / 50.0 ) {
Console::Update(); // to i tak trzeba wywoływać
@@ -884,9 +889,10 @@ bool TWorld::Update()
}
// variable step render time routines
Update_Camera( dt ); // TODO: move the fixed step cab camera updates to fixed step secondary routines section
Update_UI();
Update_Camera( dt );
Update_UI(); // TBD, TODO: move the ui updates to secondary fixed step routines, to reduce workload?
GfxRenderer.Update( dt );
ResourceSweep();
@@ -1376,8 +1382,13 @@ TWorld::Render_Cab() {
else {
*/
// renderowanie z Display List
#ifdef EU07_USE_OLD_RENDERCODE
dynamic->mdKabina->Render( 0.0, dynamic->ReplacableSkinID, dynamic->iAlpha );
dynamic->mdKabina->RenderAlpha( 0.0, dynamic->ReplacableSkinID, dynamic->iAlpha );
#else
GfxRenderer.Render( dynamic->mdKabina, dynamic->Material(), 0.0 );
GfxRenderer.Render_Alpha( dynamic->mdKabina, dynamic->Material(), 0.0 );
#endif
/*
}
*/
@@ -1501,24 +1512,16 @@ TWorld::Update_UI() {
+ to_string( tmp->MoverParameters->HVCouplers[ 1 ][ 0 ], 0 );
OutText3 =
"BP: "
+ to_string( tmp->MoverParameters->BrakePress, 2 )
+ ", "
+ to_string( tmp->MoverParameters->BrakeStatus, 0 )
+ ", PP: "
+ to_string( tmp->MoverParameters->PipePress, 2 )
+ "/"
+ to_string( tmp->MoverParameters->ScndPipePress, 2 )
+ "/"
+ to_string( tmp->MoverParameters->EqvtPipePress, 2 )
+ ", BVP: "
+ to_string( tmp->MoverParameters->Volume, 3 )
+ ", "
+ to_string( tmp->MoverParameters->CntrlPipePress, 3 )
+ ", "
+ to_string( tmp->MoverParameters->Hamulec->GetCRP(), 3 )
+ ", "
+ to_string( tmp->MoverParameters->BrakeStatus, 0 );
"BP: " + to_string( tmp->MoverParameters->BrakePress, 2 )
+ " (" + to_string( tmp->MoverParameters->BrakeStatus, 0 )
+ "), LBP: " + to_string( tmp->MoverParameters->LocBrakePress, 2 )
+ ", PP: " + to_string( tmp->MoverParameters->PipePress, 2 )
+ "/" + to_string( tmp->MoverParameters->ScndPipePress, 2 )
+ "/" + to_string( tmp->MoverParameters->EqvtPipePress, 2 )
+ ", BVP: " + to_string( tmp->MoverParameters->Volume, 3 )
+ ", " + to_string( tmp->MoverParameters->CntrlPipePress, 3 )
+ ", " + to_string( tmp->MoverParameters->Hamulec->GetCRP(), 3 )
+ ", " + to_string( tmp->MoverParameters->BrakeStatus, 0 );
if( tmp->MoverParameters->ManualBrakePos > 0 ) {
@@ -1732,58 +1735,66 @@ TWorld::Update_UI() {
default: {
// uncovered cases, nothing to do here...
// ... unless we're in debug mode
if( DebugModeFlag && Controlled ) {
if( DebugModeFlag ) {
TDynamicObject *tmp =
( FreeFlyModeFlag ?
Ground.DynamicNearest( Camera.Pos ) :
Controlled ); // w trybie latania lokalizujemy wg mapy
if( tmp == nullptr ) {
break;
}
OutText1 =
"vel: " + to_string(Controlled->GetVelocity(), 2) + " km/h"
+ "; dist: " + to_string(Controlled->MoverParameters->DistCounter, 2) + " km"
"vel: " + to_string(tmp->GetVelocity(), 2) + " km/h"
+ "; dist: " + to_string(tmp->MoverParameters->DistCounter, 2) + " km"
+ "; pos: ("
+ to_string( Controlled->GetPosition().x, 2 ) + ", "
+ to_string( Controlled->GetPosition().y, 2 ) + ", "
+ to_string( Controlled->GetPosition().z, 2 )
+ to_string( tmp->GetPosition().x, 2 ) + ", "
+ to_string( tmp->GetPosition().y, 2 ) + ", "
+ to_string( tmp->GetPosition().z, 2 )
+ ")";
OutText2 =
"HamZ=" + to_string( Controlled->MoverParameters->fBrakeCtrlPos, 1 )
+ "; HamP=" + std::to_string( mvControlled->LocalBrakePos ) + "/" + to_string( Controlled->MoverParameters->LocalBrakePosA, 2 )
+ "; NasJ=" + std::to_string( mvControlled->MainCtrlPos ) + "(" + std::to_string( mvControlled->MainCtrlActualPos ) + ")"
+ "; NasB=" + std::to_string( mvControlled->ScndCtrlPos ) + "(" + std::to_string( mvControlled->ScndCtrlActualPos ) + ")"
"HamZ=" + to_string( tmp->MoverParameters->fBrakeCtrlPos, 1 )
+ "; HamP=" + std::to_string( tmp->MoverParameters->LocalBrakePos ) + "/" + to_string( tmp->MoverParameters->LocalBrakePosA, 2 )
+ "; NasJ=" + std::to_string( tmp->MoverParameters->MainCtrlPos ) + "(" + std::to_string( tmp->MoverParameters->MainCtrlActualPos ) + ")"
+ "; NasB=" + std::to_string( tmp->MoverParameters->ScndCtrlPos ) + "(" + std::to_string( tmp->MoverParameters->ScndCtrlActualPos ) + ")"
+ "; I=" +
( mvControlled->TrainType == dt_EZT ?
std::to_string( int( mvControlled->ShowCurrent( 0 ) ) ):
std::to_string( int( mvControlled->Im ) ) )
+ "; U=" + to_string( int( mvControlled->RunningTraction.TractionVoltage + 0.5 ) )
( tmp->MoverParameters->TrainType == dt_EZT ?
std::to_string( int( tmp->MoverParameters->ShowCurrent( 0 ) ) ) :
std::to_string( int( tmp->MoverParameters->Im ) ) )
+ "; U=" + to_string( int( tmp->MoverParameters->RunningTraction.TractionVoltage + 0.5 ) )
+ "; R=" +
( Controlled->MoverParameters->RunningShape.R > 100000.0 ?
( tmp->MoverParameters->RunningShape.R > 100000.0 ?
"~0.0" :
to_string( Controlled->MoverParameters->RunningShape.R, 1 ) )
+ " An=" + to_string( Controlled->MoverParameters->AccN, 2 ); // przyspieszenie poprzeczne
to_string( tmp->MoverParameters->RunningShape.R, 1 ) )
+ " An=" + to_string( tmp->MoverParameters->AccN, 2 ); // przyspieszenie poprzeczne
if( tprev != int( GlobalTime->mr ) ) {
tprev = GlobalTime->mr;
Acc = ( Controlled->MoverParameters->Vel - VelPrev ) / 3.6;
VelPrev = Controlled->MoverParameters->Vel;
Acc = ( tmp->MoverParameters->Vel - VelPrev ) / 3.6;
VelPrev = tmp->MoverParameters->Vel;
}
OutText2 += ( "; As=" ) + to_string( Acc, 2 ); // przyspieszenie wzdłużne
OutText3 =
"cyl.ham. " + to_string( Controlled->MoverParameters->BrakePress, 2 )
+ "; prz.gl. " + to_string( Controlled->MoverParameters->PipePress, 2 )
+ "; zb.gl. " + to_string( Controlled->MoverParameters->CompressedVolume, 2 )
"cyl.ham. " + to_string( tmp->MoverParameters->BrakePress, 2 )
+ "; prz.gl. " + to_string( tmp->MoverParameters->PipePress, 2 )
+ "; zb.gl. " + to_string( tmp->MoverParameters->CompressedVolume, 2 )
// youBy - drugi wezyk
+ "; p.zas. " + to_string( Controlled->MoverParameters->ScndPipePress, 2 );
+ "; p.zas. " + to_string( tmp->MoverParameters->ScndPipePress, 2 );
// McZapkie: warto wiedziec w jakim stanie sa przelaczniki
if( mvControlled->ConvOvldFlag )
if( tmp->MoverParameters->ConvOvldFlag )
OutText3 += " C! ";
else if( mvControlled->FuseFlag )
else if( tmp->MoverParameters->FuseFlag )
OutText3 += " F! ";
else if( !mvControlled->Mains )
else if( !tmp->MoverParameters->Mains )
OutText3 += " () ";
else {
switch(
mvControlled->ActiveDir *
( mvControlled->Imin == mvControlled->IminLo ?
tmp->MoverParameters->ActiveDir *
( tmp->MoverParameters->Imin == tmp->MoverParameters->IminLo ?
1 :
2 ) ) {
case 2: { OutText3 += " >> "; break; }
@@ -1794,38 +1805,38 @@ TWorld::Update_UI() {
}
}
// McZapkie: predkosc szlakowa
if( Controlled->MoverParameters->RunningTrack.Velmax == -1 ) {
if( tmp->MoverParameters->RunningTrack.Velmax == -1 ) {
OutText3 += " Vtrack=Vmax";
}
else {
OutText3 += " Vtrack " + to_string( Controlled->MoverParameters->RunningTrack.Velmax, 2 );
OutText3 += " Vtrack " + to_string( tmp->MoverParameters->RunningTrack.Velmax, 2 );
}
if( ( mvControlled->EnginePowerSource.SourceType == CurrentCollector )
|| ( mvControlled->TrainType == dt_EZT ) ) {
if( ( tmp->MoverParameters->EnginePowerSource.SourceType == CurrentCollector )
|| ( tmp->MoverParameters->TrainType == dt_EZT ) ) {
OutText3 +=
"; pant. " + to_string( mvControlled->PantPress, 2 )
+ ( mvControlled->bPantKurek3 ? "=" : "^" ) + "ZG";
"; pant. " + to_string( tmp->MoverParameters->PantPress, 2 )
+ ( tmp->MoverParameters->bPantKurek3 ? "=" : "^" ) + "ZG";
}
// McZapkie: komenda i jej parametry
if( Controlled->MoverParameters->CommandIn.Command != ( "" ) ) {
if( tmp->MoverParameters->CommandIn.Command != ( "" ) ) {
OutText4 =
"C:" + Controlled->MoverParameters->CommandIn.Command
+ " V1=" + to_string( Controlled->MoverParameters->CommandIn.Value1, 0 )
+ " V2=" + to_string( Controlled->MoverParameters->CommandIn.Value2, 0 );
"C:" + tmp->MoverParameters->CommandIn.Command
+ " V1=" + to_string( tmp->MoverParameters->CommandIn.Value1, 0 )
+ " V2=" + to_string( tmp->MoverParameters->CommandIn.Value2, 0 );
}
if( ( Controlled->Mechanik )
&& ( Controlled->Mechanik->AIControllFlag == AIdriver ) ) {
if( ( tmp->Mechanik )
&& ( tmp->Mechanik->AIControllFlag == AIdriver ) ) {
OutText4 +=
"AI: Vd=" + to_string( Controlled->Mechanik->VelDesired, 0 )
+ " ad=" + to_string( Controlled->Mechanik->AccDesired, 2 )
+ " Pd=" + to_string( Controlled->Mechanik->ActualProximityDist, 0 )
+ " Vn=" + to_string( Controlled->Mechanik->VelNext, 0 );
"AI: Vd=" + to_string( tmp->Mechanik->VelDesired, 0 )
+ " ad=" + to_string( tmp->Mechanik->AccDesired, 2 )
+ " Pd=" + to_string( tmp->Mechanik->ActualProximityDist, 0 )
+ " Vn=" + to_string( tmp->Mechanik->VelNext, 0 );
}
// induction motor data
if( Controlled->MoverParameters->EngineType == ElectricInductionMotor ) {
if( tmp->MoverParameters->EngineType == ElectricInductionMotor ) {
float4 linecolor( 225.0 / 255.0f, 225.0f / 255.0f, 225.0f / 255.0f, 1.0f );
@@ -1833,8 +1844,8 @@ TWorld::Update_UI() {
for( int i = 0; i <= 20; ++i ) {
std::string parameters =
to_string(Controlled->MoverParameters->eimc[i], 2, 9)
+ " " + to_string( Controlled->MoverParameters->eimv[ i ], 2, 9 );
to_string(tmp->MoverParameters->eimc[i], 2, 9)
+ " " + to_string( tmp->MoverParameters->eimv[ i ], 2, 9 );
if( i <= 10 ) {
parameters += " " + to_string( Train->fPress[ i ][ 0 ], 2, 9 );
@@ -1843,7 +1854,7 @@ TWorld::Update_UI() {
parameters += " med:";
}
else if( i >= 13 ) {
parameters += " " + to_string( Controlled->MED[ 0 ][ i - 13 ], 2, 9 );
parameters += " " + to_string( tmp->MED[ 0 ][ i - 13 ], 2, 9 );
}
UITable->text_lines.emplace_back( parameters, linecolor );

View File

@@ -84,9 +84,9 @@ class TWorld
double fTimeBuffer; // bufor czasu aktualizacji dla stałego kroku fizyki
double fMaxDt; //[s] krok czasowy fizyki (0.01 dla normalnych warunków)
double m_primaryupdaterate{ 1.0 / 100.0 };
double m_primaryupdateaccumulator{ 0.0 }; // keeps track of elapsed simulation time, for core fixed step routines
double m_secondaryupdaterate{ 1.0 / 50.0 };
double m_secondaryupdateaccumulator{ 0.0 }; // keeps track of elapsed simulation time, for less important fixed step routines
double m_primaryupdateaccumulator{ m_secondaryupdaterate }; // keeps track of elapsed simulation time, for core fixed step routines
double m_secondaryupdateaccumulator{ m_secondaryupdaterate }; // keeps track of elapsed simulation time, for less important fixed step routines
int iPause; // wykrywanie zmian w zapauzowaniu
double VelPrev; // poprzednia prędkość
int tprev; // poprzedni czas

View File

@@ -12,17 +12,10 @@ http://mozilla.org/MPL/2.0/.
void
cFrustum::calculate( glm::mat4 &Projection, glm::mat4 &Modelview ) {
/*
float proj[ 16 ];
float modl[ 16 ];
*/
float *proj = &Projection[ 0 ][ 0 ];
float *modl = &Modelview[ 0 ][ 0 ];
float clip[ 16 ];
/*
glGetFloatv( GL_PROJECTION_MATRIX, proj );
glGetFloatv( GL_MODELVIEW_MATRIX, modl );
*/
// multiply the matrices to retrieve clipping planes
clip[ 0 ] = modl[ 0 ] * proj[ 0 ] + modl[ 1 ] * proj[ 4 ] + modl[ 2 ] * proj[ 8 ] + modl[ 3 ] * proj[ 12 ];

View File

@@ -67,7 +67,7 @@ light_array::update() {
if( light.count > 0 ) {
// TODO: intensity can be affected further by dim switch or other factors
light.intensity = std::max( 0.0f, std::log( (float)light.count + 1.0f ) );
light.intensity = std::max( 0.0f, std::log1p( (float)light.count ) );
light.intensity *= ( light.owner->DimHeadlights ? 0.6f : 1.0f );
}
else {

View File

@@ -164,6 +164,7 @@ opengl_renderer::Render() {
return true; // for now always succeed
}
#ifndef EU07_USE_OLD_RENDERCODE
bool
opengl_renderer::Render( TGround *Ground ) {
@@ -406,6 +407,7 @@ opengl_renderer::Render_Alpha( TModel3d *Model, material_data const *Material, M
return result;
}
#endif
void
opengl_renderer::Update ( double const Deltatime ) {

View File

@@ -101,6 +101,7 @@ public:
// main draw call. returns false on error
bool
Render();
#ifndef EU07_USE_OLD_RENDERCODE
bool
Render( TGround *Ground );
bool
@@ -115,15 +116,17 @@ public:
Render_Alpha( TModel3d *Model, material_data const *Material, double const Squaredistance );
bool
Render_Alpha( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle );
#endif
// maintenance jobs
void
Update( double const Deltatime);
void
Update_Lights( light_array const &Lights );
void
Disable_Lights();
inline
bool
Visible( TDynamicObject const *Dynamic ) const { return m_camera.visible( Dynamic ); }
texture_manager::size_type
GetTextureId( std::string Filename, std::string const &Dir, int const Filter = -1, bool const Loadnow = true ) {

View File

@@ -41,13 +41,20 @@ void TSky::Render( float3 const &Tint )
#endif
if (Global::bUseVBO)
{ // renderowanie z VBO
mdCloud->RaRender(100, 0);
#ifdef EU07_USE_OLD_RENDERCODE
mdCloud->RaRender( 100, 0 );
mdCloud->RaRenderAlpha(100, 0);
#endif
}
else
{ // renderowanie z Display List
#ifdef EU07_USE_OLD_RENDERCODE
mdCloud->Render(100, 0);
mdCloud->RenderAlpha(100, 0);
#else
GfxRenderer.Render( mdCloud, nullptr, 100.0 );
GfxRenderer.Render_Alpha( mdCloud, nullptr, 100.0 );
#endif
}
#ifdef EU07_USE_OLD_LIGHTING_MODEL
glPopMatrix();

View File

@@ -21,7 +21,11 @@ cStars::render() {
::glRotatef( -std::fmod( Global::fTimeAngleDeg, 360.0f ), 0.0f, 1.0f, 0.0f ); // obrót dobowy osi OX
::glPointSize( 2.0f );
#ifdef EU07_USE_OLD_RENDERCODE
m_stars.Render( 1.0 );
#else
GfxRenderer.Render( &m_stars, nullptr, 1.0 );
#endif
::glPointSize( 3.0f );
::glPopMatrix();

View File

@@ -108,14 +108,10 @@ ui_layer::render_progress() {
if( (m_progress == 0.0f) && (m_subtaskprogress == 0.0f) ) return;
float const width = ( 4.0f / 3.0f ) * Global::iWindowHeight;
float const height = Global::iWindowHeight / 768.0;
glPushAttrib( GL_ENABLE_BIT );
glDisable( GL_TEXTURE_2D );
quad( float4( 75.0f, 640.0f, 75.0f + 320.0f, 640.0f + 16.0f ), float4(0.0f, 0.0f, 0.0f, 0.25f) );
glBegin( GL_TRIANGLE_STRIP );
// secondary bar
if( m_subtaskprogress ) {
quad(
@@ -128,7 +124,6 @@ ui_layer::render_progress() {
float4( 75.0f, 640.0f, 75.0f + 320.0f * m_progress, 640.0f + 16.0f ),
float4( 8.0f / 255.0f, 160.0f / 255.0f, 8.0f / 255.0f, 1.0f ) );
}
glEnd();
glPopAttrib();
}
@@ -166,10 +161,8 @@ ui_layer::render_background() {
if( m_background == 0 ) return;
auto const &texture = GfxRenderer.Texture( m_background );
// NOTE: we limit/expect the background to come with 4:3 ratio.
// TODO, TBD: if we expose texture width or ratio from texture object, this limitation could be lifted
float const width = ( 4.0f / 3.0f ) * Global::iWindowHeight;
GfxRenderer.Bind( m_background );
quad( float4( 0.0f, 0.0f, 1024.0f, 768.0f ), float4( 1.0f, 1.0f, 1.0f, 1.0f ) );