mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-06-27 03:55:41 +00:00
fix: beacon outer halo washed out behind water
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
// 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_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
glDepthMask(true);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
float tt = beacon->getLevel()->getGameTime() + a;
|
||||
float texVOff = -tt * .20f - floor(-tt * .10f);
|
||||
|
||||
if (!s_renderOuterHalo)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDepthMask(true);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
int r = 1;
|
||||
|
||||
double rot = tt * .025 * (1 - (r & 1) * 2.5);
|
||||
@@ -73,20 +72,20 @@ void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y,
|
||||
t->vertexUV(x + enx, y, z + enz, uu2, vv2);
|
||||
t->vertexUV(x + esx, y, z + esz, uu1, vv2);
|
||||
t->vertexUV(x + esx, y + top, z + esz, uu1, vv1);
|
||||
|
||||
|
||||
t->vertexUV(x + wsx, y + top, z + wsz, uu2, vv1);
|
||||
t->vertexUV(x + wsx, y, z + wsz, uu2, vv2);
|
||||
t->vertexUV(x + wnx, y, z + wnz, uu1, vv2);
|
||||
t->vertexUV(x + wnx, y + top, z + wnz, uu1, vv1);
|
||||
|
||||
|
||||
t->end();
|
||||
}
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask(false);
|
||||
|
||||
else
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask(false);
|
||||
|
||||
t->begin();
|
||||
t->color(255, 255, 255, 32);
|
||||
|
||||
@@ -111,22 +110,22 @@ void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y,
|
||||
t->vertexUV(x + wnx, y, z + wnz, uu2, vv2);
|
||||
t->vertexUV(x + enx, y, z + enz, uu1, vv2);
|
||||
t->vertexUV(x + enx, y + top, z + enz, uu1, vv1);
|
||||
|
||||
|
||||
t->vertexUV(x + esx, y + top, z + esz, uu2, vv1);
|
||||
t->vertexUV(x + esx, y, z + esz, uu2, vv2);
|
||||
t->vertexUV(x + wsx, y, z + wsz, uu1, vv2);
|
||||
t->vertexUV(x + wsx, y + top, z + wsz, uu1, vv1);
|
||||
|
||||
|
||||
t->vertexUV(x + enx, y + top, z + enz, uu2, vv1);
|
||||
t->vertexUV(x + enx, y, z + enz, uu2, vv2);
|
||||
t->vertexUV(x + esx, y, z + esz, uu1, vv2);
|
||||
t->vertexUV(x + esx, y + top, z + esz, uu1, vv1);
|
||||
|
||||
|
||||
t->vertexUV(x + wsx, y + top, z + wsz, uu2, vv1);
|
||||
t->vertexUV(x + wsx, y, z + wsz, uu2, vv2);
|
||||
t->vertexUV(x + wnx, y, z + wnz, uu1, vv2);
|
||||
t->vertexUV(x + wnx, y + top, z + wnz, uu1, vv1);
|
||||
|
||||
|
||||
t->end();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,7 @@ private:
|
||||
static ResourceLocation BEAM_LOCATION;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
@@ -1558,6 +1558,10 @@ void GameRenderer::renderLevel(float a, int64_t until)
|
||||
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
|
||||
PIXBeginNamedEvent(0,"Particle render (translucent)");
|
||||
Lighting::turnOn();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Chunk.h"
|
||||
#include "EntityRenderDispatcher.h"
|
||||
#include "TileEntityRenderDispatcher.h"
|
||||
#include "BeaconRenderer.h"
|
||||
#include "DistanceChunkSorter.h"
|
||||
#include "DirtyChunkSorter.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
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
void AddDLCSkinsToMemTextures();
|
||||
public:
|
||||
void renderEntities(Vec3 *cam, Culler *culler, float a);
|
||||
void renderBeaconBeams(float a);
|
||||
wstring gatherStats1();
|
||||
wstring gatherStats2();
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user