Initial commit
This commit is contained in:
BIN
binaries/assets/fonts/WorkSans/WorkSans-Regular.ttf
Normal file
BIN
binaries/assets/fonts/WorkSans/WorkSans-Regular.ttf
Normal file
Binary file not shown.
38
binaries/assets/shaders/addition.comp
Normal file
38
binaries/assets/shaders/addition.comp
Normal file
@@ -0,0 +1,38 @@
|
||||
#version 460
|
||||
|
||||
|
||||
//shared float shareData[1024]; // Shared between all threads in work group.
|
||||
|
||||
layout ( local_size_x = 10, local_size_y = 10, local_size_z = 1 ) in;
|
||||
|
||||
|
||||
|
||||
|
||||
layout( std430, binding = 0 ) buffer inputBlock {
|
||||
|
||||
vec2 array_a[ 100 ];
|
||||
|
||||
vec2 array_b[ 100 ];
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
layout( std430, binding = 1 ) buffer outputBlock {
|
||||
|
||||
vec2 array_c[ 100 ];
|
||||
|
||||
};
|
||||
|
||||
void main() {
|
||||
|
||||
uint index = gl_LocalInvocationIndex;
|
||||
|
||||
vec2 a = array_a[ index ];
|
||||
|
||||
vec2 b = array_b[ index ];
|
||||
|
||||
array_c[ index ] = a + b;
|
||||
|
||||
}
|
||||
|
||||
29
binaries/assets/shaders/addition2.comp
Normal file
29
binaries/assets/shaders/addition2.comp
Normal file
@@ -0,0 +1,29 @@
|
||||
#version 460
|
||||
|
||||
|
||||
//shared float shareData[1024]; // Shared between all threads in work group.
|
||||
|
||||
layout ( local_size_x = 10, local_size_y = 10, local_size_z = 1 ) in;
|
||||
|
||||
|
||||
|
||||
layout( std430, binding = 2 ) buffer outputBlock2 {
|
||||
|
||||
vec2 array_d[ 100 ];
|
||||
|
||||
};
|
||||
|
||||
layout( std430, binding = 1 ) buffer outputBlock {
|
||||
|
||||
vec2 array_c[ 100 ];
|
||||
|
||||
};
|
||||
|
||||
void main() {
|
||||
|
||||
uint index = gl_LocalInvocationIndex;
|
||||
|
||||
array_d[ index ] = array_c[ index ];
|
||||
|
||||
}
|
||||
|
||||
21
binaries/assets/shaders/color.fragment
Normal file
21
binaries/assets/shaders/color.fragment
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 400
|
||||
|
||||
out vec4 frag_colour;
|
||||
|
||||
uniform vec3 diffuse;
|
||||
|
||||
uniform vec2 position;
|
||||
|
||||
uniform sampler2D image;
|
||||
|
||||
in vec2 vertex_textureCoordinates;
|
||||
|
||||
void main() {
|
||||
|
||||
//frag_colour = texture( image, vertex_textureCoordinates );
|
||||
|
||||
frag_colour = vec4(vertex_textureCoordinates, 0.0, 1.0);
|
||||
|
||||
frag_colour = vec4(1.0);
|
||||
|
||||
}
|
||||
84
binaries/assets/shaders/color.vertex
Normal file
84
binaries/assets/shaders/color.vertex
Normal file
@@ -0,0 +1,84 @@
|
||||
#version 400
|
||||
|
||||
//layout (location = 0) in vec3 position;
|
||||
|
||||
/*
|
||||
layout (std140) uniform global
|
||||
{
|
||||
vec2 document;
|
||||
|
||||
vec2 other;
|
||||
};
|
||||
*/
|
||||
layout (std140) uniform events
|
||||
{
|
||||
vec2 mouse;
|
||||
|
||||
vec2 window;
|
||||
};
|
||||
|
||||
|
||||
//uniform vec2 mouse;
|
||||
|
||||
//uniform vec2 window;
|
||||
|
||||
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
|
||||
layout(location = 1) in vec2 textureCoordinates;
|
||||
|
||||
layout(location = 2) in int meshIndex;
|
||||
|
||||
|
||||
|
||||
out vec2 vertex_textureCoordinates;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 mousePosition = mouse / window;
|
||||
|
||||
mousePosition -= .5;
|
||||
|
||||
mousePosition.y *= -1.;
|
||||
|
||||
mousePosition *= 2.0;
|
||||
|
||||
gl_Position.xyz = position / vec3(40, 1, 10);
|
||||
|
||||
if( meshIndex == 0 ) {
|
||||
|
||||
gl_Position.xy += mousePosition;
|
||||
|
||||
} else {
|
||||
|
||||
vec2 normalizedPosition = 1.0 / window;
|
||||
|
||||
normalizedPosition -= 0.5;
|
||||
|
||||
normalizedPosition.y *= -1.;
|
||||
|
||||
normalizedPosition *= 2.0;
|
||||
|
||||
|
||||
normalizedPosition.x += .1;
|
||||
|
||||
normalizedPosition.x += mod( float(meshIndex), 30 ) * ( .08 );
|
||||
|
||||
normalizedPosition.y -= 1;
|
||||
|
||||
normalizedPosition.y -= floor( float(meshIndex) / 30 ) * .5;
|
||||
|
||||
gl_Position.xy += vec2( normalizedPosition );
|
||||
|
||||
}
|
||||
|
||||
//gl_Position.xy /= window;
|
||||
|
||||
vertex_textureCoordinates = textureCoordinates;
|
||||
|
||||
gl_Position.w = 1.0;
|
||||
|
||||
}
|
||||
|
||||
90
binaries/assets/shaders/multiQuad.fragment
Normal file
90
binaries/assets/shaders/multiQuad.fragment
Normal file
@@ -0,0 +1,90 @@
|
||||
#version 460
|
||||
|
||||
out vec4 frag_colour;
|
||||
|
||||
uniform vec3 diffuse;
|
||||
|
||||
uniform vec2 position;
|
||||
|
||||
uniform sampler2DArray samplerArray;
|
||||
|
||||
|
||||
in vec2 vertex_textureCoordinates;
|
||||
|
||||
in float vertex_meshIndex;
|
||||
|
||||
in vec3 quad_color;
|
||||
|
||||
in vec2 quad_position;
|
||||
|
||||
in vec2 quad_size;
|
||||
|
||||
flat in float quad_opacity;
|
||||
|
||||
flat in int quad_useTexture;
|
||||
|
||||
flat in int quad_textureIndex;
|
||||
|
||||
|
||||
|
||||
layout ( packed, binding = 0 ) uniform events
|
||||
{
|
||||
|
||||
vec2 mouse;
|
||||
|
||||
vec2 window;
|
||||
|
||||
};
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
|
||||
vec2 grid = vec2( floor( vertex_textureCoordinates.x * 10.0 ), floor( vertex_textureCoordinates.y * 10.0 ) );
|
||||
|
||||
int index = int( grid.x + ( grid.y * 10.0 ) );
|
||||
|
||||
|
||||
vec2 newCoordinates = vertex_textureCoordinates;
|
||||
|
||||
newCoordinates = vec2( mod( newCoordinates.x, 1) , mod( newCoordinates.y, 1) );
|
||||
|
||||
|
||||
vec4 diffuseColor = vec4( 1.0 );
|
||||
|
||||
if( quad_useTexture == 1 ) {
|
||||
|
||||
diffuseColor = texture( samplerArray, vec3( newCoordinates, quad_textureIndex ) );
|
||||
|
||||
} else {
|
||||
|
||||
vec2 size = quad_size;
|
||||
|
||||
vec2 halfSize = size / 2.0;
|
||||
|
||||
vec2 fragCoord = vertex_textureCoordinates * size;
|
||||
|
||||
float radius = 100.;
|
||||
|
||||
float borderSmoothing = 2.0;
|
||||
|
||||
vec2 centerPosition = fragCoord - halfSize;
|
||||
|
||||
float a = length( abs( centerPosition ) + size + radius ) - radius;
|
||||
|
||||
//float b = max( a, length( halfSize / 2. ) );
|
||||
|
||||
//float c = length( a );
|
||||
|
||||
|
||||
|
||||
|
||||
diffuseColor.rgb = quad_color * (1.0 - a);//( 1.0 - smoothstep( radius, radius + borderSmoothing, b ) );
|
||||
|
||||
}
|
||||
|
||||
diffuseColor.w *= quad_opacity;
|
||||
|
||||
frag_colour = diffuseColor;
|
||||
|
||||
}
|
||||
164
binaries/assets/shaders/multiQuad.vertex
Normal file
164
binaries/assets/shaders/multiQuad.vertex
Normal file
@@ -0,0 +1,164 @@
|
||||
#version 460
|
||||
|
||||
layout ( packed, binding = 0 ) uniform events
|
||||
{
|
||||
|
||||
vec2 mouse;
|
||||
|
||||
vec2 window;
|
||||
|
||||
};
|
||||
|
||||
layout ( packed, binding = 1 ) uniform orientation
|
||||
{
|
||||
|
||||
vec2 quadPosition;
|
||||
|
||||
};
|
||||
|
||||
struct quad{
|
||||
|
||||
vec2 position;
|
||||
|
||||
vec2 size;
|
||||
|
||||
vec3 color;
|
||||
|
||||
float zIndex;
|
||||
|
||||
float opacity;
|
||||
|
||||
int textureIndex;
|
||||
|
||||
int features;
|
||||
|
||||
int elementIndex;
|
||||
|
||||
//int characters[];
|
||||
|
||||
};
|
||||
|
||||
|
||||
layout( std430, binding = 2 ) readonly buffer meshes
|
||||
{
|
||||
|
||||
quad meshArray[100];
|
||||
|
||||
};
|
||||
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
|
||||
layout(location = 1) in vec2 textureCoordinates;
|
||||
|
||||
layout(location = 2) in int meshIndex;
|
||||
|
||||
|
||||
|
||||
out vec2 vertex_textureCoordinates;
|
||||
|
||||
out float vertex_meshIndex;
|
||||
|
||||
|
||||
out vec3 quad_color;
|
||||
|
||||
out vec2 quad_position;
|
||||
|
||||
out vec2 quad_size;
|
||||
|
||||
flat out int quad_textureIndex;
|
||||
|
||||
flat out int quad_useTexture;
|
||||
|
||||
flat out float quad_opacity;
|
||||
|
||||
|
||||
int checkFeature( int features, int currentFeature ) {
|
||||
|
||||
if ( ( features & currentFeature ) > 0 ) {
|
||||
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
quad currentMesh = meshArray[ meshIndex ];
|
||||
|
||||
|
||||
vec2 quadPosition = ( position.xy );
|
||||
|
||||
// vec2( -1.0, -1.0 ) -> vec2( 1.0, 1.0 )
|
||||
|
||||
|
||||
quadPosition += vec2( 1.0 );
|
||||
|
||||
quadPosition /= 2.0;
|
||||
|
||||
// vec2( 0, 0 ) -> vec2( 1.0, 1.0 )
|
||||
|
||||
|
||||
vec2 bias = vec2(0, 0); // ??????
|
||||
|
||||
|
||||
|
||||
quadPosition *= currentMesh.size;
|
||||
|
||||
quadPosition += currentMesh.position.xy;
|
||||
|
||||
quadPosition += bias;
|
||||
|
||||
quadPosition /= window;
|
||||
|
||||
|
||||
|
||||
|
||||
quadPosition *= 2.0;
|
||||
|
||||
quadPosition -= vec2( 1.0 );
|
||||
|
||||
|
||||
//quadPosition.y += .02;
|
||||
|
||||
quadPosition.y *= -1;
|
||||
|
||||
quad_color = currentMesh.color;
|
||||
|
||||
quad_size = currentMesh.size;
|
||||
|
||||
quad_position = currentMesh.position.xy;
|
||||
|
||||
quad_opacity = currentMesh.opacity;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gl_Position.xy = quadPosition;
|
||||
|
||||
|
||||
|
||||
const int useTexture = 1;
|
||||
|
||||
|
||||
quad_useTexture = checkFeature( currentMesh.features, useTexture );
|
||||
|
||||
quad_textureIndex = currentMesh.textureIndex;
|
||||
|
||||
vertex_textureCoordinates = textureCoordinates;
|
||||
|
||||
vertex_meshIndex = float( meshIndex );
|
||||
|
||||
gl_Position.w = 1.0;
|
||||
|
||||
|
||||
gl_Position.z = -currentMesh.zIndex / 10000;
|
||||
|
||||
}
|
||||
|
||||
101
binaries/assets/shaders/quad.fragment
Normal file
101
binaries/assets/shaders/quad.fragment
Normal file
@@ -0,0 +1,101 @@
|
||||
#version 460
|
||||
|
||||
out vec4 frag_colour;
|
||||
|
||||
uniform vec3 diffuse;
|
||||
|
||||
uniform vec2 position;
|
||||
|
||||
uniform sampler2DArray samplerArray;
|
||||
|
||||
|
||||
in vec2 vertex_textureCoordinates;
|
||||
|
||||
in float vertex_meshIndex;
|
||||
|
||||
in vec3 vertex_color;
|
||||
|
||||
|
||||
layout( std430, binding = 0 ) buffer inputBlock {
|
||||
|
||||
int characters[ 100 ];
|
||||
|
||||
};
|
||||
|
||||
layout( std430, binding = 1 ) buffer fontData {
|
||||
|
||||
vec2 fontOffsets[ 240 ];
|
||||
|
||||
vec2 fontSizes[ 240 ];
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct quadDetails{
|
||||
|
||||
int textLength;
|
||||
|
||||
float text[];
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
float roundedFrame( vec2 pos, vec2 size, float radius, float thickness )
|
||||
{
|
||||
float d = length(max(abs(vertex_textureCoordinates - pos),size) - size) - radius;
|
||||
return smoothstep(0.55, 0.45, abs(d / thickness) * 5.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
int charactersPerLine = 10;
|
||||
|
||||
vec2 grid = vec2( floor( vertex_textureCoordinates.x * charactersPerLine ), floor( vertex_textureCoordinates.y * charactersPerLine ) );
|
||||
|
||||
|
||||
int index = int( grid.x + ( grid.y * charactersPerLine ) );
|
||||
|
||||
vec2 newCoordinates = vertex_textureCoordinates * charactersPerLine;
|
||||
|
||||
|
||||
newCoordinates = vec2( mod( newCoordinates.x, 1) , mod( newCoordinates.y, 1) );
|
||||
|
||||
|
||||
vec2 fontSize = fontSizes[ index ];
|
||||
|
||||
vec2 offset = fontOffsets[ index ];
|
||||
|
||||
int characterIndex = characters[ index ];
|
||||
|
||||
|
||||
|
||||
vec2 correction = fontSize;
|
||||
|
||||
|
||||
|
||||
newCoordinates.xy += (offset / fontSize) / 128;
|
||||
|
||||
//newCoordinates.xy *= fontSize / 128;
|
||||
|
||||
|
||||
if( characterIndex > 0 ) {
|
||||
|
||||
vec3 coordinate = vec3( newCoordinates, characterIndex );
|
||||
|
||||
float inverse = ( ( texture( samplerArray, coordinate ).r * -1. ) + 1. );
|
||||
|
||||
frag_colour = vec4( 1.0, 1.0, 1.0, inverse );
|
||||
|
||||
} else {
|
||||
|
||||
frag_colour = vec4( 1.0 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
64
binaries/assets/shaders/quad.vertex
Normal file
64
binaries/assets/shaders/quad.vertex
Normal file
@@ -0,0 +1,64 @@
|
||||
#version 460
|
||||
|
||||
layout ( packed, binding = 0 ) uniform events
|
||||
{
|
||||
|
||||
vec2 mouse;
|
||||
|
||||
vec2 window;
|
||||
|
||||
};
|
||||
|
||||
layout ( packed, binding = 1 ) uniform orientation
|
||||
{
|
||||
|
||||
vec2 quadPosition;
|
||||
|
||||
};
|
||||
|
||||
struct quad{
|
||||
|
||||
vec2 position;
|
||||
|
||||
vec2 size;
|
||||
|
||||
vec3 color;
|
||||
|
||||
int textureIndex;
|
||||
|
||||
//int characters[];
|
||||
|
||||
};
|
||||
|
||||
|
||||
layout( std430, binding = 2 ) readonly buffer meshes
|
||||
{
|
||||
|
||||
quad meshArray[1000];
|
||||
|
||||
};
|
||||
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
|
||||
layout(location = 1) in vec2 textureCoordinates;
|
||||
|
||||
layout(location = 2) in int meshIndex;
|
||||
|
||||
|
||||
out vec2 vertex_textureCoordinates;
|
||||
|
||||
out float vertex_meshIndex;
|
||||
|
||||
out vec3 vertex_color;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_Position.xyz = position;
|
||||
|
||||
vertex_textureCoordinates = textureCoordinates;
|
||||
|
||||
gl_Position.w = 1.0;
|
||||
|
||||
}
|
||||
|
||||
64
binaries/assets/shaders/quadScale.vertex
Normal file
64
binaries/assets/shaders/quadScale.vertex
Normal file
@@ -0,0 +1,64 @@
|
||||
#version 460
|
||||
|
||||
layout ( packed, binding = 0 ) uniform events
|
||||
{
|
||||
|
||||
vec2 mouse;
|
||||
|
||||
vec2 window;
|
||||
|
||||
};
|
||||
|
||||
layout ( packed, binding = 1 ) uniform orientation
|
||||
{
|
||||
|
||||
vec2 quadPosition;
|
||||
|
||||
};
|
||||
|
||||
struct quad{
|
||||
|
||||
vec2 position;
|
||||
|
||||
vec2 size;
|
||||
|
||||
vec3 color;
|
||||
|
||||
int textureIndex;
|
||||
|
||||
//int characters[];
|
||||
|
||||
};
|
||||
|
||||
|
||||
layout( std430, binding = 2 ) readonly buffer meshes
|
||||
{
|
||||
|
||||
quad meshArray[1000];
|
||||
|
||||
};
|
||||
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
|
||||
layout(location = 1) in vec2 textureCoordinates;
|
||||
|
||||
layout(location = 2) in int meshIndex;
|
||||
|
||||
|
||||
out vec2 vertex_textureCoordinates;
|
||||
|
||||
out float vertex_meshIndex;
|
||||
|
||||
out vec3 vertex_color;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_Position.xyz = position * .6;
|
||||
|
||||
vertex_textureCoordinates = textureCoordinates;
|
||||
|
||||
gl_Position.w = 1.0;
|
||||
|
||||
}
|
||||
|
||||
17
binaries/assets/shaders/tesselation.geometry.shader
Normal file
17
binaries/assets/shaders/tesselation.geometry.shader
Normal file
@@ -0,0 +1,17 @@
|
||||
#version 410 core
|
||||
|
||||
layout(triangles, invocations = 1) in;
|
||||
layout(line_strip, max_vertices = 4) out;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[2].gl_Position;
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
10
binaries/assets/shaders/tesselation.triangle.shader
Normal file
10
binaries/assets/shaders/tesselation.triangle.shader
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 410 core
|
||||
|
||||
layout(triangles, equal_spacing, ccw) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position.xyzw = gl_in[0].gl_Position.xyzw * gl_TessCoord.x +
|
||||
gl_in[1].gl_Position.xyzw * gl_TessCoord.y +
|
||||
gl_in[2].gl_Position.xyzw * gl_TessCoord.z;
|
||||
}
|
||||
14
binaries/assets/shaders/tesselation.triangle.tsc.shader
Normal file
14
binaries/assets/shaders/tesselation.triangle.tsc.shader
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 410 core
|
||||
|
||||
layout(vertices = 3) out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TessLevelOuter[0] = 2.0;
|
||||
gl_TessLevelOuter[1] = 4.0;
|
||||
gl_TessLevelOuter[2] = 6.0;
|
||||
|
||||
gl_TessLevelInner[0] = 8.0;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
}
|
||||
1
binaries/assets/test
Executable file
1
binaries/assets/test
Executable file
@@ -0,0 +1 @@
|
||||
this is just a test.
|
||||
1
binaries/assets/testFile
Normal file
1
binaries/assets/testFile
Normal file
@@ -0,0 +1 @@
|
||||
content of file
|
||||
Reference in New Issue
Block a user