fix some clang warnings & errors

This commit is contained in:
Garux 2022-10-29 01:07:30 +03:00
parent 0678e842b2
commit 9bbb84ea5a
8 changed files with 33 additions and 33 deletions

View File

@ -225,7 +225,7 @@ void MapCoordinator(){
{ {
auto button = new QPushButton( "Get optimal mapcoords" ); auto button = new QPushButton( "Get optimal mapcoords" );
form->addWidget( button ); form->addWidget( button );
QObject::connect( button, &QPushButton::clicked, [&](){ QObject::connect( button, &QPushButton::clicked, [&, calc_min = calc_min, calc_max = calc_max](){
spin_minX->setValue( calc_min.x() ); spin_minX->setValue( calc_min.x() );
spin_minY->setValue( calc_max.y() ); spin_minY->setValue( calc_max.y() );
spin_maxX->setValue( calc_max.x() ); spin_maxX->setValue( calc_max.x() );

View File

@ -876,10 +876,10 @@ public:
} }
// IShaders implementation ----------------- // IShaders implementation -----------------
void IncRef(){ void IncRef() override {
++m_refcount; ++m_refcount;
} }
void DecRef(){ void DecRef() override {
ASSERT_MESSAGE( m_refcount != 0, "shader reference-count going below zero" ); ASSERT_MESSAGE( m_refcount != 0, "shader reference-count going below zero" );
if ( --m_refcount == 0 ) { if ( --m_refcount == 0 ) {
delete this; delete this;
@ -891,7 +891,7 @@ public:
} }
// get/set the qtexture_t* Radiant uses to represent this shader object // get/set the qtexture_t* Radiant uses to represent this shader object
qtexture_t* getTexture() const { qtexture_t* getTexture() const override {
return m_pTexture; return m_pTexture;
} }
qtexture_t* getSkyBox() override { qtexture_t* getSkyBox() override {
@ -901,52 +901,52 @@ public:
return m_pSkyBox; return m_pSkyBox;
} }
qtexture_t* getDiffuse() const { qtexture_t* getDiffuse() const override {
return m_pDiffuse; return m_pDiffuse;
} }
qtexture_t* getBump() const { qtexture_t* getBump() const override {
return m_pBump; return m_pBump;
} }
qtexture_t* getSpecular() const { qtexture_t* getSpecular() const override {
return m_pSpecular; return m_pSpecular;
} }
// get shader name // get shader name
const char* getName() const { const char* getName() const override {
return m_Name.c_str(); return m_Name.c_str();
} }
bool IsInUse() const { bool IsInUse() const override {
return m_bInUse; return m_bInUse;
} }
void SetInUse( bool bInUse ){ void SetInUse( bool bInUse ) override {
m_bInUse = bInUse; m_bInUse = bInUse;
g_ActiveShadersChangedNotify(); g_ActiveShadersChangedNotify();
} }
// get the shader flags // get the shader flags
int getFlags() const { int getFlags() const override {
return m_template.m_nFlags; return m_template.m_nFlags;
} }
// get the transparency value // get the transparency value
float getTrans() const { float getTrans() const override {
return m_template.m_fTrans; return m_template.m_fTrans;
} }
// test if it's a true shader, or a default shader created to wrap around a texture // test if it's a true shader, or a default shader created to wrap around a texture
bool IsDefault() const { bool IsDefault() const override {
return string_empty( m_filename ); return string_empty( m_filename );
} }
// get the alphaFunc // get the alphaFunc
void getAlphaFunc( EAlphaFunc *func, float *ref ) { void getAlphaFunc( EAlphaFunc *func, float *ref ) override {
*func = m_template.m_AlphaFunc; *func = m_template.m_AlphaFunc;
*ref = m_template.m_AlphaRef; *ref = m_template.m_AlphaRef;
}; };
BlendFunc getBlendFunc() const { BlendFunc getBlendFunc() const override {
return m_blendFunc; return m_blendFunc;
} }
// get the cull type // get the cull type
ECull getCull(){ ECull getCull() override {
return m_template.m_Cull; return m_template.m_Cull;
}; };
// get shader file name (ie the file where this one is defined) // get shader file name (ie the file where this one is defined)
const char* getShaderFileName() const { const char* getShaderFileName() const override {
return m_filename; return m_filename;
} }
// ----------------------------------------- // -----------------------------------------
@ -1090,20 +1090,20 @@ public:
typedef std::vector<MapLayer> MapLayers; typedef std::vector<MapLayer> MapLayers;
MapLayers m_layers; MapLayers m_layers;
const ShaderLayer* firstLayer() const { const ShaderLayer* firstLayer() const override {
if ( m_layers.empty() ) { if ( m_layers.empty() ) {
return 0; return 0;
} }
return &m_layers.front(); return &m_layers.front();
} }
void forEachLayer( const ShaderLayerCallback& callback ) const { void forEachLayer( const ShaderLayerCallback& callback ) const override {
for ( MapLayers::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i ) for ( MapLayers::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i )
{ {
callback( *i ); callback( *i );
} }
} }
qtexture_t* lightFalloffImage() const { qtexture_t* lightFalloffImage() const override {
if ( !m_template.m_lightFalloffImage.empty() ) { if ( !m_template.m_lightFalloffImage.empty() ) {
return m_pLightFalloffImage; return m_pLightFalloffImage;
} }

View File

@ -116,7 +116,7 @@ void item_model_foreach( Functor f, QAbstractItemModel* model, QModelIndex paren
} }
void EntityList_UpdateSelection( QAbstractItemModel* model, QTreeView* view ){ void EntityList_UpdateSelection( QAbstractItemModel* model, QTreeView* view ){
item_model_foreach( [model, view]( QModelIndex &index ){ item_model_foreach( [view]( QModelIndex &index ){
scene::Instance* instance = static_cast<scene::Instance*>( index.data( c_ItemDataRole_Instance ).value<void*>() ); scene::Instance* instance = static_cast<scene::Instance*>( index.data( c_ItemDataRole_Instance ).value<void*>() );
if ( Selectable* selectable = Instance_getSelectable( *instance ) ) { if ( Selectable* selectable = Instance_getSelectable( *instance ) ) {
view->selectionModel()->select( index, selectable->isSelected() view->selectionModel()->select( index, selectable->isSelected()

View File

@ -1799,10 +1799,10 @@ public:
} }
bool isSelected() const { bool isSelected() const {
return m_selectable_x.isSelected() return m_selectable_x.isSelected()
| m_selectable_y.isSelected() || m_selectable_y.isSelected()
| m_selectable_z.isSelected() || m_selectable_z.isSelected()
| m_selectable_screen.isSelected() || m_selectable_screen.isSelected()
| m_selectable_sphere.isSelected(); || m_selectable_sphere.isSelected();
} }
}; };

View File

@ -87,7 +87,7 @@ struct VFS_PAKFILE
const CopiedString name; const CopiedString name;
const unz_s zipinfo; const unz_s zipinfo;
VFS_PAK& pak; VFS_PAK& pak;
const guint32 size; const unsigned long size;
}; };
// ============================================================================= // =============================================================================

View File

@ -861,7 +861,7 @@ int LightContributionToSample( trace_t *trace ){
} }
/* clamp the distance to prevent super hot spots */ /* clamp the distance to prevent super hot spots */
dist = std::max( 16.0, sqrt( dist * dist + light->extraDist * light->extraDist ) ); dist = std::max( 16.f, std::sqrt( dist * dist + light->extraDist * light->extraDist ) );
add = light->photons / ( dist * dist ) * angle; add = light->photons / ( dist * dist ) * angle;
@ -926,7 +926,7 @@ int LightContributionToSample( trace_t *trace ){
} }
/* clamp the distance to prevent super hot spots */ /* clamp the distance to prevent super hot spots */
dist = std::max( 16.0, sqrt( dist * dist + light->extraDist * light->extraDist ) ); dist = std::max( 16.f, std::sqrt( dist * dist + light->extraDist * light->extraDist ) );
/* angle attenuation */ /* angle attenuation */
if ( light->flags & LightFlags::AttenAngle ) { if ( light->flags & LightFlags::AttenAngle ) {
@ -1294,7 +1294,7 @@ static bool LightContributionToPoint( trace_t *trace ){
/* ptpff approximation */ /* ptpff approximation */
if ( light->type == ELightType::Area && faster ) { if ( light->type == ELightType::Area && faster ) {
/* clamp the distance to prevent super hot spots */ /* clamp the distance to prevent super hot spots */
dist = std::max( 16.0, sqrt( dist * dist + light->extraDist * light->extraDist ) ); dist = std::max( 16.f, std::sqrt( dist * dist + light->extraDist * light->extraDist ) );
/* attenuate */ /* attenuate */
add = light->photons / ( dist * dist ); add = light->photons / ( dist * dist );
@ -1342,7 +1342,7 @@ static bool LightContributionToPoint( trace_t *trace ){
/* point/spot lights */ /* point/spot lights */
else if ( light->type == ELightType::Point || light->type == ELightType::Spot ) { else if ( light->type == ELightType::Point || light->type == ELightType::Spot ) {
/* clamp the distance to prevent super hot spots */ /* clamp the distance to prevent super hot spots */
dist = std::max( 16.0, sqrt( dist * dist + light->extraDist * light->extraDist ) ); dist = std::max( 16.f, std::sqrt( dist * dist + light->extraDist * light->extraDist ) );
/* attenuate */ /* attenuate */
if ( light->flags & LightFlags::AttenLinear ) { if ( light->flags & LightFlags::AttenLinear ) {
@ -1720,7 +1720,7 @@ static void SetupGrid(){
/* quantize it */ /* quantize it */
const Vector3 oldGridSize = gridSize; const Vector3 oldGridSize = gridSize;
for ( int i = 0; i < 3; i++ ) for ( int i = 0; i < 3; i++ )
gridSize[ i ] = std::max( 8.0, floor( gridSize[ i ] ) ); gridSize[ i ] = std::max( 8.f, std::floor( gridSize[ i ] ) );
/* ydnar: increase gridSize until grid count is smaller than max allowed */ /* ydnar: increase gridSize until grid count is smaller than max allowed */
size_t numGridPoints; size_t numGridPoints;

View File

@ -1701,7 +1701,7 @@ static float DirtForSample( trace_t *trace ){
} }
/* apply gain (does this even do much? heh) */ /* apply gain (does this even do much? heh) */
outDirt = std::min( 1.0, pow( gatherDirt / ( numDirtVectors + 1 ), dirtGain ) ); outDirt = std::min( 1.f, std::pow( gatherDirt / ( numDirtVectors + 1 ), dirtGain ) );
/* apply scale */ /* apply scale */
outDirt *= dirtScale; outDirt *= dirtScale;

View File

@ -623,7 +623,7 @@ static void FinishShader( shaderInfo_t *si ){
} }
/* find pixel coordinates best matching the average color of the image */ /* find pixel coordinates best matching the average color of the image */
float bestDist = 99999999; float bestDist = 99999999.f;
const Vector2 o( 1.0f / si->shaderImage->width, 1.0f / si->shaderImage->height ); const Vector2 o( 1.0f / si->shaderImage->width, 1.0f / si->shaderImage->height );
for ( y = 0, st[ 1 ] = 0.0f; y < si->shaderImage->height; y++, st[ 1 ] += o[ 1 ] ) for ( y = 0, st[ 1 ] = 0.0f; y < si->shaderImage->height; y++, st[ 1 ] += o[ 1 ] )
{ {