Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
61 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
@include <shaders/generic.dei> | ||
@include <shaders/fx-blur.dei> | ||
@include <shaders/ui.dei> | ||
@include <shaders/indirect.dei> | ||
@include <shaders/app/app.dei> | ||
@include <shaders/gloom.dei> | ||
@include <shaders/model.dei> |
3 changes: 3 additions & 0 deletions
3
doomsday/tests/test_gloom/net.dengine.gloom.pack/shaders/app/app.dei
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@include <generic.dei> | ||
@include <fx_blur.dei> | ||
@include <ui.dei> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
15 changes: 8 additions & 7 deletions
15
...m/net.dengine.gloom.pack/shaders/fog.glsl → ...engine.gloom.pack/shaders/common/fog.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
highp float fogDensity(highp vec3 worldPos, highp vec3 eyePos, highp float fogEnd) | ||
{ | ||
#ifndef GLOOM_FOG_H | ||
#define GLOOM_FOG_H | ||
|
||
float fogDensity(vec3 worldPos, vec3 eyePos, float fogEnd) { | ||
return clamp(log(distance(worldPos, eyePos) / fogEnd)/3.0 + 1.0, 0.0, 1.0); | ||
} | ||
|
||
/** | ||
* Determine fog color at a given world position. The alpha component of fog color | ||
* Determine fog color at a given world position. The alpha component of fog color | ||
* determines how thick the fog is at the point. | ||
* | ||
* @param worldPos World coordinates. | ||
* @param eyePos Eye in world coordinates. | ||
* @param fogSpec (R, G, B, maxdist) | ||
*/ | ||
highp vec4 fogColor(highp vec3 worldPos, highp vec3 eyePos, highp vec4 fogSpec) | ||
{ | ||
vec4 fogColor(vec3 worldPos, vec3 eyePos, vec4 fogSpec) { | ||
return vec4(fogSpec.rgb, fogDensity(worldPos, eyePos, fogSpec.a)); | ||
} | ||
|
||
highp vec4 mixFog(highp vec4 color, highp vec4 fog) | ||
{ | ||
vec4 mixFog(vec4 color, vec4 fog) { | ||
return vec4(mix(color.rgb, fog.rgb, fog.a), color.a); | ||
} | ||
|
||
#endif // GLOOM_FOG_H |
8 changes: 8 additions & 0 deletions
8
doomsday/tests/test_gloom/net.dengine.gloom.pack/shaders/common/gbuffer_in.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef GLOOM_GBUFFER_IN_H | ||
#define GLOOM_GBUFFER_IN_H | ||
|
||
uniform sampler2D uGBufferAlbedo; | ||
uniform sampler2D uGBufferNormal; | ||
uniform sampler2D uGBufferDepth; | ||
|
||
#endif // GLOOM_GBUFFER_IN_H |
9 changes: 4 additions & 5 deletions
9
...t.dengine.gloom.pack/shaders/gbuffer.glsl → ...loom.pack/shaders/common/gbuffer_out.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
#ifndef GLOOM_GBUFFER_H | ||
#define GLOOM_GBUFFER_H | ||
#ifndef GLOOM_GBUFFER_OUT_H | ||
#define GLOOM_GBUFFER_OUT_H | ||
|
||
layout (location = 1) out vec4 out_Normal; | ||
|
||
uniform mat3 uWorldToViewMatrix; | ||
|
||
void GBuffer_SetFragmentNormal(vec3 worldNormal) | ||
{ | ||
void GBuffer_SetFragmentNormal(vec3 worldNormal) { | ||
out_Normal = vec4(normalize(uWorldToViewMatrix * worldNormal) * 0.5 + vec3(0.5), 1.0); | ||
} | ||
|
||
#endif // GLOOM_GBUFFER_H | ||
#endif // GLOOM_GBUFFER_OUT_H |
18 changes: 10 additions & 8 deletions
18
...engine.gloom.pack/shaders/lightmodel.glsl → ...gloom.pack/shaders/common/lightmodel.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
highp float lightIntensity(highp vec3 normal, highp vec3 lightDir) | ||
{ | ||
#ifndef GLOOM_LIGHTMODEL_H | ||
#define GLOOM_LIGHTMODEL_H | ||
|
||
float lightIntensity(vec3 normal, vec3 lightDir) { | ||
return clamp(dot(normal, -lightDir) + 0.1, 0.0, 1.0); | ||
} | ||
|
||
/** | ||
* Light model with one Sun-like bright light source at an infinite distance. | ||
* | ||
* | ||
* @param normal Surface normal. | ||
* @param lightDir Light direction vector. | ||
* @param fogSpec Fog RGB, maxdistance. | ||
*/ | ||
highp vec3 sunLightFactor(highp vec3 normal, highp vec3 lightDir, highp vec4 fogSpec) | ||
{ | ||
vec3 sunLightFactor(vec3 normal, vec3 lightDir, vec4 fogSpec) { | ||
// Ambient light. | ||
highp vec3 ambientColor = fogSpec.rgb * 0.75; | ||
vec3 ambientColor = fogSpec.rgb * 0.75; | ||
|
||
float intensity = lightIntensity(normal, lightDir); | ||
|
||
highp float intensity = lightIntensity(normal, lightDir); | ||
|
||
return (ambientColor + vec3(intensity)) * 0.6; | ||
} | ||
|
||
#endif // GLOOM_LIGHTMODEL_H |
5 changes: 5 additions & 0 deletions
5
....dengine.gloom.pack/shaders/miplevel.glsl → ...e.gloom.pack/shaders/common/miplevel.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
#ifndef GLOOM_MIPLEVEL_H | ||
#define GLOOM_MIPLEVEL_H | ||
|
||
// Determines mipmap level. | ||
float mipLevel(vec2 uv, vec2 texSize) { | ||
vec2 dx = dFdx(uv * texSize.x); | ||
vec2 dy = dFdy(uv * texSize.y); | ||
float d = max(dot(dx, dx), dot(dy, dy)); | ||
return 0.5 * log2(d); | ||
} | ||
|
||
#endif // GLOOM_MIPLEVEL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
doomsday/tests/test_gloom/net.dengine.gloom.pack/shaders/surface.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
doomsday/tests/test_gloom/net.dengine.gloom.pack/shaders/surface.vsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include 'flags.glsl' | ||
#include "common/flags.glsl" | ||
|
||
uniform mat4 uMvpMatrix; | ||
uniform sampler2D uPlanes; | ||
|