shader\basic_VS.hlsl = shader\basic_VS.hlsl
shader\basicTexture_FS.hlsl = shader\basicTexture_FS.hlsl
shader\basicTexture_VS.hlsl = shader\basicTexture_VS.hlsl
+ shader\blur_FS.hlsl = shader\blur_FS.hlsl
shader\lightingTexture_FS.hlsl = shader\lightingTexture_FS.hlsl
shader\perspective_VS.hlsl = shader\perspective_VS.hlsl
shader\skybox_VS.hlsl = shader\skybox_VS.hlsl
//Height
- if (_other->yFloorDist < 0 && _other->ySpeed < 0)
- {
- _other->move(-pdist * vec3(0.f, normal[1], 0.f));
- }
- if (normal[1] >= .3f && _other->ySpeed < 0)
+
+ if (normal[1] >= .3f && _other->ySpeed <= 0)
{
+ if (_other->yFloorDist < 0)
+ {
+ _other->move(-pdist * vec3(0.f, normal[1], 0.f));
+ }
_other->ySpeed = 0;
}
if (yFloorDist>0 || ySpeed!=0)
{
if (ySpeed*deltaT < yFloorDist || ySpeed>0)
- modelMat = translate(vec3(0.f, ySpeed*deltaT, 0.f))*modelMat;
+ move(vec3(0.f, ySpeed*deltaT, 0.f));
else
{
- modelMat = translate(vec3(0.f, yFloorDist, 0.f))*modelMat;
+ move(vec3(0.f, yFloorDist, 0.f));
ySpeed = 0; //set to FloorSpeed?
}
ySpeed -= deltaT*YFALL_SPEED;
//in worldNormal;
in vec2 fUVs;
-out vec4 FragmentColor;
-
uniform sampler2D uColorTexture;
void main()
{
- FragmentColor = texture(uColorTexture, fUVs);
+ gl_FragColor = texture(uColorTexture, fUVs);
}
\ No newline at end of file
//Fragment Shader
#version 330
-out vec4 FragmentColor;
-
uniform vec4 uFragmentColor = vec4(0.6, 0, 0, 0.6);
void main(){
- FragmentColor = uFragmentColor;
+ gl_FragColor = uFragmentColor;
}
--- /dev/null
+//Fragment Shader
+#version 330
+//"in" attributes from our vertex shader
+varying vec4 vColor;
+varying vec2 fUVs;
+
+//declare uniforms
+uniform sampler2D u_texture;
+uniform float resolution;
+uniform float radius;
+uniform vec2 dir;
+
+void main() {
+ //this will be our RGBA sum
+ vec4 sum = vec4(0.0);
+
+ //our original texcoord for this fragment
+ vec2 tc = fUVs;
+
+ //the amount to blur, i.e. how far off center to sample from
+ //1.0 -> blur by one pixel
+ //2.0 -> blur by two pixels, etc.
+ float blur = radius / resolution;
+
+ //the direction of our blur
+ //(1.0, 0.0) -> x-axis blur
+ //(0.0, 1.0) -> y-axis blur
+ float hstep = dir.x;
+ float vstep = dir.y;
+
+ //apply blurring, using a 9-tap filter with predefined gaussian weights
+
+ sum += texture2D(u_texture, vec2(tc.x - 4.0*blur*hstep, tc.y - 4.0*blur*vstep)) * 0.0162162162;
+ sum += texture2D(u_texture, vec2(tc.x - 3.0*blur*hstep, tc.y - 3.0*blur*vstep)) * 0.0540540541;
+ sum += texture2D(u_texture, vec2(tc.x - 2.0*blur*hstep, tc.y - 2.0*blur*vstep)) * 0.1216216216;
+ sum += texture2D(u_texture, vec2(tc.x - 1.0*blur*hstep, tc.y - 1.0*blur*vstep)) * 0.1945945946;
+
+ sum += texture2D(u_texture, vec2(tc.x, tc.y)) * 0.2270270270;
+
+ sum += texture2D(u_texture, vec2(tc.x + 1.0*blur*hstep, tc.y + 1.0*blur*vstep)) * 0.1945945946;
+ sum += texture2D(u_texture, vec2(tc.x + 2.0*blur*hstep, tc.y + 2.0*blur*vstep)) * 0.1216216216;
+ sum += texture2D(u_texture, vec2(tc.x + 3.0*blur*hstep, tc.y + 3.0*blur*vstep)) * 0.0540540541;
+ sum += texture2D(u_texture, vec2(tc.x + 4.0*blur*hstep, tc.y + 4.0*blur*vstep)) * 0.0162162162;
+
+ //discard alpha for our simple demo, multiply by vertex color and return
+ gl_FragColor = vColor * vec4(sum.rgb, 1.0);
+}
\ No newline at end of file
in vec3 PointLightPosition1, DirectionalLightDirection1;
-out vec4 FragmentColor;
-
uniform sampler2D uColorTexture;
uniform vec4 material; //vec4 in the form (ambient, point, directional, glossyness); so far it was (1, 1, 1, 3)
float squaredist1 = worldPointLightDir1.x * worldPointLightDir1.x + worldPointLightDir1.y * worldPointLightDir1.y + worldPointLightDir1.z * worldPointLightDir1.z;
- FragmentColor = vec4(uvColor.rgb * (AmbientLightColor * material[0]
+ gl_FragColor = vec4(uvColor.rgb * (AmbientLightColor * material[0]
+ PointLightColor1 * material[1] * (cosThetaPoint1 + pow(SpecularCosPoint1, specularConst)) / squaredist1
+ DirectionalLightColor1 * material[2] * (cosThetaDirection1 + pow(SpecularCosDirection1, specularConst))
), uvColor.a);
- //FragmentColor = vec4((normalize(worldNormal)+1)/2, 1.0f);
- //FragmentColor = vec4(length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, 1.0f);
+ //gl_FragColor = vec4((normalize(worldNormal)+1)/2, 1.0f);
+ //gl_FragColor = vec4(length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, 1.0f);
//vec3 uvColor = texture(uColorTexture, fUVs).rgb;
- //FragmentColor = vec4(uvColor, 1.0);
+ //gl_FragColor = vec4(uvColor, 1.0);
}
uniform samplerCube uColorTexture;
smooth in vec3 eyeDirection;
-out vec4 FragmentColor;
void main(){
- FragmentColor = texture(uColorTexture, eyeDirection);
+ gl_FragColor = texture(uColorTexture, eyeDirection);
}
#version 330
smooth in vec3 eyeDirection;
-out vec4 FragmentColor;
void main(){
- FragmentColor = vec4((eyeDirection+vec3(2.f))/4, 0.5);
+ gl_FragColor = vec4((eyeDirection+vec3(2.f))/4, 0.5);
}