mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 11:09:19 +02:00
merged upstream changes
This commit is contained in:
69
World.cpp
69
World.cpp
@@ -345,8 +345,8 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("glLineWidth(1.0f);");
|
||||
glLineWidth(1.0f);
|
||||
// glLineWidth(2.0f);
|
||||
WriteLog("glPointSize(2.0f);");
|
||||
glPointSize(2.0f);
|
||||
WriteLog("glPointSize(3.0f);");
|
||||
glPointSize(3.0f);
|
||||
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
||||
// ----------- LIGHTING SETUP -----------
|
||||
// Light values and coordinates
|
||||
@@ -492,21 +492,21 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
|
||||
glBegin(GL_QUADS); // Drawing using triangles
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(-0.28f, -0.22f, 0.0f); // bottom left of the texture and quad
|
||||
glVertex3f(-1.0f, -1.0f, 0.0f); // bottom left of the texture and quad
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(0.28f, -0.22f, 0.0f); // bottom right of the texture and quad
|
||||
glVertex3f(1.0f, -1.0f, 0.0f); // bottom right of the texture and quad
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(0.28f, 0.22f, 0.0f); // top right of the texture and quad
|
||||
glVertex3f(1.0f, 1.0f, 0.0f); // top right of the texture and quad
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(-0.28f, 0.22f, 0.0f); // top left of the texture and quad
|
||||
glVertex3f(-1.0f, 1.0f, 0.0f); // top left of the texture and quad
|
||||
glEnd();
|
||||
//~logo; Ra: to jest bez sensu zapis
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.09f);
|
||||
glRasterPos2f(-0.85f, -0.25f);
|
||||
glPrint("Uruchamianie / Initializing...");
|
||||
glRasterPos2f(-0.25f, -0.10f);
|
||||
glRasterPos2f(-0.85f, -0.30f);
|
||||
glPrint("Dzwiek / Sound...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -518,7 +518,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Sound Init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.11f);
|
||||
glRasterPos2f(-0.25f, -0.30f);
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -529,7 +529,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Textures init");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.12f);
|
||||
glRasterPos2f(-0.85f, -0.35f);
|
||||
glPrint("Tekstury / Textures...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -539,7 +539,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Textures init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.13f);
|
||||
glRasterPos2f(-0.25f, -0.35f);
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -547,7 +547,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Models init");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.14f);
|
||||
glRasterPos2f(-0.85f, -0.40f);
|
||||
glPrint("Modele / Models...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -557,7 +557,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Models init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.15f);
|
||||
glRasterPos2f(-0.25f, -0.40f);
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -565,7 +565,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Ground init");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.16f);
|
||||
glRasterPos2f(-0.85f, -0.45f);
|
||||
glPrint("Sceneria / Scenery (please wait)...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -594,7 +594,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Ground init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.17f);
|
||||
glRasterPos2f(-0.25f, -0.45f);
|
||||
glPrint("OK.");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -611,7 +611,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
char buff[255] = "Player train init: ";
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.18f);
|
||||
glRasterPos2f(-0.85f, -0.50f);
|
||||
glPrint("Przygotowanie kabiny do sterowania...");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -632,7 +632,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
WriteLog("Player train init OK");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.19f);
|
||||
glRasterPos2f(-0.25f, -0.50f);
|
||||
glPrint("OK.");
|
||||
}
|
||||
FollowView();
|
||||
@@ -644,7 +644,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
FreeFlyModeFlag = true; // Ra: automatycznie włączone latanie
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.20f);
|
||||
glRasterPos2f(-0.85f, -0.50f);
|
||||
glPrint("Blad inicjalizacji sterowanego pojazdu!");
|
||||
}
|
||||
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
|
||||
@@ -660,7 +660,7 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
Error("Player train not exist!");
|
||||
if (Global::detonatoryOK)
|
||||
{
|
||||
glRasterPos2f(-0.25f, -0.20f);
|
||||
glRasterPos2f(-0.85f, -0.55f);
|
||||
glPrint("Wybrany pojazd nie istnieje w scenerii!");
|
||||
}
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ void TWorld::OnKeyUp(int cKey)
|
||||
|
||||
void TWorld::OnMouseMove(double x, double y)
|
||||
{ // McZapkie:060503-definicja obracania myszy
|
||||
Camera.OnCursorMove(x * Global::fMouseXScale, -y * Global::fMouseYScale);
|
||||
Camera.OnCursorMove(x * Global::fMouseXScale / Global::ZoomFactor, -y * Global::fMouseYScale / Global::ZoomFactor);
|
||||
}
|
||||
|
||||
void TWorld::InOutKey()
|
||||
@@ -1323,8 +1323,19 @@ TWorld::Update_Camera( double const Deltatime ) {
|
||||
if( FreeFlyModeFlag )
|
||||
Camera.RaLook(); // jednorazowe przestawienie kamery
|
||||
}
|
||||
else if( Console::Pressed( VK_RBUTTON ) ) //||Console::Pressed(VK_F4))
|
||||
else if( Console::Pressed( VK_RBUTTON ) ) { //||Console::Pressed(VK_F4))
|
||||
FollowView( false ); // bez wyciszania dźwięków
|
||||
}
|
||||
else if( true == Console::Pressed( VK_MBUTTON ) ) {
|
||||
// middle mouse button controls zoom.
|
||||
Global::ZoomFactor = std::min( 4.5f, Global::ZoomFactor + 15.0f * static_cast<float>(Deltatime) );
|
||||
}
|
||||
else if( false == Console::Pressed( VK_MBUTTON ) ) {
|
||||
// reset zoom level if the button is no longer held down.
|
||||
// NOTE: yes, this is terrible way to go about it. it'll do for now.
|
||||
Global::ZoomFactor = std::max( 1.0f, Global::ZoomFactor - 15.0f * static_cast<float>( Deltatime ) );
|
||||
}
|
||||
|
||||
/*
|
||||
else if( Global::iTextMode == -1 ) { // tu mozna dodac dopisywanie do logu przebiegu lokomotywy
|
||||
WriteLog( "Number of textures used: " + std::to_string( Global::iTextures ) );
|
||||
@@ -1530,7 +1541,7 @@ void TWorld::Update_Lights() {
|
||||
*/
|
||||
Global::fLuminance = intensity;
|
||||
#endif
|
||||
|
||||
|
||||
vector3 sky = vector3( Global::AtmoColor[ 0 ], Global::AtmoColor[ 1 ], Global::AtmoColor[ 2 ] );
|
||||
if( Global::fLuminance < 0.25 ) { // przyspieszenie zachodu/wschodu
|
||||
sky *= 4.0 * Global::fLuminance; // nocny kolor nieba
|
||||
@@ -1552,6 +1563,12 @@ bool TWorld::Render()
|
||||
// glColor3b(255, 0, 255);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glDepthFunc( GL_LEQUAL );
|
||||
|
||||
glMatrixMode( GL_PROJECTION ); // select the Projection Matrix
|
||||
glLoadIdentity(); // reset the Projection Matrix
|
||||
// calculate the aspect ratio of the window
|
||||
gluPerspective( Global::FieldOfView / Global::ZoomFactor, (GLdouble)Global::ScreenWidth / (GLdouble)Global::ScreenHeight, 0.1f * Global::ZoomFactor, 2500.0f * Global::ZoomFactor );
|
||||
|
||||
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity();
|
||||
Camera.SetMatrix(); // ustawienie macierzy kamery względem początku scenerii
|
||||
@@ -1857,6 +1874,14 @@ TWorld::Render_Cab() {
|
||||
void
|
||||
TWorld::Render_UI() {
|
||||
|
||||
// set the UI mode projection. TODO: rework it all into somethinig more elegant... eventually
|
||||
glMatrixMode( GL_PROJECTION ); // select the Projection Matrix
|
||||
glLoadIdentity(); // reset the Projection Matrix
|
||||
// calculate the aspect ratio of the window
|
||||
gluPerspective( 45.0f, (GLdouble)Global::ScreenWidth / (GLdouble)Global::ScreenHeight, 0.2f, 2500.0f );
|
||||
glMatrixMode( GL_MODELVIEW ); // Select The Modelview Matrix
|
||||
glLoadIdentity();
|
||||
|
||||
if( DebugModeFlag && !Global::iTextMode ) {
|
||||
OutText1 = " FPS: ";
|
||||
OutText1 += to_string( Timer::GetFPS(), 2 );
|
||||
|
||||
Reference in New Issue
Block a user