-
Notifications
You must be signed in to change notification settings - Fork 0
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
15 changed files
with
618 additions
and
247 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#version 450 core | ||
|
||
#define PI 3.1415926535897932384626433832795 | ||
|
||
layout (set = 0, binding = 0) uniform samplerCube skyboxCubeMap; | ||
|
||
layout (location = 0) in vec3 inTexCoord; | ||
layout (location = 1) in float inDeltaPhi; | ||
layout (location = 2) in float inDeltaTheta; | ||
|
||
layout(location = 0) out vec4 outColor; | ||
|
||
void main() | ||
{ | ||
vec3 N = normalize(inTexCoord); | ||
vec3 up = vec3(0.0, 0.0, 1.0); | ||
vec3 right = normalize(cross(up, N)); | ||
up = cross(N, right); | ||
|
||
const float TWO_PI = PI * 2.0; | ||
const float HALF_PI = PI * 0.5; | ||
|
||
vec3 color = vec3(0.0); | ||
uint sampleCount = 0u; | ||
// sample map (semisphere integral) | ||
for (float phi = 0.0; phi < TWO_PI; phi += inDeltaPhi) { | ||
for (float theta = 0.0; theta < HALF_PI; theta += inDeltaTheta) { | ||
vec3 tempVec = cos(phi) * right + sin(phi) * up; | ||
vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec; | ||
|
||
color += texture(skyboxCubeMap, sampleVector).rgb * cos(theta) * sin(theta); | ||
sampleCount++; | ||
} | ||
} | ||
outColor = vec4(PI * color / float(sampleCount), 1.0); | ||
} |
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,27 @@ | ||
#version 450 core | ||
|
||
layout(location = 0) in vec3 Position; | ||
layout(location = 1) in vec2 TexCoord; | ||
layout(location = 2) in vec3 Normal; | ||
|
||
layout(std140, push_constant) uniform PushConsts | ||
{ | ||
layout (offset = 0) mat4 mvp; | ||
layout (offset = 64) float deltaPhi; | ||
layout (offset = 68) float deltaTheta; | ||
} pushConsts; | ||
|
||
layout (location = 0) out vec3 outTexCoord; | ||
layout (location = 1) out float outDeltaPhi; | ||
layout (location = 2) out float outDeltaTheta; | ||
|
||
void main() | ||
{ | ||
outTexCoord = Position; | ||
outDeltaPhi = pushConsts.deltaPhi; | ||
outDeltaTheta = pushConsts.deltaTheta; | ||
|
||
vec3 pos = Position; | ||
pos.y = pos.y * -1; | ||
gl_Position = pushConsts.mvp * vec4(pos, 1.0); | ||
} |
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 was deleted.
Oops, something went wrong.
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
Binary file not shown.
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
Oops, something went wrong.