Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TSBK03 Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fabian Johansson
TSBK03 Project
Commits
55e248f2
Commit
55e248f2
authored
5 months ago
by
Dethcrvsh
Browse files
Options
Downloads
Patches
Plain Diff
removed scaling from normals
parent
898862cd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
shaders/surface.vert
+3
-4
3 additions, 4 deletions
shaders/surface.vert
src/main.cpp
+4
-4
4 additions, 4 deletions
src/main.cpp
with
7 additions
and
8 deletions
shaders/surface.vert
+
3
−
4
View file @
55e248f2
...
...
@@ -24,7 +24,7 @@ struct Wave {
};
layout
(
std140
)
uniform
WaveBuffer
{
Wave
waves
[
1
6
];
Wave
waves
[
6
4
];
};
/* Get the offset for a single wave along the y-axis. */
...
...
@@ -41,7 +41,7 @@ float get_gerstner_xz(Wave wave, float dir, float x, float z, float t) {
// float w = 2.0/wave.L;
float
w
=
sqrt
(
g
*
(
2
*
pi
/
wave
.
L
));
float
phase_const
=
wave
.
S
*
w
;
float
Q
=
0
.
3
/
(
w
*
wave
.
A
*
in_WavesNum
);
float
Q
=
0
.
8
/
(
w
*
wave
.
A
*
in_WavesNum
);
return
Q
*
wave
.
A
*
dir
*
cos
(
dot
(
normalize
(
wave
.
D
)
*
w
,
vec2
(
x
,
z
))
+
t
*
phase_const
);
}
...
...
@@ -74,8 +74,7 @@ vec3 compute_normal(vec3 pos, float t) {
float
offset_z
=
(
get_waves
(
offset1
,
t
)
-
get_waves
(
offset2
,
t
)).
z
;
// Construct the normal using partial derivatives
float
scale
=
20
.
0
;
// TODO: Not here
return
normalize
(
vec3
(
-
offset_x
*
scale
,
1
.
0
,
-
offset_z
*
scale
));
return
normalize
(
vec3
(
-
offset_x
,
1
.
0
,
-
offset_z
));
}
void
main
(
void
)
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
4
−
4
View file @
55e248f2
...
...
@@ -38,8 +38,8 @@ struct Surface : public Object {
char
const
*
UNIFORM_BLOCK
=
"WaveBuffer"
;
static
int
const
MAX_WAVES
{
16
};
static
constexpr
float
const
MEDIAN_WAVELENGTH
{
2.6
};
static
constexpr
float
const
MEDIAN_AMPLITUDE
{
0.00
2
};
static
constexpr
float
const
MEDIAN_SPEED
{
0.
3
};
static
constexpr
float
const
MEDIAN_AMPLITUDE
{
0.00
6
};
static
constexpr
float
const
MEDIAN_SPEED
{
0.
6
};
static
constexpr
float
const
MEDIAN_DIR
{
3.14
/
4.0
};
struct
Wave
{
...
...
@@ -56,7 +56,7 @@ struct Surface : public Object {
std
::
vector
<
Wave
>
waves
{};
// Direction of the wind [0-2π]
float
wind_dir
{
3.14
/
3
.0
};
float
wind_dir
{
0
.0
};
Surface
()
=
default
;
...
...
@@ -86,7 +86,7 @@ struct Surface : public Object {
rd_amplitude
(
rd
),
rd_speed
(
rd
),
{},
vec2
(
cos
(
dir
),
sin
(
dir
))
vec2
(
cos
(
dir
),
sin
(
dir
))
,
};
}
...
...
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