16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 13:39:18 +02:00

tint ability for the clouds object

This commit is contained in:
tmj-fstate
2017-02-26 00:20:18 +01:00
parent 493340e602
commit bd588b87b3
3 changed files with 29 additions and 17 deletions

View File

@@ -738,16 +738,8 @@ void TWorld::OnKeyDown(int cKey)
switch (cKey) { switch (cKey) {
case VK_F1: { case VK_F1: {
// czas i relacja
if( Global::iTextMode == cKey )
Global::iTextMode =
( Global::iPause && ( cKey != VK_F1 ) ?
VK_F1 :
0 ); // wyłączenie napisów, chyba że pauza
else
Global::iTextMode = cKey;
// advance world clock in debug mode
if( DebugModeFlag ) { if( DebugModeFlag ) {
// additional time speedup keys in debug mode
if( Console::Pressed( VK_CONTROL ) ) { if( Console::Pressed( VK_CONTROL ) ) {
// ctrl-f3 // ctrl-f3
GlobalTime->UpdateMTableTime( 20.0 * 60.0 ); GlobalTime->UpdateMTableTime( 20.0 * 60.0 );
@@ -757,6 +749,19 @@ void TWorld::OnKeyDown(int cKey)
GlobalTime->UpdateMTableTime( 5.0 * 60.0 ); GlobalTime->UpdateMTableTime( 5.0 * 60.0 );
} }
} }
if( ( false == Console::Pressed( VK_CONTROL ) )
&& ( false == Console::Pressed( VK_SHIFT ) ) ) {
// czas i relacja
if( Global::iTextMode == cKey ) {
// wyłączenie napisów, chyba że pauza
Global::iTextMode =
( Global::iPause && ( cKey != VK_F1 ) ?
VK_F1 :
0 );
}
else
Global::iTextMode = cKey;
}
break; break;
} }
case VK_F2: { case VK_F2: {
@@ -3126,7 +3131,7 @@ world_environment::render() {
m_skydome.Render(); m_skydome.Render();
m_stars.render(); m_stars.render();
// m_clouds.Render(); m_clouds.Render( m_skydome.GetAverageColor() * 2.5f );
if( DebugModeFlag == true ) { if( DebugModeFlag == true ) {
// mark sun position for easier debugging // mark sun position for easier debugging

18
sky.cpp
View File

@@ -22,21 +22,22 @@ TSky::TSky(){};
void TSky::Init() void TSky::Init()
{ {
WriteLog(Global::asSky.c_str()); WriteLog( "Clouds init" );
WriteLog("init");
if ((Global::asSky != "1") && (Global::asSky != "0")) if ((Global::asSky != "1") && (Global::asSky != "0"))
// { mdCloud = TModelsManager::GetModel( Global::asSky );
mdCloud = TModelsManager::GetModel(Global::asSky.c_str());
// }
}; };
void TSky::Render() void TSky::Render( float3 const &Tint )
{ {
if (mdCloud) if (mdCloud)
{ // jeśli jest model nieba { // jeśli jest model nieba
#ifdef EU07_USE_OLD_LIGHTING_MODEL #ifdef EU07_USE_OLD_LIGHTING_MODEL
// TODO: re-implement this // TODO: re-implement this
glLightfv(GL_LIGHT0, GL_POSITION, lightPos); glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
#else
::glEnable( GL_LIGHTING );
::glDisable( GL_LIGHT0 );
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &Tint.x );
#endif #endif
if (Global::bUseVBO) if (Global::bUseVBO)
{ // renderowanie z VBO { // renderowanie z VBO
@@ -52,6 +53,11 @@ void TSky::Render()
glPopMatrix(); glPopMatrix();
// TODO: re-implement this // TODO: re-implement this
glLightfv(GL_LIGHT0, GL_POSITION, Global::lightPos); glLightfv(GL_LIGHT0, GL_POSITION, Global::lightPos);
#else
GLfloat noambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, noambient );
::glEnable( GL_LIGHT0 );
::glDisable( GL_LIGHTING );
#endif #endif
} }
}; };

3
sky.h
View File

@@ -11,6 +11,7 @@ http://mozilla.org/MPL/2.0/.
#pragma once #pragma once
#include "Model3d.h" #include "Model3d.h"
#include "Float3d.h"
class TSky class TSky
{ {
@@ -21,7 +22,7 @@ class TSky
TSky(); TSky();
~TSky(); ~TSky();
void Init(); void Init();
void Render(); void Render( float3 const &Tint = float3(1.0f, 1.0f, 1.0f) );
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------