Revert That, It Sucked
This commit is contained in:
parent
a8d0962491
commit
b339b53f42
@ -52,7 +52,6 @@
|
|||||||
* `Increase Render Chunk Size` (Enabled By Default)
|
* `Increase Render Chunk Size` (Enabled By Default)
|
||||||
* `Proper Entity Shading` (Enabled By Default)
|
* `Proper Entity Shading` (Enabled By Default)
|
||||||
* `Fix Sugar Position In Hand` (Enabled By Default)
|
* `Fix Sugar Position In Hand` (Enabled By Default)
|
||||||
* `Chunk OpenGL Occlusion Checking` (Disabled By Default)
|
|
||||||
* Existing Functionality (All Enabled By Default)
|
* Existing Functionality (All Enabled By Default)
|
||||||
* `Fix Screen Rendering When Hiding HUD`
|
* `Fix Screen Rendering When Hiding HUD`
|
||||||
* `Sanitize Usernames`
|
* `Sanitize Usernames`
|
||||||
|
@ -113,4 +113,3 @@ TRUE Render Vignette
|
|||||||
TRUE Increase Render Chunk Size
|
TRUE Increase Render Chunk Size
|
||||||
TRUE Proper Entity Shading
|
TRUE Proper Entity Shading
|
||||||
TRUE Fix Sugar Position In Hand
|
TRUE Fix Sugar Position In Hand
|
||||||
FALSE Chunk OpenGL Occlusion Checking
|
|
@ -501,63 +501,6 @@ static int safe_log2(const int x) {
|
|||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Occlusion Checking
|
|
||||||
static int num_occlusion_ids;
|
|
||||||
static GLuint *occlusion_ids;
|
|
||||||
static LevelRenderer *LevelRenderer_injection(LevelRenderer_constructor_t original, LevelRenderer *self, Minecraft *minecraft) {
|
|
||||||
// Call Original Method
|
|
||||||
original(self, minecraft);
|
|
||||||
// Setup
|
|
||||||
self->occlusion_check = true;
|
|
||||||
num_occlusion_ids = self->num_buffers / 3;
|
|
||||||
occlusion_ids = new GLuint[num_occlusion_ids];
|
|
||||||
media_glGenQueries(num_occlusion_ids, occlusion_ids);
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
static void LevelRenderer_allChanged_Chunk_setDirty_injection(Chunk *self) {
|
|
||||||
self->occlusion_id = int(occlusion_ids[self->id]);
|
|
||||||
// Call Original Method
|
|
||||||
self->setDirty();
|
|
||||||
}
|
|
||||||
static void check_query_result(Chunk *chunk) {
|
|
||||||
if (chunk->occlusion_querying) {
|
|
||||||
GLuint val;
|
|
||||||
media_glGetQueryObjectuiv(chunk->occlusion_id, GL_QUERY_RESULT_AVAILABLE, &val);
|
|
||||||
if (val != 0) {
|
|
||||||
chunk->occlusion_querying = false;
|
|
||||||
media_glGetQueryObjectuiv(chunk->occlusion_id, GL_QUERY_RESULT, &val);
|
|
||||||
chunk->occlusion_visible = val != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static int LevelRenderer_render_LevelRenderer_renderChunks_injection(LevelRenderer *self, const int start, const int end, const int a, const float b) {
|
|
||||||
for (int i = start; i < end; i++) {
|
|
||||||
Chunk *chunk = self->chunks[i];
|
|
||||||
check_query_result(chunk);
|
|
||||||
chunk->occlusion_visible = true;
|
|
||||||
}
|
|
||||||
// Call Original Method
|
|
||||||
return self->renderChunks(start, end, a, b);
|
|
||||||
}
|
|
||||||
static bool LevelRenderer_render_Chunk_isEmpty_injection(Chunk *self) {
|
|
||||||
check_query_result(self);
|
|
||||||
// Call Original Method
|
|
||||||
return self->isEmpty();
|
|
||||||
}
|
|
||||||
static void Chunk_renderBB_injection(__attribute__((unused)) Chunk_renderBB_t original, Chunk *self) {
|
|
||||||
media_glBeginQuery(GL_SAMPLES_PASSED, self->occlusion_id);
|
|
||||||
AABB aabb = {
|
|
||||||
.x1 = self->aabb.x1 - float(self->x),
|
|
||||||
.y1 = self->aabb.y1 - float(self->y),
|
|
||||||
.z1 = self->aabb.z1 - float(self->z),
|
|
||||||
.x2 = self->aabb.x2 - float(self->x),
|
|
||||||
.y2 = self->aabb.y2 - float(self->y),
|
|
||||||
.z2 = self->aabb.z2 - float(self->z)
|
|
||||||
};
|
|
||||||
EntityRenderer::renderFlat(aabb);
|
|
||||||
media_glEndQuery(GL_SAMPLES_PASSED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
void _init_misc_graphics() {
|
void _init_misc_graphics() {
|
||||||
// Disable V-Sync
|
// Disable V-Sync
|
||||||
@ -708,15 +651,6 @@ void _init_misc_graphics() {
|
|||||||
patch((void *) 0x4f20c, render_chunk_patch_seven);
|
patch((void *) 0x4f20c, render_chunk_patch_seven);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Occlusion Checking
|
|
||||||
if(feature_has("Chunk OpenGL Occlusion Checking", server_disabled)) {
|
|
||||||
overwrite_calls(LevelRenderer_constructor, LevelRenderer_injection);
|
|
||||||
overwrite_call((void *) 0x4fce4, (void *) LevelRenderer_allChanged_Chunk_setDirty_injection);
|
|
||||||
overwrite_call((void *) 0x4f8d4, (void *) LevelRenderer_render_LevelRenderer_renderChunks_injection);
|
|
||||||
overwrite_call((void *) 0x4f960, (void *) LevelRenderer_render_Chunk_isEmpty_injection);
|
|
||||||
overwrite_calls(Chunk_renderBB, Chunk_renderBB_injection);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't Render Game In Headless Mode
|
// Don't Render Game In Headless Mode
|
||||||
if (reborn_is_headless()) {
|
if (reborn_is_headless()) {
|
||||||
overwrite_calls(GameRenderer_render, nop<GameRenderer_render_t, GameRenderer *, float>);
|
overwrite_calls(GameRenderer_render, nop<GameRenderer_render_t, GameRenderer *, float>);
|
||||||
|
@ -100,7 +100,7 @@ static int LevelRenderer_renderChunks_injection(__attribute__((unused)) LevelRen
|
|||||||
for (int i = start; i < end; i++) {
|
for (int i = start; i < end; i++) {
|
||||||
Chunk *chunk = self->chunks[i];
|
Chunk *chunk = self->chunks[i];
|
||||||
// Check If Chunk Is Visible
|
// Check If Chunk Is Visible
|
||||||
if (!chunk->field_1c[a] && chunk->visible && (!self->occlusion_check || chunk->occlusion_visible)) {
|
if (!chunk->field_1c[a] && chunk->visible) {
|
||||||
const RenderChunk *render_chunk = chunk->getRenderChunk(a);
|
const RenderChunk *render_chunk = chunk->getRenderChunk(a);
|
||||||
// Get Data Block
|
// Get Data Block
|
||||||
const int chunk_id = int(render_chunk->buffer - MULTIDRAW_BASE);
|
const int chunk_id = int(render_chunk->buffer - MULTIDRAW_BASE);
|
||||||
|
Loading…
Reference in New Issue
Block a user