Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Dependencies
Cpp
mirrage
Commits
dc7a4135
Commit
dc7a4135
authored
Nov 15, 2017
by
Florian Oetke
Browse files
better mip mapping + pause for animation seq.
parent
3cf8b577
Changes
8
Hide whitespace changes
Inline
Side-by-side
assets/core_assets/shader/bin/gi_mipgen.frag.spv
View file @
dc7a4135
No preview for this file type
assets/core_assets/shader/gi_integrate_brdf.frag
View file @
dc7a4135
...
...
@@ -2,6 +2,9 @@
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
// Based on:
// http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
// https://learnopengl.com/#!PBR/IBL/Specular-IBL
layout
(
location
=
0
)
in
Vertex_data
{
vec2
tex_coords
;
...
...
assets/core_assets/shader/gi_mipgen.frag
View file @
dc7a4135
...
...
@@ -52,10 +52,12 @@ void main() {
vec4
center_depths
=
vec4
(
depth_00
.
y
,
depth_10
.
x
,
depth_11
.
w
,
depth_01
.
z
);
vec4
score
=
vec4
(
g2
(
avg_depth
-
center_depths
.
x
),
g2
(
avg_depth
-
center_depths
.
y
),
g2
(
avg_depth
-
center_depths
.
z
),
g2
(
avg_depth
-
center_depths
.
w
)
);
vec4
score
=
vec4
(
0
.
8
,
0
.
8
,
0
.
8
,
1
.
0
);
score
*=
vec4
(
g2
(
avg_depth
-
center_depths
.
x
),
g2
(
avg_depth
-
center_depths
.
y
),
g2
(
avg_depth
-
center_depths
.
z
),
g2
(
avg_depth
-
center_depths
.
w
)
);
vec4
normal_x_00
=
textureGather
(
mat_data_sampler
,
uv_00
,
0
);
...
...
@@ -89,13 +91,21 @@ void main() {
g1
(
avg_normal_y
-
center_normals_y
.
z
),
g1
(
avg_normal_y
-
center_normals_y
.
w
)
);
int
max_index
=
0
;
if
(
score
.
y
>
score
.
x
)
int
max_index
=
3
;
float
s
=
score
.
w
;
if
(
score
.
x
>
s
)
{
max_index
=
0
;
s
=
score
.
x
;
}
if
(
score
.
y
>
s
)
{
max_index
=
1
;
if
(
score
.
z
>
score
.
y
)
s
=
score
.
y
;
}
if
(
score
.
z
>
s
)
{
max_index
=
2
;
if
(
score
.
w
>
score
.
z
)
max_index
=
3
;
s
=
score
.
z
;
}
out_depth
=
texelFetch
(
depth_sampler
,
ivec2
(
vertex_out
.
tex_coords
*
tex_size
)
+
center_offsets
[
max_index
],
0
);
...
...
assets/core_assets/shader/model.frag
View file @
dc7a4135
...
...
@@ -66,15 +66,13 @@ vec3 decode_tangent_normal(vec2 tn) {
vec3
tangent_space_to_world
(
vec3
N
)
{
vec3
VN
=
normalize
(
normal
);
// calculate tangent
(assimp generated tangent contain weird artifacts)
// calculate tangent
vec3
p_dx
=
dFdx
(
view_pos
);
vec3
p_dy
=
dFdy
(
view_pos
);
vec2
tc_dx
=
dFdx
(
tex_coords
);
vec2
tc_dy
=
dFdy
(
tex_coords
);
// TODO: check alternativ
vec3
p_dy_N
=
cross
(
p_dy
,
VN
);
vec3
p_dx_N
=
cross
(
VN
,
p_dx
);
...
...
@@ -84,16 +82,5 @@ vec3 tangent_space_to_world(vec3 N) {
float
inv_max
=
inversesqrt
(
max
(
dot
(
T
,
T
),
dot
(
B
,
B
)));
mat3
TBN
=
mat3
(
T
*
inv_max
,
B
*
inv_max
,
VN
);
return
normalize
(
TBN
*
N
);
/*
vec3 VT = normalize( tc_dy.y * p_dx - tc_dx.y * p_dy );
VT = normalize(VT - dot(VT, VN) * VN);
vec3 VB = cross(VT, VN);
mat3 TBN = mat3(VT, VB, VN);
return normalize(TBN * N);*/
}
assets/demo_assets/settings/input_mapping.json
View file @
dc7a4135
...
...
@@ -30,6 +30,7 @@
"F1"
:
{
"type"
:
"once"
,
"action"
:
"start_record"
},
"F2"
:
{
"type"
:
"once"
,
"action"
:
"save_record"
},
"F3"
:
{
"type"
:
"once"
,
"action"
:
"playback"
},
"Space"
:
{
"type"
:
"once"
,
"action"
:
"pause"
},
"F11"
:
{
"type"
:
"once"
,
"action"
:
"toggle_ui"
}
},
...
...
src/demo/src/systems/nim_system.cpp
View file @
dc7a4135
...
...
@@ -166,8 +166,10 @@ namespace mirrage::systems {
if
(
!
_playing
)
return
;
_current_position
+=
dt
/
_playing
->
frame_length
(
static_cast
<
int
>
(
_current_position
))
*
_playback_speed
;
if
(
!
_paused
)
{
_current_position
+=
dt
/
_playing
->
frame_length
(
static_cast
<
int
>
(
_current_position
))
*
_playback_speed
;
}
if
(
_loop
)
{
_current_position
=
static_cast
<
float
>
(
std
::
fmod
(
_current_position
,
_playing
->
frames
()));
...
...
src/demo/src/systems/nim_system.hpp
View file @
dc7a4135
...
...
@@ -102,6 +102,11 @@ namespace mirrage::systems {
void
stop
();
void
pause
()
{
_paused
=
true
;
}
void
unpause
()
{
_paused
=
false
;
}
void
toggle_pause
()
{
_paused
=
!
_paused
;
}
auto
paused
()
const
{
return
_paused
;
}
void
start_recording
(
Nim_sequence
&
);
// appends the current state of all relevant objects
void
record
(
util
::
Time
length
,
Nim_sequence
&
);
...
...
@@ -118,6 +123,7 @@ namespace mirrage::systems {
float
_current_position
;
int
_end_position
;
bool
_loop
;
bool
_paused
=
false
;
void
_update_lookup_table
();
};
...
...
src/demo/src/test_screen.cpp
View file @
dc7a4135
...
...
@@ -137,6 +137,10 @@ namespace mirrage {
_meta_system
.
nims
().
play_looped
(
rec
);
});
break
;
case
"pause"
_strid
:
MIRRAGE_INFO
(
"Pause/Unpause playback"
);
_meta_system
.
nims
().
toggle_pause
();
break
;
case
"toggle_ui"
_strid
:
_show_ui
=
!
_show_ui
;
break
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment