From 753b36a9b2271fe0dacd1a2c951edbeae4c6f27f Mon Sep 17 00:00:00 2001 From: Webster Sheets Date: Mon, 31 Aug 2020 22:03:42 -0400 Subject: [PATCH] Apply clang-format changes --- src/BaseSphere.cpp | 2 +- src/galaxy/GalaxyGenerator.cpp | 2 +- src/graphics/TextureBuilder.cpp | 79 ++++++++++++++++----------------- src/gui/Gui.cpp | 2 +- 4 files changed, 41 insertions(+), 44 deletions(-) diff --git a/src/BaseSphere.cpp b/src/BaseSphere.cpp index 46d626fea80..a1efc28293f 100644 --- a/src/BaseSphere.cpp +++ b/src/BaseSphere.cpp @@ -6,8 +6,8 @@ #include "GasGiant.h" #include "GeoSphere.h" -#include "graphics/Renderer.h" #include "graphics/Drawables.h" +#include "graphics/Renderer.h" BaseSphere::BaseSphere(const SystemBody *body) : m_sbody(body), diff --git a/src/galaxy/GalaxyGenerator.cpp b/src/galaxy/GalaxyGenerator.cpp index be13d522e95..61049e4545c 100644 --- a/src/galaxy/GalaxyGenerator.cpp +++ b/src/galaxy/GalaxyGenerator.cpp @@ -122,7 +122,7 @@ void GalaxyGenerator::ToJson(Json &jsonObj, RefCountedPtr galaxy) sysgen->ToJson(starSystemStageArrayEl, galaxy); starSystemStageArray.push_back(starSystemStageArrayEl); // Append system stage object to array. } - galaxyGenObj["sector_stage"] = sectorStageArray; // Add sector stage array to galaxy generator object. + galaxyGenObj["sector_stage"] = sectorStageArray; // Add sector stage array to galaxy generator object. galaxyGenObj["star_system_stage"] = starSystemStageArray; // Add system stage array to galaxy generator object. jsonObj["galaxy_generator"] = galaxyGenObj; // Add galaxy generator object to supplied object. diff --git a/src/graphics/TextureBuilder.cpp b/src/graphics/TextureBuilder.cpp index 3bd6ae56e43..ecb0d378f21 100644 --- a/src/graphics/TextureBuilder.cpp +++ b/src/graphics/TextureBuilder.cpp @@ -7,8 +7,8 @@ #include "utils.h" #include #include -#include #include +#include namespace Graphics { @@ -73,29 +73,29 @@ namespace Graphics { #error "SDL surface pixel formats are endian-specific" #endif static SDL_PixelFormat pixelFormatRGBA = { - 0, // format# - 0, // palette - 32, // bits per pixel - 4, // bytes per pixel - { 0, 0 }, // padding + 0, // format# + 0, // palette + 32, // bits per pixel + 4, // bytes per pixel + { 0, 0 }, // padding 0xff, 0xff00, 0xff0000, 0xff000000, // RGBA mask - 0, 0, 0, 0, // RGBA loss - 24, 16, 8, 0, // RGBA shift - 0, // colour key - 0 // alpha + 0, 0, 0, 0, // RGBA loss + 24, 16, 8, 0, // RGBA shift + 0, // colour key + 0 // alpha }; static SDL_PixelFormat pixelFormatRGB = { - 0, // format# - 0, // palette - 24, // bits per pixel - 3, // bytes per pixel - { 0, 0 }, // padding + 0, // format# + 0, // palette + 24, // bits per pixel + 3, // bytes per pixel + { 0, 0 }, // padding 0xff, 0xff00, 0xff0000, 0, // RGBA mask - 0, 0, 0, 0, // RGBA loss - 16, 8, 0, 0, // RGBA shift - 0, // colour key - 0 // alpha + 0, 0, 0, 0, // RGBA loss + 16, 8, 0, 0, // RGBA shift + 0, // colour key + 0 // alpha }; static inline bool GetTargetFormat(const SDL_PixelFormat *sourcePixelFormat, TextureFormat *targetTextureFormat, SDL_PixelFormat **targetPixelFormat, bool forceRGBA) @@ -201,7 +201,7 @@ namespace Graphics { Output("WARNING: texture '%s' is not power-of-two and may not display correctly\n", m_filenames.front().c_str()); } } else { - if(m_textureType != TEXTURE_2D_ARRAY) { + if (m_textureType != TEXTURE_2D_ARRAY) { switch (m_dds.GetTextureFormat()) { case PicoDDS::FORMAT_DXT1: targetTextureFormat = TEXTURE_DXT1; break; case PicoDDS::FORMAT_DXT5: targetTextureFormat = TEXTURE_DXT5; break; @@ -219,10 +219,10 @@ namespace Graphics { // Cube map must be fully defined (6 images) to be used correctly assert(numberOfImages == 6); } - } else if(m_textureType == TEXTURE_2D_ARRAY) { + } else if (m_textureType == TEXTURE_2D_ARRAY) { assert(m_ddsarray.size() == m_layers); - assert(m_layers>0); - switch(m_ddsarray[0].GetTextureFormat()) { + assert(m_layers > 0); + switch (m_ddsarray[0].GetTextureFormat()) { case PicoDDS::FORMAT_DXT1: targetTextureFormat = TEXTURE_DXT1; break; case PicoDDS::FORMAT_DXT5: targetTextureFormat = TEXTURE_DXT5; break; default: @@ -230,14 +230,14 @@ namespace Graphics { assert(false); return; } - for(size_t i=0; iGetDescriptor().type == TEXTURE_2D && m_textureType == TEXTURE_2D) { - texture->Update(m_surface->pixels, vector3f(m_surface->w,m_surface->h,0.0f), m_descriptor.format, 0); + texture->Update(m_surface->pixels, vector3f(m_surface->w, m_surface->h, 0.0f), m_descriptor.format, 0); } else if (texture->GetDescriptor().type == TEXTURE_CUBE_MAP && m_textureType == TEXTURE_CUBE_MAP) { assert(m_cubemap.size() == 6); TextureCubeData tcd; @@ -329,16 +326,16 @@ namespace Graphics { tcd.negY = m_cubemap[3]->pixels; tcd.posZ = m_cubemap[4]->pixels; tcd.negZ = m_cubemap[5]->pixels; - texture->Update(tcd, vector3f(m_cubemap[0]->w, m_cubemap[0]->h,0.0f), m_descriptor.format, 0); + texture->Update(tcd, vector3f(m_cubemap[0]->w, m_cubemap[0]->h, 0.0f), m_descriptor.format, 0); } else { // Given texture and current texture don't have the same type! assert(0); } - } else if( m_dds.headerdone_ ) { + } else if (m_dds.headerdone_) { assert(m_dds.headerdone_); assert(m_descriptor.format == TEXTURE_DXT1 || m_descriptor.format == TEXTURE_DXT5); if (texture->GetDescriptor().type == TEXTURE_2D && m_textureType == TEXTURE_2D) { - texture->Update(m_dds.imgdata_.imgData, vector3f(m_dds.imgdata_.width,m_dds.imgdata_.height,0.0f), m_descriptor.format, m_dds.imgdata_.numMipMaps); + texture->Update(m_dds.imgdata_.imgData, vector3f(m_dds.imgdata_.width, m_dds.imgdata_.height, 0.0f), m_descriptor.format, m_dds.imgdata_.numMipMaps); } else if (texture->GetDescriptor().type == TEXTURE_CUBE_MAP && m_textureType == TEXTURE_CUBE_MAP) { TextureCubeData tcd; // Size in bytes of each cube map face @@ -350,20 +347,20 @@ namespace Graphics { tcd.negY = static_cast(m_dds.imgdata_.imgData + (3 * face_size)); tcd.posZ = static_cast(m_dds.imgdata_.imgData + (4 * face_size)); tcd.negZ = static_cast(m_dds.imgdata_.imgData + (5 * face_size)); - texture->Update(tcd, vector3f(m_dds.imgdata_.width, m_dds.imgdata_.height,0.0f), m_descriptor.format, m_dds.imgdata_.numMipMaps); + texture->Update(tcd, vector3f(m_dds.imgdata_.width, m_dds.imgdata_.height, 0.0f), m_descriptor.format, m_dds.imgdata_.numMipMaps); } else { // Given texture and current texture don't have the same type! assert(0); } - } else if( !m_ddsarray.empty() ) { + } else if (!m_ddsarray.empty()) { // texture array assert(m_textureType == TEXTURE_2D_ARRAY); const TextureDescriptor &desc = texture->GetDescriptor(); // virtual void Update(const vecDataPtr &data, const vector3f &dataSize, const TextureFormat format, const unsigned int numMips = 0) = 0; Texture::vecDataPtr dataPtrs; dataPtrs.reserve(m_layers); - for(size_t i=0; iUpdate(dataPtrs, desc.dataSize, desc.format, desc.numberOfMipMaps); } diff --git a/src/gui/Gui.cpp b/src/gui/Gui.cpp index 996eecbe8d5..86592fd699c 100644 --- a/src/gui/Gui.cpp +++ b/src/gui/Gui.cpp @@ -3,8 +3,8 @@ #include "Gui.h" #include "graphics/Graphics.h" -#include "graphics/Renderer.h" #include "graphics/RenderState.h" +#include "graphics/Renderer.h" #include "libs.h" namespace Gui {