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