fix: beacon outer halo washed out behind water

This commit is contained in:
itsRevela committed 2026-04-28 14:19:22 -05:00
1 parent 0df5cd865b
commit 89ed116fe0
5 files changed
+44 -13

No files matched your search

+12 -13
View File
@@ -6,6 +6,8 @@
ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM); ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM);
bool BeaconRenderer::s_renderOuterHalo = false;
void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
{ {
shared_ptr<BeaconTileEntity> beacon = dynamic_pointer_cast<BeaconTileEntity>(_beacon); shared_ptr<BeaconTileEntity> beacon = dynamic_pointer_cast<BeaconTileEntity>(_beacon);
@@ -18,21 +20,18 @@ void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y,
bindTexture(&BEAM_LOCATION); bindTexture(&BEAM_LOCATION);
// TODO: 4J: Put this back in
//assert(0);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
float tt = beacon->getLevel()->getGameTime() + a; float tt = beacon->getLevel()->getGameTime() + a;
float texVOff = -tt * .20f - floor(-tt * .10f); float texVOff = -tt * .20f - floor(-tt * .10f);
if (!s_renderOuterHalo)
{ {
glDisable(GL_BLEND);
glDepthMask(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
int r = 1; int r = 1;
double rot = tt * .025 * (1 - (r & 1) * 2.5); double rot = tt * .025 * (1 - (r & 1) * 2.5);
@@ -81,12 +80,12 @@ void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y,
t->end(); t->end();
} }
else
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
{ {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
t->begin(); t->begin();
t->color(255, 255, 255, 32); t->color(255, 255, 255, 32);
+2
View File
@@ -9,5 +9,7 @@ private:
static ResourceLocation BEAM_LOCATION; static ResourceLocation BEAM_LOCATION;
public: public:
static bool s_renderOuterHalo;
virtual void render(shared_ptr<TileEntity> _beacon, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled); virtual void render(shared_ptr<TileEntity> _beacon, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled);
}; };
+4
View File
@@ -1558,6 +1558,10 @@ void GameRenderer::renderLevel(float a, int64_t until)
PIXEndNamedEvent(); PIXEndNamedEvent();
} }
PIXBeginNamedEvent(0,"Beacon beam halo (after water)");
levelRenderer->renderBeaconBeams(a);
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
PIXBeginNamedEvent(0,"Particle render (translucent)"); PIXBeginNamedEvent(0,"Particle render (translucent)");
Lighting::turnOn(); Lighting::turnOn();
+25
View File
@@ -6,6 +6,7 @@
#include "Chunk.h" #include "Chunk.h"
#include "EntityRenderDispatcher.h" #include "EntityRenderDispatcher.h"
#include "TileEntityRenderDispatcher.h" #include "TileEntityRenderDispatcher.h"
#include "BeaconRenderer.h"
#include "DistanceChunkSorter.h" #include "DistanceChunkSorter.h"
#include "DirtyChunkSorter.h" #include "DirtyChunkSorter.h"
#include "MobSkinTextureProcessor.h" #include "MobSkinTextureProcessor.h"
@@ -653,6 +654,30 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2 mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2
} }
void LevelRenderer::renderBeaconBeams(float a)
{
if (mc == nullptr || mc->player == nullptr) return;
int playerIndex = mc->player->GetXboxPad();
if (level[playerIndex] == nullptr) return;
BeaconRenderer::s_renderOuterHalo = true;
EnterCriticalSection(&m_csRenderableTileEntities);
for (auto & it : renderableTileEntities)
{
if (!isGlobalIndexInSameDimension(it.first, level[playerIndex])) continue;
for (auto& te : it.second)
{
if (te->GetType() != eTYPE_BEACONTILEENTITY) continue;
TileEntityRenderDispatcher::instance->render(te, a);
}
}
LeaveCriticalSection(&m_csRenderableTileEntities);
BeaconRenderer::s_renderOuterHalo = false;
}
wstring LevelRenderer::gatherStats1() wstring LevelRenderer::gatherStats1()
{ {
return L"C: " + std::to_wstring(renderedChunks) + L"/" + std::to_wstring(totalChunks) + L". F: " + std::to_wstring(offscreenChunks) + L", O: " + std::to_wstring(occludedChunks) + L", E: " + std::to_wstring(emptyChunks); return L"C: " + std::to_wstring(renderedChunks) + L"/" + std::to_wstring(totalChunks) + L". F: " + std::to_wstring(offscreenChunks) + L", O: " + std::to_wstring(occludedChunks) + L", E: " + std::to_wstring(emptyChunks);
+1
View File
@@ -77,6 +77,7 @@ public:
void AddDLCSkinsToMemTextures(); void AddDLCSkinsToMemTextures();
public: public:
void renderEntities(Vec3 *cam, Culler *culler, float a); void renderEntities(Vec3 *cam, Culler *culler, float a);
void renderBeaconBeams(float a);
wstring gatherStats1(); wstring gatherStats1();
wstring gatherStats2(); wstring gatherStats2();
private: private: