WIP output PNG image

This commit is contained in:
Stephen Seo 2021-08-25 11:57:54 +09:00
parent 5f42cf53b8
commit 507c699ac0
5 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,5 @@
--- ---
Checks: 'clang-diagnostic-*,clang-analyzer-*,*,-llvmlibc-*,-fuchsia-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-modernize-use-trailing-return-type,-llvm-header-guard,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-altera-struct-pack-align,-misc-non-private-member-variables-in-classes,-modernize-use-nodiscard,-cppcoreguidelines-pro-type-union-access,-llvm-else-after-return,-readability-else-after-return' Checks: 'clang-diagnostic-*,clang-analyzer-*,*,-llvmlibc-*,-fuchsia-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-modernize-use-trailing-return-type,-llvm-header-guard,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-altera-struct-pack-align,-misc-non-private-member-variables-in-classes,-modernize-use-nodiscard,-cppcoreguidelines-pro-type-union-access,-llvm-else-after-return,-readability-else-after-return,-cppcoreguidelines-owning-memory,-android-cloexec-fopen'
WarningsAsErrors: '' WarningsAsErrors: ''
HeaderFilterRegex: '' HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false AnalyzeTemporaryDtors: false
@ -8,12 +8,12 @@ User: stephen
CheckOptions: CheckOptions:
- key: cppcoreguidelines-no-malloc.Reallocations - key: cppcoreguidelines-no-malloc.Reallocations
value: '::realloc' value: '::realloc'
- key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
value: '::free;::realloc;::freopen;::fclose'
- key: modernize-use-auto.MinTypeNameLength - key: modernize-use-auto.MinTypeNameLength
value: '5' value: '5'
- key: bugprone-reserved-identifier.Invert - key: bugprone-reserved-identifier.Invert
value: 'false' value: 'false'
- key: modernize-replace-disallow-copy-and-assign-macro.MacroName
value: DISALLOW_COPY_AND_ASSIGN
- key: bugprone-narrowing-conversions.PedanticMode - key: bugprone-narrowing-conversions.PedanticMode
value: 'false' value: 'false'
- key: bugprone-unused-return-value.CheckedFunctions - key: bugprone-unused-return-value.CheckedFunctions
@ -30,8 +30,6 @@ CheckOptions:
value: 'false' value: 'false'
- key: cert-dcl37-c.AllowedIdentifiers - key: cert-dcl37-c.AllowedIdentifiers
value: '' value: ''
- key: modernize-replace-disallow-copy-and-assign-macro.MacroName
value: DISALLOW_COPY_AND_ASSIGN
- key: hicpp-use-emplace.SmartPointers - key: hicpp-use-emplace.SmartPointers
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
- key: hicpp-member-init.IgnoreArrays - key: hicpp-member-init.IgnoreArrays
@ -316,8 +314,6 @@ CheckOptions:
value: 'false' value: 'false'
- key: modernize-use-emplace.TupleMakeFunctions - key: modernize-use-emplace.TupleMakeFunctions
value: '::std::make_pair;::std::make_tuple' value: '::std::make_pair;::std::make_tuple'
- key: cppcoreguidelines-owning-memory.LegacyResourceProducers
value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
- key: hicpp-uppercase-literal-suffix.IgnoreMacros - key: hicpp-uppercase-literal-suffix.IgnoreMacros
value: 'true' value: 'true'
- key: bugprone-argument-comment.StrictMode - key: bugprone-argument-comment.StrictMode
@ -334,12 +330,12 @@ CheckOptions:
value: '' value: ''
- key: modernize-avoid-bind.PermissiveParameterList - key: modernize-avoid-bind.PermissiveParameterList
value: 'false' value: 'false'
- key: hicpp-use-override.OverrideSpelling
value: override
- key: modernize-use-override.FinalSpelling - key: modernize-use-override.FinalSpelling
value: final value: final
- key: cert-err09-cpp.MaxSize - key: cert-err09-cpp.MaxSize
value: '-1' value: '-1'
- key: hicpp-use-override.OverrideSpelling
value: override
- key: hicpp-use-equals-default.IgnoreMacros - key: hicpp-use-equals-default.IgnoreMacros
value: 'true' value: 'true'
- key: modernize-use-noexcept.ReplacementString - key: modernize-use-noexcept.ReplacementString

View file

@ -40,6 +40,10 @@ else()
endif() endif()
target_include_directories(Example02 PUBLIC ${GLM_INCLUDE_DIRS}) target_include_directories(Example02 PUBLIC ${GLM_INCLUDE_DIRS})
find_package(PNG REQUIRED)
target_include_directories(Example02 PUBLIC ${PNG_INCLUDE_DIRS})
target_link_libraries(Example02 PUBLIC ${PNG_LIBRARIES})
find_program(CLANG_FORMAT "clang-format") find_program(CLANG_FORMAT "clang-format")
if(CLANG_FORMAT) if(CLANG_FORMAT)
add_custom_target( add_custom_target(

View file

@ -2,4 +2,4 @@
set -ev set -ev
clang-tidy src/main.cpp -checks=*,-llvmlibc-*,-fuchsia-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-modernize-use-trailing-return-type,-llvm-header-guard,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-altera-struct-pack-align,-misc-non-private-member-variables-in-classes,-modernize-use-nodiscard,-cppcoreguidelines-pro-type-union-access,-llvm-else-after-return,-readability-else-after-return -dump-config -- -std=c++17 > .clang-tidy clang-tidy src/main.cpp -checks=*,-llvmlibc-*,-fuchsia-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-modernize-use-trailing-return-type,-llvm-header-guard,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-altera-struct-pack-align,-misc-non-private-member-variables-in-classes,-modernize-use-nodiscard,-cppcoreguidelines-pro-type-union-access,-llvm-else-after-return,-readability-else-after-return,-cppcoreguidelines-owning-memory,-android-cloexec-fopen -dump-config -- -std=c++17 > .clang-tidy

View file

@ -2,6 +2,7 @@
#include <array> #include <array>
#include <cmath> #include <cmath>
#include <cstdio>
#include <fstream> #include <fstream>
#include <thread> #include <thread>
@ -9,6 +10,8 @@
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/matrix.hpp> #include <glm/matrix.hpp>
#include <png.h>
const float PI = std::acos(-1.0F); const float PI = std::acos(-1.0F);
Ex02::RT::Pixel::Pixel() : r(0), g(0), b(0) {} Ex02::RT::Pixel::Pixel() : r(0), g(0), b(0) {}

View file

@ -31,7 +31,7 @@ public:
Pixel &getPixel(unsigned int x, unsigned int y); Pixel &getPixel(unsigned int x, unsigned int y);
const Pixel &getPixel(unsigned int x, unsigned int y) const; const Pixel &getPixel(unsigned int x, unsigned int y) const;
// returns actual output filename // returns actual output filename (it appends the file extension)
std::string writeToFile(const std::string &filename) const; std::string writeToFile(const std::string &filename) const;
private: private: