In the middle of multithreading parsers.

This commit is contained in:
zy4n
2025-03-30 22:38:06 +02:00
parent d18b40a7fc
commit 144126ee7a
80 changed files with 2904 additions and 1450 deletions

478
.idea/editor.xml generated
View File

@@ -99,5 +99,483 @@
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Single" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Single" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGNMENT_TAB_FILL_STYLE/@EntryValue" value="USE_TABS_ONLY" type="string" /> <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGNMENT_TAB_FILL_STYLE/@EntryValue" value="USE_TABS_ONLY" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexRemoved" />
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexRemoved" />
</component> </component>
</project> </project>

5
.idea/misc.xml generated
View File

@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="BackendCodeEditorMiscSettings">
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
<option name="/Default/Environment/Hierarchy/GeneratedFilesCacheKey/Timestamp/@EntryValue" value="69" type="long" />
<option name="/Default/Housekeeping/OptionsDialog/SelectedPageId/@EntryValue" value="CppFormatterOtherPage" type="string" />
</component>
<component name="CMakePythonSetting"> <component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" /> <option name="pythonIntegrationState" value="YES" />
</component> </component>

View File

@@ -14,7 +14,7 @@ add_executable(z3d main.cpp
include/assets/data/material_data.hpp include/assets/data/material_data.hpp
include/assets/data/mesh_data.hpp include/assets/data/mesh_data.hpp
include/assets/data/point_cloud_data.hpp include/assets/data/point_cloud_data.hpp
include/assets/file_parsers/kitti_loader.hpp include/assets/file_parsers/kitti_parser.hpp
include/assets/file_parsers/obj_loader.hpp include/assets/file_parsers/obj_loader.hpp
include/assets/file_parsers/stl_loader.hpp include/assets/file_parsers/stl_loader.hpp
include/assets/file_parsers/uos_loader.hpp include/assets/file_parsers/uos_loader.hpp
@@ -54,7 +54,7 @@ add_executable(z3d main.cpp
source/opengl/handles/mesh_handle.ipp source/opengl/handles/mesh_handle.ipp
source/opengl/handles/point_cloud_handle.ipp source/opengl/handles/point_cloud_handle.ipp
source/opengl/handles/texture_handle.ipp source/opengl/handles/texture_handle.ipp
include/assets/data/surface_properties.hpp include/assets/data/uniform_surface_properties.hpp
include/util/unroll_bool_template.hpp include/util/unroll_bool_template.hpp
include/rendering/batch_renderers/point_cloud_batch_renderer.hpp include/rendering/batch_renderers/point_cloud_batch_renderer.hpp
source/rendering/batches/mesh_batch.ipp source/rendering/batches/mesh_batch.ipp
@@ -62,7 +62,7 @@ add_executable(z3d main.cpp
include/opengl/shading/uniform.hpp include/opengl/shading/uniform.hpp
include/opengl/type_utils.hpp include/opengl/type_utils.hpp
include/util/binary_ifstream.hpp include/util/binary_ifstream.hpp
source/assets/file_parsers/kitti_loader.cpp source/assets/file_parsers/kitti_parser.cpp
include/assets/file_parsers/generic/generic_3dtk_loader.hpp include/assets/file_parsers/generic/generic_3dtk_loader.hpp
include/assets/file_parsers/uosr_loader.hpp include/assets/file_parsers/uosr_loader.hpp
include/assets/file_parsers/uos_normal_loader.hpp include/assets/file_parsers/uos_normal_loader.hpp
@@ -86,9 +86,9 @@ add_executable(z3d main.cpp
source/viewer/instance.cpp source/viewer/instance.cpp
include/viewer/asset_loader.hpp include/viewer/asset_loader.hpp
source/viewer/asset_loader.cpp source/viewer/asset_loader.cpp
include/assets/file_parsers/glsl_loader.hpp include/assets/file_parsers/glsl_parser.hpp
include/assets/data/shader_source_data.hpp include/assets/data/shader_source_data.hpp
source/assets/file_parsers/glsl_loader.cpp source/assets/file_parsers/glsl_parser.cpp
include/viewer/settings.hpp include/viewer/settings.hpp
include/opengl/data/shader_data.hpp include/opengl/data/shader_data.hpp
source/opengl/data/shader_data.ipp source/opengl/data/shader_data.ipp
@@ -149,11 +149,11 @@ add_executable(z3d main.cpp
include/assets/prefetch_lookups/texture_prefetch_lookup.hpp include/assets/prefetch_lookups/texture_prefetch_lookup.hpp
include/assets/prefetch_lookups/pose_prefetch_lookup.hpp include/assets/prefetch_lookups/pose_prefetch_lookup.hpp
include/assets/data_stores/pose_store.hpp include/assets/data_stores/pose_store.hpp
include/assets/file_parsers/kitti_pose_loader.hpp include/assets/file_parsers/kitti_pose_parser.hpp
include/assets/file_parsers/threedtk_pose_loader.hpp include/assets/file_parsers/threedtk_pose_loader.hpp
source/assets/file_parsers/threedtk_pose_loader.cpp source/assets/file_parsers/threedtk_pose_loader.cpp
include/assets/data/pose_data.hpp include/assets/data/pose_data.hpp
source/assets/file_parsers/kitti_pose_loader.cpp source/assets/file_parsers/kitti_pose_parser.cpp
include/assets/prefetch_queue.hpp include/assets/prefetch_queue.hpp
include/util/string_list.hpp include/util/string_list.hpp
include/assets/data_stores/material_library_store.hpp include/assets/data_stores/material_library_store.hpp
@@ -178,13 +178,11 @@ add_executable(z3d main.cpp
include/opengl/shading/shader_metadata_language.hpp include/opengl/shading/shader_metadata_language.hpp
include/opengl/shading/features/generic_features.hpp include/opengl/shading/features/generic_features.hpp
include/opengl/shading/features/combined_features.hpp include/opengl/shading/features/combined_features.hpp
include/opengl/shading/requirements/shader_source_requirements.hpp
include/opengl/metadata/preprocessed_shader_source_metadata.hpp include/opengl/metadata/preprocessed_shader_source_metadata.hpp
include/opengl/shading/requirements/shader_requirements.hpp include/opengl/shading/requirements/shader_requirements.hpp
include/opengl/metadata/shader_metadata.hpp include/opengl/metadata/shader_metadata.hpp
include/opengl/metadata/shader_set_metadata.hpp include/opengl/metadata/shader_set_metadata.hpp
include/opengl/handles/shader_handle_set.hpp include/opengl/handles/shader_handle_set.hpp
include/opengl/shading/requirements/shader_set_requirements.hpp
include/opengl/data_managers/shader_program_manager.hpp include/opengl/data_managers/shader_program_manager.hpp
include/opengl/metadata/shader_program_metadata.hpp include/opengl/metadata/shader_program_metadata.hpp
source/opengl/data_managers/shader_program_manager.cpp source/opengl/data_managers/shader_program_manager.cpp
@@ -235,8 +233,20 @@ add_executable(z3d main.cpp
include/config/primitives.hpp include/config/primitives.hpp
include/assets/data/generic/component_set.hpp include/assets/data/generic/component_set.hpp
include/assets/data_views/generic/generic_mesh_view.hpp include/assets/data_views/generic/generic_mesh_view.hpp
include/assets/data_views/generic/generic_point_cloud_viwe.hpp include/assets/data_views/generic/generic_point_cloud_view.hpp
include/assets/identifiers.hpp include/assets/identifiers.hpp
include/assets/fallback_data/fallback_texture.hpp
source/assets/fallback_data/default_texture_data.cpp
include/assets/fallback_data/fallback_material.hpp
source/assets/fallback_data/fallback_material.cpp
include/assets/components/mesh_shader_components.hpp
include/assets/components/shader_components.hpp
include/assets/model_geometry.hpp
include/assets/path_id_lookups.hpp
include/util/file_id_lookup.hpp
include/assets/data/pose_list_data.hpp
include/assets/data_stores/pose_list_store.hpp
include/assets/data_views/pose_list_view.hpp
) )
target_include_directories(z3d PRIVATE include) target_include_directories(z3d PRIVATE include)

View File

@@ -5,51 +5,67 @@
#include "config/primitives.hpp" #include "config/primitives.hpp"
#include "assets/identifiers.hpp" #include "assets/identifiers.hpp"
#include "assets/data_stores/texture_store.hpp" #include "assets/data_stores/texture_store.hpp"
#include "assets/data/surface_properties.hpp" #include "assets/data/uniform_surface_properties.hpp"
#include "util/enum_bitfield_operators.hpp" #include "util/enum_bitfield_operators.hpp"
namespace assets::material_components namespace assets::material_components
{ {
using surface_properties = surface_properties;
using transparency = z3d::f32; using ambient_filter = z3d::vec3;
using ambient_color_texture = texture_id; using diffuse_filter = z3d::vec3;
using diffuse_color_texture = texture_id; using specular_filter = z3d::vec3;
using specular_color_texture = texture_id; using shininess = z3d::f32;
using alpha = z3d::f32;
using ambient_filter_texture = texture_id;
using diffuse_filter_texture = texture_id;
using specular_filter_texture = texture_id;
using shininess_texture = texture_id; using shininess_texture = texture_id;
using alpha_texture = texture_id; using alpha_texture = texture_id;
using bump_texture = texture_id; using bump_texture = texture_id;
namespace indices namespace indices
{ {
inline constexpr z3d::size surface_properties = 0; enum : z3d::size
inline constexpr z3d::size transparency = 1; {
inline constexpr z3d::size ambient_color_texture = 2; ambient_filter,
inline constexpr z3d::size diffuse_color_texture = 3; diffuse_filter,
inline constexpr z3d::size specular_color_texture = 4; specular_filter,
inline constexpr z3d::size shininess_texture = 5; shininess,
inline constexpr z3d::size alpha_texture = 6; alpha,
inline constexpr z3d::size bump_texture = 7; ambient_filter_texture,
diffuse_filter_texture,
specular_filter_texture,
shininess_texture,
alpha_texture,
bump_texture
};
} }
enum class flags : z3d::u8 enum class flags : z3d::u8
{ {
none = 0, none = 0,
surface_properties = 1 << indices::surface_properties, ambient_filter = 1 << indices::ambient_filter,
transparency = 1 << indices::transparency, diffuse_filter = 1 << indices::diffuse_filter,
ambient_filter_texture = 1 << indices::ambient_color_texture, specular_filter = 1 << indices::specular_filter,
diffuse_filter_texture = 1 << indices::diffuse_color_texture, shininess = 1 << indices::shininess,
specular_filter_texture = 1 << indices::specular_color_texture, alpha = 1 << indices::alpha,
ambient_filter_texture = 1 << indices::ambient_filter_texture,
diffuse_filter_texture = 1 << indices::diffuse_filter_texture,
specular_filter_texture = 1 << indices::specular_filter_texture,
shininess_texture = 1 << indices::shininess_texture, shininess_texture = 1 << indices::shininess_texture,
alpha_texture = 1 << indices::alpha_texture, alpha_texture = 1 << indices::alpha_texture,
bump_texture = 1 << indices::bump_texture bump_texture = 1 << indices::bump_texture
}; };
using all = z3d::structure< using all = z3d::structure<
surface_properties, ambient_filter,
transparency, diffuse_filter,
ambient_color_texture, specular_filter,
diffuse_color_texture, shininess,
specular_color_texture, alpha,
ambient_filter_texture,
diffuse_filter_texture,
specular_filter_texture,
shininess_texture, shininess_texture,
alpha_texture, alpha_texture,
bump_texture bump_texture

View File

@@ -0,0 +1,58 @@
#pragma once
#include "config/primitives.hpp"
#include "util/enum_bitfield_operators.hpp"
#include <array>
#include <string_view>
namespace assets::mesh_shader_components
{
namespace indices
{
enum : z3d::size
{
face,
line,
point,
luminance,
color,
alpha,
color_texture,
uniform_lighting,
textured_lighting,
uniform_color
};
}
enum class flags : std::uint16_t
{
none = 0,
face = 1 << indices::face,
line = 1 << indices::line,
point = 1 << indices::point,
luminance = 1 << indices::luminance,
color = 1 << indices::color,
alpha = 1 << indices::alpha,
color_texture = 1 << indices::color_texture,
uniform_lighting = 1 << indices::uniform_lighting,
textured_lighting = 1 << indices::textured_lighting,
uniform_color = 1 << indices::uniform_color
};
constexpr inline auto names = std::array<std::string_view, 10>{
"face",
"line",
"point",
"luminance",
"color",
"alpha",
"color_texture",
"uniform_lighting",
"textured_lighting",
"uniform_color"
};
}
DEFINE_ENUM_BITFIELD_OPERATORS(assets::mesh_shader_components::flags)

View File

@@ -16,11 +16,14 @@ using reflectance = z3d::f32;
namespace indices namespace indices
{ {
inline constexpr z3d::size position = 0; enum : z3d::size
inline constexpr z3d::size normal = 1; {
inline constexpr z3d::size tex_coord = 2; position,
inline constexpr z3d::size color = 3; normal,
inline constexpr z3d::size reflectance = 4; tex_coord,
color,
reflectance
};
} }
enum class flags : z3d::u8 enum class flags : z3d::u8

View File

@@ -0,0 +1,46 @@
#pragma once
#include "config/primitives.hpp"
#include "util/enum_bitfield_operators.hpp"
#include <array>
#include <string_view>
namespace assets::point_cloud_shader_components
{
enum indices : z3d::size
{
square,
lighting,
luminance,
color,
alpha,
uniform_color,
rainbow
};
enum class flags : std::uint16_t
{
none = 0,
square = 1 << indices::square,
lighting = 1 << indices::lighting,
luminance = 1 << indices::luminance,
color = 1 << indices::color,
alpha = 1 << indices::alpha,
uniform_color = 1 << indices::uniform_color,
rainbow = 1 << indices::rainbow
};
constexpr inline auto names = std::array<std::string_view, 7>{
"square",
"lighting",
"luminance",
"color",
"alpha",
"uniform_color",
"rainbow"
};
}
DEFINE_ENUM_BITFIELD_OPERATORS(assets::point_cloud_shader_components::flags)

View File

@@ -15,10 +15,13 @@ using reflectance = z3d::f32;
namespace indices namespace indices
{ {
inline constexpr z3d::size position = 0; enum : z3d::size
inline constexpr z3d::size normal = 1; {
inline constexpr z3d::size color = 2; position,
inline constexpr z3d::size reflectance = 3; normal,
color,
reflectance
};
} // namespace indices } // namespace indices
enum class flags : z3d::u8 enum class flags : z3d::u8

View File

@@ -0,0 +1,35 @@
#pragma once
#include <type_traits>
#include "mesh_shader_components.hpp"
#include "point_cloud_shader_components.hpp"
namespace assets::shader_components
{
enum class stage : z3d::u8
{
vertex = 0,
tesselation_control = 1,
tesselation_evaluation = 2,
geometry = 3,
fragment = 4
};
inline constexpr std::size_t count = 5;
inline constexpr auto stage_names = std::array<std::string_view, count>{
"vertex",
"tesselation_control",
"tesselation_evaluation",
"geometry",
"fragment"
};
using flags = std::make_unsigned_t<std::common_type_t<
std::underlying_type_t<mesh_shader_components::flags>,
std::underlying_type_t<point_cloud_shader_components::flags>
>>;
}

View File

@@ -11,8 +11,12 @@ class component_array_set {};
template<typename C, typename... Ts> template<typename C, typename... Ts>
class component_array_set<C, z3d::structure<Ts...>> class component_array_set<C, z3d::structure<Ts...>>
{ {
public:
component_array_set() = default; component_array_set() = default;
C component_flags;
z3d::structure<z3d::vector<Ts>...> component_arrays{};
protected: protected:
void clear_component_arrays() void clear_component_arrays()
{ {
@@ -24,10 +28,6 @@ protected:
component_arrays component_arrays
); );
} }
C component_flags;
z3d::structure<z3d::vector<Ts>...> component_arrays{};
}; };
} }

View File

@@ -1,7 +1,5 @@
#pragma once #pragma once
#include <optional>
#include "assets/components/material_components.hpp" #include "assets/components/material_components.hpp"
#include "generic/component_set.hpp" #include "generic/component_set.hpp"
@@ -13,22 +11,27 @@ struct material_data : detail::component_set<material_components::all>
material_data() = default; material_data() = default;
material_components::surface_properties& initialized_surface_properties(); [[nodiscard]] inline z3d::optional<material_components::ambient_filter>& ambient_filter();
[[nodiscard]] inline z3d::optional<material_components::diffuse_filter>& diffuse_filter();
[[nodiscard]] inline z3d::optional<material_components::surface_properties>& surface_properties(); [[nodiscard]] inline z3d::optional<material_components::specular_filter>& specular_filter();
[[nodiscard]] inline z3d::optional<material_components::transparency>& transparency(); [[nodiscard]] inline z3d::optional<material_components::shininess>& shininess();
[[nodiscard]] inline z3d::optional<material_components::ambient_color_texture>& ambient_color_texture_id(); [[nodiscard]] inline z3d::optional<material_components::alpha>& alpha();
[[nodiscard]] inline z3d::optional<material_components::diffuse_color_texture>& diffuse_color_texture_id(); [[nodiscard]] inline z3d::optional<material_components::ambient_filter_texture>& specular_filter_texture_id();
[[nodiscard]] inline z3d::optional<material_components::specular_color_texture>& specular_color_texture_id(); [[nodiscard]] inline z3d::optional<material_components::diffuse_filter_texture>& diffuse_filter_texture_id();
[[nodiscard]] inline z3d::optional<material_components::specular_filter_texture>& specular_filter_texture_id();
[[nodiscard]] inline z3d::optional<material_components::shininess_texture>& shininess_texture_id(); [[nodiscard]] inline z3d::optional<material_components::shininess_texture>& shininess_texture_id();
[[nodiscard]] inline z3d::optional<material_components::alpha_texture>& alpha_texture_id(); [[nodiscard]] inline z3d::optional<material_components::alpha_texture>& alpha_texture_id();
[[nodiscard]] inline z3d::optional<material_components::bump_texture>& bump_texture_id(); [[nodiscard]] inline z3d::optional<material_components::bump_texture>& bump_texture_id();
[[nodiscard]] inline const z3d::optional<material_components::surface_properties>& surface_properties() const; [[nodiscard]] inline const z3d::optional<material_components::ambient_filter>& ambient_filter() const;
[[nodiscard]] inline const z3d::optional<material_components::transparency>& transparency() const; [[nodiscard]] inline const z3d::optional<material_components::diffuse_filter>& diffuse_filter() const;
[[nodiscard]] inline const z3d::optional<material_components::ambient_color_texture>& ambient_color_texture_id() const; [[nodiscard]] inline const z3d::optional<material_components::specular_filter>& specular_filter() const;
[[nodiscard]] inline const z3d::optional<material_components::diffuse_color_texture>& diffuse_color_texture_id() const; [[nodiscard]] inline const z3d::optional<material_components::shininess>& shininess() const;
[[nodiscard]] inline const z3d::optional<material_components::specular_color_texture>& specular_color_texture_id() const; [[nodiscard]] inline const z3d::optional<material_components::alpha>& alpha() const;
[[nodiscard]] inline const z3d::optional<material_components::alpha>& transparency() const;
[[nodiscard]] inline const z3d::optional<material_components::ambient_filter_texture>& specular_filter_texture_id() const;
[[nodiscard]] inline const z3d::optional<material_components::diffuse_filter_texture>& diffuse_filter_texture_id() const;
[[nodiscard]] inline const z3d::optional<material_components::specular_filter_texture>& specular_filter_texture_id() const;
[[nodiscard]] inline const z3d::optional<material_components::shininess_texture>& shininess_texture_id() const; [[nodiscard]] inline const z3d::optional<material_components::shininess_texture>& shininess_texture_id() const;
[[nodiscard]] inline const z3d::optional<material_components::alpha_texture>& alpha_texture_id() const; [[nodiscard]] inline const z3d::optional<material_components::alpha_texture>& alpha_texture_id() const;
[[nodiscard]] inline const z3d::optional<material_components::bump_texture>& bump_texture_id() const; [[nodiscard]] inline const z3d::optional<material_components::bump_texture>& bump_texture_id() const;
@@ -38,6 +41,6 @@ struct material_data : detail::component_set<material_components::all>
} }
#define INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION #define INCLUDE_MATERIAL_DATA_IMPLEMENTATION
#include "assets/data/material_data.ipp" #include "assets/data/material_data.ipp"
#undef INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION #undef INCLUDE_MATERIAL_DATA_IMPLEMENTATION

View File

@@ -9,11 +9,16 @@
namespace assets namespace assets
{ {
class point_cloud_data : detail::component_array_set< class point_cloud_data : public detail::component_array_set<
point_cloud_vertex_components::flags, point_cloud_vertex_components::flags,
point_cloud_vertex_components::all point_cloud_vertex_components::all
> { > {
public: public:
using detail::component_array_set<
point_cloud_vertex_components::flags,
point_cloud_vertex_components::all
>::component_array_set;
[[nodiscard]] inline std::vector<point_cloud_vertex_components::position>& positions(); [[nodiscard]] inline std::vector<point_cloud_vertex_components::position>& positions();
[[nodiscard]] inline std::vector<point_cloud_vertex_components::normal>& normals(); [[nodiscard]] inline std::vector<point_cloud_vertex_components::normal>& normals();
[[nodiscard]] inline std::vector<point_cloud_vertex_components::color>& colors(); [[nodiscard]] inline std::vector<point_cloud_vertex_components::color>& colors();

View File

@@ -0,0 +1,11 @@
#pragma once
#include "pose_data.hpp"
namespace assets
{
using pose_list_data = std::vector<pose_data>;
}

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include "config/primitives.hpp" #include "config/primitives.hpp"
#include "assets/components/shader_components.hpp"
#include "assets/model_geometry.hpp"
namespace assets namespace assets
{ {
@@ -9,9 +11,20 @@ struct shader_source_data
{ {
z3d::vector<char> source{}; z3d::vector<char> source{};
struct metadata
{
model_geometry::types geometry_type;
shader_components::stage stage{};
shader_components::flags components{};
shader_components::flags static_enable{};
shader_components::flags dynamic_enable{};
} meta;
void clear() void clear()
{ {
source.clear(); source.clear();
meta.stage = {};
meta.components = {};
} }
}; };

View File

@@ -1,16 +0,0 @@
#pragma once
#include "config/primitives.hpp"
namespace assets
{
struct surface_properties
{
z3d::vec3 ambient_filter{ 0.7f, 0.7f, 0.7f };
z3d::vec3 diffuse_filter{ 0.466f, 0.466f, 0.7922f };
z3d::vec3 specular_filter{ 0.5974f, 0.2084f, 0.2084f };
z3d::f32 shininess{ 100.2237f };
};
}

View File

@@ -0,0 +1,9 @@
#pragma once
#include "config/primitives.hpp"
namespace assets
{
}

View File

@@ -10,7 +10,7 @@
#include "assets/prefetch_lookups/point_cloud_prefetch_lookup.hpp" #include "assets/prefetch_lookups/point_cloud_prefetch_lookup.hpp"
#include "util/string_list.hpp" #include "util/string_list.hpp"
#include "assets/file_parsers/kitti_loader.hpp" #include "assets/file_parsers/kitti_parser.hpp"
#include "assets/file_parsers/uos_loader.hpp" #include "assets/file_parsers/uos_loader.hpp"
#include "assets/file_parsers/uos_normal_loader.hpp" #include "assets/file_parsers/uos_normal_loader.hpp"
#include "assets/file_parsers/uos_rgb_loader.hpp" #include "assets/file_parsers/uos_rgb_loader.hpp"
@@ -21,7 +21,7 @@ namespace assets
class point_cloud_loader : public base_dynamic_loader< class point_cloud_loader : public base_dynamic_loader<
point_cloud_vertex_components::flags, point_cloud_vertex_components::flags,
kitti_loader, kitti_parser,
uos_loader, uos_loader,
uos_normal_loader, uos_normal_loader,
uos_rgb_loader, uos_rgb_loader,

View File

@@ -4,6 +4,7 @@
#include "data_stores/material_store.hpp" #include "data_stores/material_store.hpp"
#include "data_stores/mesh_store.hpp" #include "data_stores/mesh_store.hpp"
#include "data_stores/point_cloud_store.hpp" #include "data_stores/point_cloud_store.hpp"
#include "data_stores/pose_list_store.hpp"
#include "data_stores/pose_store.hpp" #include "data_stores/pose_store.hpp"
#include "data_stores/shader_source_store.hpp" #include "data_stores/shader_source_store.hpp"
#include "data_stores/texture_store.hpp" #include "data_stores/texture_store.hpp"
@@ -18,6 +19,7 @@ struct data_stores
mesh_store meshes; mesh_store meshes;
point_cloud_store point_clouds; point_cloud_store point_clouds;
pose_store poses; pose_store poses;
pose_list_store pose_lists;
shader_source_store shader_sources; shader_source_store shader_sources;
texture_store textures; texture_store textures;
}; };

View File

@@ -105,13 +105,12 @@ public:
using count_type = ztu::u32; using count_type = ztu::u32;
using component_flag_type = point_cloud_vertex_components::flags; using component_flag_type = point_cloud_vertex_components::flags;
using data_type = point_cloud_data;
using iterator_type = generic_point_cloud_store_iterator<Ts...>; using iterator_type = generic_point_cloud_store_iterator<Ts...>;
using const_iterator = generic_point_cloud_store_iterator<std::add_const_t<Ts>...>; using const_iterator = generic_point_cloud_store_iterator<std::add_const_t<Ts>...>;
using view_type = std::ranges::subrange<iterator_type>;
using const_view_type = std::ranges::subrange<const_iterator>;
using id_type = point_cloud_id; using id_type = point_cloud_id;
id_type add(const point_cloud_data& point_cloud); id_type add(id_type id, const data_type& point_cloud);
[[nodiscard]] std::pair<iterator_type, bool> find(id_type id); [[nodiscard]] std::pair<iterator_type, bool> find(id_type id);
@@ -133,10 +132,6 @@ public:
const_iterator cend() const; const_iterator cend() const;
view_type view();
const_view_type view() const;
protected: protected:
std::tuple<std::add_pointer_t<Ts>...> component_iterators(); std::tuple<std::add_pointer_t<Ts>...> component_iterators();

View File

@@ -7,7 +7,7 @@ namespace assets
using material_store = detail::generic_material_store< using material_store = detail::generic_material_store<
material_components::surface_properties, material_components::surface_properties,
material_components::transparency, material_components::alpha,
texture_store::id_type, texture_store::id_type,
texture_store::id_type, texture_store::id_type,
texture_store::id_type, texture_store::id_type,

View File

@@ -0,0 +1,137 @@
#pragma once
#include "generic/generic_basic_store.hpp"
#include "assets/identifiers.hpp"
#include "assets/data/pose_list_data.hpp"
#include "assets/data_views/pose_list_view.hpp"
namespace assets
{
class pose_list_store;
template<typename Char>
class pose_list_store_iterator
{
public:
using size_type = std::size_t;
using length_type = ztu::u32;
using id_type = pose_list_id;
using value_type = std::pair<id_type, pose_list_view>;
using id_iterator_type = id_type const*;
using pose_iterator_type = Char*;
using length_iterator_type = const length_type*;
using offset_type = size_type;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type;
using iterator_category = std::random_access_iterator_tag;
private:
friend pose_list_store;
pose_list_store_iterator(
id_iterator_type ids,
pose_iterator_type poses,
length_iterator_type lengths,
std::size_t index,
const offset_type& offset
);
public:
constexpr pose_list_store_iterator() noexcept = default;
constexpr pose_list_store_iterator(const pose_list_store_iterator&) noexcept = default;
constexpr pose_list_store_iterator(pose_list_store_iterator&&) noexcept = default;
constexpr pose_list_store_iterator& operator=(const pose_list_store_iterator&) noexcept = default;
constexpr pose_list_store_iterator& operator=(pose_list_store_iterator&&) noexcept = default;
reference operator*() const;
pose_list_store_iterator& operator++();
pose_list_store_iterator operator++(int);
pose_list_store_iterator& operator--();
pose_list_store_iterator operator--(int);
pose_list_store_iterator& operator+=(difference_type n);
pose_list_store_iterator& operator-=(difference_type n);
pose_list_store_iterator operator+(difference_type n) const;
pose_list_store_iterator operator-(difference_type n) const;
difference_type operator-(const pose_list_store_iterator& other) const;
reference operator[](difference_type n) const;
bool operator==(const pose_list_store_iterator& other) const;
bool operator!=(const pose_list_store_iterator& other) const;
bool operator<(const pose_list_store_iterator& other) const;
bool operator<=(const pose_list_store_iterator& other) const;
bool operator>(const pose_list_store_iterator& other) const;
bool operator>=(const pose_list_store_iterator& other) const;
protected:
void calc_offset(difference_type n);
reference dereference() const;
private:
id_iterator_type m_ids{};
pose_iterator_type m_poses{};
length_iterator_type m_lengths{};
size_type m_index{};
offset_type m_offset{};
};
class pose_list_store
{
public:
using size_type = std::size_t;
using count_type = ztu::u32;
using iterator_type = pose_list_store_iterator<char>;
using const_iterator = pose_list_store_iterator<const char>;
using data_type = pose_list_data;
using id_type = pose_list_id;
// TODO not storing metadata
inline id_type add(
id_type id,
const data_type& pose_list
);
[[nodiscard]] inline std::pair<iterator_type, bool> find(id_type id);
[[nodiscard]] inline std::pair<const_iterator, bool> find(id_type id) const;
inline void remove(const iterator_type& it);
inline void clear();
[[nodiscard]] inline iterator_type begin();
[[nodiscard]] inline iterator_type end();
[[nodiscard]] inline const_iterator begin() const;
[[nodiscard]] inline const_iterator end() const;
[[nodiscard]] inline const_iterator cbegin() const;
[[nodiscard]] inline const_iterator cend() const;
private:
std::vector<id_type> m_ids;
std::vector<char> m_poses;
std::vector<count_type> m_lengths;
};
}
#define INCLUDE_POSE_LIST_STORE_IMPLEMENTATION
#include "assets/data_stores/pose_list_store.ipp"
#undef INCLUDE_POSE_LIST_STORE_IMPLEMENTATION

View File

@@ -15,12 +15,14 @@ class shader_source_store_iterator
public: public:
using size_type = std::size_t; using size_type = std::size_t;
using length_type = ztu::u32; using length_type = ztu::u32;
using id_type = ztu::id_type_for<shader_source_store, ztu::u32>; using id_type = shader_source_id;
using metadata_type = shader_source_data::metadata;
using value_type = std::pair<id_type, shader_source_view>; using value_type = std::pair<id_type, shader_source_view>;
using id_iterator_type = id_type const*; using id_iterator_type = id_type const*;
using string_iterator_type = Char*; using string_iterator_type = Char*;
using length_iterator_type = const length_type*; using length_iterator_type = const length_type*;
using metadata_iterator_type = const metadata_type*;
using offset_type = size_type; using offset_type = size_type;
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
@@ -35,6 +37,7 @@ private:
id_iterator_type ids, id_iterator_type ids,
string_iterator_type strings, string_iterator_type strings,
length_iterator_type lengths, length_iterator_type lengths,
metadata_iterator_type metadata,
std::size_t index, std::size_t index,
const offset_type& offset const offset_type& offset
); );
@@ -80,6 +83,7 @@ private:
id_iterator_type m_ids{}; id_iterator_type m_ids{};
string_iterator_type m_strings{}; string_iterator_type m_strings{};
length_iterator_type m_lengths{}; length_iterator_type m_lengths{};
metadata_iterator_type m_metadata{};
size_type m_index{}; size_type m_index{};
offset_type m_offset{}; offset_type m_offset{};
}; };
@@ -95,9 +99,13 @@ public:
using const_iterator = shader_source_store_iterator<const char>; using const_iterator = shader_source_store_iterator<const char>;
using view_type = std::ranges::subrange<iterator_type>; using view_type = std::ranges::subrange<iterator_type>;
using const_view_type = std::ranges::subrange<const_iterator>; using const_view_type = std::ranges::subrange<const_iterator>;
using id_type = ztu::id_type_for<shader_source_store, ztu::u32>; using id_type = shader_source_id;
inline id_type add(const shader_source_data& shader_source); // TODO not storing metadata
inline id_type add(
shader_source_id id,
const shader_source_data& shader_source
);
[[nodiscard]] inline std::pair<iterator_type, bool> find(id_type id); [[nodiscard]] inline std::pair<iterator_type, bool> find(id_type id);
@@ -119,15 +127,12 @@ public:
[[nodiscard]] inline const_iterator cend() const; [[nodiscard]] inline const_iterator cend() const;
[[nodiscard]] inline view_type view();
[[nodiscard]] inline const_view_type view() const;
private: private:
std::vector<id_type> m_ids; std::vector<id_type> m_ids;
std::vector<char> m_strings; std::vector<char> m_strings;
std::vector<count_type> m_lengths; std::vector<count_type> m_lengths;
id_type m_next_data_id{ 1 }; std::vector<shader_source_data::metadata> m_metadata;
}; };
} }

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "generic/generic_point_cloud_viwe.hpp" #include "generic/generic_point_cloud_view.hpp"
namespace assets namespace assets
{ {

View File

@@ -0,0 +1,11 @@
#pragma once
#include "assets/data/pose_data.hpp"
namespace assets
{
using pose_list_view = std::span<pose_data>;
}

View File

@@ -1,5 +1,20 @@
#pragma once #pragma once
#include "config/primitives.hpp" #include <string_view>
#include "assets/model_geometry.hpp"
#include "assets/components/shader_components.hpp"
using shader_source_view = z3d::string_view; namespace assets
{
struct shader_source_view
{
std::string_view source;
model_geometry::types geometry_type;
shader_components::stage stage;
shader_components::flags components{};
shader_components::flags static_enable{};
shader_components::flags dynamic_enable{};
};
}

View File

@@ -0,0 +1,10 @@
#pragma once
#include "assets/data/material_data.hpp"
namespace assets
{
material_data generate_fallback_material();
}

View File

@@ -0,0 +1,28 @@
#pragma once
#include "assets/components/texture_components.hpp"
#include "assets/data/texture_data.hpp"
namespace assets
{
struct fallback_color
{
static constexpr auto components = (
texture_components::flags::red |
texture_components::flags::green |
texture_components::flags::blue
);
texture_data::value_type r, g, b;
};
texture_data generate_fallback_texture(
int width = 4,
int height = 4,
std::span<const fallback_color> colors = std::array{
fallback_color{ .r = 255, .g = 0, b = 255 },
fallback_color{ .r = 0, .g = 0, b = 0 }
}
);
}

View File

@@ -1,35 +0,0 @@
#pragma once
#include <filesystem>
#include <vector>
#include <string>
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "assets/prefetch_lookups/mesh_prefetch_lookup.hpp"
#include "assets/data/shader_source_data.hpp"
#include "util/string_list.hpp"
namespace assets
{
struct glsl_loader
{
static constexpr auto name = std::string_view("glsl");
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
shader_source_data& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
shader_source_store& store,
bool pedantic = false
);
};
}

View File

@@ -0,0 +1,122 @@
#pragma once
#include <filesystem>
#include "assets/path_id_lookups.hpp"
#include "assets/data_stores/shader_source_store.hpp"
#include "assets/data/shader_source_data.hpp"
namespace assets
{
struct glsl_parser
{
static constexpr auto name = std::string_view("glsl");
using data_type = shader_source_data;
using store_type = shader_source_store;
using lookup_type = shader_source_id_lookup;
[[nodiscard]] std::error_code prefetch(
path_id_lookups& lookups
);
[[nodiscard]] std::error_code load(
const path_id_lookups& lookups,
store_type& store,
bool pedantic = false
);
protected:
class parser_context
{
public:
parser_context(
store_type& m_store,
std::mutex& m_store_mutex
);
void operator()(lookup_type::const_pointer entry) noexcept;
protected:
void reset();
void tokenize_declarations();
[[nodiscard]] bool parse_metadata_from_tokens();
void remove_metadata_declarations();
private:
store_type* m_store;
std::mutex* m_store_mutex;
shader_source_data m_buffer{};
std::vector<std::string_view> m_value_buffer{};
std::vector<std::size_t> m_declaration_value_count_buffer{};
std::array<std::size_t, 4> m_declaration_type_index_buffer{};
};
[[nodiscard]] static std::error_code read_file(
const std::filesystem::path& filename,
std::vector<char>& source
);
static void tokenize_declarations(
std::string_view source,
std::vector<std::string_view>& value_buffer,
std::vector<std::size_t>& declaration_value_count_buffer,
std::array<std::size_t, 4>& declaration_type_index_buffer
);
static [[nodiscard]] bool parse_metadata_from_tokens(
const std::vector<std::string_view>& value_buffer,
const std::vector<std::size_t>& declaration_value_count_buffer,
const std::array<std::size_t, 4>& declaration_type_index_buffer,
shader_source_data& buffer
);
static void remove_metadata_declarations(
const std::vector<std::string_view>& value_buffer,
const std::vector<std::size_t>& declaration_value_count_buffer,
const std::array<std::size_t, 4>& declaration_type_index_buffer,
std::vector<char>& source
);
[[nodiscard]] static bool parse_geometry_declaration(
std::span<const std::string_view> values,
model_geometry::types& geometry_type
);
[[nodiscard]] static bool parse_stage_declaration(
std::span<const std::string_view> values,
shader_components::stage& stage
);
[[nodiscard]] static bool parse_components_declaration(
std::span<const std::string_view> values,
shader_source_data& buffer
);
[[nodiscard]] static bool parse_static_enable_declaration(
std::span<const std::string_view> values,
shader_source_data& buffer
);
[[nodiscard]] static bool parse_dynamic_enable_declaration(
std::span<const std::string_view> values,
shader_source_data& buffer
);
[[nodiscard]] static bool parse_component_tokens(
std::span<const std::string_view> values,
model_geometry::types geometry_type,
shader_components::flags& components
);
private:
std::vector<std::string_view> m_value_token_buffer;
std::vector<std::size_t> m_declaration_token_count_buffer;
std::array<std::size_t, 4> m_declaration_type_index_buffer;
std::vector<lookup_type::const_pointer> m_path_buffer;
};
}

View File

@@ -1,19 +0,0 @@
struct X {
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
// space stuff that has to persist
dynamic_X_buffer& buffer,
const file_dir_list& paths,
dynamic_X_store& store,
prefetch_lookup& id_lookup,
bool pedantic = false
);
}

