mirror of
https://github.com/SFML/SFML.git
synced 2025-03-14 01:40:05 +08:00
Test loading shaders with non-ASCII filenames
This commit is contained in:
parent
0a2e9ac340
commit
aee8707b1b
@ -422,6 +422,17 @@ TEST_CASE("[Graphics] sf::Shader", skipShaderFullTests())
|
||||
sf::Shader::isGeometryAvailable());
|
||||
CHECK(static_cast<bool>(shader.getNativeHandle()) == sf::Shader::isGeometryAvailable());
|
||||
}
|
||||
|
||||
SECTION("One shader with non-ASCII filename")
|
||||
{
|
||||
CHECK(shader.loadFromFile(U"Graphics/shader-\u0144.vert", sf::Shader::Type::Vertex) ==
|
||||
sf::Shader::isAvailable());
|
||||
CHECK(static_cast<bool>(shader.getNativeHandle()) == sf::Shader::isAvailable());
|
||||
|
||||
CHECK(shader.loadFromFile(U"Graphics/shader-\U0001F40C.vert", sf::Shader::Type::Vertex) ==
|
||||
sf::Shader::isAvailable());
|
||||
CHECK(static_cast<bool>(shader.getNativeHandle()) == sf::Shader::isAvailable());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("loadFromMemory()")
|
||||
|
19
test/Graphics/shader-ń.vert
Normal file
19
test/Graphics/shader-ń.vert
Normal file
@ -0,0 +1,19 @@
|
||||
uniform vec2 storm_position;
|
||||
uniform float storm_total_radius;
|
||||
uniform float storm_inner_radius;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 vertex = gl_ModelViewMatrix * gl_Vertex;
|
||||
vec2 offset = vertex.xy - storm_position;
|
||||
float len = length(offset);
|
||||
if (len < storm_total_radius)
|
||||
{
|
||||
float push_distance = storm_inner_radius + len / storm_total_radius * (storm_total_radius - storm_inner_radius);
|
||||
vertex.xy = storm_position + normalize(offset) * push_distance;
|
||||
}
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * vertex;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
19
test/Graphics/shader-🐌.vert
Normal file
19
test/Graphics/shader-🐌.vert
Normal file
@ -0,0 +1,19 @@
|
||||
uniform vec2 storm_position;
|
||||
uniform float storm_total_radius;
|
||||
uniform float storm_inner_radius;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 vertex = gl_ModelViewMatrix * gl_Vertex;
|
||||
vec2 offset = vertex.xy - storm_position;
|
||||
float len = length(offset);
|
||||
if (len < storm_total_radius)
|
||||
{
|
||||
float push_distance = storm_inner_radius + len / storm_total_radius * (storm_total_radius - storm_inner_radius);
|
||||
vertex.xy = storm_position + normalize(offset) * push_distance;
|
||||
}
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * vertex;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user