Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
tome
Tales of MajEyal
Commits
223d801e
Commit
223d801e
authored
8 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
Fixed multiple shader effects on Intel & AMD GPUs
parent
1ad3ab2f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/engines/default/engine/Shader.lua
+10
-0
10 additions, 0 deletions
game/engines/default/engine/Shader.lua
game/modules/tome/data/gfx/shaders/tentacles.frag
+5
-4
5 additions, 4 deletions
game/modules/tome/data/gfx/shaders/tentacles.frag
with
15 additions
and
4 deletions
game/engines/default/engine/Shader.lua
+
10
−
0
View file @
223d801e
...
...
@@ -123,6 +123,11 @@ function _M:getFragment(name)
code
[
#
code
+
1
]
=
l
end
f
:
close
()
-- if config.settings.cheat then
-- print("====== FRAG")
-- local nb = 1 for line in table.concat(code):gmatch("([^\n]*)\n") do print(nb, line) nb = nb + 1 end
-- print("======")
-- end
self
.
frags
[
name
]
=
core
.
shader
.
newShader
(
table.concat
(
code
))
print
(
"[SHADER] created fragment shader from /data/gfx/shaders/"
..
name
..
".frag"
)
return
self
.
frags
[
name
]
...
...
@@ -139,6 +144,11 @@ function _M:getVertex(name)
code
[
#
code
+
1
]
=
l
end
f
:
close
()
-- if config.settings.cheat then
-- print("====== VERT")
-- local nb = 1 for line in table.concat(code):gmatch("([^\n]*)\n") do print(nb, line) nb = nb + 1 end
-- print("======")
-- end
self
.
verts
[
name
]
=
core
.
shader
.
newShader
(
table.concat
(
code
),
true
)
print
(
"[SHADER] created vertex shader from /data/gfx/shaders/"
..
name
..
".vert"
)
return
self
.
verts
[
name
]
...
...
This diff is collapsed.
Click to expand it.
game/modules/tome/data/gfx/shaders/tentacles.frag
+
5
−
4
View file @
223d801e
...
...
@@ -50,14 +50,15 @@ vec4 GetColor(const int layerIndex, vec2 texPos)
vec2
GetDistortion
(
vec2
texPos
,
int
layerIndex
,
int
distortionType
,
float
deformRate
)
{
float
layerIndexF
=
float
(
layerIndex
);
if
(
distortionType
==
0
)
{
float
alpha
=
0
.
2
*
sin
(
tick
/
time_factor
*
(
layerIndex
*
0
.
5
+
1
.
0
)
+
layerIndex
*
100
.
0
)
*
deformRate
;
float
alpha
=
0
.
2
*
sin
(
tick
/
time_factor
*
(
layerIndex
F
*
0
.
5
+
1
.
0
)
+
layerIndex
F
*
100
.
0
)
*
deformRate
;
mat2
rotation
=
mat2
(
cos
(
alpha
),
sin
(
alpha
),
-
sin
(
alpha
),
cos
(
alpha
));
return
clamp
(
rotation
*
(
texPos
-
vec2
(
0
.
5
))
+
vec2
(
0
.
5
),
0
.
01
,
0
.
99
);
}
else
if
(
distortionType
==
1
)
{
float
phase
=
length
(
texPos
-
vec2
(
0
.
5
));
float
alpha
=
0
.
2
*
sin
(
-
tick
/
time_factor
*
(
layerIndex
*
0
.
5
+
1
.
0
)
+
phase
*
30
.
0
+
layerIndex
*
100
.
0
)
*
deformRate
;
float
alpha
=
0
.
2
*
sin
(
-
tick
/
time_factor
*
(
layerIndex
F
*
0
.
5
+
1
.
0
)
+
phase
*
30
.
0
+
layerIndex
F
*
100
.
0
)
*
deformRate
;
mat2
rotation
=
mat2
(
cos
(
alpha
),
sin
(
alpha
),
-
sin
(
alpha
),
cos
(
alpha
));
return
clamp
(
rotation
*
(
texPos
-
vec2
(
0
.
5
))
+
vec2
(
0
.
5
),
0
.
01
,
0
.
99
);
...
...
@@ -83,8 +84,8 @@ void main(void)
int
backLayersCount
=
int
(
backgroundLayersCount
+
0
.
5
);
for
(
int
layerIndex
=
0
;
layerIndex
<
4
;
layerIndex
++
)
{
if
(
noup
==
1
&&
layerIndex
<
backLayersCount
)
continue
;
if
(
noup
==
2
&&
layerIndex
>=
backLayersCount
)
continue
;
if
(
noup
==
1
.
0
&&
layerIndex
<
backLayersCount
)
continue
;
if
(
noup
==
2
.
0
&&
layerIndex
>=
backLayersCount
)
continue
;
float
deformRate
=
GetDistortionRange
(
layerIndex
,
pos
);
vec2
texPos
=
GetDistortion
(
pos
,
layerIndex
,
distortionType
,
deformRate
);
vec4
layerColor
=
GetColor
(
layerIndex
,
texPos
);
...
...
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