mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 16:49:18 +02:00
milek7's branch merge; model file serialization, 64bit compatibility
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -69,3 +69,5 @@ bin/
|
|||||||
ipch/
|
ipch/
|
||||||
ref/
|
ref/
|
||||||
*.aps
|
*.aps
|
||||||
|
|
||||||
|
builds/
|
||||||
@@ -423,9 +423,9 @@ TAnimModel::TAnimModel()
|
|||||||
}
|
}
|
||||||
vAngle.x = vAngle.y = vAngle.z = 0.0; // zerowanie obrotów egzemplarza
|
vAngle.x = vAngle.y = vAngle.z = 0.0; // zerowanie obrotów egzemplarza
|
||||||
pAdvanced = NULL; // nie ma zaawansowanej animacji
|
pAdvanced = NULL; // nie ma zaawansowanej animacji
|
||||||
fDark = 0.25; // standardowy próg zaplania
|
fDark = 0.25f; // standardowy próg zaplania
|
||||||
fOnTime = 0.66;
|
fOnTime = 0.66f;
|
||||||
fOffTime = fOnTime + 0.66;
|
fOffTime = fOnTime + 0.66f;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAnimModel::~TAnimModel()
|
TAnimModel::~TAnimModel()
|
||||||
@@ -546,7 +546,7 @@ TAnimContainer * TAnimModel::GetContainer(char *pName)
|
|||||||
TAnimContainer *pCurrent;
|
TAnimContainer *pCurrent;
|
||||||
for (pCurrent = pRoot; pCurrent != NULL; pCurrent = pCurrent->pNext)
|
for (pCurrent = pRoot; pCurrent != NULL; pCurrent = pCurrent->pNext)
|
||||||
// if (pCurrent->GetName()==pName)
|
// if (pCurrent->GetName()==pName)
|
||||||
if (stricmp(pCurrent->NameGet(), pName) == 0)
|
if (std::string(pName) == pCurrent->NameGet())
|
||||||
return pCurrent;
|
return pCurrent;
|
||||||
return AddContainer(pName);
|
return AddContainer(pName);
|
||||||
}
|
}
|
||||||
@@ -587,7 +587,7 @@ void TAnimModel::RaPrepare()
|
|||||||
if (LightsOff[i])
|
if (LightsOff[i])
|
||||||
LightsOff[i]->iVisible = !state;
|
LightsOff[i]->iVisible = !state;
|
||||||
}
|
}
|
||||||
TSubModel::iInstance = (int)this; //żeby nie robić cudzych animacji
|
TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
|
||||||
TSubModel::pasText = &asText; // przekazanie tekstu do wyświetlacza (!!!! do przemyślenia)
|
TSubModel::pasText = &asText; // przekazanie tekstu do wyświetlacza (!!!! do przemyślenia)
|
||||||
if (pAdvanced) // jeśli jest zaawansowana animacja
|
if (pAdvanced) // jeśli jest zaawansowana animacja
|
||||||
Advanced(); // wykonać co tam trzeba
|
Advanced(); // wykonać co tam trzeba
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ class TAnimContainer
|
|||||||
// std::string(pSubModel?pSubModel->asName.c_str():""); };
|
// std::string(pSubModel?pSubModel->asName.c_str():""); };
|
||||||
// std::string inline GetName() { return std::string(pSubModel?pSubModel->pName:"");
|
// std::string inline GetName() { return std::string(pSubModel?pSubModel->pName:"");
|
||||||
// };
|
// };
|
||||||
char * NameGet()
|
std::string NameGet()
|
||||||
{
|
{
|
||||||
return (pSubModel ? pSubModel->pName : NULL);
|
return (pSubModel ? pSubModel->pName : "");
|
||||||
};
|
};
|
||||||
// void SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
// void SetRotateAnim(vector3 vNewRotateAxis, double fNewDesiredAngle, double
|
||||||
// fNewRotateSpeed, bool bResetAngle=false);
|
// fNewRotateSpeed, bool bResetAngle=false);
|
||||||
|
|||||||
107
CMakeLists.txt
Normal file
107
CMakeLists.txt
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake_modules/")
|
||||||
|
project("eu07++ng")
|
||||||
|
|
||||||
|
include_directories("." "Console" "McZapkie")
|
||||||
|
file(GLOB HEADERS "*.h" "Console/*.h" "McZapkie/*.h")
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
"Texture.cpp"
|
||||||
|
"TextureDDS.cpp"
|
||||||
|
"Timer.cpp"
|
||||||
|
"Track.cpp"
|
||||||
|
"Traction.cpp"
|
||||||
|
"TractionPower.cpp"
|
||||||
|
"Train.cpp"
|
||||||
|
"TrkFoll.cpp"
|
||||||
|
"VBO.cpp"
|
||||||
|
"wavread.cpp"
|
||||||
|
"World.cpp"
|
||||||
|
"AdvSound.cpp"
|
||||||
|
"AirCoupler.cpp"
|
||||||
|
"AnimModel.cpp"
|
||||||
|
"Button.cpp"
|
||||||
|
"Camera.cpp"
|
||||||
|
"Console.cpp"
|
||||||
|
"console/LPT.cpp"
|
||||||
|
"Console/MWD.cpp"
|
||||||
|
"console/PoKeys55.cpp"
|
||||||
|
"Driver.cpp"
|
||||||
|
"dumb3d.cpp"
|
||||||
|
"DynObj.cpp"
|
||||||
|
"EU07.cpp"
|
||||||
|
"Event.cpp"
|
||||||
|
"EvLaunch.cpp"
|
||||||
|
"FadeSound.cpp"
|
||||||
|
"Float3d.cpp"
|
||||||
|
"Gauge.cpp"
|
||||||
|
"Globals.cpp"
|
||||||
|
"Ground.cpp"
|
||||||
|
"Logs.cpp"
|
||||||
|
"mczapkie/friction.cpp"
|
||||||
|
"mczapkie/hamulce.cpp"
|
||||||
|
"mczapkie/mctools.cpp"
|
||||||
|
"mczapkie/Mover.cpp"
|
||||||
|
"mczapkie/Oerlikon_ESt.cpp"
|
||||||
|
"MdlMngr.cpp"
|
||||||
|
"MemCell.cpp"
|
||||||
|
"Model3d.cpp"
|
||||||
|
"mtable.cpp"
|
||||||
|
"parser.cpp"
|
||||||
|
"renderer.cpp"
|
||||||
|
"PyInt.cpp"
|
||||||
|
"RealSound.cpp"
|
||||||
|
"ResourceManager.cpp"
|
||||||
|
"sn_utils.cpp"
|
||||||
|
"Segment.cpp"
|
||||||
|
"sky.cpp"
|
||||||
|
"sun.cpp"
|
||||||
|
"stars.cpp"
|
||||||
|
"lightarray.cpp"
|
||||||
|
"skydome.cpp"
|
||||||
|
"Sound.cpp"
|
||||||
|
"Spring.cpp"
|
||||||
|
"shader.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
add_definitions(-DHAVE_ROUND) # to make pymath to not redefine round
|
||||||
|
set(SOURCES ${SOURCES} "windows.cpp")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
|
||||||
|
set(SOURCES ${SOURCES} "eu07.rc")
|
||||||
|
set(SOURCES ${SOURCES} "eu07.ico")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||||
|
|
||||||
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
|
||||||
|
# /wd4996: disable "deprecation" warnings
|
||||||
|
# /wd4244: disable warnings for conversion with possible loss of data
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4996 /wd4244")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
|
||||||
|
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
include_directories(${GLEW_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${GLEW_LIBRARIES})
|
||||||
|
|
||||||
|
find_package(GLFW3 REQUIRED)
|
||||||
|
include_directories(${GLFW3_INCLUDE_DIR})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${GLFW3_LIBRARIES})
|
||||||
|
|
||||||
|
find_package(GLUT REQUIRED)
|
||||||
|
include_directories(${GLUT_INCLUDE_DIR})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${GLUT_LIBRARIES})
|
||||||
|
|
||||||
|
find_package(PythonLibs 2 REQUIRED)
|
||||||
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
|
||||||
|
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
include_directories(${PNG_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${PNG_LIBRARIES})
|
||||||
75
CMake_modules/FindGLFW3.cmake
Normal file
75
CMake_modules/FindGLFW3.cmake
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# - Try to find GLFW3
|
||||||
|
#
|
||||||
|
# If no pkgconfig, define GLFW_ROOT to installation tree
|
||||||
|
# Will define the following:
|
||||||
|
# GLFW3_FOUND
|
||||||
|
# GLFW3_INCLUDE_DIR
|
||||||
|
# GLFW3_LIBRARIES
|
||||||
|
|
||||||
|
IF(PKG_CONFIG_FOUND)
|
||||||
|
IF(APPLE)
|
||||||
|
# homebrew or macports pkgconfig locations
|
||||||
|
SET(ENV{PKG_CONFIG_PATH} "/usr/local/opt/glfw3/lib/pkgconfig:/opt/local/lib/pkgconfig")
|
||||||
|
ENDIF()
|
||||||
|
SET(ENV{PKG_CONFIG_PATH} "${DEPENDS_DIR}/glfw/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
|
||||||
|
PKG_CHECK_MODULES(GLFW3 glfw3)
|
||||||
|
|
||||||
|
FIND_LIBRARY(GLFW3_LIBRARY
|
||||||
|
NAMES ${GLFW3_LIBRARIES}
|
||||||
|
HINTS ${GLFW3_LIBRARY_DIR}
|
||||||
|
)
|
||||||
|
SET(GLFW3_LIBRARIES ${GLFW3_LIBRARY})
|
||||||
|
|
||||||
|
RETURN()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
FIND_PATH(GLFW3_INCLUDE_DIR
|
||||||
|
GLFW/glfw3.h
|
||||||
|
DOC "GLFW include directory "
|
||||||
|
PATHS
|
||||||
|
"${DEPENDS_DIR}/glfw"
|
||||||
|
"$ENV{ProgramW6432}/glfw"
|
||||||
|
${GLFW3_ROOT_PATH}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
)
|
||||||
|
|
||||||
|
# directories in the official binary package
|
||||||
|
IF(MINGW)
|
||||||
|
SET(_SUFFIX lib-mingw)
|
||||||
|
ELSEIF(MSVC11)
|
||||||
|
SET(_SUFFIX lib-vc2012)
|
||||||
|
ELSEIF(MSVC12)
|
||||||
|
SET(_SUFFIX lib-vc2013)
|
||||||
|
ELSEIF(MSVC14)
|
||||||
|
SET(_SUFFIX lib-vc2015)
|
||||||
|
ELSEIF(MSVC)
|
||||||
|
SET(_SUFFIX lib-vc2012)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
FIND_LIBRARY(GLFW3_LIBRARIES
|
||||||
|
NAMES glfw3dll glfw3
|
||||||
|
PATHS
|
||||||
|
"${DEPENDS_DIR}/glfw"
|
||||||
|
"$ENV{ProgramW6432}/glfw"
|
||||||
|
${GLFW3_ROOT_PATH}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
${_SUFFIX}
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
FIND_FILE(GLFW3_DLL
|
||||||
|
glfw3.dll
|
||||||
|
PATHS
|
||||||
|
"${DEPENDS_DIR}/glfw"
|
||||||
|
"$ENV{ProgramW6432}/glfw"
|
||||||
|
${GLFW3_ROOT_PATH}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
${_SUFFIX}
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 FOUND_VAR GLFW3_FOUND
|
||||||
|
REQUIRED_VARS GLFW3_LIBRARIES GLFW3_INCLUDE_DIR)
|
||||||
@@ -86,8 +86,8 @@ void TCamera::Update()
|
|||||||
if (Console::Pressed(Global::Keys[k_MechBackward]))
|
if (Console::Pressed(Global::Keys[k_MechBackward]))
|
||||||
Velocity.z += a;
|
Velocity.z += a;
|
||||||
// gora-dol
|
// gora-dol
|
||||||
// if (Console::Pressed(VK_NUMPAD9)) Pos.y+=0.1;
|
// if (Console::Pressed(GLFW_KEY_KP_9)) Pos.y+=0.1;
|
||||||
// if (Console::Pressed(VK_NUMPAD3)) Pos.y-=0.1;
|
// if (Console::Pressed(GLFW_KEY_KP_3)) Pos.y-=0.1;
|
||||||
|
|
||||||
// McZapkie: zeby nie hustalo przy malym FPS:
|
// McZapkie: zeby nie hustalo przy malym FPS:
|
||||||
// Velocity= (Velocity+OldVelocity)/2;
|
// Velocity= (Velocity+OldVelocity)/2;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public static Int32 GetScreenSaverTimeout()
|
|||||||
TKeyTrans Console::ktTable[4 * 256];
|
TKeyTrans Console::ktTable[4 * 256];
|
||||||
|
|
||||||
// Ra: do poprawienia
|
// Ra: do poprawienia
|
||||||
void SetLedState(char Code, bool bOn){
|
void SetLedState(unsigned char Code, bool bOn){
|
||||||
// Ra: bajer do migania LED-ami w klawiaturze
|
// Ra: bajer do migania LED-ami w klawiaturze
|
||||||
// NOTE: disabled for the time being
|
// NOTE: disabled for the time being
|
||||||
// TODO: find non Borland specific equivalent, or get rid of it
|
// TODO: find non Borland specific equivalent, or get rid of it
|
||||||
@@ -244,7 +244,7 @@ void Console::BitsUpdate(int mask)
|
|||||||
{
|
{
|
||||||
case 1: // sterowanie światełkami klawiatury: CA/SHP+opory
|
case 1: // sterowanie światełkami klawiatury: CA/SHP+opory
|
||||||
if (mask & 3) // gdy SHP albo CA
|
if (mask & 3) // gdy SHP albo CA
|
||||||
SetLedState(VK_CAPITAL, iBits & 3);
|
SetLedState(VK_CAPITAL, (iBits & 3) != 0);
|
||||||
if (mask & 4) // gdy jazda na oporach
|
if (mask & 4) // gdy jazda na oporach
|
||||||
{ // Scroll Lock ma jakoś dziwnie... zmiana stanu na przeciwny
|
{ // Scroll Lock ma jakoś dziwnie... zmiana stanu na przeciwny
|
||||||
SetLedState(VK_SCROLL, true); // przyciśnięty
|
SetLedState(VK_SCROLL, true); // przyciśnięty
|
||||||
@@ -254,7 +254,7 @@ void Console::BitsUpdate(int mask)
|
|||||||
break;
|
break;
|
||||||
case 2: // sterowanie światełkami klawiatury: CA+SHP
|
case 2: // sterowanie światełkami klawiatury: CA+SHP
|
||||||
if (mask & 2) // gdy CA
|
if (mask & 2) // gdy CA
|
||||||
SetLedState(VK_CAPITAL, iBits & 2);
|
SetLedState(VK_CAPITAL, (iBits & 2) != 0);
|
||||||
if (mask & 1) // gdy SHP
|
if (mask & 1) // gdy SHP
|
||||||
{ // Scroll Lock ma jakoś dziwnie... zmiana stanu na przeciwny
|
{ // Scroll Lock ma jakoś dziwnie... zmiana stanu na przeciwny
|
||||||
SetLedState(VK_SCROLL, true); // przyciśnięty
|
SetLedState(VK_SCROLL, true); // przyciśnięty
|
||||||
@@ -356,7 +356,7 @@ void Console::BitsUpdate(int mask)
|
|||||||
|
|
||||||
bool Console::Pressed(int x)
|
bool Console::Pressed(int x)
|
||||||
{ // na razie tak - czyta się tylko klawiatura
|
{ // na razie tak - czyta się tylko klawiatura
|
||||||
if( glfwGetKey( Global::window, x ) == GLFW_TRUE )
|
if (glfwGetKey(Global::window, x) == GLFW_TRUE)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bool TLPT::Connect(int port)
|
|||||||
case 0xBD00:
|
case 0xBD00:
|
||||||
OutPort(address + 0x006, 0); // 0xBC06? czysta improwizacja
|
OutPort(address + 0x006, 0); // 0xBC06? czysta improwizacja
|
||||||
}
|
}
|
||||||
return bool(OutPort);
|
return OutPort != 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void TLPT::Out(int x)
|
void TLPT::Out(int x)
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ bool TMWDComm::ReadData() // odbieranie danych + odczyta danych analogowych i za
|
|||||||
bool TMWDComm::SendData() // wysyłanie danych
|
bool TMWDComm::SendData() // wysyłanie danych
|
||||||
{
|
{
|
||||||
DWORD bytes_write;
|
DWORD bytes_write;
|
||||||
DWORD fdwEvtMask;
|
|
||||||
|
|
||||||
WriteFile(hComm, &WriteDataBuff[0], BYTETOWRITE, &bytes_write, NULL);
|
WriteFile(hComm, &WriteDataBuff[0], BYTETOWRITE, &bytes_write, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ bool TPoKeys55::Connect()
|
|||||||
PBYTE PropertyValueBuffer;
|
PBYTE PropertyValueBuffer;
|
||||||
bool MatchFound;
|
bool MatchFound;
|
||||||
DWORD ErrorStatus;
|
DWORD ErrorStatus;
|
||||||
HDEVINFO hDevInfo;
|
|
||||||
std::string DeviceIDFromRegistry;
|
std::string DeviceIDFromRegistry;
|
||||||
std::string DeviceIDToFind = "Vid_1dc3&Pid_1001&Rev_1000&MI_01";
|
std::string DeviceIDToFind = "Vid_1dc3&Pid_1001&Rev_1000&MI_01";
|
||||||
// First populate a list of plugged in devices (by specifying "DIGCF_PRESENT"), which are of the
|
// First populate a list of plugged in devices (by specifying "DIGCF_PRESENT"), which are of the
|
||||||
|
|||||||
Binary file not shown.
@@ -260,8 +260,8 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
|
|||||||
}
|
}
|
||||||
if (iFlags & spSwitch) // jeśli odcinek zmienny
|
if (iFlags & spSwitch) // jeśli odcinek zmienny
|
||||||
{
|
{
|
||||||
if (bool(trTrack->GetSwitchState() & 1) !=
|
if (((trTrack->GetSwitchState() & 1) != 0) !=
|
||||||
bool(iFlags & spSwitchStatus)) // czy stan się zmienił?
|
((iFlags & spSwitchStatus) != 0)) // czy stan się zmienił?
|
||||||
{ // Ra: zakładam, że są tylko 2 możliwe stany
|
{ // Ra: zakładam, że są tylko 2 możliwe stany
|
||||||
iFlags ^= spSwitchStatus;
|
iFlags ^= spSwitchStatus;
|
||||||
// fVelNext=trTrack->VelocityGet(); //nowa prędkość
|
// fVelNext=trTrack->VelocityGet(); //nowa prędkość
|
||||||
@@ -389,7 +389,7 @@ void TSpeedPos::Set(TTrack *track, double dist, int flag)
|
|||||||
fVelNext = (trTrack->iCategoryFlag & 1) ?
|
fVelNext = (trTrack->iCategoryFlag & 1) ?
|
||||||
0.0 :
|
0.0 :
|
||||||
20.0; // jeśli koniec, to pociąg stój, a samochód zwolnij
|
20.0; // jeśli koniec, to pociąg stój, a samochód zwolnij
|
||||||
vPos = (bool(iFlags & spReverse) != bool(iFlags & spEnd)) ?
|
vPos = (((iFlags & spReverse) != 0) != ((iFlags & spEnd) != 0)) ?
|
||||||
trTrack->CurrentSegment()->FastGetPoint_1() :
|
trTrack->CurrentSegment()->FastGetPoint_1() :
|
||||||
trTrack->CurrentSegment()->FastGetPoint_0();
|
trTrack->CurrentSegment()->FastGetPoint_0();
|
||||||
}
|
}
|
||||||
|
|||||||
59
DynObj.cpp
59
DynObj.cpp
@@ -43,7 +43,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
// vector3 vWorldLeft=CrossProduct(vWorldUp,vWorldFront);
|
// vector3 vWorldLeft=CrossProduct(vWorldUp,vWorldFront);
|
||||||
|
|
||||||
#define M_2PI 6.283185307179586476925286766559;
|
#define M_2PI 6.283185307179586476925286766559;
|
||||||
const float maxrot = (M_PI / 3.0); // 60°
|
const float maxrot = (float)(M_PI / 3.0); // 60°
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void TAnimPant::AKP_4E()
|
void TAnimPant::AKP_4E()
|
||||||
@@ -65,13 +65,13 @@ void TAnimPant::AKP_4E()
|
|||||||
PantWys = fLenL1 * sin(fAngleL) + fLenU1 * sin(fAngleU) + fHeight; // wysokość początkowa
|
PantWys = fLenL1 * sin(fAngleL) + fLenU1 * sin(fAngleU) + fHeight; // wysokość początkowa
|
||||||
PantTraction = PantWys;
|
PantTraction = PantWys;
|
||||||
hvPowerWire = NULL;
|
hvPowerWire = NULL;
|
||||||
fWidthExtra = 0.381; //(2.032m-1.027)/2
|
fWidthExtra = 0.381f; //(2.032m-1.027)/2
|
||||||
// poza obszarem roboczym jest aproksymacja łamaną o 5 odcinkach
|
// poza obszarem roboczym jest aproksymacja łamaną o 5 odcinkach
|
||||||
fHeightExtra[0] = 0.0; //+0.0762
|
fHeightExtra[0] = 0.0f; //+0.0762
|
||||||
fHeightExtra[1] = -0.01; //+0.1524
|
fHeightExtra[1] = -0.01f; //+0.1524
|
||||||
fHeightExtra[2] = -0.03; //+0.2286
|
fHeightExtra[2] = -0.03f; //+0.2286
|
||||||
fHeightExtra[3] = -0.07; //+0.3048
|
fHeightExtra[3] = -0.07f; //+0.3048
|
||||||
fHeightExtra[4] = -0.15; //+0.3810
|
fHeightExtra[4] = -0.15f; //+0.3810
|
||||||
};
|
};
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
int TAnim::TypeSet(int i, int fl)
|
int TAnim::TypeSet(int i, int fl)
|
||||||
@@ -1168,7 +1168,6 @@ TDynamicObject * TDynamicObject::ABuFindObject(TTrack *Track, int ScanDir,
|
|||||||
if( false == Track->Dynamics.empty() )
|
if( false == Track->Dynamics.empty() )
|
||||||
#endif
|
#endif
|
||||||
{ // sens szukania na tym torze jest tylko, gdy są na nim pojazdy
|
{ // sens szukania na tym torze jest tylko, gdy są na nim pojazdy
|
||||||
double ObjTranslation; // pozycja najblizszego obiektu na torze
|
|
||||||
double MyTranslation; // pozycja szukającego na torze
|
double MyTranslation; // pozycja szukającego na torze
|
||||||
double MinDist = Track->Length(); // najmniejsza znaleziona odleglość
|
double MinDist = Track->Length(); // najmniejsza znaleziona odleglość
|
||||||
// (zaczynamy od długości toru)
|
// (zaczynamy od długości toru)
|
||||||
@@ -1888,11 +1887,11 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
// dodatkowe parametry yB
|
// dodatkowe parametry yB
|
||||||
MoreParams += "."; // wykonuje o jedną iterację za mało, więc trzeba mu dodać
|
MoreParams += "."; // wykonuje o jedną iterację za mało, więc trzeba mu dodać
|
||||||
// kropkę na koniec
|
// kropkę na koniec
|
||||||
int kropka = MoreParams.find("."); // znajdź kropke
|
size_t kropka = MoreParams.find("."); // znajdź kropke
|
||||||
std::string ActPar; // na parametry
|
std::string ActPar; // na parametry
|
||||||
while (kropka != std::string::npos) // jesli sa kropki jeszcze
|
while (kropka != std::string::npos) // jesli sa kropki jeszcze
|
||||||
{
|
{
|
||||||
int dlugosc = MoreParams.length();
|
size_t dlugosc = MoreParams.length();
|
||||||
ActPar = ToUpper(MoreParams.substr(0, kropka)); // pierwszy parametr;
|
ActPar = ToUpper(MoreParams.substr(0, kropka)); // pierwszy parametr;
|
||||||
MoreParams = MoreParams.substr(kropka + 1, dlugosc - kropka); // reszta do dalszej
|
MoreParams = MoreParams.substr(kropka + 1, dlugosc - kropka); // reszta do dalszej
|
||||||
// obrobki
|
// obrobki
|
||||||
@@ -2153,8 +2152,8 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
iNumAxles = 2;
|
iNumAxles = 2;
|
||||||
// McZapkie-090402: odleglosc miedzy czopami skretu lub osiami
|
// McZapkie-090402: odleglosc miedzy czopami skretu lub osiami
|
||||||
fAxleDist = Max0R(MoverParameters->BDist, MoverParameters->ADist);
|
fAxleDist = Max0R(MoverParameters->BDist, MoverParameters->ADist);
|
||||||
if (fAxleDist < 0.2)
|
if (fAxleDist < 0.2f)
|
||||||
fAxleDist = 0.2; //żeby się dało wektory policzyć
|
fAxleDist = 0.2f; //żeby się dało wektory policzyć
|
||||||
if (fAxleDist > MoverParameters->Dim.L - 0.2) // nie mogą być za daleko
|
if (fAxleDist > MoverParameters->Dim.L - 0.2) // nie mogą być za daleko
|
||||||
fAxleDist = MoverParameters->Dim.L - 0.2; // bo będzie "walenie w mur"
|
fAxleDist = MoverParameters->Dim.L - 0.2; // bo będzie "walenie w mur"
|
||||||
double fAxleDistHalf = fAxleDist * 0.5;
|
double fAxleDistHalf = fAxleDist * 0.5;
|
||||||
@@ -2264,18 +2263,18 @@ void TDynamicObject::Move(double fDistance)
|
|||||||
}
|
}
|
||||||
if (fDistance > 0.0)
|
if (fDistance > 0.0)
|
||||||
{ // gdy ruch w stronę sprzęgu 0, doliczyć korektę do osi 1
|
{ // gdy ruch w stronę sprzęgu 0, doliczyć korektę do osi 1
|
||||||
bEnabled &= Axle0.Move(fDistance, !iAxleFirst); // oś z przodu pojazdu
|
bEnabled &= Axle0.Move(fDistance, iAxleFirst == 0); // oś z przodu pojazdu
|
||||||
bEnabled &= Axle1.Move(fDistance /*-fAdjustment*/, iAxleFirst); // oś z tyłu pojazdu
|
bEnabled &= Axle1.Move(fDistance /*-fAdjustment*/, iAxleFirst != 0); // oś z tyłu pojazdu
|
||||||
}
|
}
|
||||||
else if (fDistance < 0.0)
|
else if (fDistance < 0.0)
|
||||||
{ // gdy ruch w stronę sprzęgu 1, doliczyć korektę do osi 0
|
{ // gdy ruch w stronę sprzęgu 1, doliczyć korektę do osi 0
|
||||||
bEnabled &= Axle1.Move(fDistance, iAxleFirst); // oś z tyłu pojazdu prusza się pierwsza
|
bEnabled &= Axle1.Move(fDistance, iAxleFirst != 0); // oś z tyłu pojazdu prusza się pierwsza
|
||||||
bEnabled &= Axle0.Move(fDistance /*-fAdjustment*/, !iAxleFirst); // oś z przodu pojazdu
|
bEnabled &= Axle0.Move(fDistance /*-fAdjustment*/, iAxleFirst == 0); // oś z przodu pojazdu
|
||||||
}
|
}
|
||||||
else // gf: bez wywolania Move na postoju nie ma event0
|
else // gf: bez wywolania Move na postoju nie ma event0
|
||||||
{
|
{
|
||||||
bEnabled &= Axle1.Move(fDistance, iAxleFirst); // oś z tyłu pojazdu prusza się pierwsza
|
bEnabled &= Axle1.Move(fDistance, iAxleFirst != 0); // oś z tyłu pojazdu prusza się pierwsza
|
||||||
bEnabled &= Axle0.Move(fDistance, !iAxleFirst); // oś z przodu pojazdu
|
bEnabled &= Axle0.Move(fDistance, iAxleFirst == 0); // oś z przodu pojazdu
|
||||||
}
|
}
|
||||||
if (fDistance != 0.0) // nie liczyć ponownie, jeśli stoi
|
if (fDistance != 0.0) // nie liczyć ponownie, jeśli stoi
|
||||||
{ // liczenie pozycji pojazdu tutaj, bo jest używane w wielu miejscach
|
{ // liczenie pozycji pojazdu tutaj, bo jest używane w wielu miejscach
|
||||||
@@ -2353,10 +2352,10 @@ void TDynamicObject::Move(double fDistance)
|
|||||||
switch (t0->eEnvironment)
|
switch (t0->eEnvironment)
|
||||||
{ // typ zmiany oświetlenia
|
{ // typ zmiany oświetlenia
|
||||||
case e_canyon:
|
case e_canyon:
|
||||||
fShade = 0.65;
|
fShade = 0.65f;
|
||||||
break; // zacienienie w kanionie
|
break; // zacienienie w kanionie
|
||||||
case e_tunnel:
|
case e_tunnel:
|
||||||
fShade = 0.20;
|
fShade = 0.20f;
|
||||||
break; // zacienienie w tunelu
|
break; // zacienienie w tunelu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3116,7 +3115,6 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
ResetdMoveLen();
|
ResetdMoveLen();
|
||||||
// McZapkie-260202
|
// McZapkie-260202
|
||||||
// tupot mew, tfu, stukot kol:
|
// tupot mew, tfu, stukot kol:
|
||||||
DWORD stat;
|
|
||||||
// taka prowizorka zeby sciszyc stukot dalekiej lokomotywy
|
// taka prowizorka zeby sciszyc stukot dalekiej lokomotywy
|
||||||
double ObjectDist;
|
double ObjectDist;
|
||||||
double vol = 0;
|
double vol = 0;
|
||||||
@@ -3735,7 +3733,7 @@ void TDynamicObject::Render()
|
|||||||
|
|
||||||
if (renderme)
|
if (renderme)
|
||||||
{
|
{
|
||||||
TSubModel::iInstance = (int)this; //żeby nie robić cudzych animacji
|
TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
|
||||||
// AnsiString asLoadName="";
|
// AnsiString asLoadName="";
|
||||||
double ObjSqrDist = SquareMagnitude(Global::pCameraPosition - vPosition) / Global::ZoomFactor;
|
double ObjSqrDist = SquareMagnitude(Global::pCameraPosition - vPosition) / Global::ZoomFactor;
|
||||||
ABuLittleUpdate(ObjSqrDist); // ustawianie zmiennych submodeli dla wspólnego modelu
|
ABuLittleUpdate(ObjSqrDist); // ustawianie zmiennych submodeli dla wspólnego modelu
|
||||||
@@ -3863,8 +3861,8 @@ void TDynamicObject::Render()
|
|||||||
{
|
{
|
||||||
for (int li = 0; li < 3; li++)
|
for (int li = 0; li < 3; li++)
|
||||||
{
|
{
|
||||||
diffuseCabLight[li] *= 0.6;
|
diffuseCabLight[li] *= 0.6f;
|
||||||
specularCabLight[li] *= 0.7;
|
specularCabLight[li] *= 0.7f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3872,9 +3870,9 @@ void TDynamicObject::Render()
|
|||||||
{
|
{
|
||||||
for (int li = 0; li < 3; li++)
|
for (int li = 0; li < 3; li++)
|
||||||
{
|
{
|
||||||
ambientCabLight[li] *= 0.3;
|
ambientCabLight[li] *= 0.3f;
|
||||||
diffuseCabLight[li] *= 0.1;
|
diffuseCabLight[li] *= 0.1f;
|
||||||
specularCabLight[li] *= 0.2;
|
specularCabLight[li] *= 0.2f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -4280,7 +4278,7 @@ void TDynamicObject::RenderAlpha()
|
|||||||
{ // rysowanie elementów półprzezroczystych
|
{ // rysowanie elementów półprzezroczystych
|
||||||
if (renderme)
|
if (renderme)
|
||||||
{
|
{
|
||||||
TSubModel::iInstance = (int)this; //żeby nie robić cudzych animacji
|
TSubModel::iInstance = (size_t)this; //żeby nie robić cudzych animacji
|
||||||
double ObjSqrDist = SquareMagnitude(Global::pCameraPosition - vPosition);
|
double ObjSqrDist = SquareMagnitude(Global::pCameraPosition - vPosition);
|
||||||
ABuLittleUpdate(ObjSqrDist); // ustawianie zmiennych submodeli dla wspólnego modelu
|
ABuLittleUpdate(ObjSqrDist); // ustawianie zmiennych submodeli dla wspólnego modelu
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@@ -4689,7 +4687,8 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
|||||||
|
|
||||||
else if (token == "animwheelprefix:") {
|
else if (token == "animwheelprefix:") {
|
||||||
// prefiks kręcących się kół
|
// prefiks kręcących się kół
|
||||||
int i, j, k, m;
|
int i, k, m;
|
||||||
|
unsigned int j;
|
||||||
parser.getTokens( 1, false ); parser >> token;
|
parser.getTokens( 1, false ); parser >> token;
|
||||||
for (i = 0; i < iAnimType[ANIM_WHEELS]; ++i) // liczba osi
|
for (i = 0; i < iAnimType[ANIM_WHEELS]; ++i) // liczba osi
|
||||||
{ // McZapkie-050402: wyszukiwanie kol o nazwie str*
|
{ // McZapkie-050402: wyszukiwanie kol o nazwie str*
|
||||||
@@ -5073,7 +5072,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
|||||||
|
|
||||||
else if( token == "animdoorprefix:" ) {
|
else if( token == "animdoorprefix:" ) {
|
||||||
// nazwa animowanych drzwi
|
// nazwa animowanych drzwi
|
||||||
int i, j, k, m;
|
int i, j;
|
||||||
parser.getTokens(1, false); parser >> token;
|
parser.getTokens(1, false); parser >> token;
|
||||||
for (i = 0, j = 0; i < ANIM_DOORS; ++i)
|
for (i = 0, j = 0; i < ANIM_DOORS; ++i)
|
||||||
j += iAnimType[i]; // zliczanie wcześniejszych animacji
|
j += iAnimType[i]; // zliczanie wcześniejszych animacji
|
||||||
|
|||||||
144
EU07.bpr
144
EU07.bpr
@@ -1,144 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8' ?>
|
|
||||||
<!-- C++Builder XML Project -->
|
|
||||||
<PROJECT>
|
|
||||||
<MACROS>
|
|
||||||
<VERSION value="BCB.05.03"/>
|
|
||||||
<PROJECT value="E:\Gry\MaSzyna_15_04\EU07.exe"/>
|
|
||||||
<OBJFILES value="QueryParserComp.obj EU07.obj dumb3d.obj Camera.obj Texture.obj World.obj
|
|
||||||
Model3d.obj MdlMngr.obj Train.obj wavread.obj Timer.obj Event.obj
|
|
||||||
MemCell.obj Logs.obj Spring.obj Button.obj Globals.obj Gauge.obj
|
|
||||||
AnimModel.obj Ground.obj TrkFoll.obj Segment.obj Sound.obj AdvSound.obj
|
|
||||||
Track.obj DynObj.obj RealSound.obj EvLaunch.obj FadeSound.obj Traction.obj
|
|
||||||
TractionPower.obj parser.obj sky.obj AirCoupler.obj opengl\glew.obj
|
|
||||||
ResourceManager.obj VBO.obj mtable.obj TextureDDS.obj
|
|
||||||
opengl\ARB_Multisample.obj Float3d.obj Classes.obj Driver.obj Names.obj
|
|
||||||
Console.obj McZapkie\Mover.obj McZapkie\hamulce.obj
|
|
||||||
McZapkie\Oerlikon_ESt.obj McZapkie\friction.obj McZapkie\mctools.obj
|
|
||||||
Console\PoKeys55.obj Forth.obj Console\LPT.obj PyInt.obj"/>
|
|
||||||
<RESFILES value="EU07.res"/>
|
|
||||||
<IDLFILES value=""/>
|
|
||||||
<IDLGENFILES value=""/>
|
|
||||||
<DEFFILE value=""/>
|
|
||||||
<RESDEPEN value="$(RESFILES)"/>
|
|
||||||
<LIBFILES value="opengl\glut32.lib omf_python27.lib DirectX\Dsound.lib"/>
|
|
||||||
<LIBRARIES value="dclocx50.bpi bcbsmp50.bpi VCLX50.lib bcbsmp50.lib Vcl50.lib"/>
|
|
||||||
<SPARELIBS value="Vcl50.lib bcbsmp50.lib VCLX50.lib bcbsmp50.bpi dclocx50.bpi"/>
|
|
||||||
<PACKAGES value="Vcl50.bpi Vclx50.bpi"/>
|
|
||||||
<PATHCPP value=".;opengl;McZapkie;Console"/>
|
|
||||||
<PATHPAS value=".;"/>
|
|
||||||
<PATHRC value=".;"/>
|
|
||||||
<PATHASM value=".;"/>
|
|
||||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
|
||||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
|
||||||
<LINKER value="tlink32"/>
|
|
||||||
<USERDEFINES value="GLEW_STATIC;_DEBUG"/>
|
|
||||||
<SYSDEFINES value="NO_STRICT;_RTLDLL"/>
|
|
||||||
<MAINSOURCE value="EU07.cpp"/>
|
|
||||||
<INCLUDEPATH value="Console;opengl;McZapkie;$(BCB)\include;$(BCB)\include\vcl;python\include"/>
|
|
||||||
<LIBPATH value="Console;opengl;McZapkie;$(BCB)\lib\obj;$(BCB)\lib;python\libs"/>
|
|
||||||
<WARNINGS value="-w-par"/>
|
|
||||||
</MACROS>
|
|
||||||
<OPTIONS>
|
|
||||||
<IDLCFLAGS value="-src_suffix cpp -DGLEW_STATIC -D_DEBUG -IConsole -Iopengl -IMcZapkie
|
|
||||||
-I$(BCB)\include -I$(BCB)\include\vcl -Ipython\include -boa"/>
|
|
||||||
<CFLAG1 value="-Od -w- -Vx -Ve -X- -r- -a1 -6 -b- -k -y -v -vi- -c -tW -tWM"/>
|
|
||||||
<PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
|
|
||||||
<RFLAGS value=""/>
|
|
||||||
<AFLAGS value="/mx /w2 /zi"/>
|
|
||||||
<LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
|
|
||||||
</OPTIONS>
|
|
||||||
<LINKER>
|
|
||||||
<ALLOBJ value="c0w32.obj Memmgr.Lib sysinit.obj $(OBJFILES)"/>
|
|
||||||
<ALLRES value="$(RESFILES)"/>
|
|
||||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib"/>
|
|
||||||
</LINKER>
|
|
||||||
<IDEOPTIONS>
|
|
||||||
[Version Info]
|
|
||||||
IncludeVerInfo=1
|
|
||||||
AutoIncBuild=0
|
|
||||||
MajorVer=16
|
|
||||||
MinorVer=1
|
|
||||||
Release=1174
|
|
||||||
Build=483
|
|
||||||
Debug=1
|
|
||||||
PreRelease=0
|
|
||||||
Special=0
|
|
||||||
Private=0
|
|
||||||
DLL=0
|
|
||||||
Locale=1045
|
|
||||||
CodePage=1250
|
|
||||||
|
|
||||||
[Version Info Keys]
|
|
||||||
CompanyName=EU07 Team
|
|
||||||
FileDescription=MaSzyna EU07-424
|
|
||||||
FileVersion=16.1.1174.483
|
|
||||||
InternalName=DP+SPKS+asynch+python
|
|
||||||
LegalCopyright=
|
|
||||||
LegalTrademarks=
|
|
||||||
OriginalFilename=eu07.exe
|
|
||||||
ProductName=MaSzyna EU07-424
|
|
||||||
ProductVersion=16.1
|
|
||||||
Comments=
|
|
||||||
|
|
||||||
[Excluded Packages]
|
|
||||||
$(BCB)\Bin\bcbsmp50.bpl=Borland C++ Sample Components
|
|
||||||
$(BCB)\Bin\dclqrt50.bpl=QuickReport Components
|
|
||||||
C:\Windows\system32\ibsmp50.bpl=Borland C++ InterBase Alerter Component
|
|
||||||
$(BCB)\Bin\dcltee50.bpl=TeeChart 5.0 Components
|
|
||||||
$(BCB)\Bin\applet50.bpl=Borland Control Panel Applet Package
|
|
||||||
|
|
||||||
[HistoryLists\hlIncludePath]
|
|
||||||
Count=2
|
|
||||||
Item0=Console;opengl;McZapkie;$(BCB)\include;$(BCB)\include\vcl;python\include
|
|
||||||
Item1=Console;opengl;McZapkie;$(BCB)\include;$(BCB)\include\vcl
|
|
||||||
|
|
||||||
[HistoryLists\hlLibraryPath]
|
|
||||||
Count=2
|
|
||||||
Item0=Console;opengl;McZapkie;$(BCB)\lib\obj;$(BCB)\lib;python\libs
|
|
||||||
Item1=Console;opengl;McZapkie;$(BCB)\lib\obj;$(BCB)\lib
|
|
||||||
|
|
||||||
[HistoryLists\hlDebugSourcePath]
|
|
||||||
Count=2
|
|
||||||
Item0=McZapkie\
|
|
||||||
Item1=$(BCB)\source\vcl
|
|
||||||
|
|
||||||
[HistoryLists\hlConditionals]
|
|
||||||
Count=8
|
|
||||||
Item0=GLEW_STATIC;_DEBUG
|
|
||||||
Item1=GLEW_STATIC
|
|
||||||
Item2=GLEW_STATIC;_DEBUG;USE_VBO
|
|
||||||
Item3=GLEW_STATIC;_DEBUG;_USE_OLD_RW_STL
|
|
||||||
Item4=GLEW_STATIC;USE_VERTEX_ARRAYS;_DEBUG
|
|
||||||
Item5=GLEW_STATIC;USE_VERTEX_ARRAYS
|
|
||||||
Item6=GLEW_STATIC;_DEBUG;USE_VERTEX_ARRAYS
|
|
||||||
Item7=_DEBUG
|
|
||||||
|
|
||||||
[HistoryLists\hlFinalOutputDir]
|
|
||||||
Count=5
|
|
||||||
Item0=E:\Gry\MaSzyna_15_04\
|
|
||||||
Item1=D:\Maszyna
|
|
||||||
Item2=E:\Gry\MaSzyna_15_04
|
|
||||||
Item3=D:\EU07\
|
|
||||||
Item4=E:\EU07\
|
|
||||||
|
|
||||||
[Debugging]
|
|
||||||
DebugSourceDirs=McZapkie\
|
|
||||||
|
|
||||||
[Parameters]
|
|
||||||
RunParams=-s td.scn -v EP07-424
|
|
||||||
HostApplication=
|
|
||||||
RemoteHost=
|
|
||||||
RemotePath=
|
|
||||||
RemoteDebug=0
|
|
||||||
|
|
||||||
[Compiler]
|
|
||||||
ShowInfoMsgs=0
|
|
||||||
LinkDebugVcl=0
|
|
||||||
LinkCGLIB=0
|
|
||||||
|
|
||||||
[Language]
|
|
||||||
ActiveLang=
|
|
||||||
ProjectLang=
|
|
||||||
RootDir=
|
|
||||||
</IDEOPTIONS>
|
|
||||||
</PROJECT>
|
|
||||||
228
EU07.cpp
228
EU07.cpp
@@ -18,8 +18,8 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <png.h>
|
||||||
#include <dsound.h> //_clear87() itp.
|
#include <thread>
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Logs.h"
|
#include "Logs.h"
|
||||||
@@ -44,19 +44,57 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TWorld World;
|
TWorld World;
|
||||||
PCOPYDATASTRUCT pDane;
|
|
||||||
|
|
||||||
void window_resize_callback( GLFWwindow *window, int w, int h )
|
void screenshot_save_thread(char *img)
|
||||||
|
{
|
||||||
|
png_image png;
|
||||||
|
memset(&png, 0, sizeof(png_image));
|
||||||
|
png.version = PNG_IMAGE_VERSION;
|
||||||
|
png.width = Global::ScreenWidth;
|
||||||
|
png.height = Global::ScreenHeight;
|
||||||
|
png.format = PNG_FORMAT_RGB;
|
||||||
|
|
||||||
|
char datetime[64];
|
||||||
|
time_t timer;
|
||||||
|
struct tm* tm_info;
|
||||||
|
time(&timer);
|
||||||
|
tm_info = localtime(&timer);
|
||||||
|
strftime(datetime, 64, "%Y-%m-%d_%H-%M-%S", tm_info);
|
||||||
|
|
||||||
|
uint64_t perf;
|
||||||
|
QueryPerformanceCounter((LARGE_INTEGER*)&perf);
|
||||||
|
|
||||||
|
std::string filename = "screenshots/" + std::string(datetime) +
|
||||||
|
"_" + std::to_string(perf) + ".png";
|
||||||
|
|
||||||
|
if (png_image_write_to_file(&png, filename.c_str(), 0, img, -Global::ScreenWidth * 3, nullptr) == 1)
|
||||||
|
WriteLog("saved " + filename + ".");
|
||||||
|
else
|
||||||
|
WriteLog("failed to save screenshot.");
|
||||||
|
|
||||||
|
delete[] img;
|
||||||
|
}
|
||||||
|
|
||||||
|
void make_screenshot()
|
||||||
|
{
|
||||||
|
char *img = new char[Global::ScreenWidth * Global::ScreenHeight * 3];
|
||||||
|
glReadPixels(0, 0, Global::ScreenWidth, Global::ScreenHeight, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)img);
|
||||||
|
|
||||||
|
std::thread t(screenshot_save_thread, img);
|
||||||
|
t.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_resize_callback(GLFWwindow *window, int w, int h)
|
||||||
{
|
{
|
||||||
Global::ScreenWidth = w;
|
Global::ScreenWidth = w;
|
||||||
Global::ScreenHeight = h;
|
Global::ScreenHeight = h;
|
||||||
::glViewport( 0, 0, w, h );
|
glViewport(0, 0, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_pos_callback( GLFWwindow *window, double x, double y )
|
void cursor_pos_callback(GLFWwindow *window, double x, double y)
|
||||||
{
|
{
|
||||||
World.OnMouseMove( x * 0.005, y * 0.01 );
|
World.OnMouseMove(x * 0.005, y * 0.01);
|
||||||
::glfwSetCursorPos( window, 0.0, 0.0 );
|
glfwSetCursorPos(window, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void key_callback( GLFWwindow *window, int key, int scancode, int action, int mods )
|
void key_callback( GLFWwindow *window, int key, int scancode, int action, int mods )
|
||||||
@@ -80,6 +118,9 @@ void key_callback( GLFWwindow *window, int key, int scancode, int action, int mo
|
|||||||
|
|
||||||
switch( key )
|
switch( key )
|
||||||
{
|
{
|
||||||
|
case GLFW_KEY_F11:
|
||||||
|
make_screenshot();
|
||||||
|
break;
|
||||||
case GLFW_KEY_ESCAPE: {
|
case GLFW_KEY_ESCAPE: {
|
||||||
|
|
||||||
if( ( DebugModeFlag ) //[Esc] pauzuje tylko bez Debugmode
|
if( ( DebugModeFlag ) //[Esc] pauzuje tylko bez Debugmode
|
||||||
@@ -128,84 +169,19 @@ void focus_callback( GLFWwindow *window, int focus )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
GLFWAPI HWND glfwGetWin32Window( GLFWwindow* window );
|
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND Hwnd;
|
LONG CALLBACK unhandled_handler(::EXCEPTION_POINTERS* e);
|
||||||
WNDPROC BaseWindowProc;
|
LRESULT APIENTRY WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
extern HWND Hwnd;
|
||||||
LRESULT APIENTRY WndProc( HWND hWnd, // handle for this window
|
extern WNDPROC BaseWindowProc;
|
||||||
UINT uMsg, // message for this window
|
|
||||||
WPARAM wParam, // additional message information
|
|
||||||
LPARAM lParam) // additional message information
|
|
||||||
{
|
|
||||||
switch( uMsg ) // check for windows messages
|
|
||||||
{
|
|
||||||
case WM_COPYDATA: {
|
|
||||||
// obsługa danych przesłanych przez program sterujący
|
|
||||||
pDane = (PCOPYDATASTRUCT)lParam;
|
|
||||||
if( pDane->dwData == MAKE_ID4( 'E', 'U', '0', '7' ) ) // sygnatura danych
|
|
||||||
World.OnCommandGet( (DaneRozkaz *)( pDane->lpData ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// pass all unhandled messages to DefWindowProc
|
|
||||||
return CallWindowProc( BaseWindowProc, Hwnd, uMsg, wParam, lParam );
|
|
||||||
};
|
|
||||||
|
|
||||||
void make_minidump( ::EXCEPTION_POINTERS* e ) {
|
|
||||||
|
|
||||||
auto hDbgHelp = ::LoadLibraryA( "dbghelp" );
|
|
||||||
if( hDbgHelp == nullptr )
|
|
||||||
return;
|
|
||||||
auto pMiniDumpWriteDump = (decltype( &MiniDumpWriteDump ))::GetProcAddress( hDbgHelp, "MiniDumpWriteDump" );
|
|
||||||
if( pMiniDumpWriteDump == nullptr )
|
|
||||||
return;
|
|
||||||
|
|
||||||
char name[ MAX_PATH ];
|
|
||||||
{
|
|
||||||
auto nameEnd = name + ::GetModuleFileNameA( ::GetModuleHandleA( 0 ), name, MAX_PATH );
|
|
||||||
::SYSTEMTIME t;
|
|
||||||
::GetSystemTime( &t );
|
|
||||||
wsprintfA( nameEnd - strlen( ".exe" ),
|
|
||||||
"_crashdump_%4d%02d%02d_%02d%02d%02d.dmp",
|
|
||||||
t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond );
|
|
||||||
}
|
|
||||||
|
|
||||||
auto hFile = ::CreateFileA( name, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );
|
|
||||||
if( hFile == INVALID_HANDLE_VALUE )
|
|
||||||
return;
|
|
||||||
|
|
||||||
::MINIDUMP_EXCEPTION_INFORMATION exceptionInfo;
|
|
||||||
exceptionInfo.ThreadId = ::GetCurrentThreadId();
|
|
||||||
exceptionInfo.ExceptionPointers = e;
|
|
||||||
exceptionInfo.ClientPointers = FALSE;
|
|
||||||
|
|
||||||
auto dumped = pMiniDumpWriteDump(
|
|
||||||
::GetCurrentProcess(),
|
|
||||||
::GetCurrentProcessId(),
|
|
||||||
hFile,
|
|
||||||
::MINIDUMP_TYPE( ::MiniDumpWithIndirectlyReferencedMemory | ::MiniDumpScanMemory ),
|
|
||||||
e ? &exceptionInfo : nullptr,
|
|
||||||
nullptr,
|
|
||||||
nullptr );
|
|
||||||
|
|
||||||
::CloseHandle( hFile );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LONG CALLBACK unhandled_handler( ::EXCEPTION_POINTERS* e ) {
|
|
||||||
make_minidump( e );
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main( int argc, char *argv[] ) {
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
#if defined(_MSC_VER) && defined (_DEBUG)
|
#if defined(_MSC_VER) && defined (_DEBUG)
|
||||||
// memory leaks
|
// memory leaks
|
||||||
_CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF );
|
_CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF );
|
||||||
@@ -219,39 +195,44 @@ int main( int argc, char *argv[] ) {
|
|||||||
::SetUnhandledExceptionFilter( unhandled_handler );
|
::SetUnhandledExceptionFilter( unhandled_handler );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !glfwInit() )
|
if (!glfwInit())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
DeleteFile( "errors.txt" );
|
DeleteFile("errors.txt");
|
||||||
Global::LoadIniFile( "eu07.ini" );
|
Global::LoadIniFile("eu07.ini");
|
||||||
Global::InitKeys();
|
Global::InitKeys();
|
||||||
|
|
||||||
// hunter-271211: ukrywanie konsoli
|
// hunter-271211: ukrywanie konsoli
|
||||||
if( Global::iWriteLogEnabled & 2 ) {
|
if( Global::iWriteLogEnabled & 2 )
|
||||||
|
{
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), FOREGROUND_GREEN );
|
SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), FOREGROUND_GREEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i = 1; i < argc; i++ ) {
|
for (int i = 1; i < argc; ++i)
|
||||||
std::string token( argv[ i ] );
|
{
|
||||||
|
std::string token(argv[i]);
|
||||||
|
|
||||||
if( token == "-modifytga" )
|
if (token == "-modifytga")
|
||||||
Global::iModifyTGA = -1;
|
Global::iModifyTGA = -1;
|
||||||
else if( token == "-e3d" ) {
|
else if (token == "-e3d")
|
||||||
if( Global::iConvertModels > 0 )
|
{
|
||||||
|
if (Global::iConvertModels > 0)
|
||||||
Global::iConvertModels = -Global::iConvertModels;
|
Global::iConvertModels = -Global::iConvertModels;
|
||||||
else
|
else
|
||||||
Global::iConvertModels = -7; // z optymalizacją, bananami i prawidłowym Opacity
|
Global::iConvertModels = -7; // z optymalizacją, bananami i prawidłowym Opacity
|
||||||
}
|
}
|
||||||
else if( i + 1 < argc && token == "-s" )
|
else if (i + 1 < argc && token == "-s")
|
||||||
Global::SceneryFile = std::string( argv[ ++i ] );
|
Global::SceneryFile = std::string(argv[++i]);
|
||||||
else if( i + 1 < argc && token == "-v" ) {
|
else if (i + 1 < argc && token == "-v")
|
||||||
std::string v( argv[ ++i ] );
|
{
|
||||||
std::transform( v.begin(), v.end(), v.begin(), ::tolower );
|
std::string v(argv[++i]);
|
||||||
|
std::transform(v.begin(), v.end(), v.begin(), ::tolower);
|
||||||
Global::asHumanCtrlVehicle = v;
|
Global::asHumanCtrlVehicle = v;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
std::cout << "usage: " << std::string( argv[ 0 ] ) << " [-s sceneryfilepath] "
|
{
|
||||||
|
std::cout << "usage: " << std::string(argv[0]) << " [-s sceneryfilepath] "
|
||||||
<< "[-v vehiclename] [-modifytga] [-e3d]" << std::endl;
|
<< "[-v vehiclename] [-modifytga] [-e3d]" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -260,17 +241,18 @@ int main( int argc, char *argv[] ) {
|
|||||||
// match requested video mode to current to allow for
|
// match requested video mode to current to allow for
|
||||||
// fullwindow creation when resolution is the same
|
// fullwindow creation when resolution is the same
|
||||||
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||||
const GLFWvidmode *vmode = glfwGetVideoMode( monitor );
|
const GLFWvidmode *vmode = glfwGetVideoMode(monitor);
|
||||||
|
|
||||||
glfwWindowHint( GLFW_RED_BITS, vmode->redBits );
|
glfwWindowHint(GLFW_RED_BITS, vmode->redBits);
|
||||||
glfwWindowHint( GLFW_GREEN_BITS, vmode->greenBits );
|
glfwWindowHint(GLFW_GREEN_BITS, vmode->greenBits);
|
||||||
glfwWindowHint( GLFW_BLUE_BITS, vmode->blueBits );
|
glfwWindowHint(GLFW_BLUE_BITS, vmode->blueBits);
|
||||||
glfwWindowHint( GLFW_REFRESH_RATE, vmode->refreshRate );
|
glfwWindowHint(GLFW_REFRESH_RATE, vmode->refreshRate);
|
||||||
|
|
||||||
glfwWindowHint( GLFW_AUTO_ICONIFY, GLFW_FALSE );
|
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
|
||||||
glfwWindowHint( GLFW_SAMPLES, 1 << Global::iMultisampling );
|
glfwWindowHint(GLFW_SAMPLES, 1 << Global::iMultisampling);
|
||||||
|
|
||||||
if( Global::bFullScreen ) {
|
if (Global::bFullScreen)
|
||||||
|
{
|
||||||
// match screen dimensions with selected monitor, for 'borderless window' in fullscreen mode
|
// match screen dimensions with selected monitor, for 'borderless window' in fullscreen mode
|
||||||
Global::iWindowWidth = vmode->width;
|
Global::iWindowWidth = vmode->width;
|
||||||
Global::iWindowHeight = vmode->height;
|
Global::iWindowHeight = vmode->height;
|
||||||
@@ -280,25 +262,27 @@ int main( int argc, char *argv[] ) {
|
|||||||
glfwCreateWindow( Global::iWindowWidth, Global::iWindowHeight,
|
glfwCreateWindow( Global::iWindowWidth, Global::iWindowHeight,
|
||||||
"EU07", Global::bFullScreen ? monitor : nullptr, nullptr );
|
"EU07", Global::bFullScreen ? monitor : nullptr, nullptr );
|
||||||
|
|
||||||
if( !window ) {
|
if (!window)
|
||||||
|
{
|
||||||
std::cout << "failed to create window" << std::endl;
|
std::cout << "failed to create window" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
glfwMakeContextCurrent( window );
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval( (Global::VSync ? 1 : 0) ); //vsync
|
glfwSwapInterval(Global::VSync ? 1 : 0); //vsync
|
||||||
glfwSetInputMode( window, GLFW_CURSOR, GLFW_CURSOR_DISABLED ); //capture cursor
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); //capture cursor
|
||||||
glfwSetCursorPos( window, 0.0, 0.0 );
|
glfwSetCursorPos(window, 0.0, 0.0);
|
||||||
glfwSetFramebufferSizeCallback( window, window_resize_callback );
|
glfwSetFramebufferSizeCallback(window, window_resize_callback);
|
||||||
glfwSetCursorPosCallback( window, cursor_pos_callback );
|
glfwSetCursorPosCallback(window, cursor_pos_callback);
|
||||||
glfwSetKeyCallback( window, key_callback );
|
glfwSetKeyCallback(window, key_callback);
|
||||||
glfwSetWindowFocusCallback( window, focus_callback );
|
glfwSetWindowFocusCallback(window, focus_callback);
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
glfwGetFramebufferSize( window, &width, &height );
|
glfwGetFramebufferSize(window, &width, &height);
|
||||||
window_resize_callback( window, width, height );
|
window_resize_callback(window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( glewInit() != GLEW_OK ) {
|
if (glewInit() != GLEW_OK)
|
||||||
|
{
|
||||||
std::cout << "failed to init GLEW" << std::endl;
|
std::cout << "failed to init GLEW" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -306,7 +290,7 @@ int main( int argc, char *argv[] ) {
|
|||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
// setup wrapper for base glfw window proc, to handle copydata messages
|
// setup wrapper for base glfw window proc, to handle copydata messages
|
||||||
Hwnd = glfwGetWin32Window( window );
|
Hwnd = glfwGetWin32Window( window );
|
||||||
BaseWindowProc = (WNDPROC)::SetWindowLongPtr( Hwnd, GWLP_WNDPROC, (LONG)WndProc );
|
BaseWindowProc = (WNDPROC)::SetWindowLongPtr( Hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc );
|
||||||
// switch off the topmost flag
|
// switch off the topmost flag
|
||||||
::SetWindowPos( Hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
|
::SetWindowPos( Hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
|
||||||
#endif
|
#endif
|
||||||
@@ -314,7 +298,8 @@ int main( int argc, char *argv[] ) {
|
|||||||
GfxRenderer.Init();
|
GfxRenderer.Init();
|
||||||
|
|
||||||
Global::pWorld = &World; // Ra: wskaźnik potrzebny do usuwania pojazdów
|
Global::pWorld = &World; // Ra: wskaźnik potrzebny do usuwania pojazdów
|
||||||
if( !World.Init( window ) ) {
|
if (!World.Init(window))
|
||||||
|
{
|
||||||
std::cout << "failed to init TWorld" << std::endl;
|
std::cout << "failed to init TWorld" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -335,8 +320,9 @@ int main( int argc, char *argv[] ) {
|
|||||||
} // po zrobieniu E3D odpalamy normalnie scenerię, by ją zobaczyć
|
} // po zrobieniu E3D odpalamy normalnie scenerię, by ją zobaczyć
|
||||||
|
|
||||||
Console::On(); // włączenie konsoli
|
Console::On(); // włączenie konsoli
|
||||||
while( !glfwWindowShouldClose( window ) && World.Update() ) {
|
while (!glfwWindowShouldClose(window) && World.Update())
|
||||||
glfwSwapBuffers( window );
|
{
|
||||||
|
glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
Console::Off(); // wyłączenie konsoli (komunikacji zwrotnej)
|
Console::Off(); // wyłączenie konsoli (komunikacji zwrotnej)
|
||||||
@@ -345,7 +331,7 @@ int main( int argc, char *argv[] ) {
|
|||||||
TPythonInterpreter::killInstance();
|
TPythonInterpreter::killInstance();
|
||||||
delete pConsole;
|
delete pConsole;
|
||||||
|
|
||||||
glfwDestroyWindow( window );
|
glfwDestroyWindow(window);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ti;
|
int ti;
|
||||||
double tf;
|
|
||||||
std::string token;
|
std::string token;
|
||||||
//string str;
|
//string str;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|||||||
19
Float3d.cpp
19
Float3d.cpp
@@ -9,9 +9,28 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "float3d.h"
|
#include "float3d.h"
|
||||||
|
#include "sn_utils.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void float4x4::deserialize_float32(std::istream &s)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 16; i++)
|
||||||
|
e[i] = sn_utils::ld_float32(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void float4x4::deserialize_float64(std::istream &s)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 16; i++)
|
||||||
|
e[i] = (float)sn_utils::ld_float64(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void float4x4::serialize_float32(std::ostream &s)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 16; i++)
|
||||||
|
sn_utils::ls_float32(s, e[i]);
|
||||||
|
}
|
||||||
|
|
||||||
void float4x4::Quaternion(float4 *q)
|
void float4x4::Quaternion(float4 *q)
|
||||||
{ // konwersja kwaternionu obrotu na macierz obrotu
|
{ // konwersja kwaternionu obrotu na macierz obrotu
|
||||||
float xx = q->x * q->x, yy = q->y * q->y, zz = q->z * q->z;
|
float xx = q->x * q->x, yy = q->y * q->y, zz = q->z * q->z;
|
||||||
|
|||||||
15
Float3d.h
15
Float3d.h
@@ -196,9 +196,12 @@ struct float8
|
|||||||
|
|
||||||
class float4x4
|
class float4x4
|
||||||
{ // macierz transformacji pojedynczej precyzji
|
{ // macierz transformacji pojedynczej precyzji
|
||||||
|
public:
|
||||||
float e[16];
|
float e[16];
|
||||||
|
|
||||||
public:
|
void deserialize_float32(std::istream&);
|
||||||
|
void deserialize_float64(std::istream&);
|
||||||
|
void serialize_float32(std::ostream&);
|
||||||
float4x4(void){};
|
float4x4(void){};
|
||||||
float4x4(float f[16])
|
float4x4(float f[16])
|
||||||
{
|
{
|
||||||
@@ -292,6 +295,16 @@ inline float4x4 &float4x4::Rotation(double angle, float3 axis)
|
|||||||
return *this;
|
return *this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool operator==(const float4x4& v1, const float4x4& v2)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
if (v1.e[i] != v2.e[i])
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
inline float4x4 operator*(const float4x4 &m1, const float4x4 &m2)
|
inline float4x4 operator*(const float4x4 &m1, const float4x4 &m2)
|
||||||
{ // iloczyn macierzy
|
{ // iloczyn macierzy
|
||||||
float4x4 retVal;
|
float4x4 retVal;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void TGauge::Init(TSubModel *NewSubModel, TGaugeType eNewType, double fNewScale,
|
|||||||
do
|
do
|
||||||
{ // pętla po submodelach potomnych i obracanie ich o kąt zależy od
|
{ // pętla po submodelach potomnych i obracanie ich o kąt zależy od
|
||||||
// cyfry w (fValue)
|
// cyfry w (fValue)
|
||||||
if (sm->pName)
|
if (sm->pName.size())
|
||||||
{ // musi mieć niepustą nazwę
|
{ // musi mieć niepustą nazwę
|
||||||
if (sm->pName[0] >= '0')
|
if (sm->pName[0] >= '0')
|
||||||
if (sm->pName[0] <= '9')
|
if (sm->pName[0] <= '9')
|
||||||
@@ -98,7 +98,7 @@ bool TGauge::Load(cParser &Parser, TModel3d *md1, TModel3d *md2, double mul)
|
|||||||
Init(sm, gt_Digital, val3, val4, val5);
|
Init(sm, gt_Digital, val3, val4, val5);
|
||||||
else
|
else
|
||||||
Init(sm, gt_Rotate, val3, val4, val5);
|
Init(sm, gt_Rotate, val3, val4, val5);
|
||||||
return (md2); // true, gdy podany model zewnętrzny, a w kabinie nie było
|
return md2 != nullptr; // true, gdy podany model zewnętrzny, a w kabinie nie było
|
||||||
};
|
};
|
||||||
|
|
||||||
void TGauge::PermIncValue(double fNewDesired)
|
void TGauge::PermIncValue(double fNewDesired)
|
||||||
@@ -176,7 +176,7 @@ void TGauge::Update()
|
|||||||
if( n.length() > 10 ) { n.erase( 0, n.length() - 10 ); } // also dumb but should work for now
|
if( n.length() > 10 ) { n.erase( 0, n.length() - 10 ); } // also dumb but should work for now
|
||||||
do
|
do
|
||||||
{ // pętla po submodelach potomnych i obracanie ich o kąt zależy od cyfry w (fValue)
|
{ // pętla po submodelach potomnych i obracanie ich o kąt zależy od cyfry w (fValue)
|
||||||
if( sm->pName ) {
|
if( sm->pName.size() ) {
|
||||||
// musi mieć niepustą nazwę
|
// musi mieć niepustą nazwę
|
||||||
if( ( sm->pName[ 0 ] >= '0' )
|
if( ( sm->pName[ 0 ] >= '0' )
|
||||||
&& ( sm->pName[ 0 ] <= '9' ) ) {
|
&& ( sm->pName[ 0 ] <= '9' ) ) {
|
||||||
|
|||||||
2
Geom.cpp
2
Geom.cpp
@@ -11,7 +11,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "classes.hpp"
|
#include "classes.hpp"
|
||||||
#include <gl/gl.h>
|
#include <gl/gl.h>
|
||||||
#include <gl/glu.h>
|
#include <gl/glu.h>
|
||||||
#include "opengl/glut.h"
|
#include "GL/glut.h"
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
|
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
|
|||||||
161
Globals.cpp
161
Globals.cpp
@@ -49,17 +49,17 @@ bool Global::bOpenGL_1_5 = false; // czy są dostępne funkcje OpenGL 1.5
|
|||||||
double Global::fLuminance = 1.0; // jasność światła do automatycznego zapalania
|
double Global::fLuminance = 1.0; // jasność światła do automatycznego zapalania
|
||||||
float Global::SunAngle = 0.0f;
|
float Global::SunAngle = 0.0f;
|
||||||
int Global::iReCompile = 0; // zwiększany, gdy trzeba odświeżyć siatki
|
int Global::iReCompile = 0; // zwiększany, gdy trzeba odświeżyć siatki
|
||||||
GLFWwindow *Global::window;
|
|
||||||
bool Global::shiftState;
|
|
||||||
bool Global::ctrlState;
|
|
||||||
int Global::ScreenWidth = 1;
|
int Global::ScreenWidth = 1;
|
||||||
int Global::ScreenHeight = 1;
|
int Global::ScreenHeight = 1;
|
||||||
float Global::ZoomFactor = 1.0f;
|
float Global::ZoomFactor = 1.0f;
|
||||||
float Global::FieldOfView = 45.0f;
|
float Global::FieldOfView = 45.0f;
|
||||||
|
GLFWwindow *Global::window;
|
||||||
|
bool Global::shiftState;
|
||||||
|
bool Global::ctrlState;
|
||||||
int Global::iCameraLast = -1;
|
int Global::iCameraLast = -1;
|
||||||
std::string Global::asRelease = "16.0.1172.482";
|
std::string Global::asRelease = "16.0.1172.482";
|
||||||
std::string Global::asVersion =
|
std::string Global::asVersion =
|
||||||
"Compilation 2017-01-10, release " + Global::asRelease + "."; // tutaj, bo wysyłany
|
"Compilation 2017-01-10, release " + Global::asRelease + "."; // tutaj, bo wysyłany
|
||||||
int Global::iViewMode = 0; // co aktualnie widać: 0-kabina, 1-latanie, 2-sprzęgi, 3-dokumenty
|
int Global::iViewMode = 0; // co aktualnie widać: 0-kabina, 1-latanie, 2-sprzęgi, 3-dokumenty
|
||||||
int Global::iTextMode = 0; // tryb pracy wyświetlacza tekstowego
|
int Global::iTextMode = 0; // tryb pracy wyświetlacza tekstowego
|
||||||
int Global::iScreenMode[12] = {0, 0, 0, 0, 0, 0,
|
int Global::iScreenMode[12] = {0, 0, 0, 0, 0, 0,
|
||||||
@@ -94,7 +94,7 @@ std::vector<vector3> Global::FreeCameraInit;
|
|||||||
std::vector<vector3> Global::FreeCameraInitAngle;
|
std::vector<vector3> Global::FreeCameraInitAngle;
|
||||||
double Global::fFogStart = 1700;
|
double Global::fFogStart = 1700;
|
||||||
double Global::fFogEnd = 2000;
|
double Global::fFogEnd = 2000;
|
||||||
float Global::Background[3] = {0.2, 0.4, 0.33};
|
float Global::Background[3] = {0.2f, 0.4f, 0.33f};
|
||||||
GLfloat Global::AtmoColor[] = {0.423f, 0.702f, 1.0f};
|
GLfloat Global::AtmoColor[] = {0.423f, 0.702f, 1.0f};
|
||||||
GLfloat Global::FogColor[] = {0.6f, 0.7f, 0.8f};
|
GLfloat Global::FogColor[] = {0.6f, 0.7f, 0.8f};
|
||||||
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
||||||
@@ -127,8 +127,8 @@ bool Global::bFreeFly = false;
|
|||||||
bool Global::bFullScreen = false;
|
bool Global::bFullScreen = false;
|
||||||
bool Global::VSync{ true };
|
bool Global::VSync{ true };
|
||||||
bool Global::bInactivePause = true; // automatyczna pauza, gdy okno nieaktywne
|
bool Global::bInactivePause = true; // automatyczna pauza, gdy okno nieaktywne
|
||||||
float Global::fMouseXScale = 1.5;
|
float Global::fMouseXScale = 1.5f;
|
||||||
float Global::fMouseYScale = 0.2;
|
float Global::fMouseYScale = 0.2f;
|
||||||
std::string Global::SceneryFile = "td.scn";
|
std::string Global::SceneryFile = "td.scn";
|
||||||
std::string Global::asHumanCtrlVehicle = "EU07-424";
|
std::string Global::asHumanCtrlVehicle = "EU07-424";
|
||||||
int Global::iMultiplayer = 0; // blokada działania niektórych funkcji na rzecz komunikacji
|
int Global::iMultiplayer = 0; // blokada działania niektórych funkcji na rzecz komunikacji
|
||||||
@@ -495,10 +495,8 @@ void Global::ConfigParse(cParser &Parser)
|
|||||||
|
|
||||||
Parser.getTokens();
|
Parser.getTokens();
|
||||||
Parser >> token;
|
Parser >> token;
|
||||||
/*
|
|
||||||
Global::bUseVBO = (token == "yes");
|
Global::bUseVBO = (token == "yes");
|
||||||
*/
|
|
||||||
Global::bUseVBO = false; // temporarily disabled until render paths are sorted out
|
|
||||||
}
|
}
|
||||||
else if (token == "feedbackmode")
|
else if (token == "feedbackmode")
|
||||||
{
|
{
|
||||||
@@ -967,91 +965,92 @@ void Global::ConfigParse(cParser &Parser)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Global::InitKeys() {
|
void Global::InitKeys()
|
||||||
Keys[ k_IncMainCtrl ] = GLFW_KEY_KP_ADD;
|
{
|
||||||
Keys[ k_IncMainCtrlFAST ] = GLFW_KEY_KP_ADD;
|
Keys[k_IncMainCtrl] = GLFW_KEY_KP_ADD;
|
||||||
Keys[ k_DecMainCtrl ] = GLFW_KEY_KP_SUBTRACT;
|
Keys[k_IncMainCtrlFAST] = GLFW_KEY_KP_ADD;
|
||||||
Keys[ k_DecMainCtrlFAST ] = GLFW_KEY_KP_SUBTRACT;
|
Keys[k_DecMainCtrl] = GLFW_KEY_KP_SUBTRACT;
|
||||||
Keys[ k_IncScndCtrl ] = GLFW_KEY_KP_DIVIDE;
|
Keys[k_DecMainCtrlFAST] = GLFW_KEY_KP_SUBTRACT;
|
||||||
Keys[ k_IncScndCtrlFAST ] = GLFW_KEY_KP_DIVIDE;
|
Keys[k_IncScndCtrl] = GLFW_KEY_KP_DIVIDE;
|
||||||
Keys[ k_DecScndCtrl ] = GLFW_KEY_KP_MULTIPLY;
|
Keys[k_IncScndCtrlFAST] = GLFW_KEY_KP_DIVIDE;
|
||||||
Keys[ k_DecScndCtrlFAST ] = GLFW_KEY_KP_MULTIPLY;
|
Keys[k_DecScndCtrl] = GLFW_KEY_KP_MULTIPLY;
|
||||||
|
Keys[k_DecScndCtrlFAST] = GLFW_KEY_KP_MULTIPLY;
|
||||||
|
|
||||||
Keys[ k_IncLocalBrakeLevel ] = GLFW_KEY_KP_1;
|
Keys[k_IncLocalBrakeLevel] = GLFW_KEY_KP_1;
|
||||||
Keys[ k_DecLocalBrakeLevel ] = GLFW_KEY_KP_7;
|
Keys[k_DecLocalBrakeLevel] = GLFW_KEY_KP_7;
|
||||||
Keys[ k_IncBrakeLevel ] = GLFW_KEY_KP_3;
|
Keys[k_IncBrakeLevel] = GLFW_KEY_KP_3;
|
||||||
Keys[ k_DecBrakeLevel ] = GLFW_KEY_KP_9;
|
Keys[k_DecBrakeLevel] = GLFW_KEY_KP_9;
|
||||||
Keys[ k_Releaser ] = GLFW_KEY_KP_6;
|
Keys[k_Releaser] = GLFW_KEY_KP_6;
|
||||||
Keys[ k_EmergencyBrake ] = GLFW_KEY_KP_0;
|
Keys[k_EmergencyBrake] = GLFW_KEY_KP_0;
|
||||||
Keys[ k_Brake3 ] = GLFW_KEY_KP_8;
|
Keys[k_Brake3] = GLFW_KEY_KP_8;
|
||||||
Keys[ k_Brake2 ] = GLFW_KEY_KP_5;
|
Keys[k_Brake2] = GLFW_KEY_KP_5;
|
||||||
Keys[ k_Brake1 ] = GLFW_KEY_KP_2;
|
Keys[k_Brake1] = GLFW_KEY_KP_2;
|
||||||
Keys[ k_Brake0 ] = GLFW_KEY_KP_4;
|
Keys[k_Brake0] = GLFW_KEY_KP_4;
|
||||||
Keys[ k_WaveBrake ] = GLFW_KEY_KP_DECIMAL;
|
Keys[k_WaveBrake] = GLFW_KEY_KP_DECIMAL;
|
||||||
|
|
||||||
Keys[ k_AntiSlipping ] = GLFW_KEY_KP_ENTER;
|
Keys[k_AntiSlipping] = GLFW_KEY_KP_ENTER;
|
||||||
Keys[ k_Sand ] = 'S';
|
Keys[k_Sand] = 'S';
|
||||||
Keys[ k_Main ] = 'M';
|
Keys[k_Main] = 'M';
|
||||||
Keys[ k_Active ] = 'W';
|
Keys[k_Active] = 'W';
|
||||||
Keys[ k_Battery ] = 'J';
|
Keys[k_Battery] = 'J';
|
||||||
Keys[ k_DirectionForward ] = 'D';
|
Keys[k_DirectionForward] = 'D';
|
||||||
Keys[ k_DirectionBackward ] = 'R';
|
Keys[k_DirectionBackward] = 'R';
|
||||||
Keys[ k_Fuse ] = 'N';
|
Keys[k_Fuse] = 'N';
|
||||||
Keys[ k_Compressor ] = 'C';
|
Keys[k_Compressor] = 'C';
|
||||||
Keys[ k_Converter ] = 'X';
|
Keys[k_Converter] = 'X';
|
||||||
Keys[ k_MaxCurrent ] = 'F';
|
Keys[k_MaxCurrent] = 'F';
|
||||||
Keys[ k_CurrentAutoRelay ] = 'G';
|
Keys[k_CurrentAutoRelay] = 'G';
|
||||||
Keys[ k_BrakeProfile ] = 'B';
|
Keys[k_BrakeProfile] = 'B';
|
||||||
Keys[ k_CurrentNext ] = 'Z';
|
Keys[k_CurrentNext] = 'Z';
|
||||||
|
|
||||||
Keys[ k_Czuwak ] = ' ';
|
Keys[k_Czuwak] = ' ';
|
||||||
Keys[ k_Horn ] = 'A';
|
Keys[k_Horn] = 'A';
|
||||||
Keys[ k_Horn2 ] = 'A';
|
Keys[k_Horn2] = 'A';
|
||||||
|
|
||||||
Keys[ k_FailedEngineCutOff ] = 'E';
|
Keys[k_FailedEngineCutOff] = 'E';
|
||||||
|
|
||||||
Keys[ k_MechUp ] = GLFW_KEY_PAGE_UP;
|
Keys[k_MechUp] = GLFW_KEY_PAGE_UP;
|
||||||
Keys[ k_MechDown ] = GLFW_KEY_PAGE_DOWN;
|
Keys[k_MechDown] = GLFW_KEY_PAGE_DOWN;
|
||||||
Keys[ k_MechLeft ] = GLFW_KEY_LEFT;
|
Keys[k_MechLeft] = GLFW_KEY_LEFT;
|
||||||
Keys[ k_MechRight ] = GLFW_KEY_RIGHT;
|
Keys[k_MechRight] = GLFW_KEY_RIGHT;
|
||||||
Keys[ k_MechForward ] = GLFW_KEY_UP;
|
Keys[k_MechForward] = GLFW_KEY_UP;
|
||||||
Keys[ k_MechBackward ] = GLFW_KEY_DOWN;
|
Keys[k_MechBackward] = GLFW_KEY_DOWN;
|
||||||
|
|
||||||
Keys[ k_CabForward ] = GLFW_KEY_HOME;
|
Keys[k_CabForward] = GLFW_KEY_HOME;
|
||||||
Keys[ k_CabBackward ] = GLFW_KEY_END;
|
Keys[k_CabBackward] = GLFW_KEY_END;
|
||||||
|
|
||||||
Keys[ k_Couple ] = GLFW_KEY_INSERT;
|
Keys[k_Couple] = GLFW_KEY_INSERT;
|
||||||
Keys[ k_DeCouple ] = GLFW_KEY_DELETE;
|
Keys[k_DeCouple] = GLFW_KEY_DELETE;
|
||||||
|
|
||||||
Keys[ k_ProgramQuit ] = GLFW_KEY_F10;
|
Keys[k_ProgramQuit] = GLFW_KEY_F10;
|
||||||
Keys[ k_ProgramHelp ] = GLFW_KEY_F1;
|
Keys[k_ProgramHelp] = GLFW_KEY_F1;
|
||||||
Keys[ k_WalkMode ] = GLFW_KEY_F5;
|
Keys[k_WalkMode] = GLFW_KEY_F5;
|
||||||
|
|
||||||
Keys[ k_OpenLeft ] = ',';
|
Keys[k_OpenLeft] = ',';
|
||||||
Keys[ k_OpenRight ] = '.';
|
Keys[k_OpenRight] = '.';
|
||||||
Keys[ k_CloseLeft ] = ',';
|
Keys[k_CloseLeft] = ',';
|
||||||
Keys[ k_CloseRight ] = '.';
|
Keys[k_CloseRight] = '.';
|
||||||
Keys[ k_DepartureSignal ] = '/';
|
Keys[k_DepartureSignal] = '/';
|
||||||
|
|
||||||
// Winger 160204 - obsluga pantografow
|
// Winger 160204 - obsluga pantografow
|
||||||
Keys[ k_PantFrontUp ] = 'P'; // Ra: zamieniony przedni z tylnym
|
Keys[k_PantFrontUp] = 'P'; // Ra: zamieniony przedni z tylnym
|
||||||
Keys[ k_PantFrontDown ] = 'P';
|
Keys[k_PantFrontDown] = 'P';
|
||||||
Keys[ k_PantRearUp ] = 'O';
|
Keys[k_PantRearUp] = 'O';
|
||||||
Keys[ k_PantRearDown ] = 'O';
|
Keys[k_PantRearDown] = 'O';
|
||||||
// Winger 020304 - ogrzewanie
|
// Winger 020304 - ogrzewanie
|
||||||
Keys[ k_Heating ] = 'H';
|
Keys[k_Heating] = 'H';
|
||||||
Keys[ k_LeftSign ] = 'Y';
|
Keys[k_LeftSign] = 'Y';
|
||||||
Keys[ k_UpperSign ] = 'U';
|
Keys[k_UpperSign] = 'U';
|
||||||
Keys[ k_RightSign ] = 'I';
|
Keys[k_RightSign] = 'I';
|
||||||
Keys[ k_EndSign ] = 'T';
|
Keys[k_EndSign] = 'T';
|
||||||
|
|
||||||
Keys[ k_SmallCompressor ] = 'V';
|
Keys[k_SmallCompressor] = 'V';
|
||||||
Keys[ k_StLinOff ] = 'L';
|
Keys[k_StLinOff] = 'L';
|
||||||
// ABu 090305 - przyciski uniwersalne, do roznych bajerow :)
|
// ABu 090305 - przyciski uniwersalne, do roznych bajerow :)
|
||||||
Keys[ k_Univ1 ] = '[';
|
Keys[k_Univ1] = '[';
|
||||||
Keys[ k_Univ2 ] = ']';
|
Keys[k_Univ2] = ']';
|
||||||
Keys[ k_Univ3 ] = ';';
|
Keys[k_Univ3] = ';';
|
||||||
Keys[ k_Univ4 ] = '\'';
|
Keys[k_Univ4] = '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "gl/glew.h"
|
|
||||||
#include "glfw/glfw3.h"
|
#include "glfw/glfw3.h"
|
||||||
|
#include "gl/glew.h"
|
||||||
#include "dumb3d.h"
|
#include "dumb3d.h"
|
||||||
|
|
||||||
// definicje klawiszy
|
// definicje klawiszy
|
||||||
|
|||||||
111
Ground.cpp
111
Ground.cpp
@@ -206,8 +206,14 @@ void TGroundNode::InitNormals()
|
|||||||
}
|
}
|
||||||
if (Vertices[i].Normal == vector3(0, 0, 0))
|
if (Vertices[i].Normal == vector3(0, 0, 0))
|
||||||
Vertices[i].Normal = (n1 + n2) / 2;
|
Vertices[i].Normal = (n1 + n2) / 2;
|
||||||
|
if (i + 1 < iNumVerts)
|
||||||
|
{
|
||||||
if (Vertices[i + 1].Normal == vector3(0, 0, 0))
|
if (Vertices[i + 1].Normal == vector3(0, 0, 0))
|
||||||
Vertices[i + 1].Normal = n2;
|
Vertices[i + 1].Normal = n2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
WriteLog("odd number of vertices, normals may be wrong!");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GL_TRIANGLE_FAN:
|
case GL_TRIANGLE_FAN:
|
||||||
|
|
||||||
@@ -289,7 +295,6 @@ void TGroundNode::RenderVBO()
|
|||||||
(iType != TP_EVLAUNCH)) // McZapkie-070602: nie rysuj odleglych obiektow ale sprawdzaj
|
(iType != TP_EVLAUNCH)) // McZapkie-070602: nie rysuj odleglych obiektow ale sprawdzaj
|
||||||
// wyzwalacz zdarzen
|
// wyzwalacz zdarzen
|
||||||
return;
|
return;
|
||||||
int i, a;
|
|
||||||
switch (iType)
|
switch (iType)
|
||||||
{
|
{
|
||||||
case TP_TRACTION:
|
case TP_TRACTION:
|
||||||
@@ -359,12 +364,11 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
return;
|
return;
|
||||||
if (mgn > fSquareRadius)
|
if (mgn > fSquareRadius)
|
||||||
return;
|
return;
|
||||||
int i, a;
|
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
||||||
{
|
{
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
switch (iType)
|
switch (iType)
|
||||||
@@ -374,7 +378,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
{
|
{
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
#endif
|
#endif
|
||||||
hvTraction->RenderVBO(mgn, iVboPtr);
|
hvTraction->RenderVBO(mgn, iVboPtr);
|
||||||
@@ -383,7 +387,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
case TP_MODEL:
|
case TP_MODEL:
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
#endif
|
#endif
|
||||||
Model->RenderAlphaVBO(&pCenter);
|
Model->RenderAlphaVBO(&pCenter);
|
||||||
@@ -411,13 +415,13 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
// glEnable(GL_LIGHTING);
|
// glEnable(GL_LIGHTING);
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
@@ -427,7 +431,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
RaRenderVBO();
|
RaRenderVBO();
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
@@ -435,7 +439,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
}
|
}
|
||||||
#ifdef _PROBLEND
|
#ifdef _PROBLEND
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
@@ -574,7 +578,6 @@ void TGroundNode::RenderDL()
|
|||||||
// obiektow ale sprawdzaj wyzwalacz
|
// obiektow ale sprawdzaj wyzwalacz
|
||||||
// zdarzen
|
// zdarzen
|
||||||
return;
|
return;
|
||||||
int i, a;
|
|
||||||
switch (iType)
|
switch (iType)
|
||||||
{
|
{
|
||||||
case TP_TRACK:
|
case TP_TRACK:
|
||||||
@@ -641,7 +644,6 @@ void TGroundNode::RenderAlphaDL()
|
|||||||
return;
|
return;
|
||||||
if (mgn > fSquareRadius)
|
if (mgn > fSquareRadius)
|
||||||
return;
|
return;
|
||||||
int i, a;
|
|
||||||
switch (iType)
|
switch (iType)
|
||||||
{
|
{
|
||||||
case TP_TRACTION:
|
case TP_TRACTION:
|
||||||
@@ -663,7 +665,7 @@ void TGroundNode::RenderAlphaDL()
|
|||||||
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
||||||
{
|
{
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
if (!DisplayListID) //||Global::bReCompile) //Ra: wymuszenie rekompilacji
|
if (!DisplayListID) //||Global::bReCompile) //Ra: wymuszenie rekompilacji
|
||||||
@@ -700,7 +702,7 @@ void TGroundNode::RenderAlphaDL()
|
|||||||
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
||||||
{
|
{
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04);
|
glAlphaFunc(GL_GREATER, 0.04f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -969,7 +971,7 @@ void TSubRect::Sort()
|
|||||||
*/
|
*/
|
||||||
//...
|
//...
|
||||||
// przeglądanie listy i tworzenie obiektów renderujących dla danej tekstury
|
// przeglądanie listy i tworzenie obiektów renderujących dla danej tekstury
|
||||||
GLuint t = 0; // pomocniczy kod tekstury
|
int t = 0; // pomocniczy kod tekstury
|
||||||
n1 = nMeshed; // lista obiektów przetwarzanych na statyczne siatki
|
n1 = nMeshed; // lista obiektów przetwarzanych na statyczne siatki
|
||||||
while (n1)
|
while (n1)
|
||||||
{ // dla każdej tekstury powinny istnieć co najmniej dwa obiekty, ale dla DL nie ma to znaczenia
|
{ // dla każdej tekstury powinny istnieć co najmniej dwa obiekty, ale dla DL nie ma to znaczenia
|
||||||
@@ -994,7 +996,6 @@ void TSubRect::Sort()
|
|||||||
|
|
||||||
TTrack * TSubRect::FindTrack(vector3 *Point, int &iConnection, TTrack *Exclude)
|
TTrack * TSubRect::FindTrack(vector3 *Point, int &iConnection, TTrack *Exclude)
|
||||||
{ // szukanie toru, którego koniec jest najbliższy (*Point)
|
{ // szukanie toru, którego koniec jest najbliższy (*Point)
|
||||||
TTrack *Track;
|
|
||||||
for (int i = 0; i < iTracks; ++i)
|
for (int i = 0; i < iTracks; ++i)
|
||||||
if (tTracks[i] != Exclude) // można użyć tabelę torów, bo jest mniejsza
|
if (tTracks[i] != Exclude) // można użyć tabelę torów, bo jest mniejsza
|
||||||
{
|
{
|
||||||
@@ -1031,7 +1032,7 @@ void TSubRect::RaAnimate()
|
|||||||
return; // nie ma nic do animowania
|
return; // nie ma nic do animowania
|
||||||
if (Global::bUseVBO)
|
if (Global::bUseVBO)
|
||||||
{ // odświeżenie VBO sektora
|
{ // odświeżenie VBO sektora
|
||||||
if (true == GLEW_VERSION_1_5) // modyfikacje VBO są dostępne od OpenGL 1.5
|
if (GLEW_VERSION_1_5) // modyfikacje VBO są dostępne od OpenGL 1.5
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_nVBOVertices);
|
glBindBuffer(GL_ARRAY_BUFFER, m_nVBOVertices);
|
||||||
else // dla OpenGL 1.4 z GL_ARB_vertex_buffer_object odświeżenie całego sektora
|
else // dla OpenGL 1.4 z GL_ARB_vertex_buffer_object odświeżenie całego sektora
|
||||||
Release(); // opróżnienie VBO sektora, aby się odświeżył z nowymi ustawieniami
|
Release(); // opróżnienie VBO sektora, aby się odświeżył z nowymi ustawieniami
|
||||||
@@ -1592,16 +1593,15 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
|||||||
{ // wczytanie wpisu typu "node"
|
{ // wczytanie wpisu typu "node"
|
||||||
// parser->LoadTraction=Global::bLoadTraction; //Ra: tu nie potrzeba powtarzać
|
// parser->LoadTraction=Global::bLoadTraction; //Ra: tu nie potrzeba powtarzać
|
||||||
string str, str1, str2, str3, str4, Skin, DriverType, asNodeName;
|
string str, str1, str2, str3, str4, Skin, DriverType, asNodeName;
|
||||||
int nv, ti, i, n;
|
int nv, i;
|
||||||
double tf, r, rmin, tf1, tf2, tf3, tf4, l, dist, mgn;
|
double tf, r, rmin, tf1, tf3;
|
||||||
int int1, int2;
|
int int1;
|
||||||
bool bError = false, curve;
|
size_t int2;
|
||||||
|
bool bError = false;
|
||||||
vector3 pt, front, up, left, pos, tv;
|
vector3 pt, front, up, left, pos, tv;
|
||||||
matrix4x4 mat2, mat1, mat;
|
matrix4x4 mat2, mat1, mat;
|
||||||
GLuint TexID;
|
|
||||||
TGroundNode *tmp1;
|
TGroundNode *tmp1;
|
||||||
TTrack *Track;
|
TTrack *Track;
|
||||||
TTextSound *tmpsound;
|
|
||||||
std::string token;
|
std::string token;
|
||||||
parser->getTokens(2);
|
parser->getTokens(2);
|
||||||
*parser >> r >> rmin;
|
*parser >> r >> rmin;
|
||||||
@@ -1612,7 +1612,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
|||||||
*parser >> token;
|
*parser >> token;
|
||||||
str = token;
|
str = token;
|
||||||
//str = AnsiString(token.c_str());
|
//str = AnsiString(token.c_str());
|
||||||
TGroundNode *tmp, *tmp2;
|
TGroundNode *tmp;
|
||||||
tmp = new TGroundNode();
|
tmp = new TGroundNode();
|
||||||
tmp->asName = (asNodeName == "none" ? string("") : asNodeName);
|
tmp->asName = (asNodeName == "none" ? string("") : asNodeName);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
@@ -1674,10 +1674,10 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
|||||||
parser->getTokens(3);
|
parser->getTokens(3);
|
||||||
*parser >> tmp->hvTraction->NominalVoltage >> tmp->hvTraction->MaxCurrent >>
|
*parser >> tmp->hvTraction->NominalVoltage >> tmp->hvTraction->MaxCurrent >>
|
||||||
tmp->hvTraction->fResistivity;
|
tmp->hvTraction->fResistivity;
|
||||||
if (tmp->hvTraction->fResistivity == 0.01) // tyle jest w sceneriach [om/km]
|
if (tmp->hvTraction->fResistivity == 0.01f) // tyle jest w sceneriach [om/km]
|
||||||
tmp->hvTraction->fResistivity = 0.075; // taka sensowniejsza wartość za
|
tmp->hvTraction->fResistivity = 0.075f; // taka sensowniejsza wartość za
|
||||||
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
// http://www.ikolej.pl/fileadmin/user_upload/Seminaria_IK/13_05_07_Prezentacja_Kruczek.pdf
|
||||||
tmp->hvTraction->fResistivity *= 0.001; // teraz [om/m]
|
tmp->hvTraction->fResistivity *= 0.001f; // teraz [om/m]
|
||||||
parser->getTokens();
|
parser->getTokens();
|
||||||
*parser >> token;
|
*parser >> token;
|
||||||
// Ra 2014-02: a tutaj damy symbol sieci i jej budowę, np.:
|
// Ra 2014-02: a tutaj damy symbol sieci i jej budowę, np.:
|
||||||
@@ -1830,7 +1830,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
|||||||
*parser >> token;
|
*parser >> token;
|
||||||
str = token;
|
str = token;
|
||||||
//str = AnsiString(token.c_str());
|
//str = AnsiString(token.c_str());
|
||||||
tmp->tsStaticSound = new TTextSound(str, sqrt(tmp->fSquareRadius), tmp->pCenter.x, tmp->pCenter.y, tmp->pCenter.z, false, rmin);
|
tmp->tsStaticSound = new TTextSound(str, sqrt(tmp->fSquareRadius), tmp->pCenter.x, tmp->pCenter.y, tmp->pCenter.z, false, false, rmin);
|
||||||
if (rmin < 0.0)
|
if (rmin < 0.0)
|
||||||
rmin =
|
rmin =
|
||||||
0.0; // przywrócenie poprawnej wartości, jeśli służyła do wyłączenia efektu Dopplera
|
0.0; // przywrócenie poprawnej wartości, jeśli służyła do wyłączenia efektu Dopplera
|
||||||
@@ -1860,7 +1860,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
|||||||
int2 = str4.find("."); // yB: wykorzystuje tutaj zmienna, ktora potem bedzie ladunkiem
|
int2 = str4.find("."); // yB: wykorzystuje tutaj zmienna, ktora potem bedzie ladunkiem
|
||||||
if (int2 != string::npos) // yB: jesli znalazl kropke, to ja przetwarza jako parametry
|
if (int2 != string::npos) // yB: jesli znalazl kropke, to ja przetwarza jako parametry
|
||||||
{
|
{
|
||||||
int dlugosc = str4.length();
|
size_t dlugosc = str4.length();
|
||||||
int1 = atoi(str4.substr(0, int2).c_str()); // niech sprzegiem bedzie do kropki cos
|
int1 = atoi(str4.substr(0, int2).c_str()); // niech sprzegiem bedzie do kropki cos
|
||||||
str4 = str4.substr(int2 + 1, dlugosc - int2);
|
str4 = str4.substr(int2 + 1, dlugosc - int2);
|
||||||
}
|
}
|
||||||
@@ -2243,7 +2243,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
|||||||
/*
|
/*
|
||||||
nv = i;
|
nv = i;
|
||||||
*/
|
*/
|
||||||
nv = TempVerts.size();
|
nv = (int)TempVerts.size();
|
||||||
tmp->Init(nv); // utworzenie tablicy wierzchołków
|
tmp->Init(nv); // utworzenie tablicy wierzchołków
|
||||||
tmp->pCenter /= (nv > 0 ? nv : 1);
|
tmp->pCenter /= (nv > 0 ? nv : 1);
|
||||||
|
|
||||||
@@ -2544,9 +2544,6 @@ bool TGround::Init(std::string File)
|
|||||||
int OriginStackTop = 0;
|
int OriginStackTop = 0;
|
||||||
vector3 OriginStack[OriginStackMaxDepth]; // stos zagnieżdżenia origin
|
vector3 OriginStack[OriginStackMaxDepth]; // stos zagnieżdżenia origin
|
||||||
|
|
||||||
double tf;
|
|
||||||
int ParamCount, ParamPos;
|
|
||||||
|
|
||||||
// ABu: Jezeli nie ma definicji w scenerii to ustawiane ponizsze wartosci:
|
// ABu: Jezeli nie ma definicji w scenerii to ustawiane ponizsze wartosci:
|
||||||
hh = 10; // godzina startu
|
hh = 10; // godzina startu
|
||||||
mm = 30; // minuty startu
|
mm = 30; // minuty startu
|
||||||
@@ -3351,7 +3348,7 @@ void TGround::InitTracks()
|
|||||||
TGroundNode *Current, *Model;
|
TGroundNode *Current, *Model;
|
||||||
TTrack *tmp; // znaleziony tor
|
TTrack *tmp; // znaleziony tor
|
||||||
TTrack *Track;
|
TTrack *Track;
|
||||||
int iConnection, state;
|
int iConnection;
|
||||||
string name;
|
string name;
|
||||||
// tracks=tracksfar=0;
|
// tracks=tracksfar=0;
|
||||||
for (Current = nRootOfType[TP_TRACK]; Current; Current = Current->nNext)
|
for (Current = nRootOfType[TP_TRACK]; Current; Current = Current->nNext)
|
||||||
@@ -3770,7 +3767,7 @@ bool TGround::InitLaunchers()
|
|||||||
{
|
{
|
||||||
TGroundNode *Current, *tmp;
|
TGroundNode *Current, *tmp;
|
||||||
TEventLauncher *EventLauncher;
|
TEventLauncher *EventLauncher;
|
||||||
int i;
|
|
||||||
for (Current = nRootOfType[TP_EVLAUNCH]; Current; Current = Current->nNext)
|
for (Current = nRootOfType[TP_EVLAUNCH]; Current; Current = Current->nNext)
|
||||||
{
|
{
|
||||||
EventLauncher = Current->EvLaunch;
|
EventLauncher = Current->EvLaunch;
|
||||||
@@ -3797,8 +3794,6 @@ bool TGround::InitLaunchers()
|
|||||||
|
|
||||||
TTrack * TGround::FindTrack(vector3 Point, int &iConnection, TGroundNode *Exclude)
|
TTrack * TGround::FindTrack(vector3 Point, int &iConnection, TGroundNode *Exclude)
|
||||||
{ // wyszukiwanie innego toru kończącego się w (Point)
|
{ // wyszukiwanie innego toru kończącego się w (Point)
|
||||||
TTrack *Track;
|
|
||||||
TGroundNode *Current;
|
|
||||||
TTrack *tmp;
|
TTrack *tmp;
|
||||||
iConnection = -1;
|
iConnection = -1;
|
||||||
TSubRect *sr;
|
TSubRect *sr;
|
||||||
@@ -3845,8 +3840,6 @@ TTrack * TGround::FindTrack(vector3 Point, int &iConnection, TGroundNode *Exclud
|
|||||||
|
|
||||||
TTraction * TGround::FindTraction(vector3 *Point, int &iConnection, TGroundNode *Exclude)
|
TTraction * TGround::FindTraction(vector3 *Point, int &iConnection, TGroundNode *Exclude)
|
||||||
{ // wyszukiwanie innego przęsła kończącego się w (Point)
|
{ // wyszukiwanie innego przęsła kończącego się w (Point)
|
||||||
TTraction *Traction;
|
|
||||||
TGroundNode *Current;
|
|
||||||
TTraction *tmp;
|
TTraction *tmp;
|
||||||
iConnection = -1;
|
iConnection = -1;
|
||||||
TSubRect *sr;
|
TSubRect *sr;
|
||||||
@@ -4314,7 +4307,7 @@ bool TGround::CheckQuery()
|
|||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
{ // dodawane do kolejki w kolejności zapisania
|
{ // dodawane do kolejki w kolejności zapisania
|
||||||
if (tmpEvent->Params[i].asEvent)
|
if (tmpEvent->Params[i].asEvent)
|
||||||
if (bCondition != bool(tmpEvent->iFlags & (conditional_else << i)))
|
if (bCondition != (((tmpEvent->iFlags & (conditional_else << i)) != 0)))
|
||||||
{
|
{
|
||||||
if (tmpEvent->Params[i].asEvent != tmpEvent)
|
if (tmpEvent->Params[i].asEvent != tmpEvent)
|
||||||
AddToQuery(tmpEvent->Params[i].asEvent,
|
AddToQuery(tmpEvent->Params[i].asEvent,
|
||||||
@@ -4856,11 +4849,10 @@ TGround::Render( Math3D::vector3 const &Camera ) {
|
|||||||
bool TGround::RenderDL(vector3 pPosition)
|
bool TGround::RenderDL(vector3 pPosition)
|
||||||
{ // renderowanie scenerii z Display List - faza nieprzezroczystych
|
{ // renderowanie scenerii z Display List - faza nieprzezroczystych
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek (do usuwniania nadanimacji)
|
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek (do usuwniania nadanimacji)
|
||||||
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
||||||
CameraDirection.z = cos(Global::pCameraRotation);
|
CameraDirection.z = cos(Global::pCameraRotation);
|
||||||
int tr, tc;
|
|
||||||
TGroundNode *node;
|
TGroundNode *node;
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
@@ -4917,7 +4909,7 @@ bool TGround::RenderDL(vector3 pPosition)
|
|||||||
bool TGround::RenderAlphaDL(vector3 pPosition)
|
bool TGround::RenderAlphaDL(vector3 pPosition)
|
||||||
{ // renderowanie scenerii z Display List - faza przezroczystych
|
{ // renderowanie scenerii z Display List - faza przezroczystych
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.04f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
TGroundNode *node;
|
TGroundNode *node;
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
TSubRect *tmp;
|
TSubRect *tmp;
|
||||||
@@ -4946,11 +4938,10 @@ bool TGround::RenderAlphaDL(vector3 pPosition)
|
|||||||
bool TGround::RenderVBO(vector3 pPosition)
|
bool TGround::RenderVBO(vector3 pPosition)
|
||||||
{ // renderowanie scenerii z VBO - faza nieprzezroczystych
|
{ // renderowanie scenerii z VBO - faza nieprzezroczystych
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek
|
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek
|
||||||
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
||||||
CameraDirection.z = cos(Global::pCameraRotation);
|
CameraDirection.z = cos(Global::pCameraRotation);
|
||||||
int tr, tc;
|
|
||||||
TGroundNode *node;
|
TGroundNode *node;
|
||||||
glColor3f(1.0f, 1.0f, 1.0f);
|
glColor3f(1.0f, 1.0f, 1.0f);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
@@ -5014,7 +5005,7 @@ bool TGround::RenderVBO(vector3 pPosition)
|
|||||||
bool TGround::RenderAlphaVBO(vector3 pPosition)
|
bool TGround::RenderAlphaVBO(vector3 pPosition)
|
||||||
{ // renderowanie scenerii z VBO - faza przezroczystych
|
{ // renderowanie scenerii z VBO - faza przezroczystych
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.04); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.04f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
TGroundNode *node;
|
TGroundNode *node;
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
TSubRect *tmp;
|
TSubRect *tmp;
|
||||||
@@ -5062,14 +5053,14 @@ void TGround::WyslijEvent(const std::string &e, const std::string &d)
|
|||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
||||||
r.iComm = 2; // 2 - event
|
r.iComm = 2; // 2 - event
|
||||||
int i = e.length(), j = d.length();
|
size_t i = e.length(), j = d.length();
|
||||||
r.cString[0] = char(i);
|
r.cString[0] = char(i);
|
||||||
strcpy(r.cString + 1, e.c_str()); // zakończony zerem
|
strcpy(r.cString + 1, e.c_str()); // zakończony zerem
|
||||||
r.cString[i + 2] = char(j); // licznik po zerze kończącym
|
r.cString[i + 2] = char(j); // licznik po zerze kończącym
|
||||||
strcpy(r.cString + 3 + i, d.c_str()); // zakończony zerem
|
strcpy(r.cString + 3 + i, d.c_str()); // zakończony zerem
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
||||||
cData.cbData = 12 + i + j; // 8+dwa liczniki i dwa zera kończące
|
cData.cbData = (DWORD)(12 + i + j); // 8+dwa liczniki i dwa zera kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + e + " sent" );
|
CommLog( Now() + " " + std::to_string(r.iComm) + " " + e + " sent" );
|
||||||
@@ -5080,13 +5071,13 @@ void TGround::WyslijUszkodzenia(const std::string &t, char fl)
|
|||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
||||||
r.iComm = 13; // numer komunikatu
|
r.iComm = 13; // numer komunikatu
|
||||||
int i = t.length();
|
size_t i = t.length();
|
||||||
r.cString[0] = char(fl);
|
r.cString[0] = char(fl);
|
||||||
r.cString[1] = char(i);
|
r.cString[1] = char(i);
|
||||||
strcpy(r.cString + 2, t.c_str()); // z zerem kończącym
|
strcpy(r.cString + 2, t.c_str()); // z zerem kończącym
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
||||||
cData.cbData = 11 + i; // 8+licznik i zero kończące
|
cData.cbData = (DWORD)(11 + i); // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
|
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
|
||||||
@@ -5097,12 +5088,12 @@ void TGround::WyslijString(const std::string &t, int n)
|
|||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
||||||
r.iComm = n; // numer komunikatu
|
r.iComm = n; // numer komunikatu
|
||||||
int i = t.length();
|
size_t i = t.length();
|
||||||
r.cString[0] = char(i);
|
r.cString[0] = char(i);
|
||||||
strcpy(r.cString + 1, t.c_str()); // z zerem kończącym
|
strcpy(r.cString + 1, t.c_str()); // z zerem kończącym
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = 'EU07'; // sygnatura
|
||||||
cData.cbData = 10 + i; // 8+licznik i zero kończące
|
cData.cbData = (DWORD)(10 + i); // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||||
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
|
CommLog( Now() + " " + std::to_string(r.iComm) + " " + t + " sent");
|
||||||
@@ -5119,7 +5110,8 @@ void TGround::WyslijNamiary(TGroundNode *t)
|
|||||||
DaneRozkaz r;
|
DaneRozkaz r;
|
||||||
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
r.iSygn = MAKE_ID4( 'E', 'U', '0', '7' );
|
||||||
r.iComm = 7; // 7 - dane pojazdu
|
r.iComm = 7; // 7 - dane pojazdu
|
||||||
int i = 32, j = t->asName.length();
|
int i = 32;
|
||||||
|
size_t j = t->asName.length();
|
||||||
r.iPar[0] = i; // ilość danych liczbowych
|
r.iPar[0] = i; // ilość danych liczbowych
|
||||||
r.fPar[1] = Global::fTimeAngleDeg / 360.0; // aktualny czas (1.0=doba)
|
r.fPar[1] = Global::fTimeAngleDeg / 360.0; // aktualny czas (1.0=doba)
|
||||||
r.fPar[2] = t->DynamicObject->MoverParameters->Loc.X; // pozycja X
|
r.fPar[2] = t->DynamicObject->MoverParameters->Loc.X; // pozycja X
|
||||||
@@ -5179,8 +5171,8 @@ void TGround::WyslijNamiary(TGroundNode *t)
|
|||||||
r.cString[i] = char(j); // na końcu nazwa, żeby jakoś zidentyfikować
|
r.cString[i] = char(j); // na końcu nazwa, żeby jakoś zidentyfikować
|
||||||
strcpy(r.cString + i + 1, t->asName.c_str()); // zakończony zerem
|
strcpy(r.cString + i + 1, t->asName.c_str()); // zakończony zerem
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
cData.dwData = MAKE_ID4( 'E', 'U', '0', '7' ); // sygnatura
|
cData.dwData = 'EU07'; // sygnatura
|
||||||
cData.cbData = 10 + i + j; // 8+licznik i zero kończące
|
cData.cbData = (DWORD)(10 + i + j); // 8+licznik i zero kończące
|
||||||
cData.lpData = &r;
|
cData.lpData = &r;
|
||||||
// WriteLog("Ramka gotowa");
|
// WriteLog("Ramka gotowa");
|
||||||
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
Navigate( "TEU07SRK", WM_COPYDATA, (WPARAM)glfwGetWin32Window( Global::window ), (LPARAM)&cData );
|
||||||
@@ -5280,7 +5272,7 @@ TDynamicObject * TGround::DynamicNearest(vector3 pPosition, double distance, boo
|
|||||||
TDynamicObject *dyn = NULL;
|
TDynamicObject *dyn = NULL;
|
||||||
int c = GetColFromX(pPosition.x);
|
int c = GetColFromX(pPosition.x);
|
||||||
int r = GetRowFromZ(pPosition.z);
|
int r = GetRowFromZ(pPosition.z);
|
||||||
int i, j, k;
|
int i, j;
|
||||||
double sqm = distance * distance, sqd; // maksymalny promien poszukiwań do kwadratu
|
double sqm = distance * distance, sqd; // maksymalny promien poszukiwań do kwadratu
|
||||||
for (j = r - 1; j <= r + 1; j++) // plus dwa zewnętrzne sektory, łącznie 9
|
for (j = r - 1; j <= r + 1; j++) // plus dwa zewnętrzne sektory, łącznie 9
|
||||||
for (i = c - 1; i <= c + 1; i++)
|
for (i = c - 1; i <= c + 1; i++)
|
||||||
@@ -5318,7 +5310,7 @@ TDynamicObject * TGround::CouplerNearest(vector3 pPosition, double distance, boo
|
|||||||
TDynamicObject *dyn = NULL;
|
TDynamicObject *dyn = NULL;
|
||||||
int c = GetColFromX(pPosition.x);
|
int c = GetColFromX(pPosition.x);
|
||||||
int r = GetRowFromZ(pPosition.z);
|
int r = GetRowFromZ(pPosition.z);
|
||||||
int i, j, k;
|
int i, j;
|
||||||
double sqm = distance * distance, sqd; // maksymalny promien poszukiwań do kwadratu
|
double sqm = distance * distance, sqd; // maksymalny promien poszukiwań do kwadratu
|
||||||
for (j = r - 1; j <= r + 1; j++) // plus dwa zewnętrzne sektory, łącznie 9
|
for (j = r - 1; j <= r + 1; j++) // plus dwa zewnętrzne sektory, łącznie 9
|
||||||
for (i = c - 1; i <= c + 1; i++)
|
for (i = c - 1; i <= c + 1; i++)
|
||||||
@@ -5418,7 +5410,6 @@ void TGround::TerrainWrite()
|
|||||||
// chyba że dla danej tekstury wychodzi tylko jeden submodel.
|
// chyba że dla danej tekstury wychodzi tylko jeden submodel.
|
||||||
TModel3d *m = new TModel3d(); // wirtualny model roboczy z oddzielnymi submodelami
|
TModel3d *m = new TModel3d(); // wirtualny model roboczy z oddzielnymi submodelami
|
||||||
TSubModel *sk; // wskaźnik roboczy na submodel kwadratu
|
TSubModel *sk; // wskaźnik roboczy na submodel kwadratu
|
||||||
TSubModel *st; // wskaźnik roboczy na submodel tekstury
|
|
||||||
// Zliczamy kwadraty z trójkątami, ilość tekstur oraz wierzchołków.
|
// Zliczamy kwadraty z trójkątami, ilość tekstur oraz wierzchołków.
|
||||||
// Ilość kwadratów i ilość tekstur określi ilość submodeli.
|
// Ilość kwadratów i ilość tekstur określi ilość submodeli.
|
||||||
// int sub=0; //całkowita ilość submodeli
|
// int sub=0; //całkowita ilość submodeli
|
||||||
@@ -5497,7 +5488,6 @@ void TGround::TerrainWrite()
|
|||||||
void TGround::TrackBusyList()
|
void TGround::TrackBusyList()
|
||||||
{ // wysłanie informacji o wszystkich zajętych odcinkach
|
{ // wysłanie informacji o wszystkich zajętych odcinkach
|
||||||
TGroundNode *Current;
|
TGroundNode *Current;
|
||||||
TTrack *Track;
|
|
||||||
for (Current = nRootOfType[TP_TRACK]; Current; Current = Current->nNext)
|
for (Current = nRootOfType[TP_TRACK]; Current; Current = Current->nNext)
|
||||||
if (!Current->asName.empty()) // musi być nazwa
|
if (!Current->asName.empty()) // musi być nazwa
|
||||||
#ifdef EU07_USE_OLD_TTRACK_DYNAMICS_ARRAY
|
#ifdef EU07_USE_OLD_TTRACK_DYNAMICS_ARRAY
|
||||||
@@ -5538,13 +5528,12 @@ void TGround::IsolatedBusy(const std::string t)
|
|||||||
|
|
||||||
void TGround::Silence(vector3 gdzie)
|
void TGround::Silence(vector3 gdzie)
|
||||||
{ // wyciszenie wszystkiego w sektorach przed przeniesieniem kamery z (gdzie)
|
{ // wyciszenie wszystkiego w sektorach przed przeniesieniem kamery z (gdzie)
|
||||||
int tr, tc;
|
|
||||||
TGroundNode *node;
|
TGroundNode *node;
|
||||||
int n = 2 * iNumSubRects; //(2*==2km) promień wyświetlanej mapy w sektorach
|
int n = 2 * iNumSubRects; //(2*==2km) promień wyświetlanej mapy w sektorach
|
||||||
int c = GetColFromX(gdzie.x); // sektory wg dotychczasowej pozycji kamery
|
int c = GetColFromX(gdzie.x); // sektory wg dotychczasowej pozycji kamery
|
||||||
int r = GetRowFromZ(gdzie.z);
|
int r = GetRowFromZ(gdzie.z);
|
||||||
TSubRect *tmp;
|
TSubRect *tmp;
|
||||||
int i, j, k;
|
int i, j;
|
||||||
// renderowanie czołgowe dla obiektów aktywnych a niewidocznych
|
// renderowanie czołgowe dla obiektów aktywnych a niewidocznych
|
||||||
for (j = r - n; j <= r + n; j++)
|
for (j = r - n; j <= r + n; j++)
|
||||||
for (i = c - n; i <= c + n; i++)
|
for (i = c - n; i <= c + n; i++)
|
||||||
|
|||||||
6
Ground.h
6
Ground.h
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "VBO.h"
|
#include "VBO.h"
|
||||||
#include "Classes.h"
|
#include "Classes.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
@@ -398,11 +398,11 @@ class TGround
|
|||||||
TSubRect * FastGetSubRect(int iCol, int iRow);
|
TSubRect * FastGetSubRect(int iCol, int iRow);
|
||||||
int GetRowFromZ(double z)
|
int GetRowFromZ(double z)
|
||||||
{
|
{
|
||||||
return (z / fSubRectSize + fHalfTotalNumSubRects);
|
return (int)(z / fSubRectSize + fHalfTotalNumSubRects);
|
||||||
};
|
};
|
||||||
int GetColFromX(double x)
|
int GetColFromX(double x)
|
||||||
{
|
{
|
||||||
return (x / fSubRectSize + fHalfTotalNumSubRects);
|
return (int)(x / fSubRectSize + fHalfTotalNumSubRects);
|
||||||
};
|
};
|
||||||
TEvent * FindEvent(const std::string &asEventName);
|
TEvent * FindEvent(const std::string &asEventName);
|
||||||
TEvent * FindEventScan(const std::string &asEventName);
|
TEvent * FindEventScan(const std::string &asEventName);
|
||||||
|
|||||||
6
Logs.cpp
6
Logs.cpp
@@ -24,7 +24,7 @@ void WriteConsoleOnly(const char *str, double value)
|
|||||||
sprintf(buf, "%s %f \n", str, value);
|
sprintf(buf, "%s %f \n", str, value);
|
||||||
// stdout= GetStdHandle(STD_OUTPUT_HANDLE);
|
// stdout= GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
DWORD wr = 0;
|
DWORD wr = 0;
|
||||||
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &wr, NULL);
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), buf, (DWORD)strlen(buf), &wr, NULL);
|
||||||
// WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),endstring,strlen(endstring),&wr,NULL);
|
// WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),endstring,strlen(endstring),&wr,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,9 +34,9 @@ void WriteConsoleOnly(const char *str, bool newline)
|
|||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||||
FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
||||||
DWORD wr = 0;
|
DWORD wr = 0;
|
||||||
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str, strlen(str), &wr, NULL);
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str, (DWORD)strlen(str), &wr, NULL);
|
||||||
if (newline)
|
if (newline)
|
||||||
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), endstring, strlen(endstring), &wr, NULL);
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), endstring, (DWORD)strlen(endstring), &wr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteLog(const char *str, double value)
|
void WriteLog(const char *str, double value)
|
||||||
|
|||||||
@@ -5488,7 +5488,7 @@ std::vector<std::string> x;
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160717
|
// Q: 20160717
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
int Pos(std::string str_find, std::string in)
|
size_t Pos(std::string str_find, std::string in)
|
||||||
{
|
{
|
||||||
size_t pos = in.find(str_find);
|
size_t pos = in.find(str_find);
|
||||||
return (pos != std::string::npos ? pos+1 : 0);
|
return (pos != std::string::npos ? pos+1 : 0);
|
||||||
|
|||||||
925
Model3d.cpp
925
Model3d.cpp
File diff suppressed because it is too large
Load Diff
202
Model3d.h
202
Model3d.h
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#ifndef Model3dH
|
#ifndef Model3dH
|
||||||
#define Model3dH
|
#define Model3dH
|
||||||
|
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "Parser.h"
|
#include "Parser.h"
|
||||||
#include "dumb3d.h"
|
#include "dumb3d.h"
|
||||||
#include "Float3d.h"
|
#include "Float3d.h"
|
||||||
@@ -26,41 +26,10 @@ struct GLVERTEX
|
|||||||
float tu, tv;
|
float tu, tv;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TStringPack
|
|
||||||
{
|
|
||||||
char *data;
|
|
||||||
//+0 - 4 bajty: typ kromki
|
|
||||||
//+4 - 4 bajty: długość łącznie z nagłówkiem
|
|
||||||
//+8 - obszar łańcuchów znakowych, każdy zakończony zerem
|
|
||||||
int *index;
|
|
||||||
//+0 - 4 bajty: typ kromki
|
|
||||||
//+4 - 4 bajty: długość łącznie z nagłówkiem
|
|
||||||
//+8 - tabela indeksów
|
|
||||||
public:
|
|
||||||
char *String(int n);
|
|
||||||
char *StringAt(int n)
|
|
||||||
{
|
|
||||||
return data + 9 + n;
|
|
||||||
};
|
|
||||||
TStringPack()
|
|
||||||
{
|
|
||||||
data = NULL;
|
|
||||||
index = NULL;
|
|
||||||
};
|
|
||||||
void Init(char *d)
|
|
||||||
{
|
|
||||||
data = d;
|
|
||||||
};
|
|
||||||
void InitIndex(int *i)
|
|
||||||
{
|
|
||||||
index = i;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class TMaterialColor
|
class TMaterialColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TMaterialColor(){};
|
TMaterialColor() {};
|
||||||
TMaterialColor(char V)
|
TMaterialColor(char V)
|
||||||
{
|
{
|
||||||
r = g = b = V;
|
r = g = b = V;
|
||||||
@@ -79,51 +48,51 @@ class TMaterialColor
|
|||||||
/*
|
/*
|
||||||
struct TMaterial
|
struct TMaterial
|
||||||
{
|
{
|
||||||
int ID;
|
int ID;
|
||||||
AnsiString Name;
|
AnsiString Name;
|
||||||
//McZapkie-240702: lepiej uzywac wartosci float do opisu koloru bo funkcje opengl chyba tego na ogol
|
//McZapkie-240702: lepiej uzywac wartosci float do opisu koloru bo funkcje opengl chyba tego na ogol
|
||||||
uzywaja
|
uzywaja
|
||||||
float Ambient[4];
|
float Ambient[4];
|
||||||
float Diffuse[4];
|
float Diffuse[4];
|
||||||
float Specular[4];
|
float Specular[4];
|
||||||
float Transparency;
|
float Transparency;
|
||||||
GLuint TextureID;
|
GLuint TextureID;
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
struct THitBoxContainer
|
struct THitBoxContainer
|
||||||
{
|
{
|
||||||
TPlane Planes[6];
|
TPlane Planes[6];
|
||||||
int Index;
|
int Index;
|
||||||
inline void Reset() { Planes[0]= TPlane(vector3(0,0,0),0.0f); };
|
inline void Reset() { Planes[0]= TPlane(vector3(0,0,0),0.0f); };
|
||||||
inline bool Inside(vector3 Point)
|
inline bool Inside(vector3 Point)
|
||||||
{
|
{
|
||||||
bool Hit= true;
|
bool Hit= true;
|
||||||
|
|
||||||
if (Planes[0].Defined())
|
if (Planes[0].Defined())
|
||||||
for (int i=0; i<6; i++)
|
for (int i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
if (Planes[i].GetSide(Point)>0)
|
if (Planes[i].GetSide(Point)>0)
|
||||||
{
|
{
|
||||||
Hit= false;
|
Hit= false;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
else return(false);
|
else return(false);
|
||||||
return(Hit);
|
return(Hit);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Ra: tego nie będziemy już używać, bo można wycisnąć więcej
|
/* Ra: tego nie będziemy już używać, bo można wycisnąć więcej
|
||||||
typedef enum
|
typedef enum
|
||||||
{smt_Unknown, //nieznany
|
{smt_Unknown, //nieznany
|
||||||
smt_Mesh, //siatka
|
smt_Mesh, //siatka
|
||||||
smt_Point,
|
smt_Point,
|
||||||
smt_FreeSpotLight, //punkt świetlny
|
smt_FreeSpotLight, //punkt świetlny
|
||||||
smt_Text, //generator tekstu
|
smt_Text, //generator tekstu
|
||||||
smt_Stars //wiele punktów świetlnych
|
smt_Stars //wiele punktów świetlnych
|
||||||
} TSubModelType;
|
} TSubModelType;
|
||||||
*/
|
*/
|
||||||
// Ra: specjalne typy submodeli, poza tym GL_TRIANGLES itp.
|
// Ra: specjalne typy submodeli, poza tym GL_TRIANGLES itp.
|
||||||
@@ -159,21 +128,19 @@ enum TAnimType // rodzaj animacji
|
|||||||
};
|
};
|
||||||
|
|
||||||
class TModel3d;
|
class TModel3d;
|
||||||
class TSubModelInfo;
|
|
||||||
|
|
||||||
class TSubModel
|
class TSubModel
|
||||||
{ // klasa submodelu - pojedyncza siatka, punkt świetlny albo grupa punktów
|
{ // klasa submodelu - pojedyncza siatka, punkt świetlny albo grupa punktów
|
||||||
// Ra: ta klasa ma mieć wielkość 256 bajtów, aby pokryła się z formatem binarnym
|
//m7todo: zrobić normalną serializację
|
||||||
// Ra: nie przestawiać zmiennych, bo wczytują się z pliku binarnego!
|
private:
|
||||||
private:
|
int iNext;
|
||||||
TSubModel *Next;
|
int iChild;
|
||||||
TSubModel *Child;
|
|
||||||
int eType; // Ra: modele binarne dają więcej możliwości niż mesh złożony z trójkątów
|
int eType; // Ra: modele binarne dają więcej możliwości niż mesh złożony z trójkątów
|
||||||
int iName; // numer łańcucha z nazwą submodelu, albo -1 gdy anonimowy
|
int iName; // numer łańcucha z nazwą submodelu, albo -1 gdy anonimowy
|
||||||
public: // chwilowo
|
public: // chwilowo
|
||||||
TAnimType b_Anim;
|
TAnimType b_Anim;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int iFlags; // flagi informacyjne:
|
int iFlags; // flagi informacyjne:
|
||||||
// bit 0: =1 faza rysowania zależy od wymiennej tekstury 0
|
// bit 0: =1 faza rysowania zależy od wymiennej tekstury 0
|
||||||
// bit 1: =1 faza rysowania zależy od wymiennej tekstury 1
|
// bit 1: =1 faza rysowania zależy od wymiennej tekstury 1
|
||||||
@@ -194,7 +161,7 @@ class TSubModel
|
|||||||
int iMatrix; // w pliku binarnym jest numer matrycy
|
int iMatrix; // w pliku binarnym jest numer matrycy
|
||||||
};
|
};
|
||||||
int iNumVerts; // ilość wierzchołków (1 dla FreeSpotLight)
|
int iNumVerts; // ilość wierzchołków (1 dla FreeSpotLight)
|
||||||
int iVboPtr; // początek na liście wierzchołków albo indeksów
|
int tVboPtr; // początek na liście wierzchołków albo indeksów
|
||||||
int iTexture; // numer nazwy tekstury, -1 wymienna, 0 brak
|
int iTexture; // numer nazwy tekstury, -1 wymienna, 0 brak
|
||||||
float fVisible; // próg jasności światła do załączenia submodelu
|
float fVisible; // próg jasności światła do załączenia submodelu
|
||||||
float fLight; // próg jasności światła do zadziałania selfillum
|
float fLight; // próg jasności światła do zadziałania selfillum
|
||||||
@@ -215,12 +182,15 @@ class TSubModel
|
|||||||
float fCosHotspotAngle; // cosinus kąta stożka pod którym widać aureolę i zwiększone natężenie
|
float fCosHotspotAngle; // cosinus kąta stożka pod którym widać aureolę i zwiększone natężenie
|
||||||
// światła
|
// światła
|
||||||
float fCosViewAngle; // cos kata pod jakim sie teraz patrzy
|
float fCosViewAngle; // cos kata pod jakim sie teraz patrzy
|
||||||
// Ra: dalej są zmienne robocze, można je przestawiać z zachowaniem rozmiaru klasy
|
|
||||||
|
TSubModel *Next;
|
||||||
|
TSubModel *Child;
|
||||||
|
intptr_t iVboPtr;
|
||||||
texture_manager::size_type TextureID; // numer tekstury, -1 wymienna, 0 brak
|
texture_manager::size_type TextureID; // numer tekstury, -1 wymienna, 0 brak
|
||||||
bool bWire; // nie używane, ale wczytywane
|
bool bWire; // nie używane, ale wczytywane
|
||||||
// short TexAlpha; //Ra: nie używane już
|
// short TexAlpha; //Ra: nie używane już
|
||||||
GLuint uiDisplayList; // roboczy numer listy wyświetlania
|
GLuint uiDisplayList; // roboczy numer listy wyświetlania
|
||||||
float Opacity; // nie używane, ale wczytywane
|
float Opacity; // nie używane, ale wczytywane //m7todo: wywalić to
|
||||||
// ABu: te same zmienne, ale zdublowane dla Render i RenderAlpha,
|
// ABu: te same zmienne, ale zdublowane dla Render i RenderAlpha,
|
||||||
// bo sie chrzanilo przemieszczanie obiektow.
|
// bo sie chrzanilo przemieszczanie obiektow.
|
||||||
// Ra: już się nie chrzani
|
// Ra: już się nie chrzani
|
||||||
@@ -228,31 +198,30 @@ class TSubModel
|
|||||||
float3 v_RotateAxis;
|
float3 v_RotateAxis;
|
||||||
float3 v_Angles;
|
float3 v_Angles;
|
||||||
|
|
||||||
public: // chwilowo
|
public: // chwilowo
|
||||||
float3 v_TransVector;
|
float3 v_TransVector;
|
||||||
float8 *Vertices; // roboczy wskaźnik - wczytanie T3D do VBO
|
float8 *Vertices; // roboczy wskaźnik - wczytanie T3D do VBO
|
||||||
int iAnimOwner; // roboczy numer egzemplarza, który ustawił animację
|
size_t iAnimOwner; // roboczy numer egzemplarza, który ustawił animację
|
||||||
TAnimType b_aAnim; // kody animacji oddzielnie, bo zerowane
|
TAnimType b_aAnim; // kody animacji oddzielnie, bo zerowane
|
||||||
public:
|
public:
|
||||||
float4x4 *mAnimMatrix; // macierz do animacji kwaternionowych (należy do AnimContainer)
|
float4x4 *mAnimMatrix; // macierz do animacji kwaternionowych (należy do AnimContainer)
|
||||||
char space[8]; // wolne miejsce na przyszłe zmienne (zmniejszyć w miarę potrzeby)
|
public:
|
||||||
public:
|
|
||||||
TSubModel **
|
TSubModel **
|
||||||
smLetter; // wskaźnik na tablicę submdeli do generoania tekstu (docelowo zapisać do E3D)
|
smLetter; // wskaźnik na tablicę submdeli do generoania tekstu (docelowo zapisać do E3D)
|
||||||
TSubModel *Parent; // nadrzędny, np. do wymnażania macierzy
|
TSubModel *Parent; // nadrzędny, np. do wymnażania macierzy
|
||||||
int iVisible; // roboczy stan widoczności
|
int iVisible; // roboczy stan widoczności
|
||||||
// AnsiString asTexture; //robocza nazwa tekstury do zapisania w pliku binarnym
|
// AnsiString asTexture; //robocza nazwa tekstury do zapisania w pliku binarnym
|
||||||
// AnsiString asName; //robocza nazwa
|
// AnsiString asName; //robocza nazwa
|
||||||
char *pTexture; // robocza nazwa tekstury do zapisania w pliku binarnym
|
std::string pTexture; // robocza nazwa tekstury do zapisania w pliku binarnym
|
||||||
char *pName; // robocza nazwa
|
std::string pName; // robocza nazwa
|
||||||
private:
|
private:
|
||||||
// int SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
// int SeekFaceNormal(DWORD *Masks, int f,DWORD dwMask,vector3 *pt,GLVERTEX
|
||||||
// *Vertices);
|
// *Vertices);
|
||||||
int SeekFaceNormal(unsigned int *Masks, int f, unsigned int dwMask, float3 *pt, float8 *Vertices);
|
int SeekFaceNormal(unsigned int *Masks, int f, unsigned int dwMask, float3 *pt, float8 *Vertices);
|
||||||
void RaAnimation(TAnimType a);
|
void RaAnimation(TAnimType a);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int iInstance; // identyfikator egzemplarza, który aktualnie renderuje model
|
static size_t iInstance; // identyfikator egzemplarza, który aktualnie renderuje model
|
||||||
static texture_manager::size_type *ReplacableSkinId;
|
static texture_manager::size_type *ReplacableSkinId;
|
||||||
static int iAlpha; // maska bitowa dla danego przebiegu
|
static int iAlpha; // maska bitowa dla danego przebiegu
|
||||||
static double fSquareDist;
|
static double fSquareDist;
|
||||||
@@ -308,10 +277,8 @@ class TSubModel
|
|||||||
};
|
};
|
||||||
void InitialRotate(bool doit);
|
void InitialRotate(bool doit);
|
||||||
void DisplayLists();
|
void DisplayLists();
|
||||||
void Info();
|
void BinInit(TSubModel *s, float4x4 *m, float8 *v,
|
||||||
void InfoSet(TSubModelInfo *info);
|
std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
|
||||||
void BinInit(TSubModel *s, float4x4 *m, float8 *v, TStringPack *t, TStringPack *n = NULL,
|
|
||||||
bool dynamic = false);
|
|
||||||
void ReplacableSet(texture_manager::size_type *r, int a)
|
void ReplacableSet(texture_manager::size_type *r, int a)
|
||||||
{
|
{
|
||||||
ReplacableSkinId = r;
|
ReplacableSkinId = r;
|
||||||
@@ -344,54 +311,32 @@ class TSubModel
|
|||||||
void ParentMatrix(float4x4 *m);
|
void ParentMatrix(float4x4 *m);
|
||||||
float MaxY(const float4x4 &m);
|
float MaxY(const float4x4 &m);
|
||||||
void AdjustDist();
|
void AdjustDist();
|
||||||
};
|
|
||||||
|
|
||||||
class TSubModelInfo
|
void deserialize(std::istream&);
|
||||||
{ // klasa z informacjami o submodelach, do tworzenia pliku binarnego
|
void TSubModel::serialize(std::ostream&,
|
||||||
public:
|
std::vector<TSubModel*>&,
|
||||||
TSubModel *pSubModel; // wskaźnik na submodel
|
std::vector<std::string>&,
|
||||||
int iTransform; // numer transformu (-1 gdy brak)
|
std::vector<std::string>&,
|
||||||
int iName; // numer nazwy
|
std::vector<float4x4>&);
|
||||||
int iTexture; // numer tekstury
|
|
||||||
int iNameLen; // długość nazwy
|
|
||||||
int iTextureLen; // długość tekstury
|
|
||||||
int iNext, iChild; // numer następnego i potomnego
|
|
||||||
static int iTotalTransforms; // ilość transformów
|
|
||||||
static int iTotalNames; // ilość nazw
|
|
||||||
static int iTotalTextures; // ilość tekstur
|
|
||||||
static int iCurrent; // aktualny obiekt
|
|
||||||
static TSubModelInfo *pTable; // tabele obiektów pomocniczych
|
|
||||||
TSubModelInfo()
|
|
||||||
{
|
|
||||||
pSubModel = NULL;
|
|
||||||
iTransform = iName = iTexture = iNext = iChild = -1; // nie ma
|
|
||||||
iNameLen = iTextureLen = 0;
|
|
||||||
}
|
|
||||||
void Reset()
|
|
||||||
{
|
|
||||||
pTable = this; // ustawienie wskaźnika tabeli obiektów
|
|
||||||
iTotalTransforms = iTotalNames = iTotalTextures = iCurrent = 0; // zerowanie liczników
|
|
||||||
}
|
|
||||||
~TSubModelInfo(){};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TModel3d : public CMesh
|
class TModel3d : public CMesh
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// TMaterial *Materials;
|
// TMaterial *Materials;
|
||||||
// int MaterialsCount; //Ra: nie używane
|
// int MaterialsCount; //Ra: nie używane
|
||||||
// bool TractionPart; //Ra: nie używane
|
// bool TractionPart; //Ra: nie używane
|
||||||
TSubModel *Root; // drzewo submodeli
|
TSubModel *Root; // drzewo submodeli
|
||||||
int iFlags; // Ra: czy submodele mają przezroczyste tekstury
|
int iFlags; // Ra: czy submodele mają przezroczyste tekstury
|
||||||
public: // Ra: tymczasowo
|
public: // Ra: tymczasowo
|
||||||
int iNumVerts; // ilość wierzchołków (gdy nie ma VBO, to m_nVertexCount=0)
|
int iNumVerts; // ilość wierzchołków (gdy nie ma VBO, to m_nVertexCount=0)
|
||||||
private:
|
private:
|
||||||
TStringPack Textures; // nazwy tekstur
|
std::vector<std::string> Textures; // nazwy tekstur
|
||||||
TStringPack Names; // nazwy submodeli
|
std::vector<std::string> Names; // nazwy submodeli
|
||||||
int *iModel; // zawartość pliku binarnego
|
int *iModel; // zawartość pliku binarnego
|
||||||
int iSubModelsCount; // Ra: używane do tworzenia binarnych
|
int iSubModelsCount; // Ra: używane do tworzenia binarnych
|
||||||
std::string asBinary; // nazwa pod którą zapisać model binarny
|
std::string asBinary; // nazwa pod którą zapisać model binarny
|
||||||
public:
|
public:
|
||||||
inline TSubModel * GetSMRoot()
|
inline TSubModel * GetSMRoot()
|
||||||
{
|
{
|
||||||
return (Root);
|
return (Root);
|
||||||
@@ -426,13 +371,13 @@ class TModel3d : public CMesh
|
|||||||
void RaRenderAlpha(vector3 pPosition, double fAngle = 0, texture_manager::size_type *ReplacableSkinId = NULL,
|
void RaRenderAlpha(vector3 pPosition, double fAngle = 0, texture_manager::size_type *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
// trzy kąty obrotu
|
// trzy kąty obrotu
|
||||||
void Render( vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
void Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RenderAlpha( vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
void RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRender( vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
void RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
void RaRenderAlpha( vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL,
|
||||||
int iAlpha = 0x30300030);
|
int iAlpha = 0x30300030);
|
||||||
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
||||||
int Flags()
|
int Flags()
|
||||||
@@ -440,13 +385,14 @@ class TModel3d : public CMesh
|
|||||||
return iFlags;
|
return iFlags;
|
||||||
};
|
};
|
||||||
void Init();
|
void Init();
|
||||||
char * NameGet()
|
std::string NameGet()
|
||||||
{
|
{
|
||||||
return Root ? Root->pName : NULL;
|
return Root ? Root->pName : NULL;
|
||||||
};
|
};
|
||||||
int TerrainCount();
|
int TerrainCount();
|
||||||
TSubModel * TerrainSquare(int n);
|
TSubModel * TerrainSquare(int n);
|
||||||
void TerrainRenderVBO(int n);
|
void TerrainRenderVBO(int n);
|
||||||
|
void deserialize(std::istream &s, size_t size, bool dynamic);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ TPythonInterpreter *TPythonInterpreter::_instance = NULL;
|
|||||||
TPythonInterpreter::TPythonInterpreter()
|
TPythonInterpreter::TPythonInterpreter()
|
||||||
{
|
{
|
||||||
WriteLog("Loading Python ...");
|
WriteLog("Loading Python ...");
|
||||||
|
if (sizeof(void*) == 8)
|
||||||
|
Py_SetPythonHome("python64");
|
||||||
|
else
|
||||||
Py_SetPythonHome("python");
|
Py_SetPythonHome("python");
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
_main = PyImport_ImportModule("__main__");
|
_main = PyImport_ImportModule("__main__");
|
||||||
@@ -64,7 +67,7 @@ bool TPythonInterpreter::loadClassFile( std::string const &lookupPath, std::stri
|
|||||||
long fsize = ftell(sourceFile);
|
long fsize = ftell(sourceFile);
|
||||||
char *buffer = (char *)calloc(fsize + 1, sizeof(char));
|
char *buffer = (char *)calloc(fsize + 1, sizeof(char));
|
||||||
fseek(sourceFile, 0, SEEK_SET);
|
fseek(sourceFile, 0, SEEK_SET);
|
||||||
long freaded = fread(buffer, sizeof(char), fsize, sourceFile);
|
size_t freaded = fread(buffer, sizeof(char), fsize, sourceFile);
|
||||||
buffer[freaded] = 0; // z jakiegos powodu czytamy troche mniej i trzczeba dodac konczace
|
buffer[freaded] = 0; // z jakiegos powodu czytamy troche mniej i trzczeba dodac konczace
|
||||||
// zero do bufora (mimo ze calloc teoretycznie powiniene zwrocic
|
// zero do bufora (mimo ze calloc teoretycznie powiniene zwrocic
|
||||||
// wyzerowana pamiec)
|
// wyzerowana pamiec)
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ void TRealSound::Stop()
|
|||||||
void TRealSound::AdjFreq(double Freq, double dt) // McZapkie TODO: dorobic tu efekt Dopplera
|
void TRealSound::AdjFreq(double Freq, double dt) // McZapkie TODO: dorobic tu efekt Dopplera
|
||||||
// Freq moze byc liczba dodatnia mniejsza od 1 lub wieksza od 1
|
// Freq moze byc liczba dodatnia mniejsza od 1 lub wieksza od 1
|
||||||
{
|
{
|
||||||
float df, Vlist, Vsrc;
|
float df, Vlist;
|
||||||
if ((Global::bSoundEnabled) && (AM != 0))
|
if ((Global::bSoundEnabled) && (AM != 0))
|
||||||
{
|
{
|
||||||
if (dt > 0)
|
if (dt > 0)
|
||||||
@@ -247,7 +247,7 @@ void TTextSound::Init(std::string const &SoundName, double SoundAttenuation, dou
|
|||||||
fTime = GetWaveTime();
|
fTime = GetWaveTime();
|
||||||
std::string txt(SoundName);
|
std::string txt(SoundName);
|
||||||
txt.erase( txt.rfind( '.' ) ); // obcięcie rozszerzenia
|
txt.erase( txt.rfind( '.' ) ); // obcięcie rozszerzenia
|
||||||
for (int i = txt.length(); i > 0; --i)
|
for (size_t i = txt.length(); i > 0; --i)
|
||||||
if (txt[i] == '/')
|
if (txt[i] == '/')
|
||||||
txt[i] = '\\'; // bo nie rozumi
|
txt[i] = '\\'; // bo nie rozumi
|
||||||
txt += "-" + Global::asLang + ".txt"; // już może być w różnych językach
|
txt += "-" + Global::asLang + ".txt"; // już może być w różnych językach
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ void TSegment::RenderSwitchRail(const vector6 *ShapePoints1, const vector6 *Shap
|
|||||||
double fOffsetX)
|
double fOffsetX)
|
||||||
{ // tworzenie siatki trójkątów dla iglicy
|
{ // tworzenie siatki trójkątów dla iglicy
|
||||||
vector3 pos1, pos2, dir, parallel1, parallel2, pt;
|
vector3 pos1, pos2, dir, parallel1, parallel2, pt;
|
||||||
double a1, a2, s, step, offset, tv1, tv2, t, t2, t2step, oldt2, sp, oldsp;
|
double a1, a2, s, step, offset, tv1, tv2, t, t2step, oldt2;
|
||||||
int i, j;
|
int i, j;
|
||||||
if (bCurve)
|
if (bCurve)
|
||||||
{ // dla toru odchylonego
|
{ // dla toru odchylonego
|
||||||
@@ -736,7 +736,7 @@ void TSegment::Render()
|
|||||||
{
|
{
|
||||||
vector3 pt;
|
vector3 pt;
|
||||||
GfxRenderer.Bind(0);
|
GfxRenderer.Bind(0);
|
||||||
int i;
|
|
||||||
if (bCurve)
|
if (bCurve)
|
||||||
{
|
{
|
||||||
glColor3f(0, 0, 1.0f);
|
glColor3f(0, 0, 1.0f);
|
||||||
|
|||||||
10
Sound.cpp
10
Sound.cpp
@@ -8,7 +8,6 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#define STRICT
|
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "Logs.h"
|
#include "Logs.h"
|
||||||
@@ -219,7 +218,6 @@ LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(const char *Name, bool Dynamic,
|
|||||||
Dynamic = false; // wczytanie z "sounds/"
|
Dynamic = false; // wczytanie z "sounds/"
|
||||||
}
|
}
|
||||||
TSoundContainer *Next = First;
|
TSoundContainer *Next = First;
|
||||||
DWORD dwStatus;
|
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(Name, Next->Name) == 0)
|
if (strcmp(Name, Next->Name) == 0)
|
||||||
@@ -277,11 +275,6 @@ void TSoundsManager::RestoreAll()
|
|||||||
|
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (FAILED(hr = Next->DSBuffer->GetStatus(&dwStatus)))
|
|
||||||
;
|
|
||||||
// return hr;
|
|
||||||
|
|
||||||
if (dwStatus & DSBSTATUS_BUFFERLOST)
|
if (dwStatus & DSBSTATUS_BUFFERLOST)
|
||||||
{
|
{
|
||||||
// Since the app could have just been activated, then
|
// Since the app could have just been activated, then
|
||||||
@@ -376,6 +369,3 @@ void TSoundsManager::Init(HWND hWnd)
|
|||||||
|
|
||||||
SAFE_RELEASE(pDSBPrimary);
|
SAFE_RELEASE(pDSBPrimary);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
#pragma package(smart_init)
|
|
||||||
|
|||||||
79
Texture.cpp
79
Texture.cpp
@@ -17,10 +17,12 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
|
#include "GL/glew.h"
|
||||||
|
|
||||||
#include "usefull.h"
|
#include "usefull.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
|
#include "sn_utils.h"
|
||||||
|
|
||||||
texture_manager::texture_manager() {
|
texture_manager::texture_manager() {
|
||||||
|
|
||||||
@@ -80,7 +82,7 @@ opengl_texture::load_BMP() {
|
|||||||
if( infosize > sizeof( info ) ) {
|
if( infosize > sizeof( info ) ) {
|
||||||
WriteLog( "Warning - BMP header is larger than expected, possible format difference." );
|
WriteLog( "Warning - BMP header is larger than expected, possible format difference." );
|
||||||
}
|
}
|
||||||
file.read( (char *)&info, std::min( infosize, sizeof( info ) ) );
|
file.read( (char *)&info, std::min( (size_t)infosize, sizeof( info ) ) );
|
||||||
|
|
||||||
data_width = info.bmiHeader.biWidth;
|
data_width = info.bmiHeader.biWidth;
|
||||||
data_height = info.bmiHeader.biHeight;
|
data_height = info.bmiHeader.biHeight;
|
||||||
@@ -118,6 +120,70 @@ opengl_texture::load_BMP() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DDCOLORKEY opengl_texture::deserialize_ddck(std::istream &s)
|
||||||
|
{
|
||||||
|
DDCOLORKEY ddck;
|
||||||
|
|
||||||
|
ddck.dwColorSpaceLowValue = sn_utils::ld_uint32(s);
|
||||||
|
ddck.dwColorSpaceHighValue = sn_utils::ld_uint32(s);
|
||||||
|
|
||||||
|
return ddck;
|
||||||
|
}
|
||||||
|
|
||||||
|
DDPIXELFORMAT opengl_texture::deserialize_ddpf(std::istream &s)
|
||||||
|
{
|
||||||
|
DDPIXELFORMAT ddpf;
|
||||||
|
|
||||||
|
ddpf.dwSize = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwFlags = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwFourCC = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwRGBBitCount = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwRBitMask = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwGBitMask = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwBBitMask = sn_utils::ld_uint32(s);
|
||||||
|
ddpf.dwRGBAlphaBitMask = sn_utils::ld_uint32(s);
|
||||||
|
|
||||||
|
return ddpf;
|
||||||
|
}
|
||||||
|
|
||||||
|
DDSCAPS2 opengl_texture::deserialize_ddscaps(std::istream &s)
|
||||||
|
{
|
||||||
|
DDSCAPS2 ddsc;
|
||||||
|
|
||||||
|
ddsc.dwCaps = sn_utils::ld_uint32(s);
|
||||||
|
ddsc.dwCaps2 = sn_utils::ld_uint32(s);
|
||||||
|
ddsc.dwCaps3 = sn_utils::ld_uint32(s);
|
||||||
|
ddsc.dwCaps4 = sn_utils::ld_uint32(s);
|
||||||
|
|
||||||
|
return ddsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
DDSURFACEDESC2 opengl_texture::deserialize_ddsd(std::istream &s)
|
||||||
|
{
|
||||||
|
DDSURFACEDESC2 ddsd;
|
||||||
|
|
||||||
|
ddsd.dwSize = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwFlags = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwHeight = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwWidth = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.lPitch = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwBackBufferCount = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwMipMapCount = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwAlphaBitDepth = sn_utils::ld_uint32(s);
|
||||||
|
ddsd.dwReserved = sn_utils::ld_uint32(s);
|
||||||
|
sn_utils::ld_uint32(s);
|
||||||
|
ddsd.lpSurface = nullptr;
|
||||||
|
ddsd.ddckCKDestOverlay = deserialize_ddck(s);
|
||||||
|
ddsd.ddckCKDestBlt = deserialize_ddck(s);
|
||||||
|
ddsd.ddckCKSrcOverlay = deserialize_ddck(s);
|
||||||
|
ddsd.ddckCKSrcBlt = deserialize_ddck(s);
|
||||||
|
ddsd.ddpfPixelFormat = deserialize_ddpf(s);
|
||||||
|
ddsd.ddsCaps = deserialize_ddscaps(s);
|
||||||
|
ddsd.dwTextureStage = sn_utils::ld_uint32(s);
|
||||||
|
|
||||||
|
return ddsd;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
opengl_texture::load_DDS() {
|
opengl_texture::load_DDS() {
|
||||||
|
|
||||||
@@ -136,9 +202,8 @@ opengl_texture::load_DDS() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DDSURFACEDESC2 ddsd;
|
DDSURFACEDESC2 ddsd = deserialize_ddsd(file);
|
||||||
file.read((char *)&ddsd, sizeof(ddsd));
|
filesize -= 124;
|
||||||
filesize -= sizeof( ddsd );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This .dds loader supports the loading of compressed formats DXT1, DXT3
|
// This .dds loader supports the loading of compressed formats DXT1, DXT3
|
||||||
@@ -189,7 +254,7 @@ opengl_texture::load_DDS() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int datasize = filesize - offset;
|
size_t datasize = filesize - offset;
|
||||||
/*
|
/*
|
||||||
// this approach loads only the first mipmap and relies on graphics card to fill the rest
|
// this approach loads only the first mipmap and relies on graphics card to fill the rest
|
||||||
data_mapcount = 1;
|
data_mapcount = 1;
|
||||||
@@ -467,7 +532,7 @@ opengl_texture::create() {
|
|||||||
::glCompressedTexImage2D(
|
::glCompressedTexImage2D(
|
||||||
GL_TEXTURE_2D, maplevel, data_format,
|
GL_TEXTURE_2D, maplevel, data_format,
|
||||||
datawidth, dataheight, 0,
|
datawidth, dataheight, 0,
|
||||||
datasize, (GLubyte *)&data[0] + dataoffset );
|
datasize, (GLubyte *)&data[dataoffset] );
|
||||||
|
|
||||||
dataoffset += datasize;
|
dataoffset += datasize;
|
||||||
datawidth = std::max( datawidth / 2, 1 );
|
datawidth = std::max( datawidth / 2, 1 );
|
||||||
@@ -653,7 +718,7 @@ texture_manager::GetTextureId( std::string Filename, std::string const &Dir, int
|
|||||||
traits += '#';
|
traits += '#';
|
||||||
}
|
}
|
||||||
texture.traits = traits;
|
texture.traits = traits;
|
||||||
auto const textureindex = m_textures.size();
|
auto const textureindex = (texture_manager::size_type)m_textures.size();
|
||||||
m_textures.emplace_back( texture );
|
m_textures.emplace_back( texture );
|
||||||
m_texturemappings.emplace( filename, textureindex );
|
m_texturemappings.emplace( filename, textureindex );
|
||||||
|
|
||||||
|
|||||||
10
Texture.h
10
Texture.h
@@ -9,8 +9,10 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <istream>
|
||||||
|
#include <ddraw.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
|
|
||||||
enum class resource_state {
|
enum class resource_state {
|
||||||
none,
|
none,
|
||||||
@@ -20,12 +22,16 @@ enum class resource_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct opengl_texture {
|
struct opengl_texture {
|
||||||
|
static DDSURFACEDESC2 deserialize_ddsd(std::istream&);
|
||||||
|
static DDCOLORKEY deserialize_ddck(std::istream&);
|
||||||
|
static DDPIXELFORMAT deserialize_ddpf(std::istream&);
|
||||||
|
static DDSCAPS2 deserialize_ddscaps(std::istream&);
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void load();
|
void load();
|
||||||
void create();
|
void create();
|
||||||
// members
|
// members
|
||||||
GLuint id{ (GLuint) -1 }; // associated GL resource
|
GLuint id{ (GLuint)-1 }; // associated GL resource
|
||||||
bool has_alpha{ false }; // indicates the texture has alpha channel
|
bool has_alpha{ false }; // indicates the texture has alpha channel
|
||||||
bool is_ready{ false }; // indicates the texture was processed and is ready for use
|
bool is_ready{ false }; // indicates the texture was processed and is ready for use
|
||||||
std::string traits; // requested texture attributes: wrapping modes etc
|
std::string traits; // requested texture attributes: wrapping modes etc
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ void DecompressDXT3(DDS_IMAGE_DATA lImage, const GLubyte *lCompData, GLubyte *Da
|
|||||||
|
|
||||||
void DecompressDXT5(DDS_IMAGE_DATA lImage, const GLubyte *lCompData, GLubyte *Data)
|
void DecompressDXT5(DDS_IMAGE_DATA lImage, const GLubyte *lCompData, GLubyte *Data)
|
||||||
{
|
{
|
||||||
GLint x, y, z, i, j, k;
|
GLint x, y, i, j, k;
|
||||||
GLuint Select;
|
GLuint Select;
|
||||||
const GLubyte *Temp; //, r0, g0, b0, r1, g1, b1;
|
const GLubyte *Temp; //, r0, g0, b0, r1, g1, b1;
|
||||||
Color8888 colours[4], *col;
|
Color8888 colours[4], *col;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#ifndef TEXTURE_DDS_H
|
#ifndef TEXTURE_DDS_H
|
||||||
#define TEXTURE_DDS_H 1
|
#define TEXTURE_DDS_H 1
|
||||||
|
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
|
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
|
|
||||||
|
|||||||
13
Track.cpp
13
Track.cpp
@@ -412,10 +412,9 @@ vector3 LoadPoint(cParser *parser)
|
|||||||
void TTrack::Load(cParser *parser, vector3 pOrigin, std::string name)
|
void TTrack::Load(cParser *parser, vector3 pOrigin, std::string name)
|
||||||
{ // pobranie obiektu trajektorii ruchu
|
{ // pobranie obiektu trajektorii ruchu
|
||||||
vector3 pt, vec, p1, p2, cp1, cp2, p3, p4, cp3, cp4; // dodatkowe punkty potrzebne do skrzyżowań
|
vector3 pt, vec, p1, p2, cp1, cp2, p3, p4, cp3, cp4; // dodatkowe punkty potrzebne do skrzyżowań
|
||||||
double a1, a2, r1, r2, r3, r4, d1, d2, a;
|
double a1, a2, r1, r2, r3, r4;
|
||||||
string str;
|
string str;
|
||||||
bool bCurve;
|
size_t i; //,state; //Ra: teraz już nie ma początkowego stanu zwrotnicy we wpisie
|
||||||
int i; //,state; //Ra: teraz już nie ma początkowego stanu zwrotnicy we wpisie
|
|
||||||
std::string token;
|
std::string token;
|
||||||
|
|
||||||
parser->getTokens();
|
parser->getTokens();
|
||||||
@@ -1557,7 +1556,7 @@ void TTrack::Compile(GLuint tex)
|
|||||||
// 2014-07: na początek rysować brzegi jak dla łuków
|
// 2014-07: na początek rysować brzegi jak dla łuków
|
||||||
// punkty brzegu nawierzchni uzyskujemy podczas renderowania boków (bez sensu, ale
|
// punkty brzegu nawierzchni uzyskujemy podczas renderowania boków (bez sensu, ale
|
||||||
// najszybciej było zrobić)
|
// najszybciej było zrobić)
|
||||||
int i, j; // ile punktów (może byc różna ilość punktów między drogami)
|
int i; // ile punktów (może byc różna ilość punktów między drogami)
|
||||||
if (!SwitchExtension->vPoints)
|
if (!SwitchExtension->vPoints)
|
||||||
{ // jeśli tablica punktów nie jest jeszcze utworzona, zliczamy punkty i tworzymy ją
|
{ // jeśli tablica punktów nie jest jeszcze utworzona, zliczamy punkty i tworzymy ją
|
||||||
if (SwitchExtension->iRoads == 3) // mogą być tylko 3 drogi zamiast 4
|
if (SwitchExtension->iRoads == 3) // mogą być tylko 3 drogi zamiast 4
|
||||||
@@ -1735,7 +1734,7 @@ void TTrack::Compile(GLuint tex)
|
|||||||
if (!SwitchExtension->bPoints) // jeśli tablica nie wypełniona
|
if (!SwitchExtension->bPoints) // jeśli tablica nie wypełniona
|
||||||
if (b) // ale jest wskaźnik do tablicy - może nie być?
|
if (b) // ale jest wskaźnik do tablicy - może nie być?
|
||||||
{ // coś się gubi w obliczeniach na wskaźnikach
|
{ // coś się gubi w obliczeniach na wskaźnikach
|
||||||
i = (int((void *)(b)) - int((void *)(SwitchExtension->vPoints))) /
|
i = (int)(((size_t)(b)) - ((size_t)(SwitchExtension->vPoints))) /
|
||||||
sizeof(vector3); // ustalenie liczby punktów, bo mogło wyjść inaczej niż
|
sizeof(vector3); // ustalenie liczby punktów, bo mogło wyjść inaczej niż
|
||||||
// policzone z góry
|
// policzone z góry
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@@ -2913,7 +2912,7 @@ TTrack * TTrack::RaAnimate()
|
|||||||
}
|
}
|
||||||
if (Global::bUseVBO)
|
if (Global::bUseVBO)
|
||||||
{ // dla OpenGL 1.4 odświeży się cały sektor, w późniejszych poprawiamy fragment
|
{ // dla OpenGL 1.4 odświeży się cały sektor, w późniejszych poprawiamy fragment
|
||||||
if (true == GLEW_VERSION_1_5) // dla OpenGL 1.4 to się nie wykona poprawnie
|
if (GLEW_VERSION_1_5) // dla OpenGL 1.4 to się nie wykona poprawnie
|
||||||
if (TextureID1) // Ra: !!!! tu jest do poprawienia
|
if (TextureID1) // Ra: !!!! tu jest do poprawienia
|
||||||
{ // iglice liczone tylko dla zwrotnic
|
{ // iglice liczone tylko dla zwrotnic
|
||||||
vector6 rpts3[24], rpts4[24];
|
vector6 rpts3[24], rpts4[24];
|
||||||
@@ -3024,7 +3023,7 @@ TTrack * TTrack::RaAnimate()
|
|||||||
if (Global::bUseVBO)
|
if (Global::bUseVBO)
|
||||||
{ // dla OpenGL 1.4 odświeży się cały sektor, w późniejszych poprawiamy fragment
|
{ // dla OpenGL 1.4 odświeży się cały sektor, w późniejszych poprawiamy fragment
|
||||||
// aktualizacja pojazdów na torze
|
// aktualizacja pojazdów na torze
|
||||||
if (true == GLEW_VERSION_1_5) // dla OpenGL 1.4 to się nie wykona poprawnie
|
if (GLEW_VERSION_1_5) // dla OpenGL 1.4 to się nie wykona poprawnie
|
||||||
{
|
{
|
||||||
int size =
|
int size =
|
||||||
RaArrayPrepare(); // wielkość tabeli potrzebna dla tej obrotnicy
|
RaArrayPrepare(); // wielkość tabeli potrzebna dla tej obrotnicy
|
||||||
|
|||||||
22
Track.h
22
Track.h
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
#include "Segment.h"
|
#include "Segment.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
@@ -139,12 +139,12 @@ class TTrack : public Resource
|
|||||||
// McZapkie-070402: dodalem zmienne opisujace rozmiary tekstur
|
// McZapkie-070402: dodalem zmienne opisujace rozmiary tekstur
|
||||||
texture_manager::size_type TextureID1 = 0; // tekstura szyn albo nawierzchni
|
texture_manager::size_type TextureID1 = 0; // tekstura szyn albo nawierzchni
|
||||||
texture_manager::size_type TextureID2 = 0; // tekstura automatycznej podsypki albo pobocza
|
texture_manager::size_type TextureID2 = 0; // tekstura automatycznej podsypki albo pobocza
|
||||||
float fTexLength = 4.0; // długość powtarzania tekstury w metrach
|
float fTexLength = 4.0f; // długość powtarzania tekstury w metrach
|
||||||
float fTexRatio1 = 1.0; // proporcja boków tekstury nawierzchni (żeby zaoszczędzić na rozmiarach tekstur...)
|
float fTexRatio1 = 1.0f; // proporcja boków tekstury nawierzchni (żeby zaoszczędzić na rozmiarach tekstur...)
|
||||||
float fTexRatio2 = 1.0; // proporcja boków tekstury chodnika (żeby zaoszczędzić na rozmiarach tekstur...)
|
float fTexRatio2 = 1.0f; // proporcja boków tekstury chodnika (żeby zaoszczędzić na rozmiarach tekstur...)
|
||||||
float fTexHeight1 = 0.6; // wysokość brzegu względem trajektorii
|
float fTexHeight1 = 0.6f; // wysokość brzegu względem trajektorii
|
||||||
float fTexWidth = 0.9; // szerokość boku
|
float fTexWidth = 0.9f; // szerokość boku
|
||||||
float fTexSlope = 0.9;
|
float fTexSlope = 0.9f;
|
||||||
double fRadiusTable[ 2 ]; // dwa promienie, drugi dla zwrotnicy
|
double fRadiusTable[ 2 ]; // dwa promienie, drugi dla zwrotnicy
|
||||||
int iTrapezoid = 0; // 0-standard, 1-przechyłka, 2-trapez, 3-oba
|
int iTrapezoid = 0; // 0-standard, 1-przechyłka, 2-trapez, 3-oba
|
||||||
GLuint DisplayListID = 0;
|
GLuint DisplayListID = 0;
|
||||||
@@ -176,10 +176,10 @@ class TTrack : public Resource
|
|||||||
int iPrevDirection = 0; // domyślnie wirtualne odcinki dołączamy stroną od Point1
|
int iPrevDirection = 0; // domyślnie wirtualne odcinki dołączamy stroną od Point1
|
||||||
TTrackType eType = tt_Normal; // domyślnie zwykły
|
TTrackType eType = tt_Normal; // domyślnie zwykły
|
||||||
int iCategoryFlag = 1; // 0x100 - usuwanie pojazów // 1-tor, 2-droga, 4-rzeka, 8-samolot?
|
int iCategoryFlag = 1; // 0x100 - usuwanie pojazów // 1-tor, 2-droga, 4-rzeka, 8-samolot?
|
||||||
float fTrackWidth = 1.435; // szerokość w punkcie 1 // rozstaw toru, szerokość nawierzchni
|
float fTrackWidth = 1.435f; // szerokość w punkcie 1 // rozstaw toru, szerokość nawierzchni
|
||||||
float fTrackWidth2 = 0.0; // szerokość w punkcie 2 (głównie drogi i rzeki)
|
float fTrackWidth2 = 0.0f; // szerokość w punkcie 2 (głównie drogi i rzeki)
|
||||||
float fFriction = 0.15; // współczynnik tarcia
|
float fFriction = 0.15f; // współczynnik tarcia
|
||||||
float fSoundDistance = -1.0;
|
float fSoundDistance = -1.0f;
|
||||||
int iQualityFlag = 20;
|
int iQualityFlag = 20;
|
||||||
int iDamageFlag = 0;
|
int iDamageFlag = 0;
|
||||||
TEnvironmentType eEnvironment = e_flat; // dźwięk i oświetlenie
|
TEnvironmentType eEnvironment = e_flat; // dźwięk i oświetlenie
|
||||||
|
|||||||
124
Traction.cpp
124
Traction.cpp
@@ -256,11 +256,11 @@ void TTraction::RenderDL(float mgn) // McZapkie: mgn to odleglosc od obserwatora
|
|||||||
if (!Global::bSmoothTraction)
|
if (!Global::bSmoothTraction)
|
||||||
glDisable(GL_LINE_SMOOTH); // na liniach kiepsko wygląda - robi gradient
|
glDisable(GL_LINE_SMOOTH); // na liniach kiepsko wygląda - robi gradient
|
||||||
float linealpha = 5000 * WireThickness / (mgn + 1.0); //*WireThickness
|
float linealpha = 5000 * WireThickness / (mgn + 1.0); //*WireThickness
|
||||||
if (linealpha > 1.2)
|
if (linealpha > 1.2f)
|
||||||
linealpha = 1.2; // zbyt grube nie są dobre
|
linealpha = 1.2f; // zbyt grube nie są dobre
|
||||||
glLineWidth(linealpha);
|
glLineWidth(linealpha);
|
||||||
if (linealpha > 1.0)
|
if (linealpha > 1.0f)
|
||||||
linealpha = 1.0;
|
linealpha = 1.0f;
|
||||||
// McZapkie-261102: kolor zalezy od materialu i zasniedzenia
|
// McZapkie-261102: kolor zalezy od materialu i zasniedzenia
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
switch (Material)
|
switch (Material)
|
||||||
@@ -269,59 +269,59 @@ void TTraction::RenderDL(float mgn) // McZapkie: mgn to odleglosc od obserwatora
|
|||||||
case 1:
|
case 1:
|
||||||
if (TestFlag(DamageFlag, 1))
|
if (TestFlag(DamageFlag, 1))
|
||||||
{
|
{
|
||||||
r = 0.00000;
|
r = 0.00000f;
|
||||||
g = 0.32549;
|
g = 0.32549f;
|
||||||
b = 0.2882353; // zielona miedź
|
b = 0.2882353f; // zielona miedź
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = 0.35098;
|
r = 0.35098f;
|
||||||
g = 0.22549;
|
g = 0.22549f;
|
||||||
b = 0.1; // czerwona miedź
|
b = 0.1f; // czerwona miedź
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (TestFlag(DamageFlag, 1))
|
if (TestFlag(DamageFlag, 1))
|
||||||
{
|
{
|
||||||
r = 0.10;
|
r = 0.10f;
|
||||||
g = 0.10;
|
g = 0.10f;
|
||||||
b = 0.10; // czarne Al
|
b = 0.10f; // czarne Al
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = 0.25;
|
r = 0.25f;
|
||||||
g = 0.25;
|
g = 0.25f;
|
||||||
b = 0.25; // srebrne Al
|
b = 0.25f; // srebrne Al
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// tymczasowo pokazanie zasilanych odcinków
|
// tymczasowo pokazanie zasilanych odcinków
|
||||||
case 4:
|
case 4:
|
||||||
r = 0.5;
|
r = 0.5f;
|
||||||
g = 0.5;
|
g = 0.5f;
|
||||||
b = 1.0;
|
b = 1.0f;
|
||||||
break; // niebieskie z podłączonym zasilaniem
|
break; // niebieskie z podłączonym zasilaniem
|
||||||
case 5:
|
case 5:
|
||||||
r = 1.0;
|
r = 1.0f;
|
||||||
g = 0.0;
|
g = 0.0f;
|
||||||
b = 0.0;
|
b = 0.0f;
|
||||||
break; // czerwone z podłączonym zasilaniem 1
|
break; // czerwone z podłączonym zasilaniem 1
|
||||||
case 6:
|
case 6:
|
||||||
r = 0.0;
|
r = 0.0f;
|
||||||
g = 1.0;
|
g = 1.0f;
|
||||||
b = 0.0;
|
b = 0.0f;
|
||||||
break; // zielone z podłączonym zasilaniem 2
|
break; // zielone z podłączonym zasilaniem 2
|
||||||
case 7:
|
case 7:
|
||||||
r = 1.0;
|
r = 1.0f;
|
||||||
g = 1.0;
|
g = 1.0f;
|
||||||
b = 0.0;
|
b = 0.0f;
|
||||||
break; //żółte z podłączonym zasilaniem z obu stron
|
break; //żółte z podłączonym zasilaniem z obu stron
|
||||||
}
|
}
|
||||||
if (DebugModeFlag)
|
if (DebugModeFlag)
|
||||||
if (hvParallel)
|
if (hvParallel)
|
||||||
{ // jeśli z bieżnią wspólną, to dodatkowo przyciemniamy
|
{ // jeśli z bieżnią wspólną, to dodatkowo przyciemniamy
|
||||||
r *= 0.6;
|
r *= 0.6f;
|
||||||
g *= 0.6;
|
g *= 0.6f;
|
||||||
b *= 0.6;
|
b *= 0.6f;
|
||||||
}
|
}
|
||||||
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
||||||
r *= Global::ambientDayLight[ 0 ]; // w zaleźności od koloru swiatła
|
r *= Global::ambientDayLight[ 0 ]; // w zaleźności od koloru swiatła
|
||||||
@@ -332,8 +332,8 @@ void TTraction::RenderDL(float mgn) // McZapkie: mgn to odleglosc od obserwatora
|
|||||||
g *= Global::DayLight.ambient[ 1 ];
|
g *= Global::DayLight.ambient[ 1 ];
|
||||||
b *= Global::DayLight.ambient[2];
|
b *= Global::DayLight.ambient[2];
|
||||||
#endif
|
#endif
|
||||||
if (linealpha > 1.0)
|
if (linealpha > 1.0f)
|
||||||
linealpha = 1.0; // trzeba ograniczyć do <=1
|
linealpha = 1.0f; // trzeba ograniczyć do <=1
|
||||||
glColor4f(r, g, b, linealpha);
|
glColor4f(r, g, b, linealpha);
|
||||||
if (!uiDisplayList)
|
if (!uiDisplayList)
|
||||||
Optimize(); // generowanie DL w miarę potrzeby
|
Optimize(); // generowanie DL w miarę potrzeby
|
||||||
@@ -475,8 +475,8 @@ void TTraction::RenderVBO(float mgn, int iPtr)
|
|||||||
if (!Global::bSmoothTraction)
|
if (!Global::bSmoothTraction)
|
||||||
glDisable(GL_LINE_SMOOTH); // na liniach kiepsko wygląda - robi gradient
|
glDisable(GL_LINE_SMOOTH); // na liniach kiepsko wygląda - robi gradient
|
||||||
float linealpha = 5000 * WireThickness / (mgn + 1.0); //*WireThickness
|
float linealpha = 5000 * WireThickness / (mgn + 1.0); //*WireThickness
|
||||||
if (linealpha > 1.2)
|
if (linealpha > 1.2f)
|
||||||
linealpha = 1.2; // zbyt grube nie są dobre
|
linealpha = 1.2f; // zbyt grube nie są dobre
|
||||||
glLineWidth(linealpha);
|
glLineWidth(linealpha);
|
||||||
// McZapkie-261102: kolor zalezy od materialu i zasniedzenia
|
// McZapkie-261102: kolor zalezy od materialu i zasniedzenia
|
||||||
float r, g, b;
|
float r, g, b;
|
||||||
@@ -486,51 +486,51 @@ void TTraction::RenderVBO(float mgn, int iPtr)
|
|||||||
case 1:
|
case 1:
|
||||||
if (TestFlag(DamageFlag, 1))
|
if (TestFlag(DamageFlag, 1))
|
||||||
{
|
{
|
||||||
r = 0.00000;
|
r = 0.00000f;
|
||||||
g = 0.32549;
|
g = 0.32549f;
|
||||||
b = 0.2882353; // zielona miedź
|
b = 0.2882353f; // zielona miedź
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = 0.35098;
|
r = 0.35098f;
|
||||||
g = 0.22549;
|
g = 0.22549f;
|
||||||
b = 0.1; // czerwona miedź
|
b = 0.1f; // czerwona miedź
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (TestFlag(DamageFlag, 1))
|
if (TestFlag(DamageFlag, 1))
|
||||||
{
|
{
|
||||||
r = 0.10;
|
r = 0.10f;
|
||||||
g = 0.10;
|
g = 0.10f;
|
||||||
b = 0.10; // czarne Al
|
b = 0.10f; // czarne Al
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r = 0.25;
|
r = 0.25f;
|
||||||
g = 0.25;
|
g = 0.25f;
|
||||||
b = 0.25; // srebrne Al
|
b = 0.25f; // srebrne Al
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// tymczasowo pokazanie zasilanych odcinków
|
// tymczasowo pokazanie zasilanych odcinków
|
||||||
case 4:
|
case 4:
|
||||||
r = 0.5;
|
r = 0.5f;
|
||||||
g = 0.5;
|
g = 0.5f;
|
||||||
b = 1.0;
|
b = 1.0f;
|
||||||
break; // niebieskie z podłączonym zasilaniem
|
break; // niebieskie z podłączonym zasilaniem
|
||||||
case 5:
|
case 5:
|
||||||
r = 1.0;
|
r = 1.0f;
|
||||||
g = 0.0;
|
g = 0.0f;
|
||||||
b = 0.0;
|
b = 0.0f;
|
||||||
break; // czerwone z podłączonym zasilaniem 1
|
break; // czerwone z podłączonym zasilaniem 1
|
||||||
case 6:
|
case 6:
|
||||||
r = 0.0;
|
r = 0.0f;
|
||||||
g = 1.0;
|
g = 1.0f;
|
||||||
b = 0.0;
|
b = 0.0f;
|
||||||
break; // zielone z podłączonym zasilaniem 2
|
break; // zielone z podłączonym zasilaniem 2
|
||||||
case 7:
|
case 7:
|
||||||
r = 1.0;
|
r = 1.0f;
|
||||||
g = 1.0;
|
g = 1.0f;
|
||||||
b = 0.0;
|
b = 0.0f;
|
||||||
break; //żółte z podłączonym zasilaniem z obu stron
|
break; //żółte z podłączonym zasilaniem z obu stron
|
||||||
}
|
}
|
||||||
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
||||||
@@ -542,8 +542,8 @@ void TTraction::RenderVBO(float mgn, int iPtr)
|
|||||||
g *= Global::DayLight.ambient[ 1 ];
|
g *= Global::DayLight.ambient[ 1 ];
|
||||||
b *= Global::DayLight.ambient[ 2 ];
|
b *= Global::DayLight.ambient[ 2 ];
|
||||||
#endif
|
#endif
|
||||||
if (linealpha > 1.0)
|
if (linealpha > 1.0f)
|
||||||
linealpha = 1.0; // trzeba ograniczyć do <=1
|
linealpha = 1.0f; // trzeba ograniczyć do <=1
|
||||||
glColor4f(r, g, b, linealpha);
|
glColor4f(r, g, b, linealpha);
|
||||||
glDrawArrays(GL_LINES, iPtr, iLines);
|
glDrawArrays(GL_LINES, iPtr, iLines);
|
||||||
glLineWidth(1.0);
|
glLineWidth(1.0);
|
||||||
@@ -680,7 +680,7 @@ double TTraction::VoltageGet(double u, double i)
|
|||||||
return psPowered->CurrentGet(res) *
|
return psPowered->CurrentGet(res) *
|
||||||
res; // yB: dla zasilanego nie baw się w gwiazdy, tylko bierz bezpośrednio
|
res; // yB: dla zasilanego nie baw się w gwiazdy, tylko bierz bezpośrednio
|
||||||
double r0t, r1t, r0g, r1g;
|
double r0t, r1t, r0g, r1g;
|
||||||
double u0, u1, i0, i1;
|
double i0, i1;
|
||||||
r0t = fResistance[0]; //średni pomysł, ale lepsze niż nic
|
r0t = fResistance[0]; //średni pomysł, ale lepsze niż nic
|
||||||
r1t = fResistance[1]; // bo nie uwzględnia spadków z innych pojazdów
|
r1t = fResistance[1]; // bo nie uwzględnia spadków z innych pojazdów
|
||||||
if (psPower[0] && psPower[1])
|
if (psPower[0] && psPower[1])
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "VBO.h"
|
#include "VBO.h"
|
||||||
#include "dumb3d.h"
|
#include "dumb3d.h"
|
||||||
|
|
||||||
|
|||||||
74
Train.cpp
74
Train.cpp
@@ -776,7 +776,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
|||||||
dsbSwitch->Play(0, 0, 0);
|
dsbSwitch->Play(0, 0, 0);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (Console::Pressed(VK_CONTROL))
|
if (Global::ctrlState)
|
||||||
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
||||||
if (iCabLightFlag<2) ++iCabLightFlag; //zapalenie
|
if (iCabLightFlag<2) ++iCabLightFlag; //zapalenie
|
||||||
}
|
}
|
||||||
@@ -1369,7 +1369,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
|||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_Brake0])
|
else if (cKey == Global::Keys[k_Brake0])
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
mvOccupied->BrakeCtrlPos2 = 0; // wyrownaj kapturek
|
mvOccupied->BrakeCtrlPos2 = 0; // wyrownaj kapturek
|
||||||
}
|
}
|
||||||
@@ -1431,7 +1431,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
|||||||
else if (cKey == Global::Keys[k_Fuse])
|
else if (cKey == Global::Keys[k_Fuse])
|
||||||
//---------------
|
//---------------
|
||||||
{
|
{
|
||||||
if( Global::ctrlState ) // z controlem
|
if (Global::ctrlState) // z controlem
|
||||||
{
|
{
|
||||||
ggConverterFuseButton.PutValue(1); // hunter-261211
|
ggConverterFuseButton.PutValue(1); // hunter-261211
|
||||||
if ((mvControlled->Mains == false) && (ggConverterButton.GetValue() == 0) &&
|
if ((mvControlled->Mains == false) && (ggConverterButton.GetValue() == 0) &&
|
||||||
@@ -1472,7 +1472,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
|||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_DirectionBackward]) // r
|
else if (cKey == Global::Keys[k_DirectionBackward]) // r
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{ // wciśnięty [Ctrl]
|
{ // wciśnięty [Ctrl]
|
||||||
if (mvOccupied->Radio == true)
|
if (mvOccupied->Radio == true)
|
||||||
{
|
{
|
||||||
@@ -1554,7 +1554,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
|||||||
int CouplNr = -2;
|
int CouplNr = -2;
|
||||||
if (!FreeFlyModeFlag)
|
if (!FreeFlyModeFlag)
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
if (mvOccupied->BrakeDelaySwitch(bdelay_R))
|
if (mvOccupied->BrakeDelaySwitch(bdelay_R))
|
||||||
{
|
{
|
||||||
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
||||||
@@ -1581,7 +1581,7 @@ if ((mvControlled->PantFrontVolt) || (mvControlled->PantRearVolt) ||
|
|||||||
}
|
}
|
||||||
if (temp)
|
if (temp)
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
if (temp->MoverParameters->BrakeDelaySwitch(bdelay_R))
|
if (temp->MoverParameters->BrakeDelaySwitch(bdelay_R))
|
||||||
{
|
{
|
||||||
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
dsbPneumaticRelay->SetVolume(DSBVOLUME_MAX);
|
||||||
@@ -1838,9 +1838,8 @@ if
|
|||||||
ctrain_pneumatic))
|
ctrain_pneumatic))
|
||||||
{
|
{
|
||||||
rsHiss.Play(1, DSBPLAY_LOOPING, true, tmp->GetPosition());
|
rsHiss.Play(1, DSBPLAY_LOOPING, true, tmp->GetPosition());
|
||||||
DynamicObject->SetPneumatic(CouplNr,
|
DynamicObject->SetPneumatic(CouplNr != 0, true); // Ra: to mi się nie podoba !!!!
|
||||||
1); // Ra: to mi się nie podoba !!!!
|
tmp->SetPneumatic(CouplNr != 0, true);
|
||||||
tmp->SetPneumatic(CouplNr, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag,
|
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag,
|
||||||
@@ -1860,9 +1859,8 @@ if
|
|||||||
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
||||||
dsbCouplerDetach->SetVolume(DSBVOLUME_MAX);
|
dsbCouplerDetach->SetVolume(DSBVOLUME_MAX);
|
||||||
dsbCouplerDetach->Play(0, 0, 0);
|
dsbCouplerDetach->Play(0, 0, 0);
|
||||||
DynamicObject->SetPneumatic(CouplNr,
|
DynamicObject->SetPneumatic(CouplNr != 0, false); // Ra: to mi się nie podoba !!!!
|
||||||
0); // Ra: to mi się nie podoba !!!!
|
tmp->SetPneumatic(CouplNr != 0, false);
|
||||||
tmp->SetPneumatic(CouplNr, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag,
|
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag,
|
||||||
@@ -1900,8 +1898,8 @@ if
|
|||||||
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
||||||
dsbCouplerDetach->SetVolume(DSBVOLUME_MAX);
|
dsbCouplerDetach->SetVolume(DSBVOLUME_MAX);
|
||||||
dsbCouplerDetach->Play(0, 0, 0);
|
dsbCouplerDetach->Play(0, 0, 0);
|
||||||
DynamicObject->SetPneumatic(CouplNr, 0);
|
DynamicObject->SetPneumatic(CouplNr != 0, false);
|
||||||
tmp->SetPneumatic(CouplNr, 0);
|
tmp->SetPneumatic(CouplNr != 0, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1983,7 +1981,7 @@ if
|
|||||||
// przyciemnienia pod Univ4)
|
// przyciemnienia pod Univ4)
|
||||||
else if (cKey == Global::Keys[k_Univ3])
|
else if (cKey == Global::Keys[k_Univ3])
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
if (bCabLight == true) //(ggCabLightButton.GetValue()!=0)
|
if (bCabLight == true) //(ggCabLightButton.GetValue()!=0)
|
||||||
{
|
{
|
||||||
@@ -1999,7 +1997,7 @@ if
|
|||||||
dsbSwitch->Play(0, 0, 0);
|
dsbSwitch->Play(0, 0, 0);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (Console::Pressed(VK_CONTROL))
|
if (Global::ctrlState)
|
||||||
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
||||||
if (iCabLightFlag) --iCabLightFlag; //gaszenie
|
if (iCabLightFlag) --iCabLightFlag; //gaszenie
|
||||||
} */
|
} */
|
||||||
@@ -2010,7 +2008,7 @@ if
|
|||||||
// hunter-091012: dzwiek dla przyciemnienia swiatelka w kabinie
|
// hunter-091012: dzwiek dla przyciemnienia swiatelka w kabinie
|
||||||
else if (cKey == Global::Keys[k_Univ4])
|
else if (cKey == Global::Keys[k_Univ4])
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
if (bCabLightDim == true) //(ggCabLightDimButton.GetValue()!=0)
|
if (bCabLightDim == true) //(ggCabLightDimButton.GetValue()!=0)
|
||||||
{
|
{
|
||||||
@@ -2091,7 +2089,7 @@ if
|
|||||||
{
|
{
|
||||||
if (false == (mvOccupied->LightsPosNo > 0))
|
if (false == (mvOccupied->LightsPosNo > 0))
|
||||||
{
|
{
|
||||||
if( ( Global::ctrlState ) &&
|
if ((Global::ctrlState) &&
|
||||||
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
(ggRearLeftLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||||
@@ -2204,7 +2202,7 @@ if
|
|||||||
SetLights();
|
SetLights();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( ( Global::ctrlState ) &&
|
else if ((Global::ctrlState) &&
|
||||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||||
{
|
{
|
||||||
//------------------------------
|
//------------------------------
|
||||||
@@ -2258,7 +2256,7 @@ if
|
|||||||
{
|
{
|
||||||
if (false == (mvOccupied->LightsPosNo > 0))
|
if (false == (mvOccupied->LightsPosNo > 0))
|
||||||
{
|
{
|
||||||
if( ( Global::ctrlState ) &&
|
if ((Global::ctrlState) &&
|
||||||
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
(ggRearRightLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||||
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
// 17.02.17 changed rear to opposite side, so the same key actually controls both lights on the left side, from the driver's point of view
|
||||||
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
// TODO: do it a more elegant way. preferably along with the rest of the controlling code
|
||||||
@@ -2398,7 +2396,7 @@ if
|
|||||||
right *= -1.0f;
|
right *= -1.0f;
|
||||||
}
|
}
|
||||||
// if (!GetAsyncKeyState(VK_SHIFT)<0) // bez shifta
|
// if (!GetAsyncKeyState(VK_SHIFT)<0) // bez shifta
|
||||||
if( !Global::ctrlState ) // gdy [Ctrl] zwolniony (dodatkowe widoki)
|
if (!Global::ctrlState) // gdy [Ctrl] zwolniony (dodatkowe widoki)
|
||||||
{
|
{
|
||||||
if (cKey == Global::Keys[k_MechLeft])
|
if (cKey == Global::Keys[k_MechLeft])
|
||||||
{
|
{
|
||||||
@@ -4428,7 +4426,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if (
|
// if (
|
||||||
// Console::Pressed(VK_SHIFT)&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
// Global::shiftState&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
||||||
// ) //NBMX 14-09-2003: sprezarka wl
|
// ) //NBMX 14-09-2003: sprezarka wl
|
||||||
if (Global::shiftState && Console::Pressed(Global::Keys[k_Compressor]) &&
|
if (Global::shiftState && Console::Pressed(Global::Keys[k_Compressor]) &&
|
||||||
(mvControlled->CompressorPower < 2)) // hunter-091012: tak jest poprawnie
|
(mvControlled->CompressorPower < 2)) // hunter-091012: tak jest poprawnie
|
||||||
@@ -4448,7 +4446,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if (
|
// if (
|
||||||
// !Console::Pressed(VK_SHIFT)&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
// !Global::shiftState&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
||||||
// ) //NBMX 14-09-2003: sprezarka wl
|
// ) //NBMX 14-09-2003: sprezarka wl
|
||||||
if (!Global::shiftState && Console::Pressed(Global::Keys[k_Compressor]) &&
|
if (!Global::shiftState && Console::Pressed(Global::Keys[k_Compressor]) &&
|
||||||
(mvControlled->CompressorPower < 2)) // hunter-091012: tak jest poprawnie
|
(mvControlled->CompressorPower < 2)) // hunter-091012: tak jest poprawnie
|
||||||
@@ -4509,7 +4507,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
if (!DebugModeFlag)
|
if (!DebugModeFlag)
|
||||||
{
|
{
|
||||||
if (ggUniversal1Button.SubModel)
|
if (ggUniversal1Button.SubModel)
|
||||||
if( Global::shiftState )
|
if (Global::shiftState)
|
||||||
ggUniversal1Button.IncValue(dt / 2);
|
ggUniversal1Button.IncValue(dt / 2);
|
||||||
else
|
else
|
||||||
ggUniversal1Button.DecValue(dt / 2);
|
ggUniversal1Button.DecValue(dt / 2);
|
||||||
@@ -4525,7 +4523,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
if (!DebugModeFlag)
|
if (!DebugModeFlag)
|
||||||
{
|
{
|
||||||
if (ggUniversal2Button.SubModel)
|
if (ggUniversal2Button.SubModel)
|
||||||
if( Global::shiftState )
|
if (Global::shiftState)
|
||||||
ggUniversal2Button.IncValue(dt / 2);
|
ggUniversal2Button.IncValue(dt / 2);
|
||||||
else
|
else
|
||||||
ggUniversal2Button.DecValue(dt / 2);
|
ggUniversal2Button.DecValue(dt / 2);
|
||||||
@@ -4535,7 +4533,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// hunter-091012: zrobione z uwzglednieniem przelacznika swiatla
|
// hunter-091012: zrobione z uwzglednieniem przelacznika swiatla
|
||||||
if (Console::Pressed(Global::Keys[k_Univ3]))
|
if (Console::Pressed(Global::Keys[k_Univ3]))
|
||||||
{
|
{
|
||||||
if( Global::shiftState )
|
if (Global::shiftState)
|
||||||
{
|
{
|
||||||
if (Global::ctrlState)
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
@@ -4591,10 +4589,10 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
if (ggUniversal3Button.SubModel)
|
if (ggUniversal3Button.SubModel)
|
||||||
|
|
||||||
|
|
||||||
if (Console::Pressed(VK_CONTROL))
|
if (Global::ctrlState)
|
||||||
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
{//z [Ctrl] zapalamy albo gasimy światełko w kabinie
|
||||||
//tutaj jest bez sensu, trzeba reagować na wciskanie klawisza!
|
//tutaj jest bez sensu, trzeba reagować na wciskanie klawisza!
|
||||||
if (Console::Pressed(VK_SHIFT))
|
if (Global::shiftState)
|
||||||
{//zapalenie
|
{//zapalenie
|
||||||
if (iCabLightFlag<2) ++iCabLightFlag;
|
if (iCabLightFlag<2) ++iCabLightFlag;
|
||||||
}
|
}
|
||||||
@@ -4606,7 +4604,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//bez [Ctrl] przełączamy cośtem
|
{//bez [Ctrl] przełączamy cośtem
|
||||||
if (Console::Pressed(VK_SHIFT))
|
if (Global::shiftState)
|
||||||
{
|
{
|
||||||
ggUniversal3Button.PutValue(1); //hunter-131211: z UpdateValue na
|
ggUniversal3Button.PutValue(1); //hunter-131211: z UpdateValue na
|
||||||
PutValue - by zachowywal sie jak pozostale przelaczniki
|
PutValue - by zachowywal sie jak pozostale przelaczniki
|
||||||
@@ -4647,7 +4645,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
if (Console::Pressed(Global::Keys[k_Univ4]))
|
if (Console::Pressed(Global::Keys[k_Univ4]))
|
||||||
{
|
{
|
||||||
if (ggUniversal4Button.SubModel)
|
if (ggUniversal4Button.SubModel)
|
||||||
if (Console::Pressed(VK_SHIFT))
|
if (Global::shiftState)
|
||||||
{
|
{
|
||||||
ActiveUniversal4=true;
|
ActiveUniversal4=true;
|
||||||
//ggUniversal4Button.UpdateValue(1);
|
//ggUniversal4Button.UpdateValue(1);
|
||||||
@@ -4664,7 +4662,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// swiatla
|
// swiatla
|
||||||
if (Console::Pressed(Global::Keys[k_Univ4]))
|
if (Console::Pressed(Global::Keys[k_Univ4]))
|
||||||
{
|
{
|
||||||
if( Global::shiftState )
|
if (Global::shiftState)
|
||||||
{
|
{
|
||||||
if (Global::ctrlState)
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
@@ -4737,7 +4735,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// ((mvOccupied->BrakeHandle==FV4a)&&(Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
// ((mvOccupied->BrakeHandle==FV4a)&&(Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
||||||
if ((Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
if ((Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
// mvOccupied->BrakeCtrlPos2+=(mvOccupied->BrakeCtrlPos2>2?0:dt/20.0);
|
// mvOccupied->BrakeCtrlPos2+=(mvOccupied->BrakeCtrlPos2>2?0:dt/20.0);
|
||||||
// if (mvOccupied->BrakeCtrlPos2<-3) mvOccupied->BrakeCtrlPos2=-3;
|
// if (mvOccupied->BrakeCtrlPos2<-3) mvOccupied->BrakeCtrlPos2=-3;
|
||||||
@@ -4753,7 +4751,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|
|
||||||
if ((mvOccupied->BrakeHandle == FV4a) && (Console::Pressed(Global::Keys[k_IncBrakeLevel])))
|
if ((mvOccupied->BrakeHandle == FV4a) && (Console::Pressed(Global::Keys[k_IncBrakeLevel])))
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
mvOccupied->BrakeCtrlPos2 -= dt / 20.0;
|
mvOccupied->BrakeCtrlPos2 -= dt / 20.0;
|
||||||
if (mvOccupied->BrakeCtrlPos2 < -1.5)
|
if (mvOccupied->BrakeCtrlPos2 < -1.5)
|
||||||
@@ -4770,7 +4768,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|
|
||||||
if ((mvOccupied->BrakeHandle == FV4a) && (Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
if ((mvOccupied->BrakeHandle == FV4a) && (Console::Pressed(Global::Keys[k_DecBrakeLevel])))
|
||||||
{
|
{
|
||||||
if( Global::ctrlState )
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
mvOccupied->BrakeCtrlPos2 += (mvOccupied->BrakeCtrlPos2 > 2 ? 0 : dt / 20.0);
|
mvOccupied->BrakeCtrlPos2 += (mvOccupied->BrakeCtrlPos2 > 2 ? 0 : dt / 20.0);
|
||||||
if (mvOccupied->BrakeCtrlPos2 < -3)
|
if (mvOccupied->BrakeCtrlPos2 < -3)
|
||||||
@@ -4851,7 +4849,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
if (Global::shiftState)
|
if (Global::shiftState)
|
||||||
{
|
{
|
||||||
// if (Console::Pressed(k_CurrentNext))
|
// if (Console::Pressed(k_CurrentNext))
|
||||||
{ // Ra: było pod VK_F3
|
{ // Ra: było pod GLFW_KEY_F3
|
||||||
if ((mvOccupied->EpFuseSwitch(true)))
|
if ((mvOccupied->EpFuseSwitch(true)))
|
||||||
{
|
{
|
||||||
dsbPneumaticSwitch->SetVolume(-10);
|
dsbPneumaticSwitch->SetVolume(-10);
|
||||||
@@ -4862,7 +4860,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if (Console::Pressed(k_CurrentNext))
|
// if (Console::Pressed(k_CurrentNext))
|
||||||
{ // Ra: było pod VK_F3
|
{ // Ra: było pod GLFW_KEY_F3
|
||||||
if (Global::ctrlState)
|
if (Global::ctrlState)
|
||||||
{
|
{
|
||||||
if ((mvOccupied->EpFuseSwitch(false)))
|
if ((mvOccupied->EpFuseSwitch(false)))
|
||||||
@@ -4905,7 +4903,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|
|
||||||
if (Console::Pressed(Global::Keys[k_PantRearUp]))
|
if (Console::Pressed(Global::Keys[k_PantRearUp]))
|
||||||
{
|
{
|
||||||
if( Global::shiftState )
|
if (Global::shiftState)
|
||||||
ggPantRearButton.PutValue(1);
|
ggPantRearButton.PutValue(1);
|
||||||
else
|
else
|
||||||
ggPantFrontButtonOff.PutValue(1);
|
ggPantFrontButtonOff.PutValue(1);
|
||||||
@@ -5105,7 +5103,6 @@ bool TTrain::CabChange(int iDirection)
|
|||||||
// wczytywanie pliku z danymi multimedialnymi (dzwieki, kontrolki, kabiny)
|
// wczytywanie pliku z danymi multimedialnymi (dzwieki, kontrolki, kabiny)
|
||||||
bool TTrain::LoadMMediaFile(std::string const &asFileName)
|
bool TTrain::LoadMMediaFile(std::string const &asFileName)
|
||||||
{
|
{
|
||||||
double dSDist;
|
|
||||||
cParser parser(asFileName, cParser::buffer_FILE);
|
cParser parser(asFileName, cParser::buffer_FILE);
|
||||||
// NOTE: yaml-style comments are disabled until conflict in use of # is resolved
|
// NOTE: yaml-style comments are disabled until conflict in use of # is resolved
|
||||||
// parser.addCommentStyle( "#", "\n" );
|
// parser.addCommentStyle( "#", "\n" );
|
||||||
@@ -5412,7 +5409,6 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
|
|||||||
pyScreens.reset(this);
|
pyScreens.reset(this);
|
||||||
pyScreens.setLookupPath(DynamicObject->asBaseDir);
|
pyScreens.setLookupPath(DynamicObject->asBaseDir);
|
||||||
bool parse = false;
|
bool parse = false;
|
||||||
double dSDist;
|
|
||||||
int cabindex = 0;
|
int cabindex = 0;
|
||||||
DynamicObject->mdKabina = NULL; // likwidacja wskaźnika na dotychczasową kabinę
|
DynamicObject->mdKabina = NULL; // likwidacja wskaźnika na dotychczasową kabinę
|
||||||
switch (NewCabNo)
|
switch (NewCabNo)
|
||||||
|
|||||||
4
Train.h
4
Train.h
@@ -32,10 +32,10 @@ const int maxcab = 2;
|
|||||||
|
|
||||||
// const double fCzuwakTime= 90.0f;
|
// const double fCzuwakTime= 90.0f;
|
||||||
const double fCzuwakBlink = 0.15;
|
const double fCzuwakBlink = 0.15;
|
||||||
const float fConverterPrzekaznik = 1.5; // hunter-261211: do przekaznika nadmiarowego przetwornicy
|
const float fConverterPrzekaznik = 1.5f; // hunter-261211: do przekaznika nadmiarowego przetwornicy
|
||||||
// 0.33f
|
// 0.33f
|
||||||
// const double fBuzzerTime= 5.0f;
|
// const double fBuzzerTime= 5.0f;
|
||||||
const float fHaslerTime = 1.2;
|
const float fHaslerTime = 1.2f;
|
||||||
|
|
||||||
// const double fStycznTime= 0.5f;
|
// const double fStycznTime= 0.5f;
|
||||||
// const double fDblClickTime= 0.2f;
|
// const double fDblClickTime= 0.2f;
|
||||||
|
|||||||
@@ -303,8 +303,8 @@ bool TTrackFollower::ComputatePosition()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if RENDER_CONE
|
#if RENDER_CONE
|
||||||
#include "opengl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "opengl/glut.h"
|
#include "GL/glut.h"
|
||||||
void TTrackFollower::Render(float fNr)
|
void TTrackFollower::Render(float fNr)
|
||||||
{ // funkcja rysująca stożek w miejscu osi
|
{ // funkcja rysująca stożek w miejscu osi
|
||||||
glPushMatrix(); // matryca kamery
|
glPushMatrix(); // matryca kamery
|
||||||
|
|||||||
30
VBO.cpp
30
VBO.cpp
@@ -9,9 +9,39 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "VBO.h"
|
#include "VBO.h"
|
||||||
|
#include "GL/glew.h"
|
||||||
#include "usefull.h"
|
#include "usefull.h"
|
||||||
|
#include "sn_utils.h"
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void CVertNormTex::deserialize(std::istream &s)
|
||||||
|
{
|
||||||
|
x = sn_utils::ld_float32(s);
|
||||||
|
y = sn_utils::ld_float32(s);
|
||||||
|
z = sn_utils::ld_float32(s);
|
||||||
|
|
||||||
|
nx = sn_utils::ld_float32(s);
|
||||||
|
ny = sn_utils::ld_float32(s);
|
||||||
|
nz = sn_utils::ld_float32(s);
|
||||||
|
|
||||||
|
u = sn_utils::ld_float32(s);
|
||||||
|
v = sn_utils::ld_float32(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVertNormTex::serialize(std::ostream &s)
|
||||||
|
{
|
||||||
|
sn_utils::ls_float32(s, x);
|
||||||
|
sn_utils::ls_float32(s, y);
|
||||||
|
sn_utils::ls_float32(s, z);
|
||||||
|
|
||||||
|
sn_utils::ls_float32(s, nx);
|
||||||
|
sn_utils::ls_float32(s, ny);
|
||||||
|
sn_utils::ls_float32(s, nz);
|
||||||
|
|
||||||
|
sn_utils::ls_float32(s, u);
|
||||||
|
sn_utils::ls_float32(s, v);
|
||||||
|
}
|
||||||
|
|
||||||
CMesh::CMesh()
|
CMesh::CMesh()
|
||||||
{ // utworzenie pustego obiektu
|
{ // utworzenie pustego obiektu
|
||||||
m_pVNT = nullptr;
|
m_pVNT = nullptr;
|
||||||
|
|||||||
3
VBO.h
3
VBO.h
@@ -21,6 +21,9 @@ class CVertNormTex
|
|||||||
float nz = 0.0; // Z wektora normalnego
|
float nz = 0.0; // Z wektora normalnego
|
||||||
float u = 0.0; // U mapowania
|
float u = 0.0; // U mapowania
|
||||||
float v = 0.0; // V mapowania
|
float v = 0.0; // V mapowania
|
||||||
|
|
||||||
|
void deserialize(std::istream&);
|
||||||
|
void serialize(std::ostream&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMesh
|
class CMesh
|
||||||
|
|||||||
1
World.h
1
World.h
@@ -9,6 +9,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Ground.h"
|
#include "Ground.h"
|
||||||
|
|||||||
4
color.h
4
color.h
@@ -7,9 +7,9 @@ float3
|
|||||||
XYZtoRGB( float3 const &XYZ ) {
|
XYZtoRGB( float3 const &XYZ ) {
|
||||||
|
|
||||||
// M^-1 for Adobe RGB from http://www.brucelindbloom.com/Eqn_RGB_XYZ_Matrix.html
|
// M^-1 for Adobe RGB from http://www.brucelindbloom.com/Eqn_RGB_XYZ_Matrix.html
|
||||||
float const mi[ 3 ][ 3 ] = { 2.041369, -0.969266, 0.0134474, -0.5649464, 1.8760108, -0.1183897, -0.3446944, 0.041556, 1.0154096 };
|
float const mi[ 3 ][ 3 ] = { 2.041369f, -0.969266f, 0.0134474f, -0.5649464f, 1.8760108f, -0.1183897f, -0.3446944f, 0.041556f, 1.0154096f };
|
||||||
// m^-1 for sRGB:
|
// m^-1 for sRGB:
|
||||||
// float const mi[ 3 ][ 3 ] = { 3.240479, -0.969256, 0.055648, -1.53715, 1.875991, -0.204043, -0.49853, 0.041556, 1.057311 };
|
// float const mi[ 3 ][ 3 ] = { 3.240479f, -0.969256f, 0.055648f, -1.53715f, 1.875991f, -0.204043f, -0.49853f, 0.041556f, 1.057311f };
|
||||||
|
|
||||||
return float3{
|
return float3{
|
||||||
XYZ.x*mi[ 0 ][ 0 ] + XYZ.y*mi[ 1 ][ 0 ] + XYZ.z*mi[ 2 ][ 0 ],
|
XYZ.x*mi[ 0 ][ 0 ] + XYZ.y*mi[ 1 ][ 0 ] + XYZ.z*mi[ 2 ][ 0 ],
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#ifndef GeometryH
|
#ifndef GeometryH
|
||||||
#define GeometryH
|
#define GeometryH
|
||||||
|
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "dumb3d.h"
|
#include "dumb3d.h"
|
||||||
using namespace Math3D;
|
using namespace Math3D;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !(bool)ConversionError;
|
return ConversionError == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMTableTime::UpdateMTableTime(double deltaT)
|
void TMTableTime::UpdateMTableTime(double deltaT)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ cParser::~cParser()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool cParser::getTokens(int Count, bool ToLower, const char *Break)
|
bool cParser::getTokens(unsigned int Count, bool ToLower, const char *Break)
|
||||||
{
|
{
|
||||||
tokens.clear(); // emulates old parser behaviour. TODO, TBD: allow manual reset?
|
tokens.clear(); // emulates old parser behaviour. TODO, TBD: allow manual reset?
|
||||||
/*
|
/*
|
||||||
@@ -79,7 +79,7 @@ bool cParser::getTokens(int Count, bool ToLower, const char *Break)
|
|||||||
this->str("");
|
this->str("");
|
||||||
this->clear();
|
this->clear();
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < Count; ++i)
|
for (unsigned int i = 0; i < Count; ++i)
|
||||||
{
|
{
|
||||||
std::string token = readToken(ToLower, Break);
|
std::string token = readToken(ToLower, Break);
|
||||||
if( true == token.empty() ) {
|
if( true == token.empty() ) {
|
||||||
|
|||||||
2
parser.h
2
parser.h
@@ -77,7 +77,7 @@ class cParser //: public std::stringstream
|
|||||||
{
|
{
|
||||||
return !mStream->fail();
|
return !mStream->fail();
|
||||||
};
|
};
|
||||||
bool getTokens(int Count = 1, bool ToLower = true, const char *Break = "\n\r\t ;");
|
bool getTokens(unsigned int Count = 1, bool ToLower = true, const char *Break = "\n\r\t ;");
|
||||||
// returns percentage of file processed so far
|
// returns percentage of file processed so far
|
||||||
int getProgress() const;
|
int getProgress() const;
|
||||||
// add custom definition of text which should be ignored when retrieving tokens
|
// add custom definition of text which should be ignored when retrieving tokens
|
||||||
|
|||||||
17
python_var_doc.md
Normal file
17
python_var_doc.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
| nazwa | typ | opis |
|
||||||
|
|------------------------|-------|------------------------------------------------------------|
|
||||||
|
| direction | int | kiernek jazdy (-1: do tyłu, 0: żaden, 1: do przodu) |
|
||||||
|
| slipping_wheels | bool | poślizg |
|
||||||
|
| converter | bool | działanie przetwornicy |
|
||||||
|
| main_ctrl_actual_pos | int | numer pozycji nastawnika (wskaźnik RList) |
|
||||||
|
| scnd_ctrl_actual_pos | int | numer pozycji bocznika (wskaźnik MotorParam) |
|
||||||
|
| fuse | bool | wyłącznik szybki (bezpiecznik nadmiarowy) |
|
||||||
|
| converter_overload | bool | wyłącznik nadmiarowy przetwornicy i ogrzewania |
|
||||||
|
| voltage | float | napięcie w sieci |
|
||||||
|
| velocity | float | aktualna prędkość |
|
||||||
|
| im | float | prąd silnika |
|
||||||
|
| compress | bool | działanie sprężarki |
|
||||||
|
| hours | int | aktualny czas |
|
||||||
|
| minutes | int | aktualny czas |
|
||||||
|
| seconds | int | aktualny czas |
|
||||||
|
| velocity_desired | float | prędkosć zadana |
|
||||||
@@ -35,7 +35,7 @@ opengl_renderer::Init() {
|
|||||||
void
|
void
|
||||||
opengl_renderer::Update_Lights( light_array const &Lights ) {
|
opengl_renderer::Update_Lights( light_array const &Lights ) {
|
||||||
|
|
||||||
int const count = std::min( m_lights.size(), Lights.data.size() );
|
size_t const count = std::min( m_lights.size(), Lights.data.size() );
|
||||||
if( count == 0 ) { return; }
|
if( count == 0 ) { return; }
|
||||||
|
|
||||||
auto renderlight = m_lights.begin();
|
auto renderlight = m_lights.begin();
|
||||||
@@ -86,9 +86,9 @@ opengl_renderer::Update_Lights( light_array const &Lights ) {
|
|||||||
void
|
void
|
||||||
opengl_renderer::Disable_Lights() {
|
opengl_renderer::Disable_Lights() {
|
||||||
|
|
||||||
for( int idx = 0; idx < m_lights.size() + 1; ++idx ) {
|
for( size_t idx = 0; idx < m_lights.size() + 1; ++idx ) {
|
||||||
|
|
||||||
::glDisable( GL_LIGHT0 + idx );
|
::glDisable( GL_LIGHT0 + (int)idx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "lightarray.h"
|
#include "lightarray.h"
|
||||||
#include "dumb3d.h"
|
#include "dumb3d.h"
|
||||||
|
|
||||||
struct opengl_light {
|
struct opengl_light {
|
||||||
|
|
||||||
GLuint id{ -1 };
|
GLuint id{ (GLuint)-1 };
|
||||||
Math3D::vector3 direction;
|
Math3D::vector3 direction;
|
||||||
GLfloat position[ 4 ]; // 4th parameter specifies directional(0) or omni-directional(1) light source
|
GLfloat position[ 4 ]; // 4th parameter specifies directional(0) or omni-directional(1) light source
|
||||||
GLfloat ambient[ 4 ];
|
GLfloat ambient[ 4 ];
|
||||||
@@ -42,7 +42,7 @@ struct opengl_light {
|
|||||||
|
|
||||||
glLightfv( id, GL_POSITION, position );
|
glLightfv( id, GL_POSITION, position );
|
||||||
if( position[ 3 ] == 1.0f ) {
|
if( position[ 3 ] == 1.0f ) {
|
||||||
GLfloat directionarray[] = { direction.x, direction.y, direction.z };
|
GLfloat directionarray[] = { (GLfloat)direction.x, (GLfloat)direction.y, (GLfloat)direction.z };
|
||||||
glLightfv( id, GL_SPOT_DIRECTION, directionarray );
|
glLightfv( id, GL_SPOT_DIRECTION, directionarray );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ private:
|
|||||||
std::vector<std::uint16_t> m_indices;
|
std::vector<std::uint16_t> m_indices;
|
||||||
// std::vector<float3> m_normals;
|
// std::vector<float3> m_normals;
|
||||||
std::vector<float3> m_colours;
|
std::vector<float3> m_colours;
|
||||||
GLuint m_vertexbuffer{ -1 };
|
GLuint m_vertexbuffer{ (GLuint)-1 };
|
||||||
GLuint m_indexbuffer{ -1 };
|
GLuint m_indexbuffer{ (GLuint)-1 };
|
||||||
GLuint m_coloursbuffer{ -1 };
|
GLuint m_coloursbuffer{ (GLuint)-1 };
|
||||||
|
|
||||||
static float m_distributionluminance[ 5 ][ 2 ];
|
static float m_distributionluminance[ 5 ][ 2 ];
|
||||||
static float m_distributionxcomp[ 5 ][ 2 ];
|
static float m_distributionxcomp[ 5 ][ 2 ];
|
||||||
|
|||||||
136
sn_utils.cpp
Normal file
136
sn_utils.cpp
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "sn_utils.h"
|
||||||
|
|
||||||
|
// sanity checks
|
||||||
|
static_assert(std::numeric_limits<double>::is_iec559, "IEEE754 required");
|
||||||
|
static_assert(sizeof(float) == 4, "Float must be 4 bytes");
|
||||||
|
static_assert(sizeof(double) == 8, "Double must be 8 bytes");
|
||||||
|
static_assert(-1 == ~0, "Two's complement required");
|
||||||
|
|
||||||
|
// deserialize little endian uint16
|
||||||
|
uint16_t sn_utils::ld_uint16(std::istream &s)
|
||||||
|
{
|
||||||
|
uint8_t buf[2];
|
||||||
|
s.read((char*)buf, 2);
|
||||||
|
uint16_t v = (buf[1] << 8) | buf[0];
|
||||||
|
return reinterpret_cast<uint16_t&>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deserialize little endian uint32
|
||||||
|
uint32_t sn_utils::ld_uint32(std::istream &s)
|
||||||
|
{
|
||||||
|
uint8_t buf[4];
|
||||||
|
s.read((char*)buf, 4);
|
||||||
|
uint32_t v = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
|
||||||
|
return reinterpret_cast<uint32_t&>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deserialize little endian int32
|
||||||
|
int32_t sn_utils::ld_int32(std::istream &s)
|
||||||
|
{
|
||||||
|
uint8_t buf[4];
|
||||||
|
s.read((char*)buf, 4);
|
||||||
|
uint32_t v = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
|
||||||
|
return reinterpret_cast<int32_t&>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deserialize little endian ieee754 float32
|
||||||
|
float sn_utils::ld_float32(std::istream &s)
|
||||||
|
{
|
||||||
|
uint8_t buf[4];
|
||||||
|
s.read((char*)buf, 4);
|
||||||
|
uint32_t v = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
|
||||||
|
return reinterpret_cast<float&>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deserialize little endian ieee754 float64
|
||||||
|
double sn_utils::ld_float64(std::istream &s)
|
||||||
|
{
|
||||||
|
uint8_t buf[8];
|
||||||
|
s.read((char*)buf, 8);
|
||||||
|
uint64_t v = ((uint64_t)buf[7] << 56) | ((uint64_t)buf[6] << 48) |
|
||||||
|
((uint64_t)buf[5] << 40) | ((uint64_t)buf[4] << 32) |
|
||||||
|
((uint64_t)buf[3] << 24) | ((uint64_t)buf[2] << 16) |
|
||||||
|
((uint64_t)buf[1] << 8) | (uint64_t)buf[0];
|
||||||
|
return reinterpret_cast<double&>(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deserialize null-terminated string
|
||||||
|
std::string sn_utils::d_str(std::istream &s)
|
||||||
|
{
|
||||||
|
std::string r;
|
||||||
|
r.reserve(32);
|
||||||
|
char buf[1];
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
s.read(buf, 1);
|
||||||
|
if (buf[0] == 0)
|
||||||
|
break;
|
||||||
|
r.push_back(buf[0]);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sn_utils::ls_uint16(std::ostream &s, uint16_t v)
|
||||||
|
{
|
||||||
|
uint8_t buf[2];
|
||||||
|
buf[0] = v;
|
||||||
|
buf[1] = v >> 8;
|
||||||
|
s.write((char*)buf, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sn_utils::ls_uint32(std::ostream &s, uint32_t v)
|
||||||
|
{
|
||||||
|
uint8_t buf[4];
|
||||||
|
buf[0] = v;
|
||||||
|
buf[1] = v >> 8;
|
||||||
|
buf[2] = v >> 16;
|
||||||
|
buf[3] = v >> 24;
|
||||||
|
s.write((char*)buf, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sn_utils::ls_int32(std::ostream &s, int32_t v)
|
||||||
|
{
|
||||||
|
uint8_t buf[4];
|
||||||
|
buf[0] = v;
|
||||||
|
buf[1] = v >> 8;
|
||||||
|
buf[2] = v >> 16;
|
||||||
|
buf[3] = v >> 24;
|
||||||
|
s.write((char*)buf, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sn_utils::ls_float32(std::ostream &s, float t)
|
||||||
|
{
|
||||||
|
uint32_t v = reinterpret_cast<uint32_t&>(t);
|
||||||
|
uint8_t buf[4];
|
||||||
|
buf[0] = v;
|
||||||
|
buf[1] = v >> 8;
|
||||||
|
buf[2] = v >> 16;
|
||||||
|
buf[3] = v >> 24;
|
||||||
|
s.write((char*)buf, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sn_utils::ls_float64(std::ostream &s, double t)
|
||||||
|
{
|
||||||
|
uint64_t v = reinterpret_cast<uint64_t&>(t);
|
||||||
|
uint8_t buf[8];
|
||||||
|
buf[0] = v;
|
||||||
|
buf[1] = v >> 8;
|
||||||
|
buf[2] = v >> 16;
|
||||||
|
buf[3] = v >> 24;
|
||||||
|
buf[4] = v >> 32;
|
||||||
|
buf[5] = v >> 40;
|
||||||
|
buf[6] = v >> 48;
|
||||||
|
buf[7] = v >> 56;
|
||||||
|
s.write((char*)buf, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sn_utils::s_str(std::ostream &s, std::string v)
|
||||||
|
{
|
||||||
|
const char* buf = v.c_str();
|
||||||
|
s.write(buf, v.size() + 1);
|
||||||
|
}
|
||||||
23
sn_utils.h
Normal file
23
sn_utils.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class sn_utils
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static uint16_t ld_uint16(std::istream&);
|
||||||
|
static uint32_t ld_uint32(std::istream&);
|
||||||
|
static int32_t ld_int32(std::istream&);
|
||||||
|
static float ld_float32(std::istream&);
|
||||||
|
static double ld_float64(std::istream&);
|
||||||
|
static std::string d_str(std::istream&);
|
||||||
|
|
||||||
|
static void ls_uint16(std::ostream&, uint16_t);
|
||||||
|
static void ls_uint32(std::ostream&, uint32_t);
|
||||||
|
static void ls_int32(std::ostream&, int32_t);
|
||||||
|
static void ls_float32(std::ostream&, float);
|
||||||
|
static void ls_float64(std::ostream&, double);
|
||||||
|
static void s_str(std::ostream&, std::string);
|
||||||
|
};
|
||||||
3
stdafx.h
3
stdafx.h
@@ -18,12 +18,14 @@
|
|||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
#endif
|
#endif
|
||||||
// operating system
|
// operating system
|
||||||
|
#ifdef _WINDOWS
|
||||||
#include "targetver.h"
|
#include "targetver.h"
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#undef NOMINMAX
|
#undef NOMINMAX
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
|
#endif
|
||||||
// stl
|
// stl
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -65,4 +67,5 @@
|
|||||||
#define GLFW_DLL
|
#define GLFW_DLL
|
||||||
#endif
|
#endif
|
||||||
#define GLFW_INCLUDE_GLU
|
#define GLFW_INCLUDE_GLU
|
||||||
|
//m7todo: jest tu bo nie chcia³o mi siê wpychaæ do wszystkich plików
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
4
sun.h
4
sun.h
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "gl/glew.h"
|
#include "GL/glew.h"
|
||||||
#include "gl/wglew.h"
|
#include "GL/wglew.h"
|
||||||
#include "dumb3d.h"
|
#include "dumb3d.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
72
windows.cpp
Normal file
72
windows.cpp
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "World.h"
|
||||||
|
#include "usefull.h"
|
||||||
|
|
||||||
|
#pragma warning (disable: 4091)
|
||||||
|
#include <dbghelp.h>
|
||||||
|
|
||||||
|
LONG CALLBACK unhandled_handler(::EXCEPTION_POINTERS* e)
|
||||||
|
{
|
||||||
|
auto hDbgHelp = ::LoadLibraryA("dbghelp");
|
||||||
|
if (hDbgHelp == nullptr)
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
auto pMiniDumpWriteDump = (decltype(&MiniDumpWriteDump))::GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
|
||||||
|
if (pMiniDumpWriteDump == nullptr)
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
|
||||||
|
char name[MAX_PATH];
|
||||||
|
{
|
||||||
|
auto nameEnd = name + ::GetModuleFileNameA(::GetModuleHandleA(0), name, MAX_PATH);
|
||||||
|
::SYSTEMTIME t;
|
||||||
|
::GetSystemTime(&t);
|
||||||
|
wsprintfA(nameEnd - strlen(".exe"),
|
||||||
|
"_crashdump_%4d%02d%02d_%02d%02d%02d.dmp",
|
||||||
|
t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto hFile = ::CreateFileA(name, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
|
||||||
|
::MINIDUMP_EXCEPTION_INFORMATION exceptionInfo;
|
||||||
|
exceptionInfo.ThreadId = ::GetCurrentThreadId();
|
||||||
|
exceptionInfo.ExceptionPointers = e;
|
||||||
|
exceptionInfo.ClientPointers = FALSE;
|
||||||
|
|
||||||
|
auto dumped = pMiniDumpWriteDump(
|
||||||
|
::GetCurrentProcess(),
|
||||||
|
::GetCurrentProcessId(),
|
||||||
|
hFile,
|
||||||
|
::MINIDUMP_TYPE(::MiniDumpWithIndirectlyReferencedMemory | ::MiniDumpScanMemory),
|
||||||
|
e ? &exceptionInfo : nullptr,
|
||||||
|
nullptr,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
::CloseHandle(hFile);
|
||||||
|
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND Hwnd;
|
||||||
|
WNDPROC BaseWindowProc;
|
||||||
|
PCOPYDATASTRUCT pDane;
|
||||||
|
extern TWorld World;
|
||||||
|
|
||||||
|
LRESULT APIENTRY WndProc( HWND hWnd, // handle for this window
|
||||||
|
UINT uMsg, // message for this window
|
||||||
|
WPARAM wParam, // additional message information
|
||||||
|
LPARAM lParam) // additional message information
|
||||||
|
{
|
||||||
|
switch( uMsg ) // check for windows messages
|
||||||
|
{
|
||||||
|
case WM_COPYDATA: {
|
||||||
|
// obsługa danych przesłanych przez program sterujący
|
||||||
|
pDane = (PCOPYDATASTRUCT)lParam;
|
||||||
|
if( pDane->dwData == MAKE_ID4('E', 'U', '0', '7')) // sygnatura danych
|
||||||
|
World.OnCommandGet( (DaneRozkaz *)( pDane->lpData ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// pass all unhandled messages to DefWindowProc
|
||||||
|
return CallWindowProc( BaseWindowProc, Hwnd, uMsg, wParam, lParam );
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user