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
1 parent
58aa213
commit da6adb2
Showing
5 changed files
with
22 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
|
||
// Sampler bound to texture unit 0 | ||
uniform samplerCube u_cubemap; | ||
uniform vec3 u_view_origin; | ||
|
||
varying vec3 var_dummy; | ||
// The view origin as set by the C++ code | ||
uniform vec3 u_view_origin; | ||
|
||
void main() | ||
// The texture coordinate as calculated in the vertex program | ||
varying vec3 var_cubeMapTexCoord; | ||
|
||
void main() | ||
{ | ||
// Swap Y and Z coordinates | ||
vec3 texcoord = vec3(var_dummy.x, var_dummy.z, var_dummy.y); | ||
vec3 texcoord = vec3(var_cubeMapTexCoord.x, var_cubeMapTexCoord.z, var_cubeMapTexCoord.y); | ||
|
||
// Look up the fragment using the cube map sampler | ||
gl_FragColor = texture(u_cubemap, texcoord); | ||
|
||
// compute final color | ||
//gl_FragColor = vec4(1.0, 0.0, 1.0, 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 |
---|---|---|
@@ -1,21 +1,17 @@ | ||
|
||
attribute vec4 attr_TexCoord0; | ||
attribute vec3 attr_Tangent; | ||
attribute vec3 attr_Bitangent; | ||
attribute vec3 attr_Normal; | ||
// The view origin as set by the C++ code | ||
uniform vec3 u_view_origin; | ||
|
||
uniform vec3 u_view_origin; | ||
// The texture coordinate for this vertex, will be used in the fragment shader | ||
varying vec3 var_cubeMapTexCoord; | ||
|
||
varying vec3 var_dummy; | ||
|
||
void main() | ||
void main() | ||
{ | ||
var_dummy = gl_Vertex.xyz - u_view_origin; | ||
var_cubeMapTexCoord = gl_Vertex.xyz - u_view_origin; | ||
|
||
// transform vertex position into homogenous clip-space | ||
gl_Position = ftransform(); | ||
// transform vertex position into homogenous clip-space | ||
gl_Position = ftransform(); | ||
|
||
// Pass through vertex colour | ||
gl_FrontColor = gl_Color; | ||
} | ||
|
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