mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 17:09:19 +02:00
support for seasonal texture sets, wireframe mode render speed fix
This commit is contained in:
19
Globals.cpp
19
Globals.cpp
@@ -26,8 +26,9 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
// namespace Global {
|
// namespace Global {
|
||||||
|
|
||||||
// parametry do użytku wewnętrznego
|
// parametry do użytku wewnętrznego
|
||||||
// double Global::tSinceStart=0;
|
#ifdef EU07_USE_OLD_GROUNDCODE
|
||||||
TGround *Global::pGround = NULL;
|
TGround *Global::pGround = NULL;
|
||||||
|
#endif
|
||||||
std::string Global::AppName{ "EU07" };
|
std::string Global::AppName{ "EU07" };
|
||||||
std::string Global::asCurrentSceneryPath = "scenery/";
|
std::string Global::asCurrentSceneryPath = "scenery/";
|
||||||
std::string Global::asCurrentTexturePath = std::string(szTexturePath);
|
std::string Global::asCurrentTexturePath = std::string(szTexturePath);
|
||||||
@@ -75,6 +76,8 @@ GLfloat Global::FogColor[] = {0.6f, 0.7f, 0.8f};
|
|||||||
double Global::fFogStart = 1700;
|
double Global::fFogStart = 1700;
|
||||||
double Global::fFogEnd = 2000;
|
double Global::fFogEnd = 2000;
|
||||||
float Global::Overcast { 0.1f }; // NOTE: all this weather stuff should be moved elsewhere
|
float Global::Overcast { 0.1f }; // NOTE: all this weather stuff should be moved elsewhere
|
||||||
|
std::string Global::Season; // season of the year, based on simulation date
|
||||||
|
|
||||||
float Global::BaseDrawRange { 2500.f };
|
float Global::BaseDrawRange { 2500.f };
|
||||||
opengl_light Global::DayLight;
|
opengl_light Global::DayLight;
|
||||||
int Global::DynamicLightCount { 3 };
|
int Global::DynamicLightCount { 3 };
|
||||||
@@ -191,19 +194,6 @@ int Global::iMWDdivider = 5;
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
std::string Global::GetNextSymbol()
|
|
||||||
{ // pobranie tokenu z aktualnego parsera
|
|
||||||
|
|
||||||
std::string token;
|
|
||||||
if (pParser != nullptr)
|
|
||||||
{
|
|
||||||
|
|
||||||
pParser->getTokens();
|
|
||||||
*pParser >> token;
|
|
||||||
};
|
|
||||||
return token;
|
|
||||||
};
|
|
||||||
|
|
||||||
void Global::LoadIniFile(std::string asFileName)
|
void Global::LoadIniFile(std::string asFileName)
|
||||||
{
|
{
|
||||||
FreeCameraInit.resize( 10 );
|
FreeCameraInit.resize( 10 );
|
||||||
@@ -465,6 +455,7 @@ void Global::ConfigParse(cParser &Parser)
|
|||||||
std::tm *localtime = std::localtime(&timenow);
|
std::tm *localtime = std::localtime(&timenow);
|
||||||
Global::fMoveLight = localtime->tm_yday + 1; // numer bieżącego dnia w roku
|
Global::fMoveLight = localtime->tm_yday + 1; // numer bieżącego dnia w roku
|
||||||
}
|
}
|
||||||
|
Global::pWorld->compute_season( Global::fMoveLight );
|
||||||
}
|
}
|
||||||
else if( token == "dynamiclights" ) {
|
else if( token == "dynamiclights" ) {
|
||||||
// number of dynamic lights in the scene
|
// number of dynamic lights in the scene
|
||||||
|
|||||||
65
Globals.h
65
Globals.h
@@ -150,16 +150,32 @@ private:
|
|||||||
void Update();
|
void Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Global
|
class Global {
|
||||||
{
|
|
||||||
private:
|
public:
|
||||||
public:
|
// methods
|
||||||
|
static void LoadIniFile(std::string asFileName);
|
||||||
|
static void ConfigParse( cParser &parser );
|
||||||
|
static void InitKeys();
|
||||||
|
inline static Math3D::vector3 GetCameraPosition() { return pCameraPosition; };
|
||||||
|
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
|
||||||
|
static void SetCameraRotation(double Yaw);
|
||||||
|
static void TrainDelete(TDynamicObject *d);
|
||||||
|
#ifdef EU07_USE_OLD_GROUNDCODE
|
||||||
|
static TDynamicObject * DynamicNearest();
|
||||||
|
static TDynamicObject * CouplerNearest();
|
||||||
|
#endif
|
||||||
|
static bool AddToQuery(TEvent *event, TDynamicObject *who);
|
||||||
|
static bool DoEvents();
|
||||||
|
static std::string Bezogonkow(std::string str, bool _ = false);
|
||||||
|
static double Min0RSpeed(double vel1, double vel2);
|
||||||
|
|
||||||
|
// members
|
||||||
static int Keys[MaxKeys];
|
static int Keys[MaxKeys];
|
||||||
static bool RealisticControlMode; // controls ability to steer the vehicle from outside views
|
static bool RealisticControlMode; // controls ability to steer the vehicle from outside views
|
||||||
static Math3D::vector3 pCameraPosition; // pozycja kamery w świecie
|
static Math3D::vector3 pCameraPosition; // pozycja kamery w świecie
|
||||||
static Math3D::vector3 DebugCameraPosition; // pozycja kamery w świecie
|
static Math3D::vector3 DebugCameraPosition; // pozycja kamery w świecie
|
||||||
static double
|
static double pCameraRotation; // kierunek bezwzględny kamery w świecie: 0=północ, 90°=zachód (-azymut)
|
||||||
pCameraRotation; // kierunek bezwzględny kamery w świecie: 0=północ, 90°=zachód (-azymut)
|
|
||||||
static double pCameraRotationDeg; // w stopniach, dla animacji billboard
|
static double pCameraRotationDeg; // w stopniach, dla animacji billboard
|
||||||
static std::vector<Math3D::vector3> FreeCameraInit; // pozycje kamery
|
static std::vector<Math3D::vector3> FreeCameraInit; // pozycje kamery
|
||||||
static std::vector<Math3D::vector3> FreeCameraInitAngle;
|
static std::vector<Math3D::vector3> FreeCameraInitAngle;
|
||||||
@@ -179,27 +195,24 @@ class Global
|
|||||||
static bool bLiveTraction;
|
static bool bLiveTraction;
|
||||||
static float Global::fMouseXScale;
|
static float Global::fMouseXScale;
|
||||||
static float Global::fMouseYScale;
|
static float Global::fMouseYScale;
|
||||||
static double fFogStart;
|
#ifdef EU07_USE_OLD_GROUNDCODE
|
||||||
static double fFogEnd;
|
|
||||||
static TGround *pGround;
|
static TGround *pGround;
|
||||||
|
#endif
|
||||||
static std::string szDefaultExt;
|
static std::string szDefaultExt;
|
||||||
static std::string SceneryFile;
|
static std::string SceneryFile;
|
||||||
static std::string AppName;
|
static std::string AppName;
|
||||||
static std::string asCurrentSceneryPath;
|
static std::string asCurrentSceneryPath;
|
||||||
static std::string asCurrentTexturePath;
|
static std::string asCurrentTexturePath;
|
||||||
static std::string asCurrentDynamicPath;
|
static std::string asCurrentDynamicPath;
|
||||||
// McZapkie-170602: zewnetrzna definicja pojazdu uzytkownika
|
|
||||||
static std::string asHumanCtrlVehicle;
|
|
||||||
static void LoadIniFile(std::string asFileName);
|
|
||||||
static void InitKeys();
|
|
||||||
inline static Math3D::vector3 GetCameraPosition() { return pCameraPosition; };
|
|
||||||
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
|
|
||||||
static void SetCameraRotation(double Yaw);
|
|
||||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||||
static bool MultipleLogs;
|
static bool MultipleLogs;
|
||||||
// McZapkie-221002: definicja swiatla dziennego
|
// McZapkie-170602: zewnetrzna definicja pojazdu uzytkownika
|
||||||
static GLfloat FogColor[];
|
static std::string asHumanCtrlVehicle;
|
||||||
|
// world environment
|
||||||
static float Overcast;
|
static float Overcast;
|
||||||
|
static double fFogStart;
|
||||||
|
static double fFogEnd;
|
||||||
|
static std::string Season; // season of the year, based on simulation date
|
||||||
|
|
||||||
// TODO: put these things in the renderer
|
// TODO: put these things in the renderer
|
||||||
static float BaseDrawRange;
|
static float BaseDrawRange;
|
||||||
@@ -222,6 +235,9 @@ class Global
|
|||||||
static float FieldOfView; // vertical field of view for the camera. TODO: move it to the renderer
|
static float FieldOfView; // vertical field of view for the camera. TODO: move it to the renderer
|
||||||
static GLint iMaxTextureSize; // maksymalny rozmiar tekstury
|
static GLint iMaxTextureSize; // maksymalny rozmiar tekstury
|
||||||
static int iMultisampling; // tryb antyaliasingu: 0=brak,1=2px,2=4px,3=8px,4=16px
|
static int iMultisampling; // tryb antyaliasingu: 0=brak,1=2px,2=4px,3=8px,4=16px
|
||||||
|
static bool bSmoothTraction; // wygładzanie drutów
|
||||||
|
static float SplineFidelity; // determines segment size during conversion of splines to geometry
|
||||||
|
static GLfloat FogColor[];
|
||||||
|
|
||||||
static bool FullPhysics; // full calculations performed for each simulation step
|
static bool FullPhysics; // full calculations performed for each simulation step
|
||||||
static int iSlowMotion;
|
static int iSlowMotion;
|
||||||
@@ -248,8 +264,6 @@ class Global
|
|||||||
static int iScreenMode[12]; // numer ekranu wyświetlacza tekstowego
|
static int iScreenMode[12]; // numer ekranu wyświetlacza tekstowego
|
||||||
static double fMoveLight; // numer dnia w roku albo -1
|
static double fMoveLight; // numer dnia w roku albo -1
|
||||||
static bool FakeLight; // toggle between fixed and dynamic daylight
|
static bool FakeLight; // toggle between fixed and dynamic daylight
|
||||||
static bool bSmoothTraction; // wygładzanie drutów
|
|
||||||
static float SplineFidelity; // determines segment size during conversion of splines to geometry
|
|
||||||
static double fTimeSpeed; // przyspieszenie czasu, zmienna do testów
|
static double fTimeSpeed; // przyspieszenie czasu, zmienna do testów
|
||||||
static double fTimeAngleDeg; // godzina w postaci kąta
|
static double fTimeAngleDeg; // godzina w postaci kąta
|
||||||
static float fClockAngleDeg[6]; // kąty obrotu cylindrów dla zegara cyfrowego
|
static float fClockAngleDeg[6]; // kąty obrotu cylindrów dla zegara cyfrowego
|
||||||
@@ -293,19 +307,6 @@ class Global
|
|||||||
//randomizacja
|
//randomizacja
|
||||||
static std::mt19937 random_engine;
|
static std::mt19937 random_engine;
|
||||||
|
|
||||||
// metody
|
|
||||||
static void TrainDelete(TDynamicObject *d);
|
|
||||||
static void ConfigParse(cParser &parser);
|
|
||||||
static std::string GetNextSymbol();
|
|
||||||
#ifdef EU07_USE_OLD_GROUNDCODE
|
|
||||||
static TDynamicObject * DynamicNearest();
|
|
||||||
static TDynamicObject * CouplerNearest();
|
|
||||||
#endif
|
|
||||||
static bool AddToQuery(TEvent *event, TDynamicObject *who);
|
|
||||||
static bool DoEvents();
|
|
||||||
static std::string Bezogonkow(std::string str, bool _ = false);
|
|
||||||
static double Min0RSpeed(double vel1, double vel2);
|
|
||||||
|
|
||||||
// maciek001: zmienne dla MWD
|
// maciek001: zmienne dla MWD
|
||||||
static bool bMWDmasterEnable; // główne włączenie portu COM
|
static bool bMWDmasterEnable; // główne włączenie portu COM
|
||||||
static bool bMWDdebugEnable; // logowanie pracy
|
static bool bMWDdebugEnable; // logowanie pracy
|
||||||
|
|||||||
@@ -533,8 +533,9 @@ BYTE TempConnectionType[ 200 ]; // Ra: sprzêgi w sk³adzie; ujemne, gdy odwrotn
|
|||||||
|
|
||||||
TGround::TGround()
|
TGround::TGround()
|
||||||
{
|
{
|
||||||
|
#ifdef EU07_USE_OLD_GROUNDCODE
|
||||||
Global::pGround = this;
|
Global::pGround = this;
|
||||||
|
#endif
|
||||||
for( int i = 0; i < TP_LAST; ++i ) {
|
for( int i = 0; i < TP_LAST; ++i ) {
|
||||||
nRootOfType[ i ] = nullptr; // zerowanie tablic wyszukiwania
|
nRootOfType[ i ] = nullptr; // zerowanie tablic wyszukiwania
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -716,8 +716,11 @@ texture_manager::create( std::string Filename, bool const Loadnow ) {
|
|||||||
Filename.erase( traitpos );
|
Filename.erase( traitpos );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Filename.rfind( '.' ) != std::string::npos )
|
if( ( Filename.rfind( '.' ) != std::string::npos )
|
||||||
Filename.erase( Filename.rfind( '.' ) ); // trim extension if there's one
|
&& ( Filename.rfind( '.' ) != Filename.rfind( ".." ) + 1 ) ) {
|
||||||
|
// trim extension if there's one, but don't mistake folder traverse for extension
|
||||||
|
Filename.erase( Filename.rfind( '.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
for( char &c : Filename ) {
|
for( char &c : Filename ) {
|
||||||
// change forward slashes to windows ones. NOTE: probably not strictly necessary, but eh
|
// change forward slashes to windows ones. NOTE: probably not strictly necessary, but eh
|
||||||
|
|||||||
25
World.cpp
25
World.cpp
@@ -2322,7 +2322,6 @@ void TWorld::ChangeDynamic() {
|
|||||||
}
|
}
|
||||||
Global::changeDynObj = NULL;
|
Global::changeDynObj = NULL;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TWorld::ToggleDaylight() {
|
TWorld::ToggleDaylight() {
|
||||||
@@ -2339,6 +2338,30 @@ TWorld::ToggleDaylight() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculates current season of the year based on set simulation date
|
||||||
|
void
|
||||||
|
TWorld::compute_season( int const Yearday ) const {
|
||||||
|
|
||||||
|
using dayseasonpair = std::pair<int, std::string>;
|
||||||
|
|
||||||
|
std::vector<dayseasonpair> seasonsequence {
|
||||||
|
{ 65, "winter" },
|
||||||
|
{ 158, "spring" },
|
||||||
|
{ 252, "summer" },
|
||||||
|
{ 341, "autumn" },
|
||||||
|
{ 366, "winter" } };
|
||||||
|
auto const lookup =
|
||||||
|
std::lower_bound(
|
||||||
|
std::begin( seasonsequence ), std::end( seasonsequence ),
|
||||||
|
clamp( Yearday, 1, seasonsequence.back().first ),
|
||||||
|
[]( dayseasonpair const &Left, const int Right ) {
|
||||||
|
return Left.first < Right; } );
|
||||||
|
|
||||||
|
Global::Season = lookup->second + ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
world_environment::init() {
|
world_environment::init() {
|
||||||
|
|
||||||
|
|||||||
3
World.h
3
World.h
@@ -113,6 +113,9 @@ TWorld();
|
|||||||
train() const { return Train; }
|
train() const { return Train; }
|
||||||
// switches between static and dynamic daylight calculation
|
// switches between static and dynamic daylight calculation
|
||||||
void ToggleDaylight();
|
void ToggleDaylight();
|
||||||
|
// calculates current season of the year based on set simulation date
|
||||||
|
void compute_season( int const Yearday ) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Update_Environment();
|
void Update_Environment();
|
||||||
|
|||||||
33
material.cpp
33
material.cpp
@@ -18,7 +18,7 @@ bool
|
|||||||
opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
||||||
|
|
||||||
bool result { false };
|
bool result { false };
|
||||||
while( true == deserialize_mapping( Input, Loadnow ) ) {
|
while( true == deserialize_mapping( Input, 0, Loadnow ) ) {
|
||||||
result = true; // once would suffice but, eh
|
result = true; // once would suffice but, eh
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
|||||||
|
|
||||||
// imports member data pair from the config file
|
// imports member data pair from the config file
|
||||||
bool
|
bool
|
||||||
opengl_material::deserialize_mapping( cParser &Input, bool const Loadnow ) {
|
opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool const Loadnow ) {
|
||||||
|
|
||||||
if( false == Input.getTokens( 2, true, "\n\r\t;, " ) ) {
|
if( false == Input.getTokens( 2, true, "\n\r\t;, " ) ) {
|
||||||
return false;
|
return false;
|
||||||
@@ -48,8 +48,30 @@ opengl_material::deserialize_mapping( cParser &Input, bool const Loadnow ) {
|
|||||||
>> key
|
>> key
|
||||||
>> value;
|
>> value;
|
||||||
|
|
||||||
if( key == "texture1:" ) { texture1 = GfxRenderer.Fetch_Texture( path + value, Loadnow ); }
|
if( value == "{" ) {
|
||||||
else if( key == "texture2:" ) { texture2 = GfxRenderer.Fetch_Texture( path + value, Loadnow ); }
|
// detect and optionally process config blocks
|
||||||
|
cParser blockparser( Input.getToken<std::string>( false, "}" ) );
|
||||||
|
if( key == Global::Season ) {
|
||||||
|
// seasonal textures override generic textures
|
||||||
|
while( true == deserialize_mapping( blockparser, 1, Loadnow ) ) {
|
||||||
|
; // all work is done in the header
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( key == "texture1:" ) {
|
||||||
|
// TODO: full-fledged priority system
|
||||||
|
if( ( texture1 == null_handle )
|
||||||
|
|| ( Priority > 0 ) ) {
|
||||||
|
texture1 = GfxRenderer.Fetch_Texture( path + value, Loadnow );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( key == "texture2:" ) {
|
||||||
|
// TODO: full-fledged priority system
|
||||||
|
if( ( texture2 == null_handle )
|
||||||
|
|| ( Priority > 0 ) ) {
|
||||||
|
texture2 = GfxRenderer.Fetch_Texture( path + value, Loadnow );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true; // return value marks a key: value pair was extracted, nothing about whether it's recognized
|
return true; // return value marks a key: value pair was extracted, nothing about whether it's recognized
|
||||||
}
|
}
|
||||||
@@ -65,7 +87,8 @@ material_manager::create( std::string const &Filename, bool const Loadnow ) {
|
|||||||
if( filename.find( '|' ) != std::string::npos )
|
if( filename.find( '|' ) != std::string::npos )
|
||||||
filename.erase( filename.find( '|' ) ); // po | może być nazwa kolejnej tekstury
|
filename.erase( filename.find( '|' ) ); // po | może być nazwa kolejnej tekstury
|
||||||
|
|
||||||
if( filename.rfind( '.' ) != std::string::npos ) {
|
if( ( filename.rfind( '.' ) != std::string::npos )
|
||||||
|
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
||||||
// we can get extension for .mat or, in legacy files, some image format. just trim it and set it to material file extension
|
// we can get extension for .mat or, in legacy files, some image format. just trim it and set it to material file extension
|
||||||
filename.erase( filename.rfind( '.' ) );
|
filename.erase( filename.rfind( '.' ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ struct opengl_material {
|
|||||||
bool
|
bool
|
||||||
deserialize( cParser &Input, bool const Loadnow );
|
deserialize( cParser &Input, bool const Loadnow );
|
||||||
private:
|
private:
|
||||||
// imports member data pair from the config file
|
// imports member data pair from the config file, overriding existing parameter values of lower priority
|
||||||
bool
|
bool
|
||||||
deserialize_mapping( cParser &Input, bool const Loadnow );
|
deserialize_mapping( cParser &Input, int const Priority, bool const Loadnow );
|
||||||
};
|
};
|
||||||
|
|
||||||
class material_manager {
|
class material_manager {
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ opengl_renderer::Render_pass( rendermode const Mode ) {
|
|||||||
|
|
||||||
opengl_camera shadowcamera; // temporary helper, remove once ortho shadowmap code is done
|
opengl_camera shadowcamera; // temporary helper, remove once ortho shadowmap code is done
|
||||||
if( ( true == Global::RenderShadows )
|
if( ( true == Global::RenderShadows )
|
||||||
|
&& ( false == Global::bWireFrame )
|
||||||
&& ( true == World.InitPerformed() )
|
&& ( true == World.InitPerformed() )
|
||||||
&& ( m_shadowcolor != colors::white ) ) {
|
&& ( m_shadowcolor != colors::white ) ) {
|
||||||
// run shadowmap pass before color
|
// run shadowmap pass before color
|
||||||
@@ -857,7 +858,7 @@ opengl_renderer::setup_units( bool const Diffuse, bool const Shadows, bool const
|
|||||||
Active_Texture( m_helpertextureunit );
|
Active_Texture( m_helpertextureunit );
|
||||||
|
|
||||||
if( ( true == Reflections )
|
if( ( true == Reflections )
|
||||||
|| ( ( true == Global::RenderShadows ) && ( true == Shadows ) ) ) {
|
|| ( ( true == Global::RenderShadows ) && ( true == Shadows ) && ( false == Global::bWireFrame ) ) ) {
|
||||||
// we need to have texture on the helper for either the reflection and shadow generation (or both)
|
// we need to have texture on the helper for either the reflection and shadow generation (or both)
|
||||||
if( true == m_environmentcubetexturesupport ) {
|
if( true == m_environmentcubetexturesupport ) {
|
||||||
// bind dynamic environment cube if it's enabled...
|
// bind dynamic environment cube if it's enabled...
|
||||||
@@ -880,7 +881,7 @@ opengl_renderer::setup_units( bool const Diffuse, bool const Shadows, bool const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( true == Global::RenderShadows ) && ( true == Shadows ) ) {
|
if( ( true == Global::RenderShadows ) && ( true == Shadows ) && ( false == Global::bWireFrame ) ) {
|
||||||
|
|
||||||
::glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
|
::glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
|
||||||
::glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, glm::value_ptr( m_shadowcolor ) ); // TODO: dynamically calculated shadow colour, based on sun height
|
::glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, glm::value_ptr( m_shadowcolor ) ); // TODO: dynamically calculated shadow colour, based on sun height
|
||||||
@@ -938,6 +939,7 @@ opengl_renderer::setup_units( bool const Diffuse, bool const Shadows, bool const
|
|||||||
if( m_shadowtextureunit >= 0 ) {
|
if( m_shadowtextureunit >= 0 ) {
|
||||||
if( ( true == Global::RenderShadows )
|
if( ( true == Global::RenderShadows )
|
||||||
&& ( true == Shadows )
|
&& ( true == Shadows )
|
||||||
|
&& ( false == Global::bWireFrame )
|
||||||
&& ( m_shadowcolor != colors::white ) ) {
|
&& ( m_shadowcolor != colors::white ) ) {
|
||||||
|
|
||||||
Active_Texture( m_shadowtextureunit );
|
Active_Texture( m_shadowtextureunit );
|
||||||
@@ -1049,6 +1051,7 @@ opengl_renderer::switch_units( bool const Diffuse, bool const Shadows, bool cons
|
|||||||
if( ( true == Reflections )
|
if( ( true == Reflections )
|
||||||
|| ( ( true == Global::RenderShadows )
|
|| ( ( true == Global::RenderShadows )
|
||||||
&& ( true == Shadows )
|
&& ( true == Shadows )
|
||||||
|
&& ( false == Global::bWireFrame )
|
||||||
&& ( m_shadowcolor != colors::white ) ) ) {
|
&& ( m_shadowcolor != colors::white ) ) ) {
|
||||||
if( true == m_environmentcubetexturesupport ) {
|
if( true == m_environmentcubetexturesupport ) {
|
||||||
::glEnable( GL_TEXTURE_CUBE_MAP );
|
::glEnable( GL_TEXTURE_CUBE_MAP );
|
||||||
@@ -1068,7 +1071,7 @@ opengl_renderer::switch_units( bool const Diffuse, bool const Shadows, bool cons
|
|||||||
}
|
}
|
||||||
// shadow texture unit.
|
// shadow texture unit.
|
||||||
if( m_shadowtextureunit >= 0 ) {
|
if( m_shadowtextureunit >= 0 ) {
|
||||||
if( ( true == Global::RenderShadows ) && ( true == Shadows ) ) {
|
if( ( true == Global::RenderShadows ) && ( true == Shadows ) && ( false == Global::bWireFrame ) ) {
|
||||||
|
|
||||||
Active_Texture( m_shadowtextureunit );
|
Active_Texture( m_shadowtextureunit );
|
||||||
::glEnable( GL_TEXTURE_2D );
|
::glEnable( GL_TEXTURE_2D );
|
||||||
|
|||||||
Reference in New Issue
Block a user