Skip to content
Merged
Changes from all commits
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
32 changes: 6 additions & 26 deletions community/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def update_f3(self, delta_time):
visible_quad_count = sum(chunk.mesh_quad_count for chunk in self.world.visible_chunks)
self.f3.text = \
f"""
{round(pyglet.clock.get_fps())} FPS ({self.world.chunk_update_counter} Chunk Updates) {"inf" if not self.options.VSYNC else "vsync"}{"ao" if self.options.SMOOTH_LIGHTING else ""}
{round(1 / delta_time)} FPS ({self.world.chunk_update_counter} Chunk Updates) {"inf" if not self.options.VSYNC else "vsync"}{"ao" if self.options.SMOOTH_LIGHTING else ""}
C: {visible_chunk_count} / {chunk_count} pC: {self.world.pending_chunk_update_count} pU: {len(self.world.chunk_building_queue)} aB: {chunk_count}
Client Singleplayer @{round(delta_time * 1000)} ms tick {round(1 / delta_time)} TPS

Expand Down Expand Up @@ -230,36 +230,16 @@ def on_draw(self):

# Draw the F3 Debug screen
if self.show_f3:
self.draw_f3()
self.f3.draw()

# CPU - GPU Sync
if not self.options.SMOOTH_FPS:
self.fences.append(gl.glFenceSync(gl.GL_SYNC_GPU_COMMANDS_COMPLETE, 0))
# self.fences.append(gl.glFenceSync(gl.GL_SYNC_GPU_COMMANDS_COMPLETE, 0))
# Broken in pyglet 2; glFenceSync is missing
pass
else:
gl.glFinish()

def draw_f3(self):
"""Draws the f3 debug screen. Current uses the fixed-function pipeline since pyglet labels uses it"""
gl.glDisable(gl.GL_DEPTH_TEST)
gl.glUseProgram(0)
gl.glBindVertexArray(0)
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glPushMatrix()
gl.glLoadIdentity()

gl.glMatrixMode(gl.GL_PROJECTION)
gl.glPushMatrix()
gl.glLoadIdentity()
gl.glOrtho(0, self.width, 0, self.height, -1, 1)

self.f3.draw()

gl.glPopMatrix()

gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glPopMatrix()


# input functions

def on_resize(self, width, height):
Expand All @@ -279,7 +259,7 @@ def __init__(self):
self.window = Window(config = self.config, width = 852, height = 480, caption = "Minecraft clone", resizable = True, vsync = options.VSYNC)

def run(self):
pyglet.app.run()
pyglet.app.run(interval = 0)



Expand Down