16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 17:59:19 +02:00

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) void TAdvancedSound::UpdateAF(double A, double F, bool ListenerInside, vector3 NewPosition)
{ // update, ale z amplituda i czestotliwoscia { // update, ale z amplituda i czestotliwoscia
if( State == ss_Off ) {
return;
}
if ((State == ss_Commencing) && (SoundCommencing.AM > 0)) if ((State == ss_Commencing) && (SoundCommencing.AM > 0))
{ {
SoundShut.Stop(); // hunter-311211 SoundShut.Stop(); // hunter-311211

View File

@@ -411,6 +411,13 @@ TAnimModel::TAnimModel()
pModel = NULL; pModel = NULL;
iNumLights = 0; iNumLights = 0;
fBlinkTimer = 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++) for (int i = 0; i < iMaxNumLights; i++)
{ {
LightsOn[i] = LightsOff[i] = NULL; // normalnie nie ma LightsOn[i] = LightsOff[i] = NULL; // normalnie nie ma
@@ -436,7 +443,28 @@ bool TAnimModel::Init(TModel3d *pNewModel)
pModel = pNewModel; pModel = pNewModel;
return (pModel != NULL); 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) bool TAnimModel::Init(std::string const &asName, std::string const &asReplacableTexture)
{ {
if (asReplacableTexture.substr(0, 1) == if (asReplacableTexture.substr(0, 1) ==
@@ -457,6 +485,7 @@ bool TAnimModel::Init(std::string const &asName, std::string const &asReplacable
// przezroczystych // przezroczystych
return (Init(TModelsManager::GetModel(asName))); return (Init(TModelsManager::GetModel(asName)));
} }
#endif
bool TAnimModel::Load(cParser *parser, bool ter) bool TAnimModel::Load(cParser *parser, bool ter)
{ // rozpoznanie wpisu modelu i ustawienie świateł { // rozpoznanie wpisu modelu i ustawienie świateł
@@ -624,6 +653,21 @@ void TAnimModel::RenderAlphaDL(vector3 pPosition, double fAngle)
pModel->RenderAlpha(pPosition, fAngle, ReplacableSkinId, iTexAlpha); 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() int TAnimModel::Flags()
{ // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed { // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed
int i = pModel ? pModel->Flags() : 0; // pobranie flag całego modelu 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); // i|=(i&0x08080008)*((iTexAlpha&1)?0x04:0x02);
return i; return i;
}; };
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// 2011-03-16 cztery nowe funkcje renderowania z możliwością pochylania obiektów // 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 RaAnimate(); // jednorazowe przeliczenie animacji
RaPrepare(); RaPrepare();
if( pModel ) // renderowanie rekurencyjne submodeli if( pModel ) // renderowanie rekurencyjne submodeli
#ifdef EU07_USE_OLD_RENDERCODE
pModel->Render(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
#else
GfxRenderer.Render( pModel, Material(), *vPosition, vAngle ); GfxRenderer.Render( pModel, Material(), *vPosition, vAngle );
#endif
}; };
void TAnimModel::RenderAlphaDL(vector3 *vPosition) void TAnimModel::RenderAlphaDL(vector3 *vPosition)
{ {
RaPrepare(); RaPrepare();
if (pModel) // renderowanie rekurencyjne submodeli if (pModel) // renderowanie rekurencyjne submodeli
#ifdef EU07_USE_OLD_RENDERCODE
pModel->RenderAlpha(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
#else
GfxRenderer.Render_Alpha( pModel, Material(), *vPosition, vAngle ); GfxRenderer.Render_Alpha( pModel, Material(), *vPosition, vAngle );
#endif
}; };
/* /*
void TAnimModel::RenderVBO(vector3 *vPosition) 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 *LightsOn[iMaxNumLights]; // Ra: te wskaźniki powinny być w ramach TModel3d
TSubModel *LightsOff[iMaxNumLights]; TSubModel *LightsOff[iMaxNumLights];
vector3 vAngle; // bazowe obroty egzemplarza względem osi 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 int iTexAlpha; //żeby nie sprawdzać za każdym razem, dla 4 wymiennych tekstur
*/ #else
material_data m_materialdata; material_data m_materialdata;
#endif
std::string asText; // tekst dla wyświetlacza znakowego std::string asText; // tekst dla wyświetlacza znakowego
TAnimAdvanced *pAdvanced; TAnimAdvanced *pAdvanced;
@@ -154,12 +155,14 @@ class TAnimModel
void RaAnimate(); // przeliczenie animacji egzemplarza void RaAnimate(); // przeliczenie animacji egzemplarza
void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
public: public:
/* #ifdef EU07_USE_OLD_RENDERCODE
texture_manager::size_type ReplacableSkinId[5]; // McZapkie-020802: zmienialne skory 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 static TAnimContainer *acAnimList; // lista animacji z eventem, które muszą być przeliczane również bez wyświetlania
#ifndef EU07_USE_OLD_RENDERCODE
inline inline
material_data const *Material() const { return &m_materialdata; } material_data const *Material() const { return &m_materialdata; }
#endif
TAnimModel(); TAnimModel();
~TAnimModel(); ~TAnimModel();

View File

@@ -1692,6 +1692,14 @@ TDynamicObject::TDynamicObject()
//} //}
mdModel = NULL; mdModel = NULL;
mdKabina = 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; // smWiazary[0]=smWiazary[1]=NULL;
smWahacze[0] = smWahacze[1] = smWahacze[2] = smWahacze[3] = NULL; smWahacze[0] = smWahacze[1] = smWahacze[2] = smWahacze[3] = NULL;
fWahaczeAmp = 0; fWahaczeAmp = 0;
@@ -3690,12 +3698,12 @@ void TDynamicObject::TurnOff()
btMechanik1.TurnOff(); btMechanik1.TurnOff();
btMechanik2.TurnOff(); btMechanik2.TurnOff();
}; };
/* #ifdef EU07_USE_OLD_RENDERCODE
void TDynamicObject::Render() void TDynamicObject::Render()
{ // rysowanie elementów nieprzezroczystych { // rysowanie elementów nieprzezroczystych
// youBy - sprawdzamy, czy jest sens renderowac // 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 TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
// AnsiString asLoadName=""; // AnsiString asLoadName="";
@@ -3766,8 +3774,6 @@ void TDynamicObject::Render()
mdModel->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha); mdModel->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad) // renderowanie nieprzezroczystego ładunku if (mdLoad) // renderowanie nieprzezroczystego ładunku
mdLoad->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha); mdLoad->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdPrzedsionek)
mdPrzedsionek->RaRender(ObjSqrDist, ReplacableSkinID, iAlpha);
} }
else else
{ // wersja Display Lists { // wersja Display Lists
@@ -3794,8 +3800,6 @@ void TDynamicObject::Render()
mdModel->Render(ObjSqrDist, ReplacableSkinID, iAlpha); mdModel->Render(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdLoad) // renderowanie nieprzezroczystego ładunku if (mdLoad) // renderowanie nieprzezroczystego ładunku
mdLoad->Render(ObjSqrDist, ReplacableSkinID, iAlpha); mdLoad->Render(ObjSqrDist, ReplacableSkinID, iAlpha);
if (mdPrzedsionek)
mdPrzedsionek->Render(ObjSqrDist, ReplacableSkinID, iAlpha);
} }
// Ra: czy ta kabina tu ma sens? // Ra: czy ta kabina tu ma sens?
@@ -3868,12 +3872,84 @@ void TDynamicObject::Render()
TurnOff(); // przywrócenie domyślnych pozycji submodeli TurnOff(); // przywrócenie domyślnych pozycji submodeli
} // yB - koniec mieszania z grafika } // 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() void TDynamicObject::RenderSounds()
{ // przeliczanie dźwięków, bo będzie { // przeliczanie dźwięków, bo będzie słychać bez wyświetlania sektora z pojazdem
// słychać bez wyświetlania sektora z // if( Global::iPause > 0 ) { return; }
// pojazdem
// McZapkie-010302: ulepszony dzwiek silnika // McZapkie-010302: ulepszony dzwiek silnika
double freq; double freq;
double vol = 0; double vol = 0;
@@ -3884,11 +3960,10 @@ void TDynamicObject::RenderSounds()
if (MoverParameters->Power > 0) if (MoverParameters->Power > 0)
{ {
if ((rsSilnik.AM != 0) && ((MoverParameters->Mains) || (MoverParameters->EngineType == if ((rsSilnik.AM != 0)
DieselEngine))) // McZapkie-280503: && ((MoverParameters->Mains)
// zeby dla dumb // McZapkie-280503: zeby dla dumb dzialal silnik na jalowych obrotach
// dzialal silnik na || (MoverParameters->EngineType == DieselEngine)))
// jalowych obrotach
{ {
if ((fabs(MoverParameters->enrot) > 0.01) || if ((fabs(MoverParameters->enrot) > 0.01) ||
(MoverParameters->EngineType == Dumb)) //&& (MoverParameters->EnginePower>0.1)) (MoverParameters->EngineType == Dumb)) //&& (MoverParameters->EnginePower>0.1))
@@ -4093,9 +4168,8 @@ void TDynamicObject::RenderSounds()
sSmallCompressor.Update(MechInside, GetPosition()); sSmallCompressor.Update(MechInside, GetPosition());
// youBy - przenioslem, bo diesel tez moze miec turbo // youBy - przenioslem, bo diesel tez moze miec turbo
if ((MoverParameters->MainCtrlPos) >= if( (MoverParameters->TurboTest > 0)
(MoverParameters->TurboTest)) // hunter-250312: dlaczego zakomentowane? && (MoverParameters->MainCtrlPos >= MoverParameters->TurboTest))
// Ra: bo nie działało dobrze
{ {
// udawanie turbo: (6.66*(eng_vol-0.85)) // udawanie turbo: (6.66*(eng_vol-0.85))
if (eng_turbo > 6.66 * (enginevolume - 0.8) + 0.2 * dt) 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 // McZapkie-250202
// wczytywanie pliku z danymi multimedialnymi (dzwieki) // wczytywanie pliku z danymi multimedialnymi (dzwieki)
@@ -4344,6 +4338,26 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
if( token == "models:") { if( token == "models:") {
// modele i podmodele // 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? m_materialdata.multi_textures = 0; // czy jest wiele tekstur wymiennych?
parser.getTokens(); parser.getTokens();
parser >> asModel; parser >> asModel;
@@ -4354,86 +4368,80 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
} }
std::size_t i = asModel.find( ',' ); std::size_t i = asModel.find( ',' );
if ( i != std::string::npos ) if ( i != std::string::npos )
{ // Ra 2015-01: może szukać przecinka w { // Ra 2015-01: może szukać przecinka w nazwie modelu, a po przecinku była by liczba tekstur?
// nazwie modelu, a po przecinku była by
// liczba
// tekstur?
if (i < asModel.length()) if (i < asModel.length())
m_materialdata.multi_textures = asModel[i + 1] - '0'; m_materialdata.multi_textures = asModel[i + 1] - '0';
m_materialdata.multi_textures = clamp( m_materialdata.multi_textures, 0, 1 ); // na razie ustawiamy na 1 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 asModel = BaseDir + asModel; // McZapkie 2002-07-20: dynamics maja swoje
// modele w dynamics/basedir // modele w dynamics/basedir
Global::asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/... Global::asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/...
mdModel = TModelsManager::GetModel(asModel, true); mdModel = TModelsManager::GetModel(asModel, true);
assert( mdModel != nullptr ); // TODO: handle this more gracefully than all going to shit assert( mdModel != nullptr ); // TODO: handle this more gracefully than all going to shit
if (ReplacableSkin != "none") if (ReplacableSkin != "none")
#ifdef EU07_USE_OLD_RENDERCODE
{ // tekstura wymienna jest raczej jedynie w "dynamic\" { // tekstura wymienna jest raczej jedynie w "dynamic\"
ReplacableSkin = ReplacableSkin =
Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/... Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
if (!x.empty()) if (!x.empty())
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9 ); ReplacableSkinID[4] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9);
/*
if ((i = ReplacableSkin.Pos("|")) > 0) // replacable dzielone if (iMultiTex > 0)
{ { // jeśli model ma 4 tekstury
iMultiTex = -1; ReplacableSkinID[1] = GfxRenderer.GetTextureId(
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID( ReplacableSkin + ",1", "", Global::iDynamicFiltering);
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(), if (ReplacableSkinID[1])
Global::iDynamicFiltering); { // pierwsza z zestawu znaleziona
ReplacableSkin.Delete(1, i); // usunięcie razem z pionową kreską ReplacableSkinID[2] = GfxRenderer.GetTextureId(
ReplacableSkin = Global::asCurrentTexturePath + ReplacableSkin + ",2", "", Global::iDynamicFiltering);
ReplacableSkin; // odtworzenie początku ścieżki if (ReplacableSkinID[2])
// sprawdzić, ile jest i ustawić iMultiTex na liczbę podanych tekstur {
if (!ReplacableSkin.IsEmpty()) iMultiTex = 2; // już są dwie
{ // próba wycięcia drugiej nazwy ReplacableSkinID[3] = GfxRenderer.GetTextureId(
iMultiTex = -2; // skoro zostało coś po kresce, to są co najmniej dwie ReplacableSkin + ",3", "", Global::iDynamicFiltering);
if ((i = ReplacableSkin.Pos("|")) == 0) // gdy nie ma już kreski if (ReplacableSkinID[3])
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID( {
NULL, NULL, ReplacableSkin.SubString(1, i - 1).c_str(), iMultiTex = 3; // a teraz nawet trzy
Global::iDynamicFiltering); ReplacableSkinID[4] = GfxRenderer.GetTextureId(
else ReplacableSkin + ",4", "", Global::iDynamicFiltering);
{ // jak jest kreska, to wczytać drugą i próbować trzecią if (ReplacableSkinID[4])
ReplacableSkinID[-iMultiTex] = TTexturesManager::GetTextureID( iMultiTex = 4; // jak są cztery, to blokujemy podmianę tekstury rozkładem
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ść
}
}
} }
} }
} }
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) if (m_materialdata.multi_textures > 0)
{ // jeśli model ma 4 tekstury { // jeśli model ma 4 tekstury
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId( 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 ) 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 m_materialdata.textures_alpha |= 0x08080008; // tekstura -4 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
} }
#endif
if (!MoverParameters->LoadAccepted.empty()) if (!MoverParameters->LoadAccepted.empty())
// if (MoverParameters->LoadAccepted!=AnsiString("")); // && // if (MoverParameters->LoadAccepted!=AnsiString("")); // &&
// MoverParameters->LoadType!=AnsiString("passengers")) // MoverParameters->LoadType!=AnsiString("passengers"))
@@ -5763,6 +5772,54 @@ std::string TDynamicObject::TextureTest(std::string const &name)
return ""; // nie znaleziona 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) void TDynamicObject::DestinationSet(std::string to, std::string numer)
{ // ustawienie stacji docelowej oraz wymiennej tekstury 4, jeśli istnieje plik { // ustawienie stacji docelowej oraz wymiennej tekstury 4, jeśli istnieje plik
// w zasadzie, to każdy wagon mógłby mieć inną stację docelową // 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 // Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa
// tekstury nr 4 // tekstury nr 4
}; };
#endif
void TDynamicObject::OverheadTrack(float o) void TDynamicObject::OverheadTrack(float o)
{ // ewentualne wymuszanie jazdy { // 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 // parameters for the material object, as currently used by various simulator models
struct material_data { struct material_data {
@@ -152,6 +153,7 @@ struct material_data {
::SecureZeroMemory( replacable_skins, sizeof( replacable_skins ) ); ::SecureZeroMemory( replacable_skins, sizeof( replacable_skins ) );
} }
}; };
#endif
class TDynamicObject { // klasa pojazdu 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?) 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 private: // zmienne i metody do animacji submodeli; Ra: sprzatam animacje w pojeździe
#ifndef EU07_USE_OLD_RENDERCODE
material_data m_materialdata; material_data m_materialdata;
#endif
public: public:
#ifndef EU07_USE_OLD_RENDERCODE
inline inline
material_data const *Material() const { return &m_materialdata; } material_data const *Material() const { return &m_materialdata; }
#endif
// tymczasowo udostępnione do wyszukiwania drutu // 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 int iAnimType[ ANIM_TYPES ]; // 0-osie,1-drzwi,2-obracane,3-zderzaki,4-wózki,5-pantografy,6-tłoki
private: private:
@@ -415,11 +421,11 @@ public: // modele składowe pojazdu
int iCabs; // maski bitowe modeli kabin int iCabs; // maski bitowe modeli kabin
TTrack *MyTrack; // McZapkie-030303: tor na ktorym stoi, ABu TTrack *MyTrack; // McZapkie-030303: tor na ktorym stoi, ABu
std::string asBaseDir; std::string asBaseDir;
/* #ifdef EU07_USE_OLD_RENDERCODE
texture_manager::size_type ReplacableSkinID[5]; // McZapkie:zmienialne nadwozie texture_manager::size_type ReplacableSkinID[5]; // McZapkie:zmienialne nadwozie
int iAlpha; // maska przezroczystości tekstur int iAlpha; // maska przezroczystości tekstur
int iMultiTex; //<0 tekstury wskazane wpisem, >0 tekstury z przecinkami, =0 jedna 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 int iOverheadMask; // maska przydzielana przez AI pojazdom posiadającym pantograf, aby wymuszały
// jazdę bezprądową // jazdę bezprądową
TTractionParam tmpTraction; TTractionParam tmpTraction;
@@ -438,10 +444,10 @@ public: // modele składowe pojazdu
bool FastUpdate(double dt); bool FastUpdate(double dt);
void Move(double fDistance); void Move(double fDistance);
void FastMove(double fDistance); void FastMove(double fDistance);
/* #ifdef EU07_USE_OLD_RENDERCODE
void Render(); void Render();
void RenderAlpha(); void RenderAlpha();
*/ #endif
void RenderSounds(); void RenderSounds();
inline vector3 GetPosition() const inline vector3 GetPosition() const
{ {

View File

@@ -134,13 +134,13 @@ void key_callback( GLFWwindow *window, int key, int scancode, int action, int mo
} }
#endif #endif
case GLFW_KEY_ESCAPE: { case GLFW_KEY_ESCAPE: {
/*
if( ( DebugModeFlag ) //[Esc] pauzuje tylko bez Debugmode if( ( DebugModeFlag ) //[Esc] pauzuje tylko bez Debugmode
&& ( Global::iPause == 0 ) ) { // but unpausing should work always && ( Global::iPause == 0 ) ) { // but unpausing should work always
break; break;
} }
*/
if( Global::iPause & 1 ) // jeśli pauza startowa if( Global::iPause & 1 ) // jeśli pauza startowa
Global::iPause &= ~1; // odpauzowanie, gdy po wczytaniu miało nie startować Global::iPause &= ~1; // odpauzowanie, gdy po wczytaniu miało nie startować
else if( !( Global::iMultiplayer & 2 ) ) // w multiplayerze pauza nie ma sensu 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_REFRESH_RATE, vmode->refreshRate);
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE); 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) 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 the vehicle has defined light source, it can (potentially) emit light, so add it to the light array
*/ */
if( ( tmp != nullptr ) if( ( tmp != nullptr )
&& ( tmp->DynamicObject->MoverParameters->SecuritySystem.SystemType != 0 ) ) { && ( tmp->DynamicObject->MoverParameters->CategoryFlag == 1 ) // trains only
// we check for presence of security system, as a way to determine whether the vehicle is a controllable engine && ( ( tmp->DynamicObject->MoverParameters->SecuritySystem.SystemType != 0 )
// NOTE: this isn't 100% precise, e.g. middle EZT module comes with security system, while it has no lights || ( 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 ); m_lights.insert( tmp->DynamicObject );
} }

View File

@@ -1127,6 +1127,7 @@ private:
void LoadFIZ_Circuit( std::string const &Input ); void LoadFIZ_Circuit( std::string const &Input );
void LoadFIZ_RList( std::string const &Input ); void LoadFIZ_RList( std::string const &Input );
void LoadFIZ_DList( 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_LightsList( std::string const &Input );
void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input ); void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input );
TPowerType LoadFIZ_PowerDecode( std::string const &Power ); TPowerType LoadFIZ_PowerDecode( std::string const &Power );

View File

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

View File

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

View File

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

View File

@@ -193,7 +193,7 @@ double TBrakeCyl::P()
static double const cD = 1; static double const cD = 1;
static double const pD = VD - cD; 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) // Added div/0 trap for vehicles with incomplete definitions (cars etc)
// P:=VtoC; // P:=VtoC;
if (VtoC < VS) if (VtoC < VS)

View File

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

View File

@@ -2164,39 +2164,7 @@ void TModel3d::BreakHierarhy()
Error("Not implemented yet :("); Error("Not implemented yet :(");
}; };
/* #ifdef EU07_USE_OLD_RENDERCODE
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();
};
*/
/*
void TModel3d::Render(double fSquareDistance, texture_manager::size_type *ReplacableSkinId, int iAlpha) void TModel3d::Render(double fSquareDistance, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ {
iAlpha ^= 0x0F0F000F; // odwrócenie flag tekstur, aby wyłapać nieprzezroczyste 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(); 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) void TModel3d::RaRender(double fSquareDistance, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ // renderowanie specjalne, np. kabiny { // 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 // 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) void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ // nieprzezroczyste, Display List { // nieprzezroczyste, Display List
glPushMatrix(); glPushMatrix();
@@ -2340,7 +2254,7 @@ void TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager:
Root->RenderAlphaDL(); Root->RenderAlphaDL();
glPopMatrix(); glPopMatrix();
}; };
*/
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha) void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
{ // nieprzezroczyste, VBO { // nieprzezroczyste, VBO
glPushMatrix(); glPushMatrix();
@@ -2382,6 +2296,7 @@ void TModel3d::RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manage
} }
glPopMatrix(); glPopMatrix();
}; };
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// 2012-02 funkcje do tworzenia terenu z E3D // 2012-02 funkcje do tworzenia terenu z E3D

View File

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

View File

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

View File

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

147
World.cpp
View File

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

View File

@@ -12,17 +12,10 @@ http://mozilla.org/MPL/2.0/.
void void
cFrustum::calculate( glm::mat4 &Projection, glm::mat4 &Modelview ) { cFrustum::calculate( glm::mat4 &Projection, glm::mat4 &Modelview ) {
/*
float proj[ 16 ];
float modl[ 16 ];
*/
float *proj = &Projection[ 0 ][ 0 ]; float *proj = &Projection[ 0 ][ 0 ];
float *modl = &Modelview[ 0 ][ 0 ]; float *modl = &Modelview[ 0 ][ 0 ];
float clip[ 16 ]; float clip[ 16 ];
/*
glGetFloatv( GL_PROJECTION_MATRIX, proj );
glGetFloatv( GL_MODELVIEW_MATRIX, modl );
*/
// multiply the matrices to retrieve clipping planes // 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 ]; 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 ) { if( light.count > 0 ) {
// TODO: intensity can be affected further by dim switch or other factors // 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 ); light.intensity *= ( light.owner->DimHeadlights ? 0.6f : 1.0f );
} }
else { else {

View File

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

View File

@@ -101,6 +101,7 @@ public:
// main draw call. returns false on error // main draw call. returns false on error
bool bool
Render(); Render();
#ifndef EU07_USE_OLD_RENDERCODE
bool bool
Render( TGround *Ground ); Render( TGround *Ground );
bool bool
@@ -115,15 +116,17 @@ public:
Render_Alpha( TModel3d *Model, material_data const *Material, double const Squaredistance ); Render_Alpha( TModel3d *Model, material_data const *Material, double const Squaredistance );
bool bool
Render_Alpha( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle ); Render_Alpha( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle );
#endif
// maintenance jobs // maintenance jobs
void void
Update( double const Deltatime); Update( double const Deltatime);
void void
Update_Lights( light_array const &Lights ); Update_Lights( light_array const &Lights );
void void
Disable_Lights(); Disable_Lights();
inline
bool
Visible( TDynamicObject const *Dynamic ) const { return m_camera.visible( Dynamic ); }
texture_manager::size_type texture_manager::size_type
GetTextureId( std::string Filename, std::string const &Dir, int const Filter = -1, bool const Loadnow = true ) { 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 #endif
if (Global::bUseVBO) if (Global::bUseVBO)
{ // renderowanie z VBO { // renderowanie z VBO
mdCloud->RaRender(100, 0); #ifdef EU07_USE_OLD_RENDERCODE
mdCloud->RaRender( 100, 0 );
mdCloud->RaRenderAlpha(100, 0); mdCloud->RaRenderAlpha(100, 0);
#endif
} }
else else
{ // renderowanie z Display List { // 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( mdCloud, nullptr, 100.0 );
GfxRenderer.Render_Alpha( mdCloud, nullptr, 100.0 ); GfxRenderer.Render_Alpha( mdCloud, nullptr, 100.0 );
#endif
} }
#ifdef EU07_USE_OLD_LIGHTING_MODEL #ifdef EU07_USE_OLD_LIGHTING_MODEL
glPopMatrix(); 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 ::glRotatef( -std::fmod( Global::fTimeAngleDeg, 360.0f ), 0.0f, 1.0f, 0.0f ); // obrót dobowy osi OX
::glPointSize( 2.0f ); ::glPointSize( 2.0f );
#ifdef EU07_USE_OLD_RENDERCODE
m_stars.Render( 1.0 );
#else
GfxRenderer.Render( &m_stars, nullptr, 1.0 ); GfxRenderer.Render( &m_stars, nullptr, 1.0 );
#endif
::glPointSize( 3.0f ); ::glPointSize( 3.0f );
::glPopMatrix(); ::glPopMatrix();

View File

@@ -108,14 +108,10 @@ ui_layer::render_progress() {
if( (m_progress == 0.0f) && (m_subtaskprogress == 0.0f) ) return; 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 ); glPushAttrib( GL_ENABLE_BIT );
glDisable( GL_TEXTURE_2D ); 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) ); 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 // secondary bar
if( m_subtaskprogress ) { if( m_subtaskprogress ) {
quad( 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( 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 ) ); float4( 8.0f / 255.0f, 160.0f / 255.0f, 8.0f / 255.0f, 1.0f ) );
} }
glEnd();
glPopAttrib(); glPopAttrib();
} }
@@ -166,10 +161,8 @@ ui_layer::render_background() {
if( m_background == 0 ) return; if( m_background == 0 ) return;
auto const &texture = GfxRenderer.Texture( m_background );
// NOTE: we limit/expect the background to come with 4:3 ratio. // 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 // 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 ); GfxRenderer.Bind( m_background );
quad( float4( 0.0f, 0.0f, 1024.0f, 768.0f ), float4( 1.0f, 1.0f, 1.0f, 1.0f ) ); quad( float4( 0.0f, 0.0f, 1024.0f, 768.0f ), float4( 1.0f, 1.0f, 1.0f, 1.0f ) );