mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-27 10:10:43 +00:00
Merge origin/dev into reapply/dev-on-upstream-202603082259 - auto-resolved conflicts preferring origin/dev
This commit is contained in:
@@ -385,7 +385,7 @@ void Chunk::rebuild()
|
||||
MemSect(0);
|
||||
glPushMatrix();
|
||||
glDepthMask(true); // 4J added
|
||||
t->useCompactVertices(true); // 4J added
|
||||
t->useCompactVertices(false); // 4J added
|
||||
translateToPos();
|
||||
float ss = 1.000001f;
|
||||
// 4J - have removed this scale as I don't think we should need it, and have now optimised the vertex
|
||||
@@ -704,7 +704,7 @@ void Chunk::rebuild_SPU()
|
||||
MemSect(0);
|
||||
glPushMatrix();
|
||||
glDepthMask(true); // 4J added
|
||||
t->useCompactVertices(true); // 4J added
|
||||
t->useCompactVertices(false); // 4J added
|
||||
translateToPos();
|
||||
float ss = 1.000001f;
|
||||
// 4J - have removed this scale as I don't think we should need it, and have now optimised the vertex
|
||||
|
||||
@@ -627,8 +627,13 @@ void GameRenderer::unZoomRegion()
|
||||
void GameRenderer::getFovAndAspect(float& fov, float& aspect, float a, bool applyEffects)
|
||||
{
|
||||
// 4J - split out aspect ratio and fov here so we can adjust for viewports - we might need to revisit these as
|
||||
// they are maybe be too generous for performance.
|
||||
aspect = mc->width / (float) mc->height;
|
||||
// avoid pixel streching, its UGLEYYY
|
||||
{
|
||||
int fbw = mc->width;
|
||||
int fbh = mc->height;
|
||||
RenderManager.GetFramebufferSize(fbw, fbh);
|
||||
aspect = fbw / (float) fbh;
|
||||
}
|
||||
fov = getFov(a, applyEffects);
|
||||
|
||||
if( ( mc->player->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP ) ||
|
||||
@@ -838,9 +843,8 @@ void GameRenderer::turnOnLightLayer(double alpha)
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
#endif
|
||||
// Linux/PC: TextureBindVertex is a no-op (no vertex texture unit on desktop GL2.1).
|
||||
// The glTexParameteri calls below MUST NOT execute — they would corrupt the currently
|
||||
// bound terrain atlas on GL_TEXTURE0, replacing GL_NEAREST with GL_LINEAR every frame.
|
||||
// update light texture
|
||||
// todo: check implementation of getLightTexture.
|
||||
RenderManager.TextureBindVertex(getLightTexture(mc->player->GetXboxPad(), mc->level));
|
||||
#if 0
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
@@ -1000,6 +1004,7 @@ int GameRenderer::getLightTexture(int iPad, Level *level)
|
||||
|
||||
void GameRenderer::render(float a, bool bFirst)
|
||||
{
|
||||
a = 1; // juiceydev made this amazing line of code
|
||||
if( _updateLightTexture && bFirst) updateLightTexture(a);
|
||||
if (Display::isActive())
|
||||
{
|
||||
@@ -1054,12 +1059,15 @@ void GameRenderer::render(float a, bool bFirst)
|
||||
if (mc->noRender) return;
|
||||
GameRenderer::anaglyph3d = mc->options->anaglyph3d;
|
||||
|
||||
glViewport(0, 0, mc->width, mc->height); // 4J - added
|
||||
{
|
||||
int fbw, fbh;
|
||||
RenderManager.GetFramebufferSize(fbw, fbh);
|
||||
glViewport(0, 0, fbw, fbh);
|
||||
ScreenSizeCalculator ssc(mc->options, mc->width, mc->height);
|
||||
int screenWidth = ssc.getWidth();
|
||||
int screenHeight = ssc.getHeight();
|
||||
int xMouse = Mouse::getX() * screenWidth / mc->width;
|
||||
int yMouse = screenHeight - Mouse::getY() * screenHeight / mc->height - 1;
|
||||
int xMouse = Mouse::getX() * screenWidth / fbw;
|
||||
int yMouse = screenHeight - Mouse::getY() * screenHeight / fbh - 1;
|
||||
|
||||
int maxFps = getFpsCap(mc->options->framerateLimit);
|
||||
|
||||
@@ -1084,7 +1092,11 @@ void GameRenderer::render(float a, bool bFirst)
|
||||
}
|
||||
else
|
||||
{
|
||||
glViewport(0, 0, mc->width, mc->height);
|
||||
{
|
||||
int fbw, fbh;
|
||||
RenderManager.GetFramebufferSize(fbw, fbh);
|
||||
glViewport(0, 0, fbw, fbh);
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@@ -1104,7 +1116,7 @@ void GameRenderer::render(float a, bool bFirst)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
void GameRenderer::renderLevel(float a)
|
||||
{
|
||||
renderLevel(a, 0);
|
||||
@@ -1292,7 +1304,11 @@ void GameRenderer::renderLevel(float a, __int64 until)
|
||||
}
|
||||
|
||||
|
||||
glViewport(0, 0, mc->width, mc->height);
|
||||
{
|
||||
int fbw, fbh;
|
||||
RenderManager.GetFramebufferSize(fbw, fbh);
|
||||
glViewport(0, 0, fbw, fbh);
|
||||
}
|
||||
setupClearColor(a);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_CULL_FACE);
|
||||
@@ -1788,6 +1804,8 @@ void GameRenderer::renderSnowAndRain(float a)
|
||||
// 4J - added forceScale parameter
|
||||
void GameRenderer::setupGuiScreen(int forceScale /*=-1*/)
|
||||
{
|
||||
int fbw, fbh;
|
||||
RenderManager.GetFramebufferSize(fbw, fbh);
|
||||
ScreenSizeCalculator ssc(mc->options, mc->width, mc->height, forceScale);
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -518,7 +518,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||
TileEntityRenderDispatcher::yOff = (player->yOld + (player->y - player->yOld) * a);
|
||||
TileEntityRenderDispatcher::zOff = (player->zOld + (player->z - player->zOld) * a);
|
||||
|
||||
mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
||||
// mc->gameRenderer->turnOnLightLayer(a); // 4J - brought forward from 1.8.2
|
||||
|
||||
std::vector<std::shared_ptr<Entity> > entities = level[playerIndex]->getAllEntities();
|
||||
totalEntities = (int)entities.size();
|
||||
@@ -600,7 +600,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a)
|
||||
|
||||
LeaveCriticalSection(&m_csRenderableTileEntities);
|
||||
|
||||
mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
||||
// mc->gameRenderer->turnOffLightLayer(a); // 4J - brought forward from 1.8.2
|
||||
}
|
||||
|
||||
std::wstring LevelRenderer::gatherStats1()
|
||||
@@ -710,6 +710,8 @@ int LevelRenderer::render(std::shared_ptr<Mob> player, int layer, double alpha,
|
||||
// sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(), DistanceChunkSorter(player)); // 4J - removed - not sorting our chunks anymore
|
||||
}
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
int count = renderChunks(0, (int)chunks[playerIndex].length, layer, alpha);
|
||||
|
||||
@@ -740,8 +742,8 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
||||
|
||||
#if 1
|
||||
// 4J - cut down version, we're not using offsetted render lists, or a sorted chunk list, anymore
|
||||
mc->gameRenderer->turnOnLightLayer(alpha); // 4J - brought forward from 1.8.2
|
||||
std::shared_ptr<Mob> player = mc->cameraTargetPlayer;
|
||||
// mc->gameRenderer->turnOnLightLayer(alpha); // 4J - brought forward from 1.8.2
|
||||
shared_ptr<Mob> player = mc->cameraTargetPlayer;
|
||||
double xOff = player->xOld + (player->x - player->xOld) * alpha;
|
||||
double yOff = player->yOld + (player->y - player->yOld) * alpha;
|
||||
double zOff = player->zOld + (player->z - player->zOld) * alpha;
|
||||
@@ -836,7 +838,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha)
|
||||
#endif // __PS3__
|
||||
|
||||
glPopMatrix();
|
||||
mc->gameRenderer->turnOffLightLayer(alpha); // 4J - brought forward from 1.8.2
|
||||
// mc->gameRenderer->turnOffLightLayer(alpha); // 4J - brought forward from 1.8.2
|
||||
|
||||
#else
|
||||
_renderChunks.clear();
|
||||
@@ -948,6 +950,7 @@ void LevelRenderer::renderSky(float alpha)
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
|
||||
glDepthMask(false);
|
||||
@@ -1020,6 +1023,7 @@ void LevelRenderer::renderSky(float alpha)
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
float *c = level[playerIndex]->dimension->getSunriseColor(level[playerIndex]->getTimeOfDay(alpha), alpha);
|
||||
if (c != NULL)
|
||||
@@ -2386,7 +2390,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev
|
||||
|
||||
dirtyChunksLockFreeStack.Push((int *)(index));
|
||||
#else
|
||||
dirtyChunksLockFreeStack.Push((int *)(intptr_t)(index + 2));
|
||||
dirtyChunksLockFreeStack.Push((int *)(intptr_t)(uintptr_t)(index + 2));
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
@@ -3246,9 +3250,12 @@ int LevelRenderer::getGlobalIndexForChunk(int x, int y, int z, Level *level)
|
||||
int LevelRenderer::getGlobalIndexForChunk(int x, int y, int z, int dimensionId)
|
||||
{
|
||||
int dimIdx = getDimensionIndexFromId(dimensionId);
|
||||
int xx = ( x / CHUNK_XZSIZE ) + ( MAX_LEVEL_RENDER_SIZE[dimIdx] / 2 );
|
||||
int yy = y / CHUNK_SIZE;
|
||||
int zz = ( z / CHUNK_XZSIZE ) + ( MAX_LEVEL_RENDER_SIZE[dimIdx] / 2 );
|
||||
//int xx = ( x / CHUNK_XZSIZE ) + ( MAX_LEVEL_RENDER_SIZE[dimIdx] / 2 );
|
||||
//int yy = y / CHUNK_SIZE;
|
||||
//int zz = ( z / CHUNK_XZSIZE ) + ( MAX_LEVEL_RENDER_SIZE[dimIdx] / 2 );
|
||||
int xx = ( Mth::intFloorDiv(x, CHUNK_XZSIZE)) + (MAX_LEVEL_RENDER_SIZE[dimIdx] / 2);
|
||||
int yy = Mth::intFloorDiv(y, CHUNK_SIZE);
|
||||
int zz = ( Mth::intFloorDiv(z, CHUNK_XZSIZE)) + (MAX_LEVEL_RENDER_SIZE[dimIdx] / 2);
|
||||
|
||||
if( ( xx < 0 ) || ( xx >= MAX_LEVEL_RENDER_SIZE[dimIdx] ) ) return -1;
|
||||
if( ( zz < 0 ) || ( zz >= MAX_LEVEL_RENDER_SIZE[dimIdx] ) ) return -1;
|
||||
@@ -3626,12 +3633,13 @@ int LevelRenderer::rebuildChunkThreadProc(LPVOID lpParam)
|
||||
IntCache::CreateNewThreadStorage();
|
||||
Tesselator::CreateNewThreadStorage(1024*1024);
|
||||
RenderManager.InitialiseContext();
|
||||
Chunk::CreateNewThreadStorage();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
||||
int index = (size_t)lpParam;
|
||||
|
||||
while(true)
|
||||
Chunk::CreateNewThreadStorage();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
||||
int index = (int)(uintptr_t)lpParam;
|
||||
|
||||
while(true)
|
||||
|
||||
{
|
||||
s_activationEventA[index]->WaitForSignal(INFINITE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user