Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#219: WIP commit, adding dummy shadow map VP/FP and corresponding C++…
… wrapper. Add texture atlas and rectangle class.
- Loading branch information
1 parent
172cae0
commit 8f32f03
Showing
17 changed files
with
325 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#version 120 | ||
|
||
uniform sampler2D u_Diffuse; | ||
uniform float u_AlphaTest; | ||
uniform mat4 u_ObjectTransform; | ||
|
||
// The final diffuse texture coordinate at this vertex, calculated in the vertex shader | ||
varying vec2 var_TexDiffuse; | ||
|
||
void main() | ||
{ | ||
if (u_AlphaTest < 0) | ||
{ | ||
gl_FragColor.a = 1.0; | ||
gl_FragColor.rgb = vec3(1.0, 1.0, 0.0); | ||
} | ||
else | ||
{ | ||
vec4 tex = texture2D(u_Diffuse, var_TexDiffuse); | ||
|
||
if (tex.a <= u_AlphaTest) | ||
{ | ||
discard; | ||
} | ||
|
||
gl_FragColor = tex; | ||
} | ||
} |
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,23 @@ | ||
#version 140 | ||
|
||
in vec4 attr_Position; // bound to attribute 0 in source, in object space | ||
in vec4 attr_TexCoord; // bound to attribute 8 in source | ||
|
||
uniform mat4 u_ObjectTransform; // object transform (object2world) | ||
|
||
// The two top-rows of the diffuse stage texture transformation matrix | ||
uniform vec4 u_DiffuseTextureMatrix[2]; | ||
|
||
// The final diffuse texture coordinate at this vertex | ||
varying vec2 var_TexDiffuse; | ||
|
||
void main() | ||
{ | ||
// Apply the supplied object transform to the incoming vertex | ||
// transform vertex position into homogenous clip-space | ||
gl_Position = u_ModelViewProjection * u_ObjectTransform * attr_Position; | ||
|
||
// Apply the stage texture transform to the incoming tex coord, component wise | ||
var_TexDiffuse.x = dot(u_DiffuseTextureMatrix[0], attr_TexCoord); | ||
var_TexDiffuse.y = dot(u_DiffuseTextureMatrix[1], attr_TexCoord); | ||
} |
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,15 @@ | ||
#pragma once | ||
|
||
namespace render | ||
{ | ||
|
||
// Defines a rectangular area within a larger one | ||
struct Rectangle | ||
{ | ||
int x; | ||
int y; | ||
int width; | ||
int height; | ||
}; | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ enum class ShaderProgram | |
DepthFillAlpha, | ||
Interaction, | ||
CubeMap, | ||
ShadowMap, | ||
}; | ||
|
||
/** | ||
|
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
Oops, something went wrong.