View File

@@ -1,59 +0,0 @@
#pragma once
#include <filesystem>
#include <vector>
#include <span>
#include "assets/data_stores.hpp"
#include "assets/components/point_cloud_vertex_components.hpp"
#include "assets/data/point_cloud_data.hpp"
#include "assets/data_stores/point_cloud_store.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "glm/mat4x4.hpp"
#include "util/result.hpp"
namespace assets
{
struct kitti_loader
{
static constexpr auto name = std::string_view("kitti");
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
point_cloud_data& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
shader_source_store& store,
bool pedantic = false
);
private:
inline static constexpr auto frame_folder = "frames";
[[nodiscard]] static ztu::result<std::size_t> frame_id_from_filename(
std::string_view filename
);
[[nodiscard]] static std::error_code load_point_file(
const std::filesystem::path& filename,
dynamic_point_cloud_buffer& point_cloud
);
static void transform_point_cloud(
std::span<point_cloud_vertex_components::position> points,
const glm::mat4& pose
);
[[nodiscard]] static ztu::result<std::string_view> parent_directory(std::string_view path);
};
}

View File

@@ -0,0 +1,98 @@
#pragma once
#include <filesystem>
#include "assets/data_stores.hpp"
#include "assets/path_id_lookups.hpp"
#include "assets/components/point_cloud_vertex_components.hpp"
#include "assets/data/point_cloud_data.hpp"
#include "assets/data/pose_data.hpp"
#include "assets/data_stores/point_cloud_store.hpp"
#include "assets/data_stores/pose_list_store.hpp"
#include "assets/data_views/pose_list_view.hpp"
#include "util/result.hpp"
namespace assets
{
struct kitti_parser
{
static constexpr auto name = std::string_view("kitti");
using data_type = point_cloud_data;
using store_type = point_cloud_store;
using lookup_type = point_cloud_id_lookup;
[[nodiscard]] std::error_code prefetch(
path_id_lookups& lookups
);
[[nodiscard]] std::error_code load(
path_id_lookups& lookups,
data_stores& stores,
bool pedantic = false
);
protected:
static constexpr auto frame_folder = "frames";
class parser_context
{
public:
parser_context(
const pose_list_id_lookup& pose_list_lookup,
const pose_list_store& pose_list_store,
store_type& m_store,
std::mutex& m_store_mutex
);
void operator()(lookup_type::const_pointer entry) noexcept;
protected:
void reset();
void tokenize_declarations();
[[nodiscard]] bool parse_metadata_from_tokens();
void remove_metadata_declarations();
private:
pose_list_id_lookup const* m_pose_list_lookup;
pose_list_store const* m_pose_list_store;
store_type* m_store;
std::mutex* m_store_mutex;
data_type m_buffer{};
std::filesystem::path m_last_pose_path{};
pose_list_view m_last_pose_list{};
};
[[nodiscard]] static ztu::result<std::size_t> frame_id_from_filename(
std::string_view filename
);
[[nodiscard]] static std::error_code load_point_file(
const std::filesystem::path& filename,
data_type& point_cloud
);
static void transform_point_cloud(
z3d::array_view<point_cloud_vertex_components::position> points,
const pose_data& pose
);
[[nodiscard]] static ztu::result<std::filesystem::path> parent_directory(
const std::filesystem::path& path
);
#
[[nodiscard]] static ztu::result<std::filesystem::path> get_pose_path(
const std::filesystem::path& path
);
private:
std::vector<lookup_type::const_pointer> m_path_buffer;
};
}

View File

@@ -1,37 +0,0 @@
#pragma once
#include <filesystem>
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp"
#include "util/string_list.hpp"
#include "../data_stores"
#include "assets/data"
#include "assets/prefetch_lookups/pose_prefetch_lookup.hpp"
struct kitti_pose_loader
{
static constexpr auto name = std::string_view("kitti_pose");
[[nodiscard]] static std::error_code prefetch(
const file_dir_list& paths,
prefetch_queue& queue
);
[[nodiscard]] static std::error_code load(
dynamic_pose_buffer& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
shader_source_store& store,
bool pedantic = false
);
private:
static constexpr auto pose_filename = std::string_view{ "pose.txt" };
static std::error_code parse_pose(
std::ifstream& in,
dynamic_pose_buffer& pose
);
};

View File

@@ -0,0 +1,66 @@
#pragma once
#include <filesystem>
#include "assets/path_id_lookups.hpp"
#include "assets/data_stores/pose_list_store.hpp"
#include "assets/data/pose_list_data.hpp"
namespace assets
{
struct kitti_pose_parser
{
static constexpr auto name = std::string_view("kitti_pose");
using data_type = pose_list_data;
using store_type = pose_list_store;
using lookup_type = pose_list_id_lookup;
[[nodiscard]] std::error_code prefetch(
path_id_lookups& lookups
);
[[nodiscard]] std::error_code parse(
const path_id_lookups& lookups,
store_type& store,
bool pedantic = false
);
private:
static constexpr auto pose_filename = std::string_view{ "pose.txt" };
class parser_context
{
public:
parser_context(
store_type& m_store,
std::mutex& m_store_mutex
);
void operator()(lookup_type::const_pointer entry) noexcept;
protected:
void reset();
private:
store_type* m_store;
std::mutex* m_store_mutex;
data_type m_buffer{};
};
static std::error_code parse_file(
const std::filesystem::path& filename,
data_type &poses
);
static std::error_code parse_pose(
std::ifstream& in,
pose_data& pose
);
private:
std::vector<lookup_type::const_pointer> m_path_buffer;
};
}

View File

@@ -3,15 +3,17 @@
#include <filesystem> #include <filesystem>
#include <system_error> #include <system_error>
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp" #include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp" #include "assets/prefetch_queue.hpp"
#include "assets/data" #include "assets/data/material_data.hpp"
#include "../data_stores" #include "assets/data/material_library_data.hpp"
#include "../data_stores" #include "assets/data_stores/material_store.hpp"
#include "util/string_lookup.hpp" #include "assets/data_stores/material_library_store.hpp"
#include "util/result.hpp" #include "util/result.hpp"
namespace assets
{
namespace mtl_loader_error namespace mtl_loader_error
{ {
enum class codes { enum class codes {
@@ -54,3 +56,5 @@ protected:
ztu::string_list& texture_filenames ztu::string_list& texture_filenames
); );
}; };
}

View File

@@ -2,14 +2,15 @@
#include <filesystem> #include <filesystem>
#include "assets/data_stores.hpp"
#include "assets/prefetch_lookup.hpp" #include "assets/prefetch_lookup.hpp"
#include "assets/prefetch_queue.hpp" #include "assets/prefetch_queue.hpp"
#include "assets/data" #include "assets/data/pose_data.hpp"
#include "util/string_list.hpp"
#include "util/result.hpp" #include "util/result.hpp"
#include "assets/prefetch_lookups/pose_prefetch_lookup.hpp" #include "assets/prefetch_lookups/pose_prefetch_lookup.hpp"
namespace assets
{
struct threedtk_pose_loader struct threedtk_pose_loader
{ {
static constexpr auto name = std::string_view("3dtk_pose"); static constexpr auto name = std::string_view("3dtk_pose");
@@ -20,7 +21,7 @@ struct threedtk_pose_loader
); );
[[nodiscard]] static std::error_code load( [[nodiscard]] static std::error_code load(
dynamic_pose_buffer& buffer, pose_data& buffer,
const file_dir_list& paths, const file_dir_list& paths,
prefetch_lookup& id_lookup, prefetch_lookup& id_lookup,
shader_source_store& store, shader_source_store& store,
@@ -38,3 +39,5 @@ protected:
std::string_view filename std::string_view filename
); );
}; };
}

View File

@@ -5,12 +5,27 @@
namespace assets namespace assets
{ {
using material_id = z3d::identifier<0>; namespace identifier_uuids
using material_library_id = z3d::identifier<1>; {
using mesh_id = z3d::identifier<2>; enum : int {
using point_cloud_id = z3d::identifier<3>; material,
using pose_id = z3d::identifier<4>; material_library,
using shader_source_id = z3d::identifier<5>; mesh,
using texture_id = z3d::identifier<6>; point_cloud,
pose,
pose_list,
shader_source,
texture
};
}
using material_id = z3d::identifier<identifier_uuids::material>;
using material_library_id = z3d::identifier<identifier_uuids::material_library>;
using mesh_id = z3d::identifier<identifier_uuids::mesh>;
using point_cloud_id = z3d::identifier<identifier_uuids::point_cloud>;
using pose_id = z3d::identifier<identifier_uuids::pose>;
using pose_list_id = z3d::identifier<identifier_uuids::pose_list>;
using shader_source_id = z3d::identifier<identifier_uuids::shader_source>;
using texture_id = z3d::identifier<identifier_uuids::texture>;
} }

View File

@@ -0,0 +1,22 @@
#pragma once
#include "config/primitives.hpp"
namespace assets::model_geometry
{
enum class types : z3d::u8
{
mesh = 0,
point_cloud = 1
};
inline constexpr z3d::size count = 2;
inline constexpr auto names = z3d::array<z3d::string_view, 2>{
"mesh",
"point_cloud"
};
}

View File

@@ -0,0 +1,30 @@
#pragma once
#include "identifiers.hpp"
#include "util/file_id_lookup.hpp"
namespace assets
{
using material_id_lookup = file_id_lookup<material_id>;
using material_library_id_lookup = file_id_lookup<material_library_id>;
using mesh_id_lookup = file_id_lookup<mesh_id>;
using point_cloud_id_lookup = file_id_lookup<point_cloud_id>;
using pose_id_lookup = file_id_lookup<pose_id>;
using pose_list_id_lookup = file_id_lookup<pose_id>;
using shader_source_id_lookup = file_id_lookup<shader_source_id>;
using texture_id_lookup = file_id_lookup<texture_id>;
struct path_id_lookups
{
material_id_lookup materials;
material_library_id_lookup material_libraries;
mesh_id_lookup meshes;
point_cloud_id_lookup point_clouds;
pose_id_lookup poses;
pose_list_id_lookup pose_lists;
shader_source_id_lookup shader_sources;
texture_id_lookup textures;
};
}

View File

@@ -2,7 +2,14 @@
#include <tuple> #include <tuple>
#include <array> #include <array>
#include "glm/gtc/type_aligned.hpp" #include <vector>
#include <optional>
#include <span>
#include <string_view>
#include <expected>
#include <system_error>
#include "glm/glm.hpp"
#include "util/id_type.hpp" #include "util/id_type.hpp"
namespace z3d namespace z3d
@@ -53,10 +60,15 @@ using structure = std::tuple<Ts...>;
using string_view = std::string_view; using string_view = std::string_view;
template<typename T>
using result = std::expected<T, std::error_code>;
using vertex_index = u32; using vertex_index = u32;
using index_triangle = array<vertex_index, 3>; using index_triangle = array<vertex_index, 3>;
template<int ID> template<int ID>
using identifier = ztu::id_type<u32, ID>; using identifier = ztu::id_type<u32, ID>;
} }

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "assets/data/texture.hpp" #include "assets/data/texture.hpp"
#include "assets/data/surface_properties.hpp" #include "assets/data/uniform_surface_properties.hpp"
#include "assets/components/material_components.hpp" #include "assets/components/material_components.hpp"
#include "opengl/handles/material_handle.hpp" #include "opengl/handles/material_handle.hpp"

View File

@@ -17,7 +17,7 @@
#include "opengl/handles/shader_handle_set.hpp" #include "opengl/handles/shader_handle_set.hpp"
#include "opengl/shading/requirements/shader_requirements.hpp" #include "opengl/shading/requirements/shader_requirements.hpp"
#include "opengl/metadata/shader_set_metadata.hpp" #include "opengl/metadata/shader_set_metadata.hpp"
#include "opengl/shading/requirements/shader_set_requirements.hpp" #include "opengl/shading/requirements/shader_program_requirements.hpp"
namespace zgl namespace zgl
{ {
@@ -33,9 +33,9 @@ public:
void process(const store_type& shader_sources); void process(const store_type& shader_sources);
void get_handles( void fetch(
const assets::shader_source_store& shader_sources, const assets::shader_source_store& shader_sources,
std::span<const shading::shader_set_requirements> requirements, std::span<const shading::shader_program_requirements> requirements,
std::span<shader_set_metadata> metadata, std::span<shader_set_metadata> metadata,
std::span<shader_handle_set> shader_sets std::span<shader_handle_set> shader_sets
); );
@@ -56,7 +56,7 @@ protected:
std::vector<entry_type> m_shader_lookup{}; std::vector<entry_type> m_shader_lookup{};
private: private:
std::vector<shading::shader_source_requirements> m_source_requirement_buffer{}; std::vector<shading::shader_requirements> m_source_requirement_buffer{};
std::vector<preprocessed_shader_source_metadata> m_preprocessed_shader_source_metadata_buffer{}; std::vector<preprocessed_shader_source_metadata> m_preprocessed_shader_source_metadata_buffer{};
std::vector<const char*> m_source_strings_buffer{}; std::vector<const char*> m_source_strings_buffer{};
}; };

View File

@@ -21,7 +21,7 @@ public:
void process(const store_type& shader_sources); void process(const store_type& shader_sources);
void get_handles( void fetch(
const assets::shader_source_store& shader_sources, const assets::shader_source_store& shader_sources,
std::span<const shading::shader_program_requirements> requirements, std::span<const shading::shader_program_requirements> requirements,
std::span<shader_program_metadata> metadata, std::span<shader_program_metadata> metadata,
@@ -41,7 +41,7 @@ protected:
std::vector<entry_type> m_shader_program_lookup; std::vector<entry_type> m_shader_program_lookup;
private: private:
std::vector<shading::shader_set_requirements> m_shader_requirements_buffer; std::vector<shading::shader_program_requirements> m_shader_requirements_buffer;
std::vector<shader_set_metadata> m_shader_metadata_buffer; std::vector<shader_set_metadata> m_shader_metadata_buffer;
std::vector<shader_handle_set> shader_set_buffer; std::vector<shader_handle_set> shader_set_buffer;
}; };

View File

@@ -9,7 +9,7 @@
#include "util/string_lookup.hpp" #include "util/string_lookup.hpp"
#include "opengl/metadata/shader_source_metadata.hpp" #include "opengl/metadata/shader_source_metadata.hpp"
#include "opengl/shading/requirements/shader_source_requirements.hpp" #include "opengl/shading/requirements/shader_requirements.hpp"
#include "opengl/metadata/preprocessed_shader_source_metadata.hpp" #include "opengl/metadata/preprocessed_shader_source_metadata.hpp"
#include "assets/data_stores/shader_source_store.hpp" #include "assets/data_stores/shader_source_store.hpp"
@@ -30,64 +30,21 @@ public:
void process(const store_type& shader_sources); void process(const store_type& shader_sources);
void get_shader_sources( void fetch(
const assets::shader_source_store& shader_sources, const assets::shader_source_store& shader_sources,
std::span<const shading::shader_source_requirements> requirements, std::span<const shading::shader_requirements> requirements,
std::span<preprocessed_shader_source_metadata> metadata, std::span<preprocessed_shader_source_metadata> metadata,
std::vector<const char*>& shader_strings std::vector<const char*>& shader_strings
); );
protected: protected:
void tokenize_declarations(std::string_view source);
std::optional<shader_source_metadata> parse_metadata_from_tokens();
[[nodiscard]] static bool parse_stage_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
);
[[nodiscard]] static bool parse_geometry_declaration(
std::span<const std::string_view> tokens,
shader_source_metadata& metadata
);
[[nodiscard]] static bool parse_features_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
);
[[nodiscard]] static bool parse_static_enable_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
);
[[nodiscard]] static bool parse_dynamic_enable_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
);
template<typename T>
static void parse_feature_tokens(
std::span<const std::string_view> values,
const ztu::string_lookup<T>& feature_lookup,
T& features
);
static void get_define_strings( static void get_define_strings(
shading::model_geometry::types geometry, assets::model_geometry::types geometry_type,
shading::features::generic::type features, assets::shader_components::flags components,
shading::features::generic::type& feature_count, assets::shader_components::flags& component_count,
std::vector<const char*>& defines std::vector<const char*>& defines
); );
std::vector<entry_type> m_shader_source_lookup; std::vector<entry_type> m_shader_source_lookup;
private:
std::vector<std::string_view> m_value_token_buffer;
std::vector<std::size_t> m_declaration_token_count_buffer;
std::array<std::size_t, 4> m_declaration_type_index_buffer;
}; };
} }

View File

@@ -1,9 +1,7 @@
#pragma once #pragma once
#include "GL/glew.h" #include "GL/glew.h"
#include "opengl/shader_uniform.hpp" #include "opengl/shading/uniform.hpp"
#include "opengl/shader_uniform.hpp"
#include "util/uix.hpp" #include "util/uix.hpp"
#include <span> #include <span>
@@ -17,12 +15,12 @@ struct shader_program_handle
inline void bind() const; inline void bind() const;
static void unbind(); static void unbind();
template<shader_uniform::info_type VariableInfo, typename T> template<shading::uniform U, typename T>
void set_uniform(const T& value) const; void set_uniform(const T& value) const;
[[nodiscard]] attribute_support_type check_attribute_support(std::span<const shader_uniform> attributes) const; /*[[nodiscard]] attribute_support_type check_attribute_support(std::span<const shader_uniform> attributes) const;
[[nodiscard]] uniform_support_type check_uniform_support(std::span<const shader_uniform> uniforms) const; [[nodiscard]] uniform_support_type check_uniform_support(std::span<const shader_uniform> uniforms) const;*/
[[nodiscard]] bool valid() const; [[nodiscard]] bool valid() const;

View File

