Merge branch 'master' into remove_platform_rpi
This commit is contained in:
commit
c6ff28c7f8
5 changed files with 5479 additions and 385 deletions
|
|
@ -10,7 +10,7 @@ varying vec4 fragColor;
|
|||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
uniform float secondes;
|
||||
uniform float seconds;
|
||||
|
||||
uniform vec2 size;
|
||||
|
||||
|
|
@ -29,8 +29,8 @@ void main() {
|
|||
float boxTop = 0.0;
|
||||
|
||||
vec2 p = fragTexCoord;
|
||||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth;
|
||||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight;
|
||||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (seconds * speedX)) * ampX * pixelWidth;
|
||||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (seconds * speedY)) * ampY * pixelHeight;
|
||||
|
||||
gl_FragColor = texture2D(texture0, p)*colDiffuse*fragColor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ uniform vec4 colDiffuse;
|
|||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
uniform float secondes;
|
||||
uniform float seconds;
|
||||
|
||||
uniform vec2 size;
|
||||
|
||||
|
|
@ -30,8 +30,8 @@ void main() {
|
|||
float boxTop = 0.0;
|
||||
|
||||
vec2 p = fragTexCoord;
|
||||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth;
|
||||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight;
|
||||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (seconds * speedX)) * ampX * pixelWidth;
|
||||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (seconds * speedY)) * ampY * pixelHeight;
|
||||
|
||||
finalColor = texture(texture0, p)*colDiffuse*fragColor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,18 +37,18 @@ int main(void)
|
|||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
|
||||
|
||||
Texture2D texture = LoadTexture("resources/fudesumi.png");
|
||||
|
||||
|
||||
Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION));
|
||||
|
||||
float outlineSize = 2.0f;
|
||||
float outlineColor[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; // Normalized RED color
|
||||
float outlineColor[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; // Normalized RED color
|
||||
float textureSize[2] = { (float)texture.width, (float)texture.height };
|
||||
|
||||
|
||||
// Get shader locations
|
||||
int outlineSizeLoc = GetShaderLocation(shdrOutline, "outlineSize");
|
||||
int outlineColorLoc = GetShaderLocation(shdrOutline, "outlineColor");
|
||||
int textureSizeLoc = GetShaderLocation(shdrOutline, "textureSize");
|
||||
|
||||
|
||||
// Set shader values (they can be changed later)
|
||||
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
|
||||
SetShaderValue(shdrOutline, outlineColorLoc, outlineColor, SHADER_UNIFORM_VEC4);
|
||||
|
|
@ -64,7 +64,7 @@ int main(void)
|
|||
//----------------------------------------------------------------------------------
|
||||
outlineSize += GetMouseWheelMove();
|
||||
if (outlineSize < 1.0f) outlineSize = 1.0f;
|
||||
|
||||
|
||||
SetShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, SHADER_UNIFORM_FLOAT);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -75,13 +75,13 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginShaderMode(shdrOutline);
|
||||
|
||||
|
||||
DrawTexture(texture, GetScreenWidth()/2 - texture.width/2, -30, WHITE);
|
||||
|
||||
|
||||
EndShaderMode();
|
||||
|
||||
DrawText("Shader-based\ntexture\noutline", 10, 10, 20, GRAY);
|
||||
|
||||
DrawText("Scroll mouse wheel to\nchange outline size", 10, 72, 20, GRAY);
|
||||
DrawText(TextFormat("Outline size: %i px", (int)outlineSize), 10, 120, 20, MAROON);
|
||||
|
||||
DrawFPS(710, 10);
|
||||
|
|
@ -99,4 +99,4 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 258 KiB After Width: | Height: | Size: 259 KiB |
|
|
@ -46,7 +46,7 @@ int main(void)
|
|||
// Load shader and setup location points and values
|
||||
Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/wave.fs", GLSL_VERSION));
|
||||
|
||||
int secondsLoc = GetShaderLocation(shader, "secondes");
|
||||
int secondsLoc = GetShaderLocation(shader, "seconds");
|
||||
int freqXLoc = GetShaderLocation(shader, "freqX");
|
||||
int freqYLoc = GetShaderLocation(shader, "freqY");
|
||||
int ampXLoc = GetShaderLocation(shader, "ampX");
|
||||
|
|
|
|||
Loading…
Reference in a new issue