New logging system
This commit is contained in:
429
.clang-tidy
429
.clang-tidy
@@ -1,45 +1,414 @@
|
||||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*'
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,cppcoreguidelines-*,modernize-*,performance-*,portability-*,readability-*'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
HeaderFilterRegex: '.*'
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: none
|
||||
FormatStyle: file
|
||||
User: derek
|
||||
CheckOptions:
|
||||
- key: llvm-else-after-return.WarnOnConditionVariables
|
||||
- key: cppcoreguidelines-no-malloc.Reallocations
|
||||
value: '::realloc'
|
||||
- key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
|
||||
value: '::free;::realloc;::freopen;::fclose'
|
||||
- key: bugprone-reserved-identifier.Invert
|
||||
value: 'false'
|
||||
- key: modernize-use-auto.MinTypeNameLength
|
||||
value: '5'
|
||||
- key: bugprone-unused-return-value.CheckedFunctions
|
||||
value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty;::std::back_inserter;::std::distance;::std::find;::std::find_if;::std::inserter;::std::lower_bound;::std::make_pair;::std::map::count;::std::map::find;::std::map::lower_bound;::std::multimap::equal_range;::std::multimap::upper_bound;::std::set::count;::std::set::find;::std::setfill;::std::setprecision;::std::setw;::std::upper_bound;::std::vector::at;::bsearch;::ferror;::feof;::isalnum;::isalpha;::isblank;::iscntrl;::isdigit;::isgraph;::islower;::isprint;::ispunct;::isspace;::isupper;::iswalnum;::iswprint;::iswspace;::isxdigit;::memchr;::memcmp;::strcmp;::strcoll;::strncmp;::strpbrk;::strrchr;::strspn;::strstr;::wcscmp;::access;::bind;::connect;::difftime;::dlsym;::fnmatch;::getaddrinfo;::getopt;::htonl;::htons;::iconv_open;::inet_addr;::isascii;::isatty;::mmap;::newlocale;::openat;::pathconf;::pthread_equal;::pthread_getspecific;::pthread_mutex_trylock;::readdir;::readlink;::recvmsg;::regexec;::scandir;::semget;::setjmp;::shm_open;::shmget;::sigismember;::strcasecmp;::strsignal;::ttyname'
|
||||
- key: bugprone-narrowing-conversions.PedanticMode
|
||||
value: 'false'
|
||||
- key: cert-dcl51-cpp.AggressiveDependentMemberLookup
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-macro-usage.CheckCapsOnly
|
||||
value: 'false'
|
||||
- key: readability-inconsistent-declaration-parameter-name.Strict
|
||||
value: 'false'
|
||||
- key: cert-dcl37-c.AllowedIdentifiers
|
||||
value: ''
|
||||
- key: cert-err09-cpp.WarnOnLargeObjects
|
||||
value: 'false'
|
||||
- key: bugprone-suspicious-string-compare.WarnOnImplicitComparison
|
||||
value: 'true'
|
||||
- key: bugprone-argument-comment.CommentNullPtrs
|
||||
value: '0'
|
||||
- key: modernize-loop-convert.MinConfidence
|
||||
value: reasonable
|
||||
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||
- key: cppcoreguidelines-narrowing-conversions.WarnOnFloatingPointNarrowingConversion
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-init-variables.IncludeStyle
|
||||
value: llvm
|
||||
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons
|
||||
value: '0'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: modernize-use-nodiscard.ReplacementString
|
||||
value: '[[nodiscard]]'
|
||||
- key: modernize-loop-convert.MakeReverseRangeHeader
|
||||
value: ''
|
||||
- key: performance-move-constructor-init.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-loop-convert.UseCxx20ReverseRanges
|
||||
value: 'true'
|
||||
- key: cert-oop57-cpp.MemSetNames
|
||||
value: ''
|
||||
- key: performance-type-promotion-in-math-fn.IncludeStyle
|
||||
value: llvm
|
||||
- key: bugprone-suspicious-include.ImplementationFileExtensions
|
||||
value: 'c;cc;cpp;cxx'
|
||||
- key: modernize-loop-convert.MakeReverseRangeFunction
|
||||
value: ''
|
||||
- key: readability-inconsistent-declaration-parameter-name.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: bugprone-suspicious-missing-comma.SizeThreshold
|
||||
value: '5'
|
||||
- key: readability-identifier-naming.IgnoreFailedSplit
|
||||
value: 'false'
|
||||
- key: readability-qualified-auto.AddConstToQualified
|
||||
value: 'true'
|
||||
- key: bugprone-sizeof-expression.WarnOnSizeOfThis
|
||||
value: 'true'
|
||||
- key: bugprone-string-constructor.WarnOnLargeLength
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.OverrideSpelling
|
||||
value: override
|
||||
- key: readability-uppercase-literal-suffix.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: cert-dcl59-cpp.HeaderFileExtensions
|
||||
value: ';h;hh;hpp;hxx'
|
||||
- key: bugprone-dynamic-static-initializers.HeaderFileExtensions
|
||||
value: ';h;hh;hpp;hxx'
|
||||
- key: bugprone-suspicious-enum-usage.StrictMode
|
||||
value: 'false'
|
||||
- key: performance-unnecessary-copy-initialization.AllowedTypes
|
||||
value: ''
|
||||
- key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens
|
||||
value: '5'
|
||||
- key: modernize-use-transparent-functors.SafeMode
|
||||
value: 'false'
|
||||
- key: modernize-make-shared.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: bugprone-not-null-terminated-result.WantToUseSafeFunctions
|
||||
value: 'true'
|
||||
- key: bugprone-string-constructor.LargeLengthThreshold
|
||||
value: '8388608'
|
||||
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-avoid-magic-numbers.IgnoreAllFloatingPointValues
|
||||
value: 'false'
|
||||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||
value: 'false'
|
||||
- key: cert-err09-cpp.CheckThrowTemporaries
|
||||
value: 'true'
|
||||
- key: bugprone-argument-comment.CommentStringLiterals
|
||||
value: '0'
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
value: '1'
|
||||
- key: cert-dcl16-c.NewSuffixes
|
||||
value: 'L;LL;LU;LLU'
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: modernize-pass-by-value.IncludeStyle
|
||||
value: llvm
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
- key: performance-inefficient-vector-operation.EnableProto
|
||||
value: 'false'
|
||||
- key: modernize-loop-convert.MaxCopySize
|
||||
value: '16'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||
- key: bugprone-exception-escape.FunctionsThatShouldNotThrow
|
||||
value: ''
|
||||
- key: portability-simd-intrinsics.Suggest
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
|
||||
value: ''
|
||||
- key: readability-function-size.LineThreshold
|
||||
value: '4294967295'
|
||||
- key: modernize-make-shared.MakeSmartPtrFunctionHeader
|
||||
value: '<memory>'
|
||||
- key: modernize-make-shared.MakeSmartPtrFunction
|
||||
value: 'std::make_shared'
|
||||
- key: modernize-use-override.IgnoreDestructors
|
||||
value: 'false'
|
||||
- key: bugprone-sizeof-expression.WarnOnSizeOfConstant
|
||||
value: 'true'
|
||||
- key: readability-redundant-string-init.StringNames
|
||||
value: '::std::basic_string_view;::std::basic_string'
|
||||
- key: modernize-make-unique.IgnoreDefaultInitialization
|
||||
value: 'true'
|
||||
- key: modernize-use-emplace.ContainersWithPushBack
|
||||
value: '::std::vector;::std::list;::std::deque'
|
||||
- key: readability-magic-numbers.IgnoreBitFieldsWidths
|
||||
value: 'true'
|
||||
- key: modernize-make-unique.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-use-override.OverrideSpelling
|
||||
value: override
|
||||
- key: concurrency-mt-unsafe.FunctionSet
|
||||
value: any
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: modernize-use-nullptr.NullMacros
|
||||
value: 'NULL'
|
||||
- key: llvm-qualified-auto.AddConstToQualified
|
||||
value: '0'
|
||||
- key: modernize-loop-convert.NamingStyle
|
||||
value: CamelCase
|
||||
- key: llvm-else-after-return.WarnOnUnfixable
|
||||
value: '0'
|
||||
- key: bugprone-reserved-identifier.AllowedIdentifiers
|
||||
value: ''
|
||||
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
|
||||
value: 'false'
|
||||
- key: readability-else-after-return.WarnOnUnfixable
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-avoid-magic-numbers.IgnoredFloatingPointValues
|
||||
value: '1.0;100.0;'
|
||||
- key: modernize-use-emplace.IgnoreImplicitConstructors
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-macro-usage.IgnoreCommandLineMacros
|
||||
value: 'true'
|
||||
- key: modernize-use-equals-delete.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
|
||||
value: llvm
|
||||
- key: readability-magic-numbers.IgnoreAllFloatingPointValues
|
||||
value: 'false'
|
||||
- key: bugprone-misplaced-widening-cast.CheckImplicitCasts
|
||||
value: 'false'
|
||||
- key: readability-uppercase-literal-suffix.NewSuffixes
|
||||
value: ''
|
||||
- key: modernize-loop-convert.MinConfidence
|
||||
value: reasonable
|
||||
- key: cppcoreguidelines-avoid-magic-numbers.IgnorePowersOf2IntegerValues
|
||||
value: 'false'
|
||||
- key: bugprone-suspicious-missing-comma.RatioThreshold
|
||||
value: '0.200000'
|
||||
- key: performance-unnecessary-value-param.AllowedTypes
|
||||
value: ''
|
||||
- key: cppcoreguidelines-avoid-magic-numbers.IgnoredIntegerValues
|
||||
value: '1;2;3;4;'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
- key: cppcoreguidelines-avoid-magic-numbers.IgnoreBitFieldsWidths
|
||||
value: 'true'
|
||||
- key: cert-err61-cpp.CheckThrowTemporaries
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-no-malloc.Allocations
|
||||
value: '::malloc;::calloc'
|
||||
- key: readability-function-size.BranchThreshold
|
||||
value: '4294967295'
|
||||
- key: readability-implicit-bool-conversion.AllowIntegerConditions
|
||||
value: 'false'
|
||||
- key: readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: readability-identifier-naming.IgnoreMainLikeFunctions
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-init-variables.MathHeader
|
||||
value: '<math.h>'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: cert-msc51-cpp.DisallowedSeedTypes
|
||||
value: 'time_t,std::time_t'
|
||||
- key: bugprone-reserved-identifier.AggressiveDependentMemberLookup
|
||||
value: 'false'
|
||||
- key: modernize-use-equals-default.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
|
||||
value: 'false'
|
||||
- key: cert-dcl37-c.AggressiveDependentMemberLookup
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-no-malloc.Deallocations
|
||||
value: '::free'
|
||||
- key: modernize-use-emplace.SmartPointers
|
||||
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
|
||||
- key: bugprone-dangling-handle.HandleClasses
|
||||
value: 'std::basic_string_view;std::experimental::basic_string_view'
|
||||
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues
|
||||
value: 'false'
|
||||
- key: cert-oop11-cpp.IncludeStyle
|
||||
value: llvm
|
||||
- key: readability-simplify-subscript-expr.Types
|
||||
value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array'
|
||||
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||
value: llvm
|
||||
- key: performance-move-const-arg.CheckTriviallyCopyableMove
|
||||
value: 'true'
|
||||
- key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold
|
||||
value: '3'
|
||||
- key: readability-function-size.VariableThreshold
|
||||
value: '4294967295'
|
||||
- key: cert-dcl16-c.NewSuffixes
|
||||
value: 'L;LL;LU;LLU'
|
||||
- key: bugprone-narrowing-conversions.WarnOnFloatingPointNarrowingConversion
|
||||
value: 'true'
|
||||
- key: readability-identifier-naming.GetConfigPerFile
|
||||
value: 'true'
|
||||
- key: cert-err61-cpp.MaxSize
|
||||
value: '-1'
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: 'false'
|
||||
- key: readability-function-size.NestingThreshold
|
||||
value: '4294967295'
|
||||
- key: modernize-use-override.AllowOverrideAndFinal
|
||||
value: 'false'
|
||||
- key: readability-function-size.ParameterThreshold
|
||||
value: '4294967295'
|
||||
- key: modernize-pass-by-value.ValuesOnly
|
||||
value: 'false'
|
||||
- key: modernize-loop-convert.IncludeStyle
|
||||
value: llvm
|
||||
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons
|
||||
value: 'false'
|
||||
- key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.AllowOverrideAndFinal
|
||||
value: 'false'
|
||||
- key: readability-redundant-smartptr-get.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: readability-identifier-naming.AggressiveDependentMemberLookup
|
||||
value: 'false'
|
||||
- key: cert-err61-cpp.WarnOnLargeObjects
|
||||
value: 'false'
|
||||
- key: modernize-use-emplace.TupleTypes
|
||||
value: '::std::pair;::std::tuple'
|
||||
- key: modernize-use-emplace.TupleMakeFunctions
|
||||
value: '::std::make_pair;::std::make_tuple'
|
||||
- key: cppcoreguidelines-owning-memory.LegacyResourceProducers
|
||||
value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
|
||||
- key: bugprone-argument-comment.StrictMode
|
||||
value: '0'
|
||||
- key: modernize-replace-random-shuffle.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-use-bool-literals.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: bugprone-unhandled-self-assignment.WarnOnlyIfThisHasSuspiciousField
|
||||
value: 'true'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: bugprone-suspicious-string-compare.StringCompareLikeFunctions
|
||||
value: ''
|
||||
- key: modernize-avoid-bind.PermissiveParameterList
|
||||
value: 'false'
|
||||
- key: modernize-use-override.FinalSpelling
|
||||
value: final
|
||||
- key: cert-err09-cpp.MaxSize
|
||||
value: '-1'
|
||||
- key: modernize-use-noexcept.ReplacementString
|
||||
value: ''
|
||||
- key: modernize-use-using.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.FinalSpelling
|
||||
value: final
|
||||
- key: modernize-loop-convert.NamingStyle
|
||||
value: CamelCase
|
||||
- key: cppcoreguidelines-pro-type-member-init.UseAssignment
|
||||
value: 'false'
|
||||
- key: bugprone-suspicious-include.HeaderFileExtensions
|
||||
value: ';h;hh;hpp;hxx'
|
||||
- key: performance-no-automatic-move.AllowedTypes
|
||||
value: ''
|
||||
- key: performance-for-range-copy.WarnOnAllAutoCopies
|
||||
value: 'false'
|
||||
- key: bugprone-argument-comment.CommentIntegerLiterals
|
||||
value: '0'
|
||||
- key: bugprone-argument-comment.CommentCharacterLiterals
|
||||
value: '0'
|
||||
- key: modernize-pass-by-value.IncludeStyle
|
||||
value: llvm
|
||||
- key: bugprone-argument-comment.CommentFloatLiterals
|
||||
value: '0'
|
||||
- key: bugprone-too-small-loop-variable.MagnitudeBitsUpperLimit
|
||||
value: '16'
|
||||
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
|
||||
value: 'false'
|
||||
- key: readability-else-after-return.WarnOnConditionVariables
|
||||
value: 'true'
|
||||
- key: modernize-use-nullptr.NullMacros
|
||||
value: 'NULL'
|
||||
- key: cppcoreguidelines-macro-usage.AllowedRegexp
|
||||
value: '^DEBUG_*'
|
||||
- key: cppcoreguidelines-narrowing-conversions.PedanticMode
|
||||
value: 'false'
|
||||
- key: modernize-make-shared.IgnoreDefaultInitialization
|
||||
value: 'true'
|
||||
- key: modernize-make-shared.IncludeStyle
|
||||
value: llvm
|
||||
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
|
||||
value: 'false'
|
||||
- key: bugprone-signed-char-misuse.CharTypdefsToIgnore
|
||||
value: ''
|
||||
- key: cert-dcl51-cpp.Invert
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||
value: 'true'
|
||||
- key: modernize-make-unique.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: performance-for-range-copy.AllowedTypes
|
||||
value: ''
|
||||
- key: bugprone-argument-comment.CommentBoolLiterals
|
||||
value: '0'
|
||||
- key: readability-braces-around-statements.ShortStatementLines
|
||||
value: '0'
|
||||
- key: bugprone-argument-comment.CommentUserDefinedLiterals
|
||||
value: '0'
|
||||
- key: readability-magic-numbers.IgnoredFloatingPointValues
|
||||
value: '1.0;100.0;'
|
||||
- key: performance-inefficient-string-concatenation.StrictMode
|
||||
value: 'false'
|
||||
- key: readability-implicit-bool-conversion.AllowPointerConditions
|
||||
value: 'false'
|
||||
- key: readability-redundant-declaration.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: modernize-make-unique.MakeSmartPtrFunction
|
||||
value: 'std::make_unique'
|
||||
- key: portability-restrict-system-includes.Includes
|
||||
value: '*'
|
||||
- key: cert-dcl51-cpp.AllowedIdentifiers
|
||||
value: ''
|
||||
- key: cert-oop57-cpp.MemCpyNames
|
||||
value: ''
|
||||
- key: modernize-make-unique.MakeSmartPtrFunctionHeader
|
||||
value: '<memory>'
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnorePublicMemberVariables
|
||||
value: 'false'
|
||||
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctionsWhenCopyIsDeleted
|
||||
value: 'false'
|
||||
- key: cert-oop57-cpp.MemCmpNames
|
||||
value: ''
|
||||
- key: modernize-use-noexcept.UseNoexceptFalse
|
||||
value: 'true'
|
||||
- key: readability-function-cognitive-complexity.Threshold
|
||||
value: '25'
|
||||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||
value: 'true'
|
||||
- key: bugprone-argument-comment.IgnoreSingleArgument
|
||||
value: '0'
|
||||
- key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression
|
||||
value: 'false'
|
||||
- key: performance-faster-string-find.StringLikeClasses
|
||||
value: '::std::basic_string;::std::basic_string_view'
|
||||
- key: bugprone-assert-side-effect.CheckFunctionCalls
|
||||
value: 'false'
|
||||
- key: bugprone-string-constructor.StringNames
|
||||
value: '::std::basic_string;::std::basic_string_view'
|
||||
- key: bugprone-assert-side-effect.AssertMacros
|
||||
value: assert
|
||||
- key: bugprone-exception-escape.IgnoredExceptions
|
||||
value: ''
|
||||
- key: bugprone-signed-char-misuse.DiagnoseSignedUnsignedCharComparisons
|
||||
value: 'true'
|
||||
- key: modernize-use-default-member-init.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: llvm-qualified-auto.AddConstToQualified
|
||||
value: '0'
|
||||
- key: cert-str34-c.CharTypdefsToIgnore
|
||||
value: ''
|
||||
- key: llvm-else-after-return.WarnOnConditionVariables
|
||||
value: '0'
|
||||
- key: bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant
|
||||
value: 'true'
|
||||
- key: modernize-raw-string-literal.DelimiterStem
|
||||
value: lit
|
||||
- key: cert-dcl37-c.Invert
|
||||
value: 'false'
|
||||
- key: modernize-raw-string-literal.ReplaceShorterLiterals
|
||||
value: 'false'
|
||||
- key: readability-magic-numbers.IgnoredIntegerValues
|
||||
value: '1;2;3;4;'
|
||||
- key: modernize-use-auto.RemoveStars
|
||||
value: 'false'
|
||||
- key: performance-inefficient-vector-operation.VectorLikeClasses
|
||||
value: '::std::vector'
|
||||
- key: portability-simd-intrinsics.Std
|
||||
value: ''
|
||||
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
|
||||
value: 'false'
|
||||
- key: performance-unnecessary-value-param.IncludeStyle
|
||||
value: llvm
|
||||
- key: cert-dcl16-c.IgnoreMacros
|
||||
value: 'true'
|
||||
- key: modernize-replace-disallow-copy-and-assign-macro.MacroName
|
||||
value: DISALLOW_COPY_AND_ASSIGN
|
||||
- key: llvm-else-after-return.WarnOnUnfixable
|
||||
value: '0'
|
||||
- key: cert-msc32-c.DisallowedSeedTypes
|
||||
value: 'time_t,std::time_t'
|
||||
...
|
||||
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
||||
[submodule "data/res"]
|
||||
path = data/res
|
||||
url = git@gitlab.com:4VRDriver/fall-fever-resources.git
|
||||
[submodule "lib/spdlog"]
|
||||
path = lib/spdlog
|
||||
url = git@github.com:gabime/spdlog.git
|
||||
|
||||
@@ -18,7 +18,7 @@ find_package(OpenGL REQUIRED)
|
||||
#find_package(Freetype REQUIRED) Will be used in the future
|
||||
|
||||
# Specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
|
||||
@@ -5,6 +5,11 @@ Collapsed=0
|
||||
|
||||
[Window][Debug Utils]
|
||||
Pos=9,24
|
||||
Size=689,372
|
||||
Size=598,357
|
||||
Collapsed=0
|
||||
|
||||
[Window][Entities]
|
||||
Pos=1062,24
|
||||
Size=225,279
|
||||
Collapsed=0
|
||||
|
||||
|
||||
1
lib/CMakeLists.txt
vendored
1
lib/CMakeLists.txt
vendored
@@ -3,3 +3,4 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stb)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glm)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/imgui)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spdlog)
|
||||
|
||||
1
lib/spdlog
vendored
Submodule
1
lib/spdlog
vendored
Submodule
Submodule lib/spdlog added at 8826011c81
@@ -6,6 +6,7 @@ add_executable(Fall-Fever
|
||||
ShaderProgram.cpp
|
||||
VertexArray.cpp
|
||||
Texture.cpp
|
||||
TextureFactory.cpp
|
||||
Camera.cpp
|
||||
Mesh.cpp
|
||||
Model.cpp
|
||||
@@ -22,6 +23,7 @@ add_executable(Fall-Fever
|
||||
imgui/GeneralInfoWindow.cpp
|
||||
imgui/Handler.cpp
|
||||
imgui/Window.cpp
|
||||
util/Log.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
@@ -35,6 +37,7 @@ target_link_libraries(
|
||||
${FREETYPE_LIBRARIES}
|
||||
imgui
|
||||
pthread
|
||||
spdlog
|
||||
)
|
||||
|
||||
target_compile_options(Fall-Fever PRIVATE -Wall -Wextra -pedantic)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/glad.h>
|
||||
@@ -30,6 +29,7 @@
|
||||
#include "VertexArray.h"
|
||||
#include "Widget.h"
|
||||
#include "Window.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
Controller::Controller() : m_gameWindow(std::unique_ptr<Window>(new Window))
|
||||
{
|
||||
@@ -42,7 +42,7 @@ Controller::Controller() : m_gameWindow(std::unique_ptr<Window>(new Window))
|
||||
|
||||
for (auto &prototype : shaderProgramPrototypes) {
|
||||
m_shaderPrograms.push_back(new ShaderProgram(prototype));
|
||||
std::cout << "Loaded ShaderProgram \"" << prototype.name << "\"" << std::endl;
|
||||
Log::logger().info("Loaded shaderprogram \"{}\"", prototype.name);
|
||||
}
|
||||
|
||||
m_postProcessFrameBuffer = new FrameBuffer(m_gameWindow->getWindowWidth(), m_gameWindow->getWindowHeight(),
|
||||
@@ -105,8 +105,8 @@ void Controller::run()
|
||||
&lightColor, &m_exposure, &intensity);
|
||||
m_imguiHandler->addImguiWindow(generalWindow);
|
||||
|
||||
std::shared_ptr<Imgui::Window> entityWindow = std::make_shared<Imgui::EntityWindow>(m_scene->getEntities());
|
||||
m_imguiHandler->addImguiWindow(entityWindow);
|
||||
// std::shared_ptr<Imgui::Window> entityWindow = std::make_shared<Imgui::EntityWindow>(m_scene->getEntities());
|
||||
// m_imguiHandler->addImguiWindow(entityWindow);
|
||||
#endif
|
||||
|
||||
// This is the game loop
|
||||
@@ -236,8 +236,7 @@ ShaderProgram *Controller::getShaderProgramByName(const std::string &name, std::
|
||||
return program;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "[Warning] ShaderProgram could not be found by name \"" << name << "\"" << std::endl;
|
||||
Log::logger().critical("Shaderprogram could not be found by name \"{}\"", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,10 @@ ModelEntity::ModelEntity(Prototype prototype, Model *model, ShaderProgram *shade
|
||||
|
||||
void ModelEntity::draw(glm::mat4 viewProjMatrix, glm::vec3 viewPosition)
|
||||
{
|
||||
for (auto &child : m_children)
|
||||
if (auto childModel = dynamic_cast<ModelEntity *>(child))
|
||||
childModel->draw(viewProjMatrix, viewPosition);
|
||||
|
||||
m_shaderProgram->bind();
|
||||
|
||||
glm::mat4 modelViewProj = viewProjMatrix * m_modelMatrix;
|
||||
@@ -155,6 +159,10 @@ void ModelEntity::draw(glm::mat4 viewProjMatrix, glm::vec3 viewPosition)
|
||||
|
||||
void ModelEntity::drawDirectionalShadows(glm::mat4 viewProjMatrix, ShaderProgram *shaderProgram)
|
||||
{
|
||||
for (auto &child : m_children)
|
||||
if (auto childModel = dynamic_cast<ModelEntity *>(child))
|
||||
childModel->drawDirectionalShadows(viewProjMatrix, shaderProgram);
|
||||
|
||||
shaderProgram->bind();
|
||||
|
||||
glm::mat4 modelViewProj = viewProjMatrix * m_modelMatrix;
|
||||
@@ -168,6 +176,10 @@ void ModelEntity::drawDirectionalShadows(glm::mat4 viewProjMatrix, ShaderProgram
|
||||
|
||||
void ModelEntity::drawPointShadows(ShaderProgram *shaderProgram)
|
||||
{
|
||||
for (auto &child : m_children)
|
||||
if (auto childModel = dynamic_cast<ModelEntity *>(child))
|
||||
childModel->drawPointShadows(shaderProgram);
|
||||
|
||||
shaderProgram->bind();
|
||||
|
||||
shaderProgram->setUniform("u_modelMatrix", m_modelMatrix);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "EventHandler.h"
|
||||
|
||||
#include "GLFW/glfw3.h"
|
||||
#include <iostream>
|
||||
|
||||
CameraActionMap EventHandler::s_cameraActionMap = {{CameraAction::Forward, false}, {CameraAction::Backward, false},
|
||||
{CameraAction::Up, false}, {CameraAction::Down, false},
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include "FrameBuffer.h"
|
||||
|
||||
#include "ShaderProgram.h"
|
||||
#include "Texture.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
|
||||
AbstractFrameBuffer::~AbstractFrameBuffer()
|
||||
{}
|
||||
@@ -99,7 +98,7 @@ void FrameBuffer::generateTextures(uint32_t width, uint32_t height)
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
std::cout << "[Error] FrameBuffer is not complete!" << std::endl;
|
||||
Log::logger().error("Framebuffer not complete");
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
unbind();
|
||||
@@ -135,7 +134,7 @@ DepthMap::DepthMap(int RESOLUTION)
|
||||
glReadBuffer(GL_NONE);
|
||||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
std::cout << "[Error] FrameBuffer is not complete!" << std::endl;
|
||||
Log::logger().error("Framebuffer not complete");
|
||||
|
||||
unbind();
|
||||
}
|
||||
@@ -163,7 +162,7 @@ DepthMapCube::DepthMapCube(int RESOLUTION)
|
||||
glReadBuffer(GL_NONE);
|
||||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
std::cout << "[Error] FrameBuffer is not complete!" << std::endl;
|
||||
Log::logger().error("Framebuffer not complete");
|
||||
|
||||
unbind();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Helper.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
@@ -122,13 +122,13 @@ void Helper::gl_debug_callback(GLenum source, GLenum type, GLuint id, GLenum sev
|
||||
}
|
||||
|
||||
if (severity == GL_DEBUG_SEVERITY_HIGH || severity == GL_DEBUG_SEVERITY_MEDIUM)
|
||||
std::cout << "[OpenGL Debug Message]" << std::endl
|
||||
<< "Message: " << _message << std::endl
|
||||
<< "Source: " << _source << std::endl
|
||||
<< "Type: " << _type << std::endl
|
||||
<< "ID: " << id << std::endl
|
||||
<< "Severity: " << _severity << std::endl
|
||||
<< std::endl;
|
||||
Log::logger().info("[OpenGL Debug Message]\n"
|
||||
"Message: {}\n"
|
||||
"Source: {}\n"
|
||||
"Type: {}\n"
|
||||
"ID: {}\n"
|
||||
"Severity: {}\n",
|
||||
_message, _source, _type, id, _severity);
|
||||
}
|
||||
|
||||
Helper::Timer::Timer(const std::string &name) : m_name(name)
|
||||
@@ -143,5 +143,5 @@ Helper::Timer::~Timer()
|
||||
m_duration = m_end - m_start;
|
||||
float ms = m_duration.count() * 1000.0f;
|
||||
|
||||
std::cout << "Timer " << m_name << " took " << ms << "ms!" << std::endl;
|
||||
Log::logger().info("Timer {} took {}", m_name, ms);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "JsonParser.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
JsonParser::JsonParser(const std::string &jsonFilepath)
|
||||
{
|
||||
std::ifstream file(jsonFilepath.c_str(), std::ifstream::binary);
|
||||
|
||||
if (!file) {
|
||||
std::cout << "Error reading file \"" << jsonFilepath << "\"." << std::endl;
|
||||
Log::logger().warn("Could not read json file \"{}\"", jsonFilepath);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ JsonParser::JsonParser(const std::string &jsonFilepath)
|
||||
bool parsingSuccessful = Json::parseFromStream(m_rbuilder, file, &m_root, &errs);
|
||||
file.close();
|
||||
if (!parsingSuccessful) {
|
||||
std::cout << "Failed to parse file\n" << errs << std::endl;
|
||||
Log::logger().warn("Could not parse json file \"{}\":{}", jsonFilepath, errs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include "Widget.h"
|
||||
#include "Window.h"
|
||||
#include "definitions/eventActions.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "util/Log.h"
|
||||
|
||||
Menu::Menu(FrameBuffer *p_framebuffer, ShaderProgram *p_shaderProgram)
|
||||
: m_frameBuffer(p_framebuffer), m_shaderProgram(p_shaderProgram)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#include "Mesh.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "Texture.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
|
||||
uint32_t Model::s_idCounter = 0;
|
||||
|
||||
@@ -59,7 +59,7 @@ void Model::loadModel(const std::string &pathToModel)
|
||||
std::ifstream input(pathToModel, std::ios::in | std::ios::binary);
|
||||
|
||||
if (!input.is_open()) {
|
||||
std::cerr << "Could not find model file " << pathToModel << std::endl;
|
||||
Log::logger().warn("Could not find model file {}", pathToModel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@ void Model::loadModel(const std::string &pathToModel)
|
||||
|
||||
for (unsigned int i = 0; i < numTextures; i++) {
|
||||
std::string texturePath = m_workingPath + '/' + textureSources[i].c_str();
|
||||
Texture::Prototype texturePrototype{texturePath, textureTypes[i]};
|
||||
|
||||
auto loadModel = [=, &mutex]() {
|
||||
Texture *currentTex = new Texture(texturePrototype.texturePath, texturePrototype.textureType);
|
||||
Texture *currentTex = new Texture({texturePath, textureTypes[i]});
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
m_textures.push_back(currentTex);
|
||||
@@ -114,7 +114,7 @@ void Model::loadModel(const std::string &pathToModel)
|
||||
}
|
||||
|
||||
if (!hasNormalMap) {
|
||||
Texture *currentTex = new Texture("data/res/models/tex/fallback_normal.png", TextureType::Normal);
|
||||
Texture *currentTex = new Texture({"data/res/models/tex/fallback_normal.png", TextureType::Normal});
|
||||
|
||||
m_textures.push_back(currentTex);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "Model.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "Texture.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
Scene::Scene(std::vector<ShaderProgram *> shaderPrograms)
|
||||
@@ -41,8 +41,7 @@ Scene::Scene(std::vector<ShaderProgram *> shaderPrograms)
|
||||
auto loadModel = [=, &mutex]() {
|
||||
Model *currentModel = new Model(prototype);
|
||||
|
||||
std::cout << "Loaded Model \"" << prototype.modelName << "\" from \"" << prototype.modelPath << "\""
|
||||
<< std::endl;
|
||||
Log::logger().info("Loaded model \"{}\": {}", prototype.modelName, prototype.modelPath);
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
m_models.push_back(currentModel);
|
||||
@@ -61,7 +60,7 @@ Scene::Scene(std::vector<ShaderProgram *> shaderPrograms)
|
||||
m_skybox = new Skybox(skyboxPrototype, getModelByName("cube"),
|
||||
Controller::getShaderProgramByName("skyboxProgram", shaderPrograms));
|
||||
|
||||
std::cout << "Loaded Skybox \"" << skyboxPrototype.texturePath << "\"" << std::endl;
|
||||
Log::logger().info("Loaded skybox: {}", skyboxPrototype.texturePath);
|
||||
});
|
||||
|
||||
std::vector<ModelEntity::Prototype> entityPrototypes = modelParser.getEntityPrototypes();
|
||||
@@ -74,8 +73,8 @@ Scene::Scene(std::vector<ShaderProgram *> shaderPrograms)
|
||||
if (!currentModel) {
|
||||
// Apply fallback model (first model in vector)
|
||||
currentModel = m_models[0];
|
||||
std::cout << "[Warning] Model could not be found by name \"" << prototype.modelName << "\""
|
||||
<< std::endl;
|
||||
|
||||
Log::logger().warn("Model could not be found by name \"{}\"", prototype.modelName);
|
||||
}
|
||||
|
||||
// Get shaderprogram
|
||||
@@ -88,8 +87,7 @@ Scene::Scene(std::vector<ShaderProgram *> shaderPrograms)
|
||||
|
||||
ModelEntity *currentEntity = new ModelEntity(prototype, currentModel, currentProgram);
|
||||
|
||||
std::cout << "Loaded Entity \"" << prototype.name << "\" with model \"" << prototype.modelName << "\""
|
||||
<< std::endl;
|
||||
Log::logger().info("Loaded entity \"{}\" with model \"{}\"", prototype.name, prototype.modelName);
|
||||
|
||||
if (!prototype.parent.empty()) {
|
||||
Entity *parent = getEntityByName(prototype.parent);
|
||||
@@ -97,9 +95,8 @@ Scene::Scene(std::vector<ShaderProgram *> shaderPrograms)
|
||||
parent->addChild(currentEntity);
|
||||
currentEntity->setParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
m_entities.push_back(currentEntity);
|
||||
} else
|
||||
m_entities.push_back(currentEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +153,7 @@ void Scene::addEntity(ModelEntity *entity)
|
||||
m_entities.push_back(entity);
|
||||
}
|
||||
|
||||
void Scene::removeEntityByName(std::string name)
|
||||
void Scene::removeEntityByName(const std::string &name)
|
||||
{
|
||||
for (auto it = m_entities.begin(); it != m_entities.end(); it++) {
|
||||
if ((*it)->getUniqueName() == name) {
|
||||
@@ -165,7 +162,7 @@ void Scene::removeEntityByName(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "[Warning] Entity with name " << name << " could not be removed." << std::endl;
|
||||
Log::logger().warn("Entity \"{}\" could not be removed", name);
|
||||
}
|
||||
|
||||
void Scene::clearEntities()
|
||||
@@ -309,25 +306,25 @@ void Scene::calculateShadows(ShaderProgram *directionalShaderProgram, ShaderProg
|
||||
glCullFace(GL_FRONT);
|
||||
}
|
||||
|
||||
Model *Scene::getModelByName(std::string name)
|
||||
Model *Scene::getModelByName(const std::string &name)
|
||||
{
|
||||
for (auto it = m_models.begin(); it != m_models.end(); it++) {
|
||||
if ((*it)->getUniqueName() == name) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
std::cout << "[Warning] Model could not be found by unique name \"" << name << "\"" << std::endl;
|
||||
Log::logger().warn("Model could not be found by unique name \"{}\"", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ModelEntity *Scene::getEntityByName(std::string name)
|
||||
ModelEntity *Scene::getEntityByName(const std::string &name)
|
||||
{
|
||||
for (auto it = m_entities.begin(); it != m_entities.end(); it++) {
|
||||
if ((*it)->getUniqueName() == name) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
std::cout << "[Warning] Entity could not be found by unique name \"" << name << "\"" << std::endl;
|
||||
Log::logger().warn("Entity could not be found by unique name \"{}\"", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -338,7 +335,7 @@ ModelEntity *Scene::getEntityById(uint32_t id)
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
std::cout << "[Warning] Entity could not be found by ID \"" << id << "\"" << std::endl;
|
||||
Log::logger().warn("Entity could not be found by ID \"{}\"", id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
~Scene();
|
||||
|
||||
void addEntity(ModelEntity *entity);
|
||||
void removeEntityByName(std::string name);
|
||||
void removeEntityByName(const std::string &name);
|
||||
void clearEntities();
|
||||
|
||||
void updatePointLight(unsigned int lightId, bool active, glm::vec3 position, glm::vec3 color, float intensity);
|
||||
@@ -34,9 +34,9 @@ public:
|
||||
std::vector<PointLight *> getPointLights();
|
||||
DirectionalLight *getDirectionalLight();
|
||||
Skybox *getSkybox();
|
||||
ModelEntity *getEntityByName(std::string name);
|
||||
ModelEntity *getEntityByName(const std::string &name);
|
||||
ModelEntity *getEntityById(uint32_t id);
|
||||
Model *getModelByName(std::string name);
|
||||
Model *getModelByName(const std::string &name);
|
||||
|
||||
void draw(glm::mat4 viewProjMatrix, glm::vec3 viewPosition);
|
||||
void calculateShadows(ShaderProgram *directionalShaderProgram, ShaderProgram *pointShaderProgram);
|
||||
|
||||
@@ -13,7 +13,7 @@ Screen::Screen(Prototype prototype, FrameBuffer *framebuffer, ShaderProgram *sha
|
||||
{
|
||||
for (auto &prototype : prototype.widgetPrototypes) {
|
||||
auto texturePrototype = prototype.texturePrototype;
|
||||
Texture *currentTexture = new Texture(texturePrototype.texturePath, texturePrototype.textureType);
|
||||
Texture *currentTexture = new Texture({texturePrototype.texturePath, texturePrototype.textureType});
|
||||
currentTexture->initializeOnGPU();
|
||||
|
||||
Widget *currentWidget = new Widget(prototype, currentTexture);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "ShaderProgram.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
ShaderProgram::ShaderProgram(Prototype prototype) : m_uniqueName(prototype.name)
|
||||
{
|
||||
@@ -29,10 +27,9 @@ ShaderProgram::ShaderProgram(Prototype prototype) : m_uniqueName(prototype.name)
|
||||
|
||||
GLint isLinked = 0;
|
||||
glGetProgramiv(m_shaderProgramId, GL_LINK_STATUS, &isLinked);
|
||||
if (!isLinked) {
|
||||
std::cout << "Failed to link shaderProgram: " << prototype.vertexPath << ", " << prototype.geometryPath << ", "
|
||||
<< prototype.fragmentPath << std::endl;
|
||||
}
|
||||
if (!isLinked)
|
||||
Log::logger().critical("Failed to link shaderProgram \"{}\", \"{}\", \"{}\"", prototype.vertexPath,
|
||||
prototype.geometryPath, prototype.fragmentPath);
|
||||
|
||||
#ifdef _RELEASE
|
||||
glDetachShader(program, vs);
|
||||
@@ -69,7 +66,7 @@ std::string ShaderProgram::parse(const std::string &filename)
|
||||
shaderfile.open(filename, std::ios::in);
|
||||
|
||||
if (!shaderfile.is_open()) {
|
||||
std::cerr << "Shader " << filename << " not found!" << std::endl;
|
||||
Log::logger().critical("Shader \"{}\" not found", filename);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -92,7 +89,7 @@ GLuint ShaderProgram::compile(const std::string &shaderSource, GLenum type)
|
||||
glGetShaderiv(shaderId, GL_INFO_LOG_LENGTH, &length);
|
||||
char *message = new char[length];
|
||||
glGetShaderInfoLog(shaderId, length, &length, message);
|
||||
std::cout << "Shader compile error: " << message << std::endl;
|
||||
Log::logger().error("Shader compilation failed: {}", message);
|
||||
delete[] message;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#include "Texture.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Texture::Texture(const std::string &path, TextureType type) : m_texturePath(path), m_textureType(type)
|
||||
Texture::Texture(const Prototype &texturePrototype)
|
||||
: m_texturePath(texturePrototype.texturePath), m_textureType(texturePrototype.textureType)
|
||||
{
|
||||
stbi_set_flip_vertically_on_load(1);
|
||||
m_textureBuffer = stbi_load(m_texturePath.c_str(), &m_textureWidth, &m_textureHeight, &m_numComponents, 0);
|
||||
if (!m_textureBuffer) {
|
||||
std::cout << "[Warning] Texture " << m_texturePath << " not found!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_textureBuffer)
|
||||
Log::logger().warn("Texture {} could not be loaded", m_texturePath);
|
||||
}
|
||||
|
||||
Texture::~Texture()
|
||||
@@ -20,11 +19,6 @@ Texture::~Texture()
|
||||
|
||||
void Texture::initializeOnGPU()
|
||||
{
|
||||
if (m_isInitialized)
|
||||
return;
|
||||
|
||||
m_isInitialized = true;
|
||||
|
||||
GLenum internalFormat;
|
||||
GLenum dataFormat;
|
||||
|
||||
@@ -111,7 +105,7 @@ std::string Texture::getPath()
|
||||
return m_texturePath;
|
||||
}
|
||||
|
||||
GLuint Texture::getTextureId()
|
||||
GLuint Texture::textureId()
|
||||
{
|
||||
return m_textureId;
|
||||
}
|
||||
@@ -143,7 +137,7 @@ CubeMap::CubeMap(const std::string &texturePseudoPath)
|
||||
auto textureBuffer = stbi_load(path.c_str(), &m_textureWidth, &m_textureHeight, &numComponents, 0);
|
||||
|
||||
if (!textureBuffer) {
|
||||
std::cout << "[Warning] CubeMap Texture " << path.c_str() << " not found!" << std::endl;
|
||||
Log::logger().warn("CubeMap texture {} could not be loaded", path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,20 +31,22 @@ public:
|
||||
TextureType textureType;
|
||||
};
|
||||
|
||||
Texture(const std::string &path, TextureType type);
|
||||
~Texture();
|
||||
|
||||
void initializeOnGPU();
|
||||
|
||||
void bind(uint8_t textureUnit, ShaderProgram *shaderProgram, uint8_t textureTypeNum);
|
||||
void unbind();
|
||||
|
||||
TextureType getTextureType();
|
||||
std::string getPath();
|
||||
GLuint getTextureId();
|
||||
GLuint textureId();
|
||||
|
||||
Texture(const Prototype &texturePrototype); // TODO make private
|
||||
void initializeOnGPU(); // TODO make private
|
||||
~Texture(); // TODO make private
|
||||
|
||||
private:
|
||||
bool m_isInitialized = false;
|
||||
Texture(const Texture &other) = delete;
|
||||
Texture(Texture &&other) = delete;
|
||||
Texture &operator=(const Texture &other) = delete;
|
||||
Texture &operator=(Texture &&other) = delete;
|
||||
|
||||
std::string m_texturePath;
|
||||
|
||||
@@ -54,9 +56,11 @@ private:
|
||||
int32_t m_textureHeight;
|
||||
int32_t m_numComponents;
|
||||
|
||||
GLuint m_textureId;
|
||||
GLuint m_textureId; // TODO inherit from abstract class resource
|
||||
|
||||
TextureType m_textureType;
|
||||
|
||||
friend class TextureFactory;
|
||||
};
|
||||
|
||||
class CubeMap
|
||||
|
||||
20
src/TextureFactory.cpp
Normal file
20
src/TextureFactory.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "TextureFactory.h"
|
||||
|
||||
TextureFactory &TextureFactory::instance()
|
||||
{
|
||||
static TextureFactory instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void TextureFactory::registerTexture(const Texture::Prototype &prototype)
|
||||
{
|
||||
auto texture = std::make_unique<Texture>(prototype);
|
||||
m_textureMap.insert({texture->textureId(), std::move(texture)});
|
||||
}
|
||||
|
||||
std::unique_ptr<Texture> TextureFactory::texture(uint64_t resourceId)
|
||||
{
|
||||
auto texture = std::move(m_textureMap.at(resourceId));
|
||||
texture->initializeOnGPU();
|
||||
return texture;
|
||||
}
|
||||
18
src/TextureFactory.h
Normal file
18
src/TextureFactory.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "Texture.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
class TextureFactory // TODO not yet used
|
||||
{
|
||||
public:
|
||||
static TextureFactory &instance();
|
||||
|
||||
void registerTexture(const Texture::Prototype &prototype);
|
||||
std::unique_ptr<Texture> texture(uint64_t resourceId);
|
||||
|
||||
private:
|
||||
std::map<uint64_t, std::unique_ptr<Texture>> m_textureMap;
|
||||
};
|
||||
@@ -41,7 +41,7 @@ void Widget::draw(ShaderProgram *shaderProgram)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_widgetTextures[0]->getTextureId());
|
||||
glBindTexture(GL_TEXTURE_2D, m_widgetTextures[0]->textureId());
|
||||
|
||||
GLint location = glGetUniformLocation(shaderProgram->getShaderProgramId(), "u_texture");
|
||||
glUniform1i(location, 0);
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
#include "Helper.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "definitions/window.h"
|
||||
#include "util/Log.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <iostream>
|
||||
|
||||
Window::Window()
|
||||
{
|
||||
// Initialize GLFW
|
||||
if (!glfwInit()) {
|
||||
if (!glfwInit())
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
m_width = INIT_WINDOW_WIDTH;
|
||||
m_height = INIT_WINDOW_HEIGHT;
|
||||
@@ -29,12 +28,11 @@ Window::Window()
|
||||
#endif
|
||||
|
||||
m_window = glfwCreateWindow(m_width, m_height, "OpenGL", NULL, NULL);
|
||||
if (!m_window) {
|
||||
std::cout << "Failed to create window" << std::endl;
|
||||
}
|
||||
if (!m_window)
|
||||
Log::logger().critical("Failed to create window");
|
||||
|
||||
// Wait for window to maximize (in case)
|
||||
Helper::sleep(1000);
|
||||
// Helper::sleep(1000);
|
||||
|
||||
glfwGetWindowPos(m_window, &m_posX, &m_posY);
|
||||
glfwGetWindowSize(m_window, &m_width, &m_height);
|
||||
@@ -44,12 +42,12 @@ Window::Window()
|
||||
|
||||
// Initialize GLAD
|
||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
||||
std::cout << "Failed to initialize GLAD" << std::endl;
|
||||
Log::logger().critical("Failed to initialize GLAD");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;
|
||||
Log::logger().debug("OpenGL version: {}", glGetString(GL_VERSION));
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback(Helper::gl_debug_callback, NULL);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
Imgui::EntityWindow::EntityWindow(const std::vector<ModelEntity *> &entities) : Window("Entities"), m_entites(entities)
|
||||
Imgui::EntityWindow::EntityWindow(const std::vector<ModelEntity *> entities) : Window("Entities"), m_entites(entities)
|
||||
{}
|
||||
|
||||
void Imgui::EntityWindow::addWidgets()
|
||||
@@ -11,21 +11,28 @@ void Imgui::EntityWindow::addWidgets()
|
||||
ImGui::Text("Treelist");
|
||||
|
||||
for (const auto &entity : m_entites) {
|
||||
// addChildWidget(*entity);
|
||||
addChildWidget(*entity);
|
||||
}
|
||||
}
|
||||
|
||||
void Imgui::EntityWindow::addChildWidget(const ModelEntity &entity)
|
||||
{
|
||||
if (entity.getChildren().empty()) {
|
||||
ImGui::Indent();
|
||||
ImGui::Text(entity.getUniqueName().c_str());
|
||||
ImGui::SameLine();
|
||||
ImGui::SmallButton("Edit");
|
||||
ImGui::Unindent();
|
||||
} else {
|
||||
if (ImGui::TreeNode(entity.getUniqueName().c_str())) {
|
||||
bool expanded = ImGui::TreeNode(entity.getUniqueName().c_str());
|
||||
ImGui::SameLine();
|
||||
ImGui::SmallButton("Edit");
|
||||
|
||||
if (expanded) {
|
||||
for (const auto &child : entity.getChildren()) {
|
||||
addChildWidget(*(const ModelEntity *)child);
|
||||
}
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,14 @@ namespace Imgui {
|
||||
class EntityWindow : public Window
|
||||
{
|
||||
public:
|
||||
EntityWindow(const std::vector<ModelEntity *> &entities);
|
||||
EntityWindow(const std::vector<ModelEntity *> entities);
|
||||
|
||||
private:
|
||||
void addWidgets() override;
|
||||
|
||||
static void addChildWidget(const ModelEntity &entity);
|
||||
|
||||
const std::vector<ModelEntity *> &m_entites;
|
||||
const std::vector<ModelEntity *> m_entites;
|
||||
};
|
||||
|
||||
} // namespace Imgui
|
||||
17
src/util/Log.cpp
Normal file
17
src/util/Log.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "Log.h"
|
||||
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
|
||||
Log Log::s_instance;
|
||||
|
||||
Log::Log()
|
||||
{
|
||||
m_logger = spdlog::stdout_color_mt("Core");
|
||||
m_logger->set_level(spdlog::level::debug);
|
||||
// m_logger->set_pattern("");
|
||||
}
|
||||
|
||||
spdlog::logger &Log::logger()
|
||||
{
|
||||
return *s_instance.m_logger;
|
||||
}
|
||||
16
src/util/Log.h
Normal file
16
src/util/Log.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
class Log
|
||||
{
|
||||
public:
|
||||
static spdlog::logger &logger();
|
||||
|
||||
private:
|
||||
Log();
|
||||
|
||||
static Log s_instance;
|
||||
|
||||
std::shared_ptr<spdlog::logger> m_logger;
|
||||
};
|
||||
Reference in New Issue
Block a user