@@ -7,9 +7,9 @@ namespace zgl
struct material_metadata struct material_metadata
{ {
texture_handle ambient_color_texture_handle; texture_handle specular_filter_texture_handle;
texture_handle diffuse_color_texture_handle; texture_handle diffuse_filter_texture_handle;
texture_handle specular_color_texture_handle; texture_handle specular_filter_texture_handle;
texture_handle shininess_texture_handle; texture_handle shininess_texture_handle;
texture_handle alpha_texture_handle; texture_handle alpha_texture_handle;
texture_handle bump_texture_handle; texture_handle bump_texture_handle;

View File

@@ -1,13 +1,15 @@
#pragma once #pragma once
#include "opengl/shading/features/generic_features.hpp" #include "assets/components/shader_components.hpp"
namespace zgl namespace zgl
{ {
struct preprocessed_shader_source_metadata struct preprocessed_shader_source_metadata
{ {
shading::features::generic::type static_enabled{}; assets::shader_components::flags static_enabled{};
shading::features::generic::type dynamic_enable{}; assets::shader_components::flags dynamic_enable{};
shading::features::generic::type string_count{}; // Use same integer type as it guarantees good alignment.
// (even an unsigned byte should hold the maximum number of defines.)
assets::shader_components::flags string_count{};
}; };
} }

View File

@@ -1,16 +1,17 @@
#pragma once #pragma once
#include "opengl/shading/model_geometry.hpp" #include "assets/model_geometry.hpp"
#include "opengl/shading/shader_stage.hpp" #include "assets/components/shader_components.hpp"
#include "opengl/shading/features/generic_features.hpp"
namespace zgl namespace zgl
{ {
struct shader_metadata struct shader_metadata
{ {
shading::model_geometry::types geometry; assets::model_geometry::types geometry_type;
shading::stage::types stage; assets::shader_components::stage stage;
shading::features::generic::type static_enabled{}; assets::shader_components::flags static_enabled{};
shading::features::generic::type dynamic_enable{}; assets::shader_components::flags dynamic_enable{};
}; };
} }

View File

@@ -1,15 +1,16 @@
#pragma once #pragma once
#include "opengl/shading/model_geometry.hpp" #include "assets/model_geometry.hpp"
#include "opengl/shading/features/generic_features.hpp" #include "assets/components/shader_components.hpp"
namespace zgl { namespace zgl
{
struct shader_program_metadata struct shader_program_metadata
{ {
shading::model_geometry::types geometry; assets::model_geometry::types geometry_type;
shading::features::generic::type static_enabled{}; assets::shader_components::stage static_enabled{};
shading::features::generic::type dynamic_enable{}; assets::shader_components::stage dynamic_enable{};
}; };
} }

View File

@@ -1,12 +1,12 @@
#pragma once #pragma once
#include "opengl/shading/features/generic_features.hpp" #include "assets/components/shader_components.hpp"
namespace zgl namespace zgl
{ {
struct shader_set_metadata struct shader_set_metadata
{ {
shading::features::generic::type static_enabled{}; assets::shader_components::flags static_enabled{};
shading::features::generic::type dynamic_enable{}; assets::shader_components::flags dynamic_enable{};
}; };
} }

View File

@@ -1,91 +1,18 @@
#pragma once #pragma once
#include <limits> #include "assets/model_geometry.hpp"
#include <utility> #include "assets/components/shader_components.hpp"
#include "../shading/model_geometry.hpp"
#include "../shading/shader_stage.hpp"
#include "../shading/features/mesh_features.hpp"
#include "../shading/features/point_cloud_features.hpp"
#include "../shading/features/generic_features.hpp"
#include <algorithm>
// TODO move implementation to .ipp file
namespace zgl namespace zgl
{ {
template<typename T>
struct shader_features_set
{
T features, static_enable, dynamic_enable;
template<typename U>
[[nodiscard]] shader_features_set<U> cast() const noexcept
{
return {
.features = static_cast<U>(features),
.static_enable = static_cast<U>(static_enable),
.dynamic_enable = static_cast<U>(dynamic_enable)
};
}
// TODO this may not compile
[[nodiscard]] bool operator==(const shader_features_set& other) const noexcept = default;
};
struct shader_source_metadata struct shader_source_metadata
{ {
union combined_feature_set_type { assets::model_geometry::types geometry_type;
shader_features_set<shading::features::mesh::flags> mesh; assets::shader_components::stage stage;
shader_features_set<shading::features::point_cloud::flags> point_cloud; assets::shader_components::flags components{};
}; assets::shader_components::flags static_enable{};
assets::shader_components::flags dynamic_enable{};
using generic_feature_set_type = shader_features_set<shading::features::generic::type>;
shading::model_geometry::types geometry;
combined_feature_set_type feature_set;
shading::stage::types stage;
[[nodiscard]] generic_feature_set_type generic_feature_set() const noexcept
{
switch (geometry)
{
case shading::model_geometry::types::mesh:
return feature_set.mesh.cast<shading::features::generic::type>();
case shading::model_geometry::types::point_cloud:
return feature_set.point_cloud.cast<shading::features::generic::type>();
default:
std::unreachable();
}
}
void from_generic_feature_set(const generic_feature_set_type& generic_feature_set) noexcept
{
switch (geometry)
{
case shading::model_geometry::types::mesh:
feature_set.mesh = generic_feature_set.cast<shading::features::mesh::flags>();
case shading::model_geometry::types::point_cloud:
feature_set.point_cloud = generic_feature_set.cast<shading::features::point_cloud::flags>();
}
std::unreachable();
}
bool operator==(const shader_source_metadata& other) const noexcept
{
if (this->stage != other.stage)
{
return false;
}
if (this->geometry != other.geometry)
{
return false;
}
return this->generic_feature_set() == other.generic_feature_set();
}
}; };
} }

View File

@@ -21,16 +21,18 @@ struct type
namespace indices namespace indices
{ {
using type = ztu::u8; enum : z3d::size
constexpr inline type face = 0; {
constexpr inline type line = 1; face,
constexpr inline type point = 2; line,
constexpr inline type luminance = 3; point,
constexpr inline type color = 4; luminance,
constexpr inline type alpha = 5; color,
constexpr inline type lighting = 6; alpha,
constexpr inline type texture = 7; lighting,
constexpr inline type uniform_color = 8; texture,
uniform_color
};
} }
enum class flags : std::uint16_t enum class flags : std::uint16_t

View File

@@ -23,14 +23,16 @@ struct type
namespace indices namespace indices
{ {
using type = ztu::u8; enum : z3d::size
constexpr inline type square = 0; {
constexpr inline type lighting = 1; square,
constexpr inline type luminance = 2; lighting,
constexpr inline type color = 3; luminance,
constexpr inline type alpha = 4; color,
constexpr inline type uniform_color = 5; alpha,
constexpr inline type rainbow = 6; uniform_color,
rainbow
};
} }
enum class flags : std::uint8_t enum class flags : std::uint8_t

View File

@@ -1,57 +1,14 @@
#pragma once #pragma once
#include "opengl/shading/model_geometry.hpp" #include "assets/model_geometry.hpp"
#include "opengl/shading/features/generic_features.hpp" #include "assets/components/shader_components.hpp"
namespace zgl::shading namespace zgl::shading
{ {
struct shader_program_requirements struct shader_program_requirements
{ {
model_geometry::types geometry; assets::model_geometry::types geometry_type;
features::generic::type features; assets::shader_components::flags components{};
}; };
} }
/*
struct shader_program_metadata
{
using generic_feature_type = std::common_type_t<
std::underlying_type_t<features::mesh::flags>,
std::underlying_type_t<features::point_cloud::flags>
>;
static constexpr auto geometry_bits = static_cast<std::size_t>(std::bit_width(geometry::names.size()));
static constexpr auto feature_bits = sizeof(generic_feature_type) * 8 - geometry_bits;
explicit shader_program_metadata(const features::mesh::flags static_enabled, const features::mesh::flags dynamic_enable) :
shader_program_metadata(
geometry::types::mesh,
static_cast<generic_feature_type>(static_enabled),
static_cast<generic_feature_type>(dynamic_enable)
) {}
explicit shader_program_metadata(const features::point_cloud::flags static_enabled, const features::point_cloud::flags dynamic_enable) :
shader_program_metadata(
geometry::types::point_cloud,
static_cast<generic_feature_type>(static_enabled),
static_cast<generic_feature_type>(dynamic_enable)
) {}
shader_program_metadata(const geometry::types geometry_type, const generic_feature_type static_enabled, generic_feature_type dynamic_enable) :
m_geometry_type{ geometry_type }, m_static_enabled{ static_enabled }, m_dynamic_enable{ dynamic_enable } {}
[[nodiscard]] auto operator<=>(const shader_program_metadata& other) const noexcept
{
return (
std::tie(this->m_geometry_type, std::popcount(this->m_static_enabled), std::popcount(this->m_dynamic_enable)) <=>
std::tie(other.m_geometry_type, std::popcount(other.m_static_enabled), std::popcount(other.m_dynamic_enable))
);
}
[[nodiscard]] bool operator==(const shader_program_metadata& other) const noexcept = default;
geometry::types m_geometry_type : geometry_bits;
generic_feature_type m_static_enabled : feature_bits;
generic_feature_type m_dynamic_enable;
};*/

View File

@@ -1,8 +1,16 @@
#pragma once #pragma once
#include "shader_source_requirements.hpp" #include "assets/model_geometry.hpp"
#include "assets/components/shader_components.hpp"
namespace zgl::shading namespace zgl::shading
{ {
using shader_requirements = shader_source_requirements;
struct shader_requirements
{
assets::model_geometry::types geometry_type;
assets::shader_components::stage stage;
assets::shader_components::flags components{};
};
} }

View File

@@ -1,13 +0,0 @@
#pragma once
#include "opengl/shading/features/generic_features.hpp"
namespace zgl::shading
{
struct shader_set_requirements
{
model_geometry::types geometry;
features::generic::type features;
};
}

View File

@@ -1,16 +0,0 @@
#pragma once
#include "opengl/shading/model_geometry.hpp"
#include "opengl/shading/shader_stage.hpp"
#include "opengl/shading/features/generic_features.hpp"
namespace zgl::shading
{
struct shader_source_requirements
{
model_geometry::types geometry;
stage::types stage;
features::generic::type features;
};
}

View File

@@ -11,34 +11,34 @@ namespace zgl::shading::mesh_sampler_uniforms
enum class flags : std::uint16_t enum class flags : std::uint16_t
{ {
none = 0, none = 0,
ambient_color_texture = 1 << 0, specular_filter_texture = 1 << 0,
diffuse_color_texture = 1 << 1, diffuse_filter_texture = 1 << 1,
specular_color_texture = 1 << 2, specular_filter_texture = 1 << 2,
shininess_texture = 1 << 3, shininess_texture = 1 << 3,
alpha_texture = 1 << 4, alpha_texture = 1 << 4,
bump_texture = 1 << 5 bump_texture = 1 << 5
}; };
constexpr inline auto ambient_color_texture = sampler_uniform{ 0 }; constexpr inline auto specular_filter_texture = sampler_uniform{ 0 };
constexpr inline auto diffuse_color_texture = sampler_uniform{ 1 }; constexpr inline auto diffuse_filter_texture = sampler_uniform{ 1 };
constexpr inline auto specular_color_texture = sampler_uniform{ 2 }; constexpr inline auto specular_filter_texture = sampler_uniform{ 2 };
constexpr inline auto shininess_texture = sampler_uniform{ 3 }; constexpr inline auto shininess_texture = sampler_uniform{ 3 };
constexpr inline auto alpha_texture = sampler_uniform{ 4 }; constexpr inline auto alpha_texture = sampler_uniform{ 4 };
constexpr inline auto bump_texture = sampler_uniform{ 5 }; constexpr inline auto bump_texture = sampler_uniform{ 5 };
constexpr inline auto all = std::array{ constexpr inline auto all = std::array{
ambient_color_texture, specular_filter_texture,
diffuse_color_texture, diffuse_filter_texture,
specular_color_texture, specular_filter_texture,
shininess_texture, shininess_texture,
alpha_texture, alpha_texture,
bump_texture bump_texture
}; };
constexpr inline auto names = std::array{ constexpr inline auto names = std::array{
"ambient_color_texture", "specular_filter_texture",
"diffuse_color_texture", "diffuse_filter_texture",
"specular_color_texture", "specular_filter_texture",
"shininess_texture", "shininess_texture",
"alpha_texture", "alpha_texture",
"bump_texture" "bump_texture"

View File

@@ -0,0 +1,104 @@
#pragma once
#include <unordered_map>
#include <filesystem>
#include <ranges>
#include <vector>
template<typename ID>
class file_id_lookup
{
public:
using container_type = std::unordered_map<std::filesystem::path, ID>;
using key_type = typename container_type::key_type;
using mapped_type = typename container_type::mapped_type;
using value_type = typename container_type::value_type;
using size_type = typename container_type::size_type;
using difference_type = typename container_type::difference_type;
using hasher = typename container_type::hasher;
using key_equal = typename container_type::key_equal;
using allocator_type = typename container_type::allocator_type;
using reference = typename container_type::reference;
using const_reference = typename container_type::const_reference;
using pointer = typename container_type::pointer;
using const_pointer = typename container_type::const_pointer;
using iterator = typename container_type::iterator;
using const_iterator = typename container_type::const_iterator;
using local_iterator = typename container_type::local_iterator;
using const_local_iterator = typename container_type::const_local_iterator;
using node_type = typename container_type::node_type;
using insert_return_type = typename container_type::insert_return_type;
[[nodiscard]] iterator begin() noexcept { return m_container.begin(); }
[[nodiscard]] const_iterator begin() const noexcept { return m_container.begin(); }
[[nodiscard]] const_iterator cbegin() const noexcept { return m_container.cbegin(); }
[[nodiscard]] iterator end() noexcept { return m_container.end(); }
[[nodiscard]] const_iterator end() const noexcept { return m_container.end(); }
[[nodiscard]] const_iterator cend() const noexcept { return m_container.cend(); }
[[nodiscard]] bool empty() const noexcept { return m_container.empty(); }
[[nodiscard]] size_type size() const noexcept { return m_container.size(); }
[[nodiscard]] size_type max_size() const noexcept { return m_container.max_size(); }
void by_extension(
const std::string_view extension,
std::vector<const_pointer>& dst
) const {
std::ranges::copy(
m_container |
std::views::filter(
[&](const value_type& entry)
{
return entry.first.extension() == extension;
}
) |
std::views::transform(
[&](const value_type& entry)
{
return &entry;
}
),
std::back_inserter(dst)
);
}
std::pair<iterator, bool> try_emplace(const key_type& path)
{
auto it = m_container.find(path);
const auto is_new = it == m_container.end();
if (not is_new)
{
it = m_container.emplace_hint(it, path, ID::next());
}
return { it, is_new };
}
[[nodiscard]] bool contains(const key_type& key) const { return m_container.contains(key); }
[[nodiscard]] size_type count(const key_type& key) const { return m_container.count(key); }
[[nodiscard]] iterator find(const key_type& key) { return m_container.find(key); }
[[nodiscard]] const_iterator find(const key_type& key) const { return m_container.find(key); }
iterator erase(iterator pos) { return m_container.erase(pos); }
iterator erase(const_iterator pos) { return m_container.erase(pos); }
iterator erase(const_iterator first, const_iterator last) { return m_container.erase(first, last); }
size_type erase(const key_type& key) { return m_container.erase(key); }
void clear() noexcept { m_container.clear(); }
private:
static auto extension_filter(const std::string_view& extension)
{
return std::views::filter(
[extension](const key_type& path)
{
return path.extension() == extension;
}
);
}
container_type m_container;
};

View File

@@ -39,9 +39,9 @@ layout (std140, binding = 1) uniform Lighting
layout (location = 8) uniform vec3 ambient_light_color; layout (location = 8) uniform vec3 ambient_light_color;
}; };
uniform sampler2D ambient_color_texture; uniform sampler2D specular_filter_texture;
uniform sampler2D diffuse_color_texture; uniform sampler2D diffuse_filter_texture;
uniform sampler2D specular_color_texture; uniform sampler2D specular_filter_texture;
uniform sampler2D shininess_texture; uniform sampler2D shininess_texture;
uniform sampler2D alpha_texture; uniform sampler2D alpha_texture;
uniform sampler2D bump_texture; uniform sampler2D bump_texture;

View File

@@ -1,27 +1,39 @@
#ifndef INCLUDE_DYNAMIC_MATERIAL_DATA_IMPLEMENTATION #ifndef INCLUDE_MATERIAL_DATA_IMPLEMENTATION
# error Never include this file directly include 'dynamic_material_buffer.hpp' # error Never include this file directly include 'material_data.hpp'
#endif #endif
inline std::optional<assets::material_components::ambient_filter>& assets::material_data::specular_filter()
{
return std::get<material_components::indices::ambient_filter>(components);
}
inline std::optional<assets::material_components::diffuse_filter>& assets::material_data::diffuse_filter()
{
return std::get<material_components::indices::diffuse_filter>(components);
}
inline std::optional<assets::material_components::specular_filter>& assets::material_data::specular_filter()
{
return std::get<material_components::indices::specular_filter>(components);
}
inline std::optional<assets::material_components::shininess>& assets::material_data::shininess()
{
return std::get<material_components::indices::shininess>(components);
}
inline std::optional<assets::material_components::alpha>& assets::material_data::alpha()
{
return std::get<material_components::indices::alpha>(components);
}
inline std::optional<assets::material_components::surface_properties>& assets::material_data::surface_properties() inline std::optional<assets::material_components::ambient_filter_texture>& assets::material_data::specular_filter_texture_id()
{ {
return std::get<material_components::indices::surface_properties>(components); return std::get<material_components::indices::ambient_filter_texture>(components);
} }
inline std::optional<assets::material_components::transparency>& assets::material_data::transparency() inline std::optional<assets::material_components::diffuse_filter_texture>& assets::material_data::diffuse_filter_texture_id()
{ {
return std::get<material_components::indices::transparency>(components); return std::get<material_components::indices::diffuse_filter_texture>(components);
} }
inline std::optional<assets::material_components::ambient_color_texture>& assets::material_data::ambient_color_texture_id() inline std::optional<assets::material_components::specular_filter_texture>& assets::material_data::specular_filter_texture_id()
{ {
return std::get<material_components::indices::ambient_color_texture>(components); return std::get<material_components::indices::specular_filter_texture>(components);
}
inline std::optional<assets::material_components::diffuse_color_texture>& assets::material_data::diffuse_color_texture_id()
{
return std::get<material_components::indices::diffuse_color_texture>(components);
}
inline std::optional<assets::material_components::specular_color_texture>& assets::material_data::specular_color_texture_id()
{
return std::get<material_components::indices::specular_color_texture>(components);
} }
inline std::optional<assets::material_components::shininess_texture>& assets::material_data::shininess_texture_id() inline std::optional<assets::material_components::shininess_texture>& assets::material_data::shininess_texture_id()
{ {
@@ -36,29 +48,40 @@ inline std::optional<assets::material_components::bump_texture>& assets::materia
return std::get<material_components::indices::bump_texture(components); return std::get<material_components::indices::bump_texture(components);
} }
inline const std::optional<assets::material_components::surface_properties>& assets::material_data::surface_properties() const inline const std::optional<assets::material_components::ambient_filter>& assets::material_data::specular_filter() const
{ {
return std::get<material_components::indices::surface_properties>(components); return std::get<material_components::indices::ambient_filter>(components);
}
inline const std::optional<assets::material_components::diffuse_filter>& assets::material_data::diffuse_filter() const
{
return std::get<material_components::indices::diffuse_filter>(components);
}
inline const std::optional<assets::material_components::specular_filter>& assets::material_data::specular_filter() const
{
return std::get<material_components::indices::specular_filter>(components);
}
inline const std::optional<assets::material_components::shininess>& assets::material_data::shininess() const
{
return std::get<material_components::indices::shininess>(components);
}
inline const std::optional<assets::material_components::alpha>& assets::material_data::alpha() const
{
return std::get<material_components::indices::alpha>(components);
} }
inline const std::optional<assets::material_components::transparency>& assets::material_data::transparency() const inline const std::optional<assets::material_components::ambient_filter_texture>& assets::material_data::specular_filter_texture_id() const
{ {
return std::get<material_components::indices::transparency>(components); return std::get<material_components::indices::ambient_filter_texture>(components);
} }
inline const std::optional<assets::material_components::ambient_color_texture>& assets::material_data::ambient_color_texture_id() const inline const std::optional<assets::material_components::diffuse_filter_texture>& assets::material_data::diffuse_filter_texture_id() const
{ {
return std::get<material_components::indices::ambient_color_texture>(components); return std::get<material_components::indices::diffuse_filter_texture>(components);
} }
inline const std::optional<assets::material_components::diffuse_color_texture>& assets::material_data::diffuse_color_texture_id() const inline const std::optional<assets::material_components::specular_filter_texture>& assets::material_data::specular_filter_texture_id() const
{ {
return std::get<material_components::indices::diffuse_color_texture>(components); return std::get<material_components::indices::specular_filter_texture>(components);
}
inline const std::optional<assets::material_components::specular_color_texture>& assets::material_data::specular_color_texture_id() const
{
return std::get<material_components::indices::specular_color_texture>(components);
} }
inline const std::optional<assets::material_components::shininess_texture>& assets::material_data::shininess_texture_id() const inline const std::optional<assets::material_components::shininess_texture>& assets::material_data::shininess_texture_id() const
@@ -76,17 +99,6 @@ inline const std::optional<assets::material_components::bump_texture>& assets::m
return std::get<material_components::indices::bump_texture>(components); return std::get<material_components::indices::bump_texture>(components);
} }
inline assets::material_components::surface_properties& assets::material_data::initialized_surface_properties()
{
auto& surface_properties_opt = surface_properties();
if (not surface_properties_opt)
{
surface_properties_opt = material_components::surface_properties{};
}
return *surface_properties_opt;
}
inline void assets::material_data::clear() inline void assets::material_data::clear()
{ {
clear_components(); clear_components();

View File

@@ -230,13 +230,13 @@ assets::detail::generic_point_cloud_store<Ts...>::array_counts() const
template<typename... Ts> template<typename... Ts>
typename assets::detail::generic_point_cloud_store<Ts...>::id_type assets::detail::generic_point_cloud_store<Ts...>::add( typename assets::detail::generic_point_cloud_store<Ts...>::id_type assets::detail::generic_point_cloud_store<Ts...>::add(
const point_cloud_data& point_cloud const id_type id,
const data_type& point_cloud
) { ) {
const auto id = id_type{ m_next_data_id.index++ };
m_ids.push_back(id); m_ids.push_back(id);
const auto& vertices = point_cloud.vertices; const auto& vertices = point_cloud.component_arrays;
auto component_flags = component_flag_type{}; auto component_flags = component_flag_type{};
auto min_component_count = count_type{}; auto min_component_count = count_type{};
@@ -403,14 +403,3 @@ typename assets::detail::generic_point_cloud_store<Ts...>::const_iterator assets
{ {
return const_cast<const generic_point_cloud_store*>(this)->end(); return const_cast<const generic_point_cloud_store*>(this)->end();
} }
template<typename... Ts>
typename assets::detail::generic_point_cloud_store<Ts...>::view_type assets::detail::generic_point_cloud_store<Ts...>::view()
{
return { begin(), end() };
}
template<typename... Ts>
typename assets::detail::generic_point_cloud_store<Ts...>::const_view_type assets::detail::generic_point_cloud_store<Ts...>::view() const
{
return { begin(), end() };
}

View File

@@ -0,0 +1,289 @@
#ifndef INCLUDE_POSE_LIST_STORE_IMPLEMENTATION
# error Never include this file directly include 'pose_list_store.hpp'
#endif
#include <vector>
#include <span>
#include <tuple>
#include <cstddef>
#include <type_traits>
#include <algorithm>
template<typename Char>
assets::pose_list_store_iterator<Char>::pose_list_store_iterator(
id_iterator_type ids,
pose_iterator_type poses,
length_iterator_type lengths,
std::size_t index,
const offset_type& offset
) :
m_ids{ ids },
m_poses{ poses },
m_lengths{ lengths },
m_index{ index },
m_offset{ offset } {}
template<typename Char>
typename assets::pose_list_store_iterator<Char>::reference assets::pose_list_store_iterator<Char>::operator*() const {
return dereference(std::index_sequence_for<Char>{});
}
template<typename Char>
assets::pose_list_store_iterator<Char>& assets::pose_list_store_iterator<Char>::operator++() {
adjust_offsets(std::index_sequence_for<Char>{}, 1);
++m_index;
return *this;
}
template<typename Char>
assets::pose_list_store_iterator<Char> assets::pose_list_store_iterator<Char>::operator++(int) {
pose_list_store_iterator tmp = *this;
++(*this);
return tmp;
}
template<typename Char>
assets::pose_list_store_iterator<Char>& assets::pose_list_store_iterator<Char>::operator--() {
adjust_offsets(std::index_sequence_for<Char>{}, -1);
--m_index;
return *this;
}
template<typename Char>
assets::pose_list_store_iterator<Char> assets::pose_list_store_iterator<Char>::operator--(int) {
auto tmp = *this;
--(*this);
return tmp;
}
template<typename Char>
assets::pose_list_store_iterator<Char>& assets::pose_list_store_iterator<Char>::operator+=(const difference_type n)
{
adjust_offsets(std::index_sequence_for<Char>{}, n);
m_index += n;
return *this;
}
template<typename Char>
assets::pose_list_store_iterator<Char>& assets::pose_list_store_iterator<Char>::operator-=(const difference_type n)
{
return (*this) += -n;
}
template<typename Char>
assets::pose_list_store_iterator<Char> assets::pose_list_store_iterator<Char>::operator+(const difference_type n) const
{
auto tmp = *this;
return tmp += n; // TODO clion says n is unused
}
template<typename Char>
assets::pose_list_store_iterator<Char> assets::pose_list_store_iterator<Char>::operator-(const difference_type n) const
{
auto tmp = *this;
return tmp -= n; // TODO clion says n is unused
}
template<typename Char>
typename assets::pose_list_store_iterator<Char>::difference_type
assets::pose_list_store_iterator<Char>::operator-(const pose_list_store_iterator& other) const
{
return static_cast<difference_type>(m_index) - static_cast<difference_type>(other.m_index);
}
template<typename Char>
typename assets::pose_list_store_iterator<Char>::reference assets::pose_list_store_iterator<Char>::operator[](
const difference_type n
) const {
return *(*this + n);
}
template<typename Char>
bool assets::pose_list_store_iterator<Char>::operator==(const pose_list_store_iterator& other) const
{
return m_ids == other.m_ids and m_index == other.m_index;
}
template<typename Char>
bool assets::pose_list_store_iterator<Char>::operator!=(const pose_list_store_iterator& other) const
{
return not (*this == other);
}
template<typename Char>
bool assets::pose_list_store_iterator<Char>::operator<(const pose_list_store_iterator& other) const
{
return m_index < other.m_index;
}
template<typename Char>
bool assets::pose_list_store_iterator<Char>::operator<=(const pose_list_store_iterator& other) const
{
return m_index <= other.m_index;
}
template<typename Char>
bool assets::pose_list_store_iterator<Char>::operator>(const pose_list_store_iterator& other) const
{
return m_index > other.m_index;
}
template<typename Char>
bool assets::pose_list_store_iterator<Char>::operator>=(const pose_list_store_iterator& other) const
{
return m_index >= other.m_index;
}
template<typename Char>
void assets::pose_list_store_iterator<Char>::calc_offset(
difference_type n
) {
const auto negative = n < difference_type{ 0 };
const auto positive = n > difference_type{ 0 };
const auto step = difference_type{ positive } - difference_type{ negative };
n = negative ? -n : n;
// TODO template optimize for single steps
while (n--)
{
const auto& count = m_lengths[m_index];
m_offset += step * count;
m_index += step;
}
}
template<typename Char>
typename assets::pose_list_store_iterator<Char>::reference
assets::pose_list_store_iterator<Char>::dereference() const
{
return std::make_pair(
m_ids[m_index],
pose_list_view{
m_poses[m_offset],
m_lengths[m_index]
}
);
}
assets::pose_list_store::id_type assets::pose_list_store::add(
const pose_list_id id,
const pose_list_data& pose_list
) {
m_ids.push_back(id);
m_poses.insert(m_poses.end(), pose_list.begin(), pose_list.end());
m_lengths.push_back(pose_list.size());
return id;
}
std::pair<assets::pose_list_store::iterator_type, bool> assets::pose_list_store::find(id_type id)
{
const auto id_it = std::ranges::upper_bound(m_ids, id);
const auto match = (
id_it != m_ids.begin() and
*std::prev(id_it) == id
);
const auto index = id_it - m_ids.begin() - match;
auto it = begin();
it += index;
return { it, match };
}
std::pair<assets::pose_list_store::const_iterator, bool> assets::pose_list_store::find(id_type id) const
{
const auto id_it = std::ranges::upper_bound(m_ids, id);
const auto match = (
id_it != m_ids.begin() and
*std::prev(id_it) == id
);
const auto index = id_it - m_ids.begin() - match;
auto it = begin();
it += index;
return { it, match };
}
void assets::pose_list_store::remove(const iterator_type& it)
{
m_ids.erase(m_ids.begin() + it.m_index);
const auto begin = m_poses.begin() + it.m_offset;
const auto end = begin + it.m_lengths[it.m_index];
m_poses.erase(begin, end);
m_lengths.erase(m_lengths.begin() + it.m_index);
}
void assets::pose_list_store::clear()
{
m_ids.clear();
m_poses.clear();
m_lengths.clear();
}
assets::pose_list_store::iterator_type assets::pose_list_store::begin()
{
return iterator_type{
m_ids.data(),
m_poses.data(),
m_lengths.data(),
0,
{}
};
}
assets::pose_list_store::iterator_type assets::pose_list_store::end()
{
return iterator_type{
m_ids.data(),
m_poses.data(),
m_lengths.data(),
m_lengths.size(),
m_poses.size()
};
}
assets::pose_list_store::const_iterator assets::pose_list_store::begin() const
{
return const_iterator{
m_ids.data(),
m_poses.data(),
m_lengths.data(),
0,
{}
};
}
assets::pose_list_store::const_iterator assets::pose_list_store::end() const
{
return const_iterator{
m_ids.data(),
m_poses.data(),
m_lengths.data(),
m_lengths.size(),
m_poses.size()
};
}
assets::pose_list_store::const_iterator assets::pose_list_store::cbegin() const
{
return this->begin();
}
assets::pose_list_store::const_iterator assets::pose_list_store::cend() const
{
return this->end();
}

View File

@@ -9,17 +9,21 @@
#include <type_traits> #include <type_traits>
#include <algorithm> #include <algorithm>
#include "opengl/metadata/shader_source_metadata.hpp"
template<typename Char> template<typename Char>
assets::shader_source_store_iterator<Char>::shader_source_store_iterator( assets::shader_source_store_iterator<Char>::shader_source_store_iterator(
id_iterator_type ids, id_iterator_type ids,
string_iterator_type strings, string_iterator_type strings,
length_iterator_type lengths, length_iterator_type lengths,
metadata_iterator_type metadata,
std::size_t index, std::size_t index,
const offset_type& offset const offset_type& offset
) : ) :
m_ids{ ids }, m_ids{ ids },
m_strings{ strings }, m_strings{ strings },
m_lengths{ lengths }, m_lengths{ lengths },
m_metadata{ metadata },
m_index{ index }, m_index{ index },
m_offset{ offset } {} m_offset{ offset } {}
@@ -156,25 +160,23 @@ void assets::shader_source_store_iterator<Char>::calc_offset(
} }
template<typename Char> template<typename Char>
template<std::size_t... Is>
typename assets::shader_source_store_iterator<Char>::reference typename assets::shader_source_store_iterator<Char>::reference
assets::shader_source_store_iterator<Char>::dereference(std::index_sequence<Is...>) const assets::shader_source_store_iterator<Char>::dereference() const
{ {
return std::make_pair( return std::make_pair(
m_ids[m_index], m_ids[m_index],
shader_source_view( shader_source_view{
m_strings[m_offset], .source = { m_strings[m_offset], m_lengths[m_index] },
m_lengths[m_index] .meta = m_metadata[m_index]
) }
); );
} }
assets::shader_source_store::id_type assets::shader_source_store::add( assets::shader_source_store::id_type assets::shader_source_store::add(
const shader_source_id id,
const shader_source_data& shader_source const shader_source_data& shader_source
) { ) {
const auto id = id_type{ m_next_data_id.index++ };
m_ids.push_back(id); m_ids.push_back(id);
m_strings.reserve(m_strings.size() + shader_source.source.size() + 1); m_strings.reserve(m_strings.size() + shader_source.source.size() + 1);
@@ -183,6 +185,8 @@ assets::shader_source_store::id_type assets::shader_source_store::add(
m_lengths.push_back(shader_source.source.size()); m_lengths.push_back(shader_source.source.size());
m_metadata.push_back(shader_source.meta);
return id; return id;
} }
@@ -229,6 +233,7 @@ void assets::shader_source_store::remove(const iterator_type& it)
m_strings.erase(begin, end); m_strings.erase(begin, end);
m_lengths.erase(m_lengths.begin() + it.m_index); m_lengths.erase(m_lengths.begin() + it.m_index);
m_metadata.erase(m_metadata.begin() + it.m_index);
} }
void assets::shader_source_store::clear() void assets::shader_source_store::clear()
@@ -236,6 +241,7 @@ void assets::shader_source_store::clear()
m_ids.clear(); m_ids.clear();
m_strings.clear(); m_strings.clear();
m_lengths.clear(); m_lengths.clear();
m_metadata.clear();
} }
assets::shader_source_store::iterator_type assets::shader_source_store::begin() assets::shader_source_store::iterator_type assets::shader_source_store::begin()
@@ -244,6 +250,7 @@ assets::shader_source_store::iterator_type assets::shader_source_store::begin()
m_ids.data(), m_ids.data(),
m_strings.data(), m_strings.data(),
m_lengths.data(), m_lengths.data(),
m_metadata.data(),
0, 0,
{} {}
}; };
@@ -255,6 +262,7 @@ assets::shader_source_store::iterator_type assets::shader_source_store::end()
m_ids.data(), m_ids.data(),
m_strings.data(), m_strings.data(),
m_lengths.data(), m_lengths.data(),
m_metadata.data(),
m_lengths.size(), m_lengths.size(),
m_strings.size() m_strings.size()
}; };
@@ -266,6 +274,7 @@ assets::shader_source_store::const_iterator assets::shader_source_store::begin()
m_ids.data(), m_ids.data(),
m_strings.data(), m_strings.data(),
m_lengths.data(), m_lengths.data(),
m_metadata.data(),
0, 0,
{} {}
}; };
@@ -277,6 +286,7 @@ assets::shader_source_store::const_iterator assets::shader_source_store::end() c
m_ids.data(), m_ids.data(),
m_strings.data(), m_strings.data(),
m_lengths.data(), m_lengths.data(),
m_metadata.data(),
m_lengths.size(), m_lengths.size(),
m_strings.size() m_strings.size()
}; };
@@ -284,20 +294,10 @@ assets::shader_source_store::const_iterator assets::shader_source_store::end() c
assets::shader_source_store::const_iterator assets::shader_source_store::cbegin() const assets::shader_source_store::const_iterator assets::shader_source_store::cbegin() const
{ {
return const_cast<const shader_source_store*>(this)->begin(); return this->begin();
} }
assets::shader_source_store::const_iterator assets::shader_source_store::cend() const assets::shader_source_store::const_iterator assets::shader_source_store::cend() const
{ {
return const_cast<const shader_source_store*>(this)->end(); return this->end();
}
assets::shader_source_store::view_type assets::shader_source_store::view()
{
return { begin(), end() };
}
assets::shader_source_store::const_view_type assets::shader_source_store::view() const
{
return { begin(), end() };
} }

