mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-08 06:09:54 +03:00
* WIP C++03 + Xbox 360 Support * math.h & _USE_MATH_DEFINES on Level.hpp Updated Xenon vcxproj file for new file structure. * * Fix bad GUI scale setup. * * Gui: Use ratios instead of hardcoded sub-1 floating point values, to make the mechanism more clear. * Add Direct Connect Button and Screen (#30) * Add Direct Connect Button and Screen * Remove accidental extra build directories for wasm * Add DirectConnectScreen.cpp to the CMake * Use Hungarian coding style notation * * Fix errors caused by #30 * * Improve the Chat Screen * * Improve the DirectConnectScreen, among other things. * * Update the game title once again. * * Add build-wasm.bat. * * Add info about compiling for wasm * * Fix send to specific GUID actually broadcasting to everyone * * Add command manager. * * Add writeable configuration. * * Allow dynamic screen size change on windows * * Allow the same thing on the emscripten version. * WIP C++03 + Xbox 360 Support * Fixed a possible merging issue that broke RakNet? * Additional Xbox 360 compatability fixes --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com> Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com> Co-authored-by: ts <124226059+uniformization@users.noreply.github.com>
137 lines
2.7 KiB
C++
137 lines
2.7 KiB
C++
/********************************************************************
|
|
Minecraft: Pocket Edition - Decompilation Project
|
|
Copyright (C) 2023 iProgramInCpp
|
|
|
|
The following code is licensed under the BSD 1 clause license.
|
|
SPDX-License-Identifier: BSD-1-Clause
|
|
********************************************************************/
|
|
|
|
#include "RenderList.hpp"
|
|
#include "Tesselator.hpp"
|
|
|
|
#include <cstddef>
|
|
|
|
constexpr int C_MAX_RENDERS = 3072;
|
|
|
|
RenderList::RenderList()
|
|
{
|
|
m_posX = 0.0f;
|
|
m_posY = 0.0f;
|
|
m_posZ = 0.0f;
|
|
field_14 = 0;
|
|
field_18 = false;
|
|
field_19 = false;
|
|
field_1C = 0;
|
|
|
|
field_C = new int[C_MAX_RENDERS];
|
|
field_10 = new RenderChunk[C_MAX_RENDERS];
|
|
}
|
|
|
|
RenderList::~RenderList()
|
|
{
|
|
if (field_C)
|
|
delete[] field_C;
|
|
|
|
if (field_10)
|
|
delete[] field_10;
|
|
}
|
|
|
|
void RenderList::add(int x)
|
|
{
|
|
// @BUG: If too many chunks are rendered, this has the potential to overflow.
|
|
#ifndef ORIGINAL_CODE
|
|
if (field_14 == C_MAX_RENDERS)
|
|
{
|
|
render();
|
|
init(m_posX, m_posY, m_posZ);
|
|
field_1C = 0;
|
|
field_19 = false;
|
|
}
|
|
#endif
|
|
|
|
field_C[field_14] = x;
|
|
|
|
if (field_14 == C_MAX_RENDERS)
|
|
render();
|
|
}
|
|
|
|
void RenderList::addR(const RenderChunk& rc)
|
|
{
|
|
// @BUG: If too many chunks are rendered, this has the potential to overflow.
|
|
#ifndef ORIGINAL_CODE
|
|
if (field_14 == C_MAX_RENDERS)
|
|
{
|
|
render();
|
|
init(m_posX, m_posY, m_posZ);
|
|
field_1C = 0;
|
|
field_19 = false;
|
|
}
|
|
#endif
|
|
|
|
field_10[field_14] = rc;
|
|
}
|
|
|
|
void RenderList::clear()
|
|
{
|
|
field_18 = false;
|
|
field_19 = false;
|
|
}
|
|
|
|
void RenderList::init(float x, float y, float z)
|
|
{
|
|
m_posX = x;
|
|
m_posY = y;
|
|
m_posZ = z;
|
|
field_14 = 0;
|
|
field_18 = true;
|
|
}
|
|
|
|
void RenderList::render()
|
|
{
|
|
if (!field_18) return;
|
|
|
|
if (!field_19)
|
|
{
|
|
field_19 = true;
|
|
field_1C = field_14;
|
|
field_14 = 0;
|
|
}
|
|
|
|
if (field_14 < field_1C)
|
|
{
|
|
glPushMatrix();
|
|
glTranslatef(-m_posX, -m_posY, -m_posZ);
|
|
renderChunks();
|
|
glPopMatrix();
|
|
}
|
|
}
|
|
|
|
void RenderList::renderChunks()
|
|
{
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
glEnableClientState(GL_COLOR_ARRAY);
|
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
|
|
if (field_1C > 0)
|
|
{
|
|
for (int i = 0; i < field_1C; i++)
|
|
{
|
|
RenderChunk& chk = field_10[i];
|
|
glPushMatrix();
|
|
|
|
glTranslatef(chk.field_C, chk.field_10, chk.field_14);
|
|
xglBindBuffer(GL_ARRAY_BUFFER, chk.field_0);
|
|
glVertexPointer (3, GL_FLOAT, sizeof(Tesselator::Vertex), (void*)offsetof(Tesselator::Vertex, m_x));
|
|
glTexCoordPointer(2, GL_FLOAT, sizeof(Tesselator::Vertex), (void*)offsetof(Tesselator::Vertex, m_u));
|
|
glColorPointer (4, GL_UNSIGNED_BYTE, sizeof(Tesselator::Vertex), (void*)offsetof(Tesselator::Vertex, m_color));
|
|
glDrawArrays(GL_TRIANGLES, 0, chk.field_4);
|
|
|
|
glPopMatrix();
|
|
}
|
|
}
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
|
glDisableClientState(GL_COLOR_ARRAY);
|
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
}
|