mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'tmj-dev' into nogfx
This commit is contained in:
@@ -77,7 +77,7 @@ void TButton::Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2) {
|
||||
bool
|
||||
TButton::Load_mapping( cParser &Input ) {
|
||||
|
||||
if( false == Input.getTokens( 2, true, ", " ) ) {
|
||||
if( false == Input.getTokens( 2, true, " ,\n\r\t" ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ void Console::ValueSet(int x, double y)
|
||||
WriteLog("CalibrateOutDebugInfo: oryginal=" + std::to_string(y), false);
|
||||
if (Global::fCalibrateOutMax[x] > 0)
|
||||
{
|
||||
y = Global::CutValueToRange(0, y, Global::fCalibrateOutMax[x]);
|
||||
y = clamp( y, 0.0, Global::fCalibrateOutMax[x]);
|
||||
if (Global::iCalibrateOutDebugInfo == x)
|
||||
WriteLog(" cutted=" + std::to_string(y), false);
|
||||
y = y / Global::fCalibrateOutMax[x]; // sprowadzenie do <0,1> jeśli podana
|
||||
|
||||
69
Driver.cpp
69
Driver.cpp
@@ -3586,36 +3586,46 @@ bool TController::UpdateSituation(double dt)
|
||||
pVehicles[ 0 ] == pVehicles[ 1 ] ?
|
||||
pVehicles[ 0 ] :
|
||||
pVehicles[ 1 ] );
|
||||
if( iDirection > 0 ) {
|
||||
if( mvOccupied->V >= 0.0 ) {
|
||||
// towards coupler 0
|
||||
if( ( rearvehicle->NextConnected != nullptr )
|
||||
&& ( rearvehicle->MoverParameters->Couplers[ ( rearvehicle->DirectionGet() > 0 ? 1 : 0 ) ].CouplingFlag == ctrain_virtual ) ) {
|
||||
// scan behind if we had something connected there and are moving away
|
||||
rearvehicle->ABuScanObjects( -1, fMaxProximityDist );
|
||||
if( ( mvOccupied->V * iDirection < 0.0 )
|
||||
|| ( ( rearvehicle->NextConnected != nullptr )
|
||||
&& ( rearvehicle->MoverParameters->Couplers[ ( rearvehicle->DirectionGet() > 0 ? 1 : 0 ) ].CouplingFlag == ctrain_virtual ) ) ) {
|
||||
// scan behind if we're moving backward, or if we had something connected there and are moving away
|
||||
rearvehicle->ABuScanObjects( (
|
||||
pVehicle->DirectionGet() == rearvehicle->DirectionGet() ?
|
||||
-1 :
|
||||
1 ),
|
||||
fMaxProximityDist );
|
||||
}
|
||||
pVehicles[ 0 ]->ABuScanObjects( 1, scandistance );
|
||||
pVehicles[ 0 ]->ABuScanObjects( (
|
||||
pVehicle->DirectionGet() == pVehicles[ 0 ]->DirectionGet() ?
|
||||
1 :
|
||||
-1 ),
|
||||
scandistance );
|
||||
}
|
||||
else {
|
||||
// towards coupler 1
|
||||
if( ( rearvehicle->PrevConnected != nullptr )
|
||||
&& ( rearvehicle->MoverParameters->Couplers[ ( rearvehicle->DirectionGet() > 0 ? 0 : 1 ) ].CouplingFlag == ctrain_virtual ) ) {
|
||||
// scan behind if we had something connected there and are moving away
|
||||
rearvehicle->ABuScanObjects( 1, fMaxProximityDist );
|
||||
if( ( mvOccupied->V * iDirection < 0.0 )
|
||||
|| ( ( rearvehicle->PrevConnected != nullptr )
|
||||
&& ( rearvehicle->MoverParameters->Couplers[ ( rearvehicle->DirectionGet() > 0 ? 0 : 1 ) ].CouplingFlag == ctrain_virtual ) ) ) {
|
||||
// scan behind if we're moving backward, or if we had something connected there and are moving away
|
||||
rearvehicle->ABuScanObjects( (
|
||||
pVehicle->DirectionGet() == rearvehicle->DirectionGet() ?
|
||||
1 :
|
||||
-1 ),
|
||||
fMaxProximityDist );
|
||||
}
|
||||
pVehicles[ 0 ]->ABuScanObjects( -1, scandistance );
|
||||
pVehicles[ 0 ]->ABuScanObjects( (
|
||||
pVehicle->DirectionGet() == pVehicles[ 0 ]->DirectionGet() ?
|
||||
-1 :
|
||||
1 ),
|
||||
scandistance );
|
||||
}
|
||||
}
|
||||
/*
|
||||
pVehicles[ 0 ]->fScanDist = (
|
||||
mvOccupied->Vel > 5.0 ?
|
||||
400 + fBrakeDist :
|
||||
300.0 );
|
||||
pVehicles[ 0 ]->Update_scan();
|
||||
if( pVehicles[ 1 ] != pVehicles[ 0 ] ) {
|
||||
pVehicles[ 1 ]->fScanDist = pVehicles[ 0 ]->fScanDist;
|
||||
pVehicles[ 1 ]->Update_scan();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (AIControllFlag)
|
||||
{ // tu bedzie logika sterowania
|
||||
if (mvOccupied->CommandIn.Command != "")
|
||||
@@ -4362,7 +4372,7 @@ bool TController::UpdateSituation(double dt)
|
||||
if (ActualProximityDist < fMaxProximityDist) {
|
||||
// jak minął już maksymalny dystans po prostu hamuj (niski stopień)
|
||||
// ma stanąć, a jest w drodze hamowania albo ma jechać
|
||||
VelDesired = VelNext;
|
||||
VelDesired = Global::Min0RSpeed( VelDesired, VelNext );
|
||||
if( VelDesired == 0.0 ) {
|
||||
// hamowanie tak, aby stanąć
|
||||
AccDesired = ( VelNext * VelNext - vel * vel ) / ( 25.92 * ( ActualProximityDist + 0.1 - 0.5*fMinProximityDist ) );
|
||||
@@ -4458,19 +4468,6 @@ bool TController::UpdateSituation(double dt)
|
||||
}
|
||||
// koniec predkosci aktualnej
|
||||
|
||||
#ifdef DEBUGFAC
|
||||
if (fAccThreshold > -0.3) // bez sensu, ale dla towarowych korzystnie
|
||||
{ // Ra 2014-03: to nie uwzględnia odległości i zaczyna hamować, jak tylko zobaczy
|
||||
// W4
|
||||
if ((AccDesired > 0.0) &&
|
||||
(VelNext >= 0.0)) // wybieg bądź lekkie hamowanie, warunki byly zamienione
|
||||
if (vel > VelNext + 100.0) // lepiej zaczac hamowac
|
||||
AccDesired = fAccThreshold;
|
||||
else if (vel > VelNext + 70.0)
|
||||
AccDesired = 0.0; // nie spiesz się, bo będzie hamowanie
|
||||
// koniec wybiegu i hamowania
|
||||
}
|
||||
#endif // DEBUGFAC
|
||||
// last step sanity check, until the whole calculation is straightened out
|
||||
AccDesired = std::min( AccDesired, AccPreferred );
|
||||
|
||||
|
||||
2
DynObj.h
2
DynObj.h
@@ -184,7 +184,7 @@ public: // modele składowe pojazdu
|
||||
TModel3d *mdLoad; // model zmiennego ładunku
|
||||
TModel3d *mdKabina; // model kabiny dla użytkownika; McZapkie-030303: to z train.h
|
||||
TModel3d *mdLowPolyInt; // ABu 010305: wnetrze lowpoly
|
||||
float3 InteriorLight { 0.9f * 255.0f / 255.0f, 0.9f * 216.0f / 255.0f, 0.9f * 176.0f / 255.0f }; // tungsten light. TODO: allow definition of light type?
|
||||
glm::vec3 InteriorLight { 0.9f * 255.f / 255.f, 0.9f * 216.f / 255.f, 0.9f * 176.f / 255.f }; // tungsten light. TODO: allow definition of light type?
|
||||
float InteriorLightLevel { 0.0f }; // current level of interior lighting
|
||||
struct section_light {
|
||||
TSubModel *compartment;
|
||||
|
||||
@@ -431,8 +431,7 @@ void TEvent::Load(cParser *parser, vector3 *org)
|
||||
*parser >> token;
|
||||
break;
|
||||
case tp_Exit:
|
||||
while ((ptr = strchr(strdup(asNodeName.c_str()), '_')) != NULL)
|
||||
*ptr = ' ';
|
||||
asNodeName = ExchangeCharInString( asNodeName, '_', ' ' );
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
break;
|
||||
|
||||
@@ -116,7 +116,7 @@ bool TGauge::Load(cParser &Parser, TModel3d *md1, TModel3d *md2, double mul) {
|
||||
bool
|
||||
TGauge::Load_mapping( cParser &Input ) {
|
||||
|
||||
if( false == Input.getTokens( 2, true, ", " ) ) {
|
||||
if( false == Input.getTokens( 2, true, ", \n\r\t" ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1322,10 +1322,3 @@ double Global::Min0RSpeed(double vel1, double vel2)
|
||||
}
|
||||
return std::min(vel1, vel2);
|
||||
};
|
||||
|
||||
double Global::CutValueToRange(double min, double value, double max)
|
||||
{ // przycinanie wartosci do podanych granic
|
||||
value = Max0R(value, min);
|
||||
value = Min0R(value, max);
|
||||
return value;
|
||||
};
|
||||
|
||||
@@ -334,7 +334,6 @@ class Global
|
||||
static bool AddToQuery(TEvent *event, TDynamicObject *who);
|
||||
static std::string Bezogonkow(std::string str, bool _ = false);
|
||||
static double Min0RSpeed(double vel1, double vel2);
|
||||
static double CutValueToRange(double min, double value, double max);
|
||||
|
||||
// maciek001: zmienne dla MWD
|
||||
static bool bMWDmasterEnable; // główne włączenie portu COM
|
||||
|
||||
18
Ground.cpp
18
Ground.cpp
@@ -486,14 +486,11 @@ TGroundRect::NodeAdd( TGroundNode *Node ) {
|
||||
matchingnode->pCenter, Node->pCenter,
|
||||
static_cast<float>( Node->iNumVerts ) / ( Node->iNumVerts + matchingnode->iNumVerts ) );
|
||||
matchingnode->iNumVerts += Node->iNumVerts;
|
||||
matchingnode->Piece->vertices.resize( matchingnode->iNumVerts, TGroundVertex() );
|
||||
matchingnode->Piece->vertices.insert(
|
||||
std::end( matchingnode->Piece->vertices ),
|
||||
std::begin( Node->Piece->vertices ), std::end( Node->Piece->vertices ) );
|
||||
// clear content of the node we're copying. a minor memory saving at best, but still a saving
|
||||
Node->Piece->vertices.clear();
|
||||
Node->Piece->vertices.shrink_to_fit();
|
||||
|
||||
std::vector<TGroundVertex>().swap( Node->Piece->vertices );
|
||||
Node->iNumVerts = 0;
|
||||
// since we've put the data in existing node we can skip adding the new one...
|
||||
return;
|
||||
@@ -576,7 +573,6 @@ void TGround::Free()
|
||||
Current = Current->nNext;
|
||||
delete tmpn;
|
||||
}
|
||||
iNumNodes = 0;
|
||||
// RootNode=NULL;
|
||||
nRootDynamic = NULL;
|
||||
}
|
||||
@@ -692,7 +688,6 @@ TGround::convert_terrain( TSubModel const *Submodel ) {
|
||||
groundnode->nNext = nRootOfType[ groundnode->iType ];
|
||||
// ustawienie nowego na początku listy
|
||||
nRootOfType[ groundnode->iType ] = groundnode;
|
||||
++iNumNodes;
|
||||
}
|
||||
else {
|
||||
delete groundnode;
|
||||
@@ -789,7 +784,6 @@ void TGround::RaTriangleDivider(TGroundNode *node)
|
||||
ntri->bVisible = node->bVisible; // a są jakieś niewidoczne?
|
||||
ntri->nNext = nRootOfType[GL_TRIANGLES];
|
||||
nRootOfType[GL_TRIANGLES] = ntri; // dopisanie z przodu do listy
|
||||
++iNumNodes;
|
||||
ntri->iNumVerts = 3;
|
||||
ntri->Piece->vertices.resize( 3 );
|
||||
switch (divide & 3)
|
||||
@@ -1774,7 +1768,6 @@ bool TGround::Init(std::string File)
|
||||
// pTrain=NULL;
|
||||
pOrigin = aRotate = vector3(0, 0, 0); // zerowanie przesunięcia i obrotu
|
||||
std::string str;
|
||||
// TFileStream *fs;
|
||||
// int size;
|
||||
std::string subpath = Global::asCurrentSceneryPath; // "scenery/";
|
||||
cParser parser(File, cParser::buffer_FILE, subpath, Global::bLoadTraction);
|
||||
@@ -1783,7 +1776,6 @@ bool TGround::Init(std::string File)
|
||||
std::stack<Math3D::vector3> OriginStack; // stos zagnieżdżenia origin
|
||||
|
||||
TGroundNode *LastNode = nullptr; // do użycia w trainset
|
||||
iNumNodes = 0;
|
||||
token = "";
|
||||
parser.getTokens();
|
||||
parser >> token;
|
||||
@@ -1840,7 +1832,6 @@ bool TGround::Init(std::string File)
|
||||
LastNode->nNext = nRootOfType[ LastNode->iType ];
|
||||
// ustawienie nowego na początku listy
|
||||
nRootOfType[ LastNode->iType ] = LastNode;
|
||||
++iNumNodes;
|
||||
}
|
||||
else { // jeśli jest pojazdem
|
||||
if( ( LastNode->DynamicObject->Mechanik != nullptr )
|
||||
@@ -2667,7 +2658,6 @@ void TGround::InitTracks()
|
||||
Current->nNext =
|
||||
nRootOfType[TP_MEMCELL]; // to nie powinno tutaj być, bo robi się śmietnik
|
||||
nRootOfType[TP_MEMCELL] = Current;
|
||||
iNumNodes++;
|
||||
p->pMemCell = Current->MemCell; // wskaźnik komóki przekazany do odcinka izolowanego
|
||||
}
|
||||
p = p->Next();
|
||||
@@ -2706,7 +2696,6 @@ void TGround::InitTraction()
|
||||
nTemp->nNext = nRootOfType[nTemp->iType]; // ostatni dodany dołączamy na końcu
|
||||
// nowego
|
||||
nRootOfType[nTemp->iType] = nTemp; // ustawienie nowego na początku listy
|
||||
iNumNodes++;
|
||||
}
|
||||
}
|
||||
for (nCurrent = nRootOfType[TP_TRACTION]; nCurrent; nCurrent = nCurrent->nNext)
|
||||
@@ -3152,9 +3141,8 @@ bool TGround::EventConditon(TEvent *e)
|
||||
return (e->Params[9].asTrack->IsEmpty());
|
||||
else if (e->iFlags & conditional_propability)
|
||||
{
|
||||
double rprobability = 1.0 * rand() / RAND_MAX;
|
||||
WriteLog("Random integer: " + std::to_string(rprobability) + "/" +
|
||||
std::to_string(e->Params[10].asdouble));
|
||||
double rprobability = Random();
|
||||
WriteLog("Random integer: " + std::to_string(rprobability) + " / " + std::to_string(e->Params[10].asdouble));
|
||||
return (e->Params[10].asdouble > rprobability);
|
||||
}
|
||||
else if (e->iFlags & conditional_memcompare)
|
||||
|
||||
31
Ground.h
31
Ground.h
@@ -151,13 +151,8 @@ public:
|
||||
TGroundNode();
|
||||
TGroundNode(TGroundNodeType t);
|
||||
~TGroundNode();
|
||||
/*
|
||||
void Init(int n);
|
||||
*/
|
||||
|
||||
void InitNormals();
|
||||
/*
|
||||
void Release();
|
||||
*/
|
||||
void RenderHidden(); // obsługa dźwięków i wyzwalaczy zdarzeń
|
||||
};
|
||||
|
||||
@@ -205,7 +200,6 @@ class TSubRect : /*public Resource,*/ public CMesh
|
||||
// Ra: trzeba sprawdzić wydajność siatki
|
||||
const int iNumSubRects = 5; // na ile dzielimy kilometr
|
||||
const int iNumRects = 500;
|
||||
// const double fHalfNumRects=iNumRects/2.0; //połowa do wyznaczenia środka
|
||||
const int iTotalNumSubRects = iNumRects * iNumSubRects;
|
||||
const double fHalfTotalNumSubRects = iTotalNumSubRects / 2.0;
|
||||
const double fSubRectSize = 1000.0 / iNumSubRects;
|
||||
@@ -255,27 +249,22 @@ class TGround
|
||||
{
|
||||
friend class opengl_renderer;
|
||||
|
||||
vector3 CameraDirection; // zmienna robocza przy renderowaniu
|
||||
int const *iRange = nullptr; // tabela widoczności
|
||||
TGroundRect Rects[ iNumRects ][ iNumRects ]; // mapa kwadratów kilometrowych
|
||||
TSubRect srGlobal; // zawiera obiekty globalne (na razie wyzwalacze czasowe)
|
||||
TGroundNode *nRootDynamic = nullptr; // lista pojazdów
|
||||
TGroundRect Rects[iNumRects][iNumRects]; // mapa kwadratów kilometrowych
|
||||
TGroundNode *nRootOfType[ TP_LAST ]; // tablica grupująca obiekty, przyspiesza szukanie
|
||||
TEvent *RootEvent = nullptr; // lista zdarzeń
|
||||
TEvent *QueryRootEvent = nullptr,
|
||||
*tmpEvent = nullptr;
|
||||
/*
|
||||
TSubRect *pRendered[1500]; // lista renderowanych sektorów
|
||||
*/
|
||||
int iNumNodes = 0;
|
||||
vector3 pOrigin;
|
||||
vector3 aRotate;
|
||||
bool bInitDone = false;
|
||||
TGroundNode *nRootOfType[TP_LAST]; // tablica grupująca obiekty, przyspiesza szukanie
|
||||
TSubRect srGlobal; // zawiera obiekty globalne (na razie wyzwalacze czasowe)
|
||||
typedef std::unordered_map<std::string, TEvent *> event_map;
|
||||
event_map m_eventmap;
|
||||
TNames<TGroundNode *> m_trackmap;
|
||||
light_array m_lights; // collection of dynamic light sources present in the scene
|
||||
|
||||
vector3 pOrigin;
|
||||
vector3 aRotate;
|
||||
bool bInitDone = false;
|
||||
|
||||
private: // metody prywatne
|
||||
bool EventConditon(TEvent *e);
|
||||
|
||||
@@ -335,9 +324,6 @@ class TGround
|
||||
|
||||
public:
|
||||
void WyslijEvent(const std::string &e, const std::string &d);
|
||||
/*
|
||||
int iRendered; // ilość renderowanych sektorów, pobierana przy pokazywniu FPS
|
||||
*/
|
||||
void WyslijString(const std::string &t, int n);
|
||||
void WyslijWolny(const std::string &t);
|
||||
void WyslijNamiary(TGroundNode *t);
|
||||
@@ -357,4 +343,5 @@ class TGround
|
||||
void IsolatedBusy(const std::string t);
|
||||
void Silence(vector3 gdzie);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -114,13 +114,14 @@ std::string DWE(std::string s) /*Delete After Equal sign*/
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string ExchangeCharInString( std::string const &Source, char const &From, char const &To )
|
||||
std::string ExchangeCharInString( std::string const &Source, char const From, char const To )
|
||||
{
|
||||
std::string replacement; replacement.reserve( Source.size() );
|
||||
std::for_each(Source.cbegin(), Source.cend(), [&](char const idx) {
|
||||
if( idx != From ) { replacement += idx; }
|
||||
else { replacement += To; }
|
||||
} );
|
||||
std::for_each(
|
||||
std::begin( Source ), std::end( Source ),
|
||||
[&](char const idx) {
|
||||
if( idx != From ) { replacement += idx; }
|
||||
else { replacement += To; } } );
|
||||
|
||||
return replacement;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ bool FuzzyLogicAI(double Test, double Threshold, double Probability);
|
||||
/*operacje na stringach*/
|
||||
std::string DUE(std::string s); /*Delete Until Equal sign*/
|
||||
std::string DWE(std::string s); /*Delete While Equal sign*/
|
||||
std::string ExchangeCharInString(std::string const &s, const char &aim, const char &target); // zamienia jeden znak na drugi
|
||||
std::string ExchangeCharInString( std::string const &Source, char const From, char const To ); // zamienia jeden znak na drugi
|
||||
std::vector<std::string> &Split(const std::string &s, char delim, std::vector<std::string> &elems);
|
||||
std::vector<std::string> Split(const std::string &s, char delim);
|
||||
//std::vector<std::string> Split(const std::string &s);
|
||||
|
||||
@@ -762,12 +762,6 @@ void TTrack::Load(cParser *parser, vector3 pOrigin, std::string name)
|
||||
iAction |= 0x40; // flaga opuszczenia pantografu (tor uwzględniany w skanowaniu jako
|
||||
// ograniczenie dla pantografujących)
|
||||
}
|
||||
else if (str == "colides")
|
||||
{ // informacja o stanie sieci: 0-jazda bezprądowa, >0-z opuszczonym i ograniczeniem prędkości
|
||||
parser->getTokens();
|
||||
*parser >> token;
|
||||
// trColides=; //tor kolizyjny, na którym trzeba sprawdzać pojazdy pod kątem zderzenia
|
||||
}
|
||||
else
|
||||
ErrorLog("Unknown property: \"" + str + "\" in track \"" + name + "\"");
|
||||
parser->getTokens();
|
||||
|
||||
14
Track.h
14
Track.h
@@ -139,9 +139,7 @@ private:
|
||||
float fTexHeight1 = 0.6f; // wysokość brzegu względem trajektorii
|
||||
float fTexWidth = 0.9f; // szerokość boku
|
||||
float fTexSlope = 0.9f;
|
||||
/*
|
||||
GLuint DisplayListID = 0;
|
||||
*/
|
||||
|
||||
material_handle m_material1 = 0; // tekstura szyn albo nawierzchni
|
||||
material_handle m_material2 = 0; // tekstura automatycznej podsypki albo pobocza
|
||||
typedef std::vector<geometry_handle> geometryhandle_sequence;
|
||||
@@ -187,7 +185,6 @@ public:
|
||||
bool ScannedFlag = false; // McZapkie: do zaznaczania kolorem torów skanowanych przez AI
|
||||
TTraction *hvOverhead = nullptr; // drut zasilający do szybkiego znalezienia (nie używany)
|
||||
TGroundNode *nFouling[ 2 ]; // współrzędne ukresu albo oporu kozła
|
||||
TTrack *trColides = nullptr; // tor kolizyjny, na którym trzeba sprawdzać pojazdy pod kątem zderzenia
|
||||
|
||||
TTrack(TGroundNode *g);
|
||||
~TTrack();
|
||||
@@ -225,17 +222,8 @@ public:
|
||||
bool CheckDynamicObject(TDynamicObject *Dynamic);
|
||||
bool AddDynamicObject(TDynamicObject *Dynamic);
|
||||
bool RemoveDynamicObject(TDynamicObject *Dynamic);
|
||||
/*
|
||||
void Release();
|
||||
|
||||
void Compile(GLuint tex = 0);
|
||||
void Render(); // renderowanie z Display Lists
|
||||
int RaArrayPrepare(); // zliczanie rozmiaru dla VBO sektroa
|
||||
*/
|
||||
void create_geometry(geometrybank_handle const &Bank); // wypełnianie VBO
|
||||
/*
|
||||
void RaRenderVBO(int iPtr); // renderowanie z VBO sektora
|
||||
*/
|
||||
void RenderDynSounds(); // odtwarzanie dźwięków pojazdów jest niezależne od ich wyświetlania
|
||||
|
||||
void RaOwnerSet(TSubRect *o) {
|
||||
|
||||
12
Train.cpp
12
Train.cpp
@@ -4553,8 +4553,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (mvOccupied->BrakeHandle == FV4a)
|
||||
{
|
||||
double b = Console::AnalogCalibrateGet(0);
|
||||
b = b * 8 - 2;
|
||||
b = Global::CutValueToRange(-2.0, b, mvOccupied->BrakeCtrlPosNo); // przycięcie zmiennej do granic
|
||||
b = b * 8.0 - 2.0;
|
||||
b = clamp<double>( b, -2.0, mvOccupied->BrakeCtrlPosNo ); // przycięcie zmiennej do granic
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode & 4) WriteLog("FV4a break position = " + to_string(b));
|
||||
ggBrakeCtrl.UpdateValue(b); // przesów bez zaokrąglenia
|
||||
mvOccupied->BrakeLevelSet(b);
|
||||
@@ -4562,8 +4562,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (mvOccupied->BrakeHandle == FVel6) // może można usunąć ograniczenie do FV4a i FVel6?
|
||||
{
|
||||
double b = Console::AnalogCalibrateGet(0);
|
||||
b = b * 7 - 1;
|
||||
b = Global::CutValueToRange(-1.0, b, mvOccupied->BrakeCtrlPosNo); // przycięcie zmiennej do granic
|
||||
b = b * 7.0 - 1.0;
|
||||
b = clamp<double>( b, -1.0, mvOccupied->BrakeCtrlPosNo ); // przycięcie zmiennej do granic
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode & 4) WriteLog("FVel6 break position = " + to_string(b));
|
||||
ggBrakeCtrl.UpdateValue(b); // przesów bez zaokrąglenia
|
||||
mvOccupied->BrakeLevelSet(b);
|
||||
@@ -4588,8 +4588,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
if ((mvOccupied->BrakeLocHandle == FD1))
|
||||
{
|
||||
double b = Console::AnalogCalibrateGet(1);
|
||||
b *= 10;
|
||||
b = Global::CutValueToRange(0.0, b, LocalBrakePosNo); // przycięcie zmiennej do granic
|
||||
b *= 10.0;
|
||||
b = clamp<double>( b, 0.0, LocalBrakePosNo); // przycięcie zmiennej do granic
|
||||
ggLocalBrake.UpdateValue(b); // przesów bez zaokrąglenia
|
||||
if (Global::bMWDdebugEnable && Global::iMWDDebugMode & 4) WriteLog("FD1 break position = " + to_string(b));
|
||||
mvOccupied->LocalBrakePos =
|
||||
|
||||
@@ -1849,8 +1849,7 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||
|
||||
// crude way to light the cabin, until we have something more complete in place
|
||||
auto const cablight = Dynamic->InteriorLight * Dynamic->InteriorLightLevel;
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
||||
}
|
||||
|
||||
Render( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||
@@ -1942,8 +1941,7 @@ opengl_renderer::Render_cab( TDynamicObject *Dynamic ) {
|
||||
}
|
||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||
// crude way to light the cabin, until we have something more complete in place
|
||||
auto const cablight = Dynamic->InteriorLight * Dynamic->InteriorLightLevel;
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
||||
}
|
||||
// render
|
||||
Render( Dynamic->mdKabina, Dynamic->Material(), 0.0 );
|
||||
@@ -2589,8 +2587,7 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||
|
||||
// crude way to light the cabin, until we have something more complete in place
|
||||
auto const cablight = Dynamic->InteriorLight * Dynamic->InteriorLightLevel;
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( Dynamic->InteriorLight * Dynamic->InteriorLightLevel ) );
|
||||
}
|
||||
|
||||
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||
|
||||
10
skydome.cpp
10
skydome.cpp
@@ -121,11 +121,11 @@ void CSkyDome::Render() {
|
||||
// build the buffers
|
||||
::glGenBuffers( 1, &m_vertexbuffer );
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, m_vertexbuffer );
|
||||
::glBufferData( GL_ARRAY_BUFFER, m_vertices.size() * sizeof( float3 ), m_vertices.data(), GL_STATIC_DRAW );
|
||||
::glBufferData( GL_ARRAY_BUFFER, m_vertices.size() * sizeof( glm::vec3 ), m_vertices.data(), GL_STATIC_DRAW );
|
||||
|
||||
::glGenBuffers( 1, &m_coloursbuffer );
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, m_coloursbuffer );
|
||||
::glBufferData( GL_ARRAY_BUFFER, m_colours.size() * sizeof( float3 ), m_colours.data(), GL_DYNAMIC_DRAW );
|
||||
::glBufferData( GL_ARRAY_BUFFER, m_colours.size() * sizeof( glm::vec3 ), m_colours.data(), GL_DYNAMIC_DRAW );
|
||||
|
||||
::glGenBuffers( 1, &m_indexbuffer );
|
||||
::glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, m_indexbuffer );
|
||||
@@ -137,10 +137,10 @@ void CSkyDome::Render() {
|
||||
::glEnableClientState( GL_COLOR_ARRAY );
|
||||
// positions
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, m_vertexbuffer );
|
||||
::glVertexPointer( 3, GL_FLOAT, sizeof( float3 ), reinterpret_cast<void const*>( 0 ) );
|
||||
::glVertexPointer( 3, GL_FLOAT, sizeof( glm::vec3 ), reinterpret_cast<void const*>( 0 ) );
|
||||
// colours
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, m_coloursbuffer );
|
||||
::glColorPointer( 3, GL_FLOAT, sizeof( float3 ), reinterpret_cast<void const*>( 0 ) );
|
||||
::glColorPointer( 3, GL_FLOAT, sizeof( glm::vec3 ), reinterpret_cast<void const*>( 0 ) );
|
||||
// indices
|
||||
::glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, m_indexbuffer );
|
||||
::glDrawElements( GL_TRIANGLES, static_cast<GLsizei>( m_indices.size() ), GL_UNSIGNED_SHORT, reinterpret_cast<void const*>( 0 ) );
|
||||
@@ -344,7 +344,7 @@ void CSkyDome::RebuildColors() {
|
||||
if( m_coloursbuffer != -1 ) {
|
||||
// the colour buffer was already initialized, so on this run we update its content
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, m_coloursbuffer );
|
||||
::glBufferSubData( GL_ARRAY_BUFFER, 0, m_colours.size() * sizeof( float3 ), m_colours.data() );
|
||||
::glBufferSubData( GL_ARRAY_BUFFER, 0, m_colours.size() * sizeof( glm::vec3 ), m_colours.data() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user