View File

@@ -0,0 +1,29 @@
#include "assets/fallback_data/fallback_texture.hpp"
assets::texture_data assets::generate_fallback_texture(
const int width,
const int height,
const std::span<const fallback_color> colors
) {
const auto pixel_count = width * height;
auto data = std::make_unique<texture_data::value_type[]>(pixel_count * sizeof(fallback_color));
auto pixels = reinterpret_cast<fallback_color*>(data.get());
for (int y{}; y != height; ++y)
{
for (int x{}; x != width; ++x)
{
const auto index = (x + y) % colors.size();
*pixels++ = colors[index];
}
}
return {
std::move(data),
width,
height,
fallback_color::components
};
}

View File

@@ -0,0 +1,8 @@
#include "assets/fallback_data/fallback_material.hpp"
assets::material_data generate_fallback_material()
{
}

View File

@@ -1,36 +0,0 @@
#include "../../../include/assets/data_parsers"
#include <fstream>
std::error_code glsl_loader::load(
const std::filesystem::path& filename,
std::string& source
) {
auto file = std::ifstream(filename);
if (not file.is_open())
{
return std::make_error_code(std::errc::no_such_file_or_directory);
}
file.seekg(0, std::ios::end);
const auto size = file.tellg();
if (size == 0 or size == std::numeric_limits<std::streamsize>::max())
{
return std::make_error_code(std::errc::invalid_seek);
}
source.reserve(size);
file.seekg(0, std::ios::beg);
source.assign(
std::istreambuf_iterator<char>(file),
std::istreambuf_iterator<char>()
);
file.close();
return {};
}

View File

