Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
age_maker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marek Trtík
age_maker
Commits
b4c01d2a
There was an error fetching the commit references. Please try again later.
Commit
b4c01d2a
authored
1 year ago
by
Petr Babic
Browse files
Options
Downloads
Patches
Plain Diff
use default material
parent
6ca85c64
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.clang-format
+234
-0
234 additions, 0 deletions
.clang-format
src/presenter.cpp
+35
-52
35 additions, 52 deletions
src/presenter.cpp
with
269 additions
and
52 deletions
.clang-format
0 → 100644
+
234
−
0
View file @
b4c01d2a
---
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: ^(<|"(gtest|gmock|isl|json)/)
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: .*
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: (Test)?$
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
Language: Cpp
LineEnding: DeriveLF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PPIndentWidth: -1
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InConditionalStatements: false
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
This diff is collapsed.
Click to expand it.
src/presenter.cpp
+
35
−
52
View file @
b4c01d2a
#include
<maker/presenter.hpp>
#include
<maker/index.hpp>
#include
<com/math_files.hpp>
#include
<gfx/index.hpp>
#include
<maker/index.hpp>
#include
<maker/presenter.hpp>
#include
<osi/index.hpp>
#include
<com/math_files.hpp>
namespace
mak
{
Presenter
::
Presenter
()
:
com
::
Runner
{
self_name
()
}
{}
Presenter
::
Presenter
()
:
com
::
Runner
{
self_name
()
}
{}
Presenter
::~
Presenter
()
{}
Presenter
::~
Presenter
()
{}
static
com
::
Folder
*
generate_grid
()
{
auto
shader
=
gfx
::
shader_system
()
->
insert_shader
(
"grid_shader"
,
gfx
::
Shader
::
Pipeline
::
FORWARD
,
gfx
::
Shader
::
UNLIT
,
{
"shaders"
});
auto
color
=
shader
->
insert
<
gfx
::
Shader
::
UniformNode
>
(
gfx
::
Shader
::
Node
::
SlotDefinition
{
"color"
,
"color"
,
gfx
::
Shader
::
Node
::
DataType
::
ElementType
::
VEC3
});
shader
->
connect
(
shader
->
root
(),
gfx
::
Shader
::
MasterNodeUnlit
::
inputs
::
color
,
color
,
0
);
auto
material
=
gfx
::
material_system
()
->
insert_material
(
"grid_material"
,
shader
,
{
gfx
::
material_system
()
->
materials
()
->
name
()});
auto
material
=
gfx
::
material_system
()
->
insert_default_material
(
"grid_material"
,
{
"materials"
},
vec3
{
0
});
auto
grid
=
gfx
::
object_system
()
->
insert_object
(
{
"grid"
},
material
,
gfx
::
buffer_generators
()
->
insert_procedural_grid
()
);
auto
grid
=
gfx
::
object_system
()
->
insert_object
({
"grid"
},
material
,
gfx
::
buffer_generators
()
->
insert_procedural_grid
());
gfx
::
object_system
()
->
push_frame_back
(
grid
,
grid_frame
());
return
grid
;
}
static
com
::
Folder
*
generate_box
(
vec3
position
,
vec3
half_sizes_along_axes
)
{
auto
shader
=
gfx
::
shader_system
()
->
insert_shader
(
"box_shader"
,
gfx
::
Shader
::
Pipeline
::
FORWARD
,
gfx
::
Shader
::
LIT
,
{
"shaders"
});
auto
texture
=
shader
->
insert
<
gfx
::
Shader
::
TextureNode
>
(
"/home/pbabic/Repositories/age_app_template/data/age/texture/UV.jpeg"
);
auto
container
=
shader
->
insert
<
gfx
::
Shader
::
TextureNode
>
(
"/home/pbabic/Repositories/age_app_template/data/age/texture/container.jpg"
);
auto
shader
=
gfx
::
shader_system
()
->
insert_shader
(
"box_shader"
,
gfx
::
Shader
::
Pipeline
::
FORWARD
,
gfx
::
Shader
::
LIT
,
{
"shaders"
});
auto
texture
=
shader
->
insert
<
gfx
::
Shader
::
TextureNode
>
(
"/home/pbabic/Repositories/age_app_template/data/age/texture/UV.jpeg"
);
auto
container
=
shader
->
insert
<
gfx
::
Shader
::
TextureNode
>
(
"/home/pbabic/Repositories/age_app_template/data/age/texture/container.jpg"
);
auto
tex_coords
=
shader
->
insert
<
gfx
::
Shader
::
NodeVaryingTexcoord
>
();
shader
->
connect
(
texture
,
gfx
::
Shader
::
TextureNode
::
inputs
::
tex_coord
,
tex_coords
,
0
);
...
...
@@ -47,14 +40,12 @@ static com::Folder *generate_box(vec3 position, vec3 half_sizes_along_axes) {
shader
->
connect
(
shader
->
root
(),
gfx
::
Shader
::
MasterNodeLit
::
inputs
::
diffuse
,
add
,
0
);
shader
->
connect
(
shader
->
root
(),
gfx
::
Shader
::
MasterNodeLit
::
inputs
::
specular
,
add
,
0
);
auto
material
=
gfx
::
material_system
()
->
insert_material
(
"box_material"
,
shader
,
{
gfx
::
material_system
()
->
materials
()
->
name
()});
auto
material
=
gfx
::
material_system
()
->
insert_material
(
"box_material"
,
shader
,
{
gfx
::
material_system
()
->
materials
()
->
name
()
});
auto
box
=
gfx
::
object_system
()
->
insert_object
(
{
"test_box"
},
material
,
gfx
::
buffer_generators
()
->
insert_procedural_box_solid
(
half_sizes_along_axes
,
"test_box"
,
{
"maker"
})
);
{
"test_box"
},
material
,
gfx
::
buffer_generators
()
->
insert_procedural_box_solid
(
half_sizes_along_axes
,
"test_box"
,
{
"maker"
}));
auto
frame
=
root
()
->
push_back
<
com
::
Folder
>
(
"test_box"
)
->
push_back
<
com
::
Frame
>
();
frame
->
set_origin
(
position
);
gfx
::
object_system
()
->
push_frame_back
(
box
,
frame
);
...
...
@@ -65,62 +56,54 @@ static com::Folder *generate_box(vec3 position, vec3 half_sizes_along_axes) {
static
com
::
Folder
*
generate_point_light
(
vec3
position
,
vec3
color
,
float
radius
)
{
auto
point_light_frame
=
root
()
->
push_back
<
com
::
Folder
>
(
"point_light"
)
->
push_back
<
com
::
Frame
>
();
point_light_frame
->
move_origin
(
position
);
auto
point_light
=
gfx
::
light_system
()
->
insert_light
<
gfx
::
PointLight
>
({
"point_light"
},
point_light_frame
,
color
,
radius
);
auto
point_light
=
gfx
::
light_system
()
->
insert_light
<
gfx
::
PointLight
>
({
"point_light"
},
point_light_frame
,
color
,
radius
);
auto
shader
=
gfx
::
shader_system
()
->
insert_shader
(
"point_light_shader"
,
gfx
::
Shader
::
Pipeline
::
FORWARD
,
gfx
::
Shader
::
UNLIT
,
{
"shaders"
});
auto
color_node
=
shader
->
insert
<
gfx
::
Shader
::
UniformNode
>
(
gfx
::
Shader
::
Node
::
SlotDefinition
{
"color"
,
"color"
,
gfx
::
Shader
::
Node
::
DataType
::
ElementType
::
VEC3
});
shader
->
connect
(
shader
->
root
(),
gfx
::
Shader
::
MasterNodeUnlit
::
inputs
::
color
,
color_node
,
0
);
auto
material
=
gfx
::
material_system
()
->
insert_material
(
"point_light_material"
,
shader
,
{
gfx
::
material_system
()
->
materials
()
->
name
()});
material
->
set_uniform
(
color_node
->
name
(),
color
);
auto
material
=
gfx
::
material_system
()
->
insert_default_material
(
"point_light_material"
,
{
"materials"
},
color
);
// point light visualizer box
gfx
::
object_system
()
->
push_frame_back
(
gfx
::
object_system
()
->
insert_object
(
{
"point_light_box"
},
material
,
gfx
::
buffer_generators
()
->
insert_procedural_box_solid
({
0.1
,
0.1
,
0.1
},
"point_light_box"
,
{
"maker"
})
),
point_light_frame
);
{
"point_light_box"
},
material
,
gfx
::
buffer_generators
()
->
insert_procedural_box_solid
({
0.1
,
0.1
,
0.1
},
"point_light_box"
,
{
"maker"
})),
point_light_frame
);
return
point_light
;
}
void
Presenter
::
initialize
()
{
void
Presenter
::
initialize
()
{
osi
::
presenters
()
->
push_back
<
com
::
Folder
>
(
"maker"
)
->
push_back
<
com
::
Link
>
(
self_name
()
+
".link"
,
this
);
auto
grid
=
generate_grid
();
auto
box
=
generate_box
(
vec3
{
0
},
vec3
{
0.5
});
auto
box
=
generate_box
(
vec3
{
0
},
vec3
{
0.5
});
auto
point_light
=
generate_point_light
({
2
,
1
,
1
},
{
0
,
1
,
1
},
20
);
auto
point_light
=
generate_point_light
({
2
,
1
,
1
},
{
0
,
1
,
1
},
20
);
gfx
::
object_system
()
->
insert_light
(
box
,
point_light
);
// directional light
auto
light_frame
=
root
()
->
push_back
<
com
::
Folder
>
(
"dir_light"
)
->
push_back
<
com
::
Frame
>
();
light_frame
->
set_rotation
(
quat
{{
1.2
,
0.8
,
0.3
}});
auto
light
=
gfx
::
light_system
()
->
insert_light
<
gfx
::
DirectionalLight
>
({
"dir_light"
},
light_frame
,
vec3
{
0.75
,
0.5
,
0.5
});
light_frame
->
set_rotation
(
quat
{
{
1.2
,
0.8
,
0.3
}
});
auto
light
=
gfx
::
light_system
()
->
insert_light
<
gfx
::
DirectionalLight
>
({
"dir_light"
},
light_frame
,
vec3
{
0.75
,
0.5
,
0.5
});
gfx
::
object_system
()
->
insert_light
(
box
,
light
);
// ambient light
gfx
::
object_system
()
->
insert_light
(
box
,
gfx
::
light_system
()
->
insert_light
<
gfx
::
AmbientLight
>
({
"ambient_light"
},
nullptr
,
vec3
{
0.1
,
1
,
0.5
}));
gfx
::
object_system
()
->
insert_light
(
box
,
gfx
::
light_system
()
->
insert_light
<
gfx
::
AmbientLight
>
({
"ambient_light"
},
nullptr
,
vec3
{
0.1
,
1
,
0.5
}));
print_tree
(
*
root
());
print_tree
(
*
gfx
::
material_system
()
->
folder
());
}
void
Presenter
::
release
()
{
void
Presenter
::
release
()
{
osi
::
presenters
()
->
find
<
com
::
Folder
>
(
"maker"
)
->
erase
(
self_name
()
+
".link"
);
root
()
->
erase
(
"test_box"
);
}
void
Presenter
::
next_round
()
{
void
Presenter
::
next_round
()
{
gfx
::
renderer
()
->
clear_render_buffers
();
gfx
::
renderer
()
->
present_collection
(
gfx
::
object_system
()
->
objects
());
}
}
}
// namespace mak
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment