mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-20 09:57:09 +00:00
fix: slime block render priority
thanks to Tranq for calling it out
This commit is contained in:
parent
986af5438c
commit
e8b66c62d7
|
|
@ -325,12 +325,14 @@ void Chunk::rebuild()
|
||||||
if( empty )
|
if( empty )
|
||||||
{
|
{
|
||||||
// 4J - added - clear any renderer data associated with this
|
// 4J - added - clear any renderer data associated with this
|
||||||
for (int currentLayer = 0; currentLayer < 2; currentLayer++)
|
for (int currentLayer = 0; currentLayer < LevelRenderer::CHUNK_RENDER_LAYERS; currentLayer++)
|
||||||
{
|
{
|
||||||
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer);
|
if (currentLayer < 2)
|
||||||
|
{
|
||||||
|
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer);
|
||||||
|
}
|
||||||
RenderManager.CBuffClear(lists + currentLayer);
|
RenderManager.CBuffClear(lists + currentLayer);
|
||||||
}
|
}
|
||||||
RenderManager.CBuffClear(lists + 2);
|
|
||||||
|
|
||||||
delete region;
|
delete region;
|
||||||
delete tileRenderer;
|
delete tileRenderer;
|
||||||
|
|
@ -483,13 +485,26 @@ void Chunk::rebuild()
|
||||||
if((currentLayer==0)&&(!renderNextLayer))
|
if((currentLayer==0)&&(!renderNextLayer))
|
||||||
{
|
{
|
||||||
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1);
|
levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1);
|
||||||
RenderManager.CBuffClear(lists + 1);
|
for (int clearLayer = 1; clearLayer < LevelRenderer::CHUNK_RENDER_LAYERS; clearLayer++)
|
||||||
RenderManager.CBuffClear(lists + 2);
|
{
|
||||||
|
RenderManager.CBuffClear(lists + clearLayer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if((currentLayer==1)&&(!renderNextLayer))
|
if((currentLayer==1)&&(!renderNextLayer))
|
||||||
{
|
{
|
||||||
RenderManager.CBuffClear(lists + 2);
|
for (int clearLayer = 2; clearLayer < LevelRenderer::CHUNK_RENDER_LAYERS; clearLayer++)
|
||||||
|
{
|
||||||
|
RenderManager.CBuffClear(lists + clearLayer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if((currentLayer==2)&&(!renderNextLayer))
|
||||||
|
{
|
||||||
|
for (int clearLayer = 3; clearLayer < LevelRenderer::CHUNK_RENDER_LAYERS; clearLayer++)
|
||||||
|
{
|
||||||
|
RenderManager.CBuffClear(lists + clearLayer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1659,6 +1659,18 @@ void GameRenderer::renderLevel(float a, int64_t until)
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glBlendFunc(GL_ZERO, GL_ONE);
|
||||||
|
PIXBeginNamedEvent(0,"Fourth pass level render");
|
||||||
|
int visibleTopTransparentChunksLayer3 = levelRenderer->render(cameraEntity, 3, a, updateChunks);
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
if (visibleTopTransparentChunksLayer3 > 0)
|
||||||
|
{
|
||||||
|
PIXBeginNamedEvent(0,"Fourth pass level direct render");
|
||||||
|
levelRenderer->renderChunksDirect(3, a);
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
}
|
||||||
|
|
||||||
GL11::glShadeModel(GL11::GL_FLAT);
|
GL11::glShadeModel(GL11::GL_FLAT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1669,6 +1681,9 @@ void GameRenderer::renderLevel(float a, int64_t until)
|
||||||
PIXBeginNamedEvent(0,"Third pass level render");
|
PIXBeginNamedEvent(0,"Third pass level render");
|
||||||
levelRenderer->render(cameraEntity, 2, a, updateChunks);
|
levelRenderer->render(cameraEntity, 2, a, updateChunks);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
PIXBeginNamedEvent(0,"Fourth pass level render");
|
||||||
|
levelRenderer->render(cameraEntity, 3, a, updateChunks);
|
||||||
|
PIXEndNamedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4J - added - have split out translucent particle rendering so that it happens after the water is rendered, primarily for fireworks
|
// 4J - added - have split out translucent particle rendering so that it happens after the water is rendered, primarily for fireworks
|
||||||
|
|
|
||||||
|
|
@ -166,9 +166,11 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures)
|
||||||
visibleLists_layer0 = nullptr;
|
visibleLists_layer0 = nullptr;
|
||||||
visibleLists_layer1 = nullptr;
|
visibleLists_layer1 = nullptr;
|
||||||
visibleLists_layer2 = nullptr;
|
visibleLists_layer2 = nullptr;
|
||||||
|
visibleLists_layer3 = nullptr;
|
||||||
visibleCount_layer0 = 0;
|
visibleCount_layer0 = 0;
|
||||||
visibleCount_layer1 = 0;
|
visibleCount_layer1 = 0;
|
||||||
visibleCount_layer2 = 0;
|
visibleCount_layer2 = 0;
|
||||||
|
visibleCount_layer3 = 0;
|
||||||
|
|
||||||
this->mc = mc;
|
this->mc = mc;
|
||||||
this->textures = textures;
|
this->textures = textures;
|
||||||
|
|
@ -473,9 +475,11 @@ void LevelRenderer::allChanged(int playerIndex)
|
||||||
delete[] visibleLists_layer0;
|
delete[] visibleLists_layer0;
|
||||||
delete[] visibleLists_layer1;
|
delete[] visibleLists_layer1;
|
||||||
delete[] visibleLists_layer2;
|
delete[] visibleLists_layer2;
|
||||||
|
delete[] visibleLists_layer3;
|
||||||
visibleLists_layer0 = nullptr;
|
visibleLists_layer0 = nullptr;
|
||||||
visibleLists_layer1 = nullptr;
|
visibleLists_layer1 = nullptr;
|
||||||
visibleLists_layer2 = nullptr;
|
visibleLists_layer2 = nullptr;
|
||||||
|
visibleLists_layer3 = nullptr;
|
||||||
|
|
||||||
chunks[playerIndex] = ClipChunkArray(xChunks * yChunks * zChunks);
|
chunks[playerIndex] = ClipChunkArray(xChunks * yChunks * zChunks);
|
||||||
// sortedChunks[playerIndex] = new vector<Chunk *>(xChunks * yChunks * zChunks); // 4J - removed - not sorting our chunks anymore
|
// sortedChunks[playerIndex] = new vector<Chunk *>(xChunks * yChunks * zChunks); // 4J - removed - not sorting our chunks anymore
|
||||||
|
|
@ -514,9 +518,11 @@ void LevelRenderer::allChanged(int playerIndex)
|
||||||
visibleLists_layer0 = new int[totalChunkCount];
|
visibleLists_layer0 = new int[totalChunkCount];
|
||||||
visibleLists_layer1 = new int[totalChunkCount];
|
visibleLists_layer1 = new int[totalChunkCount];
|
||||||
visibleLists_layer2 = new int[totalChunkCount];
|
visibleLists_layer2 = new int[totalChunkCount];
|
||||||
|
visibleLists_layer3 = new int[totalChunkCount];
|
||||||
visibleCount_layer0 = 0;
|
visibleCount_layer0 = 0;
|
||||||
visibleCount_layer1 = 0;
|
visibleCount_layer1 = 0;
|
||||||
visibleCount_layer2 = 0;
|
visibleCount_layer2 = 0;
|
||||||
|
visibleCount_layer3 = 0;
|
||||||
|
|
||||||
if (level != nullptr)
|
if (level != nullptr)
|
||||||
{
|
{
|
||||||
|
|
@ -810,6 +816,11 @@ void LevelRenderer::renderChunksDirect(int layer, double alpha)
|
||||||
lists = visibleLists_layer1;
|
lists = visibleLists_layer1;
|
||||||
numVisible = visibleCount_layer1;
|
numVisible = visibleCount_layer1;
|
||||||
}
|
}
|
||||||
|
else if (layer == 3)
|
||||||
|
{
|
||||||
|
lists = visibleLists_layer3;
|
||||||
|
numVisible = visibleCount_layer3;
|
||||||
|
}
|
||||||
bool first = true;
|
bool first = true;
|
||||||
if (lists != nullptr)
|
if (lists != nullptr)
|
||||||
{
|
{
|
||||||
|
|
@ -909,6 +920,11 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
||||||
lists = visibleLists_layer1;
|
lists = visibleLists_layer1;
|
||||||
numVisible = visibleCount_layer1;
|
numVisible = visibleCount_layer1;
|
||||||
}
|
}
|
||||||
|
else if (layer == 3)
|
||||||
|
{
|
||||||
|
lists = visibleLists_layer3;
|
||||||
|
numVisible = visibleCount_layer3;
|
||||||
|
}
|
||||||
if (lists != nullptr)
|
if (lists != nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numVisible; i++)
|
for (int i = 0; i < numVisible; i++)
|
||||||
|
|
@ -2684,6 +2700,7 @@ void LevelRenderer::cull(Culler *culler, float a)
|
||||||
visibleCount_layer0 = 0;
|
visibleCount_layer0 = 0;
|
||||||
visibleCount_layer1 = 0;
|
visibleCount_layer1 = 0;
|
||||||
visibleCount_layer2 = 0;
|
visibleCount_layer2 = 0;
|
||||||
|
visibleCount_layer3 = 0;
|
||||||
|
|
||||||
// Column-level frustum culling: test one AABB per XZ column before testing individual Y chunks.
|
// Column-level frustum culling: test one AABB per XZ column before testing individual Y chunks.
|
||||||
// At dist 64 this reduces ~278K clip() calls to ~17K column tests + per-chunk tests only for visible columns.
|
// At dist 64 this reduces ~278K clip() calls to ~17K column tests + per-chunk tests only for visible columns.
|
||||||
|
|
@ -2743,6 +2760,7 @@ void LevelRenderer::cull(Culler *culler, float a)
|
||||||
if (!((flags & CHUNK_FLAG_EMPTY1) == CHUNK_FLAG_EMPTY1))
|
if (!((flags & CHUNK_FLAG_EMPTY1) == CHUNK_FLAG_EMPTY1))
|
||||||
visibleLists_layer1[visibleCount_layer1++] = list + 1;
|
visibleLists_layer1[visibleCount_layer1++] = list + 1;
|
||||||
visibleLists_layer2[visibleCount_layer2++] = list + 2;
|
visibleLists_layer2[visibleCount_layer2++] = list + 2;
|
||||||
|
visibleLists_layer3[visibleCount_layer3++] = list + 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
void doBarrierParticles(int posX, int posY, int posZ);
|
void doBarrierParticles(int posX, int posY, int posZ);
|
||||||
|
|
||||||
static const int CHUNK_XZSIZE = 16;
|
static const int CHUNK_XZSIZE = 16;
|
||||||
static const int CHUNK_RENDER_LAYERS = 3;
|
static const int CHUNK_RENDER_LAYERS = 4;
|
||||||
#ifdef _LARGE_WORLDS
|
#ifdef _LARGE_WORLDS
|
||||||
static const int CHUNK_SIZE = 16;
|
static const int CHUNK_SIZE = 16;
|
||||||
#else
|
#else
|
||||||
|
|
@ -286,9 +286,11 @@ public:
|
||||||
int *visibleLists_layer0;
|
int *visibleLists_layer0;
|
||||||
int *visibleLists_layer1;
|
int *visibleLists_layer1;
|
||||||
int *visibleLists_layer2;
|
int *visibleLists_layer2;
|
||||||
|
int *visibleLists_layer3;
|
||||||
int visibleCount_layer0;
|
int visibleCount_layer0;
|
||||||
int visibleCount_layer1;
|
int visibleCount_layer1;
|
||||||
int visibleCount_layer2;
|
int visibleCount_layer2;
|
||||||
|
int visibleCount_layer3;
|
||||||
|
|
||||||
bool dirtyChunkPresent;
|
bool dirtyChunkPresent;
|
||||||
int64_t lastDirtyChunkFound;
|
int64_t lastDirtyChunkFound;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ int StainedGlassBlock::getItemAuxValueForBlockData(int data)
|
||||||
|
|
||||||
int StainedGlassBlock::getRenderLayer()
|
int StainedGlassBlock::getRenderLayer()
|
||||||
{
|
{
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StainedGlassBlock::registerIcons(IconRegister *iconRegister)
|
void StainedGlassBlock::registerIcons(IconRegister *iconRegister)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ int StainedGlassPaneBlock::getItemAuxValueForBlockData(int data)
|
||||||
|
|
||||||
int StainedGlassPaneBlock::getRenderLayer()
|
int StainedGlassPaneBlock::getRenderLayer()
|
||||||
{
|
{
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StainedGlassPaneBlock::registerIcons(IconRegister *iconRegister)
|
void StainedGlassPaneBlock::registerIcons(IconRegister *iconRegister)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue