Skip to content

Commit

Permalink
Opacity support in SimpleForward shader
Browse files Browse the repository at this point in the history
  • Loading branch information
gecko0307 committed Jan 4, 2025
1 parent 2c1607d commit aeeb474
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ in vec3 eyeNormal;
in vec3 eyePosition;
in vec2 texCoord;

uniform float opacity;

/*
* Diffuse
*/
Expand Down Expand Up @@ -32,7 +34,7 @@ void main()
vec3 N = normalize(eyeNormal);

vec4 diffuseColor = diffuse(uv);
float alpha = diffuseColor.a;
float alpha = diffuseColor.a * opacity;

fragColor = vec4(diffuseColor.rgb, alpha);
}
4 changes: 2 additions & 2 deletions src/dagon/render/simple/shaders/simpleforward.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2024 Timur Gafarov
Copyright (c) 2024-2025 Timur Gafarov
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
Expand Down Expand Up @@ -73,7 +73,7 @@ class SimpleForwardShader: Shader
setParameter("normalMatrix", state.normalMatrix);

setParameter("opacity", mat.opacity * state.opacity);

setParameter("shadeless", mat.shadeless);
setParameter("textureScale", mat.textureScale);

// Diffuse
Expand Down

0 comments on commit aeeb474

Please sign in to comment.