mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 05:09:19 +02:00
render code relocation continued
This commit is contained in:
@@ -411,11 +411,6 @@ TAnimModel::TAnimModel()
|
|||||||
pModel = NULL;
|
pModel = NULL;
|
||||||
iNumLights = 0;
|
iNumLights = 0;
|
||||||
fBlinkTimer = 0;
|
fBlinkTimer = 0;
|
||||||
ReplacableSkinId[0] = 0;
|
|
||||||
ReplacableSkinId[1] = 0;
|
|
||||||
ReplacableSkinId[2] = 0;
|
|
||||||
ReplacableSkinId[3] = 0;
|
|
||||||
ReplacableSkinId[4] = 0;
|
|
||||||
for (int i = 0; i < iMaxNumLights; i++)
|
for (int i = 0; i < iMaxNumLights; i++)
|
||||||
{
|
{
|
||||||
LightsOn[i] = LightsOff[i] = NULL; // normalnie nie ma
|
LightsOn[i] = LightsOff[i] = NULL; // normalnie nie ma
|
||||||
@@ -448,16 +443,16 @@ bool TAnimModel::Init(std::string const &asName, std::string const &asReplacable
|
|||||||
"*") // od gwiazdki zaczynają się teksty na wyświetlaczach
|
"*") // od gwiazdki zaczynają się teksty na wyświetlaczach
|
||||||
asText = asReplacableTexture.substr(1, asReplacableTexture.length() - 1); // zapamiętanie tekstu
|
asText = asReplacableTexture.substr(1, asReplacableTexture.length() - 1); // zapamiętanie tekstu
|
||||||
else if (asReplacableTexture != "none")
|
else if (asReplacableTexture != "none")
|
||||||
ReplacableSkinId[1] =
|
m_materialdata.replacable_skins[1] =
|
||||||
GfxRenderer.GetTextureId( asReplacableTexture, "" );
|
GfxRenderer.GetTextureId( asReplacableTexture, "" );
|
||||||
if( ( ReplacableSkinId[ 1 ] != 0 )
|
if( ( m_materialdata.replacable_skins[ 1 ] != 0 )
|
||||||
&& ( GfxRenderer.Texture( ReplacableSkinId[ 1 ] ).has_alpha ) ) {
|
&& ( GfxRenderer.Texture( m_materialdata.replacable_skins[ 1 ] ).has_alpha ) ) {
|
||||||
// tekstura z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
// tekstura z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||||
iTexAlpha = 0x31310031;
|
m_materialdata.textures_alpha = 0x31310031;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// tekstura nieprzezroczysta - nie renderować w cyklu
|
// tekstura nieprzezroczysta - nie renderować w cyklu
|
||||||
iTexAlpha = 0x30300030;
|
m_materialdata.textures_alpha = 0x30300030;
|
||||||
}
|
}
|
||||||
// przezroczystych
|
// przezroczystych
|
||||||
return (Init(TModelsManager::GetModel(asName)));
|
return (Init(TModelsManager::GetModel(asName)));
|
||||||
@@ -632,8 +627,8 @@ void TAnimModel::RenderAlphaDL(vector3 pPosition, double fAngle)
|
|||||||
int TAnimModel::Flags()
|
int TAnimModel::Flags()
|
||||||
{ // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed
|
{ // informacja dla TGround, czy ma być w Render, RenderAlpha, czy RenderMixed
|
||||||
int i = pModel ? pModel->Flags() : 0; // pobranie flag całego modelu
|
int i = pModel ? pModel->Flags() : 0; // pobranie flag całego modelu
|
||||||
if (ReplacableSkinId[1] > 0) // jeśli ma wymienną teksturę 0
|
if( m_materialdata.replacable_skins[ 1 ] > 0 ) // jeśli ma wymienną teksturę 0
|
||||||
i |= (i & 0x01010001) * ((iTexAlpha & 1) ? 0x20 : 0x10);
|
i |= (i & 0x01010001) * ((m_materialdata.textures_alpha & 1) ? 0x20 : 0x10);
|
||||||
// if (ReplacableSkinId[2]>0) //jeśli ma wymienną teksturę 1
|
// if (ReplacableSkinId[2]>0) //jeśli ma wymienną teksturę 1
|
||||||
// i|=(i&0x02020002)*((iTexAlpha&1)?0x10:0x08);
|
// i|=(i&0x02020002)*((iTexAlpha&1)?0x10:0x08);
|
||||||
// if (ReplacableSkinId[3]>0) //jeśli ma wymienną teksturę 2
|
// if (ReplacableSkinId[3]>0) //jeśli ma wymienną teksturę 2
|
||||||
@@ -652,14 +647,15 @@ void TAnimModel::RenderDL(vector3 *vPosition)
|
|||||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
RaAnimate(); // jednorazowe przeliczenie animacji
|
||||||
RaPrepare();
|
RaPrepare();
|
||||||
if( pModel ) // renderowanie rekurencyjne submodeli
|
if( pModel ) // renderowanie rekurencyjne submodeli
|
||||||
pModel->Render(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
GfxRenderer.Render( pModel, Material(), *vPosition, vAngle );
|
||||||
};
|
};
|
||||||
void TAnimModel::RenderAlphaDL(vector3 *vPosition)
|
void TAnimModel::RenderAlphaDL(vector3 *vPosition)
|
||||||
{
|
{
|
||||||
RaPrepare();
|
RaPrepare();
|
||||||
if (pModel) // renderowanie rekurencyjne submodeli
|
if (pModel) // renderowanie rekurencyjne submodeli
|
||||||
pModel->RenderAlpha(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
GfxRenderer.Render_Alpha( pModel, Material(), *vPosition, vAngle );
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
void TAnimModel::RenderVBO(vector3 *vPosition)
|
void TAnimModel::RenderVBO(vector3 *vPosition)
|
||||||
{
|
{
|
||||||
RaAnimate(); // jednorazowe przeliczenie animacji
|
RaAnimate(); // jednorazowe przeliczenie animacji
|
||||||
@@ -673,6 +669,7 @@ void TAnimModel::RenderAlphaVBO(vector3 *vPosition)
|
|||||||
if (pModel) // renderowanie rekurencyjne submodeli
|
if (pModel) // renderowanie rekurencyjne submodeli
|
||||||
pModel->RaRenderAlpha(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
pModel->RaRenderAlpha(vPosition, &vAngle, ReplacableSkinId, iTexAlpha);
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool TAnimModel::TerrainLoaded()
|
bool TAnimModel::TerrainLoaded()
|
||||||
|
|||||||
15
AnimModel.h
15
AnimModel.h
@@ -17,6 +17,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
#include "Model3d.h"
|
#include "Model3d.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
|
#include "DynObj.h"
|
||||||
|
|
||||||
const int iMaxNumLights = 8;
|
const int iMaxNumLights = 8;
|
||||||
|
|
||||||
@@ -138,7 +139,11 @@ class TAnimModel
|
|||||||
TSubModel *LightsOn[iMaxNumLights]; // Ra: te wskaźniki powinny być w ramach TModel3d
|
TSubModel *LightsOn[iMaxNumLights]; // Ra: te wskaźniki powinny być w ramach TModel3d
|
||||||
TSubModel *LightsOff[iMaxNumLights];
|
TSubModel *LightsOff[iMaxNumLights];
|
||||||
vector3 vAngle; // bazowe obroty egzemplarza względem osi
|
vector3 vAngle; // bazowe obroty egzemplarza względem osi
|
||||||
|
/*
|
||||||
int iTexAlpha; //żeby nie sprawdzać za każdym razem, dla 4 wymiennych tekstur
|
int iTexAlpha; //żeby nie sprawdzać za każdym razem, dla 4 wymiennych tekstur
|
||||||
|
*/
|
||||||
|
material_data m_materialdata;
|
||||||
|
|
||||||
std::string asText; // tekst dla wyświetlacza znakowego
|
std::string asText; // tekst dla wyświetlacza znakowego
|
||||||
TAnimAdvanced *pAdvanced;
|
TAnimAdvanced *pAdvanced;
|
||||||
void Advanced();
|
void Advanced();
|
||||||
@@ -149,9 +154,13 @@ class TAnimModel
|
|||||||
void RaAnimate(); // przeliczenie animacji egzemplarza
|
void RaAnimate(); // przeliczenie animacji egzemplarza
|
||||||
void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
|
void RaPrepare(); // ustawienie animacji egzemplarza na wzorcu
|
||||||
public:
|
public:
|
||||||
|
/*
|
||||||
texture_manager::size_type ReplacableSkinId[5]; // McZapkie-020802: zmienialne skory
|
texture_manager::size_type ReplacableSkinId[5]; // McZapkie-020802: zmienialne skory
|
||||||
static TAnimContainer *acAnimList; // lista animacji z eventem, które muszą być przeliczane
|
*/
|
||||||
// również bez wyświetlania
|
static TAnimContainer *acAnimList; // lista animacji z eventem, które muszą być przeliczane również bez wyświetlania
|
||||||
|
inline
|
||||||
|
material_data const *Material() const { return &m_materialdata; }
|
||||||
|
|
||||||
TAnimModel();
|
TAnimModel();
|
||||||
~TAnimModel();
|
~TAnimModel();
|
||||||
bool Init(TModel3d *pNewModel);
|
bool Init(TModel3d *pNewModel);
|
||||||
@@ -165,8 +174,10 @@ class TAnimModel
|
|||||||
void RenderAlphaVBO(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
void RenderAlphaVBO(vector3 pPosition = vector3(0, 0, 0), double fAngle = 0);
|
||||||
*/ void RenderDL(vector3 *vPosition);
|
*/ void RenderDL(vector3 *vPosition);
|
||||||
void RenderAlphaDL(vector3 *vPosition);
|
void RenderAlphaDL(vector3 *vPosition);
|
||||||
|
/*
|
||||||
void RenderVBO(vector3 *vPosition);
|
void RenderVBO(vector3 *vPosition);
|
||||||
void RenderAlphaVBO(vector3 *vPosition);
|
void RenderAlphaVBO(vector3 *vPosition);
|
||||||
|
*/
|
||||||
int Flags();
|
int Flags();
|
||||||
void RaAnglesSet(double a, double b, double c)
|
void RaAnglesSet(double a, double b, double c)
|
||||||
{
|
{
|
||||||
|
|||||||
99
DynObj.cpp
99
DynObj.cpp
@@ -1692,12 +1692,6 @@ TDynamicObject::TDynamicObject()
|
|||||||
//}
|
//}
|
||||||
mdModel = NULL;
|
mdModel = NULL;
|
||||||
mdKabina = NULL;
|
mdKabina = NULL;
|
||||||
ReplacableSkinID[0] = 0;
|
|
||||||
ReplacableSkinID[1] = 0;
|
|
||||||
ReplacableSkinID[2] = 0;
|
|
||||||
ReplacableSkinID[3] = 0;
|
|
||||||
ReplacableSkinID[4] = 0;
|
|
||||||
iAlpha = 0x30300030; // tak gdy tekstury wymienne nie mają przezroczystości
|
|
||||||
// smWiazary[0]=smWiazary[1]=NULL;
|
// smWiazary[0]=smWiazary[1]=NULL;
|
||||||
smWahacze[0] = smWahacze[1] = smWahacze[2] = smWahacze[3] = NULL;
|
smWahacze[0] = smWahacze[1] = smWahacze[2] = smWahacze[3] = NULL;
|
||||||
fWahaczeAmp = 0;
|
fWahaczeAmp = 0;
|
||||||
@@ -4350,12 +4344,12 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
|||||||
|
|
||||||
if( token == "models:") {
|
if( token == "models:") {
|
||||||
// modele i podmodele
|
// modele i podmodele
|
||||||
iMultiTex = 0; // czy jest wiele tekstur wymiennych?
|
m_materialdata.multi_textures = 0; // czy jest wiele tekstur wymiennych?
|
||||||
parser.getTokens();
|
parser.getTokens();
|
||||||
parser >> asModel;
|
parser >> asModel;
|
||||||
if( asModel[asModel.size() - 1] == '#' ) // Ra 2015-01: nie podoba mi siê to
|
if( asModel[asModel.size() - 1] == '#' ) // Ra 2015-01: nie podoba mi siê to
|
||||||
{ // model wymaga wielu tekstur wymiennych
|
{ // model wymaga wielu tekstur wymiennych
|
||||||
iMultiTex = 1;
|
m_materialdata.multi_textures = 1;
|
||||||
asModel.erase( asModel.length() - 1 );
|
asModel.erase( asModel.length() - 1 );
|
||||||
}
|
}
|
||||||
std::size_t i = asModel.find( ',' );
|
std::size_t i = asModel.find( ',' );
|
||||||
@@ -4365,11 +4359,8 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
|||||||
// liczba
|
// liczba
|
||||||
// tekstur?
|
// tekstur?
|
||||||
if (i < asModel.length())
|
if (i < asModel.length())
|
||||||
iMultiTex = asModel[i + 1] - '0';
|
m_materialdata.multi_textures = asModel[i + 1] - '0';
|
||||||
if (iMultiTex < 0)
|
m_materialdata.multi_textures = clamp( m_materialdata.multi_textures, 0, 1 ); // na razie ustawiamy na 1
|
||||||
iMultiTex = 0;
|
|
||||||
else if (iMultiTex > 1)
|
|
||||||
iMultiTex = 1; // na razie ustawiamy na 1
|
|
||||||
}
|
}
|
||||||
asModel = BaseDir + asModel; // McZapkie 2002-07-20: dynamics maja swoje
|
asModel = BaseDir + asModel; // McZapkie 2002-07-20: dynamics maja swoje
|
||||||
// modele w dynamics/basedir
|
// modele w dynamics/basedir
|
||||||
@@ -4382,7 +4373,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
|||||||
Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
|
Global::asCurrentTexturePath + ReplacableSkin; // skory tez z dynamic/...
|
||||||
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
|
std::string x = TextureTest(Global::asCurrentTexturePath + "nowhere"); // na razie prymitywnie
|
||||||
if (!x.empty())
|
if (!x.empty())
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9);
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( Global::asCurrentTexturePath + "nowhere", "", 9 );
|
||||||
/*
|
/*
|
||||||
if ((i = ReplacableSkin.Pos("|")) > 0) // replacable dzielone
|
if ((i = ReplacableSkin.Pos("|")) > 0) // replacable dzielone
|
||||||
{
|
{
|
||||||
@@ -4443,62 +4434,53 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (iMultiTex > 0)
|
if (m_materialdata.multi_textures > 0)
|
||||||
{ // jeśli model ma 4 tekstury
|
{ // jeśli model ma 4 tekstury
|
||||||
ReplacableSkinID[1] = GfxRenderer.GetTextureId(
|
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
|
||||||
ReplacableSkin + ",1", "", Global::iDynamicFiltering);
|
ReplacableSkin + ",1", "", Global::iDynamicFiltering);
|
||||||
if (ReplacableSkinID[1])
|
if( m_materialdata.replacable_skins[ 1 ] )
|
||||||
{ // pierwsza z zestawu znaleziona
|
{ // pierwsza z zestawu znaleziona
|
||||||
ReplacableSkinID[2] = GfxRenderer.GetTextureId(
|
m_materialdata.replacable_skins[ 2 ] = GfxRenderer.GetTextureId(
|
||||||
ReplacableSkin + ",2", "", Global::iDynamicFiltering);
|
ReplacableSkin + ",2", "", Global::iDynamicFiltering);
|
||||||
if (ReplacableSkinID[2])
|
if( m_materialdata.replacable_skins[ 2 ] )
|
||||||
{
|
{
|
||||||
iMultiTex = 2; // już są dwie
|
m_materialdata.multi_textures = 2; // już są dwie
|
||||||
ReplacableSkinID[3] = GfxRenderer.GetTextureId(
|
m_materialdata.replacable_skins[ 3 ] = GfxRenderer.GetTextureId(
|
||||||
ReplacableSkin + ",3", "", Global::iDynamicFiltering);
|
ReplacableSkin + ",3", "", Global::iDynamicFiltering);
|
||||||
if (ReplacableSkinID[3])
|
if( m_materialdata.replacable_skins[ 3 ] )
|
||||||
{
|
{
|
||||||
iMultiTex = 3; // a teraz nawet trzy
|
m_materialdata.multi_textures = 3; // a teraz nawet trzy
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId(
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId(
|
||||||
ReplacableSkin + ",4", "", Global::iDynamicFiltering);
|
ReplacableSkin + ",4", "", Global::iDynamicFiltering);
|
||||||
if (ReplacableSkinID[4])
|
if( m_materialdata.replacable_skins[ 4 ] )
|
||||||
iMultiTex = 4; // jak są cztery, to blokujemy podmianę tekstury
|
m_materialdata.multi_textures = 4; // jak są cztery, to blokujemy podmianę tekstury
|
||||||
// rozkładem
|
// rozkładem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // zestaw nie zadziałał, próbujemy normanie
|
{ // zestaw nie zadziałał, próbujemy normanie
|
||||||
iMultiTex = 0;
|
m_materialdata.multi_textures = 0;
|
||||||
ReplacableSkinID[1] = GfxRenderer.GetTextureId(
|
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
|
||||||
ReplacableSkin, "", Global::iDynamicFiltering);
|
ReplacableSkin, "", Global::iDynamicFiltering);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ReplacableSkinID[1] = GfxRenderer.GetTextureId(
|
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.GetTextureId(
|
||||||
ReplacableSkin, "", Global::iDynamicFiltering);
|
ReplacableSkin, "", Global::iDynamicFiltering);
|
||||||
if (GfxRenderer.Texture(ReplacableSkinID[1]).has_alpha)
|
if( GfxRenderer.Texture( m_materialdata.replacable_skins[ 1 ] ).has_alpha )
|
||||||
iAlpha = 0x31310031; // tekstura -1 z kanałem alfa - nie renderować w cyklu
|
m_materialdata.textures_alpha = 0x31310031; // tekstura -1 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||||
// nieprzezroczystych
|
|
||||||
else
|
else
|
||||||
iAlpha = 0x30300030; // wszystkie tekstury nieprzezroczyste - nie
|
m_materialdata.textures_alpha = 0x30300030; // wszystkie tekstury nieprzezroczyste - nie renderować w cyklu przezroczystych
|
||||||
// renderować w
|
if( m_materialdata.replacable_skins[ 2 ] )
|
||||||
// cyklu przezroczystych
|
if( GfxRenderer.Texture( m_materialdata.replacable_skins[ 2 ] ).has_alpha )
|
||||||
if (ReplacableSkinID[2])
|
m_materialdata.textures_alpha |= 0x02020002; // tekstura -2 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||||
if (GfxRenderer.Texture(ReplacableSkinID[2]).has_alpha)
|
if( m_materialdata.replacable_skins[ 3 ] )
|
||||||
iAlpha |= 0x02020002; // tekstura -2 z kanałem alfa - nie renderować
|
if( GfxRenderer.Texture( m_materialdata.replacable_skins[ 3 ] ).has_alpha )
|
||||||
// w cyklu
|
m_materialdata.textures_alpha |= 0x04040004; // tekstura -3 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||||
// nieprzezroczystych
|
if( m_materialdata.replacable_skins[ 4 ] )
|
||||||
if (ReplacableSkinID[3])
|
if( GfxRenderer.Texture( m_materialdata.replacable_skins[ 4 ] ).has_alpha )
|
||||||
if (GfxRenderer.Texture(ReplacableSkinID[3]).has_alpha)
|
m_materialdata.textures_alpha |= 0x08080008; // tekstura -4 z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||||
iAlpha |= 0x04040004; // tekstura -3 z kanałem alfa - nie renderować
|
|
||||||
// w cyklu
|
|
||||||
// nieprzezroczystych
|
|
||||||
if (ReplacableSkinID[4])
|
|
||||||
if (GfxRenderer.Texture(ReplacableSkinID[4]).has_alpha)
|
|
||||||
iAlpha |= 0x08080008; // tekstura -4 z kanałem alfa - nie renderować
|
|
||||||
// w cyklu
|
|
||||||
// nieprzezroczystych
|
|
||||||
}
|
}
|
||||||
if (!MoverParameters->LoadAccepted.empty())
|
if (!MoverParameters->LoadAccepted.empty())
|
||||||
// if (MoverParameters->LoadAccepted!=AnsiString("")); // &&
|
// if (MoverParameters->LoadAccepted!=AnsiString("")); // &&
|
||||||
@@ -5782,15 +5764,12 @@ std::string TDynamicObject::TextureTest(std::string const &name)
|
|||||||
};
|
};
|
||||||
|
|
||||||
void TDynamicObject::DestinationSet(std::string to, std::string numer)
|
void TDynamicObject::DestinationSet(std::string to, std::string numer)
|
||||||
{ // ustawienie stacji
|
{ // ustawienie stacji docelowej oraz wymiennej tekstury 4, jeśli istnieje plik
|
||||||
// docelowej oraz wymiennej
|
|
||||||
// tekstury 4, jeśli
|
|
||||||
// istnieje plik
|
|
||||||
// w zasadzie, to każdy wagon mógłby mieć inną stację docelową
|
// w zasadzie, to każdy wagon mógłby mieć inną stację docelową
|
||||||
// zwłaszcza w towarowych, pod kątem zautomatyzowania maewrów albo pracy górki
|
// zwłaszcza w towarowych, pod kątem zautomatyzowania maewrów albo pracy górki
|
||||||
// ale to jeszcze potrwa, zanim będzie możliwe, na razie można wpisać stację z
|
// ale to jeszcze potrwa, zanim będzie możliwe, na razie można wpisać stację z
|
||||||
// rozkładu
|
// rozkładu
|
||||||
if (abs(iMultiTex) >= 4)
|
if( std::abs( m_materialdata.multi_textures ) >= 4 )
|
||||||
return; // jak są 4 tekstury wymienne, to nie zmieniać rozkładem
|
return; // jak są 4 tekstury wymienne, to nie zmieniać rozkładem
|
||||||
numer = Global::Bezogonkow(numer);
|
numer = Global::Bezogonkow(numer);
|
||||||
asDestination = to;
|
asDestination = to;
|
||||||
@@ -5798,13 +5777,13 @@ void TDynamicObject::DestinationSet(std::string to, std::string numer)
|
|||||||
std::string x = TextureTest(asBaseDir + numer + "@" + MoverParameters->TypeName);
|
std::string x = TextureTest(asBaseDir + numer + "@" + MoverParameters->TypeName);
|
||||||
if (!x.empty())
|
if (!x.empty())
|
||||||
{
|
{
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( x, "", 9 ); // rozmywania 0,1,4,5 nie nadają się
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x = TextureTest(asBaseDir + numer );
|
x = TextureTest(asBaseDir + numer );
|
||||||
if (!x.empty())
|
if (!x.empty())
|
||||||
{
|
{
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( x, "", 9 ); // rozmywania 0,1,4,5 nie nadają się
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (to.empty())
|
if (to.empty())
|
||||||
@@ -5812,17 +5791,17 @@ void TDynamicObject::DestinationSet(std::string to, std::string numer)
|
|||||||
x = TextureTest(asBaseDir + to + "@" + MoverParameters->TypeName); // w pierwszej kolejności z nazwą FIZ/MMD
|
x = TextureTest(asBaseDir + to + "@" + MoverParameters->TypeName); // w pierwszej kolejności z nazwą FIZ/MMD
|
||||||
if (!x.empty())
|
if (!x.empty())
|
||||||
{
|
{
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( x, "", 9 ); // rozmywania 0,1,4,5 nie nadają się
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x = TextureTest(asBaseDir + to); // na razie prymitywnie
|
x = TextureTest(asBaseDir + to); // na razie prymitywnie
|
||||||
if (!x.empty())
|
if (!x.empty())
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9); // rozmywania 0,1,4,5 nie nadają się
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( x, "", 9 ); // rozmywania 0,1,4,5 nie nadają się
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = TextureTest(asBaseDir + "nowhere"); // jak nie znalazł dedykowanej, to niech daje nowhere
|
x = TextureTest(asBaseDir + "nowhere"); // jak nie znalazł dedykowanej, to niech daje nowhere
|
||||||
if (!x.empty())
|
if (!x.empty())
|
||||||
ReplacableSkinID[4] = GfxRenderer.GetTextureId( x, "", 9);
|
m_materialdata.replacable_skins[ 4 ] = GfxRenderer.GetTextureId( x, "", 9 );
|
||||||
}
|
}
|
||||||
// Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa
|
// Ra 2015-01: żeby zalogować błąd, trzeba by mieć pewność, że model używa
|
||||||
// tekstury nr 4
|
// tekstury nr 4
|
||||||
|
|||||||
24
DynObj.h
24
DynObj.h
@@ -18,6 +18,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "AdvSound.h"
|
#include "AdvSound.h"
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
#include "AirCoupler.h"
|
#include "AirCoupler.h"
|
||||||
|
#include "texture.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -140,6 +141,18 @@ class TAnim
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// parameters for the material object, as currently used by various simulator models
|
||||||
|
struct material_data {
|
||||||
|
|
||||||
|
int textures_alpha{ 0x30300030 }; // maska przezroczystości tekstur. default: tekstury wymienne nie mają przezroczystości
|
||||||
|
texture_manager::size_type replacable_skins[ 5 ]; // McZapkie:zmienialne nadwozie
|
||||||
|
int multi_textures{ 0 }; //<0 tekstury wskazane wpisem, >0 tekstury z przecinkami, =0 jedna
|
||||||
|
|
||||||
|
material_data() {
|
||||||
|
::SecureZeroMemory( replacable_skins, sizeof( replacable_skins ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class TDynamicObject { // klasa pojazdu
|
class TDynamicObject { // klasa pojazdu
|
||||||
|
|
||||||
friend class opengl_renderer;
|
friend class opengl_renderer;
|
||||||
@@ -175,8 +188,6 @@ public: // parametry położenia pojazdu dostępne publicznie
|
|||||||
|
|
||||||
TPowerSource ConnectedEnginePowerSource( TDynamicObject const *Caller ) const;
|
TPowerSource ConnectedEnginePowerSource( TDynamicObject const *Caller ) const;
|
||||||
|
|
||||||
private:
|
|
||||||
// returns type of the nearest functional power source present in the trainset
|
|
||||||
public: // modele składowe pojazdu
|
public: // modele składowe pojazdu
|
||||||
TModel3d *mdModel; // model pudła
|
TModel3d *mdModel; // model pudła
|
||||||
TModel3d *mdLoad; // model zmiennego ładunku
|
TModel3d *mdLoad; // model zmiennego ładunku
|
||||||
@@ -187,7 +198,12 @@ public: // modele składowe pojazdu
|
|||||||
float fShade; // zacienienie: 0:normalnie, -1:w ciemności, +1:dodatkowe światło (brak koloru?)
|
float fShade; // zacienienie: 0:normalnie, -1:w ciemności, +1:dodatkowe światło (brak koloru?)
|
||||||
|
|
||||||
private: // zmienne i metody do animacji submodeli; Ra: sprzatam animacje w pojeździe
|
private: // zmienne i metody do animacji submodeli; Ra: sprzatam animacje w pojeździe
|
||||||
public: // tymczasowo udostępnione do wyszukiwania drutu
|
material_data m_materialdata;
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline
|
||||||
|
material_data const *Material() const { return &m_materialdata; }
|
||||||
|
// tymczasowo udostępnione do wyszukiwania drutu
|
||||||
int iAnimType[ ANIM_TYPES ]; // 0-osie,1-drzwi,2-obracane,3-zderzaki,4-wózki,5-pantografy,6-tłoki
|
int iAnimType[ ANIM_TYPES ]; // 0-osie,1-drzwi,2-obracane,3-zderzaki,4-wózki,5-pantografy,6-tłoki
|
||||||
private:
|
private:
|
||||||
int iAnimations; // liczba obiektów animujących
|
int iAnimations; // liczba obiektów animujących
|
||||||
@@ -399,9 +415,11 @@ public: // modele składowe pojazdu
|
|||||||
int iCabs; // maski bitowe modeli kabin
|
int iCabs; // maski bitowe modeli kabin
|
||||||
TTrack *MyTrack; // McZapkie-030303: tor na ktorym stoi, ABu
|
TTrack *MyTrack; // McZapkie-030303: tor na ktorym stoi, ABu
|
||||||
std::string asBaseDir;
|
std::string asBaseDir;
|
||||||
|
/*
|
||||||
texture_manager::size_type ReplacableSkinID[5]; // McZapkie:zmienialne nadwozie
|
texture_manager::size_type ReplacableSkinID[5]; // McZapkie:zmienialne nadwozie
|
||||||
int iAlpha; // maska przezroczystości tekstur
|
int iAlpha; // maska przezroczystości tekstur
|
||||||
int iMultiTex; //<0 tekstury wskazane wpisem, >0 tekstury z przecinkami, =0 jedna
|
int iMultiTex; //<0 tekstury wskazane wpisem, >0 tekstury z przecinkami, =0 jedna
|
||||||
|
*/
|
||||||
int iOverheadMask; // maska przydzielana przez AI pojazdom posiadającym pantograf, aby wymuszały
|
int iOverheadMask; // maska przydzielana przez AI pojazdom posiadającym pantograf, aby wymuszały
|
||||||
// jazdę bezprądową
|
// jazdę bezprądową
|
||||||
TTractionParam tmpTraction;
|
TTractionParam tmpTraction;
|
||||||
|
|||||||
10
Float3d.h
10
Float3d.h
@@ -23,7 +23,8 @@ class float3
|
|||||||
y = b;
|
y = b;
|
||||||
z = c;
|
z = c;
|
||||||
};
|
};
|
||||||
float inline Length() const;
|
float Length() const;
|
||||||
|
float LengthSquared() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const float3 &v1, const float3 &v2)
|
inline bool operator==(const float3 &v1, const float3 &v2)
|
||||||
@@ -49,10 +50,13 @@ inline float3 operator+(const float3 &v1, const float3 &v2)
|
|||||||
{
|
{
|
||||||
return float3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
|
return float3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z);
|
||||||
};
|
};
|
||||||
float inline float3::Length() const
|
inline float float3::Length() const
|
||||||
{
|
{
|
||||||
return std::sqrt(x * x + y * y + z * z);
|
return std::sqrt(LengthSquared());
|
||||||
};
|
};
|
||||||
|
inline float float3::LengthSquared() const {
|
||||||
|
return ( x * x + y * y + z * z );
|
||||||
|
}
|
||||||
inline float3 operator*( float3 const &v, float const k ) {
|
inline float3 operator*( float3 const &v, float const k ) {
|
||||||
return float3( v.x * k, v.y * k, v.z * k );
|
return float3( v.x * k, v.y * k, v.z * k );
|
||||||
};
|
};
|
||||||
|
|||||||
33
Ground.cpp
33
Ground.cpp
@@ -279,7 +279,7 @@ void TGroundNode::MoveMe(vector3 pPosition)
|
|||||||
ResourceManager::Unregister(this);
|
ResourceManager::Unregister(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void TGroundNode::RaRenderVBO()
|
void TGroundNode::RaRenderVBO()
|
||||||
{ // renderowanie z domyslnego bufora VBO
|
{ // renderowanie z domyslnego bufora VBO
|
||||||
glColor3ub(Diffuse[0], Diffuse[1], Diffuse[2]);
|
glColor3ub(Diffuse[0], Diffuse[1], Diffuse[2]);
|
||||||
@@ -444,7 +444,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void TGroundNode::Compile(bool many)
|
void TGroundNode::Compile(bool many)
|
||||||
{ // tworzenie skompilowanej listy w wyświetlaniu DL
|
{ // tworzenie skompilowanej listy w wyświetlaniu DL
|
||||||
if (!many)
|
if (!many)
|
||||||
@@ -665,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.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.35f); // 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
|
||||||
@@ -702,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.04f);
|
glAlphaFunc(GL_GREATER, 0.02f);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -1183,7 +1183,7 @@ void TSubRect::RenderAlphaDL()
|
|||||||
for (int j = 0; j < iTracks; ++j)
|
for (int j = 0; j < iTracks; ++j)
|
||||||
tTracks[j]->RenderDynAlpha(); // przezroczyste fragmenty pojazdów na torach
|
tTracks[j]->RenderDynAlpha(); // przezroczyste fragmenty pojazdów na torach
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
void TSubRect::RenderVBO()
|
void TSubRect::RenderVBO()
|
||||||
{ // renderowanie nieprzezroczystych (VBO)
|
{ // renderowanie nieprzezroczystych (VBO)
|
||||||
TGroundNode *node;
|
TGroundNode *node;
|
||||||
@@ -1217,7 +1217,7 @@ void TSubRect::RenderAlphaVBO()
|
|||||||
for (int j = 0; j < iTracks; ++j)
|
for (int j = 0; j < iTracks; ++j)
|
||||||
tTracks[j]->RenderDynAlpha(); // przezroczyste fragmenty pojazdów na torach
|
tTracks[j]->RenderDynAlpha(); // przezroczyste fragmenty pojazdów na torach
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
void TSubRect::RenderSounds()
|
void TSubRect::RenderSounds()
|
||||||
{ // aktualizacja dźwięków w pojazdach sektora (sektor może nie być wyświetlany)
|
{ // aktualizacja dźwięków w pojazdach sektora (sektor może nie być wyświetlany)
|
||||||
for (int j = 0; j < iTracks; ++j)
|
for (int j = 0; j < iTracks; ++j)
|
||||||
@@ -1264,7 +1264,7 @@ void TGroundRect::RenderDL()
|
|||||||
iLastDisplay = iFrameNumber; // drugi raz nie potrzeba
|
iLastDisplay = iFrameNumber; // drugi raz nie potrzeba
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
void TGroundRect::RenderVBO()
|
void TGroundRect::RenderVBO()
|
||||||
{ // renderowanie kwadratu kilometrowego (VBO), jeśli jeszcze nie zrobione
|
{ // renderowanie kwadratu kilometrowego (VBO), jeśli jeszcze nie zrobione
|
||||||
if (iLastDisplay != iFrameNumber)
|
if (iLastDisplay != iFrameNumber)
|
||||||
@@ -1281,7 +1281,7 @@ void TGroundRect::RenderVBO()
|
|||||||
nTerrain->smTerrain->iVisible = iFrameNumber; // ma się wyświetlić w tej ramce
|
nTerrain->smTerrain->iVisible = iFrameNumber; // ma się wyświetlić w tej ramce
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -4829,27 +4829,30 @@ bool
|
|||||||
TGround::Render( Math3D::vector3 const &Camera ) {
|
TGround::Render( Math3D::vector3 const &Camera ) {
|
||||||
|
|
||||||
GfxRenderer.Update_Lights( m_lights );
|
GfxRenderer.Update_Lights( m_lights );
|
||||||
|
/*
|
||||||
if( Global::bUseVBO ) { // renderowanie przez VBO
|
if( Global::bUseVBO ) { // renderowanie przez VBO
|
||||||
if( !RenderVBO( Camera ) )
|
if( !RenderVBO( Camera ) )
|
||||||
return false;
|
return false;
|
||||||
if( !RenderAlphaVBO( Camera ) )
|
if( !RenderAlphaVBO( Camera ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else { // renderowanie przez Display List
|
else {
|
||||||
|
*/
|
||||||
|
// renderowanie przez Display List
|
||||||
if( !RenderDL( Camera ) )
|
if( !RenderDL( Camera ) )
|
||||||
return false;
|
return false;
|
||||||
if( !RenderAlphaDL( Camera ) )
|
if( !RenderAlphaDL( Camera ) )
|
||||||
return false;
|
return false;
|
||||||
|
/*
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.35f); // 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);
|
||||||
@@ -4909,7 +4912,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.04f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.02f); // 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;
|
||||||
@@ -4934,7 +4937,7 @@ bool TGround::RenderAlphaDL(vector3 pPosition)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
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);
|
||||||
@@ -5037,7 +5040,7 @@ bool TGround::RenderAlphaVBO(vector3 pPosition)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void TGround::Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam)
|
void TGround::Navigate(std::string const &ClassName, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|||||||
8
Ground.h
8
Ground.h
@@ -178,9 +178,11 @@ class TGroundNode : public Resource
|
|||||||
void RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
void RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
||||||
void RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
void RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
||||||
// (McZapkie-131202)
|
// (McZapkie-131202)
|
||||||
|
/*
|
||||||
void RaRenderVBO(); // renderowanie (nieprzezroczystych) ze wspólnego VBO
|
void RaRenderVBO(); // renderowanie (nieprzezroczystych) ze wspólnego VBO
|
||||||
void RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
void RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
||||||
void RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
void RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
class TSubRect : public Resource, public CMesh
|
class TSubRect : public Resource, public CMesh
|
||||||
@@ -221,9 +223,11 @@ class TSubRect : public Resource, public CMesh
|
|||||||
void RaAnimate(); // przeliczenie animacji torów
|
void RaAnimate(); // przeliczenie animacji torów
|
||||||
void RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
void RenderDL(); // renderowanie nieprzezroczystych w Display Lists
|
||||||
void RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
void RenderAlphaDL(); // renderowanie przezroczystych w Display Lists
|
||||||
|
/*
|
||||||
// (McZapkie-131202)
|
// (McZapkie-131202)
|
||||||
void RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
void RenderVBO(); // renderowanie nieprzezroczystych z własnego VBO
|
||||||
void RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
void RenderAlphaVBO(); // renderowanie przezroczystych z (własnego) VBO
|
||||||
|
*/
|
||||||
void RenderSounds(); // dźwięki pojazdów z niewidocznych sektorów
|
void RenderSounds(); // dźwięki pojazdów z niewidocznych sektorów
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -271,7 +275,9 @@ class TGroundRect : public TSubRect
|
|||||||
pSubRects[i].Sort(); // optymalizacja obiektów w sektorach
|
pSubRects[i].Sort(); // optymalizacja obiektów w sektorach
|
||||||
};
|
};
|
||||||
void RenderDL();
|
void RenderDL();
|
||||||
|
/*
|
||||||
void RenderVBO();
|
void RenderVBO();
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
class TGround
|
class TGround
|
||||||
@@ -358,8 +364,10 @@ class TGround
|
|||||||
bool Render( Math3D::vector3 const &Camera );
|
bool Render( Math3D::vector3 const &Camera );
|
||||||
bool RenderDL(vector3 pPosition);
|
bool RenderDL(vector3 pPosition);
|
||||||
bool RenderAlphaDL(vector3 pPosition);
|
bool RenderAlphaDL(vector3 pPosition);
|
||||||
|
/*
|
||||||
bool RenderVBO(vector3 pPosition);
|
bool RenderVBO(vector3 pPosition);
|
||||||
bool RenderAlphaVBO(vector3 pPosition);
|
bool RenderAlphaVBO(vector3 pPosition);
|
||||||
|
*/
|
||||||
bool CheckQuery();
|
bool CheckQuery();
|
||||||
// GetRect(double x, double z) { return
|
// GetRect(double x, double z) { return
|
||||||
// &(Rects[int(x/fSubRectSize+fHalfNumRects)][int(z/fSubRectSize+fHalfNumRects)]); };
|
// &(Rects[int(x/fSubRectSize+fHalfNumRects)][int(z/fSubRectSize+fHalfNumRects)]); };
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ std::string *TSubModel::pasText;
|
|||||||
|
|
||||||
TSubModel::TSubModel()
|
TSubModel::TSubModel()
|
||||||
{
|
{
|
||||||
ZeroMemory(this, sizeof(TSubModel)); // istotne przy zapisywaniu wersji binarnej
|
::SecureZeroMemory(this, sizeof(TSubModel)); // istotne przy zapisywaniu wersji binarnej
|
||||||
FirstInit();
|
FirstInit();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2305,7 +2305,7 @@ glPopMatrix();
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// 2011-03-16 cztery nowe funkcje renderowania z możliwością pochylania obiektów
|
// 2011-03-16 cztery nowe funkcje renderowania z możliwością pochylania obiektów
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
|
void TModel3d::Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
|
||||||
{ // nieprzezroczyste, Display List
|
{ // nieprzezroczyste, Display List
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@@ -2340,6 +2340,7 @@ void TModel3d::RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager:
|
|||||||
Root->RenderAlphaDL();
|
Root->RenderAlphaDL();
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
|
void TModel3d::RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId, int iAlpha)
|
||||||
{ // nieprzezroczyste, VBO
|
{ // nieprzezroczyste, VBO
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|||||||
@@ -367,8 +367,10 @@ public:
|
|||||||
void RaRender(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
void RaRender(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
void RaRenderAlpha(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
void RaRenderAlpha(double fSquareDistance, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
// trzy kąty obrotu
|
// trzy kąty obrotu
|
||||||
|
/*
|
||||||
void Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
void Render(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
void RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
void RenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
|
*/
|
||||||
void RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
void RaRender(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
void RaRenderAlpha(vector3 *vPosition, vector3 *vAngle, texture_manager::size_type *ReplacableSkinId = NULL, int iAlpha = 0x30300030);
|
||||||
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
// inline int GetSubModelsCount() { return (SubModelsCount); };
|
||||||
|
|||||||
@@ -473,6 +473,8 @@ opengl_texture::load_TGA() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: add horizontal/vertical data flip, based on the descriptor (18th) header byte
|
||||||
|
|
||||||
// fill remaining data info
|
// fill remaining data info
|
||||||
data_mapcount = 1;
|
data_mapcount = 1;
|
||||||
data_format = GL_BGRA;
|
data_format = GL_BGRA;
|
||||||
|
|||||||
13
World.cpp
13
World.cpp
@@ -1669,14 +1669,19 @@ TWorld::Render_Cab() {
|
|||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if( Global::bUseVBO ) { // renderowanie z użyciem VBO
|
/*
|
||||||
|
if( Global::bUseVBO ) { // renderowanie z użyciem VBO. NOTE: disabled for the time being
|
||||||
dynamic->mdKabina->RaRender( 0.0, dynamic->ReplacableSkinID, dynamic->iAlpha );
|
dynamic->mdKabina->RaRender( 0.0, dynamic->ReplacableSkinID, dynamic->iAlpha );
|
||||||
dynamic->mdKabina->RaRenderAlpha( 0.0, dynamic->ReplacableSkinID, dynamic->iAlpha );
|
dynamic->mdKabina->RaRenderAlpha( 0.0, dynamic->ReplacableSkinID, dynamic->iAlpha );
|
||||||
}
|
}
|
||||||
else { // renderowanie z Display List
|
else {
|
||||||
GfxRenderer.Render( dynamic->mdKabina, dynamic, 0.0 );
|
*/
|
||||||
GfxRenderer.Render_Alpha( dynamic->mdKabina, dynamic, 0.0 );
|
// renderowanie z Display List
|
||||||
|
GfxRenderer.Render( dynamic->mdKabina, dynamic->Material(), 0.0 );
|
||||||
|
GfxRenderer.Render_Alpha( dynamic->mdKabina, dynamic->Material(), 0.0 );
|
||||||
|
/*
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
#ifdef EU07_USE_OLD_LIGHTING_MODEL
|
||||||
// TODO: re-implement this
|
// TODO: re-implement this
|
||||||
// przywrócenie standardowych, bo zawsze są zmieniane
|
// przywrócenie standardowych, bo zawsze są zmieniane
|
||||||
|
|||||||
40
renderer.cpp
40
renderer.cpp
@@ -125,7 +125,7 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
|||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||||
}
|
}
|
||||||
|
|
||||||
Render( Dynamic->mdLowPolyInt, Dynamic, squaredistance );
|
Render( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
// reset the overall ambient
|
// reset the overall ambient
|
||||||
@@ -136,10 +136,10 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dynamic->mdModel->Render( squaredistance, Dynamic->ReplacableSkinID, Dynamic->iAlpha );
|
// Dynamic->mdModel->Render( squaredistance, Dynamic->ReplacableSkinID, Dynamic->iAlpha );
|
||||||
Render( Dynamic->mdModel, Dynamic, squaredistance );
|
Render( Dynamic->mdModel, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||||
Render( Dynamic->mdLoad, Dynamic, squaredistance );
|
Render( Dynamic->mdLoad, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
|
||||||
@@ -151,11 +151,11 @@ opengl_renderer::Render( TDynamicObject *Dynamic ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
opengl_renderer::Render( TModel3d *Model, TDynamicObject const *Instance, double const Squaredistance ) {
|
opengl_renderer::Render( TModel3d *Model, material_data const *Material, double const Squaredistance ) {
|
||||||
|
|
||||||
auto alpha =
|
auto alpha =
|
||||||
( Instance != nullptr ?
|
( Material != nullptr ?
|
||||||
Instance->iAlpha :
|
Material->textures_alpha :
|
||||||
0x30300030 );
|
0x30300030 );
|
||||||
alpha ^= 0x0F0F000F; // odwrócenie flag tekstur, aby wyłapać nieprzezroczyste
|
alpha ^= 0x0F0F000F; // odwrócenie flag tekstur, aby wyłapać nieprzezroczyste
|
||||||
if( 0 == ( alpha & Model->iFlags & 0x1F1F001F ) ) {
|
if( 0 == ( alpha & Model->iFlags & 0x1F1F001F ) ) {
|
||||||
@@ -166,8 +166,8 @@ opengl_renderer::Render( TModel3d *Model, TDynamicObject const *Instance, double
|
|||||||
Model->Root->fSquareDist = Squaredistance; // zmienna globalna!
|
Model->Root->fSquareDist = Squaredistance; // zmienna globalna!
|
||||||
|
|
||||||
Model->Root->ReplacableSet(
|
Model->Root->ReplacableSet(
|
||||||
( Instance != nullptr ?
|
( Material != nullptr ?
|
||||||
Instance->ReplacableSkinID :
|
Material->replacable_skins :
|
||||||
nullptr ),
|
nullptr ),
|
||||||
alpha );
|
alpha );
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ opengl_renderer::Render( TModel3d *Model, TDynamicObject const *Instance, double
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
opengl_renderer::Render( TModel3d *Model, TDynamicObject const *Instance, Math3D::vector3 const &Position, Math3D::vector3 const &Angle ) {
|
opengl_renderer::Render( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle ) {
|
||||||
|
|
||||||
::glPushMatrix();
|
::glPushMatrix();
|
||||||
::glTranslated( Position.x, Position.y, Position.z );
|
::glTranslated( Position.x, Position.y, Position.z );
|
||||||
@@ -188,7 +188,7 @@ opengl_renderer::Render( TModel3d *Model, TDynamicObject const *Instance, Math3D
|
|||||||
if( Angle.z != 0.0 )
|
if( Angle.z != 0.0 )
|
||||||
::glRotated( Angle.z, 0.0, 0.0, 1.0 );
|
::glRotated( Angle.z, 0.0, 0.0, 1.0 );
|
||||||
|
|
||||||
auto const result = Render( Model, Instance, SquareMagnitude( Position - Global::GetCameraPosition() ) );
|
auto const result = Render( Model, Material, SquareMagnitude( Position - Global::GetCameraPosition() ) );
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
|||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, &cablight.x );
|
||||||
}
|
}
|
||||||
|
|
||||||
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic, squaredistance );
|
Render_Alpha( Dynamic->mdLowPolyInt, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
if( Dynamic->InteriorLightLevel > 0.0f ) {
|
||||||
// reset the overall ambient
|
// reset the overall ambient
|
||||||
@@ -240,10 +240,10 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Render_Alpha( Dynamic->mdModel, Dynamic, squaredistance );
|
Render_Alpha( Dynamic->mdModel, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
if( Dynamic->mdLoad ) // renderowanie nieprzezroczystego ładunku
|
||||||
Render_Alpha( Dynamic->mdLoad, Dynamic, squaredistance );
|
Render_Alpha( Dynamic->mdLoad, Dynamic->Material(), squaredistance );
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
|
||||||
@@ -254,11 +254,11 @@ opengl_renderer::Render_Alpha( TDynamicObject *Dynamic ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
opengl_renderer::Render_Alpha( TModel3d *Model, TDynamicObject const *Instance, double const Squaredistance ) {
|
opengl_renderer::Render_Alpha( TModel3d *Model, material_data const *Material, double const Squaredistance ) {
|
||||||
|
|
||||||
auto alpha =
|
auto alpha =
|
||||||
( Instance != nullptr ?
|
( Material != nullptr ?
|
||||||
Instance->iAlpha :
|
Material->textures_alpha :
|
||||||
0x30300030 );
|
0x30300030 );
|
||||||
|
|
||||||
if( 0 == ( alpha & Model->iFlags & 0x2F2F002F ) ) {
|
if( 0 == ( alpha & Model->iFlags & 0x2F2F002F ) ) {
|
||||||
@@ -269,8 +269,8 @@ opengl_renderer::Render_Alpha( TModel3d *Model, TDynamicObject const *Instance,
|
|||||||
Model->Root->fSquareDist = Squaredistance; // zmienna globalna!
|
Model->Root->fSquareDist = Squaredistance; // zmienna globalna!
|
||||||
|
|
||||||
Model->Root->ReplacableSet(
|
Model->Root->ReplacableSet(
|
||||||
( Instance != nullptr ?
|
( Material != nullptr ?
|
||||||
Instance->ReplacableSkinID :
|
Material->replacable_skins :
|
||||||
nullptr ),
|
nullptr ),
|
||||||
alpha );
|
alpha );
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ opengl_renderer::Render_Alpha( TModel3d *Model, TDynamicObject const *Instance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
opengl_renderer::Render_Alpha( TModel3d *Model, TDynamicObject const *Instance, Math3D::vector3 const &Position, Math3D::vector3 const &Angle ) {
|
opengl_renderer::Render_Alpha( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle ) {
|
||||||
|
|
||||||
::glPushMatrix();
|
::glPushMatrix();
|
||||||
::glTranslated( Position.x, Position.y, Position.z );
|
::glTranslated( Position.x, Position.y, Position.z );
|
||||||
@@ -291,7 +291,7 @@ opengl_renderer::Render_Alpha( TModel3d *Model, TDynamicObject const *Instance,
|
|||||||
if( Angle.z != 0.0 )
|
if( Angle.z != 0.0 )
|
||||||
::glRotated( Angle.z, 0.0, 0.0, 1.0 );
|
::glRotated( Angle.z, 0.0, 0.0, 1.0 );
|
||||||
|
|
||||||
auto const result = Render_Alpha( Model, Instance, SquareMagnitude( Position - Global::GetCameraPosition() ) );
|
auto const result = Render_Alpha( Model, Material, SquareMagnitude( Position - Global::GetCameraPosition() ) );
|
||||||
|
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
|
||||||
|
|||||||
10
renderer.h
10
renderer.h
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
This Source Code Form is subject to the
|
This Source Code Form is subject to the
|
||||||
terms of the Mozilla Public License, v.
|
terms of the Mozilla Public License, v.
|
||||||
2.0. If a copy of the MPL was not
|
2.0. If a copy of the MPL was not
|
||||||
@@ -101,15 +101,15 @@ public:
|
|||||||
bool
|
bool
|
||||||
Render( TDynamicObject *Dynamic );
|
Render( TDynamicObject *Dynamic );
|
||||||
bool
|
bool
|
||||||
Render( TModel3d *Model, TDynamicObject const *Instance, double const Squaredistance );
|
Render( TModel3d *Model, material_data const *Material, double const Squaredistance );
|
||||||
bool
|
bool
|
||||||
Render( TModel3d *Model, TDynamicObject const *Instance, Math3D::vector3 const &Position, Math3D::vector3 const &Angle );
|
Render( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle );
|
||||||
bool
|
bool
|
||||||
Render_Alpha( TDynamicObject *Dynamic );
|
Render_Alpha( TDynamicObject *Dynamic );
|
||||||
bool
|
bool
|
||||||
Render_Alpha( TModel3d *Model, TDynamicObject const *Instance, double const Squaredistance );
|
Render_Alpha( TModel3d *Model, material_data const *Material, double const Squaredistance );
|
||||||
bool
|
bool
|
||||||
Render_Alpha( TModel3d *Model, TDynamicObject const *Instance, Math3D::vector3 const &Position, Math3D::vector3 const &Angle );
|
Render_Alpha( TModel3d *Model, material_data const *Material, Math3D::vector3 const &Position, Math3D::vector3 const &Angle );
|
||||||
// maintenance jobs
|
// maintenance jobs
|
||||||
void
|
void
|
||||||
Update( double const Deltatime);
|
Update( double const Deltatime);
|
||||||
|
|||||||
Reference in New Issue
Block a user