mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-27 03:37:10 +00:00
added bunch of todos, modified readme
This commit is contained in:
parent
0e13ac4955
commit
36166bfdae
|
|
@ -44,24 +44,11 @@ static bool s_mainThreadSet = false;
|
||||||
|
|
||||||
void C4JRender::Initialise()
|
void C4JRender::Initialise()
|
||||||
{
|
{
|
||||||
#if defined(__linux__) && (GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 4))
|
|
||||||
// If the session is a native Wayland session, tell GLFW to use the Wayland
|
|
||||||
// backend instead of falling back to XWayland. This enables proper cursor
|
|
||||||
// confine-and-hide (zwp_confined_pointer_v1 + zwp_relative_pointer_v1) which
|
|
||||||
// is required for correct first-person mouse input on Wayland compositors.
|
|
||||||
if (getenv("WAYLAND_DISPLAY")) {
|
|
||||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
|
|
||||||
fprintf(stderr, "[4J_Render] Wayland session detected — requesting native Wayland backend\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
fprintf(stderr, "[4J_Render] Failed to initialise GLFW\n");
|
fprintf(stderr, "[4J_Render] Failed to initialise GLFW\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// todo: make resolution work
|
||||||
// Resolve window dimensions: use caller-requested size, or fall back to
|
|
||||||
// the primary monitor's native resolution so the window fits any display.
|
|
||||||
GLFWmonitor *primaryMonitor = glfwGetPrimaryMonitor();
|
GLFWmonitor *primaryMonitor = glfwGetPrimaryMonitor();
|
||||||
const GLFWvidmode *mode = primaryMonitor ? glfwGetVideoMode(primaryMonitor) : nullptr;
|
const GLFWvidmode *mode = primaryMonitor ? glfwGetVideoMode(primaryMonitor) : nullptr;
|
||||||
|
|
||||||
|
|
@ -304,9 +291,7 @@ void C4JRender::DrawVertices(ePrimitiveType PrimitiveType, int count,
|
||||||
GLenum mode = mapPrimType((int)PrimitiveType);
|
GLenum mode = mapPrimType((int)PrimitiveType);
|
||||||
|
|
||||||
if (vType == VERTEX_TYPE_COMPRESSED) {
|
if (vType == VERTEX_TYPE_COMPRESSED) {
|
||||||
// Compact terrain vertex: 8 × int16_t = 16 bytes per vertex
|
// NO NEED TO REWRITE IT ALL YAY
|
||||||
// Layout: [x*1024, y*1024, z*1024, RGB565-32768, u*8192, v*8192, tex2u, tex2v]
|
|
||||||
// Always use glBegin/glEnd — works correctly both inside and outside display lists.
|
|
||||||
int16_t *sdata = (int16_t *)dataIn;
|
int16_t *sdata = (int16_t *)dataIn;
|
||||||
::glBegin(mode);
|
::glBegin(mode);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
|
|
||||||
|
|
@ -101,9 +101,9 @@ UIBitmapFont::UIBitmapFont( SFontData &sfontdata )
|
||||||
|
|
||||||
if (bimgData == nullptr)
|
if (bimgData == nullptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[UIBitmapFont] ERROR: failed to load font image for '%s' — font file missing or corrupt.\n",
|
fprintf(stderr, "[UIBitmapFont] ERROR: failed to load font image for '%s' is font included?\n",
|
||||||
sfontdata.m_strFontName.c_str());
|
sfontdata.m_strFontName.c_str());
|
||||||
m_cFontData = new CFontData(); // default/empty — avoids null deref downstream
|
m_cFontData = new CFontData(); // todo: make font work
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -838,9 +838,8 @@ void GameRenderer::turnOnLightLayer(double alpha)
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Linux/PC: TextureBindVertex is a no-op (no vertex texture unit on desktop GL2.1).
|
// update light texture
|
||||||
// The glTexParameteri calls below MUST NOT execute — they would corrupt the currently
|
// todo: check implementation of getLightTexture.
|
||||||
// bound terrain atlas on GL_TEXTURE0, replacing GL_NEAREST with GL_LINEAR every frame.
|
|
||||||
RenderManager.TextureBindVertex(getLightTexture(mc->player->GetXboxPad(), mc->level));
|
RenderManager.TextureBindVertex(getLightTexture(mc->player->GetXboxPad(), mc->level));
|
||||||
#if 0
|
#if 0
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ If you are on wayland, you may swap `glfw-x11` to `glfw-wayland` for native wayl
|
||||||
|
|
||||||
On Docker:
|
On Docker:
|
||||||
|
|
||||||
If you don't want to deal with installing dependencies, you can use the included devcontainer. Open the project in VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension and it will set everything up for you — GCC 15, Meson, Ninja, lld, and all the libraries.
|
If you don't want to deal with installing dependencies, you can use the included devcontainer. Open the project in VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension and it will set everything up for you - GCC 15, Meson, Ninja, lld, and all the libraries.
|
||||||
|
|
||||||
Alternatively, you can build and use the container manually:
|
Alternatively, you can build and use the container manually:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue