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

fix build in compilers other than msvc: include shuffling

This commit is contained in:
milek7
2018-01-25 15:43:41 +01:00
parent 45f28131a7
commit 1413aae881
26 changed files with 95 additions and 55 deletions

View File

@@ -20,6 +20,7 @@ http://mozilla.org/MPL/2.0/.
#include "Globals.h"
#include "Timer.h"
#include "Logs.h"
#include "renderer.h"
TAnimContainer *TAnimModel::acAnimList = NULL;

View File

@@ -27,6 +27,8 @@ class sound_source;
class TEventLauncher;
class TTraction; // drut
class TTractionPowerSource; // zasilanie drutów
class TWorld;
class TCamera;
namespace Mtable
{

View File

@@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/.
#include "Traction.h"
#include "sound.h"
#include "MdlMngr.h"
#include "renderer.h"
// Ra: taki zapis funkcjonuje lepiej, ale może nie jest optymalny
#define vWorldFront Math3D::vector3(0, 0, 1)

View File

@@ -22,6 +22,7 @@ http://mozilla.org/MPL/2.0/.
#include "Timer.h"
#include "parser.h"
#include "Console.h"
#include "World.h"
//---------------------------------------------------------------------------

View File

@@ -20,6 +20,8 @@ http://mozilla.org/MPL/2.0/.
#include "Globals.h"
#include "Timer.h"
#include "Logs.h"
#include "World.h"
#include "messaging.h"
TEvent::TEvent( std::string const &m ) :
asNodeName( m )

View File

@@ -10,9 +10,11 @@ http://mozilla.org/MPL/2.0/.
#pragma once
#include <string>
#include "renderer.h"
#include "opengllight.h"
#include "dumb3d.h"
#include "motiontelemetry.h"
#include "Classes.h"
#include "Float3d.h"
// definicje klawiszy
const int k_IncMainCtrl = 0; //[Num+]

View File

@@ -11,6 +11,8 @@ http://mozilla.org/MPL/2.0/.
#include "Logs.h"
#include "Globals.h"
#include "mctools.h"
#include "winheaders.h"
std::ofstream output; // standardowy "log.txt", można go wyłączyć
std::ofstream errors; // lista błędów "errors.txt", zawsze działa
@@ -80,6 +82,7 @@ void WriteLog( const char *str, logtype const Type ) {
output.flush();
}
#ifdef _WIN32
if( Global::iWriteLogEnabled & 2 ) {
// hunter-271211: pisanie do konsoli tylko, gdy nie jest ukrywana
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), FOREGROUND_GREEN | FOREGROUND_INTENSITY );
@@ -87,6 +90,7 @@ void WriteLog( const char *str, logtype const Type ) {
WriteConsole( GetStdHandle( STD_OUTPUT_HANDLE ), str, (DWORD)strlen( str ), &wr, NULL );
WriteConsole( GetStdHandle( STD_OUTPUT_HANDLE ), endstring, (DWORD)strlen( endstring ), &wr, NULL );
}
#endif
}
// Ra: bezwarunkowa rejestracja poważnych błędów

View File

@@ -13,7 +13,7 @@ http://mozilla.org/MPL/2.0/.
#include "Logs.h"
#include "Oerlikon_ESt.h"
#include "parser.h"
//---------------------------------------------------------------------------
#include "usefull.h"
// Ra: tu należy przenosić funcje z mover.pas, które nie są z niego wywoływane.
// Jeśli jakieś zmienne nie są używane w mover.pas, też można je przenosić.

View File

@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
#include "Logs.h"
#include "usefull.h"
#include "Track.h"
#include "renderer.h"
//---------------------------------------------------------------------------

View File

@@ -22,6 +22,7 @@ http://mozilla.org/MPL/2.0/.
#include "Globals.h"
#include "Logs.h"
#include "sn_utils.h"
#include "mctools.h"
#include <png.h>

View File

@@ -10,6 +10,7 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h"
#include "Timer.h"
#include "Globals.h"
#include "winheaders.h"
namespace Timer {

View File

@@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/.
#include "Globals.h"
#include "Timer.h"
#include "Logs.h"
#include "renderer.h"
// 101206 Ra: trapezoidalne drogi i tory
// 110720 Ra: rozprucie zwrotnicy i odcinki izolowane

View File

@@ -18,6 +18,7 @@ http://mozilla.org/MPL/2.0/.
#include "simulation.h"
#include "Globals.h"
#include "Logs.h"
#include "renderer.h"
//---------------------------------------------------------------------------
/*

View File

@@ -23,6 +23,7 @@ http://mozilla.org/MPL/2.0/.
#include "Driver.h"
#include "Console.h"
#include "sound.h"
#include "Camera.h"
void
control_mapper::insert( TGauge const &Gauge, std::string const &Label ) {

View File

@@ -17,6 +17,7 @@ http://mozilla.org/MPL/2.0/.
#include "sound.h"
#include "PyInt.h"
#include "command.h"
#include "World.h"
// typedef enum {st_Off, st_Starting, st_On, st_ShuttingDown} T4State;

View File

@@ -9,11 +9,14 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h"
#include <sndfile.h>
#include "audio.h"
#include "Globals.h"
#include "McZapkie/mctools.h"
#include "Logs.h"
#include <sndfile.h>
#include "ResourceManager.h"
#include "usefull.h"
namespace audio {

View File

@@ -13,6 +13,8 @@ http://mozilla.org/MPL/2.0/.
#include "sound.h"
#include "Globals.h"
#include "Logs.h"
#include "usefull.h"
#include "Camera.h"
namespace audio {

View File

@@ -11,6 +11,7 @@ http://mozilla.org/MPL/2.0/.
#include "audio.h"
#include "ResourceManager.h"
#include "Globals.h"
class sound_source;
@@ -169,7 +170,8 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
auto const &buffer { audio::renderer.buffer( bufferhandle ) };
buffers.emplace_back( buffer.id );
if( false == buffer.caption.empty() ) {
Global::tranTexts.Add( buffer.caption ); } } );
Global::tranTexts.Add( buffer.caption );
} } );
if( id != audio::null_resource ) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );

View File

@@ -13,6 +13,7 @@ http://mozilla.org/MPL/2.0/.
#include "Globals.h"
#include "Logs.h"
#include "Timer.h"
#include "mctools.h"
namespace simulation {

View File

@@ -3,7 +3,7 @@
#include <vector>
#include "dumb3d.h"
#include "Float3d.h"
#include "DynObj.h"
#include "Classes.h"
// collection of virtual light sources present in the scene
// used by the renderer to determine most suitable placement for actual light sources during render

View File

@@ -5,7 +5,17 @@
#include "Train.h"
#include "Timer.h"
#include "Driver.h"
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#endif
motiontelemetry::motiontelemetry()
{

View File

@@ -3,10 +3,6 @@
#include <string>
#include <chrono>
#ifdef _WIN32
#include <winsock2.h>
#endif
class motiontelemetry
{
public:

46
opengllight.h Normal file
View File

@@ -0,0 +1,46 @@
#pragma once
struct opengl_light {
GLuint id{ (GLuint)-1 };
glm::vec3 direction;
glm::vec4
position { 0.f, 0.f, 0.f, 1.f }, // 4th parameter specifies directional(0) or omni-directional(1) light source
ambient { 0.f, 0.f, 0.f, 1.f },
diffuse { 1.f, 1.f, 1.f, 1.f },
specular { 1.f, 1.f, 1.f, 1.f };
inline
void apply_intensity( float const Factor = 1.0f ) {
if( Factor == 1.0 ) {
glLightfv( id, GL_AMBIENT, glm::value_ptr(ambient) );
glLightfv( id, GL_DIFFUSE, glm::value_ptr(diffuse) );
glLightfv( id, GL_SPECULAR, glm::value_ptr(specular) );
}
else {
// temporary light scaling mechanics (ultimately this work will be left to the shaders
glm::vec4 scaledambient( ambient.r * Factor, ambient.g * Factor, ambient.b * Factor, ambient.a );
glm::vec4 scaleddiffuse( diffuse.r * Factor, diffuse.g * Factor, diffuse.b * Factor, diffuse.a );
glm::vec4 scaledspecular( specular.r * Factor, specular.g * Factor, specular.b * Factor, specular.a );
glLightfv( id, GL_AMBIENT, glm::value_ptr(scaledambient) );
glLightfv( id, GL_DIFFUSE, glm::value_ptr(scaleddiffuse) );
glLightfv( id, GL_SPECULAR, glm::value_ptr(scaledspecular) );
}
}
inline
void apply_angle() {
glLightfv( id, GL_POSITION, glm::value_ptr(position) );
if( position.w == 1.f ) {
glLightfv( id, GL_SPOT_DIRECTION, glm::value_ptr(direction) );
}
}
inline
void set_position( glm::vec3 const &Position ) {
position = glm::vec4( Position, position.w );
}
};

View File

@@ -18,56 +18,13 @@ http://mozilla.org/MPL/2.0/.
#include "World.h"
#include "MemCell.h"
#include "scene.h"
#include "opengllight.h"
#define EU07_USE_PICKING_FRAMEBUFFER
//#define EU07_USE_DEBUG_SHADOWMAP
//#define EU07_USE_DEBUG_CABSHADOWMAP
//#define EU07_USE_DEBUG_CAMERA
struct opengl_light {
GLuint id{ (GLuint)-1 };
glm::vec3 direction;
glm::vec4
position { 0.f, 0.f, 0.f, 1.f }, // 4th parameter specifies directional(0) or omni-directional(1) light source
ambient { 0.f, 0.f, 0.f, 1.f },
diffuse { 1.f, 1.f, 1.f, 1.f },
specular { 1.f, 1.f, 1.f, 1.f };
inline
void apply_intensity( float const Factor = 1.0f ) {
if( Factor == 1.0 ) {
glLightfv( id, GL_AMBIENT, glm::value_ptr(ambient) );
glLightfv( id, GL_DIFFUSE, glm::value_ptr(diffuse) );
glLightfv( id, GL_SPECULAR, glm::value_ptr(specular) );
}
else {
// temporary light scaling mechanics (ultimately this work will be left to the shaders
glm::vec4 scaledambient( ambient.r * Factor, ambient.g * Factor, ambient.b * Factor, ambient.a );
glm::vec4 scaleddiffuse( diffuse.r * Factor, diffuse.g * Factor, diffuse.b * Factor, diffuse.a );
glm::vec4 scaledspecular( specular.r * Factor, specular.g * Factor, specular.b * Factor, specular.a );
glLightfv( id, GL_AMBIENT, glm::value_ptr(scaledambient) );
glLightfv( id, GL_DIFFUSE, glm::value_ptr(scaleddiffuse) );
glLightfv( id, GL_SPECULAR, glm::value_ptr(scaledspecular) );
}
}
inline
void apply_angle() {
glLightfv( id, GL_POSITION, glm::value_ptr(position) );
if( position.w == 1.f ) {
glLightfv( id, GL_SPOT_DIRECTION, glm::value_ptr(direction) );
}
}
inline
void set_position( glm::vec3 const &Position ) {
position = glm::vec4( Position, position.w );
}
};
// encapsulates basic rendering setup.
// for modern opengl this translates to a specific collection of glsl shaders,
// for legacy opengl this is combination of blending modes, active texture units etc

View File

@@ -15,6 +15,7 @@ http://mozilla.org/MPL/2.0/.
#include "Timer.h"
#include "Logs.h"
#include "sn_utils.h"
#include "renderer.h"
namespace scene {

View File

@@ -13,6 +13,8 @@ http://mozilla.org/MPL/2.0/.
#include "Globals.h"
#include "Logs.h"
#include "uilayer.h"
#include "renderer.h"
#include "World.h"
namespace simulation {