@@ -0,0 +1,463 @@
#include "assets/file_parsers/glsl_parser.hpp"
#include <fstream>
#include <numeric>
#include "assets/components/mesh_shader_components.hpp"
#include "assets/components/point_cloud_shader_components.hpp"
#include "util/logger.hpp"
#include <mutex>
#include <execution>
namespace assets::language
{
enum class declaration_type : std::size_t
{
stage = 0,
geometry = 1,
features = 2,
static_enable = 3,
dynamic_enable = 4,
invalid = std::numeric_limits<std::size_t>::max()
};
using stage = shader_components::stage;
inline constexpr auto declaration_prefix = std::string_view("\n#pragma ");
inline constexpr auto title_separator = ':';
inline constexpr auto value_separator = ' ';
inline auto declaration_lookup = ztu::string_lookup<declaration_type>{
{ "STAGE", declaration_type::stage },
{ "GEOMETRY", declaration_type::geometry },
{ "FEATURES", declaration_type::features },
{ "STATIC_ENABLE", declaration_type::static_enable },
{ "DYNAMIC_ENABLE", declaration_type::dynamic_enable }
};
inline auto stage_lookup = ztu::string_lookup<shader_components::stage>{
{ "VERTEX", stage::vertex },
{ "TESSELATION_CONTROL", stage::tesselation_control },
{ "TESSELATION_EVALUATION", stage::tesselation_evaluation },
{ "GEOMETRY", stage::geometry },
{ "FRAGMENT", stage::fragment },
};
inline auto geometry_lookup = ztu::string_lookup<model_geometry::types>{
{ "MESH", model_geometry::types::mesh },
{ "POINT_CLOUD", model_geometry::types::point_cloud }
};
inline auto mesh_feature_lookup = ztu::string_lookup<shader_components::flags>{
{ "FACE", static_cast<shader_components::flags>(mesh_shader_components::flags::face) },
{ "LINE", static_cast<shader_components::flags>(mesh_shader_components::flags::line) },
{ "POINT", static_cast<shader_components::flags>(mesh_shader_components::flags::point) },
{ "V_L", static_cast<shader_components::flags>(mesh_shader_components::flags::luminance) },
{ "V_RGB", static_cast<shader_components::flags>(mesh_shader_components::flags::color) },
{ "V_R", static_cast<shader_components::flags>(mesh_shader_components::flags::alpha) },
{ "COLOR_TEXTURE", static_cast<shader_components::flags>(mesh_shader_components::flags::color_texture) },
{ "U_LIGHTING", static_cast<shader_components::flags>(mesh_shader_components::flags::uniform_lighting) },
{ "T_LIGHTING", static_cast<shader_components::flags>(mesh_shader_components::flags::textured_lighting) },
{ "U_RGBA", static_cast<shader_components::flags>(mesh_shader_components::flags::uniform_color) }
};
inline auto point_cloud_feature_lookup = ztu::string_lookup<shader_components::flags>{
{ "SQUARE", static_cast<shader_components::flags>(point_cloud_shader_components::flags::square) },
{ "LIGHTING", static_cast<shader_components::flags>(point_cloud_shader_components::flags::lighting) },
{ "V_L", static_cast<shader_components::flags>(point_cloud_shader_components::flags::luminance) },
{ "V_RGB", static_cast<shader_components::flags>(point_cloud_shader_components::flags::color) },
{ "V_A", static_cast<shader_components::flags>(point_cloud_shader_components::flags::alpha) },
{ "U_RGBA", static_cast<shader_components::flags>(point_cloud_shader_components::flags::uniform_color) },
{ "RAINBOW", static_cast<shader_components::flags>(point_cloud_shader_components::flags::rainbow) }
};
}
assets::glsl_parser::parser_context::parser_context(
store_type& m_store,
std::mutex& m_store_mutex
) : m_store{ &m_store }, m_store_mutex{ &m_store_mutex }
{
m_buffer.source.reserve(4096);
m_value_buffer.reserve(64);
m_declaration_value_count_buffer.reserve(8);
}
void assets::glsl_parser::parser_context::reset()
{
m_buffer.clear();
m_value_buffer.clear();
m_declaration_value_count_buffer.clear();
std::ranges::fill(
m_declaration_type_index_buffer,
static_cast<std::size_t>(language::declaration_type::invalid)
);
}
void assets::glsl_parser::parser_context::operator()(lookup_type::const_pointer entry) noexcept
{
const auto& [ filename, id ] = *entry;
if (const auto e = read_file(filename, m_buffer.source))
{
ztu::logger::warn("Could not load shader source %: %.", filename, e.message());
return;
}
tokenize_declarations();
if (not parse_metadata_from_tokens())
{
ztu::logger::warn("Ignoring shader % as it contains malformed metadata.", id);
return;
}
remove_metadata_declarations();
{
auto lock = std::lock_guard{ *m_store_mutex };
m_store->add(id, m_buffer);
}
}
void assets::glsl_parser::parser_context::tokenize_declarations()
{
auto source_rest = std::string_view( m_buffer.source.data(), m_buffer.source.size() );
auto offset = std::string_view::size_type{};
while ((offset = source_rest.find(language::declaration_prefix)) != std::string_view::npos)
{
const auto current_token_count = m_value_buffer.size();
auto line_end = source_rest.find('\n', offset);
if (line_end == std::string_view::npos)
{
line_end = source_rest.length();
}
auto declaration = source_rest.substr(offset, line_end - offset);
if ((offset = declaration.find(language::title_separator)) == std::string_view::npos)
{
continue;
}
const auto title = declaration.substr(0, offset);
if (const auto it = language::declaration_lookup.find(title); it != language::declaration_lookup.end())
{
const auto declaration_type = static_cast<std::size_t>(it->second);
m_declaration_type_index_buffer[declaration_type] = m_declaration_value_count_buffer.size();
}
else
{
continue;
}
declaration = declaration.substr(offset);
if (not declaration.empty() and declaration.front() == language::value_separator)
{
declaration = declaration.substr(sizeof(language::value_separator), declaration.length());
}
while ((offset = declaration.find(language::value_separator)) != std::string_view::npos)
{
m_value_buffer.emplace_back(declaration.substr(0, offset));
declaration = declaration.substr(offset + sizeof(language::value_separator));
}
if (not declaration.empty())
{
m_value_buffer.emplace_back(declaration);
}
m_declaration_value_count_buffer.emplace_back(
m_value_buffer.size() - current_token_count
);
// Preserve line break
source_rest = source_rest.substr(line_end);
}
}
bool assets::glsl_parser::parser_context::parse_metadata_from_tokens()
{
using namespace std::string_view_literals;
for (const auto [ type, name, parser ] :
{
std::make_tuple(language::declaration_type::stage, "stage"sv, &parse_stage_declaration),
std::make_tuple(language::declaration_type::geometry, "geometry"sv, &parse_geometry_declaration),
std::make_tuple(language::declaration_type::features, "features"sv, &parse_components_declaration),
std::make_tuple(language::declaration_type::static_enable, "static_enable"sv, &parse_static_enable_declaration),
std::make_tuple(language::declaration_type::dynamic_enable, "dynamic_enable"sv, &parse_dynamic_enable_declaration)
}
) {
const auto index = m_declaration_type_index_buffer[static_cast<std::size_t>(type)];
if (index == static_cast<std::size_t>(language::declaration_type::invalid))
{
ztu::logger::warn("Shader metadata error: Missing % declaration.", name);
return false;
}
const auto value_token_offset = std::accumulate(
m_declaration_value_count_buffer.begin(),
m_declaration_value_count_buffer.begin() + index,
std::size_t{}
);
const auto value_token_count = m_declaration_value_count_buffer[index];
if (not parser(std::span(m_value_buffer).subspan(value_token_offset, value_token_count), m_buffer))
{
return false;
}
}
return true;
}
void assets::glsl_parser::parser_context::remove_metadata_declarations()
{
if (m_declaration_value_count_buffer.empty())
{
return;
}
// 1. For every declaration expand the first value view to the size of the line.
// 2. Delete all other value views as they are not needed anymore.
// 3. Delete all declaration lines by overwriting them with the following source code.
// 4. Resize the source vector to the new character count.
const auto source_view = std::string_view{ m_buffer.source.data(), m_buffer.source.size() };
const auto value_span = std::span(m_value_buffer);
auto offset = std::size_t{};
for (auto [ index, count ] : std::ranges::views::enumerate(m_declaration_value_count_buffer))
{
const auto values = value_span.subspan(offset, count);
const auto value = values.front();
std::size_t begin_pos = value.data() - source_view.data();
std::size_t end_pos = begin_pos + value.size();
begin_pos = source_view.rfind('\n', begin_pos);
if (begin_pos == std::string_view::npos)
{
begin_pos = 0;
}
end_pos = source_view.find('\n', end_pos);
if (end_pos == std::string_view::npos)
{
end_pos = source_view.length();
}
else
{
end_pos += sizeof('\n');
}
m_value_buffer[index] = source_view.substr(begin_pos, end_pos - begin_pos);
offset += count;
}
const auto lines = std::span(m_value_buffer.data(), m_declaration_value_count_buffer.size());
const auto& first_line = lines.front();
auto source_end = first_line.begin();
auto line_end = first_line.end();
for (const auto& line : lines.subspan(1))
{
std::copy(line_end, line.begin(), source_end);
source_end += line.size();
line_end = line.end();
}
const auto source_rest_size = m_buffer.source.end().base() - line_end;
std::copy_n(line_end, source_rest_size, source_end);
source_end += source_rest_size;
m_buffer.source.resize(source_end - m_buffer.source.data());
}
std::error_code assets::glsl_parser::read_file(
const std::filesystem::path& filename,
std::vector<char>& source
) {
auto file = std::ifstream{ filename };
if (not file.is_open())
{
return std::make_error_code(std::errc::no_such_file_or_directory);
}
file.seekg(0, std::ios::end);
const std::streampos size = file.tellg();
if (size == 0 or size == std::numeric_limits<std::streampos>::max())
{
return std::make_error_code(std::errc::invalid_seek);
}
file.seekg(0, std::ios::beg);
source.clear();
source.reserve(sizeof('\n') + size);
source.push_back('\n');
std::copy(
std::istreambuf_iterator<char>(file),
std::istreambuf_iterator<char>(),
std::back_inserter(source)
);
file.close();
return {};
}
std::error_code assets::glsl_parser::prefetch(
path_id_lookups&
) {
// Nothing to prefetch
return {};
}
std::error_code assets::glsl_parser::load(
const path_id_lookups& lookups,
shader_source_store& store,
bool
) {
namespace fs = std::filesystem;
m_path_buffer.clear();
lookups.shader_sources.by_extension(".glsl", m_path_buffer);
auto store_mutex = std::mutex{};
std::for_each(
std::execution::parallel_unsequenced_policy{},
m_path_buffer.begin(),
m_path_buffer.end(),
parser_context{ store, store_mutex }
);
return {};
}
bool assets::glsl_parser::parse_geometry_declaration(
const std::span<const std::string_view> values,
model_geometry::types& geometry_type
) {
if (values.size() != 1)
{
ztu::logger::warn("Invalid geometry declaration: Expected exactly one token but got %.", values.size());
return false;
}
const auto value = values.front();
if (const auto it = language::geometry_lookup.find(value); it != language::geometry_lookup.end())
{
geometry_type = it->second;
}
else
{
ztu::logger::warn("Invalid geometry declaration: Unknown geometry %.", value);
return false;
}
return true;
}
bool assets::glsl_parser::parse_stage_declaration(
const std::span<const std::string_view> values,
shader_components::stage& stage
) {
if (values.size() != 1)
{
ztu::logger::warn("Invalid stage declaration: Expected exactly one token but got %.", values.size());
return false;
}
const auto value = values.front();
if (const auto it = language::stage_lookup.find(value); it != language::stage_lookup.end())
{
stage = it->second;
}
else
{
ztu::logger::warn("Invalid stage declaration: Unknown stage %.", value);
return false;
}
return true;
}
bool assets::glsl_parser::parse_components_declaration(
const std::span<const std::string_view> values,
shader_source_data& buffer
) {
return parse_component_tokens(values, buffer.geometry_type, buffer.components);
}
bool assets::glsl_parser::parse_static_enable_declaration(
const std::span<const std::string_view> values,
shader_source_data& buffer
) {
return parse_component_tokens(values, buffer.geometry_type, buffer.static_enable);
}
bool assets::glsl_parser::parse_dynamic_enable_declaration(
const std::span<const std::string_view> values,
shader_source_data& buffer
) {
return parse_component_tokens(values, buffer.geometry_type, buffer.dynamic_enable);
}
bool assets::glsl_parser::parse_component_tokens(
const std::span<const std::string_view> values,
const model_geometry::types geometry_type,
shader_components::flags& components
) {
components = {};
const ztu::string_lookup<shader_components::flags>* component_lookup{};
switch (geometry_type)
{
case model_geometry::types::mesh:
component_lookup = &language::mesh_feature_lookup;
break;
case model_geometry::types::point_cloud:
component_lookup = &language::point_cloud_feature_lookup;
break;
default:
ztu::logger::warn("Internal error: Unknown geometry index %.", static_cast<int>(geometry_type));
return false;
}
for (const auto value : values)
{
if (const auto it = component_lookup->find(value); it != component_lookup->end())
{
components |= it->second;
}
else
{
ztu::logger::warn("Ignoring unknown feature token %.", value);
}
}
return true;
}

View File

@@ -1,301 +0,0 @@
#include "../../../include/assets/data_parsers"
#include "glm/glm.hpp"
#include <charconv>
#include <fstream>
#include <glm/ext/matrix_transform.hpp>
#include "assets/components/point_cloud_vertex_components.hpp"
#include "util/binary_ifstream.hpp"
#include "util/logger.hpp"
ztu::result<std::string_view> kitti_loader::parent_directory(const std::string_view path)
{
const auto sep_index = path.rfind(std::filesystem::path::preferred_separator);
if (sep_index == std::string_view::npos)
{
return std::unexpected(std::make_error_code(std::errc::no_such_file_or_directory));
}
return path.substr(0, sep_index);
};
std::error_code kitti_loader::prefetch(
const file_dir_list& paths,
prefetch_queue& queue
) {
// Directories can simply be passed on
queue.kitti_pose_queue.directories.push_back(paths.directories);
// For files, we just forward the files directory
for (const auto file : queue.kitti_pose_queue.files)
{
if (const auto base_directory = parent_directory(file).and_then(parent_directory))
{
queue.kitti_pose_queue.directories.push_back(*base_directory);
}
else
{
// TODO remove from list
ztu::logger::error("Malformed kitti file path: %.", file);
}
}
return {};
}
std::error_code kitti_loader::load(
dynamic_point_cloud_buffer& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
dynamic_shader_source_store& store,
bool
) {
namespace fs = std::filesystem;
std::error_code error;
std::vector<dynamic_pose_store::iterator_type> pose_its;
pose_its.reserve(paths.files.size());
auto processed_filenames = ztu::string_list{};
auto path_buffer = fs::path{};
const auto preprocess_filename = [&](
std::string_view path,
const auto& directory,
std::string_view filename,
const pose_prefetch_lookup::directory_iterator& dir_it
) {
const auto pose_index = frame_id_from_filename(filename);
if (not pose_index) [[unlikely]]
{
ztu::logger::error("Could not parse frame id from kitti file path: %.", filename);
return;
}
const auto [ index_it, pose_id_match ] = id_lookup.poses.find_index(dir_it, *pose_index);
if (not pose_id_match) [[unlikely]]
{
ztu::logger::error("No matching pose index (%) found in directory (%).", directory, *pose_index);
return;
}
const auto [ pose_it, pose_match ] = store.poses.find(pose_id_match);
if (not pose_id_match) [[unlikely]]
{
ztu::logger::error("No matching pose found for id: %.", pose_id_match);
return;
}
processed_filenames.push_back(path);
pose_its.push_back(pose_it);
};
for (const auto file : paths.files)
{
path_buffer.assign(file.begin(), file.end());
if (not fs::is_regular_file(path_buffer))
{
ztu::logger::error("Given kitti file does not exist: %.", path_buffer);
continue;
}
const auto sep_index = file.rfind(fs::path::preferred_separator);
if (sep_index == std::string_view::npos) [[unlikely]]
{
ztu::logger::error("Could not parse frame directory from kitti file path: %.", file);
continue;
}
// TODO find out if the path splitting is consistent
const auto base_directory = parent_directory(file.substr(0, sep_index));
if (not base_directory) [[unlikely]]
{
ztu::logger::error("Could not parse base directory from kitti file path: %.", file);
continue;
}
const auto [ dir_it, dir_match ] = id_lookup.poses.find_directory(*base_directory);
if (not dir_match) [[unlikely]]
{
ztu::logger::error("No matching pose directory found for %.", file);
continue;
}
const auto filename = file.substr(sep_index + 1);
preprocess_filename(
file,
*base_directory,
filename,
dir_it
);
}
for (const auto directory : paths.directories)
{
path_buffer.assign(directory.begin(), directory.end());
const auto [ dir_it, dir_match ] = id_lookup.poses.find_directory(path_buffer);
if (not dir_match) [[unlikely]]
{
ztu::logger::error("No matching pose directory found for %.", path_buffer);
continue;
}
path_buffer /= frame_folder;
if (not fs::is_directory(path_buffer))
{
ztu::logger::error("Given kitti directory does not exist: %.", directory);
continue;
}
for (const auto& file : fs::directory_iterator{ path_buffer })
{
const auto file_path = std::string_view{ file.path().c_str() };
if (not file_path.ends_with(".bin"))
{
continue;
}
auto filename_begin = file_path.rfind(fs::path::preferred_separator);
filename_begin = filename_begin == std::string_view::npos ? 0 : filename_begin + 1;
const auto filename_only = file_path.substr(filename_begin);
const auto pose_index = frame_id_from_filename(filename_only);
if (not pose_index) [[unlikely]]
{
ztu::logger::error("Could not parse frame id from kitti filename: %.", filename_only);
continue;
}
const auto [ index_it, pose_id_match ] = id_lookup.poses.find_index(dir_it, *pose_index);
if (not pose_id_match) [[unlikely]]
{
ztu::logger::error("No matching pose index (%) found in directory (%).", directory, *pose_index);
continue;
}
const auto [ pose_it, pose_match ] = store.poses.find(pose_id_match);
if (not pose_id_match) [[unlikely]]
{
ztu::logger::error("No matching pose found for id: %.", pose_id_match);
continue;
}
processed_filenames.push_back(file_path);
pose_its.push_back(pose_it);
preprocess_filename(
file_path,
directory,
filename_only,
dir_it
);
}
}
for (const auto [ filename, pose_it ] : std::ranges::views::zip(processed_filenames, pose_its))
{
buffer.clear();
if ((error = load_point_file(filename, buffer)))
{
return error;
}
transform_point_cloud(buffer.positions(), *pose_it);
store.point_clouds.add(buffer);
}
return {};
}
void kitti_loader::transform_point_cloud(
std::span<point_cloud_vertex_components::position> points,
const glm::mat4& pose
) {
for (auto& [ x, y, z ] : points) {
auto vec = glm::vec4{ x, y, z, 1.0f };
vec = pose * vec;
x = vec.x;
y = vec.y;
z = vec.z;
}
}
std::error_code kitti_loader::load_point_file(
const std::filesystem::path& filename,
dynamic_point_cloud_buffer& point_cloud
) {
auto in = binary_ifstream{};
auto error = std::error_code{};
if ((error == in.open(filename, true)))
{
return error;
}
const auto read_vector = [&in](auto& vector) -> std::error_code
{
for (auto& component : vector)
{
float component32;
if (const auto e = in.read_ieee754<std::endian::little>(component32))
{
return e;
}
component = component32;
}
return {};
};
point_cloud_vertex_components::position position;
auto& positions = point_cloud.positions();
while (not ((error = read_vector(position)))) {
positions.push_back(position);
if ((error = in.skip<float>())) // TODO what am I skipping here?!?
{
break;
}
}
if (static_cast<std::errc>(error.value()) != std::errc::result_out_of_range)
{
return error;
}
return {};
}
ztu::result<std::size_t> kitti_loader::frame_id_from_filename(
std::string_view filename
) {
std::size_t id;
const auto result = std::from_chars(filename.cbegin(), filename.cend(), id);
if (result.ec != std::errc{})
{
return std::unexpected(std::make_error_code(result.ec));
}
return id;
}

View File

