mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 17:09:19 +02:00
Merge branch 'tmj-dev' into nogfx
This commit is contained in:
@@ -606,23 +606,8 @@ int TAnimModel::Flags()
|
|||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// 2011-03-16 funkcje renderowania z możliwością pochylania obiektów
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void TAnimModel::Render( vector3 const &Position ) {
|
|
||||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
|
||||||
RaPrepare();
|
|
||||||
if( pModel ) // renderowanie rekurencyjne submodeli
|
|
||||||
GfxRenderer.Render( pModel, Material(), Position, vAngle );
|
|
||||||
};
|
|
||||||
void TAnimModel::RenderAlpha( vector3 const &Position ) {
|
|
||||||
RaPrepare();
|
|
||||||
if( pModel ) // renderowanie rekurencyjne submodeli
|
|
||||||
GfxRenderer.Render_Alpha( pModel, Material(), Position, vAngle );
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool TAnimModel::TerrainLoaded()
|
bool TAnimModel::TerrainLoaded()
|
||||||
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
{ // zliczanie kwadratów kilometrowych (główna linia po Next) do tworznia tablicy
|
||||||
return (this ? pModel != NULL : false);
|
return (this ? pModel != NULL : false);
|
||||||
|
|||||||
@@ -164,10 +164,6 @@ class TAnimModel {
|
|||||||
bool Load(cParser *parser, bool ter = false);
|
bool Load(cParser *parser, bool ter = false);
|
||||||
TAnimContainer * AddContainer(char *pName);
|
TAnimContainer * AddContainer(char *pName);
|
||||||
TAnimContainer * GetContainer(char *pName);
|
TAnimContainer * GetContainer(char *pName);
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void Render( vector3 const &Position );
|
|
||||||
void RenderAlpha( vector3 const &Position );
|
|
||||||
#endif
|
|
||||||
int Flags();
|
int Flags();
|
||||||
void RaAnglesSet(double a, double b, double c)
|
void RaAnglesSet(double a, double b, double c)
|
||||||
{
|
{
|
||||||
@@ -178,9 +174,6 @@ class TAnimModel {
|
|||||||
bool TerrainLoaded();
|
bool TerrainLoaded();
|
||||||
int TerrainCount();
|
int TerrainCount();
|
||||||
TSubModel * TerrainSquare(int n);
|
TSubModel * TerrainSquare(int n);
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void TerrainRenderVBO(int n);
|
|
||||||
#endif
|
|
||||||
void AnimationVND(void *pData, double a, double b, double c, double d);
|
void AnimationVND(void *pData, double a, double b, double c, double d);
|
||||||
void LightSet(int n, float v);
|
void LightSet(int n, float v);
|
||||||
static void AnimUpdate(double dt);
|
static void AnimUpdate(double dt);
|
||||||
|
|||||||
158
Driver.cpp
158
Driver.cpp
@@ -187,7 +187,7 @@ void TSpeedPos::CommandCheck()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len, TOrders const &Orders )
|
bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len )
|
||||||
{ // przeliczenie odległości od punktu (*p), w kierunku (*dir), zaczynając od pojazdu
|
{ // przeliczenie odległości od punktu (*p), w kierunku (*dir), zaczynając od pojazdu
|
||||||
// dla kolejnych pozycji podawane są współrzędne poprzedniego obiektu w (*p)
|
// dla kolejnych pozycji podawane są współrzędne poprzedniego obiektu w (*p)
|
||||||
vector3 v = vPos - *p; // wektor od poprzedniego obiektu (albo pojazdu) do punktu zmiany
|
vector3 v = vPos - *p; // wektor od poprzedniego obiektu (albo pojazdu) do punktu zmiany
|
||||||
@@ -253,19 +253,6 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len, TOrders const &Ord
|
|||||||
|
|
||||||
if( trTrack->iCategoryFlag & 1 ) {
|
if( trTrack->iCategoryFlag & 1 ) {
|
||||||
// railways
|
// railways
|
||||||
/*
|
|
||||||
if( ( iFlags & spElapsed ) == 0 ) {
|
|
||||||
// jeśli nie wjechał
|
|
||||||
// TODO: remove this block when the detection of vehicles ahead is working properly
|
|
||||||
if( false == trTrack->Dynamics.empty() ) {
|
|
||||||
// to zabronić wjazdu (chyba że ten z przodu też jedzie prosto)
|
|
||||||
fVelNext = 25.0; // can't force full stop as it can prevent vehicles from leaving the track. slow down should be enough to ensure slow enough movement to stop
|
|
||||||
if( Global::iWriteLogEnabled & 8 ) {
|
|
||||||
WriteLog( "Track " + trTrack->NameGet() + " is occupied. Vehicle count: " + std::to_string( trTrack->Dynamics.size() ) + ", distance: " + std::to_string( fDist ) + " m." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if( iFlags & spSwitch ) {
|
if( iFlags & spSwitch ) {
|
||||||
// jeśli odcinek zmienny
|
// jeśli odcinek zmienny
|
||||||
if( ( ( trTrack->GetSwitchState() & 1 ) != 0 ) !=
|
if( ( ( trTrack->GetSwitchState() & 1 ) != 0 ) !=
|
||||||
@@ -701,7 +688,7 @@ void TController::TableCheck(double fDistance)
|
|||||||
{ // aktualizacja rekordów z wyjątkiem ostatniego
|
{ // aktualizacja rekordów z wyjątkiem ostatniego
|
||||||
if (sSpeedTable[i].iFlags & spEnabled) // jeśli pozycja istotna
|
if (sSpeedTable[i].iFlags & spEnabled) // jeśli pozycja istotna
|
||||||
{
|
{
|
||||||
if (sSpeedTable[i].Update(&pos, &dir, len, OrderCurrentGet()))
|
if(sSpeedTable[i].Update( &pos, &dir, len ))
|
||||||
{
|
{
|
||||||
if( Global::iWriteLogEnabled & 8 ) {
|
if( Global::iWriteLogEnabled & 8 ) {
|
||||||
WriteLog( "Speed table for " + OwnerName() + " detected switch change at " + sSpeedTable[ i ].trTrack->NameGet() + " (generating fresh trace)" );
|
WriteLog( "Speed table for " + OwnerName() + " detected switch change at " + sSpeedTable[ i ].trTrack->NameGet() + " (generating fresh trace)" );
|
||||||
@@ -744,7 +731,7 @@ void TController::TableCheck(double fDistance)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sSpeedTable[iLast].Update(&pos, &dir, len, OrderCurrentGet()); // aktualizacja ostatniego
|
sSpeedTable[iLast].Update( &pos, &dir, len ); // aktualizacja ostatniego
|
||||||
// WriteLog("TableCheck: Upate last track. Dist=" + AnsiString(sSpeedTable[iLast].fDist));
|
// WriteLog("TableCheck: Upate last track. Dist=" + AnsiString(sSpeedTable[iLast].fDist));
|
||||||
if( sSpeedTable[ iLast ].fDist < fDistance ) {
|
if( sSpeedTable[ iLast ].fDist < fDistance ) {
|
||||||
TableTraceRoute( fDistance, pVehicles[ 1 ] ); // doskanowanie dalszego odcinka
|
TableTraceRoute( fDistance, pVehicles[ 1 ] ); // doskanowanie dalszego odcinka
|
||||||
@@ -1736,7 +1723,41 @@ void TController::AutoRewident()
|
|||||||
fAccThreshold = -fBrake_a0[BrakeAccTableSize] - 1 * fBrake_a1[BrakeAccTableSize];
|
fAccThreshold = -fBrake_a0[BrakeAccTableSize] - 1 * fBrake_a1[BrakeAccTableSize];
|
||||||
fBrakeReaction = 1.00 + fLength*0.005;
|
fBrakeReaction = 1.00 + fLength*0.005;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
double TController::ESMVelocity(bool Main)
|
||||||
|
{
|
||||||
|
double fCurrentCoeff = 0.9;
|
||||||
|
double fFrictionCoeff = 0.85;
|
||||||
|
double ESMVel = 9999;
|
||||||
|
int MCPN = mvControlling->MainCtrlActualPos;
|
||||||
|
int SCPN = mvControlling->ScndCtrlActualPos;
|
||||||
|
if (Main)
|
||||||
|
MCPN += 1;
|
||||||
|
else
|
||||||
|
SCPN += 1;
|
||||||
|
if ((mvControlling->RList[MCPN].ScndAct < 255)&&(mvControlling->ScndCtrlActualPos==0))
|
||||||
|
SCPN = mvControlling->RList[MCPN].ScndAct;
|
||||||
|
double FrictionMax = mvControlling->Mass*9.81*mvControlling->Adhesive(mvControlling->RunningTrack.friction)*fFrictionCoeff;
|
||||||
|
double IF = mvControlling->Imax;
|
||||||
|
double MS = 0;
|
||||||
|
double Fmax = 0;
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
MS = mvControlling->MomentumF(IF, IF, SCPN);
|
||||||
|
Fmax = MS * mvControlling->RList[MCPN].Bn*mvControlling->RList[MCPN].Mn * 2 / mvControlling->WheelDiameter * mvControlling->Transmision.Ratio;
|
||||||
|
IF = 0.5*IF*(1 + FrictionMax/Fmax);
|
||||||
|
}
|
||||||
|
IF = std::min(IF, mvControlling->Imax*fCurrentCoeff);
|
||||||
|
double R = mvControlling->RList[MCPN].R + mvControlling->CircuitRes + mvControlling->RList[MCPN].Mn*mvControlling->WindingRes;
|
||||||
|
double pole = mvControlling->MotorParam[SCPN].fi *
|
||||||
|
std::max(abs(IF) / (abs(IF) + mvControlling->MotorParam[SCPN].Isat) - mvControlling->MotorParam[SCPN].fi0, 0.0);
|
||||||
|
double Us = abs(mvControlling->Voltage) - IF*R;
|
||||||
|
double ns = std::max(0.0, Us / (pole*mvControlling->RList[MCPN].Mn));
|
||||||
|
ESMVel = ns * mvControlling->WheelDiameter*M_PI*3.6/mvControlling->Transmision.Ratio;
|
||||||
|
return ESMVel;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
int TController::CheckDirection() {
|
int TController::CheckDirection() {
|
||||||
|
|
||||||
@@ -2486,51 +2507,64 @@ bool TController::IncSpeed()
|
|||||||
(mvControlling->StLinFlag)) // youBy polecił dodać 2012-09-08 v367
|
(mvControlling->StLinFlag)) // youBy polecił dodać 2012-09-08 v367
|
||||||
// na pozycji 0 przejdzie, a na pozostałych będzie czekać, aż się załączą liniowe
|
// na pozycji 0 przejdzie, a na pozostałych będzie czekać, aż się załączą liniowe
|
||||||
// (zgaśnie DelayCtrlFlag)
|
// (zgaśnie DelayCtrlFlag)
|
||||||
if (Ready || (iDrivigFlags & movePress))
|
if (Ready || (iDrivigFlags & movePress))
|
||||||
if (fabs(mvControlling->Im) <
|
{
|
||||||
(fReady < 0.4 ? mvControlling->Imin : mvControlling->IminLo))
|
bool scndctrl = ((mvOccupied->Vel <= 30) ||
|
||||||
{ // Ra: wywalał nadmiarowy, bo Im może być ujemne; jak nie odhamowany, to nie
|
(mvControlling->Imax > mvControlling->ImaxLo) ||
|
||||||
// przesadzać z prądem
|
(fVoltage + fVoltage <
|
||||||
if ((mvOccupied->Vel <= 30) ||
|
mvControlling->EnginePowerSource.CollectorParameters.MinV +
|
||||||
(mvControlling->Imax > mvControlling->ImaxLo) ||
|
mvControlling->EnginePowerSource.CollectorParameters.MaxV) ||
|
||||||
(fVoltage + fVoltage <
|
(mvControlling->MainCtrlPos == mvControlling->MainCtrlPosNo));
|
||||||
mvControlling->EnginePowerSource.CollectorParameters.MinV +
|
scndctrl = ((scndctrl) && (mvControlling->MainCtrlPos > 1) && (mvControlling->RList[mvControlling->MainCtrlActualPos].R < 0.01)&& (mvControlling->ScndCtrlPos != mvControlling->ScndCtrlPosNo));
|
||||||
mvControlling->EnginePowerSource.CollectorParameters.MaxV))
|
double Vs = 99999;
|
||||||
{ // bocznik na szeregowej przy ciezkich bruttach albo przy wysokim rozruchu
|
if((mvControlling->MainCtrlPos != mvControlling->MainCtrlPosNo)||(mvControlling->ScndCtrlPos!=mvControlling->ScndCtrlPosNo))
|
||||||
// pod górę albo przy niskim napięciu
|
Vs = ESMVelocity(!scndctrl);
|
||||||
if (mvControlling->MainCtrlPos ?
|
|
||||||
mvControlling->RList[mvControlling->MainCtrlPos].R > 0.0 :
|
if ((fabs(mvControlling->Im) <
|
||||||
true) // oporowa
|
(fReady < 0.4 ? mvControlling->Imin : mvControlling->IminLo))||(mvControlling->Vel>Vs))
|
||||||
{
|
{ // Ra: wywalał nadmiarowy, bo Im może być ujemne; jak nie odhamowany, to nie
|
||||||
OK = (mvControlling->DelayCtrlFlag ?
|
// przesadzać z prądem
|
||||||
true :
|
if ((mvOccupied->Vel <= 30) ||
|
||||||
mvControlling->IncMainCtrl(1)); // kręcimy nastawnik jazdy
|
(mvControlling->Imax > mvControlling->ImaxLo) ||
|
||||||
if ((OK) &&
|
(fVoltage + fVoltage <
|
||||||
(mvControlling->MainCtrlPos ==
|
mvControlling->EnginePowerSource.CollectorParameters.MinV +
|
||||||
1)) // czekaj na 1 pozycji, zanim się nie włączą liniowe
|
mvControlling->EnginePowerSource.CollectorParameters.MaxV))
|
||||||
iDrivigFlags |= moveIncSpeed;
|
{ // bocznik na szeregowej przy ciezkich bruttach albo przy wysokim rozruchu
|
||||||
else
|
// pod górę albo przy niskim napięciu
|
||||||
iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi czekania
|
if (mvControlling->MainCtrlPos ?
|
||||||
}
|
mvControlling->RList[mvControlling->MainCtrlPos].R > 0.0 :
|
||||||
else // jeśli bezoporowa (z wyjątekiem 0)
|
true) // oporowa
|
||||||
OK = false; // to dać bocznik
|
{
|
||||||
}
|
OK = (mvControlling->DelayCtrlFlag ?
|
||||||
else
|
true :
|
||||||
{ // przekroczone 30km/h, można wejść na jazdę równoległą
|
mvControlling->IncMainCtrl(1)); // kręcimy nastawnik jazdy
|
||||||
if (mvControlling->ScndCtrlPos) // jeśli ustawiony bocznik
|
if ((OK) &&
|
||||||
if (mvControlling->MainCtrlPos <
|
(mvControlling->MainCtrlPos ==
|
||||||
mvControlling->MainCtrlPosNo - 1) // a nie jest ostatnia pozycja
|
1)) // czekaj na 1 pozycji, zanim się nie włączą liniowe
|
||||||
mvControlling->DecScndCtrl(2); // to bocznik na zero po chamsku
|
iDrivigFlags |= moveIncSpeed;
|
||||||
// (ktoś miał to poprawić...)
|
else
|
||||||
OK = mvControlling->IncMainCtrl(1);
|
iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi czekania
|
||||||
}
|
}
|
||||||
if ((mvControlling->MainCtrlPos > 2) &&
|
else // jeśli bezoporowa (z wyjątekiem 0)
|
||||||
(mvControlling->Im == 0)) // brak prądu na dalszych pozycjach
|
OK = false; // to dać bocznik
|
||||||
Need_TryAgain = true; // nie załączona lokomotywa albo wywalił
|
}
|
||||||
// nadmiarowy
|
else
|
||||||
else if (!OK) // nie da się wrzucić kolejnej pozycji
|
{ // przekroczone 30km/h, można wejść na jazdę równoległą
|
||||||
OK = mvControlling->IncScndCtrl(1); // to dać bocznik
|
if (mvControlling->ScndCtrlPos) // jeśli ustawiony bocznik
|
||||||
}
|
if (mvControlling->MainCtrlPos <
|
||||||
|
mvControlling->MainCtrlPosNo - 1) // a nie jest ostatnia pozycja
|
||||||
|
mvControlling->DecScndCtrl(2); // to bocznik na zero po chamsku
|
||||||
|
// (ktoś miał to poprawić...)
|
||||||
|
OK = mvControlling->IncMainCtrl(1);
|
||||||
|
}
|
||||||
|
if ((mvControlling->MainCtrlPos > 2) &&
|
||||||
|
(mvControlling->Im == 0)) // brak prądu na dalszych pozycjach
|
||||||
|
Need_TryAgain = true; // nie załączona lokomotywa albo wywalił
|
||||||
|
// nadmiarowy
|
||||||
|
else if (!OK) // nie da się wrzucić kolejnej pozycji
|
||||||
|
OK = mvControlling->IncScndCtrl(1); // to dać bocznik
|
||||||
|
}
|
||||||
|
}
|
||||||
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
|
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
|
||||||
break;
|
break;
|
||||||
case Dumb:
|
case Dumb:
|
||||||
|
|||||||
3
Driver.h
3
Driver.h
@@ -144,7 +144,7 @@ class TSpeedPos
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void Clear();
|
void Clear();
|
||||||
bool Update(vector3 *p, vector3 *dir, double &len, TOrders const &Orders );
|
bool Update(vector3 *p, vector3 *dir, double &len );
|
||||||
bool Set(TEvent *e, double d, TOrders order = Wait_for_orders);
|
bool Set(TEvent *e, double d, TOrders order = Wait_for_orders);
|
||||||
void Set(TTrack *t, double d, int f);
|
void Set(TTrack *t, double d, int f);
|
||||||
std::string TableText();
|
std::string TableText();
|
||||||
@@ -310,6 +310,7 @@ class TController
|
|||||||
void Activation(); // umieszczenie obsady w odpowiednim członie
|
void Activation(); // umieszczenie obsady w odpowiednim członie
|
||||||
void ControllingSet(); // znajduje człon do sterowania
|
void ControllingSet(); // znajduje człon do sterowania
|
||||||
void AutoRewident(); // ustawia hamulce w składzie
|
void AutoRewident(); // ustawia hamulce w składzie
|
||||||
|
double ESMVelocity(bool Main);
|
||||||
public:
|
public:
|
||||||
Mtable::TTrainParameters *Timetable()
|
Mtable::TTrainParameters *Timetable()
|
||||||
{
|
{
|
||||||
|
|||||||
64
Model3d.cpp
64
Model3d.cpp
@@ -639,70 +639,6 @@ basic_vertex *TSubModel::TrianglePtr(int tex, int pos, glm::vec3 const &Ambient,
|
|||||||
return s->Vertices + pos; // wskaźnik na wolne miejsce w tabeli wierzchołków
|
return s->Vertices + pos; // wskaźnik na wolne miejsce w tabeli wierzchołków
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void TSubModel::DisplayLists()
|
|
||||||
{ // utworznie po jednej skompilowanej liście dla
|
|
||||||
// każdego submodelu
|
|
||||||
if (eType < TP_ROTATOR)
|
|
||||||
{
|
|
||||||
if (iNumVerts > 0)
|
|
||||||
{
|
|
||||||
uiDisplayList = glGenLists(1);
|
|
||||||
glNewList(uiDisplayList, GL_COMPILE);
|
|
||||||
#ifdef USE_VERTEX_ARRAYS
|
|
||||||
// ShaXbee-121209: przekazywanie wierzcholkow hurtem
|
|
||||||
glVertexPointer(3, GL_DOUBLE, sizeof(GLVERTEX), &Vertices[0].Point.x);
|
|
||||||
glNormalPointer(GL_DOUBLE, sizeof(GLVERTEX), &Vertices[0].Normal.x);
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(GLVERTEX), &Vertices[0].tu);
|
|
||||||
glDrawArrays(eType, 0, iNumVerts);
|
|
||||||
#else
|
|
||||||
glBegin(eType);
|
|
||||||
for (int i = 0; i < iNumVerts; i++)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
glNormal3dv(&Vertices[i].Normal.x);
|
|
||||||
glTexCoord2f(Vertices[i].tu,Vertices[i].tv);
|
|
||||||
glVertex3dv(&Vertices[i].Point.x);
|
|
||||||
*/
|
|
||||||
glNormal3fv(glm::value_ptr(Vertices[i].normal));
|
|
||||||
glTexCoord2fv(glm::value_ptr(Vertices[i].material));
|
|
||||||
glVertex3fv(glm::value_ptr(Vertices[i].position));
|
|
||||||
};
|
|
||||||
glEnd();
|
|
||||||
#endif
|
|
||||||
glEndList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (eType == TP_FREESPOTLIGHT)
|
|
||||||
{
|
|
||||||
uiDisplayList = glGenLists(1);
|
|
||||||
glNewList(uiDisplayList, GL_COMPILE);
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
glVertex3f( 0.0f, 0.0f, -0.05f ); // shift point towards the viewer, to avoid z-fighting with the light polygons
|
|
||||||
glEnd();
|
|
||||||
glEndList();
|
|
||||||
}
|
|
||||||
else if (eType == TP_STARS)
|
|
||||||
{ // punkty świecące dookólnie
|
|
||||||
uiDisplayList = glGenLists(1);
|
|
||||||
glNewList(uiDisplayList, GL_COMPILE);
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
for (int i = 0; i < iNumVerts; ++i)
|
|
||||||
{
|
|
||||||
glColor3fv(glm::value_ptr(Vertices[i].normal));
|
|
||||||
glVertex3fv(glm::value_ptr(Vertices[i].position));
|
|
||||||
};
|
|
||||||
glEnd();
|
|
||||||
glEndList();
|
|
||||||
}
|
|
||||||
// SafeDeleteArray(Vertices); //przy VBO muszą zostać do załadowania całego
|
|
||||||
// modelu
|
|
||||||
if (Child)
|
|
||||||
Child->DisplayLists();
|
|
||||||
if (Next)
|
|
||||||
Next->DisplayLists();
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void TSubModel::InitialRotate(bool doit)
|
void TSubModel::InitialRotate(bool doit)
|
||||||
{ // konwersja układu współrzędnych na zgodny ze scenerią
|
{ // konwersja układu współrzędnych na zgodny ze scenerią
|
||||||
|
|||||||
6
color.h
6
color.h
@@ -76,9 +76,9 @@ HSVtoRGB( glm::vec3 const &HSV ) {
|
|||||||
hh /= 60.0;
|
hh /= 60.0;
|
||||||
int const i = (int)hh;
|
int const i = (int)hh;
|
||||||
float const ff = hh - i;
|
float const ff = hh - i;
|
||||||
float const p = HSV.z * ( 1.0 - HSV.y );
|
float const p = HSV.z * ( 1.f - HSV.y );
|
||||||
float const q = HSV.z * ( 1.0 - ( HSV.y * ff ) );
|
float const q = HSV.z * ( 1.f - ( HSV.y * ff ) );
|
||||||
float const t = HSV.z * ( 1.0 - ( HSV.y * ( 1.0 - ff ) ) );
|
float const t = HSV.z * ( 1.f - ( HSV.y * ( 1.f - ff ) ) );
|
||||||
|
|
||||||
switch( i ) {
|
switch( i ) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
28
moon.cpp
28
moon.cpp
@@ -45,8 +45,8 @@ cMoon::update() {
|
|||||||
|
|
||||||
move();
|
move();
|
||||||
glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor );
|
glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor );
|
||||||
position = glm::rotateX( position, glm::radians<float>( m_body.elevref ) );
|
position = glm::rotateX( position, glm::radians( static_cast<float>( m_body.elevref ) ) );
|
||||||
position = glm::rotateY( position, glm::radians<float>( -m_body.hrang ) );
|
position = glm::rotateY( position, glm::radians( static_cast<float>( -m_body.hrang ) ) );
|
||||||
|
|
||||||
m_position = position;
|
m_position = position;
|
||||||
}
|
}
|
||||||
@@ -54,16 +54,16 @@ cMoon::update() {
|
|||||||
void
|
void
|
||||||
cMoon::render() {
|
cMoon::render() {
|
||||||
|
|
||||||
glColor4f( 225.0f/255.0f, 225.0f/255.0f, 255.0f/255.0f, 1.f );
|
::glColor4f( 225.f / 255.f, 225.f / 255.f, 255.f / 255.f, 1.f );
|
||||||
// debug line to locate the sun easier
|
// debug line to locate the moon easier
|
||||||
glBegin( GL_LINES );
|
::glBegin( GL_LINES );
|
||||||
glVertex3f( m_position.x, m_position.y, m_position.z );
|
::glVertex3fv( glm::value_ptr( m_position ) );
|
||||||
glVertex3f( m_position.x, 0.0f, m_position.z );
|
::glVertex3f( m_position.x, 0.f, m_position.z );
|
||||||
glEnd();
|
::glEnd();
|
||||||
glPushMatrix();
|
::glPushMatrix();
|
||||||
glTranslatef( m_position.x, m_position.y, m_position.z );
|
::glTranslatef( m_position.x, m_position.y, m_position.z );
|
||||||
gluSphere( moonsphere, /* (float)( Global::ScreenHeight / Global::FieldOfView ) * 0.5 * */ ( m_body.distance / 60.2666 ) * 9.037461, 12, 12 );
|
::gluSphere( moonsphere, /* (float)( Global::iWindowHeight / Global::FieldOfView ) * 0.5 * */ ( m_body.distance / 60.2666 ) * 9.037461, 12, 12 );
|
||||||
glPopMatrix();
|
::glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3
|
glm::vec3
|
||||||
@@ -85,8 +85,8 @@ float cMoon::getIntensity() {
|
|||||||
// calculating intensity of the sun instead, and returning 15% of the value,
|
// calculating intensity of the sun instead, and returning 15% of the value,
|
||||||
// which roughly matches how much sunlight is reflected by the moon
|
// which roughly matches how much sunlight is reflected by the moon
|
||||||
// We alter the intensity further based on current phase of the moon
|
// We alter the intensity further based on current phase of the moon
|
||||||
auto const phasefactor = 1.0f - std::abs( m_phase - 29.53f * 0.5f ) / ( 29.53 * 0.5f );
|
auto const phasefactor = 1.0f - std::abs( m_phase - 29.53f * 0.5f ) / ( 29.53f * 0.5f );
|
||||||
return (float)( m_body.etr/ 1399.0 ) * phasefactor * 0.15f; // arbitrary scaling factor taken from etrn value
|
return static_cast<float>( ( m_body.etr/ 1399.0 ) * phasefactor * 0.15 ); // arbitrary scaling factor taken from etrn value
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMoon::setLocation( float const Longitude, float const Latitude ) {
|
void cMoon::setLocation( float const Longitude, float const Latitude ) {
|
||||||
|
|||||||
@@ -250,7 +250,6 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ErrorLog( "Shadows framebuffer setup failed" );
|
ErrorLog( "Shadows framebuffer setup failed" );
|
||||||
m_framebuffersupport = false;
|
|
||||||
Global::RenderShadows = false;
|
Global::RenderShadows = false;
|
||||||
}
|
}
|
||||||
::glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch back to primary render target for now
|
::glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch back to primary render target for now
|
||||||
|
|||||||
21
sky.cpp
21
sky.cpp
@@ -24,25 +24,4 @@ void TSky::Init() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void TSky::Render( glm::vec3 const &Tint )
|
|
||||||
{
|
|
||||||
if (mdCloud)
|
|
||||||
{ // jeśli jest model nieba
|
|
||||||
// setup
|
|
||||||
::glEnable( GL_LIGHTING );
|
|
||||||
GfxRenderer.Disable_Lights();
|
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr(Tint) );
|
|
||||||
// render
|
|
||||||
GfxRenderer.Render( mdCloud, nullptr, 100.0 );
|
|
||||||
GfxRenderer.Render_Alpha( mdCloud, nullptr, 100.0 );
|
|
||||||
// post-render cleanup
|
|
||||||
GLfloat noambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, noambient );
|
|
||||||
::glEnable( GL_LIGHT0 ); // other lights will be enabled during lights update
|
|
||||||
::glDisable( GL_LIGHTING );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
3
sky.h
3
sky.h
@@ -21,9 +21,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void Render( glm::vec3 const &Tint = glm::vec3(1.0f, 1.0f, 1.0f) );
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
3
stars.h
3
stars.h
@@ -15,9 +15,6 @@ public:
|
|||||||
|
|
||||||
// methods:
|
// methods:
|
||||||
void init();
|
void init();
|
||||||
#ifdef EU07_USE_OLD_RENDERCODE
|
|
||||||
void render();
|
|
||||||
#endif
|
|
||||||
// constructors:
|
// constructors:
|
||||||
|
|
||||||
// deconstructor:
|
// deconstructor:
|
||||||
|
|||||||
28
sun.cpp
28
sun.cpp
@@ -41,8 +41,8 @@ cSun::update() {
|
|||||||
|
|
||||||
move();
|
move();
|
||||||
glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor );
|
glm::vec3 position( 0.f, 0.f, -2000.f * Global::fDistanceFactor );
|
||||||
position = glm::rotateX( position, glm::radians<float>( m_body.elevref ) );
|
position = glm::rotateX( position, glm::radians( static_cast<float>( m_body.elevref ) ) );
|
||||||
position = glm::rotateY( position, glm::radians<float>( -m_body.hrang ) );
|
position = glm::rotateY( position, glm::radians( static_cast<float>( -m_body.hrang ) ) );
|
||||||
|
|
||||||
m_position = position;
|
m_position = position;
|
||||||
}
|
}
|
||||||
@@ -50,23 +50,17 @@ cSun::update() {
|
|||||||
void
|
void
|
||||||
cSun::render() {
|
cSun::render() {
|
||||||
|
|
||||||
/*
|
::glColor4f( 255.f / 255.f, 242.f / 255.f, 231.f / 255.f, 1.f );
|
||||||
glLightfv(GL_LIGHT0, GL_POSITION, position.getVector() ); // sun
|
|
||||||
|
|
||||||
GLfloat LightPosition[]= { 10.0f, 50.0f, -5.0f, 1.0f }; // ambient
|
|
||||||
glLightfv(GL_LIGHT1, GL_POSITION, LightPosition );
|
|
||||||
*/
|
|
||||||
glColor4f( 255.0f/255.0f, 242.0f/255.0f, 231.0f/255.0f, 1.f );
|
|
||||||
// debug line to locate the sun easier
|
// debug line to locate the sun easier
|
||||||
glBegin( GL_LINES );
|
::glBegin( GL_LINES );
|
||||||
glVertex3f( m_position.x, m_position.y, m_position.z );
|
::glVertex3fv( glm::value_ptr( m_position ) );
|
||||||
glVertex3f( m_position.x, 0.0f, m_position.z );
|
::glVertex3f( m_position.x, 0.f, m_position.z );
|
||||||
glEnd();
|
::glEnd();
|
||||||
glPushMatrix();
|
::glPushMatrix();
|
||||||
glTranslatef( m_position.x, m_position.y, m_position.z );
|
::glTranslatef( m_position.x, m_position.y, m_position.z );
|
||||||
// radius is a result of scaling true distance down to 2km -- it's scaled by equal ratio
|
// radius is a result of scaling true distance down to 2km -- it's scaled by equal ratio
|
||||||
gluSphere( sunsphere, (float)(m_body.distance * 9.359157), 12, 12 );
|
::gluSphere( sunsphere, m_body.distance * 9.359157, 12, 12 );
|
||||||
glPopMatrix();
|
::glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3
|
glm::vec3
|
||||||
|
|||||||
Reference in New Issue
Block a user