Render: Add support for int/double shader attributes
This commit is contained in:
@@ -4,14 +4,14 @@ layout(location = 0) out vec4 color;
|
||||
|
||||
in vec3 v_normal;
|
||||
in vec2 v_textureCoordinates;
|
||||
in flat float v_textureIndex;
|
||||
in flat uint v_textureIndex;
|
||||
|
||||
uniform sampler2D u_textures[32];
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 textureColor = vec4(1.0f);
|
||||
switch(int(v_textureIndex)) {
|
||||
switch(v_textureIndex) {
|
||||
case 0: break; // Texture unit 0 is reserved for no texture
|
||||
case 1: textureColor *= texture(u_textures[1], v_textureCoordinates); break;
|
||||
case 2: textureColor *= texture(u_textures[2], v_textureCoordinates); break;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec3 a_normal;
|
||||
layout(location = 2) in vec2 a_textureCoordinates;
|
||||
layout(location = 3) in float a_textureIndex;
|
||||
layout(location = 3) in uint a_textureIndex;
|
||||
|
||||
out vec3 v_normal;
|
||||
out vec2 v_textureCoordinates;
|
||||
out flat float v_textureIndex;
|
||||
out flat uint v_textureIndex;
|
||||
|
||||
uniform mat4 u_projectionView;
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ layout(location = 0) out vec4 color;
|
||||
|
||||
in vec4 v_color;
|
||||
in vec3 v_textureCoordinates;
|
||||
in flat float v_textureIndex;
|
||||
in flat uint v_textureIndex;
|
||||
|
||||
uniform samplerCube u_textures[32];
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 textureColor = v_color;
|
||||
switch(int(v_textureIndex)) {
|
||||
switch(v_textureIndex) {
|
||||
case 0: break; // Texture unit 0 is reserved for no texture
|
||||
case 1: textureColor *= texture(u_textures[1], v_textureCoordinates); break;
|
||||
case 2: textureColor *= texture(u_textures[2], v_textureCoordinates); break;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec4 a_color;
|
||||
layout(location = 2) in float a_textureIndex;
|
||||
layout(location = 2) in uint a_textureIndex;
|
||||
|
||||
out vec4 v_color;
|
||||
out vec3 v_textureCoordinates;
|
||||
out flat float v_textureIndex;
|
||||
out flat uint v_textureIndex;
|
||||
|
||||
uniform mat4 u_projectionView;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ layout(location = 0) out vec4 color;
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_textureCoordinates;
|
||||
in flat float v_textureIndex;
|
||||
in flat uint v_textureIndex;
|
||||
in float v_width;
|
||||
in float v_edge;
|
||||
in float v_borderWidth;
|
||||
@@ -25,7 +25,7 @@ float alpha(float textureAlpha)
|
||||
void main()
|
||||
{
|
||||
vec4 textureColor = v_color;
|
||||
switch(int(v_textureIndex)) {
|
||||
switch(v_textureIndex) {
|
||||
case 0: break; // Texture unit 0 is reserved for no texture
|
||||
// case 1: textureColor.a = 1; break;
|
||||
case 1: textureColor.a = alpha(texture(u_textures[1], v_textureCoordinates).a); break;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec4 a_color;
|
||||
layout(location = 2) in vec2 a_textureCoordinates;
|
||||
layout(location = 3) in float a_textureIndex;
|
||||
layout(location = 3) in uint a_textureIndex;
|
||||
layout(location = 4) in float a_width;
|
||||
layout(location = 5) in float a_edge;
|
||||
layout(location = 6) in float a_borderWidth;
|
||||
@@ -13,7 +13,7 @@ layout(location = 9) in float a_offset;
|
||||
|
||||
out vec4 v_color;
|
||||
out vec2 v_textureCoordinates;
|
||||
out flat float v_textureIndex;
|
||||
out flat uint v_textureIndex;
|
||||
out float v_width;
|
||||
out float v_edge;
|
||||
out float v_borderWidth;
|
||||
|
||||
@@ -4,14 +4,14 @@ layout(location = 0) out vec4 color;
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_textureCoordinates;
|
||||
in flat float v_textureIndex;
|
||||
in flat uint v_textureIndex;
|
||||
|
||||
uniform sampler2D u_textures[32];
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 textureColor = v_color;
|
||||
switch(int(v_textureIndex)) {
|
||||
switch(v_textureIndex) {
|
||||
case 0: break; // Texture unit 0 is reserved for no texture
|
||||
case 1: textureColor *= texture(u_textures[1], v_textureCoordinates); break;
|
||||
case 2: textureColor *= texture(u_textures[2], v_textureCoordinates); break;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec4 a_color;
|
||||
layout(location = 2) in vec2 a_textureCoordinates;
|
||||
layout(location = 3) in float a_textureIndex;
|
||||
layout(location = 3) in uint a_textureIndex;
|
||||
|
||||
out vec4 v_color;
|
||||
out vec2 v_textureCoordinates;
|
||||
out flat float v_textureIndex;
|
||||
out flat uint v_textureIndex;
|
||||
|
||||
uniform mat4 u_projectionView;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user