Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Big CMake + MinGW + Sound PR #127

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rendering Bugfixes
 * Re-enabled lighting & normals that were disabled due to merge
 * Re-added smooth outline rendering as fallback
 * Fixed OpenGL reference in CMake files
  • Loading branch information
BrentDaMage committed Mar 6, 2025
commit f4e028acdb0e4351cca8b9822993390523910187
2 changes: 1 addition & 1 deletion platforms/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if(USE_GLES1_COMPATIBILITY_LAYER)
endif()
else()
find_package(OpenGL REQUIRED)
target_link_libraries(reminecraftpe-core PUBLIC OpenGL::OpenGL)
target_link_libraries(reminecraftpe-core PUBLIC OpenGL::GL)
endif()

# WASM
Expand Down
2 changes: 1 addition & 1 deletion source/client/app/NinecraftApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void NinecraftApp::initGLStates()
glCullFace(GL_BACK);
glEnable(GL_TEXTURE_2D);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
//glDisable(GL_LIGHTING);
glDisable(GL_LIGHTING);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}

Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/components/RolledSelectionList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void RolledSelectionList::render(int mouseX, int mouseY, float f)

capXPosition();

//glDisable(GL_LIGHTING);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);

m_pMinecraft->m_pTextures->loadAndBindTexture("gui/background.png");
Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/components/ScrolledSelectionList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void ScrolledSelectionList::render(int mouseX, int mouseY, float f)
field_38 *= 0.75f;
capYPosition();

//glDisable(GL_LIGHTING);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);

m_pMinecraft->m_pTextures->loadAndBindTexture("gui/background.png");
Expand Down
2 changes: 1 addition & 1 deletion source/client/renderer/GameRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void GameRenderer::setupFog(int i)
fog_color[3] = 1.0f;

glFogfv(GL_FOG_COLOR, fog_color);
//glNormal3f(0.0f, -1.0f, 0.0f);
glNormal3f(0.0f, -1.0f, 0.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

if (m_pMinecraft->m_pMobPersp->isUnderLiquid(Material::water))
Expand Down
4 changes: 2 additions & 2 deletions source/client/renderer/ItemInHandRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void ItemInHandRenderer::render(float f)
glTranslatef(-0.3f * Mth::sin(float(M_PI) * Mth::sqrt(fAnim)), 0.4f * Mth::sin(2.0f * float(M_PI) * Mth::sqrt(fAnim)), -0.4f * Mth::sin(float(M_PI) * fAnim));
glTranslatef(0.64f, ((1.0f - h) * -0.6f) - 0.6f, -0.72f);
glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
//glEnable(GL_RESCALE_NORMAL);
glEnable(GL_RESCALE_NORMAL);

// @HUH: refetch
fAnim = pLP->getAttackAnim(f);
Expand Down Expand Up @@ -229,7 +229,7 @@ void ItemInHandRenderer::render(float f)
glTranslatef(-0.4f * Mth::sin(float(M_PI) * Mth::sqrt(fAnim)), 0.2f * Mth::sin(2.0f * float(M_PI) * Mth::sqrt(fAnim)), -0.2f * Mth::sin(float(M_PI) * fAnim));
glTranslatef(0.56f, ((1.0f - h) * -0.6f) - 0.52f, -0.72f);
glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
//glEnable(GL_RESCALE_NORMAL);
glEnable(GL_RESCALE_NORMAL);

// @HUH: refetch
fAnim = pLP->getAttackAnim(f);
Expand Down
10 changes: 9 additions & 1 deletion source/client/renderer/LevelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void LevelRenderer::render(Mob* pMob, int a, float b)
c = m_chunksLength;

glDisable(GL_TEXTURE_2D);
//glDisable(GL_LIGHTING);
glDisable(GL_LIGHTING);
glDisable(GL_ALPHA_TEST);
glDisable(GL_FOG);
glColorMask(false, false, false, false);
Expand Down Expand Up @@ -907,7 +907,12 @@ void LevelRenderer::renderHitOutline(Player* pPlayer, const HitResult& hr, int i
float line_width = 1.5f / Gui::InvGuiScale;
// Clamp Line Width
float range[2];
#ifdef GL_ALIASED_LINE_WIDTH_RANGE
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
#else
glEnable(GL_LINE_SMOOTH);
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, range);
#endif
if (range[1] < line_width)
{
line_width = range[1];
Expand Down Expand Up @@ -938,6 +943,9 @@ void LevelRenderer::renderHitOutline(Player* pPlayer, const HitResult& hr, int i
render(aabb);
}

#ifndef GL_ALIASED_LINE_WIDTH_RANGE
glDisable(GL_LINE_SMOOTH);
#endif
glDepthMask(true);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
Expand Down
4 changes: 2 additions & 2 deletions source/client/renderer/entity/ItemRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void ItemRenderer::render(Entity* pEntity, float x, float y, float z, float a, f
itemsToRender = 4;

glTranslatef(x, y + 0.1f + yOffset * 0.1f, z);
//glEnable(GL_RESCALE_NORMAL);
glEnable(GL_RESCALE_NORMAL);

int itemID = pItemInstance->m_itemID;
if (itemID < C_MAX_TILES && TileRenderer::canRender(Tile::tiles[itemID]->getRenderShape()))
Expand Down Expand Up @@ -123,7 +123,7 @@ void ItemRenderer::render(Entity* pEntity, float x, float y, float z, float a, f
}
}

//glDisable(GL_RESCALE_NORMAL);
glDisable(GL_RESCALE_NORMAL);
glPopMatrix();
}

Expand Down
4 changes: 2 additions & 2 deletions source/client/renderer/entity/ItemSpriteRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void ItemSpriteRenderer::render(Entity* pEntity, float x, float y, float z, floa
{
glPushMatrix();
glTranslatef(x, y, z);
//glEnable(GL_RESCALE_NORMAL);
glEnable(GL_RESCALE_NORMAL);
glScalef(0.5f, 0.5f, 0.5f);
bindTexture(C_ITEMS_NAME);

Expand All @@ -32,6 +32,6 @@ void ItemSpriteRenderer::render(Entity* pEntity, float x, float y, float z, floa
t.vertexUV(-0.5f, +0.75f, 0.0f, float(16 * (m_sprite % 16)) / 256.0f, float(16 * (m_sprite / 16)) / 256.0f);
t.draw();

//glDisable(GL_RESCALE_NORMAL);
glDisable(GL_RESCALE_NORMAL);
glPopMatrix();
}
2 changes: 1 addition & 1 deletion source/client/renderer/entity/MobRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& str, float x, float

glPushMatrix();
glTranslatef(x + 0.0f, y + 2.3f, z);
//glNormal3f(0.0f, 1.0f, 0.0f);
glNormal3f(0.0f, 1.0f, 0.0f);
// billboard the name towards the camera
glRotatef(-m_pDispatcher->m_rot.x, 0.0f, 1.0f, 0.0f);
glRotatef(+m_pDispatcher->m_rot.y, 1.0f, 0.0f, 0.0f);
Expand Down
Loading