-
Notifications
You must be signed in to change notification settings - Fork 30
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
ab5732d
commit 9052d37
Showing
6 changed files
with
149 additions
and
119 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,31 @@ | ||
#version 120 | ||
#extension GL_ARB_texture_rectangle : enable | ||
|
||
#define TWO_PI 6.28318530717958647693 | ||
#define PI 3.14159265358979323846 | ||
#define HALF_PI 1.57079632679489661923 | ||
|
||
uniform vec3 lEye; | ||
uniform float litAmount; | ||
|
||
varying float fogAmount; | ||
varying vec3 nEye; | ||
varying vec3 vEye; | ||
|
||
void main() | ||
{ | ||
vec3 l = normalize(lEye - vEye); | ||
|
||
//vec3 lightN = normalize(cross(dFdx(vEye), dFdy(vEye))); | ||
vec3 lightN = normalize(nEye); | ||
|
||
float diffuse = max(dot(lightN, l), 0.0); | ||
|
||
vec3 h = normalize(lightN + l); | ||
|
||
float nDotH = max(dot(lightN, h), 0.0); | ||
|
||
float specular = 1e-2 * pow(nDotH, 64); | ||
|
||
gl_FragColor = (1.0 - fogAmount) * gl_Color * (1.0 - litAmount + litAmount * (diffuse + specular)); | ||
} |
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,31 @@ | ||
#version 120 | ||
#extension GL_ARB_texture_rectangle : enable | ||
|
||
#define PI 3.14159265358979323846 | ||
#define TWO_PI 6.28318530717958647693 | ||
#define HALF_PI 1.57079632679489661923 | ||
|
||
uniform sampler2DRect particles0; | ||
uniform sampler2DRect particles1; | ||
|
||
uniform float fogStart; | ||
uniform float fogEnd; | ||
|
||
varying float fogAmount; | ||
varying vec3 vEye; | ||
varying vec3 nEye; | ||
|
||
void main() | ||
{ | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
vec4 vWorld = vec4(texture2DRect(particles0, gl_TexCoord[0].st).xyz, 1.0); | ||
vec3 nWorld = texture2DRect(particles1, gl_TexCoord[0].st).xyz; | ||
|
||
vEye = (gl_ModelViewMatrix * vWorld).xyz; | ||
fogAmount = clamp((length(vEye) - fogStart) / (fogEnd - fogStart), 0.0, 1.0); | ||
nEye = gl_NormalMatrix * nWorld; | ||
|
||
gl_FrontColor = gl_Color; | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = gl_ModelViewProjectionMatrix * vWorld; | ||
} |
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.