mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 20:29:17 +02:00
field of view setting, t3d loader fix
This commit is contained in:
@@ -52,6 +52,7 @@ HWND Global::hWnd = NULL; // uchwyt okna
|
||||
int Global::ScreenWidth = 1;
|
||||
int Global::ScreenHeight = 1;
|
||||
float Global::ZoomFactor = 1.0f;
|
||||
float Global::FieldOfView = 45.0f;
|
||||
int Global::iCameraLast = -1;
|
||||
std::string Global::asRelease = "16.0.1172.482";
|
||||
std::string Global::asVersion =
|
||||
@@ -261,6 +262,14 @@ void Global::ConfigParse(cParser &Parser)
|
||||
Parser.getTokens();
|
||||
Parser >> Global::asHumanCtrlVehicle;
|
||||
}
|
||||
else if( token == "fieldofview" ) {
|
||||
|
||||
Parser.getTokens( 1, false );
|
||||
Parser >> Global::FieldOfView;
|
||||
// guard against incorrect values
|
||||
Global::FieldOfView = std::min( 75.0f, Global::FieldOfView );
|
||||
Global::FieldOfView = std::max( 15.0f, Global::FieldOfView );
|
||||
}
|
||||
else if (token == "width")
|
||||
{
|
||||
|
||||
|
||||
@@ -256,6 +256,7 @@ class Global
|
||||
static int ScreenWidth; // current window dimensions. TODO: move it to renderer
|
||||
static int ScreenHeight;
|
||||
static float ZoomFactor; // determines current camera zoom level. TODO: move it to the renderer
|
||||
static float FieldOfView; // vertical field of view for the camera. TODO: move it to the renderer
|
||||
static int iCameraLast;
|
||||
static std::string asRelease; // numer
|
||||
static std::string asVersion; // z opisem
|
||||
|
||||
@@ -219,6 +219,9 @@ template <typename ColorT> inline void readColor(cParser &parser, ColorT *color)
|
||||
double discard;
|
||||
parser.getTokens(4, false);
|
||||
parser >> discard >> color[0] >> color[1] >> color[2];
|
||||
color[ 0 ] /= 255.0;
|
||||
color[ 1 ] /= 255.0;
|
||||
color[ 2 ] /= 255.0;
|
||||
};
|
||||
|
||||
inline void readColor(cParser &parser, int &color)
|
||||
|
||||
@@ -1517,7 +1517,7 @@ bool TWorld::Render()
|
||||
glMatrixMode( GL_PROJECTION ); // select the Projection Matrix
|
||||
glLoadIdentity(); // reset the Projection Matrix
|
||||
// calculate the aspect ratio of the window
|
||||
gluPerspective( 45.0f / Global::ZoomFactor, (GLdouble)Global::ScreenWidth / (GLdouble)Global::ScreenHeight, 0.1f * Global::ZoomFactor, 2500.0f * Global::ZoomFactor );
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user