Merge remote-tracking branch 'refs/remotes/raysan5/develop' into newaudio

This commit is contained in:
Joshua Reisenauer 2016-05-19 15:31:56 -07:00
commit 847944e240
44 changed files with 621 additions and 390 deletions

View file

@ -85,6 +85,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux # add standard directories for GNU/Linux
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
INCLUDES = -I. -I../src -I/usr/local/include/raylib/ INCLUDES = -I. -I../src -I/usr/local/include/raylib/
else ifeq ($(PLATFORM_OS),OSX)
INCLUDES = -I. -I../src
else else
INCLUDES = -I. -I../../src -IC:/raylib/raylib/src INCLUDES = -I. -I../../src -IC:/raylib/raylib/src
# external libraries headers # external libraries headers
@ -103,6 +105,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux # add standard directories for GNU/Linux
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
LFLAGS = -L. -L../../src LFLAGS = -L. -L../../src
else ifeq ($(PLATFORM_OS),OSX)
LFLAGS = -L. -L../src
else else
LFLAGS = -L. -L../../src -LC:/raylib/raylib/src LFLAGS = -L. -L../../src -LC:/raylib/raylib/src
# external libraries to link with # external libraries to link with
@ -129,7 +133,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libraries for OS X 10.9 desktop compiling # libraries for OS X 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw3 -framework OpenGL -framework OpenAl -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed

View file

@ -33,5 +33,5 @@ void main()
else if (texelColor.r < 0.5) tc = sum*sum*0.009 + texelColor; else if (texelColor.r < 0.5) tc = sum*sum*0.009 + texelColor;
else tc = sum*sum*0.0075 + texelColor; else tc = sum*sum*0.0075 + texelColor;
finalColor = tc; gl_FragColor = tc;
} }

View file

@ -20,7 +20,7 @@ float angle = 0.8;
uniform vec2 center = vec2(200.0, 200.0); uniform vec2 center = vec2(200.0, 200.0);
void main (void) void main()
{ {
vec2 texSize = vec2(renderWidth, renderHeight); vec2 texSize = vec2(renderWidth, renderHeight);
vec2 tc = fragTexCoord*texSize; vec2 tc = fragTexCoord*texSize;

View file

@ -17,12 +17,12 @@ void main()
{ {
vec4 sum = vec4(0); vec4 sum = vec4(0);
vec4 tc = vec4(0); vec4 tc = vec4(0);
for (int i = -4; i < 4; i++) for (int i = -4; i < 4; i++)
{ {
for (int j = -3; j < 3; j++) for (int j = -3; j < 3; j++)
{ {
sum += texture2D(texture0, fragTexCoord + vec2(j, i)*0.004)*0.25; sum += texture(texture0, fragTexCoord + vec2(j, i)*0.004)*0.25;
} }
} }

View file

@ -29,6 +29,9 @@ uniform float matGlossiness = 50.0;
uniform vec3 lightPosition; uniform vec3 lightPosition;
uniform vec3 cameraPosition; uniform vec3 cameraPosition;
// Fragment shader output data
out vec4 fragColor;
// Calculate ambient lighting component // Calculate ambient lighting component
vec3 AmbientLighting() vec3 AmbientLighting()
{ {

View file

@ -21,7 +21,7 @@ float angle = 0.8;
uniform vec2 center = vec2(200.0, 200.0); uniform vec2 center = vec2(200.0, 200.0);
void main (void) void main()
{ {
vec2 texSize = vec2(renderWidth, renderHeight); vec2 texSize = vec2(renderWidth, renderHeight);
vec2 tc = fragTexCoord*texSize; vec2 tc = fragTexCoord*texSize;
@ -40,7 +40,7 @@ void main (void)
} }
tc += center; tc += center;
vec3 color = texture2D(texture0, tc/texSize).rgb; vec3 color = texture(texture0, tc/texSize).rgb;
finalColor = vec4(color, 1.0);; finalColor = vec4(color, 1.0);;
} }

View file

@ -1,20 +1,26 @@
#version 100 #version 100
// Input vertex attributes
attribute vec3 vertexPosition; attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord; attribute vec2 vertexTexCoord;
attribute vec3 vertexNormal; attribute vec3 vertexNormal;
attribute vec4 vertexColor;
varying vec2 fragTexCoord; // Input uniform values
uniform mat4 mvpMatrix; uniform mat4 mvpMatrix;
// Output vertex attributes (to fragment shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
void main() void main()
{ {
vec3 normal = vertexNormal; // Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord; fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
// Calculate final vertex position
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
} }

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
@ -22,21 +25,13 @@ void main()
} }
} }
if (texture2D(texture0, fragTexCoord).r < 0.3) // Texel color fetching from texture sampler
{ vec4 texelColor = texture(texture0, fragTexCoord);
tc = sum*sum*0.012 + texture2D(texture0, fragTexCoord);
} // Calculate final fragment color
else if (texelColor.r < 0.3) tc = sum*sum*0.012 + texelColor;
{ else if (texelColor.r < 0.5) tc = sum*sum*0.009 + texelColor;
if (texture2D(texture0, fragTexCoord).r < 0.5) else tc = sum*sum*0.0075 + texelColor;
{
tc = sum*sum*0.009 + texture2D(texture0, fragTexCoord);
}
else
{
tc = sum*sum*0.0075 + texture2D(texture0, fragTexCoord);
}
}
gl_FragColor = tc; gl_FragColor = tc;
} }

View file

@ -2,7 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
@ -16,6 +20,7 @@ float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 );
void main() void main()
{ {
// Texel color fetching from texture sampler
vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight[0]; vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight[0];
for (int i = 1; i < 3; i++) for (int i = 1; i < 3; i++)

View file

@ -2,12 +2,15 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
float hatchOffsetY = 5.0f; float hatchOffsetY = 5.0f;
float lumThreshold01 = 0.9f; float lumThreshold01 = 0.9f;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
@ -46,7 +49,7 @@ vec4 PostFX(sampler2D tex, vec2 uv)
return c; return c;
} }
void main(void) void main()
{ {
vec3 tc = PostFX(texture0, fragTexCoord).rgb; vec3 tc = PostFX(texture0, fragTexCoord).rgb;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;

View file

@ -2,12 +2,15 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
const float PI = 3.1415926535; const float PI = 3.1415926535;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
@ -11,10 +14,12 @@ uniform vec4 fragTintColor;
void main() void main()
{ {
vec4 base = texture2D(texture0, fragTexCoord)*fragTintColor; // Texel color fetching from texture sampler
vec4 texelColor = texture(texture0, fragTexCoord)*fragTintColor*fragColor;
// Convert to grayscale using NTSC conversion weights // Convert texel color to grayscale using NTSC conversion weights
float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114)); float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));
gl_FragColor = vec4(gray, gray, gray, fragTintColor.a); // Calculate final fragment color
gl_FragColor = vec4(gray, gray, gray, texelColor.a);
} }

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
@ -14,7 +17,7 @@ float frequency = 720/3.0;
uniform float time; uniform float time;
void main (void) void main()
{ {
/* /*
// Scanlines method 1 // Scanlines method 1

View file

@ -2,28 +2,32 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
const float renderWidth = 1280; const float renderWidth = 800.0; // HARDCODED for example!
const float renderHeight = 720; const float renderHeight = 480.0; // Use uniforms instead...
float radius = 250.0; float radius = 250.0;
float angle = 0.8; float angle = 0.8;
uniform vec2 center = vec2(200, 200); uniform vec2 center = vec2(200.0, 200.0);
void main (void) void main()
{ {
vec2 texSize = vec2(renderWidth, renderHeight); vec2 texSize = vec2(renderWidth, renderHeight);
vec2 tc = fragTexCoord*texSize; vec2 tc = fragTexCoord*texSize;
tc -= center; tc -= center;
float dist = length(tc);
float dist = length(tc);
if (dist < radius) if (dist < radius)
{ {
float percent = (radius - dist)/radius; float percent = (radius - dist)/radius;
@ -33,7 +37,7 @@ void main (void)
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
} }
tc += center; tc += center;
vec3 color = texture2D(texture0, tc/texSize).rgb; vec3 color = texture2D(texture0, tc/texSize).rgb;

View file

@ -2,8 +2,11 @@
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 fragTintColor; uniform vec4 fragTintColor;
@ -11,6 +14,7 @@ uniform vec4 fragTintColor;
void main() void main()
{ {
// Texel color fetching from texture sampler
vec4 texelColor = texture2D(texture0, fragTexCoord); vec4 texelColor = texture2D(texture0, fragTexCoord);
// NOTE: Implement here your fragment shader code // NOTE: Implement here your fragment shader code

Some files were not shown because too many files have changed in this diff Show more