@@ -0,0 +1,239 @@
#include "assets/file_parsers/kitti_parser.hpp"
#include "glm/glm.hpp"
#include <charconv>
#include <fstream>
#include <glm/ext/matrix_transform.hpp>
#include "assets/components/point_cloud_vertex_components.hpp"
#include "assets/data/pose_data.hpp"
#include "util/binary_ifstream.hpp"
#include "util/logger.hpp"
#include <execution>
assets::kitti_parser::parser_context::parser_context(
const pose_list_id_lookup& pose_list_lookup,
const pose_list_store& pose_list_store,
store_type& m_store,
std::mutex& m_store_mutex
) :
m_pose_list_lookup{ &pose_list_lookup },
m_pose_list_store{ &pose_list_store },
m_store{ &m_store },
m_store_mutex{ &m_store_mutex }
{
m_buffer.positions().reserve(8192);
m_buffer.normals().reserve(8192);
m_buffer.colors().reserve(8192);
}
void assets::kitti_parser::parser_context::reset()
{
m_buffer.clear();
}
void assets::kitti_parser::parser_context::operator()(lookup_type::const_pointer entry) noexcept
{
const auto& [ filename, id ] = *entry;
pose_data pose;
if (const auto pose_path = get_pose_path(filename); not pose_path)
{
if (pose_path != m_last_pose_path)
{
if (const auto pose_list_id_it = m_pose_list_lookup->find(*pose_path); pose_list_id_it != m_pose_list_lookup->end())
{
m_last_pose_path = *pose_path;
const auto pose_list_id = pose_list_id_it->second;
if (const auto [ pose_list_it, found ] = m_pose_list_store->find(pose_list_id); found)
{
m_last_pose_path = *pose_path;
m_last_pose_list = pose_list_it->second;
}
else
{
ztu::logger::error("No matching pose found in store for %.", *pose_path);
return;
}
}
else
{
ztu::logger::error("No matching pose registered in lookup %.", *pose_path);
return;
}
}
}
else
{
ztu::logger::error("Malformed kitti file path %.", filename);
return;
}
clear();
if (const auto e = load_point_file(filename, m_buffer))
{
ztu::logger::error("Could not load kitti file %: %", filename, e.message());
return;
}
transform_point_cloud(m_buffer.positions(), pose);
{
auto lock = std::lock_guard{ *m_store_mutex };
m_store->add(id, m_buffer);
}
}
ztu::result<std::filesystem::path> assets::kitti_parser::parent_directory(
const std::filesystem::path& path
) {
try
{
return path.parent_path();
}
catch (const std::exception&)
{
return std::unexpected(std::make_error_code(std::errc::no_such_file_or_directory));
}
};
ztu::result<std::filesystem::path> assets::kitti_parser::get_pose_path(
const std::filesystem::path& path
) {
return parent_directory(path)
.and_then(parent_directory)
.and_then(
[](const auto& base_dir)
{
return base_dir / "pose.txt";
}
);
};
std::error_code assets::kitti_parser::prefetch(
path_id_lookups& lookups
) {
m_path_buffer.clear();
lookups.point_clouds.by_extension(".bin", m_path_buffer);
for (const auto entry : m_path_buffer)
{
if (const auto pose_path = pose_path(entry->second))
{
lookups.poses.try_emplace(std::filesystem::absolute(pose_path));
}
else
{
ztu::logger::error("Malformed kitti file path %.", entry->second);
}
}
return {};
}
std::error_code assets::kitti_parser::load(
path_id_lookups& lookups,
data_stores& stores,
bool pedantic
) {
namespace fs = std::filesystem;
m_path_buffer.clear();
lookups.point_clouds.by_extension(".bin", m_path_buffer);
auto store_mutex = std::mutex{};
std::for_each(
std::execution::parallel_unsequenced_policy{},
m_path_buffer.begin(),
m_path_buffer.end(),
parser_context{
lookups.pose_lists,
stores.pose_lists,
stores.point_clouds,
store_mutex
}
);
return {};
}
void assets::kitti_parser::transform_point_cloud(
std::span<point_cloud_vertex_components::position> points,
const glm::mat4& pose
) {
for (auto& point : points)
{
point = pose * glm::vec4{ point, 1.0f };
}
}
std::error_code assets::kitti_parser::load_point_file(
const std::filesystem::path& filename,
point_cloud_data& point_cloud
) {
auto in = binary_ifstream{};
if (const auto e = in.open(filename, true))
{
return e;
}
const auto read_vector = [&in](auto& vector) -> std::error_code
{
for (auto& component : vector)
{
float component32;
if (const auto e = in.read_ieee754<std::endian::little>(component32))
{
return e;
}
component = component32;
}
return {};
};
point_cloud_vertex_components::position position;
auto& positions = point_cloud.positions();
auto parsing_error = std::error_code{};
while (not ((parsing_error = read_vector(position))))
{
positions.push_back(position);
if ((parsing_error = in.skip<float>())) // TODO what am I skipping here?!?
{
break;
}
}
if (static_cast<std::errc>(parsing_error.value()) != std::errc::result_out_of_range)
{
return parsing_error;
}
return {};
}
ztu::result<std::size_t> assets::kitti_parser::frame_id_from_filename(
const std::string_view filename
) {
std::size_t id;
const auto result = std::from_chars(filename.cbegin(), filename.cend(), id);
if (result.ec != std::errc{})
{
return std::unexpected(std::make_error_code(result.ec));
}
return id;
}

View File

@@ -1,120 +0,0 @@
#include "../../../include/assets/data_parsers"
#include "../../../include/assets/read_buffers"
#include <fstream>
#include <glm/ext/matrix_transform.hpp>
#include "util/logger.hpp"
inline std::error_code kitti_pose_loader::parse_pose(
std::ifstream& in,
dynamic_pose_buffer& pose
) {
for (dynamic_pose_buffer::length_type row{}; row != 3; ++row)
{
for (dynamic_pose_buffer::length_type col{}; col != 4; ++col)
{
if (not (in >> pose[row][col]))
{
return std::make_error_code(std::errc::result_out_of_range);
}
}
}
return {};
}
std::error_code kitti_pose_loader::prefetch(
const file_dir_list& paths,
prefetch_queue& queue
) {
// Nothing to be done here
}
std::error_code kitti_pose_loader::load(
dynamic_pose_buffer& buffer,
const file_dir_list& paths,
prefetch_lookup& id_lookup,
dynamic_shader_source_store& store,
bool pedantic
) {
namespace fs = std::filesystem;
auto path_buffer = fs::path{};
auto in = std::ifstream{}; // TODO disable exceptions (for other loaders as well)
// Needed to initialize 4th row and col
buffer = glm::identity<glm::mat4>();
auto processed_filenames = ztu::string_list{};
processed_filenames.reserve(
paths.files.character_count() +
paths.directories.character_count() +
paths.directories.size() * pose_filename.size(),
paths.files.size() + paths.directories.size()
);
const auto preprocess_file = [&]()
{
if (not fs::is_regular_file(path_buffer))
{
ztu::logger::error("Kitti pose file does not exist: %", path_buffer);
return;
}
processed_filenames.push_back(path_buffer.c_str());
};
for (const auto directory : paths.directories) {
path_buffer.assign(directory.begin(), directory.end());
path_buffer /= pose_filename;
preprocess_file();
}
for (const auto file : paths.files) {
path_buffer.assign(file.begin(), file.end());
preprocess_file();
}
for (const auto filename : processed_filenames)
{
// TODO if (not) removing the path separator creates issues.
const auto directory = filename.substr(0, filename.length() - pose_filename.length());
auto [ dir_it, dir_match ] = id_lookup.poses.find_directory(directory);
if (not dir_match) [[unlikely]]
{
dir_it = id_lookup.poses.emplace_dir(dir_it, directory);
}
in.open(filename.data()); // Safe because string list adds null terminator
if (not in.is_open())
{
ztu::logger::error("Cannot open kitti pose file %", path_buffer);
continue;
}
in >> std::skipws;
for (auto i = pose_prefetch_lookup::index_type{}; in.peek() != std::ifstream::traits_type::eof(); ++i)
{
if (const auto error = parse_pose(in, buffer))
{
ztu::logger::error(
"Error occurred while parsing kitti pose % in file %: [%] %",
i,
path_buffer,
error.category().name(),
error.message()
);
continue;
}
const auto id = store.poses.add(buffer);
id_lookup.poses.emplace_hint_dir(dir_it, i, id);
}
in.close();
}
}

View File

@@ -0,0 +1,125 @@
#include "assets/file_parsers/kitti_pose_parser.hpp"
#include <fstream>
#include <execution>
#include <glm/ext/matrix_transform.hpp>
#include "util/logger.hpp"
assets::kitti_pose_parser::parser_context::parser_context(
store_type& m_store,
std::mutex& m_store_mutex
) : m_store{ &m_store }, m_store_mutex{ &m_store_mutex }
{
m_buffer.reserve(128);
}
void assets::kitti_pose_parser::parser_context::reset()
{
m_buffer.clear();
}
void assets::kitti_pose_parser::parser_context::operator()(lookup_type::const_pointer entry) noexcept
{
const auto& [ filename, id ] = *entry;
if (const auto e = parse_file(filename, m_buffer))
{
ztu::logger::warn("Could not load pose_list %: %.", filename, e.message());
return;
}
{
auto lock = std::lock_guard{ *m_store_mutex };
m_store->add(id, m_buffer);
}
}
std::error_code assets::kitti_pose_parser::prefetch(
path_id_lookups& lookups
) {
return {};
}
std::error_code assets::kitti_pose_parser::parse(
const path_id_lookups& lookups,
store_type& store,
bool
) {
namespace fs = std::filesystem;
auto path_buffer = fs::path{};
auto in = std::ifstream{}; // TODO disable exceptions (for other loaders as well)
m_path_buffer.clear();
lookups.pose_lists.by_extension(".glsl", m_path_buffer);
auto store_mutex = std::mutex{};
std::for_each(
std::execution::parallel_unsequenced_policy{},
m_path_buffer.begin(),
m_path_buffer.end(),
parser_context{ store, store_mutex }
);
return {};
}
std::error_code assets::kitti_pose_parser::parse_file(
const std::filesystem::path& filename,
data_type &poses
) {
auto in = std::ifstream{};
in.open(filename);
if (not in.is_open())
{
return std::make_error_code(std::errc::no_such_file_or_directory);
}
in >> std::skipws;
while (in.peek() != std::ifstream::traits_type::eof())
{
auto pose = glm::identity<pose_data>();
if (const auto error = parse_pose(in, pose))
{
ztu::logger::error(
"Error occurred while parsing kitti pose file %: [%] %",
filename,
error.category().name(),
error.message()
);
continue;
}
poses.emplace_back(pose);
}
in.close();
return {};
}
std::error_code assets::kitti_pose_parser::parse_pose(
std::ifstream& in,
pose_data& pose
) {
for (pose_data::length_type row{}; row != 3; ++row)
{
for (pose_data::length_type col{}; col != 4; ++col)
{
if (not (in >> pose[row][col]))
{
return std::make_error_code(std::errc::result_out_of_range);
}
}
}
return {};
}

View File

