mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
changed NULL use to c++11 compliant
This commit is contained in:
@@ -447,7 +447,7 @@ bool TAnimModel::Init(std::string const &asName, std::string const &asReplacable
|
||||
else if( asReplacableTexture != "none" ) {
|
||||
m_materialdata.replacable_skins[ 1 ] = GfxRenderer.Fetch_Material( asReplacableTexture );
|
||||
}
|
||||
if( ( m_materialdata.replacable_skins[ 1 ] != NULL )
|
||||
if( ( m_materialdata.replacable_skins[ 1 ] != null_handle )
|
||||
&& ( GfxRenderer.Material( m_materialdata.replacable_skins[ 1 ] ).has_alpha ) ) {
|
||||
// tekstura z kanałem alfa - nie renderować w cyklu nieprzezroczystych
|
||||
m_materialdata.textures_alpha = 0x31310031;
|
||||
|
||||
@@ -156,7 +156,7 @@ bool TPoKeys55::Connect()
|
||||
// get the structure (after we have allocated enough memory for the structure.)
|
||||
DetailedInterfaceDataStructure->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
||||
// First call populates "StructureSize" with the correct value
|
||||
SetupDiGetDeviceInterfaceDetail(DeviceInfoTable, InterfaceDataStructure, NULL, NULL,
|
||||
SetupDiGetDeviceInterfaceDetail(DeviceInfoTable, InterfaceDataStructure, NULL, 0,
|
||||
&StructureSize, NULL);
|
||||
DetailedInterfaceDataStructure =
|
||||
(PSP_DEVICE_INTERFACE_DETAIL_DATA)(malloc(StructureSize)); // Allocate enough memory
|
||||
|
||||
@@ -2928,7 +2928,7 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
|
||||
else
|
||||
TrainParams->NewName(NewCommand); // czyści tabelkę przystanków
|
||||
delete tsGuardSignal;
|
||||
tsGuardSignal = NULL; // wywalenie kierownika
|
||||
tsGuardSignal = nullptr; // wywalenie kierownika
|
||||
if (NewCommand != "none")
|
||||
{
|
||||
if (!TrainParams->LoadTTfile(
|
||||
|
||||
2
Driver.h
2
Driver.h
@@ -367,7 +367,7 @@ class TController
|
||||
bool TableAddNew();
|
||||
bool TableNotFound(TEvent const *Event) const;
|
||||
// TEvent *TableCheckTrackEvent(double fDirection, TTrack *Track);
|
||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = nullptr);
|
||||
void TableCheck(double fDistance);
|
||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc);
|
||||
void TablePurger();
|
||||
|
||||
@@ -4059,7 +4059,7 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
|
||||
int skinindex = 0;
|
||||
do {
|
||||
material_handle material = GfxRenderer.Fetch_Material( Global::asCurrentTexturePath + ReplacableSkin + "," + std::to_string( skinindex + 1 ), true );
|
||||
if( material == NULL ) {
|
||||
if( material == null_handle ) {
|
||||
break;
|
||||
}
|
||||
m_materialdata.replacable_skins[ skinindex + 1 ] = material;
|
||||
|
||||
2
DynObj.h
2
DynObj.h
@@ -143,7 +143,7 @@ class TAnim
|
||||
struct material_data {
|
||||
|
||||
int textures_alpha{ 0x30300030 }; // maska przezroczystości tekstur. default: tekstury wymienne nie mają przezroczystości
|
||||
material_handle replacable_skins[ 5 ] = { NULL, NULL, NULL, NULL, NULL }; // McZapkie:zmienialne nadwozie
|
||||
material_handle replacable_skins[ 5 ] = { null_handle, null_handle, null_handle, null_handle, null_handle }; // McZapkie:zmienialne nadwozie
|
||||
int multi_textures{ 0 }; //<0 tekstury wskazane wpisem, >0 tekstury z przecinkami, =0 jedna
|
||||
};
|
||||
|
||||
|
||||
2
EU07.cpp
2
EU07.cpp
@@ -272,7 +272,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
auto const fileversionsize = ::GetFileVersionInfoSize( argv[ 0 ], NULL );
|
||||
std::vector<BYTE>fileversiondata; fileversiondata.resize( fileversionsize );
|
||||
if( ::GetFileVersionInfo( argv[ 0 ], NULL, fileversionsize, fileversiondata.data() ) ) {
|
||||
if( ::GetFileVersionInfo( argv[ 0 ], 0, fileversionsize, fileversiondata.data() ) ) {
|
||||
|
||||
struct lang_codepage {
|
||||
WORD language;
|
||||
|
||||
10
Ground.cpp
10
Ground.cpp
@@ -232,7 +232,7 @@ void TSubRect::NodeAdd(TGroundNode *Node)
|
||||
// since ground rectangle can be empty, we're doing lazy initialization of the geometry bank, when something may actually use it
|
||||
// NOTE: this method is called for both subcell and cell, but subcells get first created and passed the handle from their parent
|
||||
// thus, this effectively only gets executed for the 'parent' ground cells. Not the most elegant, but for now it'll do
|
||||
if( m_geometrybank == NULL ) {
|
||||
if( m_geometrybank == null_handle ) {
|
||||
m_geometrybank = GfxRenderer.Create_Bank();
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ TGroundRect::~TGroundRect()
|
||||
void
|
||||
TGroundRect::Init() {
|
||||
// since ground rectangle can be empty, we're doing lazy initialization of the geometry bank, when something may actually use it
|
||||
if( m_geometrybank == NULL ) {
|
||||
if( m_geometrybank == null_handle ) {
|
||||
m_geometrybank = GfxRenderer.Create_Bank();
|
||||
}
|
||||
|
||||
@@ -1378,9 +1378,9 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
||||
str = token;
|
||||
tmp->m_material = GfxRenderer.Fetch_Material( str );
|
||||
auto const texturehandle = (
|
||||
tmp->m_material != NULL ?
|
||||
tmp->m_material != null_handle ?
|
||||
GfxRenderer.Material( tmp->m_material ).texture1 :
|
||||
NULL );
|
||||
null_handle );
|
||||
auto const &texture = (
|
||||
texturehandle ?
|
||||
GfxRenderer.Texture( texturehandle ) :
|
||||
@@ -1396,7 +1396,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
|
||||
|
||||
tmp->iFlags |= 200; // z usuwaniem
|
||||
// remainder of legacy 'problend' system -- geometry assigned a texture with '@' in its name is treated as translucent, opaque otherwise
|
||||
if( texturehandle != NULL ) {
|
||||
if( texturehandle != null_handle ) {
|
||||
tmp->iFlags |= (
|
||||
( ( texture.name.find( '@' ) != std::string::npos )
|
||||
&& ( true == texture.has_alpha ) ) ?
|
||||
|
||||
@@ -118,9 +118,8 @@ std::string ExchangeCharInString( std::string const &Source, char const &From, c
|
||||
{
|
||||
std::string replacement; replacement.reserve( Source.size() );
|
||||
std::for_each(Source.cbegin(), Source.cend(), [&](char const idx) {
|
||||
if( idx != From ) { replacement += idx; }
|
||||
else {
|
||||
if( To != NULL ) { replacement += To; } }
|
||||
if( idx != From ) { replacement += idx; }
|
||||
else { replacement += To; }
|
||||
} );
|
||||
|
||||
return replacement;
|
||||
|
||||
18
Model3d.cpp
18
Model3d.cpp
@@ -308,7 +308,7 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
|
||||
std::string material = parser.getToken<std::string>();
|
||||
if (material == "none")
|
||||
{ // rysowanie podanym kolorem
|
||||
m_material = NULL;
|
||||
m_material = null_handle;
|
||||
iFlags |= 0x10; // rysowane w cyklu nieprzezroczystych
|
||||
}
|
||||
else if (material.find("replacableskin") != material.npos)
|
||||
@@ -348,7 +348,7 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
|
||||
// 2. tekstura ma przezroczystość
|
||||
iFlags |=
|
||||
( ( ( Opacity < 1.0 )
|
||||
&& ( ( m_material != NULL )
|
||||
&& ( ( m_material != null_handle )
|
||||
&& ( GfxRenderer.Material( m_material ).has_alpha ) ) ) ?
|
||||
0x20 :
|
||||
0x10 ); // 0x10-nieprzezroczysta, 0x20-przezroczysta
|
||||
@@ -1044,7 +1044,7 @@ void TSubModel::serialize_geometry( std::ostream &Output ) const {
|
||||
if( Child ) {
|
||||
Child->serialize_geometry( Output );
|
||||
}
|
||||
if( m_geometry != NULL ) {
|
||||
if( m_geometry != null_handle ) {
|
||||
for( auto const &vertex : GfxRenderer.Vertices( m_geometry ) ) {
|
||||
vertex.serialize( Output );
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ TSubModel::convert( TGroundNode &Groundnode ) const {
|
||||
0x20 :
|
||||
0x10 );
|
||||
|
||||
if( m_geometry == NULL ) { return; }
|
||||
if( m_geometry == null_handle ) { return; }
|
||||
|
||||
std::size_t vertexcount { 0 };
|
||||
std::vector<TGroundVertex> importedvertices;
|
||||
@@ -1198,7 +1198,7 @@ float TSubModel::MaxY( float4x4 const &m ) {
|
||||
|
||||
auto maxy { 0.0f };
|
||||
// binary and text models invoke this function at different stages, either after or before geometry data was sent to the geometry manager
|
||||
if( m_geometry != NULL ) {
|
||||
if( m_geometry != null_handle ) {
|
||||
|
||||
for( auto const &vertex : GfxRenderer.Vertices( m_geometry ) ) {
|
||||
maxy = std::max(
|
||||
@@ -1539,7 +1539,7 @@ void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
||||
{
|
||||
Root = nullptr;
|
||||
float4x4 *tm = nullptr;
|
||||
if( m_geometrybank == NULL ) {
|
||||
if( m_geometrybank == null_handle ) {
|
||||
m_geometrybank = GfxRenderer.Create_Bank();
|
||||
}
|
||||
|
||||
@@ -1738,7 +1738,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
|
||||
if( ( iFlags & 0x30 ) == 0 ) {
|
||||
// texture-alpha based fallback if for some reason we don't have opacity flag set yet
|
||||
iFlags |= (
|
||||
( ( m_material != NULL )
|
||||
( ( m_material != null_handle )
|
||||
&& ( GfxRenderer.Material( m_material ).has_alpha ) ) ?
|
||||
0x20 :
|
||||
0x10 ); // 0x10-nieprzezroczysta, 0x20-przezroczysta
|
||||
@@ -1746,7 +1746,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
|
||||
}
|
||||
else {
|
||||
ErrorLog( "Bad model: reference to non-existent texture index in sub-model" + ( pName.empty() ? "" : " \"" + pName + "\"" ) );
|
||||
m_material = NULL;
|
||||
m_material = null_handle;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1878,7 +1878,7 @@ void TModel3d::Init()
|
||||
}
|
||||
iFlags |= Root->FlagsCheck() | 0x8000; // flagi całego modelu
|
||||
if (iNumVerts) {
|
||||
if( m_geometrybank == NULL ) {
|
||||
if( m_geometrybank == null_handle ) {
|
||||
m_geometrybank = GfxRenderer.Create_Bank();
|
||||
}
|
||||
std::size_t dataoffset = 0;
|
||||
|
||||
10
Model3d.h
10
Model3d.h
@@ -68,8 +68,8 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
int iNext{ NULL };
|
||||
int iChild{ NULL };
|
||||
int iNext{ 0 };
|
||||
int iChild{ 0 };
|
||||
int eType{ TP_ROTATOR }; // Ra: modele binarne dają więcej możliwości niż mesh złożony z trójkątów
|
||||
int iName{ -1 }; // numer łańcucha z nazwą submodelu, albo -1 gdy anonimowy
|
||||
public: // chwilowo
|
||||
@@ -121,8 +121,8 @@ private:
|
||||
|
||||
TSubModel *Next { nullptr };
|
||||
TSubModel *Child { nullptr };
|
||||
geometry_handle m_geometry { NULL, NULL }; // geometry of the submodel
|
||||
material_handle m_material { NULL }; // numer tekstury, -1 wymienna, 0 brak
|
||||
geometry_handle m_geometry { 0, 0 }; // geometry of the submodel
|
||||
material_handle m_material { null_handle }; // numer tekstury, -1 wymienna, 0 brak
|
||||
bool bWire { false }; // nie używane, ale wczytywane
|
||||
float Opacity { 1.0f };
|
||||
float f_Angle { 0.0f };
|
||||
@@ -135,7 +135,7 @@ public: // chwilowo
|
||||
basic_vertex *Vertices; // roboczy wskaźnik - wczytanie T3D do VBO
|
||||
*/
|
||||
vertex_array Vertices;
|
||||
size_t iAnimOwner{ NULL }; // roboczy numer egzemplarza, który ustawił animację
|
||||
size_t iAnimOwner{ 0 }; // roboczy numer egzemplarza, który ustawił animację
|
||||
TAnimType b_aAnim{ at_None }; // kody animacji oddzielnie, bo zerowane
|
||||
public:
|
||||
float4x4 *mAnimMatrix{ nullptr }; // macierz do animacji kwaternionowych (należy do AnimContainer)
|
||||
|
||||
@@ -454,7 +454,7 @@ bool TSegment::RenderLoft( vertex_array &Output, Math3D::vector3 const &Origin,
|
||||
void TSegment::Render()
|
||||
{
|
||||
vector3 pt;
|
||||
GfxRenderer.Bind_Material( NULL );
|
||||
GfxRenderer.Bind_Material( null_handle );
|
||||
|
||||
if (bCurve)
|
||||
{
|
||||
|
||||
@@ -224,7 +224,7 @@ void TSoundsManager::RestoreAll()
|
||||
hr = Next->DSBuffer->Restore();
|
||||
if (hr == DSERR_BUFFERLOST)
|
||||
Sleep(10);
|
||||
} while ((hr = Next->DSBuffer->Restore()) != NULL);
|
||||
} while ((hr = Next->DSBuffer->Restore()) != 0);
|
||||
|
||||
// char *Name= Next->Name;
|
||||
// int cc= Next->Concurrent;
|
||||
|
||||
13
Texture.cpp
13
Texture.cpp
@@ -817,9 +817,9 @@ texture_manager::bind( std::size_t const Unit, texture_handle const Texture ) {
|
||||
return;
|
||||
}
|
||||
// TBD, TODO: do binding in texture object, add support for other types than 2d
|
||||
if( m_units[ Unit ].unit == NULL ) { return; }
|
||||
if( m_units[ Unit ].unit == 0 ) { return; }
|
||||
unit( m_units[ Unit ].unit );
|
||||
if( Texture != NULL ) {
|
||||
if( Texture != null_handle ) {
|
||||
#ifndef EU07_DEFERRED_TEXTURE_UPLOAD
|
||||
// NOTE: we could bind dedicated 'error' texture here if the id isn't valid
|
||||
::glBindTexture( GL_TEXTURE_2D, texture(Texture).id );
|
||||
@@ -830,15 +830,14 @@ texture_manager::bind( std::size_t const Unit, texture_handle const Texture ) {
|
||||
}
|
||||
else {
|
||||
// TODO: bind a special 'error' texture on failure
|
||||
::glBindTexture( GL_TEXTURE_2D, NULL );
|
||||
m_units[ Unit ].texture = NULL;
|
||||
::glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
m_units[ Unit ].texture = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
||||
::glBindTexture( GL_TEXTURE_2D, NULL );
|
||||
m_units[ Unit ].texture = NULL;
|
||||
::glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
m_units[ Unit ].texture = 0;
|
||||
}
|
||||
// all done
|
||||
return;
|
||||
|
||||
@@ -78,6 +78,7 @@ private:
|
||||
};
|
||||
|
||||
typedef int texture_handle;
|
||||
int const null_handle = 0;
|
||||
|
||||
class texture_manager {
|
||||
|
||||
@@ -114,8 +115,8 @@ private:
|
||||
typedef std::unordered_map<std::string, std::size_t> index_map;
|
||||
|
||||
struct texture_unit {
|
||||
GLint unit { NULL };
|
||||
texture_handle texture { NULL }; // current (most recently bound) texture
|
||||
GLint unit { 0 };
|
||||
texture_handle texture { null_handle }; // current (most recently bound) texture
|
||||
};
|
||||
|
||||
// methods:
|
||||
@@ -134,7 +135,7 @@ private:
|
||||
index_map m_texturemappings;
|
||||
garbage_collector<texturetimepointpair_sequence> m_garbagecollector { m_textures, 600, 60, "texture" };
|
||||
std::array<texture_unit, 4> m_units;
|
||||
GLint m_activeunit { NULL };
|
||||
GLint m_activeunit { 0 };
|
||||
};
|
||||
|
||||
// reduces provided data image to half of original size, using basic 2x2 average
|
||||
|
||||
@@ -485,7 +485,7 @@ void TTrack::Load(cParser *parser, vector3 pOrigin, std::string name)
|
||||
*parser >> str; // railtex
|
||||
m_material1 = (
|
||||
str == "none" ?
|
||||
NULL :
|
||||
null_handle :
|
||||
GfxRenderer.Fetch_Material( str ) );
|
||||
parser->getTokens();
|
||||
*parser >> fTexLength; // tex tile length
|
||||
@@ -495,7 +495,7 @@ void TTrack::Load(cParser *parser, vector3 pOrigin, std::string name)
|
||||
*parser >> str; // sub || railtex
|
||||
m_material2 = (
|
||||
str == "none" ?
|
||||
NULL :
|
||||
null_handle :
|
||||
GfxRenderer.Fetch_Material( str ) );
|
||||
parser->getTokens(3);
|
||||
*parser >> fTexHeight1 >> fTexWidth >> fTexSlope;
|
||||
|
||||
@@ -93,7 +93,7 @@ sekcji z sąsiedniego przęsła).
|
||||
std::size_t
|
||||
TTraction::create_geometry( geometrybank_handle const &Bank, glm::dvec3 const &Origin ) {
|
||||
|
||||
if( m_geometry != NULL ) {
|
||||
if( m_geometry != null_handle ) {
|
||||
return GfxRenderer.Vertices( m_geometry ).size() / 2;
|
||||
}
|
||||
|
||||
|
||||
4
color.h
4
color.h
@@ -47,9 +47,9 @@ RGBtoHSV( glm::vec3 const &RGB ) {
|
||||
hsv.x = ( RGB.g - RGB.b ) / delta; // between yellow & magenta
|
||||
else
|
||||
if( RGB.g >= max )
|
||||
hsv.x = 2.0 + ( RGB.g - RGB.r ) / delta; // between cyan & yellow
|
||||
hsv.x = 2.f + ( RGB.g - RGB.r ) / delta; // between cyan & yellow
|
||||
else
|
||||
hsv.x = 4.0 + ( RGB.r - RGB.g ) / delta; // between magenta & cyan
|
||||
hsv.x = 4.f + ( RGB.r - RGB.g ) / delta; // between magenta & cyan
|
||||
|
||||
hsv.x *= 60.0; // degrees
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ opengl_material::deserialize( cParser &Input, bool const Loadnow ) {
|
||||
}
|
||||
|
||||
has_alpha = (
|
||||
texture1 != NULL ?
|
||||
texture1 != null_handle ?
|
||||
GfxRenderer.Texture( texture1 ).has_alpha :
|
||||
false );
|
||||
|
||||
@@ -93,15 +93,15 @@ material_manager::create( std::string const &Filename, bool const Loadnow ) {
|
||||
cParser materialparser( disklookup, cParser::buffer_FILE );
|
||||
if( false == material.deserialize( materialparser, Loadnow ) ) {
|
||||
// deserialization failed but the .mat file does exist, so we give up at this point
|
||||
return NULL;
|
||||
return null_handle;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if there's no .mat file, this could be legacy method of referring just to diffuse texture directly, make a material out of it in such case
|
||||
material.texture1 = GfxRenderer.Fetch_Texture( Filename, Loadnow );
|
||||
if( material.texture1 == NULL ) {
|
||||
if( material.texture1 == null_handle ) {
|
||||
// if there's also no texture, give up
|
||||
return NULL;
|
||||
return null_handle;
|
||||
}
|
||||
material.has_alpha = GfxRenderer.Texture( material.texture1 ).has_alpha;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ typedef int material_handle;
|
||||
// for legacy opengl this is basically just texture(s) assigned to geometry
|
||||
struct opengl_material {
|
||||
|
||||
texture_handle texture1 { NULL }; // primary texture, typically diffuse+apha
|
||||
texture_handle texture2 { NULL }; // secondary texture, typically normal+reflection
|
||||
texture_handle texture1 { null_handle }; // primary texture, typically diffuse+apha
|
||||
texture_handle texture2 { null_handle }; // secondary texture, typically normal+reflection
|
||||
|
||||
bool has_alpha { false }; // alpha state, calculated from presence of alpha in texture1
|
||||
std::string name;
|
||||
|
||||
@@ -118,7 +118,7 @@ geometry_bank::vertices( geometry_handle const &Geometry ) const {
|
||||
|
||||
// opengl vbo-based variant of the geometry bank
|
||||
|
||||
GLuint opengl_vbogeometrybank::m_activebuffer { NULL }; // buffer bound currently on the opengl end, if any
|
||||
GLuint opengl_vbogeometrybank::m_activebuffer { 0 }; // buffer bound currently on the opengl end, if any
|
||||
unsigned int opengl_vbogeometrybank::m_activestreams { stream::none }; // currently enabled data type pointers
|
||||
std::vector<GLint> opengl_vbogeometrybank::m_activetexturearrays; // currently enabled texture coord arrays
|
||||
|
||||
@@ -151,7 +151,7 @@ opengl_vbogeometrybank::replace_( geometry_handle const &Geometry ) {
|
||||
void
|
||||
opengl_vbogeometrybank::draw_( geometry_handle const &Geometry, stream_units const &Units, unsigned int const Streams ) {
|
||||
|
||||
if( m_buffer == NULL ) {
|
||||
if( m_buffer == 0 ) {
|
||||
// if there's no buffer, we'll have to make one
|
||||
// NOTE: this isn't exactly optimal in terms of ensuring the gfx card doesn't stall waiting for the data
|
||||
// may be better to initiate upload earlier (during update phase) and trust this effort won't go to waste
|
||||
@@ -235,14 +235,14 @@ opengl_vbogeometrybank::bind_buffer() {
|
||||
void
|
||||
opengl_vbogeometrybank::delete_buffer() {
|
||||
|
||||
if( m_buffer != NULL ) {
|
||||
if( m_buffer != 0 ) {
|
||||
|
||||
::glDeleteBuffers( 1, &m_buffer );
|
||||
if( m_activebuffer == m_buffer ) {
|
||||
m_activebuffer = NULL;
|
||||
m_activebuffer = 0;
|
||||
release_streams();
|
||||
}
|
||||
m_buffer = NULL;
|
||||
m_buffer = 0;
|
||||
m_buffercapacity = 0;
|
||||
// NOTE: since we've deleted the buffer all chunks it held were rendered invalid as well
|
||||
// instead of clearing their state here we're delaying it until new buffer is created to avoid looping through chunk records twice
|
||||
@@ -423,7 +423,7 @@ geometrybank_manager::append( vertex_array &Vertices, geometry_handle const &Geo
|
||||
void
|
||||
geometrybank_manager::draw( geometry_handle const &Geometry, unsigned int const Streams ) {
|
||||
|
||||
if( Geometry == NULL ) { return; }
|
||||
if( Geometry == null_handle ) { return; }
|
||||
|
||||
auto &bankrecord = bank( Geometry );
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ private:
|
||||
static GLuint m_activebuffer; // buffer bound currently on the opengl end, if any
|
||||
static unsigned int m_activestreams;
|
||||
static std::vector<GLint> m_activetexturearrays;
|
||||
GLuint m_buffer { NULL }; // id of the buffer holding data on the opengl end
|
||||
GLuint m_buffer { 0 }; // id of the buffer holding data on the opengl end
|
||||
std::size_t m_buffercapacity{ 0 }; // total capacity of the last established buffer
|
||||
chunkrecord_sequence m_chunkrecords; // helper data for all stored geometry chunks, in matching order
|
||||
|
||||
|
||||
28
renderer.cpp
28
renderer.cpp
@@ -217,7 +217,7 @@ opengl_renderer::Init( GLFWwindow *Window ) {
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL );
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE );
|
||||
::glBindTexture( GL_TEXTURE_2D, NULL );
|
||||
::glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
#ifdef EU07_USE_DEBUG_SHADOWMAP
|
||||
::glGenTextures( 1, &m_shadowdebugtexture );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_shadowdebugtexture );
|
||||
@@ -1093,7 +1093,7 @@ opengl_renderer::Render( world_environment *Environment ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Bind_Material( NULL );
|
||||
Bind_Material( null_handle );
|
||||
::glDisable( GL_LIGHTING );
|
||||
::glDisable( GL_DEPTH_TEST );
|
||||
::glDepthMask( GL_FALSE );
|
||||
@@ -1690,7 +1690,7 @@ opengl_renderer::Render( TGroundNode *Node ) {
|
||||
}
|
||||
|
||||
case GL_LINES: {
|
||||
if( ( Node->Piece->geometry == NULL )
|
||||
if( ( Node->Piece->geometry == null_handle )
|
||||
|| ( Node->fLineThickness > 0.0 ) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -1723,7 +1723,7 @@ opengl_renderer::Render( TGroundNode *Node ) {
|
||||
::glLineWidth( static_cast<float>( linewidth ) );
|
||||
}
|
||||
|
||||
GfxRenderer.Bind_Material( NULL );
|
||||
GfxRenderer.Bind_Material( null_handle );
|
||||
|
||||
::glPushMatrix();
|
||||
auto const originoffset = Node->m_rootposition - m_renderpass.camera.position();
|
||||
@@ -1751,7 +1751,7 @@ opengl_renderer::Render( TGroundNode *Node ) {
|
||||
}
|
||||
|
||||
case GL_TRIANGLES: {
|
||||
if( ( Node->Piece->geometry == NULL )
|
||||
if( ( Node->Piece->geometry == null_handle )
|
||||
|| ( ( Node->iFlags & 0x10 ) == 0 ) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -2203,7 +2203,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
// material configuration:
|
||||
::glPushAttrib( GL_ENABLE_BIT | GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_POINT_BIT );
|
||||
|
||||
Bind_Material( NULL );
|
||||
Bind_Material( null_handle );
|
||||
::glPointSize( std::max( 3.f, 5.f * distancefactor * anglefactor ) );
|
||||
::glColor4f( Submodel->f4Diffuse[ 0 ], Submodel->f4Diffuse[ 1 ], Submodel->f4Diffuse[ 2 ], lightlevel * anglefactor );
|
||||
::glDisable( GL_LIGHTING );
|
||||
@@ -2250,7 +2250,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
// material configuration:
|
||||
::glPushAttrib( GL_ENABLE_BIT | GL_CURRENT_BIT );
|
||||
|
||||
Bind_Material( NULL );
|
||||
Bind_Material( null_handle );
|
||||
::glDisable( GL_LIGHTING );
|
||||
|
||||
// main draw call
|
||||
@@ -2266,7 +2266,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if( Submodel->Child != NULL )
|
||||
if( Submodel->Child != nullptr )
|
||||
if( Submodel->iAlpha & Submodel->iFlags & 0x001F0000 )
|
||||
Render( Submodel->Child );
|
||||
|
||||
@@ -2452,7 +2452,7 @@ opengl_renderer::Render_Alpha( TGroundNode *Node ) {
|
||||
auto const color { Node->hvTraction->wire_color() };
|
||||
::glColor4f( color.r, color.g, color.b, linealpha );
|
||||
|
||||
Bind_Material( NULL );
|
||||
Bind_Material( null_handle );
|
||||
|
||||
::glPushMatrix();
|
||||
auto const originoffset = Node->m_rootposition - m_renderpass.camera.position();
|
||||
@@ -2507,7 +2507,7 @@ opengl_renderer::Render_Alpha( TGroundNode *Node ) {
|
||||
}
|
||||
|
||||
case GL_LINES: {
|
||||
if( ( Node->Piece->geometry == NULL )
|
||||
if( ( Node->Piece->geometry == null_handle )
|
||||
|| ( Node->fLineThickness < 0.0 ) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -2528,7 +2528,7 @@ opengl_renderer::Render_Alpha( TGroundNode *Node ) {
|
||||
::glLineWidth( static_cast<float>(linewidth) );
|
||||
}
|
||||
|
||||
GfxRenderer.Bind_Material( NULL );
|
||||
GfxRenderer.Bind_Material( null_handle );
|
||||
|
||||
::glPushMatrix();
|
||||
auto const originoffset = Node->m_rootposition - m_renderpass.camera.position();
|
||||
@@ -2546,7 +2546,7 @@ opengl_renderer::Render_Alpha( TGroundNode *Node ) {
|
||||
}
|
||||
|
||||
case GL_TRIANGLES: {
|
||||
if( ( Node->Piece->geometry == NULL )
|
||||
if( ( Node->Piece->geometry == null_handle )
|
||||
|| ( ( Node->iFlags & 0x20 ) == 0 ) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -2852,7 +2852,7 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
}
|
||||
}
|
||||
|
||||
if( Submodel->Child != NULL ) {
|
||||
if( Submodel->Child != nullptr ) {
|
||||
if( Submodel->eType == TP_TEXT ) { // tekst renderujemy w specjalny sposób, zamiast submodeli z łańcucha Child
|
||||
int i, j = (int)Submodel->pasText->size();
|
||||
TSubModel *p;
|
||||
@@ -2885,7 +2885,7 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
|
||||
if( Submodel->b_aAnim < at_SecondsJump )
|
||||
Submodel->b_aAnim = at_None; // wyłączenie animacji dla kolejnego użycia submodelu
|
||||
|
||||
if( Submodel->Next != NULL )
|
||||
if( Submodel->Next != nullptr )
|
||||
if( Submodel->iAlpha & Submodel->iFlags & 0x2F000000 )
|
||||
Render_Alpha( Submodel->Next );
|
||||
};
|
||||
|
||||
22
renderer.h
22
renderer.h
@@ -316,7 +316,7 @@ private:
|
||||
texture_manager m_textures;
|
||||
opengllight_array m_lights;
|
||||
|
||||
geometry_handle m_billboardgeometry { NULL, NULL };
|
||||
geometry_handle m_billboardgeometry { 0, 0 };
|
||||
texture_handle m_glaretexture { -1 };
|
||||
texture_handle m_suntexture { -1 };
|
||||
texture_handle m_moontexture { -1 };
|
||||
@@ -325,22 +325,22 @@ private:
|
||||
// TODO: refactor framebuffer stuff into an object
|
||||
bool m_framebuffersupport { false };
|
||||
#ifdef EU07_USE_PICKING_FRAMEBUFFER
|
||||
GLuint m_pickframebuffer { NULL };
|
||||
GLuint m_picktexture { NULL };
|
||||
GLuint m_pickdepthbuffer { NULL };
|
||||
GLuint m_pickframebuffer { 0 };
|
||||
GLuint m_picktexture { 0 };
|
||||
GLuint m_pickdepthbuffer { 0 };
|
||||
#endif
|
||||
int m_shadowbuffersize { 2048 };
|
||||
GLuint m_shadowframebuffer { NULL };
|
||||
GLuint m_shadowtexture { NULL };
|
||||
GLuint m_shadowframebuffer { 0 };
|
||||
GLuint m_shadowtexture { 0 };
|
||||
#ifdef EU07_USE_DEBUG_SHADOWMAP
|
||||
GLuint m_shadowdebugtexture{ NULL };
|
||||
GLuint m_shadowdebugtexture{ 0 };
|
||||
#endif
|
||||
glm::mat4 m_shadowtexturematrix; // conversion from camera-centric world space to light-centric clip space
|
||||
GLuint m_environmentframebuffer { NULL };
|
||||
GLuint m_environmentcubetexture { NULL };
|
||||
GLuint m_environmentdepthbuffer { NULL };
|
||||
GLuint m_environmentframebuffer { 0 };
|
||||
GLuint m_environmentcubetexture { 0 };
|
||||
GLuint m_environmentdepthbuffer { 0 };
|
||||
bool m_environmentcubetexturesupport { false }; // indicates whether we can use the dynamic environment cube map
|
||||
int m_environmentcubetextureface { NULL }; // helper, currently processed cube map face
|
||||
int m_environmentcubetextureface { 0 }; // helper, currently processed cube map face
|
||||
int m_environmentupdatetime { 0 }; // time of the most recent environment map update
|
||||
glm::dvec3 m_environmentupdatelocation; // coordinates of most recent environment map update
|
||||
|
||||
|
||||
1
stdafx.h
1
stdafx.h
@@ -29,6 +29,7 @@
|
||||
#include <strsafe.h>
|
||||
#endif
|
||||
// stl
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#define _USE_MATH_DEFINES
|
||||
|
||||
10
uilayer.cpp
10
uilayer.cpp
@@ -100,9 +100,9 @@ ui_layer::set_background( std::string const &Filename ) {
|
||||
m_background = GfxRenderer.Fetch_Texture( Filename );
|
||||
}
|
||||
else {
|
||||
m_background = NULL;
|
||||
m_background = null_handle;
|
||||
}
|
||||
if( m_background != NULL ) {
|
||||
if( m_background != null_handle ) {
|
||||
auto const &texture = GfxRenderer.Texture( m_background );
|
||||
m_progressbottom = ( texture.width() != texture.height() );
|
||||
}
|
||||
@@ -235,11 +235,11 @@ ui_layer::render_background() {
|
||||
void
|
||||
ui_layer::render_texture() {
|
||||
|
||||
if( m_texture != NULL ) {
|
||||
if( m_texture != 0 ) {
|
||||
::glColor4f( 1.f, 1.f, 1.f, 1.f );
|
||||
::glDisable( GL_BLEND );
|
||||
|
||||
GfxRenderer.Bind_Texture( NULL );
|
||||
GfxRenderer.Bind_Texture( null_handle );
|
||||
::glBindTexture( GL_TEXTURE_2D, m_texture );
|
||||
|
||||
auto const size = 512.f;
|
||||
@@ -254,7 +254,7 @@ ui_layer::render_texture() {
|
||||
|
||||
glEnd();
|
||||
|
||||
::glBindTexture( GL_TEXTURE_2D, NULL );
|
||||
::glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
::glEnable( GL_BLEND );
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void
|
||||
set_background( std::string const &Filename = "" );
|
||||
void
|
||||
set_texture( GLuint Texture = NULL ) { m_texture = Texture; }
|
||||
set_texture( GLuint Texture = 0 ) { m_texture = Texture; }
|
||||
void
|
||||
set_tooltip( std::string const &Tooltip ) { m_tooltip = Tooltip; }
|
||||
void
|
||||
@@ -98,8 +98,8 @@ private:
|
||||
std::string m_progresstext; // label placed over the progress bar
|
||||
bool m_progressbottom { false }; // location of the progress bar
|
||||
|
||||
texture_handle m_background { NULL }; // path to texture used as the background. size depends on mAspect.
|
||||
GLuint m_texture { NULL };
|
||||
texture_handle m_background { null_handle }; // path to texture used as the background. size depends on mAspect.
|
||||
GLuint m_texture { 0 };
|
||||
std::vector<std::shared_ptr<ui_panel> > m_panels;
|
||||
std::string m_tooltip;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user