mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/GabsPuNs-MinecraftConsoles.git
synced 2026-05-22 02:07:14 +00:00
LCE Renewed - Merged some fixes and code updates from TU25. * Fixed transparent items in hand. * Beacon beams fixes. - Fixed a crash when a dispenser is dispensing water or lava when the dispenser is blocked. Minecraft Consoles - Merged Asynchronous server joining - Memory leak fix: Make chunks unload properly Other - Fixed Server Menu and Rename World Menu in 720p Res
151 lines
4.4 KiB
C++
151 lines
4.4 KiB
C++
#include "stdafx.h"
|
|
#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
|
#include "..\Minecraft.World\net.minecraft.world.level.h"
|
|
#include "BeaconRenderer.h"
|
|
#include "Tesselator.h"
|
|
|
|
ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM);
|
|
|
|
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);
|
|
|
|
float scale = beacon->getAndUpdateClientSideScale();
|
|
|
|
if (scale > 0)
|
|
{
|
|
Tesselator *t = Tesselator::getInstance();
|
|
|
|
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);
|
|
|
|
float ca = .125f;
|
|
int yb = 0;
|
|
|
|
for (unsigned int i = 0; i < beacon->beamSections.size(); i++)
|
|
{
|
|
BeaconTileEntity::BeaconBeamSection& section = beacon->beamSections.at(i);
|
|
int sectionTop = yb + section.getHeight();
|
|
|
|
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);
|
|
|
|
{
|
|
int r = 1;
|
|
|
|
double rot = tt * .025 * (1 - (r & 1) * 2.5);
|
|
|
|
t->begin();
|
|
t->color(section.getColor()[0], section.getColor()[1], section.getColor()[2], ca);
|
|
|
|
double rr1 = r * 0.2;
|
|
|
|
double wnx = .5 + cos(rot + PI * .75) * rr1;
|
|
double wnz = .5 + sin(rot + PI * .75) * rr1;
|
|
double enx = .5 + cos(rot + PI * .25) * rr1;
|
|
double enz = .5 + sin(rot + PI * .25) * rr1;
|
|
|
|
double wsx = .5 + cos(rot + PI * 1.25) * rr1;
|
|
double wsz = .5 + sin(rot + PI * 1.25) * rr1;
|
|
double esx = .5 + cos(rot + PI * 1.75) * rr1;
|
|
double esz = .5 + sin(rot + PI * 1.75) * rr1;
|
|
|
|
double bot = y + yb;
|
|
double top = y + sectionTop * scale;
|
|
|
|
double uu1 = 0;
|
|
double uu2 = 1;
|
|
double vv2 = -1 + texVOff;
|
|
double vv1 = section.getHeight() * scale * 2.5 + vv2;
|
|
|
|
t->vertexUV(x + wnx, top, z + wnz, uu2, vv1);
|
|
t->vertexUV(x + wnx, bot, z + wnz, uu2, vv2);
|
|
t->vertexUV(x + enx, bot, z + enz, uu1, vv2);
|
|
t->vertexUV(x + enx, top, z + enz, uu1, vv1);
|
|
|
|
t->vertexUV(x + enx, top, z + enz, uu2, vv1);
|
|
t->vertexUV(x + enx, bot, z + enz, uu2, vv2);
|
|
t->vertexUV(x + esx, bot, z + esz, uu1, vv2);
|
|
t->vertexUV(x + esx, top, z + esz, uu1, vv1);
|
|
|
|
t->vertexUV(x + esx, top, z + esz, uu2, vv1);
|
|
t->vertexUV(x + esx, bot, z + esz, uu2, vv2);
|
|
t->vertexUV(x + wsx, bot, z + wsz, uu1, vv2);
|
|
t->vertexUV(x + wsx, top, z + wsz, uu1, vv1);
|
|
|
|
t->vertexUV(x + wsx, top, z + wsz, uu2, vv1);
|
|
t->vertexUV(x + wsx, bot, z + wsz, uu2, vv2);
|
|
t->vertexUV(x + wnx, bot, z + wnz, uu1, vv2);
|
|
t->vertexUV(x + wnx, top, z + wnz, uu1, vv1);
|
|
|
|
t->end();
|
|
}
|
|
|
|
glEnable(GL_BLEND);
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
glDepthMask(false);
|
|
|
|
{
|
|
t->begin();
|
|
t->color(section.getColor()[0], section.getColor()[1], section.getColor()[2], ca);
|
|
|
|
double wnx = .2;
|
|
double wnz = .2;
|
|
double enx = .8;
|
|
double enz = .2;
|
|
|
|
double wsx = .2;
|
|
double wsz = .8;
|
|
double esx = .8;
|
|
double esz = .8;
|
|
|
|
double top = y + sectionTop * scale;
|
|
double bot = y + yb;
|
|
|
|
double uu1 = 0;
|
|
double uu2 = 1;
|
|
double vv2 = -1 + texVOff;
|
|
double vv1 = section.getHeight() * scale + vv2;
|
|
|
|
t->vertexUV(x + wnx, top, z + wnz, uu2, vv1);
|
|
t->vertexUV(x + wnx, bot, z + wnz, uu2, vv2);
|
|
t->vertexUV(x + enx, bot, z + enz, uu1, vv2);
|
|
t->vertexUV(x + enx, top, z + enz, uu1, vv1);
|
|
|
|
t->vertexUV(x + enx, top, z + enz, uu2, vv1);
|
|
t->vertexUV(x + enx, bot, z + enz, uu2, vv2);
|
|
t->vertexUV(x + esx, bot, z + esz, uu1, vv2);
|
|
t->vertexUV(x + esx, top, z + esz, uu1, vv1);
|
|
|
|
t->vertexUV(x + esx, top, z + esz, uu2, vv1);
|
|
t->vertexUV(x + esx, bot, z + esz, uu2, vv2);
|
|
t->vertexUV(x + wsx, bot, z + wsz, uu1, vv2);
|
|
t->vertexUV(x + wsx, top, z + wsz, uu1, vv1);
|
|
|
|
t->vertexUV(x + wsx, top, z + wsz, uu2, vv1);
|
|
t->vertexUV(x + wsx, bot, z + wsz, uu2, vv2);
|
|
t->vertexUV(x + wnx, bot, z + wnz, uu1, vv2);
|
|
t->vertexUV(x + wnx, top, z + wnz, uu1, vv1);
|
|
|
|
t->end();
|
|
}
|
|
|
|
glEnable(GL_LIGHTING);
|
|
glEnable(GL_TEXTURE_2D);
|
|
|
|
glDepthMask(true);
|
|
|
|
yb = sectionTop;
|
|
}
|
|
}
|
|
} |