Skip to content

Commit

Permalink
Client|Shaders: Reorganized/renamed shader refs
Browse files Browse the repository at this point in the history
The "generic" group now has a "textured" subgroup.
  • Loading branch information
skyjake committed May 23, 2013
1 parent 7130272 commit 45b725e
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
76 changes: 53 additions & 23 deletions doomsday/client/data/shaders.dei
Expand Up @@ -12,7 +12,7 @@ group generic {
# Simple shader with untextured vertices. There is an additional constant
# color applied to all vertices. Uses a combined model-view-projection
# matrix.
shader color {
shader color_ucolor {
vertex = "
uniform highp mat4 uMvpMatrix;
uniform highp vec4 uColor;
Expand All @@ -32,29 +32,59 @@ group generic {
}"
}

# Simple shader with one texture plus a color per vertex. Uses a
# combined model-view-projection matrix.
shader tex_color {
vertex = "
uniform highp mat4 uMvpMatrix;
attribute highp vec4 aVertex;
attribute highp vec2 aUV;
attribute highp vec4 aColor;
varying highp vec2 vUV;
varying highp vec4 vColor;
group textured {
# Simple shader with one texture plus a color per vertex. Uses a
# combined model-view-projection matrix.
shader color {
vertex = "
uniform highp mat4 uMvpMatrix;
attribute highp vec4 aVertex;
attribute highp vec2 aUV;
attribute highp vec4 aColor;
varying highp vec2 vUV;
varying highp vec4 vColor;

void main(void) {
gl_Position = uMvpMatrix * aVertex;
vUV = aUV;
vColor = aColor;
}"
fragment = "
uniform sampler2D uTex;
varying highp vec2 vUV;
varying highp vec4 vColor;
void main(void) {
gl_Position = uMvpMatrix * aVertex;
vUV = aUV;
vColor = aColor;
}"
fragment = "
uniform sampler2D uTex;
varying highp vec2 vUV;
varying highp vec4 vColor;

void main(void) {
gl_FragColor = vColor * texture2D(uTex, vUV);
}"
void main(void) {
gl_FragColor = vColor * texture2D(uTex, vUV);
}"
}

# Simple shader with one texture plus a color per vertex. There is
# an additional constant color applied to all vertices. Uses a
# combined model-view-projection matrix.
shader color_ucolor {
vertex = "
uniform highp mat4 uMvpMatrix;
uniform highp vec4 uColor;
attribute highp vec4 aVertex;
attribute highp vec2 aUV;
attribute highp vec4 aColor;
varying highp vec2 vUV;
varying highp vec4 vColor;

void main(void) {
gl_Position = uMvpMatrix * aVertex;
vUV = aUV;
vColor = aColor * uColor;
}"
fragment = "
uniform sampler2D uTex;
varying highp vec2 vUV;
varying highp vec4 vColor;

void main(void) {
gl_FragColor = vColor * texture2D(uTex, vUV);
}"
}
}
}
4 changes: 2 additions & 2 deletions doomsday/client/src/ui/widgets/lineeditwidget.cpp
Expand Up @@ -125,12 +125,12 @@ DENG2_OBSERVES(Atlas, Reposition)
drawable.addBuffer(ID_BUF_TEXT, new VertexBuf);
drawable.addBufferWithNewProgram(ID_BUF_CURSOR, new VertexBuf, "cursor");

self.root().shaders().build(drawable.program(), "generic.tex_color")
self.root().shaders().build(drawable.program(), "generic.textured.color")
<< uMvpMatrix
//<< uColor
<< uTex;

self.root().shaders().build(drawable.program("cursor"), "generic.color")
self.root().shaders().build(drawable.program("cursor"), "generic.color_ucolor")
<< uMvpMatrix
<< uColor;

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/widgets/taskbarwidget.cpp
Expand Up @@ -57,7 +57,7 @@ DENG2_PIMPL(TaskBarWidget)
};
buf->setVertices(gl::TriangleStrip, verts, 4, gl::Static);

self.root().shaders().build(drawable.program(), "generic.color")
self.root().shaders().build(drawable.program(), "generic.color_ucolor")
<< uMvpMatrix
<< uColor;

Expand Down

0 comments on commit 45b725e

Please sign in to comment.