barry + shift
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
//Use quad shuffling to compute fragment mip
|
||||
//#extension GL_KHR_shader_subgroup_quad: enable
|
||||
|
||||
#ifdef USE_NV_BARRY
|
||||
#extension GL_NV_fragment_shader_barycentric: require
|
||||
#endif
|
||||
|
||||
layout(binding = 0) uniform sampler2D blockModelAtlas;
|
||||
layout(binding = 2) uniform sampler2D depthTex;
|
||||
@@ -12,7 +15,9 @@ layout(binding = 2) uniform sampler2D depthTex;
|
||||
// however they are not a full block
|
||||
|
||||
layout(location = 0) in flat uvec4 interData;
|
||||
#ifndef USE_NV_BARRY
|
||||
layout(location = 1) in vec2 uv;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RENDER
|
||||
layout(location = 7) in flat uint quadDebug;
|
||||
@@ -109,6 +114,10 @@ void main() {
|
||||
//vec2 uv = vec2(0);
|
||||
//Tile is the tile we are in
|
||||
vec2 tile;
|
||||
#ifdef USE_NV_BARRY
|
||||
vec2 uv = mix(gl_BaryCoordNV.yx, 1-gl_BaryCoordNV.xz, gl_PrimitiveID&1)*(vec2((interData.x>>8)&0xFu, (interData.x>>12)&0xFu)+1);
|
||||
#endif
|
||||
|
||||
vec2 uv2 = modf(uv, tile)*(1.0/(vec2(3.0,2.0)*256.0));
|
||||
vec4 colour;
|
||||
vec2 texPos = uv2 + getBaseUV();
|
||||
|
||||
@@ -7,15 +7,13 @@
|
||||
#define POSITION_SCRATCH_BINDING 5
|
||||
#define LIGHTING_SAMPLER_BINDING 1
|
||||
|
||||
#define USE_INTERPOLATED_UV
|
||||
|
||||
#import <voxy:lod/quad_format.glsl>
|
||||
#import <voxy:lod/block_model.glsl>
|
||||
#import <voxy:lod/gl46/bindings.glsl>
|
||||
#import <voxy:lod/quad_util.glsl>
|
||||
|
||||
layout(location = 0) out flat uvec4 interData;
|
||||
#ifdef USE_INTERPOLATED_UV
|
||||
#ifndef USE_NV_BARRY
|
||||
layout(location = 1) out vec2 uv;
|
||||
#endif
|
||||
|
||||
@@ -37,7 +35,7 @@ void main() {
|
||||
uint cornerId = gl_VertexID&3;
|
||||
gl_Position = getQuadCornerPos(quad, cornerId);
|
||||
|
||||
#ifdef USE_INTERPOLATED_UV
|
||||
#ifndef USE_NV_BARRY
|
||||
uv = getCornerUV(quad, cornerId);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ vec4 getQuadCornerPos(in QuadData quad, uint cornerId) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
#ifdef USE_INTERPOLATED_UV
|
||||
#ifndef USE_NV_BARRY
|
||||
vec2 getCornerUV(const in QuadData quad, uint cornerId) {
|
||||
return quad.uvCorner + quad.quadSizeAddin*vec2((cornerId>>1)&1u, cornerId&1u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user