# clang-format for the native C++ renderer (native/src, native/test, bindings.cpp).
#
# 4-space indent, indented namespace bodies, attached (K&R) braces, ~120-col
# lines. Function bodies always on a new line (no short one-liners).
# Run from the repo with:  clang-format -i native/**/*.{hpp,cpp}
---
Language: Cpp
BasedOnStyle: LLVM
Standard: Latest

ColumnLimit: 120
IndentWidth: 4
TabWidth: 4
UseTab: Never
AccessModifierOffset: -4
ContinuationIndentWidth: 4

NamespaceIndentation: All
FixNamespaceComments: true

PointerAlignment: Left
DerivePointerAlignment: false

AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false

AlignAfterOpenBracket: Align
BinPackParameters: false
BinPackArguments: true
SpaceBeforeParens: ControlStatements

# The math code leads continuation lines with the operator (the VectorMath
# determinant / inverse, Renderer shading expressions). Keep that.
BreakBeforeBinaryOperators: NonAssignment

# Preserve the stdlib / embree / local include groups (blank-line separated);
# sort only within each group.
IncludeBlocks: Preserve
SortIncludes: CaseSensitive