@@ -1,4 +1,4 @@
#include "../../../include/assets/data_parsers" #include "assets/file_parsers/mtl_loader.hpp"
#include <charconv> #include <charconv>
#include <fstream> #include <fstream>
@@ -435,15 +435,14 @@ std::error_code mtl_loader::load(
}), }),
ztu::make_line_parser("Ka ", ztu::is_not_repeating, [&](const auto& param) ztu::make_line_parser("Ka ", ztu::is_not_repeating, [&](const auto& param)
{ {
if (surface_properties_disabled) return codes::ok; material_components::ambient_filter ambient_filter;
if (parse_numeric_vector(param, ambient_filter) != std::errc{}) [[unlikely]]
auto& properties = material.initialized_surface_properties();
if (parse_numeric_vector(param, properties.ambient_filter) != std::errc{}) [[unlikely]]
{ {
return codes::malformed_ambient_color; return codes::malformed_ambient_color; // TODO rename to filter
} }
material.components() |= flags::surface_properties; material.ambient_filter = mbient_filter;
material.components() |= flags::ambient_filter;
return codes::ok; return codes::ok;
}), }),
@@ -511,7 +510,7 @@ std::error_code mtl_loader::load(
if (textures_disabled) return codes::ok; if (textures_disabled) return codes::ok;
load_texture(param, "ambient color", [&](const auto id) { load_texture(param, "ambient color", [&](const auto id) {
material.ambient_color_texture_id() = id; material.specular_filter_texture_id() = id;
material.components() |= flags::ambient_filter_texture; material.components() |= flags::ambient_filter_texture;
}); });
@@ -522,7 +521,7 @@ std::error_code mtl_loader::load(
if (textures_disabled) return codes::ok; if (textures_disabled) return codes::ok;
load_texture(param, "diffuse color", [&](const auto id) { load_texture(param, "diffuse color", [&](const auto id) {
material.diffuse_color_texture_id() = id; material.diffuse_filter_texture_id() = id;
material.components() |= flags::diffuse_filter_texture; material.components() |= flags::diffuse_filter_texture;
}); });
@@ -533,7 +532,7 @@ std::error_code mtl_loader::load(
if (textures_disabled) return codes::ok; if (textures_disabled) return codes::ok;
load_texture(param, "specular color", [&](const auto id) { load_texture(param, "specular color", [&](const auto id) {
material.specular_color_texture_id() = id; material.specular_filter_texture_id() = id;
material.components() |= flags::specular_filter_texture; material.components() |= flags::specular_filter_texture;
}); });

View File

@@ -1,11 +1,11 @@
#include "../../../include/assets/data_parsers" #include "assets/file_parsers/obj_loader.hpp"
#include <charconv> #include <charconv>
#include <fstream> #include <fstream>
#include <array> #include <array>
#include "assets/components/mesh_vertex_components.hpp" #include "assets/components/mesh_vertex_components.hpp"
#include "../../../include/assets/data_loaders" #include "assets/data_loaders/"
#include "util/logger.hpp" #include "util/logger.hpp"
#include "util/for_each.hpp" #include "util/for_each.hpp"

View File

@@ -1,4 +1,4 @@
#include "../../../include/assets/data_parsers" #include "assets/file_parsers/stl_loader.hpp"
#include "util/binary_ifstream.hpp" #include "util/binary_ifstream.hpp"
#include "util/unroll_bool_template.hpp" #include "util/unroll_bool_template.hpp"

View File

@@ -1,13 +1,14 @@
#include "../../../include/assets/data_parsers" #include "assets/file_parsers/threedtk_pose_loader.hpp"
#include "../../../include/assets/read_buffers"
#include <fstream>
#include <glm/ext/matrix_transform.hpp> #include <glm/ext/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp> #include <glm/gtx/euler_angles.hpp>
#include "util/logger.hpp" #include "util/logger.hpp"
#include <fstream>
inline std::error_code threedtk_pose_loader::parse_transform_info( inline std::error_code threedtk_pose_loader::parse_transform_info(

View File

@@ -13,9 +13,9 @@ struct prioritized_metadata_comparator
bool operator()(const type& a, const type& b) const noexcept bool operator()(const type& a, const type& b) const noexcept
{ {
if (a.geometry != b.geometry) if (a.geometry_type != b.geometry_type)
{ {
return a.geometry > b.geometry; return a.geometry_type > b.geometry_type;
} }
if (a.stage != b.stage) if (a.stage != b.stage)
@@ -48,24 +48,24 @@ std::optional<std::pair<zgl::shader_metadata, zgl::shader_handle>> zgl::shader_m
) { ) {
auto shader_it = std::ranges::lower_bound( auto shader_it = std::ranges::lower_bound(
m_shader_lookup, m_shader_lookup,
std::pair{ requirements.geometry, requirements.stage }, std::pair{ requirements.geometry_type, requirements.stage },
std::greater{}, std::greater{},
[](const shader_lookup_entry_type& entry) [](const entry_type& entry)
{ {
const auto& meta = entry.first; const auto& meta = entry.first;
return std::pair{ meta.geometry, meta.stage }; return std::pair{ meta.geometry_type, meta.stage };
} }
); );
while ( while (
shader_it != m_shader_lookup.end() and shader_it != m_shader_lookup.end() and
shader_it->first.geometry == requirements.geometry and shader_it->first.geometry_type == requirements.geometry_type and
shader_it->first.stage == requirements.stage shader_it->first.stage == requirements.stage
) { ) {
const auto& [ meta, data ] = *shader_it; const auto& [ meta, data ] = *shader_it;
const auto unwanted_static_features = meta.static_enabled & ~requirements.features; const auto unwanted_static_features = meta.static_enabled & ~requirements.components;
const auto required_dynamic_features = requirements.features & ~meta.static_enabled; const auto required_dynamic_features = requirements.components & ~meta.static_enabled;
const auto missing_dynamic_features = required_dynamic_features & ~meta.dynamic_enable; const auto missing_dynamic_features = required_dynamic_features & ~meta.dynamic_enable;
if (unwanted_static_features == 0 and missing_dynamic_features == 0) if (unwanted_static_features == 0 and missing_dynamic_features == 0)
@@ -84,9 +84,9 @@ void zgl::shader_manager::process(const store_type& shader_sources)
m_preprocessor.process(shader_sources); m_preprocessor.process(shader_sources);
} }
void zgl::shader_manager::get_handles( void zgl::shader_manager::fetch(
const assets::shader_source_store& shader_sources, const assets::shader_source_store& shader_sources,
std::span<const shading::shader_set_requirements> requirements, std::span<const shading::shader_program_requirements> requirements,
std::span<shader_set_metadata> metadata, std::span<shader_set_metadata> metadata,
std::span<shader_handle_set> shader_sets std::span<shader_handle_set> shader_sets
) { ) {
@@ -99,14 +99,14 @@ void zgl::shader_manager::get_handles(
shader_set_meta = {}; shader_set_meta = {};
auto shader_req = shading::shader_requirements{ auto shader_req = shading::shader_requirements{
.geometry = req.geometry, .geometry_type = req.geometry_type,
.stage = {}, .stage = {},
.features = req.features .components = req.components
}; };
for (auto [ stage_index, handle ] : std::ranges::views::enumerate(shader_set.stages)) for (auto [ stage_index, handle ] : std::ranges::views::enumerate(shader_set.stages))
{ {
shader_req.stage = static_cast<shading::stage::types>(stage_index); shader_req.stage = static_cast<assets::shader_components::stage>(stage_index);
if (auto shader_match = find_shader(shader_req)) if (auto shader_match = find_shader(shader_req))
{ {
@@ -127,7 +127,7 @@ void zgl::shader_manager::get_handles(
m_preprocessed_shader_source_metadata_buffer.resize(m_source_requirement_buffer.size()); m_preprocessed_shader_source_metadata_buffer.resize(m_source_requirement_buffer.size());
m_source_strings_buffer.clear(); m_source_strings_buffer.clear();
m_preprocessor.get_shader_sources( m_preprocessor.fetch(
shader_sources, shader_sources,
m_source_requirement_buffer, m_source_requirement_buffer,
m_preprocessed_shader_source_metadata_buffer, m_preprocessed_shader_source_metadata_buffer,
@@ -161,7 +161,7 @@ void zgl::shader_manager::get_handles(
)) { )) {
handle = shader.handle; handle = shader.handle;
auto shader_meta = shader_metadata{ auto shader_meta = shader_metadata{
.geometry = source_req_it->geometry, .geometry_type = source_req_it->geometry_type,
.stage = source_req_it->stage, .stage = source_req_it->stage,
.static_enabled = source_meta_it->static_enabled, .static_enabled = source_meta_it->static_enabled,
.dynamic_enable = source_meta_it->dynamic_enable .dynamic_enable = source_meta_it->dynamic_enable
@@ -194,14 +194,14 @@ void zgl::shader_manager::get_handles(
std::ranges::sort( std::ranges::sort(
new_shaders, new_shaders,
prioritized_metadata_comparator{}, prioritized_metadata_comparator{},
&shader_lookup_entry_type::first &entry_type::first
); );
std::ranges::inplace_merge( std::ranges::inplace_merge(
m_shader_lookup, m_shader_lookup,
m_shader_lookup.begin() + prev_shader_count, m_shader_lookup.begin() + prev_shader_count,
prioritized_metadata_comparator{}, prioritized_metadata_comparator{},
&shader_lookup_entry_type::first &entry_type::first
); );
} }

View File

@@ -7,12 +7,12 @@ struct prioritized_metadata_comparator
bool operator()(const type& a, const type& b) const noexcept bool operator()(const type& a, const type& b) const noexcept
{ {
if (a.geometry != b.geometry) if (a.geometry_type != b.geometry_type)
{ {
return a.geometry > b.geometry; return a.geometry_type > b.geometry_type;
} }
static constexpr auto more_features = std::popcount<zgl::shading::features::generic::type>; static constexpr auto more_features = std::popcount<assets::shader_components::stage>;
return std::ranges::lexicographical_compare( return std::ranges::lexicographical_compare(
std::array{ a.dynamic_enable, a.static_enabled }, std::array{ a.dynamic_enable, a.static_enabled },
@@ -29,7 +29,7 @@ void zgl::shader_program_manager::process(const store_type& shader_sources)
m_shader_manager.process(shader_sources); m_shader_manager.process(shader_sources);
} }
void zgl::shader_program_manager::get_handles( void zgl::shader_program_manager::fetch(
const assets::shader_source_store& shader_sources, const assets::shader_source_store& shader_sources,
std::span<const shading::shader_program_requirements> requirements, std::span<const shading::shader_program_requirements> requirements,
std::span<shader_program_metadata> metadata, std::span<shader_program_metadata> metadata,
@@ -55,8 +55,8 @@ void zgl::shader_program_manager::get_handles(
program_meta = {}; program_meta = {};
program_handle = {}; program_handle = {};
m_shader_requirements_buffer.emplace_back( m_shader_requirements_buffer.emplace_back(
req.geometry, req.geometry_type,
req.features req.components
); );
} }
} }
@@ -66,7 +66,7 @@ void zgl::shader_program_manager::get_handles(
m_shader_metadata_buffer.resize(m_shader_requirements_buffer.size()); m_shader_metadata_buffer.resize(m_shader_requirements_buffer.size());
shader_set_buffer.clear(); shader_set_buffer.clear();
m_shader_manager.get_handles( m_shader_manager.fetch(
shader_sources, shader_sources,
m_shader_requirements_buffer, m_shader_requirements_buffer,
m_shader_metadata_buffer, m_shader_metadata_buffer,
@@ -92,7 +92,7 @@ void zgl::shader_program_manager::get_handles(
program_handle = program.handle; program_handle = program.handle;
program_meta = shader_program_metadata{ program_meta = shader_program_metadata{
.geometry = shader_set_req_it->geometry, .geometry_type = shader_set_req_it->geometry_type,
.static_enabled = shader_set_meta_it->static_enabled, .static_enabled = shader_set_meta_it->static_enabled,
.dynamic_enable = shader_set_meta_it->dynamic_enable .dynamic_enable = shader_set_meta_it->dynamic_enable
}; };
@@ -113,14 +113,14 @@ void zgl::shader_program_manager::get_handles(
std::ranges::sort( std::ranges::sort(
new_shader_programs, new_shader_programs,
prioritized_metadata_comparator{}, prioritized_metadata_comparator{},
&shader_program_lookup_entry_type::first &entry_type::first
); );
std::ranges::inplace_merge( std::ranges::inplace_merge(
m_shader_program_lookup, m_shader_program_lookup,
m_shader_program_lookup.begin() + prev_shader_program_count, m_shader_program_lookup.begin() + prev_shader_program_count,
prioritized_metadata_comparator{}, prioritized_metadata_comparator{},
&shader_program_lookup_entry_type::first &entry_type::first
); );
} }
@@ -130,23 +130,23 @@ std::optional<std::pair<zgl::shader_program_metadata, zgl::shader_program_handle
auto shader_program_it = std::ranges::lower_bound( auto shader_program_it = std::ranges::lower_bound(
m_shader_program_lookup, m_shader_program_lookup,
requirements.geometry, requirements.geometry_type,
std::greater{}, std::greater{},
[](const shader_program_lookup_entry_type& entry) [](const entry_type& entry)
{ {
const auto& meta = entry.first; const auto& meta = entry.first;
return meta.geometry; return meta.geometry_type;
} }
); );
while ( while (
shader_program_it != m_shader_program_lookup.end() and shader_program_it != m_shader_program_lookup.end() and
shader_program_it->first.geometry == requirements.geometry shader_program_it->first.geometry_type == requirements.geometry_type
) { ) {
const auto& [ meta, data ] = *shader_program_it; const auto& [ meta, data ] = *shader_program_it;
const auto unwanted_static_features = meta.static_enabled & ~requirements.features; const auto unwanted_static_features = meta.static_enabled & ~requirements.components;
const auto required_dynamic_features = requirements.features & ~meta.static_enabled; const auto required_dynamic_features = requirements.components & ~meta.static_enabled;
const auto missing_dynamic_features = required_dynamic_features & ~meta.dynamic_enable; const auto missing_dynamic_features = required_dynamic_features & ~meta.dynamic_enable;
if (unwanted_static_features == 0 and missing_dynamic_features == 0) if (unwanted_static_features == 0 and missing_dynamic_features == 0)

View File

@@ -4,10 +4,11 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <numeric> #include <numeric>
#include <utility>
#include "opengl/shading/shader_metadata_language.hpp" #include "opengl/shading/shader_metadata_language.hpp"
static auto mesh_feature_defines = std::array{ static auto mesh_component_defines = std::array{
"#define FACE\n", "#define FACE\n",
"#define LINE\n", "#define LINE\n",
"#define POINT\n", "#define POINT\n",
@@ -19,7 +20,7 @@ static auto mesh_feature_defines = std::array{
"#define U_RGBA\n", "#define U_RGBA\n",
}; };
static auto point_cloud_feature_defines = std::array{ static auto point_cloud_component_defines = std::array{
"#define SQUARE\n", "#define SQUARE\n",
"#define LIGHTING\n", "#define LIGHTING\n",
"#define V_L\n", "#define V_L\n",
@@ -29,34 +30,15 @@ static auto point_cloud_feature_defines = std::array{
"#define RAINBOW\n" "#define RAINBOW\n"
}; };
struct prioritized_feature_set_comparator
{
using type = zgl::shader_features_set<zgl::shading::features::generic::type>;
bool operator()(const type& a, const type& b) const noexcept
{
static constexpr auto more_features = std::popcount<zgl::shading::features::generic::type>;
return std::ranges::lexicographical_compare(
std::array{ a.dynamic_enable, a.features, a.static_enable },
std::array{ b.dynamic_enable, b.features, b.static_enable },
std::greater{},
more_features,
more_features
);
}
};
struct prioritized_metadata_comparator struct prioritized_metadata_comparator
{ {
using type = zgl::shader_source_metadata; using type = zgl::shader_source_metadata;
bool operator()(const type& a, const type& b) const noexcept bool operator()(const type& a, const type& b) const noexcept
{ {
if (a.geometry != b.geometry) if (a.geometry_type != b.geometry_type)
{ {
return a.geometry > b.geometry; return a.geometry_type > b.geometry_type;
} }
if (a.stage != b.stage) if (a.stage != b.stage)
@@ -64,62 +46,56 @@ struct prioritized_metadata_comparator
return a.stage > b.stage; return a.stage > b.stage;
} }
const auto features_a = a.generic_feature_set(); static constexpr auto more_components = std::popcount<assets::shader_components::flags>;
const auto features_b = b.generic_feature_set();
return feature_set_comparator(features_a, features_b); // Sort by dynamic components first to make sure when compatible components are found
// the compiled shader will have maximum dynamic compatibility.
return std::ranges::lexicographical_compare(
std::array{ a.dynamic_enable, a.components, a.static_enable },
std::array{ b.dynamic_enable, b.components, b.static_enable },
std::greater{},
more_components,
more_components
);
} }
private:
prioritized_feature_set_comparator feature_set_comparator{};
}; };
void zgl::shader_source_manager::process(const store_type& shader_sources) void zgl::shader_source_manager::process(const store_type& shader_sources)
{ {
namespace language = shading::shader_metadata_language; namespace language = shading::shader_metadata_language;
for (const auto& [ id, shader_source ] : shader_sources) for (const auto& [ id, shader_source ] : shader_sources)
{ {
m_value_token_buffer.clear(); const auto meta = metadata_type{
m_declaration_token_count_buffer.clear(); .stage = shader_source.stage,
std::ranges::fill( .components = shader_source.components,
m_declaration_type_index_buffer, .static_enable = shader_source.static_enable,
static_cast<std::size_t>(language::declaration_type::invalid) .dynamic_enable = shader_source.dynamic_enable
); };
tokenize_declarations(shader_source);
const auto metadata = parse_metadata_from_tokens();
if (not metadata)
{
ztu::logger::warn("Ignoring shader % as it contains malformed metadata.", id);
continue;
}
// Sorted insert should be faster than std::sort and std::unique // Sorted insert should be faster than std::sort and std::unique
// for small numbers of elements and high numbers of duplicates. // for small numbers of elements and high numbers of duplicates.
const auto it = std::ranges::upper_bound( const auto it = std::ranges::upper_bound(
m_shader_source_lookup, m_shader_source_lookup,
*metadata, meta,
prioritized_metadata_comparator{}, prioritized_metadata_comparator{},
&std::pair<shader_source_metadata, dynamic_shader_source_store::id_type>::first &entry_type::first
); );
if (it != m_shader_source_lookup.end() and it->first == *metadata) if (it != m_shader_source_lookup.end() and it->first == meta)
{ {
continue; continue;
} }
m_shader_source_lookup.emplace(it, *metadata, id); m_shader_source_lookup.emplace(it, meta, id);
} }
} }
void zgl::shader_source_manager::get_shader_sources( void zgl::shader_source_manager::fetch(
const assets::shader_source_store& shader_sources, const assets::shader_source_store& shader_sources,
std::span<const shading::shader_source_requirements> requirements, std::span<const shading::shader_requirements> requirements,
std::span<preprocessed_shader_source_metadata> metadata, std::span<preprocessed_shader_source_metadata> metadata,
std::vector<const char*>& shader_strings std::vector<const char*>& shader_strings
) { ) {
@@ -127,8 +103,8 @@ void zgl::shader_source_manager::get_shader_sources(
assert(requirements.size() == metadata.size()); assert(requirements.size() == metadata.size());
static constexpr auto max_shader_strings = std::max( static constexpr auto max_shader_strings = std::max(
mesh_feature_defines.size(), mesh_component_defines.size(),
point_cloud_feature_defines.size() point_cloud_component_defines.size()
) + 1; ) + 1;
shader_strings.reserve(max_shader_strings); shader_strings.reserve(max_shader_strings);
@@ -136,43 +112,42 @@ void zgl::shader_source_manager::get_shader_sources(
std::ranges::transform( std::ranges::transform(
requirements, requirements,
metadata.begin(), metadata.begin(),
[&](const shading::shader_source_requirements& req) [&](const shading::shader_requirements& req)
{ {
auto res = preprocessed_shader_source_metadata{}; auto res = preprocessed_shader_source_metadata{};
auto source_it = std::ranges::lower_bound( auto source_it = std::ranges::lower_bound(
m_shader_source_lookup, m_shader_source_lookup,
std::pair{ req.geometry, req.stage }, std::pair{ req.geometry_type, req.stage },
std::greater{}, std::greater{},
[](const source_lookup_entry_type& entry) [](const entry_type& entry)
{ {
const auto& meta = entry.first; const auto& meta = entry.first;
return std::pair{ meta.geometry, meta.stage }; return std::pair{ meta.geometry_type, meta.stage };
} }
); );
assets::shader_source_store::id_type source_id{}; assets::shader_source_store::id_type source_id{};
shading::features::generic::type to_be_enabled{}; assets::shader_components::flags to_be_enabled{};
while ( while (
source_it != m_shader_source_lookup.end() and source_it != m_shader_source_lookup.end() and
source_it->first.geometry == req.geometry and source_it->first.geometry == req.geometry_type and
source_it->first.stage == req.stage source_it->first.stage == req.stage
) { ) {
const auto& [ meta, id ] = *source_it; const auto& [ meta, id ] = *source_it;
const auto& [ features, static_enable, dynamic_enable ] = meta.generic_feature_set();
const auto missing_features = req.features & ~features; const auto missing_components = req.components & ~meta.components;
const auto unwanted_features = ~req.features & features; const auto unwanted_components = ~req.components & meta.components;
const auto fixed_unwanted_features = unwanted_features & ~static_enable & ~dynamic_enable; const auto fixed_unwanted_components = unwanted_components & ~meta.static_enable & ~meta.dynamic_enable;
if (missing_features == 0 and fixed_unwanted_features == 0) if (missing_components == 0 and fixed_unwanted_components == 0)
{ {
to_be_enabled = req.features & static_enable; to_be_enabled = req.components & meta.static_enable;
source_id = id; source_id = id;
res.static_enabled = features & ~dynamic_enable & ~unwanted_features; res.static_enabled = meta.commponents & ~meta.dynamic_enable & ~unwanted_components;
res.dynamic_enable = dynamic_enable; res.dynamic_enable = meta.dynamic_enable;
break; break;
} }
@@ -186,7 +161,7 @@ void zgl::shader_source_manager::get_shader_sources(
if (source_found) if (source_found)
{ {
get_define_strings( get_define_strings(
req.geometry, req.geometry_type,
to_be_enabled, to_be_enabled,
res.string_count, res.string_count,
shader_strings shader_strings
@@ -200,276 +175,34 @@ void zgl::shader_source_manager::get_shader_sources(
} }
void zgl::shader_source_manager::get_define_strings( void zgl::shader_source_manager::get_define_strings(
const shading::model_geometry::types geometry, const assets::model_geometry::types geometry_type,
shading::features::generic::type features, assets::shader_components::flags components,
shading::features::generic::type& feature_count, assets::shader_components::flags& component_count,
std::vector<const char*>& defines std::vector<const char*>& defines
) { ) {
std::span<const char*> all_defines; std::span<const char*> all_defines;
switch (geometry) switch (geometry_type)
{ {
case shading::model_geometry::types::mesh: case shading::model_geometry::types::mesh:
all_defines = mesh_feature_defines; all_defines = mesh_component_defines;
break; break;
case shading::model_geometry::types::point_cloud: case shading::model_geometry::types::point_cloud:
all_defines = point_cloud_feature_defines; all_defines = point_cloud_component_defines;
break; break;
default: default:
std::unreachable(); std::unreachable();
} }
auto index = std::size_t{}; auto index = std::size_t{};
while (features != 0) while (components != 0)
{ {
if ((features & 1) != 0) if ((components & 1) != 0)
{ {
defines.push_back(all_defines[index]); defines.push_back(all_defines[index]);
++feature_count; ++component_count;
} }
features >>= 1; components >>= 1;
++index; ++index;
} }
} }
void zgl::shader_source_manager::tokenize_declarations(
std::string_view source_rest
) {
namespace language = shading::shader_metadata_language;
auto offset = std::string_view::size_type{};
auto keyword = language::declaration_prefix;
while ((offset = source_rest.find(keyword)) != std::string_view::npos)
{
const auto current_token_count = m_value_token_buffer.size();
auto line_end = source_rest.find('\n', offset);
if (line_end == std::string_view::npos)
{
line_end = source_rest.length();
}
auto declaration = source_rest.substr(offset, line_end - offset);
if ((offset = declaration.find(language::title_separator)) == std::string_view::npos)
{
continue;
}
const auto title = declaration.substr(0, offset);
if (const auto it = language::declaration_lookup.find(title); it != language::declaration_lookup.end())
{
const auto declaration_type = static_cast<std::size_t>(it->second);
m_declaration_type_index_buffer[declaration_type] = m_declaration_token_count_buffer.size();
}
else
{
continue;
}
declaration = declaration.substr(offset);
if (not declaration.empty() and declaration.front() == language::value_separator)
{
declaration = declaration.substr(sizeof(language::value_separator), declaration.length());
}
while ((offset = declaration.find(language::value_separator)) != std::string_view::npos)
{
m_value_token_buffer.emplace_back(declaration.substr(0, offset));
declaration = declaration.substr(offset + sizeof(language::value_separator));
}
if (not declaration.empty())
{
m_value_token_buffer.emplace_back(declaration);
}
m_declaration_token_count_buffer.emplace_back(
m_value_token_buffer.size() - current_token_count
);
source_rest = source_rest.substr(line_end + sizeof('\n'));
keyword = language::declaration_prefix.substr(sizeof('\n'));
}
}
bool zgl::shader_source_manager::parse_stage_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
) {
namespace language = shading::shader_metadata_language;
if (values.size() != 1)
{
ztu::logger::warn("Invalid stage declaration: Expected exactly one token but got %.", values.size());
return false;
}
const auto value = values.front();
if (const auto it = language::stage_lookup.find(value); it != language::stage_lookup.end())
{
metadata.stage = it->second;
}
else
{
ztu::logger::warn("Invalid stage declaration: Unknown stage %.", value);
return false;
}
return true;
}
bool zgl::shader_source_manager::parse_geometry_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
) {
namespace language = shading::shader_metadata_language;
if (values.size() != 1)
{
ztu::logger::warn("Invalid geometry declaration: Expected exactly one token but got %.", values.size());
return false;
}
const auto value = values.front();
if (const auto it = language::geometry_lookup.find(value); it != language::geometry_lookup.end())
{
metadata.geometry = it->second;
}
else
{
ztu::logger::warn("Invalid geometry declaration: Unknown geometry %.", value);
return false;
}
return true;
}
template<typename T>
void zgl::shader_source_manager::parse_feature_tokens(
std::span<const std::string_view> values,
const ztu::string_lookup<T>& feature_lookup,
T& features
) {
features = {};
for (const auto value : values)
{
if (const auto it = feature_lookup.find(value); it != feature_lookup.end())
{
features |= it->second;
}
else
{
ztu::logger::warn("Ignoring unknown feature token %.", value);
}
}
}
bool zgl::shader_source_manager::parse_features_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
) {
namespace language = shading::shader_metadata_language;
switch (metadata.geometry)
{
case shading::model_geometry::types::mesh:
parse_feature_tokens(values, language::mesh_feature_lookup, metadata.feature_set.mesh.features);
break;
case shading::model_geometry::types::point_cloud:
parse_feature_tokens(values, language::point_cloud_feature_lookup, metadata.feature_set.point_cloud.features);
break;
default:
ztu::logger::warn("Internal error: Unknown geometry index %.", static_cast<int>(metadata.geometry));
return false;
}
return true;
}
bool zgl::shader_source_manager::parse_static_enable_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
) {
namespace language = shading::shader_metadata_language;
switch (metadata.geometry)
{
case shading::model_geometry::types::mesh:
parse_feature_tokens(values, language::mesh_feature_lookup, metadata.feature_set.mesh.static_enable);
break;
case shading::model_geometry::types::point_cloud:
parse_feature_tokens(values, language::point_cloud_feature_lookup, metadata.feature_set.point_cloud.static_enable);
break;
default:
ztu::logger::warn("Internal error: Unknown geometry index %.", static_cast<int>(metadata.geometry));
return false;
}
return true;
}
bool zgl::shader_source_manager::parse_dynamic_enable_declaration(
std::span<const std::string_view> values,
shader_source_metadata& metadata
) {
namespace language = shading::shader_metadata_language;
switch (metadata.geometry)
{
case shading::model_geometry::types::mesh:
parse_feature_tokens(values, language::mesh_feature_lookup, metadata.feature_set.mesh.dynamic_enable);
break;
case shading::model_geometry::types::point_cloud:
parse_feature_tokens(values, language::point_cloud_feature_lookup, metadata.feature_set.point_cloud.dynamic_enable);
break;
default:
ztu::logger::warn("Internal error: Unknown geometry index %.", static_cast<int>(metadata.geometry));
return false;
}
return true;
}
std::optional<zgl::shader_source_metadata> zgl::shader_source_manager::parse_metadata_from_tokens()
{
namespace language = shading::shader_metadata_language;
using namespace std::string_view_literals;
shader_source_metadata data;
for (const auto [ type, name, parser ] :
{
std::make_tuple(language::declaration_type::stage, "stage"sv, &parse_stage_declaration),
std::make_tuple(language::declaration_type::geometry, "geometry"sv, &parse_geometry_declaration),
std::make_tuple(language::declaration_type::features, "features"sv, &parse_features_declaration),
std::make_tuple(language::declaration_type::static_enable, "static_enable"sv, &parse_static_enable_declaration),
std::make_tuple(language::declaration_type::dynamic_enable, "dynamic_enable"sv, &parse_dynamic_enable_declaration)
}
) {
const auto index = m_declaration_type_index_buffer[static_cast<std::size_t>(type)];
if (index == static_cast<std::size_t>(language::declaration_type::invalid))
{
ztu::logger::warn("Shader metadata error: Missing % declaration.", name);
return std::nullopt;
}
const auto value_token_offset = std::accumulate(
m_declaration_token_count_buffer.begin(),
m_declaration_token_count_buffer.begin() + index,
std::size_t{}
);
const auto value_token_count = m_declaration_token_count_buffer[index];
if (not parser(std::span(m_value_token_buffer).subspan(value_token_offset, value_token_count), data))
{
return std::nullopt;
}
}
return data;
}