use provoking vertex

This commit is contained in:
mcrcortex
2025-06-03 00:08:01 +10:00
parent 075e8f2897
commit 8462dde374
2 changed files with 10 additions and 5 deletions

View File

@@ -136,6 +136,7 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
this.bindRenderingBuffers(viewport, depthBoundTexture);
glMemoryBarrier(GL_COMMAND_BARRIER_BIT|GL_SHADER_STORAGE_BARRIER_BIT);//Barrier everything is needed
glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
glMultiDrawElementsIndirectCountARB(GL_TRIANGLES, GL_UNSIGNED_SHORT, indirectOffset, drawCountOffset, maxDrawCount, 0);
glEnable(GL_CULL_FACE);
@@ -169,6 +170,7 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
glBindVertexArray(RenderService.STATIC_VAO);//Needs to be before binding
this.bindRenderingBuffers(viewport, depthBoundTexture);
glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
glMultiDrawElementsIndirectCountARB(GL_TRIANGLES, GL_UNSIGNED_SHORT, TRANSLUCENT_OFFSET*5*4, 4*4, Math.min(this.geometryManager.getSectionCount(), 100_000), 0);
glEnable(GL_CULL_FACE);

View File

@@ -104,13 +104,16 @@ void main() {
uvec2 encPos = positionBuffer[gl_BaseInstance];
uint lodLevel = extractDetail(encPos);
ivec2 quadSize = extractSize(quad);
if (cornerIdx == 1) //Only if we are the provoking vertex
{
vec2 modelUV = vec2(modelId&0xFFu, (modelId>>8)&0xFFu)*(1.0/(256.0));
baseUV = modelUV + (vec2(face>>1, face&1u) * (1.0/(vec2(3.0, 2.0)*256.0)));
ivec2 quadSize = extractSize(quad);
{ //Generate tinting and flag data
//Generate tinting and flag data
flags = faceHasAlphaCuttout(faceData);
//We need to have a conditional override based on if the model size is < a full face + quadSize > 1