mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-25 16:54:00 +00:00
fix: restore entity lighting, use tesselated clouds for night-time lighting
This commit is contained in:
parent
8094590e8d
commit
98eea45bb7
|
|
@ -739,7 +739,7 @@ void GameRenderer::renderItemInHand(float a, int eye) {
|
|||
if (!localplayer->ThirdPersonView() &&
|
||||
!mc->cameraTargetPlayer->isSleeping()) {
|
||||
if (!mc->options->hideGui && !mc->gameMode->isCutScene()) {
|
||||
turnOnLightLayer(a);
|
||||
turnOnLightLayer(a, true);
|
||||
PIXBeginNamedEvent(0, "Item in hand render");
|
||||
itemInHandRenderer->render(a);
|
||||
PIXEndNamedEvent();
|
||||
|
|
@ -767,21 +767,29 @@ void GameRenderer::renderItemInHand(float a, int eye) {
|
|||
|
||||
// 4J - change brought forward from 1.8.2
|
||||
void GameRenderer::turnOffLightLayer(double alpha) { // 4J - TODO
|
||||
#if 0
|
||||
if (SharedConstants::TEXTURE_LIGHTING)
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
#endif
|
||||
// 4jcraft: manually handle this in order to ensure that the light layer is
|
||||
// turned off correctly
|
||||
#if 1
|
||||
if (SharedConstants::TEXTURE_LIGHTING) {
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
#else
|
||||
RenderManager.TextureBindVertex(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 4J - change brought forward from 1.8.2
|
||||
void GameRenderer::turnOnLightLayer(double alpha) { // 4J - TODO
|
||||
void GameRenderer::turnOnLightLayer(
|
||||
double alpha,
|
||||
bool scaleLight) { // 4jcraft: added scaleLight for entity lighting
|
||||
#if 0
|
||||
if (SharedConstants::TEXTURE_LIGHTING)
|
||||
{
|
||||
|
|
@ -812,7 +820,7 @@ void GameRenderer::turnOnLightLayer(double alpha) { // 4J - TODO
|
|||
// 4jcraft: update light texture
|
||||
// todo: check implementation of getLightTexture.
|
||||
RenderManager.TextureBindVertex(
|
||||
getLightTexture(mc->player->GetXboxPad(), mc->level));
|
||||
getLightTexture(mc->player->GetXboxPad(), mc->level), scaleLight);
|
||||
#if 0
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,10 @@ public:
|
|||
float blg;
|
||||
float blgt;
|
||||
void turnOffLightLayer(double alpha);
|
||||
void turnOnLightLayer(double alpha);
|
||||
void turnOnLightLayer(
|
||||
double alpha,
|
||||
bool scaleLight =
|
||||
false); // 4jcraft: added scaleLight for entity lighting
|
||||
|
||||
private:
|
||||
void tickLightTexture();
|
||||
|
|
|
|||
|
|
@ -560,7 +560,9 @@ void LevelRenderer::renderEntities(Vec3* cam, Culler* culler, float a) {
|
|||
TileEntityRenderDispatcher::zOff =
|
||||
(player->zOld + (player->z - player->zOld) * a);
|
||||
|
||||
mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
||||
// 4jcraft: we use scaleLight for entity lighting
|
||||
mc->gameRenderer->turnOnLightLayer(
|
||||
a, true); // 4J - brought forward from 1.8.2
|
||||
|
||||
std::vector<std::shared_ptr<Entity> > entities =
|
||||
level[playerIndex]->getAllEntities();
|
||||
|
|
@ -1689,7 +1691,7 @@ void LevelRenderer::renderAdvancedClouds(float alpha) {
|
|||
// geometry to get rid of seams. This is a huge amount more
|
||||
// quads to render, so now using command buffers to render each
|
||||
// section to cut CPU hit.
|
||||
#if 1
|
||||
#if 0
|
||||
float xx = (float)(xPos * D);
|
||||
float zz = (float)(zPos * D);
|
||||
float xp = xx - xoffs;
|
||||
|
|
|
|||
Loading…
Reference in a new issue