diff --git a/src/App/Material.cpp b/src/App/Material.cpp index 3a34d208d2..8962dc33d7 100644 --- a/src/App/Material.cpp +++ b/src/App/Material.cpp @@ -32,61 +32,35 @@ using namespace App; +// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) //=========================================================================== // Material //=========================================================================== Material::Material() - : shininess {0.9000f} + : shininess {0.9000F} , transparency {} + , _matType {USER_DEFINED} { setType(STEEL); setType(USER_DEFINED); } -Material::Material(const Material& other) - : ambientColor(other.ambientColor) - , diffuseColor(other.diffuseColor) - , specularColor(other.specularColor) - , emissiveColor(other.emissiveColor) - , shininess(other.shininess) - , transparency(other.transparency) - , uuid(other.uuid) - , _matType(other._matType) -{ -} - Material::Material(const char* MatName) - : shininess {0.9000f} + : shininess {0.9000F} , transparency {} + , _matType {USER_DEFINED} { set(MatName); } -Material::Material(const MaterialType MatType) - : shininess {0.9000f} +Material::Material(MaterialType MatType) + : shininess {0.9000F} , transparency {} + , _matType {USER_DEFINED} { setType(MatType); } -Material& Material::operator=(const Material& other) -{ - if (this == &other) { - return *this; - } - - _matType = other._matType; - ambientColor = other.ambientColor; - diffuseColor = other.diffuseColor; - specularColor = other.specularColor; - emissiveColor = other.emissiveColor; - shininess = other.shininess; - transparency = other.transparency; - uuid = other.uuid; - - return *this; -} - void Material::set(const char* MatName) { if (strcmp("Brass", MatName) == 0) { @@ -160,187 +134,188 @@ void Material::set(const char* MatName) } } -void Material::setType(const MaterialType MatType) +void Material::setType(MaterialType MatType) { _matType = MatType; switch (MatType) { case BRASS: - ambientColor.set(0.3294f, 0.2235f, 0.0275f); - diffuseColor.set(0.7804f, 0.5686f, 0.1137f); - specularColor.set(0.9922f, 0.9412f, 0.8078f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.2179f; - transparency = 0.0000f; + ambientColor.set(0.3294F, 0.2235F, 0.0275F); + diffuseColor.set(0.7804F, 0.5686F, 0.1137F); + specularColor.set(0.9922F, 0.9412F, 0.8078F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.2179F; + transparency = 0.0000F; break; case BRONZE: - ambientColor.set(0.2125f, 0.1275f, 0.0540f); - diffuseColor.set(0.7140f, 0.4284f, 0.1814f); - specularColor.set(0.3935f, 0.2719f, 0.1667f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.2000f; - transparency = 0.0000f; + ambientColor.set(0.2125F, 0.1275F, 0.0540F); + diffuseColor.set(0.7140F, 0.4284F, 0.1814F); + specularColor.set(0.3935F, 0.2719F, 0.1667F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.2000F; + transparency = 0.0000F; break; case COPPER: - ambientColor.set(0.3300f, 0.2600f, 0.2300f); - diffuseColor.set(0.5000f, 0.1100f, 0.0000f); - specularColor.set(0.9500f, 0.7300f, 0.0000f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.9300f; - transparency = 0.0000f; + ambientColor.set(0.3300F, 0.2600F, 0.2300F); + diffuseColor.set(0.5000F, 0.1100F, 0.0000F); + specularColor.set(0.9500F, 0.7300F, 0.0000F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.9300F; + transparency = 0.0000F; break; case GOLD: - ambientColor.set(0.3000f, 0.2306f, 0.0953f); - diffuseColor.set(0.4000f, 0.2760f, 0.0000f); - specularColor.set(0.9000f, 0.8820f, 0.7020f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0625f; - transparency = 0.0000f; + ambientColor.set(0.3000F, 0.2306F, 0.0953F); + diffuseColor.set(0.4000F, 0.2760F, 0.0000F); + specularColor.set(0.9000F, 0.8820F, 0.7020F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0625F; + transparency = 0.0000F; break; case PEWTER: - ambientColor.set(0.1059f, 0.0588f, 0.1137f); - diffuseColor.set(0.4275f, 0.4706f, 0.5412f); - specularColor.set(0.3333f, 0.3333f, 0.5216f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0769f; - transparency = 0.0000f; + ambientColor.set(0.1059F, 0.0588F, 0.1137F); + diffuseColor.set(0.4275F, 0.4706F, 0.5412F); + specularColor.set(0.3333F, 0.3333F, 0.5216F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0769F; + transparency = 0.0000F; break; case PLASTER: - ambientColor.set(0.0500f, 0.0500f, 0.0500f); - diffuseColor.set(0.1167f, 0.1167f, 0.1167f); - specularColor.set(0.0305f, 0.0305f, 0.0305f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0078f; - transparency = 0.0000f; + ambientColor.set(0.0500F, 0.0500F, 0.0500F); + diffuseColor.set(0.1167F, 0.1167F, 0.1167F); + specularColor.set(0.0305F, 0.0305F, 0.0305F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0078F; + transparency = 0.0000F; break; case PLASTIC: - ambientColor.set(0.1000f, 0.1000f, 0.1000f); - diffuseColor.set(0.0000f, 0.0000f, 0.0000f); - specularColor.set(0.0600f, 0.0600f, 0.0600f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0078f; - transparency = 0.0000f; + ambientColor.set(0.1000F, 0.1000F, 0.1000F); + diffuseColor.set(0.0000F, 0.0000F, 0.0000F); + specularColor.set(0.0600F, 0.0600F, 0.0600F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0078F; + transparency = 0.0000F; break; case SILVER: - ambientColor.set(0.1922f, 0.1922f, 0.1922f); - diffuseColor.set(0.5075f, 0.5075f, 0.5075f); - specularColor.set(0.5083f, 0.5083f, 0.5083f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.2000f; - transparency = 0.0000f; + ambientColor.set(0.1922F, 0.1922F, 0.1922F); + diffuseColor.set(0.5075F, 0.5075F, 0.5075F); + specularColor.set(0.5083F, 0.5083F, 0.5083F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.2000F; + transparency = 0.0000F; break; case STEEL: - ambientColor.set(0.0020f, 0.0020f, 0.0020f); - diffuseColor.set(0.0000f, 0.0000f, 0.0000f); - specularColor.set(0.9800f, 0.9800f, 0.9800f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0600f; - transparency = 0.0000f; + ambientColor.set(0.0020F, 0.0020F, 0.0020F); + diffuseColor.set(0.0000F, 0.0000F, 0.0000F); + specularColor.set(0.9800F, 0.9800F, 0.9800F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0600F; + transparency = 0.0000F; break; case STONE: - ambientColor.set(0.1900f, 0.1520f, 0.1178f); - diffuseColor.set(0.7500f, 0.6000f, 0.4650f); - specularColor.set(0.0784f, 0.0800f, 0.0480f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.1700f; - transparency = 0.0000f; + ambientColor.set(0.1900F, 0.1520F, 0.1178F); + diffuseColor.set(0.7500F, 0.6000F, 0.4650F); + specularColor.set(0.0784F, 0.0800F, 0.0480F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.1700F; + transparency = 0.0000F; break; case SHINY_PLASTIC: - ambientColor.set(0.0880f, 0.0880f, 0.0880f); - diffuseColor.set(0.0000f, 0.0000f, 0.0000f); - specularColor.set(1.0000f, 1.0000f, 1.0000f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 1.0000f; - transparency = 0.0000f; + ambientColor.set(0.0880F, 0.0880F, 0.0880F); + diffuseColor.set(0.0000F, 0.0000F, 0.0000F); + specularColor.set(1.0000F, 1.0000F, 1.0000F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 1.0000F; + transparency = 0.0000F; break; case SATIN: - ambientColor.set(0.0660f, 0.0660f, 0.0660f); - diffuseColor.set(0.0000f, 0.0000f, 0.0000f); - specularColor.set(0.4400f, 0.4400f, 0.4400f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0938f; - transparency = 0.0000f; + ambientColor.set(0.0660F, 0.0660F, 0.0660F); + diffuseColor.set(0.0000F, 0.0000F, 0.0000F); + specularColor.set(0.4400F, 0.4400F, 0.4400F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0938F; + transparency = 0.0000F; break; case METALIZED: - ambientColor.set(0.1800f, 0.1800f, 0.1800f); - diffuseColor.set(0.0000f, 0.0000f, 0.0000f); - specularColor.set(0.4500f, 0.4500f, 0.4500f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.1300f; - transparency = 0.0000f; + ambientColor.set(0.1800F, 0.1800F, 0.1800F); + diffuseColor.set(0.0000F, 0.0000F, 0.0000F); + specularColor.set(0.4500F, 0.4500F, 0.4500F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.1300F; + transparency = 0.0000F; break; case NEON_GNC: - ambientColor.set(0.2000f, 0.2000f, 0.2000f); - diffuseColor.set(0.0000f, 0.0000f, 0.0000f); - specularColor.set(0.6200f, 0.6200f, 0.6200f); - emissiveColor.set(1.0000f, 1.0000f, 0.0000f); - shininess = 0.0500f; - transparency = 0.0000f; + ambientColor.set(0.2000F, 0.2000F, 0.2000F); + diffuseColor.set(0.0000F, 0.0000F, 0.0000F); + specularColor.set(0.6200F, 0.6200F, 0.6200F); + emissiveColor.set(1.0000F, 1.0000F, 0.0000F); + shininess = 0.0500F; + transparency = 0.0000F; break; case CHROME: - ambientColor.set(0.3500f, 0.3500f, 0.3500f); - diffuseColor.set(0.9176f, 0.9176f, 0.9176f); - specularColor.set(0.9746f, 0.9746f, 0.9746f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.1000f; - transparency = 0.0000f; + ambientColor.set(0.3500F, 0.3500F, 0.3500F); + diffuseColor.set(0.9176F, 0.9176F, 0.9176F); + specularColor.set(0.9746F, 0.9746F, 0.9746F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.1000F; + transparency = 0.0000F; break; case ALUMINIUM: - ambientColor.set(0.3000f, 0.3000f, 0.3000f); - diffuseColor.set(0.3000f, 0.3000f, 0.3000f); - specularColor.set(0.7000f, 0.7000f, 0.8000f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.0900f; - transparency = 0.0000f; + ambientColor.set(0.3000F, 0.3000F, 0.3000F); + diffuseColor.set(0.3000F, 0.3000F, 0.3000F); + specularColor.set(0.7000F, 0.7000F, 0.8000F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.0900F; + transparency = 0.0000F; break; case OBSIDIAN: - ambientColor.set(0.0538f, 0.0500f, 0.0662f); - diffuseColor.set(0.1828f, 0.1700f, 0.2253f); - specularColor.set(0.3327f, 0.3286f, 0.3464f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.3000f; - transparency = 0.0000f; + ambientColor.set(0.0538F, 0.0500F, 0.0662F); + diffuseColor.set(0.1828F, 0.1700F, 0.2253F); + specularColor.set(0.3327F, 0.3286F, 0.3464F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.3000F; + transparency = 0.0000F; break; case NEON_PHC: - ambientColor.set(1.0000f, 1.0000f, 1.0000f); - diffuseColor.set(1.0000f, 1.0000f, 1.0000f); - specularColor.set(0.6200f, 0.6200f, 0.6200f); - emissiveColor.set(0.0000f, 0.9000f, 0.4140f); - shininess = 0.0500f; - transparency = 0.0000f; + ambientColor.set(1.0000F, 1.0000F, 1.0000F); + diffuseColor.set(1.0000F, 1.0000F, 1.0000F); + specularColor.set(0.6200F, 0.6200F, 0.6200F); + emissiveColor.set(0.0000F, 0.9000F, 0.4140F); + shininess = 0.0500F; + transparency = 0.0000F; break; case JADE: - ambientColor.set(0.1350f, 0.2225f, 0.1575f); - diffuseColor.set(0.5400f, 0.8900f, 0.6300f); - specularColor.set(0.3162f, 0.3162f, 0.3162f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.1000f; - transparency = 0.0000f; + ambientColor.set(0.1350F, 0.2225F, 0.1575F); + diffuseColor.set(0.5400F, 0.8900F, 0.6300F); + specularColor.set(0.3162F, 0.3162F, 0.3162F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.1000F; + transparency = 0.0000F; break; case RUBY: - ambientColor.set(0.1745f, 0.0118f, 0.0118f); - diffuseColor.set(0.6142f, 0.0414f, 0.0414f); - specularColor.set(0.7278f, 0.6279f, 0.6267f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.6000f; - transparency = 0.0000f; + ambientColor.set(0.1745F, 0.0118F, 0.0118F); + diffuseColor.set(0.6142F, 0.0414F, 0.0414F); + specularColor.set(0.7278F, 0.6279F, 0.6267F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.6000F; + transparency = 0.0000F; break; case EMERALD: - ambientColor.set(0.0215f, 0.1745f, 0.0215f); - diffuseColor.set(0.0757f, 0.6142f, 0.0757f); - specularColor.set(0.6330f, 0.7278f, 0.6330f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.6000f; - transparency = 0.0000f; + ambientColor.set(0.0215F, 0.1745F, 0.0215F); + diffuseColor.set(0.0757F, 0.6142F, 0.0757F); + specularColor.set(0.6330F, 0.7278F, 0.6330F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.6000F; + transparency = 0.0000F; break; case USER_DEFINED: break; default: - ambientColor.set(0.3333f, 0.3333f, 0.3333f); - diffuseColor.set(0.8000f, 0.8000f, 0.9000f); - specularColor.set(0.5333f, 0.5333f, 0.5333f); - emissiveColor.set(0.0000f, 0.0000f, 0.0000f); - shininess = 0.9000f; - transparency = 0.0000f; + ambientColor.set(0.3333F, 0.3333F, 0.3333F); + diffuseColor.set(0.8000F, 0.8000F, 0.9000F); + specularColor.set(0.5333F, 0.5333F, 0.5333F); + emissiveColor.set(0.0000F, 0.0000F, 0.0000F); + shininess = 0.9000F; + transparency = 0.0000F; break; } } +// NOLINTEND(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) diff --git a/src/App/Material.h b/src/App/Material.h index 02e32f5490..ba22b510e5 100644 --- a/src/App/Material.h +++ b/src/App/Material.h @@ -67,15 +67,17 @@ public: //@{ /** Sets the USER_DEFINED material type. The user must set the colors afterwards. */ Material(); + ~Material() = default; /** Copy constructor. */ - Material(const Material& other); + Material(const Material& other) = default; + Material(Material&& other) = default; /** Defines the colors and shininess for the material \a MatName. If \a MatName isn't defined * then USER_DEFINED is set and the user must define the colors itself. */ explicit Material(const char* MatName); /** Does basically the same as the constructor above unless that it accepts a MaterialType as * argument. */ - explicit Material(const MaterialType MatType); + explicit Material(MaterialType MatType); //@} /** Set a material by name @@ -111,7 +113,7 @@ public: * This method is provided for convenience which does basically the same as the method above * unless that it accepts a MaterialType as argument. */ - void setType(const MaterialType MatType); + void setType(MaterialType MatType); /** * Returns the currently set material type. */ @@ -122,6 +124,7 @@ public: /** @name Properties */ //@{ + // NOLINTBEGIN Color ambientColor; /**< Defines the ambient color. */ Color diffuseColor; /**< Defines the diffuse color. */ Color specularColor; /**< Defines the specular color. */ @@ -129,20 +132,28 @@ public: float shininess; float transparency; std::string uuid; + // NOLINTEND //@} bool operator==(const Material& m) const { - return _matType == m._matType && shininess == m.shininess && transparency == m.transparency - && ambientColor == m.ambientColor && diffuseColor == m.diffuseColor - && specularColor == m.specularColor && emissiveColor == m.emissiveColor + // clang-format off + return _matType == m._matType + && shininess == m.shininess + && transparency == m.transparency + && ambientColor == m.ambientColor + && diffuseColor == m.diffuseColor + && specularColor == m.specularColor + && emissiveColor == m.emissiveColor && uuid == m.uuid; + // clang-format on } bool operator!=(const Material& m) const { return !operator==(m); } - Material& operator=(const Material& other); + Material& operator=(const Material& other) = default; + Material& operator=(Material&& other) = default; private: MaterialType _matType;