mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-14 00:41:08 +00:00
8aeff6b09a
The STL now defines `std::byte` so doing `using namespace std` will conflict will custom definition of `byte`, which this legacy code is full of. It looks like NetRadiant went the route of making explicit usage of `std::` prefixed types and did not renamed the custom definition of byte, so doing the same reduces diff noise between the two trees. This also makes the code future proof if the STL decides to define some other types with common name. This patches replaces all usages of `map`, `pair` and `vector` with `std::map`, `std::pair` and `std::vector` and remove the `using namespace std` line in `stl_check.h`. ``` libs/mathlib.h:132:44: error: reference to ‘byte’ is ambiguous 132 | void NormalToLatLong( const vec3_t normal, byte bytes[2] ); | ^~~~ In file included from /usr/include/c++/11/bits/stl_algobase.h:61, from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/ios:40, from /usr/include/c++/11/ostream:38, from /usr/include/c++/11/iostream:39, from libs/missing.h:76, from radiant/qe3.h:40, from radiant/stdafx.h:39, from radiant/bp_dlg.cpp:28: /usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’ 404 | enum class byte : unsigned char; | ^~~~ ```
94 lines
2.4 KiB
C++
94 lines
2.4 KiB
C++
/*
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
|
|
|
This file is part of GtkRadiant.
|
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef _CPICOMODEL_H_
|
|
#define _CPICOMODEL_H_
|
|
|
|
#include "plugin.h"
|
|
#include "picomodel.h"
|
|
|
|
#include "gtkr_vector.h"
|
|
|
|
class CPicoParent
|
|
{
|
|
public:
|
|
virtual void UpdateShaders( void ) = 0;
|
|
};
|
|
|
|
class CModelManager; // forward declaration
|
|
|
|
//typedef std::pair<Str, int> PicoModelKey;
|
|
typedef std::pair<Str, int> PicoModelKey;
|
|
|
|
class CPicoModel : public IRender, public ISelect
|
|
{
|
|
friend class CModelManager;
|
|
public:
|
|
CPicoModel( const PicoModelKey& key );
|
|
CPicoModel( const Str& name );
|
|
CPicoModel( const Str& name, const int frame );
|
|
CPicoModel( const char *name, const int frame );
|
|
~CPicoModel();
|
|
void load( const char *name, const int frame );
|
|
|
|
void IncRef(){
|
|
++m_refcount;
|
|
}
|
|
void DecRef(){
|
|
if ( --m_refcount == 0 ) {
|
|
delete this;
|
|
}
|
|
}
|
|
|
|
void AddParent( CPicoParent *parent );
|
|
void RemoveParent( CPicoParent *parent );
|
|
|
|
void Reload( void );
|
|
|
|
void Draw( int state, std::vector<IShader*> shaders, int rflags ) const;
|
|
//IRender
|
|
virtual void Draw( int state, int rflags ) const;
|
|
virtual const bool IsModelNotNull() const { return true; }
|
|
virtual const aabb_t *GetAABB() const { return &m_BBox; }
|
|
|
|
//ISelect
|
|
virtual bool TestRay( const ray_t *ray, vec_t *dist ) const;
|
|
|
|
int GetNumSurfaces( void );
|
|
char *GetShaderNameForSurface( const unsigned int surf );
|
|
|
|
private:
|
|
void AccumulateBBox();
|
|
|
|
char *m_name;
|
|
int m_frame;
|
|
picoModel_t *m_pModel;
|
|
unsigned int m_refcount;
|
|
aabb_t m_BBox;
|
|
GPtrArray *m_children; // array of CPicoSurface
|
|
GPtrArray *m_parents; // array of CPicoParent
|
|
|
|
GPtrArray* m_shaders;
|
|
|
|
bool m_bReloaded; // managed by CModelManager
|
|
};
|
|
|
|
#endif // _CPICOMODEL_H_
|