Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
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
Vulkan2021
VkCV Framework
Commits
e7d8aaf5
Commit
e7d8aaf5
authored
3 years ago
by
Alexander Gauggel
Browse files
Options
Downloads
Patches
Plain Diff
[
#81
] Add sun color and brightness to UI
parent
18a5ce25
No related branches found
No related tags found
1 merge request
!68
Resolve "Complete Voxelization"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projects/voxelization/resources/shaders/shader.frag
+9
-8
9 additions, 8 deletions
projects/voxelization/resources/shaders/shader.frag
projects/voxelization/src/main.cpp
+10
-6
10 additions, 6 deletions
projects/voxelization/src/main.cpp
with
19 additions
and
14 deletions
projects/voxelization/resources/shaders/shader.frag
+
9
−
8
View file @
e7d8aaf5
...
...
@@ -11,7 +11,9 @@ layout(location = 2) in vec3 passPos;
layout
(
location
=
0
)
out
vec3
outColor
;
layout
(
set
=
0
,
binding
=
0
)
uniform
sunBuffer
{
vec3
L
;
float
padding
;
vec3
L
;
float
padding
;
vec3
sunColor
;
float
sunStrength
;
mat4
lightMatrix
;
};
layout
(
set
=
0
,
binding
=
1
)
uniform
texture2D
shadowMap
;
...
...
@@ -35,11 +37,10 @@ float shadowTest(vec3 worldPos){
}
void
main
()
{
vec3
N
=
normalize
(
passNormal
);
vec3
sunColor
=
vec3
(
1
);
vec3
sun
=
sunColor
*
clamp
(
dot
(
N
,
L
),
0
,
1
);
sun
*=
shadowTest
(
passPos
);
vec3
ambient
=
vec3
(
0
.
1
);
vec3
albedo
=
texture
(
sampler2D
(
albedoTexture
,
textureSampler
),
passUV
).
rgb
;
outColor
=
albedo
*
(
sun
+
ambient
);
vec3
N
=
normalize
(
passNormal
);
vec3
sun
=
sunStrength
*
sunColor
*
clamp
(
dot
(
N
,
L
),
0
,
1
);
sun
*=
shadowTest
(
passPos
);
vec3
ambient
=
vec3
(
0
.
1
);
vec3
albedo
=
texture
(
sampler2D
(
albedoTexture
,
textureSampler
),
passUV
).
rgb
;
outColor
=
albedo
*
(
sun
+
ambient
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
projects/voxelization/src/main.cpp
+
10
−
6
View file @
e7d8aaf5
...
...
@@ -13,8 +13,8 @@
int
main
(
int
argc
,
const
char
**
argv
)
{
const
char
*
applicationName
=
"Voxelization"
;
uint32_t
windowWidth
=
8
0
0
;
uint32_t
windowHeight
=
60
0
;
uint32_t
windowWidth
=
12
80
;
uint32_t
windowHeight
=
72
0
;
vkcv
::
Window
window
=
vkcv
::
Window
::
create
(
applicationName
,
...
...
@@ -156,9 +156,11 @@ int main(int argc, const char** argv) {
// light info buffer
struct
LightInfo
{
glm
::
vec3
direction
;
float
padding
;
glm
::
mat4
lightMatrix
;
glm
::
vec3
direction
;
float
padding
;
glm
::
vec3
sunColor
=
glm
::
vec3
(
1.
f
);
float
sunStrength
=
1.
f
;
glm
::
mat4
lightMatrix
;
};
LightInfo
lightInfo
;
vkcv
::
Buffer
lightBuffer
=
core
.
createBuffer
<
LightInfo
>
(
vkcv
::
BufferType
::
UNIFORM
,
sizeof
(
glm
::
vec3
));
...
...
@@ -449,7 +451,9 @@ int main(int argc, const char** argv) {
gui
.
beginGUI
();
ImGui
::
Begin
(
"Settings"
);
ImGui
::
DragFloat2
(
"Light angles"
,
&
lightAngles
.
x
);
ImGui
::
DragFloat2
(
"Light angles"
,
&
lightAngles
.
x
);
ImGui
::
ColorEdit3
(
"Sun color"
,
&
lightInfo
.
sunColor
.
x
);
ImGui
::
DragFloat
(
"Sun strength"
,
&
lightInfo
.
sunStrength
);
ImGui
::
End
();
gui
.
endGUI
();
...
...
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