diff --git a/community/README.md b/community/README.md index 6358b087..879dced6 100644 --- a/community/README.md +++ b/community/README.md @@ -1,28 +1 @@ -# Community - -*TODO* It would be cool to make a video to showcase community at some point and link it here! - -The `community` directory is for experiments & contributions made by other people on the latest tutorial's code (see PR [#29](https://github.com/obiwac/python-minecraft-clone/pull/29)). -It more generally extends the project with functionality I've yet to cover in a tutorial or that I don't intend on covering at all. - -Anyone (you included!) is more than welcome to open a PR to add their own contribution, be it a bug fix, a new build in the world save, or a new feature entirely! - -Characteristic contributions are contributions which add something to the code -- bugfixes will get merged to the source of all episodes if relevant to them. - -The community has several features and options that can be toggled in `src/options.py`: - -- Render Distance: At what distance (in chunks) should chunks stop being rendered -- FOV: Camera field of view - -- Indirect Rendering: Alternative way of rendering that has less overhead but is only supported on devices supporting OpenGL 4.2 -- Advanced OpenGL: Rudimentary occlusion culling using hardware occlusion queries, however it is not performant and will cause pipeline stalls and decrease performance on most hardware - mostly for testing if it improves framerate -- Chunk Updates: Chunk updates per chunk every tick - 1 gives the best performance and best framerate, however, as Python is an slow language, 1 may increase chunk building time by an ludicrous amount -- Vsync: Vertical sync, may yield smoother framerate but bigger frame times and input lag -- Max CPU Ahead frames: Number of frames that the CPU can go ahead of a frame before syncing with the GPU by waiting for it to complete the execution of the command buffer, using `glClientWaitSync()` -- Smooth FPS: Legacy CPU/GPU sync by forcing the flushing and completion of command buffer using `glFinish()`, not recommended - similar to setting Max CPU Ahead Frames to 0. Mostly for testing whether it makes any difference with `glClientWaitSync()` - -- Smooth lighting: Smoothes the light of each vertex to achieve a linear interpolation of light on each fragment, hence creating a smoother light effect - it also adds ambient occlusion, to simulate light blocked by opaque objects (chunk update/build time will be severely affected by this feature) -- Fancy translucency: Better translucency blending, avoid weird looking artefacts - disable on low-end hardware -- Mipmap (minification filtering): Texture filtering used on higher distances. Default is `GL_NEAREST` (no filtering) (more info in `options.py`) -- Colored lighting: Uses an alternative shader program to achieve a more colored lighting; it aims to look similar to Beta 1.8+ (no performance loss should be incurred) -- Antialiasing: Experimental feature +In this branch, I have added perlin noise to generate hills, lakes, caves, ores, etc. diff --git a/community/audio/README.md b/community/audio/README.md deleted file mode 100644 index 8bb7b880..00000000 --- a/community/audio/README.md +++ /dev/null @@ -1 +0,0 @@ -For music download `.ogg` (or other) from [archive.org](https://archive.org/details/C418-MinecraftSoundtrackVolumeAlpha/) and put them into the music `dir`. diff --git a/community/src/renderer/block_type.py b/community/block_type.py similarity index 53% rename from community/src/renderer/block_type.py rename to community/block_type.py index 150eab10..604c50c5 100644 --- a/community/src/renderer/block_type.py +++ b/community/block_type.py @@ -1,43 +1,30 @@ -from typing import Any -from src.physics.collider import Collider -import models.cube # default model +import models.cube # default model - -class BlockType: +class Block_type: # new optional model argument (cube model by default) - def __init__( - self, texture_manager, name="unknown", block_face_textures={"all": "cobblestone"}, model: Any = models.cube - ): + def __init__(self, texture_manager, name = "unknown", block_face_textures = {"all": "cobblestone"}, model = models.cube, transparent = False): self.name = name - self.block_face_textures = block_face_textures - self.model = model # create members based on model attributes - self.transparent = model.transparent + self.transparent = transparent self.is_cube = model.is_cube - self.glass = model.glass - self.translucent = model.translucent - - # create colliders - - self.colliders = [] - - for collider in model.colliders: - self.colliders.append(Collider(*collider)) # replace data contained in numbers.py with model specific data self.vertex_positions = model.vertex_positions - self.tex_coords = model.tex_coords # to deprecate - self.tex_indices = [0] * len(self.tex_coords) + self.tex_coords = model.tex_coords.copy() self.shading_values = model.shading_values def set_block_face(face, texture): - # make sure we don't add nonexistent face + # make sure we don't add inexistent faces if face > len(self.tex_coords) - 1: return - self.tex_indices[face] = texture + + self.tex_coords[face] = self.tex_coords[face].copy() + + for vertex in range(4): + self.tex_coords[face][vertex * 3 + 2] = texture for face in block_face_textures: texture = block_face_textures[face] @@ -46,26 +33,18 @@ def set_block_face(face, texture): texture_index = texture_manager.textures.index(texture) if face == "all": - for i in range(len(self.tex_coords)): - set_block_face(i, texture_index) - - elif face == "sides": set_block_face(0, texture_index) set_block_face(1, texture_index) + set_block_face(2, texture_index) + set_block_face(3, texture_index) set_block_face(4, texture_index) set_block_face(5, texture_index) - - elif face == "x": + + elif face == "sides": set_block_face(0, texture_index) set_block_face(1, texture_index) - - elif face == "y": - set_block_face(2, texture_index) - set_block_face(3, texture_index) - - elif face == "z": set_block_face(4, texture_index) set_block_face(5, texture_index) - + else: - set_block_face(["right", "left", "top", "bottom", "front", "back"].index(face), texture_index) + set_block_face(["right", "left", "top", "bottom", "front", "back"].index(face), texture_index) \ No newline at end of file diff --git a/community/camera.py b/community/camera.py new file mode 100644 index 00000000..478fd528 --- /dev/null +++ b/community/camera.py @@ -0,0 +1,116 @@ +import math +import matrix + +class Camera: + def __init__(self, shader, width, height): + # Existing attributes + self.width = width + self.height = height + self.mv_matrix = matrix.Matrix() + self.p_matrix = matrix.Matrix() + self.shader = shader + self.shader_matrix_location = self.shader.find_uniform(b"matrix") + self.input = [0, 0, 0] + self.position = [0, 81.5, 0] + self.rotation = [-math.tau / 4, 0] + + # New attribute for vertical velocity + self.velocity_y = 0.0 + self.is_jumping = False # To check if the player is in the middle of a jump + + + def round_position(self, position): + return [round(coord) for coord in position] + + def update_camera(self, delta_time, sprinting, world, flying): + base_speed = 8 + sprint_multiplier = 2.0 if sprinting else 1.0 + multiplier = base_speed * sprint_multiplier * delta_time + + gravity = -20.0 * delta_time + + # Calculate movement vector for all directions (X, Y, Z) + movement_vector = [0, 0, 0] + + if flying: + movement_vector[1] = self.input[1] * multiplier + self.velocity_y = 0 # Reset vertical velocity when flying + self.is_jumping = False + else: + if self.is_jumping: + # Apply velocity to the Y-axis during the jump + movement_vector[1] = self.velocity_y + self.velocity_y = -gravity # Apply gravity to velocity + + # Stop the jump if the player reaches the max height or hits an obstacle + if self.velocity_y <= 0 or not self.check_collision(world, [self.position[0], self.position[1] + movement_vector[1], self.position[2]]): + self.is_jumping = False + self.velocity_y = gravity + else: + movement_vector[1] = gravity + + # XZ-Axis Movement (left/right/forward/backward) + if self.input[0] != 0 or self.input[2] != 0: + angle = self.rotation[0] - math.atan2(self.input[2], self.input[0]) + math.tau / 4 + movement_vector[0] = math.cos(angle) * multiplier + movement_vector[2] = math.sin(angle) * multiplier + + # Calculate the next position + next_position = [ + self.position[0] + movement_vector[0], + self.position[1] + movement_vector[1], + self.position[2] + movement_vector[2], + ] + + # Check for collisions along each axis separately + if self.check_collision(world, [next_position[0], self.position[1], self.position[2]]): + self.position[0] = next_position[0] + + if self.check_collision(world, [self.position[0], next_position[1], self.position[2]]): + self.position[1] = next_position[1] + else: + if movement_vector[1] < 0: + self.velocity_y = 0 + self.is_jumping = False + + if self.check_collision(world, [self.position[0], self.position[1], next_position[2]]): + self.position[2] = next_position[2] + + + + def check_collision(self, world, position): + # Player's bounding box is 1x1x2 blocks, centered on the player's position. + x, y, z = position + corners_to_check = [ + (x - 0.5, y - 1.5, z - 0.5), # bottom block, front left + (x + 0.5, y - 1.5, z - 0.5), # bottom block, front right + (x - 0.5, y - 1.5, z + 0.5), # bottom block, back left + (x + 0.5, y - 1.5, z + 0.5), # bottom block, back right + + (x - 0.5, y - 0.5, z - 0.5), # top block, front left + (x + 0.5, y - 0.5, z - 0.5), # top block, front right + (x - 0.5, y - 0.5, z + 0.5), # top block, back left + (x + 0.5, y - 0.5, z + 0.5), # top block, back right + ] + + for corner in corners_to_check: + if world.get_block_number(self.round_position(corner)) != 0: + return False + return True + + + + + def update_matrices(self): + # create projection matrix + self.p_matrix.load_identity() + self.p_matrix.perspective(90, float(self.width) / self.height, 0.1, 500) + + # create modelview matrix + self.mv_matrix.load_identity() + self.mv_matrix.rotate_2d(self.rotation[0] + math.tau / 4, self.rotation[1]) + self.mv_matrix.translate(-self.position[0], -self.position[1], -self.position[2]) + + # modelviewprojection matrix + mvp_matrix = self.mv_matrix * self.p_matrix + self.shader.uniform_matrix(self.shader_matrix_location, mvp_matrix) diff --git a/community/chunk.py b/community/chunk.py new file mode 100644 index 00000000..7a69542d --- /dev/null +++ b/community/chunk.py @@ -0,0 +1,192 @@ +import ctypes +import math + +import pyglet.gl as gl + +import subchunk + +CHUNK_WIDTH = 16 +CHUNK_HEIGHT = 128 +CHUNK_LENGTH = 16 + +class Chunk: + def __init__(self, world, chunk_position): + self.world = world + + self.chunk_position = chunk_position + + self.position = ( + self.chunk_position[0] * CHUNK_WIDTH, + self.chunk_position[1] * CHUNK_HEIGHT, + self.chunk_position[2] * CHUNK_LENGTH) + + self.blocks = [[[0 + for z in range(CHUNK_LENGTH)] + for y in range(CHUNK_HEIGHT)] + for x in range(CHUNK_WIDTH )] + + self.subchunks = {} + + for x in range(int(CHUNK_WIDTH / subchunk.SUBCHUNK_WIDTH)): + for y in range(int(CHUNK_HEIGHT / subchunk.SUBCHUNK_HEIGHT)): + for z in range(int(CHUNK_LENGTH / subchunk.SUBCHUNK_LENGTH)): + self.subchunks[(x, y, z)] = subchunk.Subchunk(self, (x, y, z)) + + # mesh variables + + self.mesh_vertex_positions = [] + self.mesh_tex_coords = [] + self.mesh_shading_values = [] + + self.mesh_index_counter = 0 + self.mesh_indices = [] + + self.mesh_indices_length = 0 + + # create vertex array object + + self.vao = gl.GLuint(0) + gl.glGenVertexArrays(1, self.vao) + gl.glBindVertexArray(self.vao) + + # create vertex position vbo + + self.vertex_position_vbo = gl.GLuint(0) + gl.glGenBuffers(1, self.vertex_position_vbo) + + # create tex coord vbo + + self.tex_coord_vbo = gl.GLuint(0) + gl.glGenBuffers(1, self.tex_coord_vbo) + + # create shading values vbo + + self.shading_values_vbo = gl.GLuint(0) + gl.glGenBuffers(1, self.shading_values_vbo) + + # create index buffer object + + self.ibo = gl.GLuint(0) + gl.glGenBuffers(1, self.ibo) + + def update_subchunk_meshes(self): + for subchunk_position in self.subchunks: + subchunk = self.subchunks[subchunk_position] + subchunk.update_mesh() + + # segfaults for some reason + # self.update_mesh() + + def update_at_position(self, position): + x, y, z = position + + lx = int(x % subchunk.SUBCHUNK_WIDTH ) + ly = int(y % subchunk.SUBCHUNK_HEIGHT) + lz = int(z % subchunk.SUBCHUNK_LENGTH) + + clx, cly, clz = self.world.get_local_position(position) + + sx = math.floor(clx / subchunk.SUBCHUNK_WIDTH ) + sy = math.floor(cly / subchunk.SUBCHUNK_HEIGHT) + sz = math.floor(clz / subchunk.SUBCHUNK_LENGTH) + + self.subchunks[(sx, sy, sz)].update_mesh() + + def try_update_subchunk_mesh(subchunk_position): + if subchunk_position in self.subchunks: + self.subchunks[subchunk_position].update_mesh() + + if lx == subchunk.SUBCHUNK_WIDTH - 1: try_update_subchunk_mesh((sx + 1, sy, sz)) + if lx == 0: try_update_subchunk_mesh((sx - 1, sy, sz)) + + if ly == subchunk.SUBCHUNK_HEIGHT - 1: try_update_subchunk_mesh((sx, sy + 1, sz)) + if ly == 0: try_update_subchunk_mesh((sx, sy - 1, sz)) + + if lz == subchunk.SUBCHUNK_LENGTH - 1: try_update_subchunk_mesh((sx, sy, sz + 1)) + if lz == 0: try_update_subchunk_mesh((sx, sy, sz - 1)) + + def update_mesh(self): + self.mesh_vertex_positions = [] + self.mesh_tex_coords = [] + self.mesh_shading_values = [] + + self.mesh_index_counter = 0 + self.mesh_indices = [] + + for subchunk_position in self.subchunks: + subchunk = self.subchunks[subchunk_position] + + self.mesh_vertex_positions.extend(subchunk.mesh_vertex_positions) + self.mesh_tex_coords.extend(subchunk.mesh_tex_coords) + self.mesh_shading_values.extend(subchunk.mesh_shading_values) + + # print("before", subchunk.mesh_indices, self.mesh_index_counter) + mesh_indices = [index + self.mesh_index_counter for index in subchunk.mesh_indices] + # print("after", subchunk.mesh_indices, self.mesh_index_counter) + + self.mesh_indices.extend(mesh_indices) + self.mesh_index_counter += subchunk.mesh_index_counter + + def send_mesh_data_to_gpu(self): + # it's important to set this *after* we're sure our data is being passed, so that our draw function isn't accidentally called + self.mesh_indices_length = len(self.mesh_indices) + + if not self.mesh_index_counter: + return + + gl.glBindVertexArray(self.vao) + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.vertex_position_vbo) + gl.glBufferData( + gl.GL_ARRAY_BUFFER, + ctypes.sizeof(gl.GLfloat * len(self.mesh_vertex_positions)), + (gl.GLfloat * len(self.mesh_vertex_positions)) (*self.mesh_vertex_positions), + gl.GL_STATIC_DRAW) + + gl.glVertexAttribPointer(0, 3, gl.GL_FLOAT, gl.GL_FALSE, 0, 0) + gl.glEnableVertexAttribArray(0) + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.tex_coord_vbo) + gl.glBufferData( + gl.GL_ARRAY_BUFFER, + ctypes.sizeof(gl.GLfloat * len(self.mesh_tex_coords)), + (gl.GLfloat * len(self.mesh_tex_coords)) (*self.mesh_tex_coords), + gl.GL_STATIC_DRAW) + + gl.glVertexAttribPointer(1, 3, gl.GL_FLOAT, gl.GL_FALSE, 0, 0) + gl.glEnableVertexAttribArray(1) + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.shading_values_vbo) + gl.glBufferData( + gl.GL_ARRAY_BUFFER, + ctypes.sizeof(gl.GLfloat * len(self.mesh_shading_values)), + (gl.GLfloat * len(self.mesh_shading_values)) (*self.mesh_shading_values), + gl.GL_STATIC_DRAW) + + gl.glVertexAttribPointer(2, 1, gl.GL_FLOAT, gl.GL_FALSE, 0, 0) + gl.glEnableVertexAttribArray(2) + + gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, self.ibo) + gl.glBufferData( + gl.GL_ELEMENT_ARRAY_BUFFER, + ctypes.sizeof(gl.GLuint * self.mesh_indices_length), + (gl.GLuint * len(self.mesh_indices)) (*self.mesh_indices), + gl.GL_STATIC_DRAW) + + del self.mesh_vertex_positions + del self.mesh_tex_coords + del self.mesh_shading_values + + del self.mesh_indices + + def draw(self): + if not self.mesh_indices_length: + return + + gl.glBindVertexArray(self.vao) + + gl.glDrawElements( + gl.GL_TRIANGLES, + self.mesh_indices_length, + gl.GL_UNSIGNED_INT, + None) \ No newline at end of file diff --git a/community/src/physics/collider.py b/community/collider.py similarity index 72% rename from community/src/physics/collider.py rename to community/collider.py index 75dbd8db..81f2aa89 100644 --- a/community/src/physics/collider.py +++ b/community/collider.py @@ -1,23 +1,26 @@ class Collider: - def __init__(self, pos1=(None,) * 3, pos2=(None,) * 3): + def __init__(self, pos1 = (None,) * 3, pos2 = (None,) * 3): # pos1: position of the collider vertex in the -X, -Y, -Z direction # pos2: position of the collider vertex in the +X, +Y, +Z direction self.x1, self.y1, self.z1 = pos1 self.x2, self.y2, self.z2 = pos2 - + def __add__(self, pos): x, y, z = pos - return Collider((self.x1 + x, self.y1 + y, self.z1 + z), (self.x2 + x, self.y2 + y, self.z2 + z)) - + return Collider( + (self.x1 + x, self.y1 + y, self.z1 + z), + (self.x2 + x, self.y2 + y, self.z2 + z) + ) + def __and__(self, collider): x = min(self.x2, collider.x2) - max(self.x1, collider.x1) y = min(self.y2, collider.y2) - max(self.y1, collider.y1) z = min(self.z2, collider.z2) - max(self.z1, collider.z1) return x > 0 and y > 0 and z > 0 - + def collide(self, collider, velocity): # self: the dynamic collider, which moves # collider: the static collider, which stays put @@ -28,17 +31,16 @@ def collide(self, collider, velocity): vx, vy, vz = velocity - def time(x, y): - return x / y if y else float("-" * (x > 0) + "inf") + time = lambda x, y: x / y if y else float('-' * (x > 0) + "inf") x_entry = time(collider.x1 - self.x2 if vx > 0 else collider.x2 - self.x1, vx) - x_exit = time(collider.x2 - self.x1 if vx > 0 else collider.x1 - self.x2, vx) + x_exit = time(collider.x2 - self.x1 if vx > 0 else collider.x1 - self.x2, vx) y_entry = time(collider.y1 - self.y2 if vy > 0 else collider.y2 - self.y1, vy) - y_exit = time(collider.y2 - self.y1 if vy > 0 else collider.y1 - self.y2, vy) + y_exit = time(collider.y2 - self.y1 if vy > 0 else collider.y1 - self.y2, vy) z_entry = time(collider.z1 - self.z2 if vz > 0 else collider.z2 - self.z1, vz) - z_exit = time(collider.z2 - self.z1 if vz > 0 else collider.z1 - self.z2, vz) + z_exit = time(collider.z2 - self.z1 if vz > 0 else collider.z1 - self.z2, vz) # make sure we actually got a collision @@ -47,19 +49,19 @@ def time(x, y): if x_entry > 1 or y_entry > 1 or z_entry > 1: return no_collision - + # on which axis did we collide first? entry = max(x_entry, y_entry, z_entry) - exit_ = min(x_exit, y_exit, z_exit) + exit_ = min(x_exit, y_exit, z_exit ) if entry > exit_: return no_collision - + # find normal of surface we collided with nx = (0, -1 if vx > 0 else 1)[entry == x_entry] ny = (0, -1 if vy > 0 else 1)[entry == y_entry] nz = (0, -1 if vz > 0 else 1)[entry == z_entry] - return entry, (nx, ny, nz) + return entry, (nx, ny, nz) \ No newline at end of file diff --git a/community/data/entities.mcpy b/community/data/entities.mcpy new file mode 100644 index 00000000..1f9176db --- /dev/null +++ b/community/data/entities.mcpy @@ -0,0 +1,7 @@ +Player: name "Player", width 0.6, height 1.8, model models.pig, texture pig +Pig: name "Pig", width 0.9, height 0.9, model models.pig, texture pig +Zombie: name "Zombie", width 0.6, height 1.95, model models.zombie, texture zombie +Skeleton: name "Skeleton", width 0.6, height 1.99, model models.skeleton, texture skeleton +Creeper: name "Creeper", width 0.6, height 1.7, model models.creeper, texture creeper +Cow: name "Cow", width 0.9, height 1.3, model models.cow, texture cow +Curry: name "Curry", width 0.9, height 1.8, model models.curry, texture curry diff --git a/community/frag.glsl b/community/frag.glsl new file mode 100644 index 00000000..46c3d2a2 --- /dev/null +++ b/community/frag.glsl @@ -0,0 +1,18 @@ +#version 330 + +out vec4 fragment_colour; + +uniform sampler2DArray texture_array_sampler; + +in vec3 local_position; +in vec3 interpolated_tex_coords; +in float interpolated_shading_value; + +void main(void) { + vec4 texture_colour = texture(texture_array_sampler, interpolated_tex_coords); + fragment_colour = texture_colour * interpolated_shading_value; + + if (texture_colour.a == 0.0) { // discard if texel's alpha component is 0 (texel is transparent) + discard; + } +} \ No newline at end of file diff --git a/community/hit.py b/community/hit.py new file mode 100644 index 00000000..716cfdea --- /dev/null +++ b/community/hit.py @@ -0,0 +1,73 @@ +import math + +HIT_RANGE = 3 + +class Hit_ray: + def __init__(self, world, rotation, starting_position): + self.world = world + + self.vector = ( + math.cos(rotation[0]) * math.cos(rotation[1]), + math.sin(rotation[1]), + math.sin(rotation[0]) * math.cos(rotation[1])) + + self.position = list(starting_position) + self.block = tuple(map(lambda x: int(round(x)), self.position)) + + self.distance = 0 + + def check(self, hit_callback, distance, current_block, next_block): + if self.world.get_block_number(next_block): + hit_callback(current_block, next_block) + return True + + self.position = list(map(lambda x: self.position[x] + self.vector[x] * distance, range(3))) + + self.block = next_block + self.distance += distance + + return False + + def step(self, hit_callback): + bx, by, bz = self.block + local_position = list(map(lambda x: self.position[x] - self.block[x], range(3))) + + sign = [1, 1, 1] # '1' for positive, '-1' for negative + absolute_vector = list(self.vector) + + for component in range(3): + if self.vector[component] < 0: + sign[component] = -1 + + absolute_vector[component] = -absolute_vector[component] + local_position[component] = -local_position[component] + + lx, ly, lz = local_position + vx, vy, vz = absolute_vector + + if vx: + x = 0.5 + y = (0.5 - lx) / vx * vy + ly + z = (0.5 - lx) / vx * vz + lz + + if y >= -0.5 and y <= 0.5 and z >= -0.5 and z <= 0.5: + distance = math.sqrt((x - lx) ** 2 + (y - ly) ** 2 + (z - lz) ** 2) + return self.check(hit_callback, distance, self.block, (bx + sign[0], by, bz)) + + if vy: + x = (0.5 - ly) / vy * vx + lx + y = 0.5 + z = (0.5 - ly) / vy * vz + lz + + if x >= -0.5 and x <= 0.5 and z >= -0.5 and z <= 0.5: + distance = math.sqrt((x - lx) ** 2 + (y - ly) ** 2 + (z - lz) ** 2) + return self.check(hit_callback, distance, self.block, (bx, by + sign[1], bz)) + + if vz: + x = (0.5 - lz) / vz * vx + lx + y = (0.5 - lz) / vz * vy + ly + z = 0.5 + + if x >= -0.5 and x <= 0.5 and y >= -0.5 and y <= 0.5: + distance = math.sqrt((x - lx) ** 2 + (y - ly) ** 2 + (z - lz) ** 2) + return self.check(hit_callback, distance, self.block, (bx, by, bz + sign[2])) \ No newline at end of file diff --git a/community/logs/1718132102.8883429.log b/community/logs/1718132102.8883429.log new file mode 100644 index 00000000..8653b30b --- /dev/null +++ b/community/logs/1718132102.8883429.log @@ -0,0 +1,7 @@ +[LOGS] +[2024-06-12 00:25:03,805] [MainProcess/MainThread/INFO] (main.py/__init__) System Info: Python: CPython 3.11.5 +System: AMD64 Windows 10 10.0.19045 +CPU: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel +Display: Intel(R) HD Graphics 620 +(4, 6) +[2024-06-12 00:25:03,805] [MainProcess/MainThread/INFO] (main.py/__init__) Creating Texture Array diff --git a/community/logs/1722522224.621931.log b/community/logs/1722522224.621931.log new file mode 100644 index 00000000..94cb6e76 --- /dev/null +++ b/community/logs/1722522224.621931.log @@ -0,0 +1,7 @@ +[LOGS] +[2024-08-01 19:53:46,072] [MainProcess/MainThread/INFO] (main.py/__init__) System Info: Python: CPython 3.12.4 +System: AMD64 Windows 10 10.0.19045 +CPU: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel +Display: Intel(R) HD Graphics 620 +(4, 6) +[2024-08-01 19:53:46,074] [MainProcess/MainThread/INFO] (main.py/__init__) Creating Texture Array diff --git a/community/logs/1722522264.0477836.log b/community/logs/1722522264.0477836.log new file mode 100644 index 00000000..5cef90ea --- /dev/null +++ b/community/logs/1722522264.0477836.log @@ -0,0 +1,7 @@ +[LOGS] +[2024-08-01 19:54:25,028] [MainProcess/MainThread/INFO] (main.py/__init__) System Info: Python: CPython 3.12.4 +System: AMD64 Windows 10 10.0.19045 +CPU: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel +Display: Intel(R) HD Graphics 620 +(4, 6) +[2024-08-01 19:54:25,035] [MainProcess/MainThread/INFO] (main.py/__init__) Creating Texture Array diff --git a/community/logs/1722678099.6825862.log b/community/logs/1722678099.6825862.log new file mode 100644 index 00000000..35a0a986 --- /dev/null +++ b/community/logs/1722678099.6825862.log @@ -0,0 +1,7 @@ +[LOGS] +[2024-08-03 15:11:43,187] [MainProcess/MainThread/INFO] (main.py/__init__) System Info: Python: CPython 3.12.4 +System: AMD64 Windows 10 10.0.19045 +CPU: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel +Display: Intel(R) HD Graphics 620 +(4, 6) +[2024-08-03 15:11:43,188] [MainProcess/MainThread/INFO] (main.py/__init__) Creating Texture Array diff --git a/community/main.py b/community/main.py index 90f8e4aa..681b9c76 100644 --- a/community/main.py +++ b/community/main.py @@ -1,114 +1,111 @@ -import platform +import sys +import math import ctypes -import logging -import random -import time -import os -from collections import deque - import pyglet -from src.music import MusicPlayer - pyglet.options["shadow_window"] = False pyglet.options["debug_gl"] = False -pyglet.options["search_local_libs"] = True -pyglet.options["audio"] = ("openal", "pulse", "directsound", "xaudio2", "silent") import pyglet.gl as gl -from src.renderer.shader import Shader -from src.renderer.texture_manager import TextureManager -from src.world import World -from src.entity.player import Player -from src.controllers.joystick import JoystickController -from src.controllers.keyboard_mouse import KeyboardMouseController - -import src.options as options - - -class InternalConfig: - def __init__(self, options): - self.RENDER_DISTANCE = options.RENDER_DISTANCE - self.FOV = options.FOV - self.INDIRECT_RENDERING = options.INDIRECT_RENDERING - self.ADVANCED_OPENGL = options.ADVANCED_OPENGL - self.CHUNK_UPDATES = options.CHUNK_UPDATES - self.VSYNC = options.VSYNC - self.MAX_CPU_AHEAD_FRAMES = options.MAX_CPU_AHEAD_FRAMES - self.SMOOTH_FPS = options.SMOOTH_FPS - self.SMOOTH_LIGHTING = options.SMOOTH_LIGHTING - self.FANCY_TRANSLUCENCY = options.FANCY_TRANSLUCENCY - self.MIPMAP_TYPE = options.MIPMAP_TYPE - self.COLORED_LIGHTING = options.COLORED_LIGHTING - self.ANTIALIASING = options.ANTIALIASING +import matrix +import shader +import camera + +import block_type +import texture_manager +import world + +import hit class Window(pyglet.window.Window): def __init__(self, **args): super().__init__(**args) - # Options - self.options = InternalConfig(options) - - if self.options.INDIRECT_RENDERING and not gl.gl_info.have_version(4, 2): - raise RuntimeError( - """Indirect Rendering is not supported on your hardware - This feature is only supported on OpenGL 4.2+, but your driver doesnt seem to support it, - Please disable "INDIRECT_RENDERING" in options.py""" - ) - - # F3 Debug Screen - - self.show_f3 = False - self.f3 = pyglet.text.Label( - "", - x=10, - y=self.height - 10, - font_size=16, - color=(255, 255, 255, 255), - width=self.width // 3, - multiline=True, - ) - self.system_info = f"""Python: {platform.python_implementation()} {platform.python_version()} -System: {platform.machine()} {platform.system()} {platform.release()} {platform.version()} -CPU: {platform.processor()} -Display: {gl.gl_info.get_renderer()} -{gl.gl_info.get_version()}""" - - logging.info(f"System Info: {self.system_info}") + # create world + + self.world = world.World() + # create shader - logging.info("Compiling Shaders") - if not self.options.COLORED_LIGHTING: - self.shader = Shader("shaders/alpha_lighting/vert.glsl", "shaders/alpha_lighting/frag.glsl") - else: - self.shader = Shader("shaders/colored_lighting/vert.glsl", "shaders/colored_lighting/frag.glsl") - self.shader_sampler_location = self.shader.find_uniform(b"u_TextureArraySampler") + self.shader = shader.Shader("vert.glsl", "frag.glsl") + self.shader_sampler_location = self.shader.find_uniform(b"texture_array_sampler") self.shader.use() - # create textures - logging.info("Creating Texture Array") - self.texture_manager = TextureManager(16, 16, 256) + # pyglet stuff - # create world + pyglet.clock.schedule_interval(self.update, 1.0 / 10000) + self.mouse_captured = False - self.world = World(self.shader, None, self.texture_manager, self.options) + # camera stuff + + self.camera = camera.Camera(self.shader, self.width, self.height) + + # other stuff + + sys.setswitchinterval(0.000000001) + self.holding = 7 + self.sprinting = False + self.flying = False + + self.time_of_day = 0.0 # Represents time of day, 0.0 to 1.0 where 0.0 is midnight and 0.5 is noon + self.cycle_speed = 0.01 # Speed of the day-night cycle + + # Define sky colors for different times of the day + self.sky_colors = { + 'midnight': (15/255, 15/255, 45/255, 1.0), + 'dawn': (135/255, 206/255, 250/255, 1.0), + 'noon': (135/255, 206/255, 250/255, 1.0), + 'dusk': (250/255, 128/255, 114/255, 1.0), + 'night': (25/255, 25/255, 112/255, 1.0) + } + + def interpolate_color(self, color1, color2, factor): + return tuple(c1 + (c2 - c1) * factor for c1, c2 in zip(color1, color2)) + + def update_sky_color(self): + if self.time_of_day < 0.25: + # Dawn + factor = self.time_of_day / 0.25 + color = self.interpolate_color(self.sky_colors['midnight'], self.sky_colors['dawn'], factor) + elif self.time_of_day < 0.5: + # Noon + factor = (self.time_of_day - 0.25) / 0.25 + color = self.interpolate_color(self.sky_colors['dawn'], self.sky_colors['noon'], factor) + elif self.time_of_day < 0.75: + # Dusk + factor = (self.time_of_day - 0.5) / 0.25 + color = self.interpolate_color(self.sky_colors['noon'], self.sky_colors['dusk'], factor) + else: + # Night to Midnight + factor = (self.time_of_day - 0.75) / 0.25 + color = self.interpolate_color(self.sky_colors['dusk'], self.sky_colors['night'], factor) - # player stuff + # Additional blending for smoother transition from night to midnight + if self.time_of_day > 0.99: + additional_factor = (self.time_of_day - 0.99) / 0.01 + color = self.interpolate_color(color, self.sky_colors['midnight'], additional_factor) - logging.info("Setting up player & camera") - self.player = Player(self.world, self.shader, self.width, self.height) - self.world.player = self.player + gl.glClearColor(*color) + + def update(self, delta_time): + if not self.mouse_captured: + self.camera.input = [0, 0, 0] - # pyglet stuff - pyglet.clock.schedule(self.player.update_interpolation) - pyglet.clock.schedule_interval(self.update, 1 / 60) - self.mouse_captured = False + self.camera.update_camera(delta_time, self.sprinting, self.world, self.flying) + - # misc stuff + + self.time_of_day += self.cycle_speed * delta_time + self.time_of_day %= 1.0 # Keep time_of_day in the range [0.0, 1.0] - self.holding = 50 + # Update the sky color + self.update_sky_color() + + def on_draw(self): + self.world.process_load_queue(self.camera.position) + self.camera.update_matrices() # bind textures @@ -116,189 +113,128 @@ def __init__(self, **args): gl.glBindTexture(gl.GL_TEXTURE_2D_ARRAY, self.world.texture_manager.texture_array) gl.glUniform1i(self.shader_sampler_location, 0) - # enable cool stuff + # draw stuff gl.glEnable(gl.GL_DEPTH_TEST) gl.glEnable(gl.GL_CULL_FACE) - gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) - - if self.options.ANTIALIASING: - gl.glEnable(gl.GL_MULTISAMPLE) - gl.glEnable(gl.GL_SAMPLE_ALPHA_TO_COVERAGE) - gl.glSampleCoverage(0.5, gl.GL_TRUE) - - # controls stuff - self.controls = [0, 0, 0] - - # joystick stuff - self.joystick_controller = JoystickController(self) - - # mouse and keyboard stuff - self.keyboard_mouse = KeyboardMouseController(self) - - # music stuff - logging.info("Loading audio") - try: - self.music = [ - pyglet.media.load(os.path.join("audio/music", file)) - for file in os.listdir("audio/music") - if os.path.isfile(os.path.join("audio/music", file)) - ] - except FileNotFoundError: - self.music = [] - - self.media_player = MusicPlayer() - self.media_player.volume = 0.5 - - if len(self.music) > 0: - self.media_player.queue(random.choice(self.music)) - self.media_player.play() - else: - self.media_player.standby = True - - # GPU command syncs - self.fences = deque() - - def toggle_fullscreen(self): - self.set_fullscreen(not self.fullscreen) - - def on_close(self): - logging.info("Deleting media player") - self.media_player.delete() - for fence in self.fences: - gl.glDeleteSync(fence) - - super().on_close() - - def update_f3(self, delta_time): - """Update the F3 debug screen content""" - - player_chunk_pos = self.world.get_chunk_position(self.player.position) - player_local_pos = self.world.get_local_position(self.player.position) - chunk_count = len(self.world.chunks) - visible_chunk_count = len(self.world.visible_chunks) - quad_count = sum(chunk.mesh_quad_count for chunk in self.world.chunks.values()) - visible_quad_count = sum(chunk.mesh_quad_count for chunk in self.world.visible_chunks) - self.f3.text = f""" -{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 - -XYZ: ( X: {round(self.player.position[0], 3)} / Y: {round(self.player.position[1], 3)} / Z: {round(self.player.position[2], 3)} ) -Block: {self.player.rounded_position[0]} {self.player.rounded_position[1]} {self.player.rounded_position[2]} -Chunk: {player_local_pos[0]} {player_local_pos[1]} {player_local_pos[2]} in {player_chunk_pos[0]} {player_chunk_pos[1]} {player_chunk_pos[2]} -Light: {max(self.world.get_light(self.player.rounded_position), self.world.get_skylight(self.player.rounded_position))} ({self.world.get_skylight(self.player.rounded_position)} sky, {self.world.get_light(self.player.rounded_position)} block) - -{self.system_info} - -Renderer: {"OpenGL 3.3 VAOs" if not self.options.INDIRECT_RENDERING else "OpenGL 4.0 VAOs Indirect"} {"Conditional" if self.options.ADVANCED_OPENGL else ""} -Buffers: {chunk_count} -Vertex Data: {round(quad_count * 28 * ctypes.sizeof(gl.GLfloat) / 1048576, 3)} MiB ({quad_count} Quads) -Visible Quads: {visible_quad_count} -Buffer Uploading: Direct (glBufferSubData) -""" - - def update(self, delta_time): - """Every tick""" - if self.show_f3: - self.update_f3(delta_time) - - if not self.media_player.source and len(self.music) > 0: - if not self.media_player.standby: - self.media_player.standby = True - self.media_player.next_time = round(time.time()) + random.randint(240, 360) - elif time.time() >= self.media_player.next_time: - self.media_player.standby = False - self.media_player.queue(random.choice(self.music)) - self.media_player.play() - - if not self.mouse_captured: - self.player.input = [0, 0, 0] - - self.joystick_controller.update_controller() - self.player.update(delta_time) - - self.world.tick(delta_time) - - def on_draw(self): - gl.glEnable(gl.GL_DEPTH_TEST) - self.shader.use() - self.player.update_matrices() - - while len(self.fences) > self.options.MAX_CPU_AHEAD_FRAMES: - fence = self.fences.popleft() - gl.glClientWaitSync(fence, gl.GL_SYNC_FLUSH_COMMANDS_BIT, 2147483647) - gl.glDeleteSync(fence) - self.clear() - self.world.prepare_rendering() self.world.draw() - # Draw the F3 Debug screen - if self.show_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)) - # Broken in pyglet 2; glFenceSync is missing - pass - else: - gl.glFinish() - + gl.glFinish() + # input functions def on_resize(self, width, height): - logging.info(f"Resize {width} * {height}") gl.glViewport(0, 0, width, height) - self.player.view_width = width - self.player.view_height = height - self.f3.y = self.height - 10 - self.f3.width = self.width // 3 - - -class Game: - def __init__(self): - self.config = gl.Config( - double_buffer=True, - major_version=3, - minor_version=3, - depth_size=16, - sample_buffers=bool(options.ANTIALIASING), - samples=options.ANTIALIASING, - ) - self.window = Window( - config=self.config, width=852, height=480, caption="Minecraft clone", resizable=True, vsync=options.VSYNC - ) - - def run(self): - pyglet.app.run(interval=0) + self.camera.width = width + self.camera.height = height + + def on_mouse_press(self, x, y, button, modifiers): + if not self.mouse_captured: + self.mouse_captured = True + self.set_exclusive_mouse(True) + + return + + def hit_callback(current_block, next_block): + if self.world.get_block_number(current_block) != 14 and 0 <= current_block[1] < 128: + if button == pyglet.window.mouse.RIGHT: + if self.camera.check_collision(self.world, self.camera.position): + self.world.set_block(current_block, self.holding) + elif button == pyglet.window.mouse.LEFT: self.world.set_block(next_block, 0) + elif button == pyglet.window.mouse.MIDDLE: self.holding = self.world.get_block_number(next_block) + + hit_ray = hit.Hit_ray(self.world, self.camera.rotation, self.camera.position) + + while hit_ray.distance < hit.HIT_RANGE: + if hit_ray.step(hit_callback): + break + + def on_mouse_motion(self, x, y, delta_x, delta_y): + if self.mouse_captured: + sensitivity = 0.004 + + self.camera.rotation[0] += delta_x * sensitivity + self.camera.rotation[1] += delta_y * sensitivity + + self.camera.rotation[1] = max(-math.tau / 4, min(math.tau / 4, self.camera.rotation[1])) + + def on_mouse_drag(self, x, y, delta_x, delta_y, buttons, modifiers): + self.on_mouse_motion(x, y, delta_x, delta_y) + + def on_key_press(self, key, modifiers): + if not self.mouse_captured: + return + + if key == pyglet.window.key.D: + self.camera.input[0] += 2 + elif key == pyglet.window.key.A: + self.camera.input[0] -= 2 + elif key == pyglet.window.key.W: + self.camera.input[2] += 2 + elif key == pyglet.window.key.S: + self.camera.input[2] -= 2 + elif key == pyglet.window.key.LCTRL and self.camera.input[2] > 0: + self.sprinting = True + elif key == pyglet.window.key.R: + self.camera.position = [0, 80, 0] + elif key == pyglet.window.key.F: + self.flying = not self.flying + + elif key == pyglet.window.key.SPACE: + if self.flying: + self.camera.input[1] += 2 # Stop ascending + else: + # Don't reset input[1] directly; let the gravity handle it + if self.camera.is_jumping: + self.camera.input[1] -= 1 # Prevent further jumping mid-air + + else: + self.camera.input[1] += 1 + self.camera.is_jumping = True + + + elif key == pyglet.window.key.LSHIFT: + if self.flying: + self.camera.input[1] -= 2 # Descend in flying mode + + elif key == pyglet.window.key.ESCAPE: + self.mouse_captured = False + self.set_exclusive_mouse(False) + + + def on_key_release(self, key, modifiers): + if not self.mouse_captured: + return + if key == pyglet.window.key.D: self.camera.input[0] -= 2 + elif key == pyglet.window.key.A: self.camera.input[0] += 2 + elif key == pyglet.window.key.W: self.camera.input[2] -= 2 + elif key == pyglet.window.key.S: self.camera.input[2] += 2 + elif key == pyglet.window.key.LCTRL: self.sprinting = False -def init_logger(): - log_folder = "logs/" - log_filename = f"{time.time()}.log" - log_path = os.path.join(log_folder, log_filename) + elif key == pyglet.window.key.SPACE: + if self.flying: + self.camera.input[1] -= 2 # Stop ascending + else: + self.camera.input[1] = 0 # Reset jump + self.camera.is_jumping = False - if not os.path.isdir(log_folder): - os.mkdir(log_folder) + elif key == pyglet.window.key.LSHIFT: + if self.flying: + self.camera.input[1] += 2 # Stop descending - with open(log_path, "x") as file: - file.write("[LOGS]\n") - logging.basicConfig( - level=logging.INFO, - filename=log_path, - format="[%(asctime)s] [%(processName)s/%(threadName)s/%(levelname)s] (%(module)s.py/%(funcName)s) %(message)s", - ) +class Game: + def __init__(self): + self.config = gl.Config(major_version = 3, depth_size = 16) + self.window = Window(config = self.config, width = 800, height = 600, caption = "Minecraft clone", resizable = True, vsync = False) + + def run(self): + pyglet.app.run() -def main(): - init_logger() +if __name__ == "__main__": game = Game() game.run() - - -if __name__ == "__main__": - main() diff --git a/community/matrix.py b/community/matrix.py new file mode 100644 index 00000000..538e7e12 --- /dev/null +++ b/community/matrix.py @@ -0,0 +1,156 @@ + +import copy +import ctypes +import math + +def copy_matrix(matrix): + return copy.deepcopy(matrix) # we need to use deepcopy since we're dealing with 2D arrays + +clean_matrix = [[0.0 for x in range(4)] for x in range(4)] +identity_matrix = copy_matrix(clean_matrix) + +identity_matrix[0][0] = 1.0 +identity_matrix[1][1] = 1.0 +identity_matrix[2][2] = 1.0 +identity_matrix[3][3] = 1.0 + +def multiply_matrices(x_matrix, y_matrix): + result_matrix = copy_matrix(clean_matrix) + + for i in range(4): + result_matrix[i][0] = \ + (x_matrix[i][0] * y_matrix[0][0]) + \ + (x_matrix[i][1] * y_matrix[1][0]) + \ + (x_matrix[i][2] * y_matrix[2][0]) + \ + (x_matrix[i][3] * y_matrix[3][0]) + + result_matrix[i][1] = \ + (x_matrix[i][0] * y_matrix[0][1]) + \ + (x_matrix[i][1] * y_matrix[1][1]) + \ + (x_matrix[i][2] * y_matrix[2][1]) + \ + (x_matrix[i][3] * y_matrix[3][1]) + + result_matrix[i][2] = \ + (x_matrix[i][0] * y_matrix[0][2]) + \ + (x_matrix[i][1] * y_matrix[1][2]) + \ + (x_matrix[i][2] * y_matrix[2][2]) + \ + (x_matrix[i][3] * y_matrix[3][2]) + + result_matrix[i][3] = \ + (x_matrix[i][0] * y_matrix[0][3]) + \ + (x_matrix[i][1] * y_matrix[1][3]) + \ + (x_matrix[i][2] * y_matrix[2][3]) + \ + (x_matrix[i][3] * y_matrix[3][3]) + + return result_matrix + +class Matrix: + def __init__(self, base = None): + if type(base) == Matrix: self.data = copy_matrix(base.data) + elif type(base) == list: self.data = copy_matrix(base) + else: self.data = copy_matrix(clean_matrix) + + def load_identity(self): + self.data = copy_matrix(identity_matrix) + + def __mul__(self, matrix): + return Matrix(multiply_matrices(self.data, matrix.data)) + + def __imul__(self, matrix): + self.data = multiply_matrices(self.data, matrix.data) + + def scale(self, x, y, z): + for i in range(4): self.data[0][i] *= scale_x + for i in range(4): self.data[1][i] *= scale_y + for i in range(4): self.data[2][i] *= scale_z + + def translate(self, x, y, z): + for i in range(4): + self.data[3][i] = self.data[3][i] + (self.data[0][i] * x + self.data[1][i] * y + self.data[2][i] * z) + + def rotate(self, angle, x, y, z): + magnitude = math.sqrt(x * x + y * y + z * z) + + x /= -magnitude + y /= -magnitude + z /= -magnitude + + sin_angle = math.sin(angle) + cos_angle = math.cos(angle) + one_minus_cos = 1.0 - cos_angle + + xx = x * x + yy = y * y + zz = z * z + + xy = x * y + yz = y * z + zx = z * x + + xs = x * sin_angle + ys = y * sin_angle + zs = z * sin_angle + + rotation_matrix = copy_matrix(clean_matrix) + + rotation_matrix[0][0] = (one_minus_cos * xx) + cos_angle + rotation_matrix[0][1] = (one_minus_cos * xy) - zs + rotation_matrix[0][2] = (one_minus_cos * zx) + ys + + rotation_matrix[1][0] = (one_minus_cos * xy) + zs + rotation_matrix[1][1] = (one_minus_cos * yy) + cos_angle + rotation_matrix[1][2] = (one_minus_cos * yz) - xs + + rotation_matrix[2][0] = (one_minus_cos * zx) - ys + rotation_matrix[2][1] = (one_minus_cos * yz) + xs + rotation_matrix[2][2] = (one_minus_cos * zz) + cos_angle + + rotation_matrix[3][3] = 1.0 + self.data = multiply_matrices(rotation_matrix, self.data) + + def rotate_2d(self, x, y): + self.rotate(x, 0, 1.0, 0) + self.rotate(-y, math.cos(x), 0, math.sin(x)) + + def frustum(self, left, right, bottom, top, near, far): + deltax = right - left + deltay = top - bottom + deltaz = far - near + + frustum_matrix = copy_matrix(clean_matrix) + + frustum_matrix[0][0] = 2 * near / deltax + frustum_matrix[1][1] = 2 * near / deltay + + frustum_matrix[2][0] = (right + left) / deltax + frustum_matrix[2][1] = (top + bottom) / deltay + frustum_matrix[2][2] = -(near + far) / deltaz + + frustum_matrix[2][3] = -1.0 + frustum_matrix[3][2] = -2 * near * far / deltaz + + self.data = multiply_matrices(frustum_matrix, self.data) + + def perspective(self, fovy, aspect, near, far): + frustum_y = math.tan(math.radians(fovy) / 2) + frustum_x = frustum_y * aspect + + self.frustum(-frustum_x * near, frustum_x * near, -frustum_y * near, frustum_y * near, near, far) + + def orthographic(self, left, right, bottom, top, near, far): + deltax = right - left + deltay = top - bottom + deltaz = far - near + + orthographic_matrix = copy_matrix(identity_matrix) + + orthographic_matrix[0][0] = 2.0 / deltax + orthographic_matrix[3][0] = -(right + left) / deltax + + orthographic_matrix[1][1] = 2.0 / deltay + orthographic_matrix[3][1] = -(top + bottom) / deltay + + orthographic_matrix[2][2] = 2.0 / deltax + orthographic_matrix[3][2] = -(near + far) / deltaz + + self.data = multiply_matrices(orthographic_matrix, self.data) diff --git a/community/models/__init__.py b/community/models/__init__.py index c7a74dac..472191d7 100644 --- a/community/models/__init__.py +++ b/community/models/__init__.py @@ -23,7 +23,12 @@ "snow", "cactus", "tinted_glass", + "pig", + "zombie", + "skeleton", + "creeper", + "cow", + "curry", ] -from . import cube from . import * diff --git a/community/models/__pycache__/button.cpython-311.pyc b/community/models/__pycache__/button.cpython-311.pyc new file mode 100644 index 00000000..3f07348c Binary files /dev/null and b/community/models/__pycache__/button.cpython-311.pyc differ diff --git a/community/models/__pycache__/button.cpython-312.pyc b/community/models/__pycache__/button.cpython-312.pyc new file mode 100644 index 00000000..6e7e4b82 Binary files /dev/null and b/community/models/__pycache__/button.cpython-312.pyc differ diff --git a/community/models/__pycache__/cactus.cpython-311.pyc b/community/models/__pycache__/cactus.cpython-311.pyc new file mode 100644 index 00000000..1ec39392 Binary files /dev/null and b/community/models/__pycache__/cactus.cpython-311.pyc differ diff --git a/community/models/__pycache__/cactus.cpython-312.pyc b/community/models/__pycache__/cactus.cpython-312.pyc new file mode 100644 index 00000000..9d1dc49d Binary files /dev/null and b/community/models/__pycache__/cactus.cpython-312.pyc differ diff --git a/community/models/__pycache__/cow.cpython-311.pyc b/community/models/__pycache__/cow.cpython-311.pyc new file mode 100644 index 00000000..ffeb0099 Binary files /dev/null and b/community/models/__pycache__/cow.cpython-311.pyc differ diff --git a/community/models/__pycache__/cow.cpython-312.pyc b/community/models/__pycache__/cow.cpython-312.pyc new file mode 100644 index 00000000..df23c4c2 Binary files /dev/null and b/community/models/__pycache__/cow.cpython-312.pyc differ diff --git a/community/models/__pycache__/creeper.cpython-311.pyc b/community/models/__pycache__/creeper.cpython-311.pyc new file mode 100644 index 00000000..7801d0be Binary files /dev/null and b/community/models/__pycache__/creeper.cpython-311.pyc differ diff --git a/community/models/__pycache__/creeper.cpython-312.pyc b/community/models/__pycache__/creeper.cpython-312.pyc new file mode 100644 index 00000000..c47a4d4e Binary files /dev/null and b/community/models/__pycache__/creeper.cpython-312.pyc differ diff --git a/community/models/__pycache__/crop.cpython-311.pyc b/community/models/__pycache__/crop.cpython-311.pyc new file mode 100644 index 00000000..fb42d035 Binary files /dev/null and b/community/models/__pycache__/crop.cpython-311.pyc differ diff --git a/community/models/__pycache__/crop.cpython-312.pyc b/community/models/__pycache__/crop.cpython-312.pyc new file mode 100644 index 00000000..7c79dba0 Binary files /dev/null and b/community/models/__pycache__/crop.cpython-312.pyc differ diff --git a/community/models/__pycache__/cube.cpython-311.pyc b/community/models/__pycache__/cube.cpython-311.pyc new file mode 100644 index 00000000..f84c8873 Binary files /dev/null and b/community/models/__pycache__/cube.cpython-311.pyc differ diff --git a/community/models/__pycache__/cube.cpython-312.pyc b/community/models/__pycache__/cube.cpython-312.pyc new file mode 100644 index 00000000..f901df8e Binary files /dev/null and b/community/models/__pycache__/cube.cpython-312.pyc differ diff --git a/community/models/__pycache__/curry.cpython-311.pyc b/community/models/__pycache__/curry.cpython-311.pyc new file mode 100644 index 00000000..b892f7c1 Binary files /dev/null and b/community/models/__pycache__/curry.cpython-311.pyc differ diff --git a/community/models/__pycache__/curry.cpython-312.pyc b/community/models/__pycache__/curry.cpython-312.pyc new file mode 100644 index 00000000..4c467f36 Binary files /dev/null and b/community/models/__pycache__/curry.cpython-312.pyc differ diff --git a/community/models/__pycache__/door.cpython-311.pyc b/community/models/__pycache__/door.cpython-311.pyc new file mode 100644 index 00000000..51ac2301 Binary files /dev/null and b/community/models/__pycache__/door.cpython-311.pyc differ diff --git a/community/models/__pycache__/door.cpython-312.pyc b/community/models/__pycache__/door.cpython-312.pyc new file mode 100644 index 00000000..493979c7 Binary files /dev/null and b/community/models/__pycache__/door.cpython-312.pyc differ diff --git a/community/models/__pycache__/fire.cpython-311.pyc b/community/models/__pycache__/fire.cpython-311.pyc new file mode 100644 index 00000000..ee5e69e3 Binary files /dev/null and b/community/models/__pycache__/fire.cpython-311.pyc differ diff --git a/community/models/__pycache__/fire.cpython-312.pyc b/community/models/__pycache__/fire.cpython-312.pyc new file mode 100644 index 00000000..67d38710 Binary files /dev/null and b/community/models/__pycache__/fire.cpython-312.pyc differ diff --git a/community/models/__pycache__/flat.cpython-311.pyc b/community/models/__pycache__/flat.cpython-311.pyc new file mode 100644 index 00000000..d1b2e5eb Binary files /dev/null and b/community/models/__pycache__/flat.cpython-311.pyc differ diff --git a/community/models/__pycache__/flat.cpython-312.pyc b/community/models/__pycache__/flat.cpython-312.pyc new file mode 100644 index 00000000..fd02297c Binary files /dev/null and b/community/models/__pycache__/flat.cpython-312.pyc differ diff --git a/community/models/__pycache__/glass.cpython-311.pyc b/community/models/__pycache__/glass.cpython-311.pyc new file mode 100644 index 00000000..3fcabd5e Binary files /dev/null and b/community/models/__pycache__/glass.cpython-311.pyc differ diff --git a/community/models/__pycache__/glass.cpython-312.pyc b/community/models/__pycache__/glass.cpython-312.pyc new file mode 100644 index 00000000..c6a7145f Binary files /dev/null and b/community/models/__pycache__/glass.cpython-312.pyc differ diff --git a/community/models/__pycache__/ladder.cpython-311.pyc b/community/models/__pycache__/ladder.cpython-311.pyc new file mode 100644 index 00000000..ba7b1e58 Binary files /dev/null and b/community/models/__pycache__/ladder.cpython-311.pyc differ diff --git a/community/models/__pycache__/ladder.cpython-312.pyc b/community/models/__pycache__/ladder.cpython-312.pyc new file mode 100644 index 00000000..9382e38a Binary files /dev/null and b/community/models/__pycache__/ladder.cpython-312.pyc differ diff --git a/community/models/__pycache__/leaves.cpython-311.pyc b/community/models/__pycache__/leaves.cpython-311.pyc new file mode 100644 index 00000000..6070cda5 Binary files /dev/null and b/community/models/__pycache__/leaves.cpython-311.pyc differ diff --git a/community/models/__pycache__/leaves.cpython-312.pyc b/community/models/__pycache__/leaves.cpython-312.pyc new file mode 100644 index 00000000..89d8bc7c Binary files /dev/null and b/community/models/__pycache__/leaves.cpython-312.pyc differ diff --git a/community/models/__pycache__/lever.cpython-311.pyc b/community/models/__pycache__/lever.cpython-311.pyc new file mode 100644 index 00000000..a3bf6238 Binary files /dev/null and b/community/models/__pycache__/lever.cpython-311.pyc differ diff --git a/community/models/__pycache__/lever.cpython-312.pyc b/community/models/__pycache__/lever.cpython-312.pyc new file mode 100644 index 00000000..a9a81e93 Binary files /dev/null and b/community/models/__pycache__/lever.cpython-312.pyc differ diff --git a/community/models/__pycache__/liquid.cpython-311.pyc b/community/models/__pycache__/liquid.cpython-311.pyc new file mode 100644 index 00000000..a820c97c Binary files /dev/null and b/community/models/__pycache__/liquid.cpython-311.pyc differ diff --git a/community/models/__pycache__/liquid.cpython-312.pyc b/community/models/__pycache__/liquid.cpython-312.pyc new file mode 100644 index 00000000..3d5d1f2b Binary files /dev/null and b/community/models/__pycache__/liquid.cpython-312.pyc differ diff --git a/community/models/__pycache__/pig.cpython-311.pyc b/community/models/__pycache__/pig.cpython-311.pyc new file mode 100644 index 00000000..1fe3daea Binary files /dev/null and b/community/models/__pycache__/pig.cpython-311.pyc differ diff --git a/community/models/__pycache__/pig.cpython-312.pyc b/community/models/__pycache__/pig.cpython-312.pyc new file mode 100644 index 00000000..6ad9e59f Binary files /dev/null and b/community/models/__pycache__/pig.cpython-312.pyc differ diff --git a/community/models/__pycache__/plant.cpython-311.pyc b/community/models/__pycache__/plant.cpython-311.pyc new file mode 100644 index 00000000..3c5c8f99 Binary files /dev/null and b/community/models/__pycache__/plant.cpython-311.pyc differ diff --git a/community/models/__pycache__/plant.cpython-312.pyc b/community/models/__pycache__/plant.cpython-312.pyc new file mode 100644 index 00000000..2cdab754 Binary files /dev/null and b/community/models/__pycache__/plant.cpython-312.pyc differ diff --git a/community/models/__pycache__/pressure_plate.cpython-311.pyc b/community/models/__pycache__/pressure_plate.cpython-311.pyc new file mode 100644 index 00000000..6a8a2c6a Binary files /dev/null and b/community/models/__pycache__/pressure_plate.cpython-311.pyc differ diff --git a/community/models/__pycache__/pressure_plate.cpython-312.pyc b/community/models/__pycache__/pressure_plate.cpython-312.pyc new file mode 100644 index 00000000..d5f7318a Binary files /dev/null and b/community/models/__pycache__/pressure_plate.cpython-312.pyc differ diff --git a/community/models/__pycache__/sign.cpython-311.pyc b/community/models/__pycache__/sign.cpython-311.pyc new file mode 100644 index 00000000..a7f384dd Binary files /dev/null and b/community/models/__pycache__/sign.cpython-311.pyc differ diff --git a/community/models/__pycache__/sign.cpython-312.pyc b/community/models/__pycache__/sign.cpython-312.pyc new file mode 100644 index 00000000..279a21a3 Binary files /dev/null and b/community/models/__pycache__/sign.cpython-312.pyc differ diff --git a/community/models/__pycache__/sign_post.cpython-311.pyc b/community/models/__pycache__/sign_post.cpython-311.pyc new file mode 100644 index 00000000..60ae899d Binary files /dev/null and b/community/models/__pycache__/sign_post.cpython-311.pyc differ diff --git a/community/models/__pycache__/sign_post.cpython-312.pyc b/community/models/__pycache__/sign_post.cpython-312.pyc new file mode 100644 index 00000000..9c3ca934 Binary files /dev/null and b/community/models/__pycache__/sign_post.cpython-312.pyc differ diff --git a/community/models/__pycache__/skeleton.cpython-311.pyc b/community/models/__pycache__/skeleton.cpython-311.pyc new file mode 100644 index 00000000..e8469c37 Binary files /dev/null and b/community/models/__pycache__/skeleton.cpython-311.pyc differ diff --git a/community/models/__pycache__/skeleton.cpython-312.pyc b/community/models/__pycache__/skeleton.cpython-312.pyc new file mode 100644 index 00000000..a3aec110 Binary files /dev/null and b/community/models/__pycache__/skeleton.cpython-312.pyc differ diff --git a/community/models/__pycache__/slab.cpython-311.pyc b/community/models/__pycache__/slab.cpython-311.pyc new file mode 100644 index 00000000..f8d2dd8a Binary files /dev/null and b/community/models/__pycache__/slab.cpython-311.pyc differ diff --git a/community/models/__pycache__/slab.cpython-312.pyc b/community/models/__pycache__/slab.cpython-312.pyc new file mode 100644 index 00000000..bf25075a Binary files /dev/null and b/community/models/__pycache__/slab.cpython-312.pyc differ diff --git a/community/models/__pycache__/snow.cpython-311.pyc b/community/models/__pycache__/snow.cpython-311.pyc new file mode 100644 index 00000000..7817b169 Binary files /dev/null and b/community/models/__pycache__/snow.cpython-311.pyc differ diff --git a/community/models/__pycache__/snow.cpython-312.pyc b/community/models/__pycache__/snow.cpython-312.pyc new file mode 100644 index 00000000..2b15fc28 Binary files /dev/null and b/community/models/__pycache__/snow.cpython-312.pyc differ diff --git a/community/models/__pycache__/soil.cpython-311.pyc b/community/models/__pycache__/soil.cpython-311.pyc new file mode 100644 index 00000000..48a8f0c6 Binary files /dev/null and b/community/models/__pycache__/soil.cpython-311.pyc differ diff --git a/community/models/__pycache__/soil.cpython-312.pyc b/community/models/__pycache__/soil.cpython-312.pyc new file mode 100644 index 00000000..7f027748 Binary files /dev/null and b/community/models/__pycache__/soil.cpython-312.pyc differ diff --git a/community/models/__pycache__/stairs.cpython-311.pyc b/community/models/__pycache__/stairs.cpython-311.pyc new file mode 100644 index 00000000..509cf475 Binary files /dev/null and b/community/models/__pycache__/stairs.cpython-311.pyc differ diff --git a/community/models/__pycache__/stairs.cpython-312.pyc b/community/models/__pycache__/stairs.cpython-312.pyc new file mode 100644 index 00000000..dc40100e Binary files /dev/null and b/community/models/__pycache__/stairs.cpython-312.pyc differ diff --git a/community/models/__pycache__/tinted_glass.cpython-311.pyc b/community/models/__pycache__/tinted_glass.cpython-311.pyc new file mode 100644 index 00000000..7533ca2d Binary files /dev/null and b/community/models/__pycache__/tinted_glass.cpython-311.pyc differ diff --git a/community/models/__pycache__/tinted_glass.cpython-312.pyc b/community/models/__pycache__/tinted_glass.cpython-312.pyc new file mode 100644 index 00000000..f552f4d3 Binary files /dev/null and b/community/models/__pycache__/tinted_glass.cpython-312.pyc differ diff --git a/community/models/__pycache__/torch.cpython-311.pyc b/community/models/__pycache__/torch.cpython-311.pyc new file mode 100644 index 00000000..42123031 Binary files /dev/null and b/community/models/__pycache__/torch.cpython-311.pyc differ diff --git a/community/models/__pycache__/torch.cpython-312.pyc b/community/models/__pycache__/torch.cpython-312.pyc new file mode 100644 index 00000000..85cbab20 Binary files /dev/null and b/community/models/__pycache__/torch.cpython-312.pyc differ diff --git a/community/models/__pycache__/zombie.cpython-311.pyc b/community/models/__pycache__/zombie.cpython-311.pyc new file mode 100644 index 00000000..b00c3825 Binary files /dev/null and b/community/models/__pycache__/zombie.cpython-311.pyc differ diff --git a/community/models/__pycache__/zombie.cpython-312.pyc b/community/models/__pycache__/zombie.cpython-312.pyc new file mode 100644 index 00000000..782a07e3 Binary files /dev/null and b/community/models/__pycache__/zombie.cpython-312.pyc differ diff --git a/community/models/button.py b/community/models/button.py index f6bf0b1b..87f38e7d 100644 --- a/community/models/button.py +++ b/community/models/button.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/cactus.py b/community/models/cactus.py index bf5b2dd8..4e919573 100644 --- a/community/models/cactus.py +++ b/community/models/cactus.py @@ -1,9 +1,8 @@ -translucent = False -transparent = 1 +transparent = True +transparency = 2 is_cube = False glass = False - -# fmt: off +translucent = False colliders = [ [ diff --git a/community/models/cow.py b/community/models/cow.py new file mode 100644 index 00000000..d88f904d --- /dev/null +++ b/community/models/cow.py @@ -0,0 +1,8 @@ + +transparent = True +is_cube = False +glass = False + +colliders = [] + +bones = [{'name':'body','pivot':[0.0, 1.1875, 0.125],'vertices':[[-0.3749999701976776, 0.7499999403953552, 0.625, -0.3749999701976776, 0.7499999403953552, -0.5, 0.3749999701976776, 0.7499999403953552, -0.5, 0.3749999701976776, 0.7499999403953552, 0.625], [0.3749999701976776, 1.375, 0.625, 0.3749999701976776, 1.3749998807907104, -0.5, -0.3749999701976776, 1.3749998807907104, -0.5, -0.3749999701976776, 1.375, 0.625], [-0.3749999701976776, 0.7499999403953552, -0.5, -0.3749999701976776, 1.3749998807907104, -0.5, 0.3749999701976776, 1.3749998807907104, -0.5, 0.3749999701976776, 0.7499999403953552, -0.5], [0.3749999701976776, 0.7499999403953552, 0.625, 0.3749999701976776, 1.375, 0.625, -0.3749999701976776, 1.375, 0.625, -0.3749999701976776, 0.7499999403953552, 0.625], [0.3749999701976776, 0.7499999403953552, 0.625, 0.3749999701976776, 0.7499999403953552, -0.5, 0.3749999701976776, 1.3749998807907104, -0.5, 0.3749999701976776, 1.375, 0.625], [-0.3749999701976776, 1.375, 0.625, -0.3749999701976776, 1.3749998807907104, -0.5, -0.3749999701976776, 0.7499999403953552, -0.5, -0.3749999701976776, 0.7499999403953552, 0.625], [-0.1249999925494194, 0.6874999403953552, 0.625, -0.1249999925494194, 0.6874999403953552, 0.25, 0.1249999925494194, 0.6874999403953552, 0.25, 0.1249999925494194, 0.6874999403953552, 0.625], [0.1249999925494194, 0.7499999403953552, 0.625, 0.1249999925494194, 0.7499999403953552, 0.25, -0.1249999925494194, 0.7499999403953552, 0.25, -0.1249999925494194, 0.7499999403953552, 0.625], [-0.1249999925494194, 0.6874999403953552, 0.25, -0.1249999925494194, 0.7499999403953552, 0.25, 0.1249999925494194, 0.7499999403953552, 0.25, 0.1249999925494194, 0.6874999403953552, 0.25], [0.1249999925494194, 0.6874999403953552, 0.625, 0.1249999925494194, 0.7499999403953552, 0.625, -0.1249999925494194, 0.7499999403953552, 0.625, -0.1249999925494194, 0.6874999403953552, 0.625], [0.1249999925494194, 0.6874999403953552, 0.625, 0.1249999925494194, 0.6874999403953552, 0.25, 0.1249999925494194, 0.7499999403953552, 0.25, 0.1249999925494194, 0.7499999403953552, 0.625], [-0.1249999925494194, 0.7499999403953552, 0.625, -0.1249999925494194, 0.7499999403953552, 0.25, -0.1249999925494194, 0.6874999403953552, 0.25, -0.1249999925494194, 0.6874999403953552, 0.625]],'tex_coords':[[0.06493506493506493, 0.0, 0.06493506493506493, 0.6428571428571428, 0.14285714285714285, 0.6428571428571428, 0.14285714285714285, 0.0], [0.2077922077922078, 0.0, 0.2077922077922078, 0.6428571428571428, 0.2857142857142857, 0.6428571428571428, 0.2857142857142857, 0.0], [0.06493506493506493, 0.6428571428571428, 0.06493506493506493, 1.0, 0.14285714285714285, 1.0, 0.14285714285714285, 0.6428571428571428], [0.14285714285714285, 0.6428571428571428, 0.14285714285714285, 1.0, 0.22077922077922077, 1.0, 0.22077922077922077, 0.6428571428571428], [0.14285714285714285, 0.0, 0.14285714285714285, 0.6428571428571428, 0.2077922077922078, 0.6428571428571428, 0.2077922077922078, 0.0], [0.0, 0.0, 0.0, 0.6428571428571428, 0.06493506493506493, 0.6428571428571428, 0.06493506493506493, 0.0], [0.2922077922077922, 0.75, 0.2922077922077922, 0.9642857142857143, 0.3181818181818182, 0.9642857142857143, 0.3181818181818182, 0.75], [0.3246753246753247, 0.75, 0.3246753246753247, 0.9642857142857143, 0.35064935064935066, 0.9642857142857143, 0.35064935064935066, 0.75], [0.2922077922077922, 0.9642857142857143, 0.2922077922077922, 1.0, 0.3181818181818182, 1.0, 0.3181818181818182, 0.9642857142857143], [0.3181818181818182, 0.9642857142857143, 0.3181818181818182, 1.0, 0.34415584415584416, 1.0, 0.34415584415584416, 0.9642857142857143], [0.3181818181818182, 0.75, 0.3181818181818182, 0.9642857142857143, 0.3246753246753247, 0.9642857142857143, 0.3246753246753247, 0.75], [0.2857142857142857, 0.75, 0.2857142857142857, 0.9642857142857143, 0.2922077922077922, 0.9642857142857143, 0.2922077922077922, 0.75]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'head','pivot':[0.0, 1.25, -0.5],'vertices':[[-0.25, 1.0, -0.875, -0.25, 1.5, -0.875, 0.25, 1.5, -0.875, 0.25, 1.0, -0.875], [0.25, 1.0, -0.5, 0.25, 1.5, -0.5, -0.25, 1.5, -0.5, -0.25, 1.0, -0.5], [-0.25, 1.5, -0.875, -0.25, 1.5, -0.5, 0.25, 1.5, -0.5, 0.25, 1.5, -0.875], [0.25, 1.0, -0.875, 0.25, 1.0, -0.5, -0.25, 1.0, -0.5, -0.25, 1.0, -0.875], [0.25, 1.0, -0.875, 0.25, 1.5, -0.875, 0.25, 1.5, -0.5, 0.25, 1.0, -0.5], [-0.25, 1.0, -0.5, -0.25, 1.5, -0.5, -0.25, 1.5, -0.875, -0.25, 1.0, -0.875], [-0.3125, 1.375, -0.75, -0.3125, 1.5625, -0.75, -0.25, 1.5625, -0.75, -0.25, 1.375, -0.75], [-0.25, 1.375, -0.6875, -0.25, 1.5625, -0.6875, -0.3125, 1.5625, -0.6875, -0.3125, 1.375, -0.6875], [-0.3125, 1.5625, -0.75, -0.3125, 1.5625, -0.6875, -0.25, 1.5625, -0.6875, -0.25, 1.5625, -0.75], [-0.25, 1.375, -0.75, -0.25, 1.375, -0.6875, -0.3125, 1.375, -0.6875, -0.3125, 1.375, -0.75], [-0.25, 1.375, -0.75, -0.25, 1.5625, -0.75, -0.25, 1.5625, -0.6875, -0.25, 1.375, -0.6875], [-0.3125, 1.375, -0.6875, -0.3125, 1.5625, -0.6875, -0.3125, 1.5625, -0.75, -0.3125, 1.375, -0.75], [0.25, 1.375, -0.75, 0.25, 1.5625, -0.75, 0.3125, 1.5625, -0.75, 0.3125, 1.375, -0.75], [0.3125, 1.375, -0.6875, 0.3125, 1.5625, -0.6875, 0.25, 1.5625, -0.6875, 0.25, 1.375, -0.6875], [0.25, 1.5625, -0.75, 0.25, 1.5625, -0.6875, 0.3125, 1.5625, -0.6875, 0.3125, 1.5625, -0.75], [0.3125, 1.375, -0.75, 0.3125, 1.375, -0.6875, 0.25, 1.375, -0.6875, 0.25, 1.375, -0.75], [0.3125, 1.375, -0.75, 0.3125, 1.5625, -0.75, 0.3125, 1.5625, -0.6875, 0.3125, 1.375, -0.6875], [0.25, 1.375, -0.6875, 0.25, 1.5625, -0.6875, 0.25, 1.5625, -0.75, 0.25, 1.375, -0.75]],'tex_coords':[[0.38961038961038963, 0.5, 0.38961038961038963, 0.7857142857142857, 0.44155844155844154, 0.7857142857142857, 0.44155844155844154, 0.5], [0.4805194805194805, 0.5, 0.4805194805194805, 0.7857142857142857, 0.5324675324675324, 0.7857142857142857, 0.5324675324675324, 0.5], [0.38961038961038963, 0.7857142857142857, 0.38961038961038963, 1.0, 0.44155844155844154, 1.0, 0.44155844155844154, 0.7857142857142857], [0.44155844155844154, 0.7857142857142857, 0.44155844155844154, 1.0, 0.4935064935064935, 1.0, 0.4935064935064935, 0.7857142857142857], [0.44155844155844154, 0.5, 0.44155844155844154, 0.7857142857142857, 0.4805194805194805, 0.7857142857142857, 0.4805194805194805, 0.5], [0.35064935064935066, 0.5, 0.35064935064935066, 0.7857142857142857, 0.38961038961038963, 0.7857142857142857, 0.38961038961038963, 0.5], [0.538961038961039, 0.8571428571428572, 0.538961038961039, 0.9642857142857143, 0.5454545454545454, 0.9642857142857143, 0.5454545454545454, 0.8571428571428572], [0.551948051948052, 0.8571428571428572, 0.551948051948052, 0.9642857142857143, 0.5584415584415584, 0.9642857142857143, 0.5584415584415584, 0.8571428571428572], [0.538961038961039, 0.9642857142857143, 0.538961038961039, 1.0, 0.5454545454545454, 1.0, 0.5454545454545454, 0.9642857142857143], [0.5454545454545454, 0.9642857142857143, 0.5454545454545454, 1.0, 0.551948051948052, 1.0, 0.551948051948052, 0.9642857142857143], [0.5454545454545454, 0.8571428571428572, 0.5454545454545454, 0.9642857142857143, 0.551948051948052, 0.9642857142857143, 0.551948051948052, 0.8571428571428572], [0.5324675324675324, 0.8571428571428572, 0.5324675324675324, 0.9642857142857143, 0.538961038961039, 0.9642857142857143, 0.538961038961039, 0.8571428571428572], [0.564935064935065, 0.8571428571428572, 0.564935064935065, 0.9642857142857143, 0.5714285714285714, 0.9642857142857143, 0.5714285714285714, 0.8571428571428572], [0.577922077922078, 0.8571428571428572, 0.577922077922078, 0.9642857142857143, 0.5844155844155844, 0.9642857142857143, 0.5844155844155844, 0.8571428571428572], [0.564935064935065, 0.9642857142857143, 0.564935064935065, 1.0, 0.5714285714285714, 1.0, 0.5714285714285714, 0.9642857142857143], [0.5714285714285714, 0.9642857142857143, 0.5714285714285714, 1.0, 0.577922077922078, 1.0, 0.577922077922078, 0.9642857142857143], [0.5714285714285714, 0.8571428571428572, 0.5714285714285714, 0.9642857142857143, 0.577922077922078, 0.9642857142857143, 0.577922077922078, 0.8571428571428572], [0.5584415584415584, 0.8571428571428572, 0.5584415584415584, 0.9642857142857143, 0.564935064935065, 0.9642857142857143, 0.564935064935065, 0.8571428571428572]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg0','pivot':[-0.25, 0.75, 0.4375],'vertices':[[-0.3125, 0.0, 0.3125, -0.3125, 0.75, 0.3125, -0.0625, 0.75, 0.3125, -0.0625, 0.0, 0.3125], [-0.0625, 0.0, 0.5625, -0.0625, 0.75, 0.5625, -0.3125, 0.75, 0.5625, -0.3125, 0.0, 0.5625], [-0.3125, 0.75, 0.3125, -0.3125, 0.75, 0.5625, -0.0625, 0.75, 0.5625, -0.0625, 0.75, 0.3125], [-0.0625, 0.0, 0.3125, -0.0625, 0.0, 0.5625, -0.3125, 0.0, 0.5625, -0.3125, 0.0, 0.3125], [-0.0625, 0.0, 0.3125, -0.0625, 0.75, 0.3125, -0.0625, 0.75, 0.5625, -0.0625, 0.0, 0.5625], [-0.3125, 0.0, 0.5625, -0.3125, 0.75, 0.5625, -0.3125, 0.75, 0.3125, -0.3125, 0.0, 0.3125]],'tex_coords':[[0.6103896103896104, 0.4285714285714286, 0.6103896103896104, 0.8571428571428572, 0.6363636363636364, 0.8571428571428572, 0.6363636363636364, 0.4285714285714286], [0.6623376623376623, 0.4285714285714286, 0.6623376623376623, 0.8571428571428572, 0.6883116883116883, 0.8571428571428572, 0.6883116883116883, 0.4285714285714286], [0.6103896103896104, 0.8571428571428572, 0.6103896103896104, 1.0, 0.6363636363636364, 1.0, 0.6363636363636364, 0.8571428571428572], [0.6363636363636364, 0.8571428571428572, 0.6363636363636364, 1.0, 0.6623376623376623, 1.0, 0.6623376623376623, 0.8571428571428572], [0.6363636363636364, 0.4285714285714286, 0.6363636363636364, 0.8571428571428572, 0.6623376623376623, 0.8571428571428572, 0.6623376623376623, 0.4285714285714286], [0.5844155844155844, 0.4285714285714286, 0.5844155844155844, 0.8571428571428572, 0.6103896103896104, 0.8571428571428572, 0.6103896103896104, 0.4285714285714286]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg1','pivot':[0.25, 0.75, 0.4375],'vertices':[[0.0625, 0.0, 0.3125, 0.0625, 0.75, 0.3125, 0.3125, 0.75, 0.3125, 0.3125, 0.0, 0.3125], [0.3125, 0.0, 0.5625, 0.3125, 0.75, 0.5625, 0.0625, 0.75, 0.5625, 0.0625, 0.0, 0.5625], [0.0625, 0.75, 0.3125, 0.0625, 0.75, 0.5625, 0.3125, 0.75, 0.5625, 0.3125, 0.75, 0.3125], [0.3125, 0.0, 0.3125, 0.3125, 0.0, 0.5625, 0.0625, 0.0, 0.5625, 0.0625, 0.0, 0.3125], [0.3125, 0.0, 0.3125, 0.3125, 0.75, 0.3125, 0.3125, 0.75, 0.5625, 0.3125, 0.0, 0.5625], [0.0625, 0.0, 0.5625, 0.0625, 0.75, 0.5625, 0.0625, 0.75, 0.3125, 0.0625, 0.0, 0.3125]],'tex_coords':[[0.7142857142857143, 0.4285714285714286, 0.7142857142857143, 0.8571428571428572, 0.7402597402597403, 0.8571428571428572, 0.7402597402597403, 0.4285714285714286], [0.7662337662337663, 0.4285714285714286, 0.7662337662337663, 0.8571428571428572, 0.7922077922077922, 0.8571428571428572, 0.7922077922077922, 0.4285714285714286], [0.7142857142857143, 0.8571428571428572, 0.7142857142857143, 1.0, 0.7402597402597403, 1.0, 0.7402597402597403, 0.8571428571428572], [0.7402597402597403, 0.8571428571428572, 0.7402597402597403, 1.0, 0.7662337662337663, 1.0, 0.7662337662337663, 0.8571428571428572], [0.7402597402597403, 0.4285714285714286, 0.7402597402597403, 0.8571428571428572, 0.7662337662337663, 0.8571428571428572, 0.7662337662337663, 0.4285714285714286], [0.6883116883116883, 0.4285714285714286, 0.6883116883116883, 0.8571428571428572, 0.7142857142857143, 0.8571428571428572, 0.7142857142857143, 0.4285714285714286]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg2','pivot':[-0.25, 0.75, -0.375],'vertices':[[-0.3125, 0.0, -0.4375, -0.3125, 0.75, -0.4375, -0.0625, 0.75, -0.4375, -0.0625, 0.0, -0.4375], [-0.0625, 0.0, -0.1875, -0.0625, 0.75, -0.1875, -0.3125, 0.75, -0.1875, -0.3125, 0.0, -0.1875], [-0.3125, 0.75, -0.4375, -0.3125, 0.75, -0.1875, -0.0625, 0.75, -0.1875, -0.0625, 0.75, -0.4375], [-0.0625, 0.0, -0.4375, -0.0625, 0.0, -0.1875, -0.3125, 0.0, -0.1875, -0.3125, 0.0, -0.4375], [-0.0625, 0.0, -0.4375, -0.0625, 0.75, -0.4375, -0.0625, 0.75, -0.1875, -0.0625, 0.0, -0.1875], [-0.3125, 0.0, -0.1875, -0.3125, 0.75, -0.1875, -0.3125, 0.75, -0.4375, -0.3125, 0.0, -0.4375]],'tex_coords':[[0.8181818181818182, 0.4285714285714286, 0.8181818181818182, 0.8571428571428572, 0.8441558441558441, 0.8571428571428572, 0.8441558441558441, 0.4285714285714286], [0.8701298701298701, 0.4285714285714286, 0.8701298701298701, 0.8571428571428572, 0.8961038961038961, 0.8571428571428572, 0.8961038961038961, 0.4285714285714286], [0.8181818181818182, 0.8571428571428572, 0.8181818181818182, 1.0, 0.8441558441558441, 1.0, 0.8441558441558441, 0.8571428571428572], [0.8441558441558441, 0.8571428571428572, 0.8441558441558441, 1.0, 0.8701298701298701, 1.0, 0.8701298701298701, 0.8571428571428572], [0.8441558441558441, 0.4285714285714286, 0.8441558441558441, 0.8571428571428572, 0.8701298701298701, 0.8571428571428572, 0.8701298701298701, 0.4285714285714286], [0.7922077922077922, 0.4285714285714286, 0.7922077922077922, 0.8571428571428572, 0.8181818181818182, 0.8571428571428572, 0.8181818181818182, 0.4285714285714286]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg3','pivot':[0.25, 0.75, -0.375],'vertices':[[0.0625, 0.0, -0.4375, 0.0625, 0.75, -0.4375, 0.3125, 0.75, -0.4375, 0.3125, 0.0, -0.4375], [0.3125, 0.0, -0.1875, 0.3125, 0.75, -0.1875, 0.0625, 0.75, -0.1875, 0.0625, 0.0, -0.1875], [0.0625, 0.75, -0.4375, 0.0625, 0.75, -0.1875, 0.3125, 0.75, -0.1875, 0.3125, 0.75, -0.4375], [0.3125, 0.0, -0.4375, 0.3125, 0.0, -0.1875, 0.0625, 0.0, -0.1875, 0.0625, 0.0, -0.4375], [0.3125, 0.0, -0.4375, 0.3125, 0.75, -0.4375, 0.3125, 0.75, -0.1875, 0.3125, 0.0, -0.1875], [0.0625, 0.0, -0.1875, 0.0625, 0.75, -0.1875, 0.0625, 0.75, -0.4375, 0.0625, 0.0, -0.4375]],'tex_coords':[[0.922077922077922, 0.4285714285714286, 0.922077922077922, 0.8571428571428572, 0.948051948051948, 0.8571428571428572, 0.948051948051948, 0.4285714285714286], [0.974025974025974, 0.4285714285714286, 0.974025974025974, 0.8571428571428572, 1.0, 0.8571428571428572, 1.0, 0.4285714285714286], [0.922077922077922, 0.8571428571428572, 0.922077922077922, 1.0, 0.948051948051948, 1.0, 0.948051948051948, 0.8571428571428572], [0.948051948051948, 0.8571428571428572, 0.948051948051948, 1.0, 0.974025974025974, 1.0, 0.974025974025974, 0.8571428571428572], [0.948051948051948, 0.4285714285714286, 0.948051948051948, 0.8571428571428572, 0.974025974025974, 0.8571428571428572, 0.974025974025974, 0.4285714285714286], [0.8961038961038961, 0.4285714285714286, 0.8961038961038961, 0.8571428571428572, 0.922077922077922, 0.8571428571428572, 0.922077922077922, 0.4285714285714286]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}] diff --git a/community/models/creeper.py b/community/models/creeper.py new file mode 100644 index 00000000..f6860aa7 --- /dev/null +++ b/community/models/creeper.py @@ -0,0 +1,8 @@ + +transparent = True +is_cube = False +glass = False + +colliders = [] + +bones = [{'name':'body','pivot':[0.0, 0.0, 0.0],'vertices':[[-0.25, 0.375, -0.125, -0.25, 1.125, -0.125, 0.25, 1.125, -0.125, 0.25, 0.375, -0.125], [0.25, 0.375, 0.125, 0.25, 1.125, 0.125, -0.25, 1.125, 0.125, -0.25, 0.375, 0.125], [-0.25, 1.125, -0.125, -0.25, 1.125, 0.125, 0.25, 1.125, 0.125, 0.25, 1.125, -0.125], [0.25, 0.375, -0.125, 0.25, 0.375, 0.125, -0.25, 0.375, 0.125, -0.25, 0.375, -0.125], [0.25, 0.375, -0.125, 0.25, 1.125, -0.125, 0.25, 1.125, 0.125, 0.25, 0.375, 0.125], [-0.25, 0.375, 0.125, -0.25, 1.125, 0.125, -0.25, 1.125, -0.125, -0.25, 0.375, -0.125]],'tex_coords':[[0.03333333333333333, 0.0, 0.03333333333333333, 0.75, 0.1, 0.75, 0.1, 0.0], [0.13333333333333333, 0.0, 0.13333333333333333, 0.75, 0.2, 0.75, 0.2, 0.0], [0.03333333333333333, 0.75, 0.03333333333333333, 1.0, 0.1, 1.0, 0.1, 0.75], [0.1, 0.75, 0.1, 1.0, 0.16666666666666666, 1.0, 0.16666666666666666, 0.75], [0.1, 0.0, 0.1, 0.75, 0.13333333333333333, 0.75, 0.13333333333333333, 0.0], [0.0, 0.0, 0.0, 0.75, 0.03333333333333333, 0.75, 0.03333333333333333, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'head','pivot':[0.0, 1.125, 0.0],'vertices':[[-0.25, 1.125, -0.25, -0.25, 1.625, -0.25, 0.25, 1.625, -0.25, 0.25, 1.125, -0.25], [0.25, 1.125, 0.25, 0.25, 1.625, 0.25, -0.25, 1.625, 0.25, -0.25, 1.125, 0.25], [-0.25, 1.625, -0.25, -0.25, 1.625, 0.25, 0.25, 1.625, 0.25, 0.25, 1.625, -0.25], [0.25, 1.125, -0.25, 0.25, 1.125, 0.25, -0.25, 1.125, 0.25, -0.25, 1.125, -0.25], [0.25, 1.125, -0.25, 0.25, 1.625, -0.25, 0.25, 1.625, 0.25, 0.25, 1.125, 0.25], [-0.25, 1.125, 0.25, -0.25, 1.625, 0.25, -0.25, 1.625, -0.25, -0.25, 1.125, -0.25]],'tex_coords':[[0.26666666666666666, 0.0, 0.26666666666666666, 0.5, 0.3333333333333333, 0.5, 0.3333333333333333, 0.0], [0.4, 0.0, 0.4, 0.5, 0.4666666666666667, 0.5, 0.4666666666666667, 0.0], [0.26666666666666666, 0.5, 0.26666666666666666, 1.0, 0.3333333333333333, 1.0, 0.3333333333333333, 0.5], [0.3333333333333333, 0.5, 0.3333333333333333, 1.0, 0.4, 1.0, 0.4, 0.5], [0.3333333333333333, 0.0, 0.3333333333333333, 0.5, 0.4, 0.5, 0.4, 0.0], [0.2, 0.0, 0.2, 0.5, 0.26666666666666666, 0.5, 0.26666666666666666, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg0','pivot':[-0.125, 0.375, 0.25],'vertices':[[-0.25, 0.0, 0.125, -0.25, 0.375, 0.125, 0.0, 0.375, 0.125, 0.0, 0.0, 0.125], [0.0, 0.0, 0.375, 0.0, 0.375, 0.375, -0.25, 0.375, 0.375, -0.25, 0.0, 0.375], [-0.25, 0.375, 0.125, -0.25, 0.375, 0.375, 0.0, 0.375, 0.375, 0.0, 0.375, 0.125], [0.0, 0.0, 0.125, 0.0, 0.0, 0.375, -0.25, 0.0, 0.375, -0.25, 0.0, 0.125], [0.0, 0.0, 0.125, 0.0, 0.375, 0.125, 0.0, 0.375, 0.375, 0.0, 0.0, 0.375], [-0.25, 0.0, 0.375, -0.25, 0.375, 0.375, -0.25, 0.375, 0.125, -0.25, 0.0, 0.125]],'tex_coords':[[0.5, 0.375, 0.5, 0.75, 0.5333333333333333, 0.75, 0.5333333333333333, 0.375], [0.5666666666666667, 0.375, 0.5666666666666667, 0.75, 0.6, 0.75, 0.6, 0.375], [0.5, 0.75, 0.5, 1.0, 0.5333333333333333, 1.0, 0.5333333333333333, 0.75], [0.5333333333333333, 0.75, 0.5333333333333333, 1.0, 0.5666666666666667, 1.0, 0.5666666666666667, 0.75], [0.5333333333333333, 0.375, 0.5333333333333333, 0.75, 0.5666666666666667, 0.75, 0.5666666666666667, 0.375], [0.4666666666666667, 0.375, 0.4666666666666667, 0.75, 0.5, 0.75, 0.5, 0.375]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg1','pivot':[0.125, 0.375, 0.25],'vertices':[[0.0, 0.0, 0.125, 0.0, 0.375, 0.125, 0.25, 0.375, 0.125, 0.25, 0.0, 0.125], [0.25, 0.0, 0.375, 0.25, 0.375, 0.375, 0.0, 0.375, 0.375, 0.0, 0.0, 0.375], [0.0, 0.375, 0.125, 0.0, 0.375, 0.375, 0.25, 0.375, 0.375, 0.25, 0.375, 0.125], [0.25, 0.0, 0.125, 0.25, 0.0, 0.375, 0.0, 0.0, 0.375, 0.0, 0.0, 0.125], [0.25, 0.0, 0.125, 0.25, 0.375, 0.125, 0.25, 0.375, 0.375, 0.25, 0.0, 0.375], [0.0, 0.0, 0.375, 0.0, 0.375, 0.375, 0.0, 0.375, 0.125, 0.0, 0.0, 0.125]],'tex_coords':[[0.6333333333333333, 0.375, 0.6333333333333333, 0.75, 0.6666666666666666, 0.75, 0.6666666666666666, 0.375], [0.7, 0.375, 0.7, 0.75, 0.7333333333333333, 0.75, 0.7333333333333333, 0.375], [0.6333333333333333, 0.75, 0.6333333333333333, 1.0, 0.6666666666666666, 1.0, 0.6666666666666666, 0.75], [0.6666666666666666, 0.75, 0.6666666666666666, 1.0, 0.7, 1.0, 0.7, 0.75], [0.6666666666666666, 0.375, 0.6666666666666666, 0.75, 0.7, 0.75, 0.7, 0.375], [0.6, 0.375, 0.6, 0.75, 0.6333333333333333, 0.75, 0.6333333333333333, 0.375]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg2','pivot':[-0.125, 0.375, -0.25],'vertices':[[-0.25, 0.0, -0.375, -0.25, 0.375, -0.375, 0.0, 0.375, -0.375, 0.0, 0.0, -0.375], [0.0, 0.0, -0.125, 0.0, 0.375, -0.125, -0.25, 0.375, -0.125, -0.25, 0.0, -0.125], [-0.25, 0.375, -0.375, -0.25, 0.375, -0.125, 0.0, 0.375, -0.125, 0.0, 0.375, -0.375], [0.0, 0.0, -0.375, 0.0, 0.0, -0.125, -0.25, 0.0, -0.125, -0.25, 0.0, -0.375], [0.0, 0.0, -0.375, 0.0, 0.375, -0.375, 0.0, 0.375, -0.125, 0.0, 0.0, -0.125], [-0.25, 0.0, -0.125, -0.25, 0.375, -0.125, -0.25, 0.375, -0.375, -0.25, 0.0, -0.375]],'tex_coords':[[0.7666666666666667, 0.375, 0.7666666666666667, 0.75, 0.8, 0.75, 0.8, 0.375], [0.8333333333333334, 0.375, 0.8333333333333334, 0.75, 0.8666666666666667, 0.75, 0.8666666666666667, 0.375], [0.7666666666666667, 0.75, 0.7666666666666667, 1.0, 0.8, 1.0, 0.8, 0.75], [0.8, 0.75, 0.8, 1.0, 0.8333333333333334, 1.0, 0.8333333333333334, 0.75], [0.8, 0.375, 0.8, 0.75, 0.8333333333333334, 0.75, 0.8333333333333334, 0.375], [0.7333333333333333, 0.375, 0.7333333333333333, 0.75, 0.7666666666666667, 0.75, 0.7666666666666667, 0.375]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg3','pivot':[0.125, 0.375, -0.25],'vertices':[[0.0, 0.0, -0.375, 0.0, 0.375, -0.375, 0.25, 0.375, -0.375, 0.25, 0.0, -0.375], [0.25, 0.0, -0.125, 0.25, 0.375, -0.125, 0.0, 0.375, -0.125, 0.0, 0.0, -0.125], [0.0, 0.375, -0.375, 0.0, 0.375, -0.125, 0.25, 0.375, -0.125, 0.25, 0.375, -0.375], [0.25, 0.0, -0.375, 0.25, 0.0, -0.125, 0.0, 0.0, -0.125, 0.0, 0.0, -0.375], [0.25, 0.0, -0.375, 0.25, 0.375, -0.375, 0.25, 0.375, -0.125, 0.25, 0.0, -0.125], [0.0, 0.0, -0.125, 0.0, 0.375, -0.125, 0.0, 0.375, -0.375, 0.0, 0.0, -0.375]],'tex_coords':[[0.9, 0.375, 0.9, 0.75, 0.9333333333333333, 0.75, 0.9333333333333333, 0.375], [0.9666666666666667, 0.375, 0.9666666666666667, 0.75, 1.0, 0.75, 1.0, 0.375], [0.9, 0.75, 0.9, 1.0, 0.9333333333333333, 1.0, 0.9333333333333333, 0.75], [0.9333333333333333, 0.75, 0.9333333333333333, 1.0, 0.9666666666666667, 1.0, 0.9666666666666667, 0.75], [0.9333333333333333, 0.375, 0.9333333333333333, 0.75, 0.9666666666666667, 0.75, 0.9666666666666667, 0.375], [0.8666666666666667, 0.375, 0.8666666666666667, 0.75, 0.9, 0.75, 0.9, 0.375]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}] diff --git a/community/models/crop.py b/community/models/crop.py index 8f387b3c..c8d29610 100644 --- a/community/models/crop.py +++ b/community/models/crop.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/cube.py b/community/models/cube.py index 475b8545..50c204f7 100644 --- a/community/models/cube.py +++ b/community/models/cube.py @@ -1,9 +1,8 @@ -transparent = 0 +transparent = False +transparency = 0 +translucent = False is_cube = True glass = False -translucent = False - -# fmt: off colliders = [ [ diff --git a/community/models/curry.py b/community/models/curry.py new file mode 100644 index 00000000..dabce985 --- /dev/null +++ b/community/models/curry.py @@ -0,0 +1,8 @@ + +transparent = True +is_cube = False +glass = False + +colliders = [] + +bones = [{'name':'body','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 0.75, -0.125, -0.25, 1.5, -0.125, 0.25, 1.5, -0.125, 0.25, 0.75, -0.125], [0.25, 0.75, 0.125, 0.25, 1.5, 0.125, -0.25, 1.5, 0.125, -0.25, 0.75, 0.125], [-0.25, 1.5, -0.125, -0.25, 1.5, 0.125, 0.25, 1.5, 0.125, 0.25, 1.5, -0.125], [0.25, 0.75, -0.125, 0.25, 0.75, 0.125, -0.25, 0.75, 0.125, -0.25, 0.75, -0.125], [0.25, 0.75, -0.125, 0.25, 1.5, -0.125, 0.25, 1.5, 0.125, 0.25, 0.75, 0.125], [-0.25, 0.75, 0.125, -0.25, 1.5, 0.125, -0.25, 1.5, -0.125, -0.25, 0.75, -0.125]],'tex_coords':[[0.018867924528301886, 0.0, 0.018867924528301886, 0.75, 0.05660377358490566, 0.75, 0.05660377358490566, 0.0], [0.07547169811320754, 0.0, 0.07547169811320754, 0.75, 0.11320754716981132, 0.75, 0.11320754716981132, 0.0], [0.018867924528301886, 0.75, 0.018867924528301886, 1.0, 0.05660377358490566, 1.0, 0.05660377358490566, 0.75], [0.05660377358490566, 0.75, 0.05660377358490566, 1.0, 0.09433962264150944, 1.0, 0.09433962264150944, 0.75], [0.05660377358490566, 0.0, 0.05660377358490566, 0.75, 0.07547169811320754, 0.75, 0.07547169811320754, 0.0], [0.0, 0.0, 0.0, 0.75, 0.018867924528301886, 0.75, 0.018867924528301886, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'head','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.2536456286907196, 1.497308611869812, -0.23161627352237701, -0.2536456286907196, 1.997308611869812, -0.23161627352237701, 0.2463543713092804, 1.997308611869812, -0.23161627352237701, 0.2463543713092804, 1.497308611869812, -0.23161627352237701], [0.2463543713092804, 1.497308611869812, 0.2683837413787842, 0.2463543713092804, 1.997308611869812, 0.2683837413787842, -0.2536456286907196, 1.997308611869812, 0.2683837413787842, -0.2536456286907196, 1.497308611869812, 0.2683837413787842], [-0.2536456286907196, 1.997308611869812, -0.23161627352237701, -0.2536456286907196, 1.997308611869812, 0.2683837413787842, 0.2463543713092804, 1.997308611869812, 0.2683837413787842, 0.2463543713092804, 1.997308611869812, -0.23161627352237701], [0.2463543713092804, 1.497308611869812, -0.23161627352237701, 0.2463543713092804, 1.497308611869812, 0.2683837413787842, -0.2536456286907196, 1.497308611869812, 0.2683837413787842, -0.2536456286907196, 1.497308611869812, -0.23161627352237701], [0.2463543713092804, 1.497308611869812, -0.23161627352237701, 0.2463543713092804, 1.997308611869812, -0.23161627352237701, 0.2463543713092804, 1.997308611869812, 0.2683837413787842, 0.2463543713092804, 1.497308611869812, 0.2683837413787842], [-0.2536456286907196, 1.497308611869812, 0.2683837413787842, -0.2536456286907196, 1.997308611869812, 0.2683837413787842, -0.2536456286907196, 1.997308611869812, -0.23161627352237701, -0.2536456286907196, 1.497308611869812, -0.23161627352237701], [0.2316092699766159, 0.8962944149971008, -0.21831698715686798, 0.2316092699766159, 1.396294355392456, -0.21831698715686798, 0.7316092848777771, 1.396294355392456, -0.21831698715686798, 0.7316092848777771, 0.8962944149971008, -0.21831698715686798], [0.7316092848777771, 0.8962944149971008, 0.2816829979419708, 0.7316092848777771, 1.396294355392456, 0.2816829979419708, 0.2316092699766159, 1.396294355392456, 0.2816829979419708, 0.2316092699766159, 0.8962944149971008, 0.2816829979419708], [0.2316092699766159, 1.396294355392456, -0.21831698715686798, 0.2316092699766159, 1.396294355392456, 0.2816829979419708, 0.7316092848777771, 1.396294355392456, 0.2816829979419708, 0.7316092848777771, 1.396294355392456, -0.21831698715686798], [0.7316092848777771, 0.8962944149971008, -0.21831698715686798, 0.7316092848777771, 0.8962944149971008, 0.2816829979419708, 0.2316092699766159, 0.8962944149971008, 0.2816829979419708, 0.2316092699766159, 0.8962944149971008, -0.21831698715686798], [0.7316092848777771, 0.8962944149971008, -0.21831698715686798, 0.7316092848777771, 1.396294355392456, -0.21831698715686798, 0.7316092848777771, 1.396294355392456, 0.2816829979419708, 0.7316092848777771, 0.8962944149971008, 0.2816829979419708], [0.2316092699766159, 0.8962944149971008, 0.2816829979419708, 0.2316092699766159, 1.396294355392456, 0.2816829979419708, 0.2316092699766159, 1.396294355392456, -0.21831698715686798, 0.2316092699766159, 0.8962944149971008, -0.21831698715686798]],'tex_coords':[[0.1509433962264151, 0.0, 0.1509433962264151, 0.5, 0.18867924528301888, 0.5, 0.18867924528301888, 0.0], [0.22641509433962265, 0.0, 0.22641509433962265, 0.5, 0.2641509433962264, 0.5, 0.2641509433962264, 0.0], [0.1509433962264151, 0.5, 0.1509433962264151, 1.0, 0.18867924528301888, 1.0, 0.18867924528301888, 0.5], [0.18867924528301888, 0.5, 0.18867924528301888, 1.0, 0.22641509433962265, 1.0, 0.22641509433962265, 0.5], [0.18867924528301888, 0.0, 0.18867924528301888, 0.5, 0.22641509433962265, 0.5, 0.22641509433962265, 0.0], [0.11320754716981132, 0.0, 0.11320754716981132, 0.5, 0.1509433962264151, 0.5, 0.1509433962264151, 0.0], [0.3018867924528302, 0.0, 0.3018867924528302, 0.5, 0.33962264150943394, 0.5, 0.33962264150943394, 0.0], [0.37735849056603776, 0.0, 0.37735849056603776, 0.5, 0.41509433962264153, 0.5, 0.41509433962264153, 0.0], [0.3018867924528302, 0.5, 0.3018867924528302, 1.0, 0.33962264150943394, 1.0, 0.33962264150943394, 0.5], [0.33962264150943394, 0.5, 0.33962264150943394, 1.0, 0.37735849056603776, 1.0, 0.37735849056603776, 0.5], [0.33962264150943394, 0.0, 0.33962264150943394, 0.5, 0.37735849056603776, 0.5, 0.37735849056603776, 0.0], [0.2641509433962264, 0.0, 0.2641509433962264, 0.5, 0.3018867924528302, 0.5, 0.3018867924528302, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'hat','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 1.5, -0.25, -0.25, 2.0, -0.25, 0.25, 2.0, -0.25, 0.25, 1.5, -0.25], [0.25, 1.5, 0.25, 0.25, 2.0, 0.25, -0.25, 2.0, 0.25, -0.25, 1.5, 0.25], [-0.25, 2.0, -0.25, -0.25, 2.0, 0.25, 0.25, 2.0, 0.25, 0.25, 2.0, -0.25], [0.25, 1.5, -0.25, 0.25, 1.5, 0.25, -0.25, 1.5, 0.25, -0.25, 1.5, -0.25], [0.25, 1.5, -0.25, 0.25, 2.0, -0.25, 0.25, 2.0, 0.25, 0.25, 1.5, 0.25], [-0.25, 1.5, 0.25, -0.25, 2.0, 0.25, -0.25, 2.0, -0.25, -0.25, 1.5, -0.25]],'tex_coords':[[0.4528301886792453, 0.0, 0.4528301886792453, 0.5, 0.49056603773584906, 0.5, 0.49056603773584906, 0.0], [0.5283018867924528, 0.0, 0.5283018867924528, 0.5, 0.5660377358490566, 0.5, 0.5660377358490566, 0.0], [0.4528301886792453, 0.5, 0.4528301886792453, 1.0, 0.49056603773584906, 1.0, 0.49056603773584906, 0.5], [0.49056603773584906, 0.5, 0.49056603773584906, 1.0, 0.5283018867924528, 1.0, 0.5283018867924528, 0.5], [0.49056603773584906, 0.0, 0.49056603773584906, 0.5, 0.5283018867924528, 0.5, 0.5283018867924528, 0.0], [0.41509433962264153, 0.0, 0.41509433962264153, 0.5, 0.4528301886792453, 0.5, 0.4528301886792453, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'rightArm','pivot':[-0.3125, 1.375, 0.0],'vertices':[[-0.5, 0.75, -0.125, -0.5, 1.5, -0.125, -0.25, 1.5, -0.125, -0.25, 0.75, -0.125], [-0.25, 0.75, 0.125, -0.25, 1.5, 0.125, -0.5, 1.5, 0.125, -0.5, 0.75, 0.125], [-0.5, 1.5, -0.125, -0.5, 1.5, 0.125, -0.25, 1.5, 0.125, -0.25, 1.5, -0.125], [-0.25, 0.75, -0.125, -0.25, 0.75, 0.125, -0.5, 0.75, 0.125, -0.5, 0.75, -0.125], [-0.25, 0.75, -0.125, -0.25, 1.5, -0.125, -0.25, 1.5, 0.125, -0.25, 0.75, 0.125], [-0.5, 0.75, 0.125, -0.5, 1.5, 0.125, -0.5, 1.5, -0.125, -0.5, 0.75, -0.125]],'tex_coords':[[0.5849056603773585, 0.0, 0.5849056603773585, 0.75, 0.6037735849056604, 0.75, 0.6037735849056604, 0.0], [0.6226415094339622, 0.0, 0.6226415094339622, 0.75, 0.6415094339622641, 0.75, 0.6415094339622641, 0.0], [0.5849056603773585, 0.75, 0.5849056603773585, 1.0, 0.6037735849056604, 1.0, 0.6037735849056604, 0.75], [0.6037735849056604, 0.75, 0.6037735849056604, 1.0, 0.6226415094339622, 1.0, 0.6226415094339622, 0.75], [0.6037735849056604, 0.0, 0.6037735849056604, 0.75, 0.6226415094339622, 0.75, 0.6226415094339622, 0.0], [0.5660377358490566, 0.0, 0.5660377358490566, 0.75, 0.5849056603773585, 0.75, 0.5849056603773585, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leftArm','pivot':[0.3125, 1.375, 0.0],'vertices':[[0.7019792795181274, 0.748781681060791, -0.02643335424363613, 0.7019792795181274, 1.498781681060791, -0.02643335424363613, 0.9519792795181274, 1.498781681060791, -0.02643335424363613, 0.9519792795181274, 0.748781681060791, -0.02643335424363613], [0.9519792795181274, 0.748781681060791, 0.22356665134429932, 0.9519792795181274, 1.498781681060791, 0.22356665134429932, 0.7019792795181274, 1.498781681060791, 0.22356665134429932, 0.7019792795181274, 0.748781681060791, 0.22356665134429932], [0.7019792795181274, 1.498781681060791, -0.02643335424363613, 0.7019792795181274, 1.498781681060791, 0.22356665134429932, 0.9519792795181274, 1.498781681060791, 0.22356665134429932, 0.9519792795181274, 1.498781681060791, -0.02643335424363613], [0.9519792795181274, 0.748781681060791, -0.02643335424363613, 0.9519792795181274, 0.748781681060791, 0.22356665134429932, 0.7019792795181274, 0.748781681060791, 0.22356665134429932, 0.7019792795181274, 0.748781681060791, -0.02643335424363613], [0.9519792795181274, 0.748781681060791, -0.02643335424363613, 0.9519792795181274, 1.498781681060791, -0.02643335424363613, 0.9519792795181274, 1.498781681060791, 0.22356665134429932, 0.9519792795181274, 0.748781681060791, 0.22356665134429932], [0.7019792795181274, 0.748781681060791, 0.22356665134429932, 0.7019792795181274, 1.498781681060791, 0.22356665134429932, 0.7019792795181274, 1.498781681060791, -0.02643335424363613, 0.7019792795181274, 0.748781681060791, -0.02643335424363613], [0.09342791140079498, 1.3167552947998047, -0.06984145194292068, 0.09342791140079498, 1.5042552947998047, -0.06984145194292068, 0.7184278964996338, 1.5042552947998047, -0.06984145194292068, 0.7184278964996338, 1.3167552947998047, -0.06984145194292068], [0.7184278964996338, 1.3167552947998047, 0.18015854060649872, 0.7184278964996338, 1.5042552947998047, 0.18015854060649872, 0.09342791140079498, 1.5042552947998047, 0.18015854060649872, 0.09342791140079498, 1.3167552947998047, 0.18015854060649872], [0.09342791140079498, 1.5042552947998047, -0.06984145194292068, 0.09342791140079498, 1.5042552947998047, 0.18015854060649872, 0.7184278964996338, 1.5042552947998047, 0.18015854060649872, 0.7184278964996338, 1.5042552947998047, -0.06984145194292068], [0.7184278964996338, 1.3167552947998047, -0.06984145194292068, 0.7184278964996338, 1.3167552947998047, 0.18015854060649872, 0.09342791140079498, 1.3167552947998047, 0.18015854060649872, 0.09342791140079498, 1.3167552947998047, -0.06984145194292068], [0.7184278964996338, 1.3167552947998047, -0.06984145194292068, 0.7184278964996338, 1.5042552947998047, -0.06984145194292068, 0.7184278964996338, 1.5042552947998047, 0.18015854060649872, 0.7184278964996338, 1.3167552947998047, 0.18015854060649872], [0.09342791140079498, 1.3167552947998047, 0.18015854060649872, 0.09342791140079498, 1.5042552947998047, 0.18015854060649872, 0.09342791140079498, 1.5042552947998047, -0.06984145194292068, 0.09342791140079498, 1.3167552947998047, -0.06984145194292068]],'tex_coords':[[0.660377358490566, 0.0, 0.660377358490566, 0.75, 0.6792452830188679, 0.75, 0.6792452830188679, 0.0], [0.6981132075471698, 0.0, 0.6981132075471698, 0.75, 0.7169811320754716, 0.75, 0.7169811320754716, 0.0], [0.660377358490566, 0.75, 0.660377358490566, 1.0, 0.6792452830188679, 1.0, 0.6792452830188679, 0.75], [0.6792452830188679, 0.75, 0.6792452830188679, 1.0, 0.6981132075471698, 1.0, 0.6981132075471698, 0.75], [0.6792452830188679, 0.0, 0.6792452830188679, 0.75, 0.6981132075471698, 0.75, 0.6981132075471698, 0.0], [0.6415094339622641, 0.0, 0.6415094339622641, 0.75, 0.660377358490566, 0.75, 0.660377358490566, 0.0], [0.7358490566037735, 0.5625, 0.7358490566037735, 0.75, 0.7830188679245284, 0.75, 0.7830188679245284, 0.5625], [0.8018867924528302, 0.5625, 0.8018867924528302, 0.75, 0.8490566037735849, 0.75, 0.8490566037735849, 0.5625], [0.7358490566037735, 0.75, 0.7358490566037735, 1.0, 0.7830188679245284, 1.0, 0.7830188679245284, 0.75], [0.7830188679245284, 0.75, 0.7830188679245284, 1.0, 0.8301886792452831, 1.0, 0.8301886792452831, 0.75], [0.7830188679245284, 0.5625, 0.7830188679245284, 0.75, 0.8018867924528302, 0.75, 0.8018867924528302, 0.5625], [0.7169811320754716, 0.5625, 0.7169811320754716, 0.75, 0.7358490566037735, 0.75, 0.7358490566037735, 0.5625]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'rightLeg','pivot':[-0.11875, 0.75, 0.0],'vertices':[[-0.24375000596046448, 0.0, -0.125, -0.24375000596046448, 0.75, -0.125, 0.0062500000931322575, 0.75, -0.125, 0.0062500000931322575, 0.0, -0.125], [0.0062500000931322575, 0.0, 0.125, 0.0062500000931322575, 0.75, 0.125, -0.24375000596046448, 0.75, 0.125, -0.24375000596046448, 0.0, 0.125], [-0.24375000596046448, 0.75, -0.125, -0.24375000596046448, 0.75, 0.125, 0.0062500000931322575, 0.75, 0.125, 0.0062500000931322575, 0.75, -0.125], [0.0062500000931322575, 0.0, -0.125, 0.0062500000931322575, 0.0, 0.125, -0.24375000596046448, 0.0, 0.125, -0.24375000596046448, 0.0, -0.125], [0.0062500000931322575, 0.0, -0.125, 0.0062500000931322575, 0.75, -0.125, 0.0062500000931322575, 0.75, 0.125, 0.0062500000931322575, 0.0, 0.125], [-0.24375000596046448, 0.0, 0.125, -0.24375000596046448, 0.75, 0.125, -0.24375000596046448, 0.75, -0.125, -0.24375000596046448, 0.0, -0.125]],'tex_coords':[[0.8679245283018868, 0.0, 0.8679245283018868, 0.75, 0.8867924528301887, 0.75, 0.8867924528301887, 0.0], [0.9056603773584906, 0.0, 0.9056603773584906, 0.75, 0.9245283018867925, 0.75, 0.9245283018867925, 0.0], [0.8679245283018868, 0.75, 0.8679245283018868, 1.0, 0.8867924528301887, 1.0, 0.8867924528301887, 0.75], [0.8867924528301887, 0.75, 0.8867924528301887, 1.0, 0.9056603773584906, 1.0, 0.9056603773584906, 0.75], [0.8867924528301887, 0.0, 0.8867924528301887, 0.75, 0.9056603773584906, 0.75, 0.9056603773584906, 0.0], [0.8490566037735849, 0.0, 0.8490566037735849, 0.75, 0.8679245283018868, 0.75, 0.8679245283018868, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leftLeg','pivot':[0.11875, 0.75, 0.0],'vertices':[[-0.0062500000931322575, 0.0, -0.125, -0.0062500000931322575, 0.75, -0.125, 0.24375000596046448, 0.75, -0.125, 0.24375000596046448, 0.0, -0.125], [0.24375000596046448, 0.0, 0.125, 0.24375000596046448, 0.75, 0.125, -0.0062500000931322575, 0.75, 0.125, -0.0062500000931322575, 0.0, 0.125], [-0.0062500000931322575, 0.75, -0.125, -0.0062500000931322575, 0.75, 0.125, 0.24375000596046448, 0.75, 0.125, 0.24375000596046448, 0.75, -0.125], [0.24375000596046448, 0.0, -0.125, 0.24375000596046448, 0.0, 0.125, -0.0062500000931322575, 0.0, 0.125, -0.0062500000931322575, 0.0, -0.125], [0.24375000596046448, 0.0, -0.125, 0.24375000596046448, 0.75, -0.125, 0.24375000596046448, 0.75, 0.125, 0.24375000596046448, 0.0, 0.125], [-0.0062500000931322575, 0.0, 0.125, -0.0062500000931322575, 0.75, 0.125, -0.0062500000931322575, 0.75, -0.125, -0.0062500000931322575, 0.0, -0.125]],'tex_coords':[[0.9433962264150944, 0.0, 0.9433962264150944, 0.75, 0.9622641509433962, 0.75, 0.9622641509433962, 0.0], [0.9811320754716981, 0.0, 0.9811320754716981, 0.75, 1.0, 0.75, 1.0, 0.0], [0.9433962264150944, 0.75, 0.9433962264150944, 1.0, 0.9622641509433962, 1.0, 0.9622641509433962, 0.75], [0.9622641509433962, 0.75, 0.9622641509433962, 1.0, 0.9811320754716981, 1.0, 0.9811320754716981, 0.75], [0.9622641509433962, 0.0, 0.9622641509433962, 0.75, 0.9811320754716981, 0.75, 0.9811320754716981, 0.0], [0.9245283018867925, 0.0, 0.9245283018867925, 0.75, 0.9433962264150944, 0.75, 0.9433962264150944, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}] diff --git a/community/models/door.py b/community/models/door.py index b34a2f9d..74bcb7bb 100644 --- a/community/models/door.py +++ b/community/models/door.py @@ -1,10 +1,9 @@ -transparent = 0 +transparent = False +transparency = 0 is_cube = True glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/fire.py b/community/models/fire.py index 0ff98b1d..84edeec7 100644 --- a/community/models/fire.py +++ b/community/models/fire.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/flat.py b/community/models/flat.py index 8d5e40f3..75f8cfdd 100644 --- a/community/models/flat.py +++ b/community/models/flat.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/glass.py b/community/models/glass.py index d259bf90..a204622e 100644 --- a/community/models/glass.py +++ b/community/models/glass.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = True glass = True translucent = False -# fmt: off - colliders = [ [ (-0.5, -0.5, -0.5), diff --git a/community/models/ladder.py b/community/models/ladder.py index 0ff98b1d..84edeec7 100644 --- a/community/models/ladder.py +++ b/community/models/ladder.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/leaves.py b/community/models/leaves.py index ea004e08..3e0c2b91 100644 --- a/community/models/leaves.py +++ b/community/models/leaves.py @@ -1,10 +1,9 @@ -transparent = 1 +transparent = True +transparency = 1 is_cube = True glass = False translucent = False -# fmt: off - colliders = [ [ (-0.5, -0.5, -0.5), diff --git a/community/models/lever.py b/community/models/lever.py index 46359dd6..87f38e7d 100644 --- a/community/models/lever.py +++ b/community/models/lever.py @@ -1,10 +1,9 @@ -transparent = 1 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/liquid.py b/community/models/liquid.py index 6df86bcf..635adbb3 100644 --- a/community/models/liquid.py +++ b/community/models/liquid.py @@ -1,12 +1,10 @@ # in the end, it'd be nice to have it so that liquids fill up the whole block when they have a block above them # this would avoid the problems this solution has - -transparent = 1 +transparent = False +transparency = 0 is_cube = True -glass = True -translucent = True - -# fmt: off +glass = False +translucent = False colliders = [] diff --git a/community/models/pig.py b/community/models/pig.py new file mode 100644 index 00000000..eddfc53d --- /dev/null +++ b/community/models/pig.py @@ -0,0 +1,8 @@ + +transparent = True +is_cube = False +glass = False + +colliders = [] + +bones = [{'name':'body','pivot':[0.0, 0.8125, 0.125],'vertices':[[-0.3124999701976776, 0.3750000298023224, 0.5, -0.3124999701976776, 0.375, -0.5, 0.3124999701976776, 0.375, -0.5, 0.3124999701976776, 0.3750000298023224, 0.5], [0.3124999701976776, 0.8750000596046448, 0.5, 0.3124999701976776, 0.875, -0.5, -0.3124999701976776, 0.875, -0.5, -0.3124999701976776, 0.8750000596046448, 0.5], [-0.3124999701976776, 0.375, -0.5, -0.3124999701976776, 0.875, -0.5, 0.3124999701976776, 0.875, -0.5, 0.3124999701976776, 0.375, -0.5], [0.3124999701976776, 0.3750000298023224, 0.5, 0.3124999701976776, 0.8750000596046448, 0.5, -0.3124999701976776, 0.8750000596046448, 0.5, -0.3124999701976776, 0.3750000298023224, 0.5], [0.3124999701976776, 0.3750000298023224, 0.5, 0.3124999701976776, 0.375, -0.5, 0.3124999701976776, 0.875, -0.5, 0.3124999701976776, 0.8750000596046448, 0.5], [-0.3124999701976776, 0.8750000596046448, 0.5, -0.3124999701976776, 0.875, -0.5, -0.3124999701976776, 0.375, -0.5, -0.3124999701976776, 0.3750000298023224, 0.5]],'tex_coords':[[0.056338028169014086, 0.0, 0.056338028169014086, 0.6666666666666667, 0.1267605633802817, 0.6666666666666667, 0.1267605633802817, 0.0], [0.18309859154929578, 0.0, 0.18309859154929578, 0.6666666666666667, 0.2535211267605634, 0.6666666666666667, 0.2535211267605634, 0.0], [0.056338028169014086, 0.6666666666666667, 0.056338028169014086, 1.0, 0.1267605633802817, 1.0, 0.1267605633802817, 0.6666666666666667], [0.1267605633802817, 0.6666666666666667, 0.1267605633802817, 1.0, 0.19718309859154928, 1.0, 0.19718309859154928, 0.6666666666666667], [0.1267605633802817, 0.0, 0.1267605633802817, 0.6666666666666667, 0.18309859154929578, 0.6666666666666667, 0.18309859154929578, 0.0], [0.0, 0.0, 0.0, 0.6666666666666667, 0.056338028169014086, 0.6666666666666667, 0.056338028169014086, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'head','pivot':[0.0, 0.75, -0.375],'vertices':[[-0.25, 0.5, -0.875, -0.25, 1.0, -0.875, 0.25, 1.0, -0.875, 0.25, 0.5, -0.875], [0.25, 0.5, -0.375, 0.25, 1.0, -0.375, -0.25, 1.0, -0.375, -0.25, 0.5, -0.375], [-0.25, 1.0, -0.875, -0.25, 1.0, -0.375, 0.25, 1.0, -0.375, 0.25, 1.0, -0.875], [0.25, 0.5, -0.875, 0.25, 0.5, -0.375, -0.25, 0.5, -0.375, -0.25, 0.5, -0.875], [0.25, 0.5, -0.875, 0.25, 1.0, -0.875, 0.25, 1.0, -0.375, 0.25, 0.5, -0.375], [-0.25, 0.5, -0.375, -0.25, 1.0, -0.375, -0.25, 1.0, -0.875, -0.25, 0.5, -0.875], [-0.125, 0.5625, -0.9375, -0.125, 0.75, -0.9375, 0.125, 0.75, -0.9375, 0.125, 0.5625, -0.9375], [0.125, 0.5625, -0.875, 0.125, 0.75, -0.875, -0.125, 0.75, -0.875, -0.125, 0.5625, -0.875], [-0.125, 0.75, -0.9375, -0.125, 0.75, -0.875, 0.125, 0.75, -0.875, 0.125, 0.75, -0.9375], [0.125, 0.5625, -0.9375, 0.125, 0.5625, -0.875, -0.125, 0.5625, -0.875, -0.125, 0.5625, -0.9375], [0.125, 0.5625, -0.9375, 0.125, 0.75, -0.9375, 0.125, 0.75, -0.875, 0.125, 0.5625, -0.875], [-0.125, 0.5625, -0.875, -0.125, 0.75, -0.875, -0.125, 0.75, -0.9375, -0.125, 0.5625, -0.9375]],'tex_coords':[[0.30985915492957744, 0.33333333333333337, 0.30985915492957744, 0.6666666666666667, 0.36619718309859156, 0.6666666666666667, 0.36619718309859156, 0.33333333333333337], [0.4225352112676056, 0.33333333333333337, 0.4225352112676056, 0.6666666666666667, 0.4788732394366197, 0.6666666666666667, 0.4788732394366197, 0.33333333333333337], [0.30985915492957744, 0.6666666666666667, 0.30985915492957744, 1.0, 0.36619718309859156, 1.0, 0.36619718309859156, 0.6666666666666667], [0.36619718309859156, 0.6666666666666667, 0.36619718309859156, 1.0, 0.4225352112676056, 1.0, 0.4225352112676056, 0.6666666666666667], [0.36619718309859156, 0.33333333333333337, 0.36619718309859156, 0.6666666666666667, 0.4225352112676056, 0.6666666666666667, 0.4225352112676056, 0.33333333333333337], [0.2535211267605634, 0.33333333333333337, 0.2535211267605634, 0.6666666666666667, 0.30985915492957744, 0.6666666666666667, 0.30985915492957744, 0.33333333333333337], [0.4859154929577465, 0.8333333333333334, 0.4859154929577465, 0.9583333333333334, 0.5140845070422535, 0.9583333333333334, 0.5140845070422535, 0.8333333333333334], [0.5211267605633803, 0.8333333333333334, 0.5211267605633803, 0.9583333333333334, 0.5492957746478874, 0.9583333333333334, 0.5492957746478874, 0.8333333333333334], [0.4859154929577465, 0.9583333333333334, 0.4859154929577465, 1.0, 0.5140845070422535, 1.0, 0.5140845070422535, 0.9583333333333334], [0.5140845070422535, 0.9583333333333334, 0.5140845070422535, 1.0, 0.5422535211267606, 1.0, 0.5422535211267606, 0.9583333333333334], [0.5140845070422535, 0.8333333333333334, 0.5140845070422535, 0.9583333333333334, 0.5211267605633803, 0.9583333333333334, 0.5211267605633803, 0.8333333333333334], [0.4788732394366197, 0.8333333333333334, 0.4788732394366197, 0.9583333333333334, 0.4859154929577465, 0.9583333333333334, 0.4859154929577465, 0.8333333333333334]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg0','pivot':[-0.1875, 0.375, 0.4375],'vertices':[[-0.3125, 0.0, 0.3125, -0.3125, 0.375, 0.3125, -0.0625, 0.375, 0.3125, -0.0625, 0.0, 0.3125], [-0.0625, 0.0, 0.5625, -0.0625, 0.375, 0.5625, -0.3125, 0.375, 0.5625, -0.3125, 0.0, 0.5625], [-0.3125, 0.375, 0.3125, -0.3125, 0.375, 0.5625, -0.0625, 0.375, 0.5625, -0.0625, 0.375, 0.3125], [-0.0625, 0.0, 0.3125, -0.0625, 0.0, 0.5625, -0.3125, 0.0, 0.5625, -0.3125, 0.0, 0.3125], [-0.0625, 0.0, 0.3125, -0.0625, 0.375, 0.3125, -0.0625, 0.375, 0.5625, -0.0625, 0.0, 0.5625], [-0.3125, 0.0, 0.5625, -0.3125, 0.375, 0.5625, -0.3125, 0.375, 0.3125, -0.3125, 0.0, 0.3125]],'tex_coords':[[0.5774647887323944, 0.5833333333333333, 0.5774647887323944, 0.8333333333333334, 0.6056338028169014, 0.8333333333333334, 0.6056338028169014, 0.5833333333333333], [0.6338028169014085, 0.5833333333333333, 0.6338028169014085, 0.8333333333333334, 0.6619718309859155, 0.8333333333333334, 0.6619718309859155, 0.5833333333333333], [0.5774647887323944, 0.8333333333333334, 0.5774647887323944, 1.0, 0.6056338028169014, 1.0, 0.6056338028169014, 0.8333333333333334], [0.6056338028169014, 0.8333333333333334, 0.6056338028169014, 1.0, 0.6338028169014085, 1.0, 0.6338028169014085, 0.8333333333333334], [0.6056338028169014, 0.5833333333333333, 0.6056338028169014, 0.8333333333333334, 0.6338028169014085, 0.8333333333333334, 0.6338028169014085, 0.5833333333333333], [0.5492957746478874, 0.5833333333333333, 0.5492957746478874, 0.8333333333333334, 0.5774647887323944, 0.8333333333333334, 0.5774647887323944, 0.5833333333333333]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg1','pivot':[0.1875, 0.375, 0.4375],'vertices':[[0.0625, 0.0, 0.3125, 0.0625, 0.375, 0.3125, 0.3125, 0.375, 0.3125, 0.3125, 0.0, 0.3125], [0.3125, 0.0, 0.5625, 0.3125, 0.375, 0.5625, 0.0625, 0.375, 0.5625, 0.0625, 0.0, 0.5625], [0.0625, 0.375, 0.3125, 0.0625, 0.375, 0.5625, 0.3125, 0.375, 0.5625, 0.3125, 0.375, 0.3125], [0.3125, 0.0, 0.3125, 0.3125, 0.0, 0.5625, 0.0625, 0.0, 0.5625, 0.0625, 0.0, 0.3125], [0.3125, 0.0, 0.3125, 0.3125, 0.375, 0.3125, 0.3125, 0.375, 0.5625, 0.3125, 0.0, 0.5625], [0.0625, 0.0, 0.5625, 0.0625, 0.375, 0.5625, 0.0625, 0.375, 0.3125, 0.0625, 0.0, 0.3125]],'tex_coords':[[0.6901408450704225, 0.5833333333333333, 0.6901408450704225, 0.8333333333333334, 0.7183098591549296, 0.8333333333333334, 0.7183098591549296, 0.5833333333333333], [0.7464788732394366, 0.5833333333333333, 0.7464788732394366, 0.8333333333333334, 0.7746478873239436, 0.8333333333333334, 0.7746478873239436, 0.5833333333333333], [0.6901408450704225, 0.8333333333333334, 0.6901408450704225, 1.0, 0.7183098591549296, 1.0, 0.7183098591549296, 0.8333333333333334], [0.7183098591549296, 0.8333333333333334, 0.7183098591549296, 1.0, 0.7464788732394366, 1.0, 0.7464788732394366, 0.8333333333333334], [0.7183098591549296, 0.5833333333333333, 0.7183098591549296, 0.8333333333333334, 0.7464788732394366, 0.8333333333333334, 0.7464788732394366, 0.5833333333333333], [0.6619718309859155, 0.5833333333333333, 0.6619718309859155, 0.8333333333333334, 0.6901408450704225, 0.8333333333333334, 0.6901408450704225, 0.5833333333333333]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg2','pivot':[-0.1875, 0.375, -0.3125],'vertices':[[-0.3125, 0.0, -0.4375, -0.3125, 0.375, -0.4375, -0.0625, 0.375, -0.4375, -0.0625, 0.0, -0.4375], [-0.0625, 0.0, -0.1875, -0.0625, 0.375, -0.1875, -0.3125, 0.375, -0.1875, -0.3125, 0.0, -0.1875], [-0.3125, 0.375, -0.4375, -0.3125, 0.375, -0.1875, -0.0625, 0.375, -0.1875, -0.0625, 0.375, -0.4375], [-0.0625, 0.0, -0.4375, -0.0625, 0.0, -0.1875, -0.3125, 0.0, -0.1875, -0.3125, 0.0, -0.4375], [-0.0625, 0.0, -0.4375, -0.0625, 0.375, -0.4375, -0.0625, 0.375, -0.1875, -0.0625, 0.0, -0.1875], [-0.3125, 0.0, -0.1875, -0.3125, 0.375, -0.1875, -0.3125, 0.375, -0.4375, -0.3125, 0.0, -0.4375]],'tex_coords':[[0.8028169014084507, 0.5833333333333333, 0.8028169014084507, 0.8333333333333334, 0.8309859154929577, 0.8333333333333334, 0.8309859154929577, 0.5833333333333333], [0.8591549295774648, 0.5833333333333333, 0.8591549295774648, 0.8333333333333334, 0.8873239436619719, 0.8333333333333334, 0.8873239436619719, 0.5833333333333333], [0.8028169014084507, 0.8333333333333334, 0.8028169014084507, 1.0, 0.8309859154929577, 1.0, 0.8309859154929577, 0.8333333333333334], [0.8309859154929577, 0.8333333333333334, 0.8309859154929577, 1.0, 0.8591549295774648, 1.0, 0.8591549295774648, 0.8333333333333334], [0.8309859154929577, 0.5833333333333333, 0.8309859154929577, 0.8333333333333334, 0.8591549295774648, 0.8333333333333334, 0.8591549295774648, 0.5833333333333333], [0.7746478873239436, 0.5833333333333333, 0.7746478873239436, 0.8333333333333334, 0.8028169014084507, 0.8333333333333334, 0.8028169014084507, 0.5833333333333333]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leg3','pivot':[0.1875, 0.375, -0.3125],'vertices':[[0.0625, 0.0, -0.4375, 0.0625, 0.375, -0.4375, 0.3125, 0.375, -0.4375, 0.3125, 0.0, -0.4375], [0.3125, 0.0, -0.1875, 0.3125, 0.375, -0.1875, 0.0625, 0.375, -0.1875, 0.0625, 0.0, -0.1875], [0.0625, 0.375, -0.4375, 0.0625, 0.375, -0.1875, 0.3125, 0.375, -0.1875, 0.3125, 0.375, -0.4375], [0.3125, 0.0, -0.4375, 0.3125, 0.0, -0.1875, 0.0625, 0.0, -0.1875, 0.0625, 0.0, -0.4375], [0.3125, 0.0, -0.4375, 0.3125, 0.375, -0.4375, 0.3125, 0.375, -0.1875, 0.3125, 0.0, -0.1875], [0.0625, 0.0, -0.1875, 0.0625, 0.375, -0.1875, 0.0625, 0.375, -0.4375, 0.0625, 0.0, -0.4375]],'tex_coords':[[0.9154929577464789, 0.5833333333333333, 0.9154929577464789, 0.8333333333333334, 0.9436619718309859, 0.8333333333333334, 0.9436619718309859, 0.5833333333333333], [0.971830985915493, 0.5833333333333333, 0.971830985915493, 0.8333333333333334, 1.0, 0.8333333333333334, 1.0, 0.5833333333333333], [0.9154929577464789, 0.8333333333333334, 0.9154929577464789, 1.0, 0.9436619718309859, 1.0, 0.9436619718309859, 0.8333333333333334], [0.9436619718309859, 0.8333333333333334, 0.9436619718309859, 1.0, 0.971830985915493, 1.0, 0.971830985915493, 0.8333333333333334], [0.9436619718309859, 0.5833333333333333, 0.9436619718309859, 0.8333333333333334, 0.971830985915493, 0.8333333333333334, 0.971830985915493, 0.5833333333333333], [0.8873239436619719, 0.5833333333333333, 0.8873239436619719, 0.8333333333333334, 0.9154929577464789, 0.8333333333333334, 0.9154929577464789, 0.5833333333333333]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}] diff --git a/community/models/plant.py b/community/models/plant.py index 0ff98b1d..9aa6a127 100644 --- a/community/models/plant.py +++ b/community/models/plant.py @@ -1,9 +1,8 @@ -transparent = 2 +transparent = True +transparency = 2 +translucent = False is_cube = False glass = False -translucent = False - -# fmt: off colliders = [] diff --git a/community/models/pressure_plate.py b/community/models/pressure_plate.py index 8d5e40f3..75f8cfdd 100644 --- a/community/models/pressure_plate.py +++ b/community/models/pressure_plate.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/sign.py b/community/models/sign.py index 0ff98b1d..84edeec7 100644 --- a/community/models/sign.py +++ b/community/models/sign.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/sign_post.py b/community/models/sign_post.py index 0ff98b1d..84edeec7 100644 --- a/community/models/sign_post.py +++ b/community/models/sign_post.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/skeleton.py b/community/models/skeleton.py new file mode 100644 index 00000000..003cd6c2 --- /dev/null +++ b/community/models/skeleton.py @@ -0,0 +1,8 @@ + +transparent = True +is_cube = False +glass = False + +colliders = [] + +bones = [{'name':'body','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 0.75, -0.125, -0.25, 1.5, -0.125, 0.25, 1.5, -0.125, 0.25, 0.75, -0.125], [0.25, 0.75, 0.125, 0.25, 1.5, 0.125, -0.25, 1.5, 0.125, -0.25, 0.75, 0.125], [-0.25, 1.5, -0.125, -0.25, 1.5, 0.125, 0.25, 1.5, 0.125, 0.25, 1.5, -0.125], [0.25, 0.75, -0.125, 0.25, 0.75, 0.125, -0.25, 0.75, 0.125, -0.25, 0.75, -0.125], [0.25, 0.75, -0.125, 0.25, 1.5, -0.125, 0.25, 1.5, 0.125, 0.25, 0.75, 0.125], [-0.25, 0.75, 0.125, -0.25, 1.5, 0.125, -0.25, 1.5, -0.125, -0.25, 0.75, -0.125]],'tex_coords':[[0.03333333333333333, 0.0, 0.03333333333333333, 0.75, 0.1, 0.75, 0.1, 0.0], [0.13333333333333333, 0.0, 0.13333333333333333, 0.75, 0.2, 0.75, 0.2, 0.0], [0.03333333333333333, 0.75, 0.03333333333333333, 1.0, 0.1, 1.0, 0.1, 0.75], [0.1, 0.75, 0.1, 1.0, 0.16666666666666666, 1.0, 0.16666666666666666, 0.75], [0.1, 0.0, 0.1, 0.75, 0.13333333333333333, 0.75, 0.13333333333333333, 0.0], [0.0, 0.0, 0.0, 0.75, 0.03333333333333333, 0.75, 0.03333333333333333, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'head','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 1.5, -0.25, -0.25, 2.0, -0.25, 0.25, 2.0, -0.25, 0.25, 1.5, -0.25], [0.25, 1.5, 0.25, 0.25, 2.0, 0.25, -0.25, 2.0, 0.25, -0.25, 1.5, 0.25], [-0.25, 2.0, -0.25, -0.25, 2.0, 0.25, 0.25, 2.0, 0.25, 0.25, 2.0, -0.25], [0.25, 1.5, -0.25, 0.25, 1.5, 0.25, -0.25, 1.5, 0.25, -0.25, 1.5, -0.25], [0.25, 1.5, -0.25, 0.25, 2.0, -0.25, 0.25, 2.0, 0.25, 0.25, 1.5, 0.25], [-0.25, 1.5, 0.25, -0.25, 2.0, 0.25, -0.25, 2.0, -0.25, -0.25, 1.5, -0.25]],'tex_coords':[[0.26666666666666666, 0.0, 0.26666666666666666, 0.5, 0.3333333333333333, 0.5, 0.3333333333333333, 0.0], [0.4, 0.0, 0.4, 0.5, 0.4666666666666667, 0.5, 0.4666666666666667, 0.0], [0.26666666666666666, 0.5, 0.26666666666666666, 1.0, 0.3333333333333333, 1.0, 0.3333333333333333, 0.5], [0.3333333333333333, 0.5, 0.3333333333333333, 1.0, 0.4, 1.0, 0.4, 0.5], [0.3333333333333333, 0.0, 0.3333333333333333, 0.5, 0.4, 0.5, 0.4, 0.0], [0.2, 0.0, 0.2, 0.5, 0.26666666666666666, 0.5, 0.26666666666666666, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'hat','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 1.5, -0.25, -0.25, 2.0, -0.25, 0.25, 2.0, -0.25, 0.25, 1.5, -0.25], [0.25, 1.5, 0.25, 0.25, 2.0, 0.25, -0.25, 2.0, 0.25, -0.25, 1.5, 0.25], [-0.25, 2.0, -0.25, -0.25, 2.0, 0.25, 0.25, 2.0, 0.25, 0.25, 2.0, -0.25], [0.25, 1.5, -0.25, 0.25, 1.5, 0.25, -0.25, 1.5, 0.25, -0.25, 1.5, -0.25], [0.25, 1.5, -0.25, 0.25, 2.0, -0.25, 0.25, 2.0, 0.25, 0.25, 1.5, 0.25], [-0.25, 1.5, 0.25, -0.25, 2.0, 0.25, -0.25, 2.0, -0.25, -0.25, 1.5, -0.25]],'tex_coords':[[0.5333333333333333, 0.0, 0.5333333333333333, 0.5, 0.6, 0.5, 0.6, 0.0], [0.6666666666666666, 0.0, 0.6666666666666666, 0.5, 0.7333333333333333, 0.5, 0.7333333333333333, 0.0], [0.5333333333333333, 0.5, 0.5333333333333333, 1.0, 0.6, 1.0, 0.6, 0.5], [0.6, 0.5, 0.6, 1.0, 0.6666666666666666, 1.0, 0.6666666666666666, 0.5], [0.6, 0.0, 0.6, 0.5, 0.6666666666666666, 0.5, 0.6666666666666666, 0.0], [0.4666666666666667, 0.0, 0.4666666666666667, 0.5, 0.5333333333333333, 0.5, 0.5333333333333333, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'rightArm','pivot':[-0.3125, 1.375, 0.0],'vertices':[[-0.375, 0.75, -0.0625, -0.375, 1.5, -0.0625, -0.25, 1.5, -0.0625, -0.25, 0.75, -0.0625], [-0.25, 0.75, 0.0625, -0.25, 1.5, 0.0625, -0.375, 1.5, 0.0625, -0.375, 0.75, 0.0625], [-0.375, 1.5, -0.0625, -0.375, 1.5, 0.0625, -0.25, 1.5, 0.0625, -0.25, 1.5, -0.0625], [-0.25, 0.75, -0.0625, -0.25, 0.75, 0.0625, -0.375, 0.75, 0.0625, -0.375, 0.75, -0.0625], [-0.25, 0.75, -0.0625, -0.25, 1.5, -0.0625, -0.25, 1.5, 0.0625, -0.25, 0.75, 0.0625], [-0.375, 0.75, 0.0625, -0.375, 1.5, 0.0625, -0.375, 1.5, -0.0625, -0.375, 0.75, -0.0625]],'tex_coords':[[0.75, 0.125, 0.75, 0.875, 0.7666666666666667, 0.875, 0.7666666666666667, 0.125], [0.7833333333333333, 0.125, 0.7833333333333333, 0.875, 0.8, 0.875, 0.8, 0.125], [0.75, 0.875, 0.75, 1.0, 0.7666666666666667, 1.0, 0.7666666666666667, 0.875], [0.7666666666666667, 0.875, 0.7666666666666667, 1.0, 0.7833333333333333, 1.0, 0.7833333333333333, 0.875], [0.7666666666666667, 0.125, 0.7666666666666667, 0.875, 0.7833333333333333, 0.875, 0.7833333333333333, 0.125], [0.7333333333333333, 0.125, 0.7333333333333333, 0.875, 0.75, 0.875, 0.75, 0.125]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leftArm','pivot':[0.3125, 1.375, 0.0],'vertices':[[0.25, 0.75, -0.0625, 0.25, 1.5, -0.0625, 0.375, 1.5, -0.0625, 0.375, 0.75, -0.0625], [0.375, 0.75, 0.0625, 0.375, 1.5, 0.0625, 0.25, 1.5, 0.0625, 0.25, 0.75, 0.0625], [0.25, 1.5, -0.0625, 0.25, 1.5, 0.0625, 0.375, 1.5, 0.0625, 0.375, 1.5, -0.0625], [0.375, 0.75, -0.0625, 0.375, 0.75, 0.0625, 0.25, 0.75, 0.0625, 0.25, 0.75, -0.0625], [0.375, 0.75, -0.0625, 0.375, 1.5, -0.0625, 0.375, 1.5, 0.0625, 0.375, 0.75, 0.0625], [0.25, 0.75, 0.0625, 0.25, 1.5, 0.0625, 0.25, 1.5, -0.0625, 0.25, 0.75, -0.0625]],'tex_coords':[[0.8166666666666667, 0.125, 0.8166666666666667, 0.875, 0.8333333333333334, 0.875, 0.8333333333333334, 0.125], [0.85, 0.125, 0.85, 0.875, 0.8666666666666667, 0.875, 0.8666666666666667, 0.125], [0.8166666666666667, 0.875, 0.8166666666666667, 1.0, 0.8333333333333334, 1.0, 0.8333333333333334, 0.875], [0.8333333333333334, 0.875, 0.8333333333333334, 1.0, 0.85, 1.0, 0.85, 0.875], [0.8333333333333334, 0.125, 0.8333333333333334, 0.875, 0.85, 0.875, 0.85, 0.125], [0.8, 0.125, 0.8, 0.875, 0.8166666666666667, 0.875, 0.8166666666666667, 0.125]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'rightLeg','pivot':[-0.125, 0.75, 0.0],'vertices':[[-0.1875, 0.0, -0.0625, -0.1875, 0.75, -0.0625, -0.0625, 0.75, -0.0625, -0.0625, 0.0, -0.0625], [-0.0625, 0.0, 0.0625, -0.0625, 0.75, 0.0625, -0.1875, 0.75, 0.0625, -0.1875, 0.0, 0.0625], [-0.1875, 0.75, -0.0625, -0.1875, 0.75, 0.0625, -0.0625, 0.75, 0.0625, -0.0625, 0.75, -0.0625], [-0.0625, 0.0, -0.0625, -0.0625, 0.0, 0.0625, -0.1875, 0.0, 0.0625, -0.1875, 0.0, -0.0625], [-0.0625, 0.0, -0.0625, -0.0625, 0.75, -0.0625, -0.0625, 0.75, 0.0625, -0.0625, 0.0, 0.0625], [-0.1875, 0.0, 0.0625, -0.1875, 0.75, 0.0625, -0.1875, 0.75, -0.0625, -0.1875, 0.0, -0.0625]],'tex_coords':[[0.8833333333333333, 0.125, 0.8833333333333333, 0.875, 0.9, 0.875, 0.9, 0.125], [0.9166666666666666, 0.125, 0.9166666666666666, 0.875, 0.9333333333333333, 0.875, 0.9333333333333333, 0.125], [0.8833333333333333, 0.875, 0.8833333333333333, 1.0, 0.9, 1.0, 0.9, 0.875], [0.9, 0.875, 0.9, 1.0, 0.9166666666666666, 1.0, 0.9166666666666666, 0.875], [0.9, 0.125, 0.9, 0.875, 0.9166666666666666, 0.875, 0.9166666666666666, 0.125], [0.8666666666666667, 0.125, 0.8666666666666667, 0.875, 0.8833333333333333, 0.875, 0.8833333333333333, 0.125]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leftLeg','pivot':[0.125, 0.75, 0.0],'vertices':[[0.0625, 0.0, -0.0625, 0.0625, 0.75, -0.0625, 0.1875, 0.75, -0.0625, 0.1875, 0.0, -0.0625], [0.1875, 0.0, 0.0625, 0.1875, 0.75, 0.0625, 0.0625, 0.75, 0.0625, 0.0625, 0.0, 0.0625], [0.0625, 0.75, -0.0625, 0.0625, 0.75, 0.0625, 0.1875, 0.75, 0.0625, 0.1875, 0.75, -0.0625], [0.1875, 0.0, -0.0625, 0.1875, 0.0, 0.0625, 0.0625, 0.0, 0.0625, 0.0625, 0.0, -0.0625], [0.1875, 0.0, -0.0625, 0.1875, 0.75, -0.0625, 0.1875, 0.75, 0.0625, 0.1875, 0.0, 0.0625], [0.0625, 0.0, 0.0625, 0.0625, 0.75, 0.0625, 0.0625, 0.75, -0.0625, 0.0625, 0.0, -0.0625]],'tex_coords':[[0.95, 0.125, 0.95, 0.875, 0.9666666666666667, 0.875, 0.9666666666666667, 0.125], [0.9833333333333333, 0.125, 0.9833333333333333, 0.875, 1.0, 0.875, 1.0, 0.125], [0.95, 0.875, 0.95, 1.0, 0.9666666666666667, 1.0, 0.9666666666666667, 0.875], [0.9666666666666667, 0.875, 0.9666666666666667, 1.0, 0.9833333333333333, 1.0, 0.9833333333333333, 0.875], [0.9666666666666667, 0.125, 0.9666666666666667, 0.875, 0.9833333333333333, 0.875, 0.9833333333333333, 0.125], [0.9333333333333333, 0.125, 0.9333333333333333, 0.875, 0.95, 0.875, 0.95, 0.125]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}] diff --git a/community/models/slab.py b/community/models/slab.py index e2932597..794cc01e 100644 --- a/community/models/slab.py +++ b/community/models/slab.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [ [ (-0.5, -0.5, -0.5), diff --git a/community/models/snow.py b/community/models/snow.py index 0c02b11d..4a2bab4e 100644 --- a/community/models/snow.py +++ b/community/models/snow.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [ [ (-0.5, -0.5000, -0.5), diff --git a/community/models/soil.py b/community/models/soil.py index 2a77a097..b54d522e 100644 --- a/community/models/soil.py +++ b/community/models/soil.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [ [ (-0.5, -0.5000, -0.5), diff --git a/community/models/stairs.py b/community/models/stairs.py index e2932597..794cc01e 100644 --- a/community/models/stairs.py +++ b/community/models/stairs.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [ [ (-0.5, -0.5, -0.5), diff --git a/community/models/tinted_glass.py b/community/models/tinted_glass.py index a2b247e6..c5b6daee 100644 --- a/community/models/tinted_glass.py +++ b/community/models/tinted_glass.py @@ -1,10 +1,9 @@ -transparent = 1 +transparent = True +transparency = 1 is_cube = True glass = True translucent = True -# fmt: off - colliders = [ [ (-0.5, -0.5, -0.5), diff --git a/community/models/torch.py b/community/models/torch.py index 32e37d65..37d47795 100644 --- a/community/models/torch.py +++ b/community/models/torch.py @@ -1,10 +1,9 @@ -transparent = 2 +transparent = True +transparency = 2 is_cube = False glass = False translucent = False -# fmt: off - colliders = [] vertex_positions = [ diff --git a/community/models/zombie.py b/community/models/zombie.py new file mode 100644 index 00000000..d1650af9 --- /dev/null +++ b/community/models/zombie.py @@ -0,0 +1,8 @@ + +transparent = True +is_cube = False +glass = False + +colliders = [] + +bones = [{'name':'body','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 0.75, -0.125, -0.25, 1.5, -0.125, 0.25, 1.5, -0.125, 0.25, 0.75, -0.125], [0.25, 0.75, 0.125, 0.25, 1.5, 0.125, -0.25, 1.5, 0.125, -0.25, 0.75, 0.125], [-0.25, 1.5, -0.125, -0.25, 1.5, 0.125, 0.25, 1.5, 0.125, 0.25, 1.5, -0.125], [0.25, 0.75, -0.125, 0.25, 0.75, 0.125, -0.25, 0.75, 0.125, -0.25, 0.75, -0.125], [0.25, 0.75, -0.125, 0.25, 1.5, -0.125, 0.25, 1.5, 0.125, 0.25, 0.75, 0.125], [-0.25, 0.75, 0.125, -0.25, 1.5, 0.125, -0.25, 1.5, -0.125, -0.25, 0.75, -0.125]],'tex_coords':[[0.02631578947368421, 0.0, 0.02631578947368421, 0.75, 0.07894736842105263, 0.75, 0.07894736842105263, 0.0], [0.10526315789473684, 0.0, 0.10526315789473684, 0.75, 0.15789473684210525, 0.75, 0.15789473684210525, 0.0], [0.02631578947368421, 0.75, 0.02631578947368421, 1.0, 0.07894736842105263, 1.0, 0.07894736842105263, 0.75], [0.07894736842105263, 0.75, 0.07894736842105263, 1.0, 0.13157894736842105, 1.0, 0.13157894736842105, 0.75], [0.07894736842105263, 0.0, 0.07894736842105263, 0.75, 0.10526315789473684, 0.75, 0.10526315789473684, 0.0], [0.0, 0.0, 0.0, 0.75, 0.02631578947368421, 0.75, 0.02631578947368421, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'head','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 1.5, -0.25, -0.25, 2.0, -0.25, 0.25, 2.0, -0.25, 0.25, 1.5, -0.25], [0.25, 1.5, 0.25, 0.25, 2.0, 0.25, -0.25, 2.0, 0.25, -0.25, 1.5, 0.25], [-0.25, 2.0, -0.25, -0.25, 2.0, 0.25, 0.25, 2.0, 0.25, 0.25, 2.0, -0.25], [0.25, 1.5, -0.25, 0.25, 1.5, 0.25, -0.25, 1.5, 0.25, -0.25, 1.5, -0.25], [0.25, 1.5, -0.25, 0.25, 2.0, -0.25, 0.25, 2.0, 0.25, 0.25, 1.5, 0.25], [-0.25, 1.5, 0.25, -0.25, 2.0, 0.25, -0.25, 2.0, -0.25, -0.25, 1.5, -0.25]],'tex_coords':[[0.21052631578947367, 0.0, 0.21052631578947367, 0.5, 0.2631578947368421, 0.5, 0.2631578947368421, 0.0], [0.3157894736842105, 0.0, 0.3157894736842105, 0.5, 0.3684210526315789, 0.5, 0.3684210526315789, 0.0], [0.21052631578947367, 0.5, 0.21052631578947367, 1.0, 0.2631578947368421, 1.0, 0.2631578947368421, 0.5], [0.2631578947368421, 0.5, 0.2631578947368421, 1.0, 0.3157894736842105, 1.0, 0.3157894736842105, 0.5], [0.2631578947368421, 0.0, 0.2631578947368421, 0.5, 0.3157894736842105, 0.5, 0.3157894736842105, 0.0], [0.15789473684210525, 0.0, 0.15789473684210525, 0.5, 0.21052631578947367, 0.5, 0.21052631578947367, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'hat','pivot':[0.0, 1.5, 0.0],'vertices':[[-0.25, 1.5, -0.25, -0.25, 2.0, -0.25, 0.25, 2.0, -0.25, 0.25, 1.5, -0.25], [0.25, 1.5, 0.25, 0.25, 2.0, 0.25, -0.25, 2.0, 0.25, -0.25, 1.5, 0.25], [-0.25, 2.0, -0.25, -0.25, 2.0, 0.25, 0.25, 2.0, 0.25, 0.25, 2.0, -0.25], [0.25, 1.5, -0.25, 0.25, 1.5, 0.25, -0.25, 1.5, 0.25, -0.25, 1.5, -0.25], [0.25, 1.5, -0.25, 0.25, 2.0, -0.25, 0.25, 2.0, 0.25, 0.25, 1.5, 0.25], [-0.25, 1.5, 0.25, -0.25, 2.0, 0.25, -0.25, 2.0, -0.25, -0.25, 1.5, -0.25]],'tex_coords':[[0.42105263157894735, 0.0, 0.42105263157894735, 0.5, 0.47368421052631576, 0.5, 0.47368421052631576, 0.0], [0.5263157894736842, 0.0, 0.5263157894736842, 0.5, 0.5789473684210527, 0.5, 0.5789473684210527, 0.0], [0.42105263157894735, 0.5, 0.42105263157894735, 1.0, 0.47368421052631576, 1.0, 0.47368421052631576, 0.5], [0.47368421052631576, 0.5, 0.47368421052631576, 1.0, 0.5263157894736842, 1.0, 0.5263157894736842, 0.5], [0.47368421052631576, 0.0, 0.47368421052631576, 0.5, 0.5263157894736842, 0.5, 0.5263157894736842, 0.0], [0.3684210526315789, 0.0, 0.3684210526315789, 0.5, 0.42105263157894735, 0.5, 0.42105263157894735, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'rightArm','pivot':[-0.3125, 1.375, 0.0],'vertices':[[-0.5, 0.75, -0.125, -0.5, 1.5, -0.125, -0.25, 1.5, -0.125, -0.25, 0.75, -0.125], [-0.25, 0.75, 0.125, -0.25, 1.5, 0.125, -0.5, 1.5, 0.125, -0.5, 0.75, 0.125], [-0.5, 1.5, -0.125, -0.5, 1.5, 0.125, -0.25, 1.5, 0.125, -0.25, 1.5, -0.125], [-0.25, 0.75, -0.125, -0.25, 0.75, 0.125, -0.5, 0.75, 0.125, -0.5, 0.75, -0.125], [-0.25, 0.75, -0.125, -0.25, 1.5, -0.125, -0.25, 1.5, 0.125, -0.25, 0.75, 0.125], [-0.5, 0.75, 0.125, -0.5, 1.5, 0.125, -0.5, 1.5, -0.125, -0.5, 0.75, -0.125]],'tex_coords':[[0.6052631578947368, 0.0, 0.6052631578947368, 0.75, 0.631578947368421, 0.75, 0.631578947368421, 0.0], [0.6578947368421053, 0.0, 0.6578947368421053, 0.75, 0.6842105263157895, 0.75, 0.6842105263157895, 0.0], [0.6052631578947368, 0.75, 0.6052631578947368, 1.0, 0.631578947368421, 1.0, 0.631578947368421, 0.75], [0.631578947368421, 0.75, 0.631578947368421, 1.0, 0.6578947368421053, 1.0, 0.6578947368421053, 0.75], [0.631578947368421, 0.0, 0.631578947368421, 0.75, 0.6578947368421053, 0.75, 0.6578947368421053, 0.0], [0.5789473684210527, 0.0, 0.5789473684210527, 0.75, 0.6052631578947368, 0.75, 0.6052631578947368, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leftArm','pivot':[0.3125, 1.375, 0.0],'vertices':[[0.25, 0.75, -0.125, 0.25, 1.5, -0.125, 0.5, 1.5, -0.125, 0.5, 0.75, -0.125], [0.5, 0.75, 0.125, 0.5, 1.5, 0.125, 0.25, 1.5, 0.125, 0.25, 0.75, 0.125], [0.25, 1.5, -0.125, 0.25, 1.5, 0.125, 0.5, 1.5, 0.125, 0.5, 1.5, -0.125], [0.5, 0.75, -0.125, 0.5, 0.75, 0.125, 0.25, 0.75, 0.125, 0.25, 0.75, -0.125], [0.5, 0.75, -0.125, 0.5, 1.5, -0.125, 0.5, 1.5, 0.125, 0.5, 0.75, 0.125], [0.25, 0.75, 0.125, 0.25, 1.5, 0.125, 0.25, 1.5, -0.125, 0.25, 0.75, -0.125]],'tex_coords':[[0.7105263157894737, 0.0, 0.7105263157894737, 0.75, 0.7368421052631579, 0.75, 0.7368421052631579, 0.0], [0.7631578947368421, 0.0, 0.7631578947368421, 0.75, 0.7894736842105263, 0.75, 0.7894736842105263, 0.0], [0.7105263157894737, 0.75, 0.7105263157894737, 1.0, 0.7368421052631579, 1.0, 0.7368421052631579, 0.75], [0.7368421052631579, 0.75, 0.7368421052631579, 1.0, 0.7631578947368421, 1.0, 0.7631578947368421, 0.75], [0.7368421052631579, 0.0, 0.7368421052631579, 0.75, 0.7631578947368421, 0.75, 0.7631578947368421, 0.0], [0.6842105263157895, 0.0, 0.6842105263157895, 0.75, 0.7105263157894737, 0.75, 0.7105263157894737, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'rightLeg','pivot':[-0.11875, 0.75, 0.0],'vertices':[[-0.24375000596046448, 0.0, -0.125, -0.24375000596046448, 0.75, -0.125, 0.0062500000931322575, 0.75, -0.125, 0.0062500000931322575, 0.0, -0.125], [0.0062500000931322575, 0.0, 0.125, 0.0062500000931322575, 0.75, 0.125, -0.24375000596046448, 0.75, 0.125, -0.24375000596046448, 0.0, 0.125], [-0.24375000596046448, 0.75, -0.125, -0.24375000596046448, 0.75, 0.125, 0.0062500000931322575, 0.75, 0.125, 0.0062500000931322575, 0.75, -0.125], [0.0062500000931322575, 0.0, -0.125, 0.0062500000931322575, 0.0, 0.125, -0.24375000596046448, 0.0, 0.125, -0.24375000596046448, 0.0, -0.125], [0.0062500000931322575, 0.0, -0.125, 0.0062500000931322575, 0.75, -0.125, 0.0062500000931322575, 0.75, 0.125, 0.0062500000931322575, 0.0, 0.125], [-0.24375000596046448, 0.0, 0.125, -0.24375000596046448, 0.75, 0.125, -0.24375000596046448, 0.75, -0.125, -0.24375000596046448, 0.0, -0.125]],'tex_coords':[[0.8157894736842105, 0.0, 0.8157894736842105, 0.75, 0.8421052631578947, 0.75, 0.8421052631578947, 0.0], [0.868421052631579, 0.0, 0.868421052631579, 0.75, 0.8947368421052632, 0.75, 0.8947368421052632, 0.0], [0.8157894736842105, 0.75, 0.8157894736842105, 1.0, 0.8421052631578947, 1.0, 0.8421052631578947, 0.75], [0.8421052631578947, 0.75, 0.8421052631578947, 1.0, 0.868421052631579, 1.0, 0.868421052631579, 0.75], [0.8421052631578947, 0.0, 0.8421052631578947, 0.75, 0.868421052631579, 0.75, 0.868421052631579, 0.0], [0.7894736842105263, 0.0, 0.7894736842105263, 0.75, 0.8157894736842105, 0.75, 0.8157894736842105, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}, {'name':'leftLeg','pivot':[0.11875, 0.75, 0.0],'vertices':[[-0.0062500000931322575, 0.0, -0.125, -0.0062500000931322575, 0.75, -0.125, 0.24375000596046448, 0.75, -0.125, 0.24375000596046448, 0.0, -0.125], [0.24375000596046448, 0.0, 0.125, 0.24375000596046448, 0.75, 0.125, -0.0062500000931322575, 0.75, 0.125, -0.0062500000931322575, 0.0, 0.125], [-0.0062500000931322575, 0.75, -0.125, -0.0062500000931322575, 0.75, 0.125, 0.24375000596046448, 0.75, 0.125, 0.24375000596046448, 0.75, -0.125], [0.24375000596046448, 0.0, -0.125, 0.24375000596046448, 0.0, 0.125, -0.0062500000931322575, 0.0, 0.125, -0.0062500000931322575, 0.0, -0.125], [0.24375000596046448, 0.0, -0.125, 0.24375000596046448, 0.75, -0.125, 0.24375000596046448, 0.75, 0.125, 0.24375000596046448, 0.0, 0.125], [-0.0062500000931322575, 0.0, 0.125, -0.0062500000931322575, 0.75, 0.125, -0.0062500000931322575, 0.75, -0.125, -0.0062500000931322575, 0.0, -0.125]],'tex_coords':[[0.9210526315789473, 0.0, 0.9210526315789473, 0.75, 0.9473684210526315, 0.75, 0.9473684210526315, 0.0], [0.9736842105263158, 0.0, 0.9736842105263158, 0.75, 1.0, 0.75, 1.0, 0.0], [0.9210526315789473, 0.75, 0.9210526315789473, 1.0, 0.9473684210526315, 1.0, 0.9473684210526315, 0.75], [0.9473684210526315, 0.75, 0.9473684210526315, 1.0, 0.9736842105263158, 1.0, 0.9736842105263158, 0.75], [0.9473684210526315, 0.0, 0.9473684210526315, 0.75, 0.9736842105263158, 0.75, 0.9736842105263158, 0.0], [0.8947368421052632, 0.0, 0.8947368421052632, 0.75, 0.9210526315789473, 0.75, 0.9210526315789473, 0.0]],'shading_values':[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]}] diff --git a/community/poetry.lock b/community/poetry.lock deleted file mode 100644 index 65bf2325..00000000 --- a/community/poetry.lock +++ /dev/null @@ -1,241 +0,0 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. - -[[package]] -name = "base36" -version = "0.1.1" -description = "Yet another implementation for the positional numeral system using 36 as the radix." -optional = false -python-versions = "*" -files = [ - {file = "base36-0.1.1-py2.py3-none-any.whl", hash = "sha256:15eec75cf938a2186349e6b6dfc7320c73c065921493be83808c68d909b15763"}, - {file = "base36-0.1.1.tar.gz", hash = "sha256:6f221783c5499bd5fd4a1102054df9638d6232ff5ca850c21fd1efe5070c1a96"}, -] - -[[package]] -name = "nbtlib" -version = "2.0.4" -description = "A python package to read and edit nbt data" -optional = false -python-versions = ">=3.8,<4.0" -files = [ - {file = "nbtlib-2.0.4-py3-none-any.whl", hash = "sha256:38d571fbf2f7ebd640639461b47fc79919a8ea8e74633ffcc8aa6b2acfc9c889"}, - {file = "nbtlib-2.0.4.tar.gz", hash = "sha256:d4b861047fb9beb546a2e3f3b776dc61b0fb5831375752a39961882e2f76cc93"}, -] - -[package.dependencies] -numpy = "*" - -[[package]] -name = "nodeenv" -version = "1.9.1" -description = "Node.js virtual environment builder" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, - {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, -] - -[[package]] -name = "numpy" -version = "2.0.1" -description = "Fundamental package for array computing in Python" -optional = false -python-versions = ">=3.9" -files = [ - {file = "numpy-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0fbb536eac80e27a2793ffd787895242b7f18ef792563d742c2d673bfcb75134"}, - {file = "numpy-2.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:69ff563d43c69b1baba77af455dd0a839df8d25e8590e79c90fcbe1499ebde42"}, - {file = "numpy-2.0.1-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:1b902ce0e0a5bb7704556a217c4f63a7974f8f43e090aff03fcf262e0b135e02"}, - {file = "numpy-2.0.1-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:f1659887361a7151f89e79b276ed8dff3d75877df906328f14d8bb40bb4f5101"}, - {file = "numpy-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4658c398d65d1b25e1760de3157011a80375da861709abd7cef3bad65d6543f9"}, - {file = "numpy-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4127d4303b9ac9f94ca0441138acead39928938660ca58329fe156f84b9f3015"}, - {file = "numpy-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e5eeca8067ad04bc8a2a8731183d51d7cbaac66d86085d5f4766ee6bf19c7f87"}, - {file = "numpy-2.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9adbd9bb520c866e1bfd7e10e1880a1f7749f1f6e5017686a5fbb9b72cf69f82"}, - {file = "numpy-2.0.1-cp310-cp310-win32.whl", hash = "sha256:7b9853803278db3bdcc6cd5beca37815b133e9e77ff3d4733c247414e78eb8d1"}, - {file = "numpy-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:81b0893a39bc5b865b8bf89e9ad7807e16717f19868e9d234bdaf9b1f1393868"}, - {file = "numpy-2.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:75b4e316c5902d8163ef9d423b1c3f2f6252226d1aa5cd8a0a03a7d01ffc6268"}, - {file = "numpy-2.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6e4eeb6eb2fced786e32e6d8df9e755ce5be920d17f7ce00bc38fcde8ccdbf9e"}, - {file = "numpy-2.0.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:a1e01dcaab205fbece13c1410253a9eea1b1c9b61d237b6fa59bcc46e8e89343"}, - {file = "numpy-2.0.1-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:a8fc2de81ad835d999113ddf87d1ea2b0f4704cbd947c948d2f5513deafe5a7b"}, - {file = "numpy-2.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5a3d94942c331dd4e0e1147f7a8699a4aa47dffc11bf8a1523c12af8b2e91bbe"}, - {file = "numpy-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15eb4eca47d36ec3f78cde0a3a2ee24cf05ca7396ef808dda2c0ddad7c2bde67"}, - {file = "numpy-2.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:b83e16a5511d1b1f8a88cbabb1a6f6a499f82c062a4251892d9ad5d609863fb7"}, - {file = "numpy-2.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1f87fec1f9bc1efd23f4227becff04bd0e979e23ca50cc92ec88b38489db3b55"}, - {file = "numpy-2.0.1-cp311-cp311-win32.whl", hash = "sha256:36d3a9405fd7c511804dc56fc32974fa5533bdeb3cd1604d6b8ff1d292b819c4"}, - {file = "numpy-2.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:08458fbf403bff5e2b45f08eda195d4b0c9b35682311da5a5a0a0925b11b9bd8"}, - {file = "numpy-2.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6bf4e6f4a2a2e26655717a1983ef6324f2664d7011f6ef7482e8c0b3d51e82ac"}, - {file = "numpy-2.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7d6fddc5fe258d3328cd8e3d7d3e02234c5d70e01ebe377a6ab92adb14039cb4"}, - {file = "numpy-2.0.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:5daab361be6ddeb299a918a7c0864fa8618af66019138263247af405018b04e1"}, - {file = "numpy-2.0.1-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:ea2326a4dca88e4a274ba3a4405eb6c6467d3ffbd8c7d38632502eaae3820587"}, - {file = "numpy-2.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:529af13c5f4b7a932fb0e1911d3a75da204eff023ee5e0e79c1751564221a5c8"}, - {file = "numpy-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6790654cb13eab303d8402354fabd47472b24635700f631f041bd0b65e37298a"}, - {file = "numpy-2.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:cbab9fc9c391700e3e1287666dfd82d8666d10e69a6c4a09ab97574c0b7ee0a7"}, - {file = "numpy-2.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:99d0d92a5e3613c33a5f01db206a33f8fdf3d71f2912b0de1739894668b7a93b"}, - {file = "numpy-2.0.1-cp312-cp312-win32.whl", hash = "sha256:173a00b9995f73b79eb0191129f2455f1e34c203f559dd118636858cc452a1bf"}, - {file = "numpy-2.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:bb2124fdc6e62baae159ebcfa368708867eb56806804d005860b6007388df171"}, - {file = "numpy-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bfc085b28d62ff4009364e7ca34b80a9a080cbd97c2c0630bb5f7f770dae9414"}, - {file = "numpy-2.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8fae4ebbf95a179c1156fab0b142b74e4ba4204c87bde8d3d8b6f9c34c5825ef"}, - {file = "numpy-2.0.1-cp39-cp39-macosx_14_0_arm64.whl", hash = "sha256:72dc22e9ec8f6eaa206deb1b1355eb2e253899d7347f5e2fae5f0af613741d06"}, - {file = "numpy-2.0.1-cp39-cp39-macosx_14_0_x86_64.whl", hash = "sha256:ec87f5f8aca726117a1c9b7083e7656a9d0d606eec7299cc067bb83d26f16e0c"}, - {file = "numpy-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f682ea61a88479d9498bf2091fdcd722b090724b08b31d63e022adc063bad59"}, - {file = "numpy-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8efc84f01c1cd7e34b3fb310183e72fcdf55293ee736d679b6d35b35d80bba26"}, - {file = "numpy-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3fdabe3e2a52bc4eff8dc7a5044342f8bd9f11ef0934fcd3289a788c0eb10018"}, - {file = "numpy-2.0.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:24a0e1befbfa14615b49ba9659d3d8818a0f4d8a1c5822af8696706fbda7310c"}, - {file = "numpy-2.0.1-cp39-cp39-win32.whl", hash = "sha256:f9cf5ea551aec449206954b075db819f52adc1638d46a6738253a712d553c7b4"}, - {file = "numpy-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:e9e81fa9017eaa416c056e5d9e71be93d05e2c3c2ab308d23307a8bc4443c368"}, - {file = "numpy-2.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:61728fba1e464f789b11deb78a57805c70b2ed02343560456190d0501ba37b0f"}, - {file = "numpy-2.0.1-pp39-pypy39_pp73-macosx_14_0_x86_64.whl", hash = "sha256:12f5d865d60fb9734e60a60f1d5afa6d962d8d4467c120a1c0cda6eb2964437d"}, - {file = "numpy-2.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eacf3291e263d5a67d8c1a581a8ebbcfd6447204ef58828caf69a5e3e8c75990"}, - {file = "numpy-2.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2c3a346ae20cfd80b6cfd3e60dc179963ef2ea58da5ec074fd3d9e7a1e7ba97f"}, - {file = "numpy-2.0.1.tar.gz", hash = "sha256:485b87235796410c3519a699cfe1faab097e509e90ebb05dcd098db2ae87e7b3"}, -] - -[[package]] -name = "pyglet" -version = "2.0.17" -description = "pyglet is a cross-platform games and multimedia package." -optional = false -python-versions = ">=3.8" -files = [ - {file = "pyglet-2.0.17-py3-none-any.whl", hash = "sha256:c881615a5bf14455af36a0915fd9dad0069da904ab5e0ec19b4d6cdfcf1e84c2"}, - {file = "pyglet-2.0.17.tar.gz", hash = "sha256:50c533c1a7cafdccccf43041338ad921ae26866e9871b4f12bf608500632900a"}, -] - -[[package]] -name = "pyglm" -version = "2.7.1" -description = "OpenGL Mathematics library for Python" -optional = false -python-versions = "*" -files = [ - {file = "PyGLM-2.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:401ccf0ffe22c7513e4102f343e5d93f87c48fb869024b97135ee3a961c38c00"}, - {file = "PyGLM-2.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:48967e750329309e93d6b4eddea4b6be21bc195c5c9914b24909090b7dddc2b5"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:311faffc2a05aa269dc0d212bf664e79a231357c8a88b95cb87312b84fe0f2cb"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5ae6a8dc299e77e96672c412715ceb7104d8cb162d9a6a0ae1e27699714b3202"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1a06c90b43a259584e062666c8e28f5959043e09669c84c684fca8380cf4d68b"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff79f9b92135e5a2c0f896ffe0878307ab8c05eb2ef90fc0b4d9a3b63bc03a6c"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:87bf940e84d459d694ae23320a0362d2acadc317c032c54a69d761b0746a18dc"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5d7065d24c5ea85f9367d94c078399a656f643d056497f2866394077d345ec7e"}, - {file = "PyGLM-2.7.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62a3615d97fc253785f246b84c23771fc1303a59a62e732bf70f144d189f63e5"}, - {file = "PyGLM-2.7.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:32071c21dce494aa02a37ea4236495fb2ad9110a104c14c6b45d9b5c366886c6"}, - {file = "PyGLM-2.7.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:8ead25748e90f98f925e8c2ea5ebc52f2cea184cbb12fa95bfa35b699a4f6f75"}, - {file = "PyGLM-2.7.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:6b59d847790a7a6ade9af59d4a42c75b411fbfb1994a2c51a699f94a2b2b70ee"}, - {file = "PyGLM-2.7.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c5a8a9b74846118023f635f460a3d7498740996605eb25a875fe46c01e7ad23d"}, - {file = "PyGLM-2.7.1-cp310-cp310-win32.whl", hash = "sha256:82f96329235da787f0c3b30239a3b6da6c7c140ac1488b3142b363d870171fd0"}, - {file = "PyGLM-2.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:bf3e062103a95a78930201df100156e6ac24eaa9bd50ed59442300ba8edf3173"}, - {file = "PyGLM-2.7.1-cp310-cp310-win_arm64.whl", hash = "sha256:4b07ab88d8108085e7998b17f72e246dc60ee195aa0967980a22a433e1c5693a"}, - {file = "PyGLM-2.7.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:64b6ceca09f7881eaa9299121b343e6569d4ef300f483903801ce2f3407859c3"}, - {file = "PyGLM-2.7.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6833db36d6b2dc12e2a5a4dbc37f8e66c743235431af5b820f87ce35c7994052"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00ad243f7e4c0a89e1a8943446592653a8dc899cbbeeeb3e33221fb146eeda0d"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:61f2eb79e17b2470e538070d3bdd81bac01399fb9065674e905636f7a0e3df57"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aee0a971df967677f6b761c1fd9515a2e35a4e85ba2ab147dd7bf887fb2ab026"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dfd6a1a620eb6431034fee42ad9c6cb46633be47f271f993bd135b24953dbfd6"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1e258d812b68be1ff7699b55d6e66430cdd35af8c06e0774b5673bc6ed913eac"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5f804e9394befc35f2a2a2b2d3372288206538b9c75325c128441acd0a487104"}, - {file = "PyGLM-2.7.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f4b34195081a6216aa6c85d56cbc6411e2d4cd6433664904bdb069b9bee18e1e"}, - {file = "PyGLM-2.7.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:60487a1b2db6307f92648e52cd5773fb3cf3d3f6112b56787e480e1109e18be9"}, - {file = "PyGLM-2.7.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:567b1664942d12fb45bbd54fcd2ab128882905de859da8cd8a866f1489ae7d48"}, - {file = "PyGLM-2.7.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:b10e46a573ce412f16fa14cca34dfca96c23e2ccf159e3202809d6e77f140758"}, - {file = "PyGLM-2.7.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:45427bc7fe0d164c4f5e71bcc8920e6ee8169c0d1526bc6c6274b2c21fbfe8ec"}, - {file = "PyGLM-2.7.1-cp311-cp311-win32.whl", hash = "sha256:583caf00a8afa07850ede7fc82547f72b532f6dfce9aed25648f655dae415f51"}, - {file = "PyGLM-2.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:fd3e7c92ba74e76f992c6cfcbd662058c076329695713108ae54af233e6647d8"}, - {file = "PyGLM-2.7.1-cp311-cp311-win_arm64.whl", hash = "sha256:e22b4a83e0fb36f68a1d84cfd2a95d66d053d0cc5a8aab08bcd63eb7cca11d25"}, - {file = "PyGLM-2.7.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4aa958556dd26e647c67c740aee2822bd41f05f6f2ce70c4f1268e7f0a93b108"}, - {file = "PyGLM-2.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6bf06d63629a2f0f2a85c1fac778b334ee6864d1768ac469b31a30cafa596c24"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:750109e5a2d788395766ea6465b96762b42d779c9cb430dd75c02c447eb0379d"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3486bc2183c78d5fba7f8e4a26c5093bb4df5110cd09f45e7416f3afab688f72"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f4f7d138826d95aaf32bb1414978acc6d839a09350a33c244b881c6e84bd9d5"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2dd9c3c55a8070b2894b1b22bc96ed01832613f4ea984b5023b56a6b4cd6c1d1"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8fcc6ef1f3041618300313af8cd0ba4bb60758d083d7759b51ff6c709e935677"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:06b2d950e221178cc0832b5b78d91f13926d37b851bc4737f92bd5149482b487"}, - {file = "PyGLM-2.7.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:117ea85a40144720436f296c8f1eacb03c33d90fac3df5af086813d7a9e04881"}, - {file = "PyGLM-2.7.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:4c4190604c5af3f65981c4d51aff2681baaa1c185d9d380daeb0ba391199ddcb"}, - {file = "PyGLM-2.7.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:0f42987c0eedfe6a17131e59b72133f5465eda445fc6c3e4c90c7bafe2258914"}, - {file = "PyGLM-2.7.1-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:fc97b41cbb89e4135ec2abc2a1ed2fb6ee2c72eadd2e9f1dca2d9dcef90a47dc"}, - {file = "PyGLM-2.7.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:7e448d37621641fa12469ad6c19d05d7d70bd258cea334a18e2123063f6fd1ed"}, - {file = "PyGLM-2.7.1-cp312-cp312-win32.whl", hash = "sha256:f5488a46d1de944daaf043c209c149ddc59a4f1cced32ef5670062f1e0f3c813"}, - {file = "PyGLM-2.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:890db36101cf945cc1470685ea8fed788291088cdfa425fcfdf701ee6adfd24f"}, - {file = "PyGLM-2.7.1-cp312-cp312-win_arm64.whl", hash = "sha256:9e9adc73094c2607841209c08f1dc61808630f2113f7cd58003a4904fe241e56"}, - {file = "PyGLM-2.7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5116c118f7f291ab6b19b7980f8c32be9fee9d88cf85ef1760651df3f14a2cb4"}, - {file = "PyGLM-2.7.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0e2bc62c3308da7c3fb80da569d8482c17929e7e4f161c0520db7db8e1238162"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aa46162c9a427f7625880daf85d0bfc426792b3a5e465219967644391cfdbf82"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:85b713430b30a1eac179b90f59dbccb82dccba1659eab7ff5d6db6d5a07c8b7c"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b34555f20024e5ab86ed8ec7236a8ffddd12521d3093d16fc5da1fc032bc7af7"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e391b2e7f5af43e5838bfbd1eb1d4ce13187248abc6fe462bef3f23044ef8845"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d87dbdc96a34e0a6f06dfccfdb012ab70249c049606cb01b1c51cd5262a0ff26"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:38d66b7150fd0bfe37f2d31dc67969b6c4145b3f2921ec115be3047f3350b015"}, - {file = "PyGLM-2.7.1-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:04ab4b5325cbd9515ab6fd0c1d1d1e9c4cfc62fe7ae5c816cc82e41c2ed5ad65"}, - {file = "PyGLM-2.7.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:40b7a96e13c782be23140f05bc4e74599fa89922df533445a69e7a392365550a"}, - {file = "PyGLM-2.7.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:4b1b3b469eeb4f988db25deae6b31ddf89cf67f7623e4a74793a4d6041832163"}, - {file = "PyGLM-2.7.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:ffd4c70ae50ec33592cc537aeb991230d5ff8dd00091dc880fb566be69776514"}, - {file = "PyGLM-2.7.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:202964258049588469eb355bd1baeb0bffe5aa5d6fb34f4983ff465ec03a6156"}, - {file = "PyGLM-2.7.1-cp38-cp38-win32.whl", hash = "sha256:e6ef596e75df4dd233511a403725885443763d700a9b425408be62e1de980a75"}, - {file = "PyGLM-2.7.1-cp38-cp38-win_amd64.whl", hash = "sha256:1f8950d1d6d900bde0b966248ee604219a7760766bd13ab3892f80384d53633c"}, - {file = "PyGLM-2.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d3ba1bbce59dee76afceff1342bc29c0bfced2a55baf024505187d5d162a2253"}, - {file = "PyGLM-2.7.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:19218d8f414c86dbf4c6b97bf8c040e2e4fd5885833fc3a5ac5e3a2a15d9afdc"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cf719550ac93107a6c9f75bb08f9baa5d7e846fb88222985e18c4611365d48ba"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:33398e48bedd6e8f8945c7b7b0c82495927d0c5ed1964f2ca963b30b668d9275"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9d9f45eb2f1e8be53a8f52317014ebd12f61a8feffbefb413ab828323f3c0bd6"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ba24cd208fedb4d1cc3a49f52c84eebc30aaae67c9f094cee75765566451f19"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a2c36b9fffd80a25765e6917e3aecda7ab264bbfd5a8fad531c57d0c0403fda6"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8dbe2abda1572796ce981eb468d91c9031813448c9e2e426e8567617ca77c3a6"}, - {file = "PyGLM-2.7.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a7253575ec5f269ee5f5e2960e5f0d5148e3e978a27ad7ecdb0b3fce22fb6f3a"}, - {file = "PyGLM-2.7.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:6581986fa3908f3f7e8df8145f7e4dc52a285f0a589caf43cd40003304fe4048"}, - {file = "PyGLM-2.7.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:5c70210bdd103314cb635647343afc48db66e1207cbb4e389f0fe75e5ca4ae82"}, - {file = "PyGLM-2.7.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:b6f75fe54190bba4d8b86a8fe0c1f4d71183c401fdc0c398129b25bc4c67a6d1"}, - {file = "PyGLM-2.7.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:298ffdf5f7c638ff31ae74e547710485258de7fc2a819932b2df7cc8de5f8265"}, - {file = "PyGLM-2.7.1-cp39-cp39-win32.whl", hash = "sha256:303c301139c92853cd7b280431463af7c8e0d638f7d24d248c2aa19fd1316f06"}, - {file = "PyGLM-2.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:d5b0ba4cf238f916b24e0bb6411469d1348f66165d7121d34231799eb74820b9"}, - {file = "PyGLM-2.7.1-cp39-cp39-win_arm64.whl", hash = "sha256:449bdb7cf05f675631254886ccc58691167ac869bae29303fb9f869fe8bb3c46"}, - {file = "PyGLM-2.7.1.tar.gz", hash = "sha256:455817299e431c9a95e75b0c6ef6007caf57ee12a89fbba660f3741dd4da8f88"}, -] - -[[package]] -name = "pyright" -version = "1.1.375" -description = "Command line wrapper for pyright" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pyright-1.1.375-py3-none-any.whl", hash = "sha256:4c5e27eddeaee8b41cc3120736a1dda6ae120edf8523bb2446b6073a52f286e3"}, - {file = "pyright-1.1.375.tar.gz", hash = "sha256:7765557b0d6782b2fadabff455da2014476404c9e9214f49977a4e49dec19a0f"}, -] - -[package.dependencies] -nodeenv = ">=1.6.0" - -[package.extras] -all = ["twine (>=3.4.1)"] -dev = ["twine (>=3.4.1)"] - -[[package]] -name = "ruff" -version = "0.5.7" -description = "An extremely fast Python linter and code formatter, written in Rust." -optional = false -python-versions = ">=3.7" -files = [ - {file = "ruff-0.5.7-py3-none-linux_armv6l.whl", hash = "sha256:548992d342fc404ee2e15a242cdbea4f8e39a52f2e7752d0e4cbe88d2d2f416a"}, - {file = "ruff-0.5.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00cc8872331055ee017c4f1071a8a31ca0809ccc0657da1d154a1d2abac5c0be"}, - {file = "ruff-0.5.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eaf3d86a1fdac1aec8a3417a63587d93f906c678bb9ed0b796da7b59c1114a1e"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a01c34400097b06cf8a6e61b35d6d456d5bd1ae6961542de18ec81eaf33b4cb8"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fcc8054f1a717e2213500edaddcf1dbb0abad40d98e1bd9d0ad364f75c763eea"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f70284e73f36558ef51602254451e50dd6cc479f8b6f8413a95fcb5db4a55fc"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:a78ad870ae3c460394fc95437d43deb5c04b5c29297815a2a1de028903f19692"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ccd078c66a8e419475174bfe60a69adb36ce04f8d4e91b006f1329d5cd44bcf"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e31c9bad4ebf8fdb77b59cae75814440731060a09a0e0077d559a556453acbb"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d796327eed8e168164346b769dd9a27a70e0298d667b4ecee6877ce8095ec8e"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4a09ea2c3f7778cc635e7f6edf57d566a8ee8f485f3c4454db7771efb692c499"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a36d8dcf55b3a3bc353270d544fb170d75d2dff41eba5df57b4e0b67a95bb64e"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9369c218f789eefbd1b8d82a8cf25017b523ac47d96b2f531eba73770971c9e5"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b88ca3db7eb377eb24fb7c82840546fb7acef75af4a74bd36e9ceb37a890257e"}, - {file = "ruff-0.5.7-py3-none-win32.whl", hash = "sha256:33d61fc0e902198a3e55719f4be6b375b28f860b09c281e4bdbf783c0566576a"}, - {file = "ruff-0.5.7-py3-none-win_amd64.whl", hash = "sha256:083bbcbe6fadb93cd86709037acc510f86eed5a314203079df174c40bbbca6b3"}, - {file = "ruff-0.5.7-py3-none-win_arm64.whl", hash = "sha256:2dca26154ff9571995107221d0aeaad0e75a77b5a682d6236cf89a58c70b76f4"}, - {file = "ruff-0.5.7.tar.gz", hash = "sha256:8dfc0a458797f5d9fb622dd0efc52d796f23f0a1493a9527f4e49a550ae9a7e5"}, -] - -[metadata] -lock-version = "2.0" -python-versions = "^3.11" -content-hash = "5cff0dc29c85bdc8bd32558ecdf71c7b98c5e624a9ec738f6dbff8a19df13f38" diff --git a/community/poetry.toml b/community/poetry.toml deleted file mode 100644 index ab1033bd..00000000 --- a/community/poetry.toml +++ /dev/null @@ -1,2 +0,0 @@ -[virtualenvs] -in-project = true diff --git a/community/pyproject.toml b/community/pyproject.toml deleted file mode 100644 index b679a09c..00000000 --- a/community/pyproject.toml +++ /dev/null @@ -1,40 +0,0 @@ -[tool.poetry] -name = "mcpy" -version = "0.99.0" -description = "Minecraft clone written in Python" -authors = [ - "obiwac", - "Jukitsu", - "drakeerv", - "abrha2020-smart", - "StartForKiller", - "Chubercik", - "brennop", - "anthony-63", -] -readme = "README.md" - -[tool.poetry.dependencies] -python = "^3.11" -pyglet = "^2.0.16" -nbtlib = "^2.0.4" -base36 = "^0.1.1" -pyglm = "^2.7.1" - -[tool.poetry.group.dev.dependencies] -ruff = "^0.5.5" -pyright = "^1.1.374" - -[tool.pyright] -exclude = [".venv"] -venvPath = "." -venv = ".venv" - -# For some reason, pyright thinks '__setitem__' is not defined on 'pyglet.options' when it totally is. - -reportIndexIssue = false - -# From https://github.com/obiwac/python-minecraft-clone/pull/107: -# F405 * may be undefined, or defined from star imports: These are indeed defined from star imports. I guess we could import all the symbols in '__all__' explicitly, but if there's a mistake here and it causes a runtime error, that's not the end of the world. - -ignore = ["models/__init__.py"] diff --git a/community/save/0/0/c.0.0.dat b/community/save/0/0/c.0.0.dat deleted file mode 100644 index 8922125b..00000000 Binary files a/community/save/0/0/c.0.0.dat and /dev/null differ diff --git a/community/save/0/1/c.0.1.dat b/community/save/0/1/c.0.1.dat deleted file mode 100644 index dd61294b..00000000 Binary files a/community/save/0/1/c.0.1.dat and /dev/null differ diff --git a/community/save/0/1o/c.0.-4.dat b/community/save/0/1o/c.0.-4.dat deleted file mode 100644 index bb54d91d..00000000 Binary files a/community/save/0/1o/c.0.-4.dat and /dev/null differ diff --git a/community/save/0/1p/c.0.-3.dat b/community/save/0/1p/c.0.-3.dat deleted file mode 100644 index d9392f71..00000000 Binary files a/community/save/0/1p/c.0.-3.dat and /dev/null differ diff --git a/community/save/0/1q/c.0.-2.dat b/community/save/0/1q/c.0.-2.dat deleted file mode 100644 index a298fd6a..00000000 Binary files a/community/save/0/1q/c.0.-2.dat and /dev/null differ diff --git a/community/save/0/1r/c.0.-1.dat b/community/save/0/1r/c.0.-1.dat deleted file mode 100644 index c2d14567..00000000 Binary files a/community/save/0/1r/c.0.-1.dat and /dev/null differ diff --git a/community/save/0/2/c.0.2.dat b/community/save/0/2/c.0.2.dat deleted file mode 100644 index 29d57ca6..00000000 Binary files a/community/save/0/2/c.0.2.dat and /dev/null differ diff --git a/community/save/0/3/c.0.3.dat b/community/save/0/3/c.0.3.dat deleted file mode 100644 index 266bf17c..00000000 Binary files a/community/save/0/3/c.0.3.dat and /dev/null differ diff --git a/community/save/1/0/c.1.0.dat b/community/save/1/0/c.1.0.dat deleted file mode 100644 index 74fb0052..00000000 Binary files a/community/save/1/0/c.1.0.dat and /dev/null differ diff --git a/community/save/1/1/c.1.1.dat b/community/save/1/1/c.1.1.dat deleted file mode 100644 index 20c7e221..00000000 Binary files a/community/save/1/1/c.1.1.dat and /dev/null differ diff --git a/community/save/1/1o/c.1.-4.dat b/community/save/1/1o/c.1.-4.dat deleted file mode 100644 index cf3e2a1e..00000000 Binary files a/community/save/1/1o/c.1.-4.dat and /dev/null differ diff --git a/community/save/1/1p/c.1.-3.dat b/community/save/1/1p/c.1.-3.dat deleted file mode 100644 index d09273ad..00000000 Binary files a/community/save/1/1p/c.1.-3.dat and /dev/null differ diff --git a/community/save/1/1q/c.1.-2.dat b/community/save/1/1q/c.1.-2.dat deleted file mode 100644 index d327beb8..00000000 Binary files a/community/save/1/1q/c.1.-2.dat and /dev/null differ diff --git a/community/save/1/1r/c.1.-1.dat b/community/save/1/1r/c.1.-1.dat deleted file mode 100644 index 454b3396..00000000 Binary files a/community/save/1/1r/c.1.-1.dat and /dev/null differ diff --git a/community/save/1/2/c.1.2.dat b/community/save/1/2/c.1.2.dat deleted file mode 100644 index 9132f761..00000000 Binary files a/community/save/1/2/c.1.2.dat and /dev/null differ diff --git a/community/save/1/3/c.1.3.dat b/community/save/1/3/c.1.3.dat deleted file mode 100644 index e15c80bc..00000000 Binary files a/community/save/1/3/c.1.3.dat and /dev/null differ diff --git a/community/save/1o/0/c.-4.0.dat b/community/save/1o/0/c.-4.0.dat deleted file mode 100644 index af178e5b..00000000 Binary files a/community/save/1o/0/c.-4.0.dat and /dev/null differ diff --git a/community/save/1o/1/c.-4.1.dat b/community/save/1o/1/c.-4.1.dat deleted file mode 100644 index cb228884..00000000 Binary files a/community/save/1o/1/c.-4.1.dat and /dev/null differ diff --git a/community/save/1o/1o/c.-4.-4.dat b/community/save/1o/1o/c.-4.-4.dat deleted file mode 100644 index 63c9b6d1..00000000 Binary files a/community/save/1o/1o/c.-4.-4.dat and /dev/null differ diff --git a/community/save/1o/1p/c.-4.-3.dat b/community/save/1o/1p/c.-4.-3.dat deleted file mode 100644 index e83bd868..00000000 Binary files a/community/save/1o/1p/c.-4.-3.dat and /dev/null differ diff --git a/community/save/1o/1q/c.-4.-2.dat b/community/save/1o/1q/c.-4.-2.dat deleted file mode 100644 index 2e6901dc..00000000 Binary files a/community/save/1o/1q/c.-4.-2.dat and /dev/null differ diff --git a/community/save/1o/1r/c.-4.-1.dat b/community/save/1o/1r/c.-4.-1.dat deleted file mode 100644 index 65ba04b9..00000000 Binary files a/community/save/1o/1r/c.-4.-1.dat and /dev/null differ diff --git a/community/save/1o/2/c.-4.2.dat b/community/save/1o/2/c.-4.2.dat deleted file mode 100644 index 533d78f1..00000000 Binary files a/community/save/1o/2/c.-4.2.dat and /dev/null differ diff --git a/community/save/1o/3/c.-4.3.dat b/community/save/1o/3/c.-4.3.dat deleted file mode 100644 index bde272ba..00000000 Binary files a/community/save/1o/3/c.-4.3.dat and /dev/null differ diff --git a/community/save/1p/0/c.-3.0.dat b/community/save/1p/0/c.-3.0.dat deleted file mode 100644 index 549461da..00000000 Binary files a/community/save/1p/0/c.-3.0.dat and /dev/null differ diff --git a/community/save/1p/1/c.-3.1.dat b/community/save/1p/1/c.-3.1.dat deleted file mode 100644 index 074d25b7..00000000 Binary files a/community/save/1p/1/c.-3.1.dat and /dev/null differ diff --git a/community/save/1p/1o/c.-3.-4.dat b/community/save/1p/1o/c.-3.-4.dat deleted file mode 100644 index c9a6d415..00000000 Binary files a/community/save/1p/1o/c.-3.-4.dat and /dev/null differ diff --git a/community/save/1p/1p/c.-3.-3.dat b/community/save/1p/1p/c.-3.-3.dat deleted file mode 100644 index b57847d6..00000000 Binary files a/community/save/1p/1p/c.-3.-3.dat and /dev/null differ diff --git a/community/save/1p/1q/c.-3.-2.dat b/community/save/1p/1q/c.-3.-2.dat deleted file mode 100644 index c298dcb1..00000000 Binary files a/community/save/1p/1q/c.-3.-2.dat and /dev/null differ diff --git a/community/save/1p/1r/c.-3.-1.dat b/community/save/1p/1r/c.-3.-1.dat deleted file mode 100644 index 6c49de48..00000000 Binary files a/community/save/1p/1r/c.-3.-1.dat and /dev/null differ diff --git a/community/save/1p/2/c.-3.2.dat b/community/save/1p/2/c.-3.2.dat deleted file mode 100644 index d27fe8c0..00000000 Binary files a/community/save/1p/2/c.-3.2.dat and /dev/null differ diff --git a/community/save/1p/3/c.-3.3.dat b/community/save/1p/3/c.-3.3.dat deleted file mode 100644 index bec68c2c..00000000 Binary files a/community/save/1p/3/c.-3.3.dat and /dev/null differ diff --git a/community/save/1q/0/c.-2.0.dat b/community/save/1q/0/c.-2.0.dat deleted file mode 100644 index 2a0f9d68..00000000 Binary files a/community/save/1q/0/c.-2.0.dat and /dev/null differ diff --git a/community/save/1q/1/c.-2.1.dat b/community/save/1q/1/c.-2.1.dat deleted file mode 100644 index 1045f76a..00000000 Binary files a/community/save/1q/1/c.-2.1.dat and /dev/null differ diff --git a/community/save/1q/1o/c.-2.-4.dat b/community/save/1q/1o/c.-2.-4.dat deleted file mode 100644 index 69cffe47..00000000 Binary files a/community/save/1q/1o/c.-2.-4.dat and /dev/null differ diff --git a/community/save/1q/1p/c.-2.-3.dat b/community/save/1q/1p/c.-2.-3.dat deleted file mode 100644 index 9f878ccc..00000000 Binary files a/community/save/1q/1p/c.-2.-3.dat and /dev/null differ diff --git a/community/save/1q/1q/c.-2.-2.dat b/community/save/1q/1q/c.-2.-2.dat deleted file mode 100644 index 61d07f6d..00000000 Binary files a/community/save/1q/1q/c.-2.-2.dat and /dev/null differ diff --git a/community/save/1q/1r/c.-2.-1.dat b/community/save/1q/1r/c.-2.-1.dat deleted file mode 100644 index f0587c54..00000000 Binary files a/community/save/1q/1r/c.-2.-1.dat and /dev/null differ diff --git a/community/save/1q/2/c.-2.2.dat b/community/save/1q/2/c.-2.2.dat deleted file mode 100644 index db26b75a..00000000 Binary files a/community/save/1q/2/c.-2.2.dat and /dev/null differ diff --git a/community/save/1q/3/c.-2.3.dat b/community/save/1q/3/c.-2.3.dat deleted file mode 100644 index 9a2d3fb1..00000000 Binary files a/community/save/1q/3/c.-2.3.dat and /dev/null differ diff --git a/community/save/1r/0/c.-1.0.dat b/community/save/1r/0/c.-1.0.dat deleted file mode 100644 index 6e869d99..00000000 Binary files a/community/save/1r/0/c.-1.0.dat and /dev/null differ diff --git a/community/save/1r/1/c.-1.1.dat b/community/save/1r/1/c.-1.1.dat deleted file mode 100644 index 9254e9ad..00000000 Binary files a/community/save/1r/1/c.-1.1.dat and /dev/null differ diff --git a/community/save/1r/1o/c.-1.-4.dat b/community/save/1r/1o/c.-1.-4.dat deleted file mode 100644 index 26fdd952..00000000 Binary files a/community/save/1r/1o/c.-1.-4.dat and /dev/null differ diff --git a/community/save/1r/1p/c.-1.-3.dat b/community/save/1r/1p/c.-1.-3.dat deleted file mode 100644 index e7456449..00000000 Binary files a/community/save/1r/1p/c.-1.-3.dat and /dev/null differ diff --git a/community/save/1r/1q/c.-1.-2.dat b/community/save/1r/1q/c.-1.-2.dat deleted file mode 100644 index 9e3d54e7..00000000 Binary files a/community/save/1r/1q/c.-1.-2.dat and /dev/null differ diff --git a/community/save/1r/1r/c.-1.-1.dat b/community/save/1r/1r/c.-1.-1.dat deleted file mode 100644 index 83d36a09..00000000 Binary files a/community/save/1r/1r/c.-1.-1.dat and /dev/null differ diff --git a/community/save/1r/2/c.-1.2.dat b/community/save/1r/2/c.-1.2.dat deleted file mode 100644 index 7db9d2f1..00000000 Binary files a/community/save/1r/2/c.-1.2.dat and /dev/null differ diff --git a/community/save/1r/3/c.-1.3.dat b/community/save/1r/3/c.-1.3.dat deleted file mode 100644 index e2645fd7..00000000 Binary files a/community/save/1r/3/c.-1.3.dat and /dev/null differ diff --git a/community/save/2/0/c.2.0.dat b/community/save/2/0/c.2.0.dat deleted file mode 100644 index 3d431745..00000000 Binary files a/community/save/2/0/c.2.0.dat and /dev/null differ diff --git a/community/save/2/1/c.2.1.dat b/community/save/2/1/c.2.1.dat deleted file mode 100644 index 38098181..00000000 Binary files a/community/save/2/1/c.2.1.dat and /dev/null differ diff --git a/community/save/2/1o/c.2.-4.dat b/community/save/2/1o/c.2.-4.dat deleted file mode 100644 index ec2b75f5..00000000 Binary files a/community/save/2/1o/c.2.-4.dat and /dev/null differ diff --git a/community/save/2/1p/c.2.-3.dat b/community/save/2/1p/c.2.-3.dat deleted file mode 100644 index be2bfc66..00000000 Binary files a/community/save/2/1p/c.2.-3.dat and /dev/null differ diff --git a/community/save/2/1q/c.2.-2.dat b/community/save/2/1q/c.2.-2.dat deleted file mode 100644 index 3ac417f3..00000000 Binary files a/community/save/2/1q/c.2.-2.dat and /dev/null differ diff --git a/community/save/2/1r/c.2.-1.dat b/community/save/2/1r/c.2.-1.dat deleted file mode 100644 index da575974..00000000 Binary files a/community/save/2/1r/c.2.-1.dat and /dev/null differ diff --git a/community/save/2/2/c.2.2.dat b/community/save/2/2/c.2.2.dat deleted file mode 100644 index 8bc0fc85..00000000 Binary files a/community/save/2/2/c.2.2.dat and /dev/null differ diff --git a/community/save/2/3/c.2.3.dat b/community/save/2/3/c.2.3.dat deleted file mode 100644 index fd08a54f..00000000 Binary files a/community/save/2/3/c.2.3.dat and /dev/null differ diff --git a/community/save/3/0/c.3.0.dat b/community/save/3/0/c.3.0.dat deleted file mode 100644 index 5d50c087..00000000 Binary files a/community/save/3/0/c.3.0.dat and /dev/null differ diff --git a/community/save/3/1/c.3.1.dat b/community/save/3/1/c.3.1.dat deleted file mode 100644 index bc472fc3..00000000 Binary files a/community/save/3/1/c.3.1.dat and /dev/null differ diff --git a/community/save/3/1o/c.3.-4.dat b/community/save/3/1o/c.3.-4.dat deleted file mode 100644 index 0b093de8..00000000 Binary files a/community/save/3/1o/c.3.-4.dat and /dev/null differ diff --git a/community/save/3/1p/c.3.-3.dat b/community/save/3/1p/c.3.-3.dat deleted file mode 100644 index 75ccf0b1..00000000 Binary files a/community/save/3/1p/c.3.-3.dat and /dev/null differ diff --git a/community/save/3/1q/c.3.-2.dat b/community/save/3/1q/c.3.-2.dat deleted file mode 100644 index 3d08b972..00000000 Binary files a/community/save/3/1q/c.3.-2.dat and /dev/null differ diff --git a/community/save/3/1r/c.3.-1.dat b/community/save/3/1r/c.3.-1.dat deleted file mode 100644 index 6f69f1d8..00000000 Binary files a/community/save/3/1r/c.3.-1.dat and /dev/null differ diff --git a/community/save/3/2/c.3.2.dat b/community/save/3/2/c.3.2.dat deleted file mode 100644 index 02f4acb6..00000000 Binary files a/community/save/3/2/c.3.2.dat and /dev/null differ diff --git a/community/save/3/3/c.3.3.dat b/community/save/3/3/c.3.3.dat deleted file mode 100644 index 159e18cd..00000000 Binary files a/community/save/3/3/c.3.3.dat and /dev/null differ diff --git a/community/src/renderer/shader.py b/community/shader.py similarity index 75% rename from community/src/renderer/shader.py rename to community/shader.py index df6b454a..16d4ebb7 100644 --- a/community/src/renderer/shader.py +++ b/community/shader.py @@ -1,25 +1,24 @@ import ctypes import pyglet.gl as gl -import glm - - -class ShaderError(Exception): ... - +class Shader_error(Exception): + def __init__(self, message): + self.message = message def create_shader(target, source_path): # read shader source - with open(source_path, "rb") as source_file: - source = source_file.read() + source_file = open(source_path, "rb") + source = source_file.read() + source_file.close() source_length = ctypes.c_int(len(source) + 1) source_buffer = ctypes.create_string_buffer(source) buffer_pointer = ctypes.cast( - ctypes.pointer(ctypes.pointer(source_buffer)), ctypes.POINTER(ctypes.POINTER(ctypes.c_char)) - ) - + ctypes.pointer(ctypes.pointer(source_buffer)), + ctypes.POINTER(ctypes.POINTER(ctypes.c_char))) + # compile shader gl.glShaderSource(target, 1, buffer_pointer, ctypes.byref(source_length)) @@ -33,9 +32,8 @@ def create_shader(target, source_path): log_buffer = ctypes.create_string_buffer(log_length.value) gl.glGetShaderInfoLog(target, log_length, None, log_buffer) - if log_length.value > 1: - raise ShaderError(str(log_buffer.value)) - + if log_length: + raise Shader_error(str(log_buffer.value)) class Shader: def __init__(self, vert_path, frag_path): @@ -59,18 +57,15 @@ def __init__(self, vert_path, frag_path): gl.glDeleteShader(self.vert_shader) gl.glDeleteShader(self.frag_shader) - + def __del__(self): gl.glDeleteProgram(self.program) def find_uniform(self, name): return gl.glGetUniformLocation(self.program, ctypes.create_string_buffer(name)) - + def uniform_matrix(self, location, matrix): - gl.glUniformMatrix4fv(location, 1, gl.GL_FALSE, glm.value_ptr(matrix)) + gl.glUniformMatrix4fv(location, 1, gl.GL_FALSE, (gl.GLfloat * 16) (*sum(matrix.data, []))) def use(self): - gl.glUseProgram(self.program) - - def stop(self): - gl.glUseProgram(0) + gl.glUseProgram(self.program) \ No newline at end of file diff --git a/community/shaders/entity/frag.glsl b/community/shaders/entity/frag.glsl new file mode 100644 index 00000000..1c87c427 --- /dev/null +++ b/community/shaders/entity/frag.glsl @@ -0,0 +1,18 @@ +#version 330 + +out vec4 fragment_colour; + +uniform sampler2D texture_sampler; + +in vec3 local_position; +in vec3 interpolated_tex_coords; +in float shading; + +void main(void) { + vec4 texture_colour = texture(texture_sampler, interpolated_tex_coords.xy); + fragment_colour = texture_colour * shading; + + if (texture_colour.a == 0.0) { // discard if texel's alpha component is 0 (texel is transparent) + discard; + } +} diff --git a/community/shaders/entity/vert.glsl b/community/shaders/entity/vert.glsl new file mode 100644 index 00000000..b3339810 --- /dev/null +++ b/community/shaders/entity/vert.glsl @@ -0,0 +1,29 @@ +#version 330 + +layout(location = 0) in vec3 vertex_position; +layout(location = 1) in vec3 normal; +layout(location = 2) in vec3 tex_coords; + +out vec3 local_position; +out vec3 interpolated_tex_coords; +out float shading; + +uniform mat4 inverse_transform_matrix; +uniform mat4 matrix; +uniform float lighting; + +void main(void) { + local_position = vertex_position; + + interpolated_tex_coords = tex_coords; + + vec3 transformed_normal = (vec4(normal, 1.0) * inverse_transform_matrix).xyz; + vec3 sunlight = vec3(0.0, 2.0, 1.0); + + vec3 xz_absolute_normal = vec3(abs(transformed_normal.x), transformed_normal.y, abs(transformed_normal.z)); + float facing = dot(normalize(xz_absolute_normal), normalize(sunlight)); + + shading = max(0.4, (1. + facing) / 2) * lighting; + + gl_Position = matrix * vec4(vertex_position, 1.0); +} diff --git a/community/src/__init__.py b/community/src/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/src/chunk/__init__.py b/community/src/chunk/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/src/chunk/chunk.py b/community/src/chunk/chunk.py deleted file mode 100644 index 1f952920..00000000 --- a/community/src/chunk/chunk.py +++ /dev/null @@ -1,372 +0,0 @@ -import ctypes -from collections import deque - -import pyglet.gl as gl - -from src.chunk.subchunk import SUBCHUNK_WIDTH, SUBCHUNK_HEIGHT, SUBCHUNK_LENGTH, Subchunk -import src.options as options - -CHUNK_WIDTH = 16 -CHUNK_HEIGHT = 128 -CHUNK_LENGTH = 16 - - -class Chunk: - def __init__(self, world, chunk_position): - self.world = world - self.shader_chunk_offset_location = self.world.shader.find_uniform(b"u_ChunkPosition") - - self.modified = False - self.chunk_position = chunk_position - - self.position = ( - self.chunk_position[0] * CHUNK_WIDTH, - self.chunk_position[1] * CHUNK_HEIGHT, - self.chunk_position[2] * CHUNK_LENGTH, - ) - - self.blocks = [[[0 for z in range(CHUNK_LENGTH)] for y in range(CHUNK_HEIGHT)] for x in range(CHUNK_WIDTH)] - # Numpy is really slow there - self.lightmap = [[[0 for z in range(CHUNK_LENGTH)] for y in range(CHUNK_HEIGHT)] for x in range(CHUNK_WIDTH)] - - self.subchunks = {} - self.chunk_update_queue = deque() - - for x in range(int(CHUNK_WIDTH / SUBCHUNK_WIDTH)): - for y in range(int(CHUNK_HEIGHT / SUBCHUNK_HEIGHT)): - for z in range(int(CHUNK_LENGTH / SUBCHUNK_LENGTH)): - self.subchunks[(x, y, z)] = Subchunk(self, (x, y, z)) - - # mesh variables - - self.mesh = [] - self.translucent_mesh = [] - - self.mesh_quad_count = 0 - self.translucent_quad_count = 0 - - # create VAO and VBO's - - self.vao = gl.GLuint(0) - gl.glGenVertexArrays(1, self.vao) - gl.glBindVertexArray(self.vao) - - self.vbo = gl.GLuint(0) - gl.glGenBuffers(1, self.vbo) - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.vbo) - gl.glBufferData( - gl.GL_ARRAY_BUFFER, - ctypes.sizeof(gl.GLfloat * CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_LENGTH * 7), - None, - gl.GL_DYNAMIC_DRAW, - ) - - gl.glVertexAttribPointer(0, 3, gl.GL_FLOAT, gl.GL_FALSE, 7 * ctypes.sizeof(gl.GLfloat), 0) - gl.glEnableVertexAttribArray(0) - gl.glVertexAttribPointer( - 1, 1, gl.GL_FLOAT, gl.GL_FALSE, 7 * ctypes.sizeof(gl.GLfloat), 3 * ctypes.sizeof(gl.GLfloat) - ) - gl.glEnableVertexAttribArray(1) - gl.glVertexAttribPointer( - 2, 1, gl.GL_FLOAT, gl.GL_FALSE, 7 * ctypes.sizeof(gl.GLfloat), 4 * ctypes.sizeof(gl.GLfloat) - ) - gl.glEnableVertexAttribArray(2) - gl.glVertexAttribPointer( - 3, 1, gl.GL_FLOAT, gl.GL_FALSE, 7 * ctypes.sizeof(gl.GLfloat), 5 * ctypes.sizeof(gl.GLfloat) - ) - gl.glEnableVertexAttribArray(3) - gl.glVertexAttribPointer( - 4, 1, gl.GL_FLOAT, gl.GL_FALSE, 7 * ctypes.sizeof(gl.GLfloat), 6 * ctypes.sizeof(gl.GLfloat) - ) - gl.glEnableVertexAttribArray(4) - - gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, world.ibo) - - if self.world.options.INDIRECT_RENDERING: - self.indirect_command_buffer = gl.GLuint(0) - gl.glGenBuffers(1, self.indirect_command_buffer) - gl.glBindBuffer(gl.GL_DRAW_INDIRECT_BUFFER, self.indirect_command_buffer) - gl.glBufferData(gl.GL_DRAW_INDIRECT_BUFFER, ctypes.sizeof(gl.GLuint * 10), None, gl.GL_DYNAMIC_DRAW) - - self.draw_commands = [] - - self.occlusion_query = gl.GLuint(0) - gl.glGenQueries(1, self.occlusion_query) - - def __del__(self): - gl.glDeleteQueries(1, self.occlusion_query) - gl.glDeleteBuffers(1, self.vbo) - gl.glDeleteVertexArrays(1, self.vao) - - def get_block_light(self, position): - x, y, z = position - return self.lightmap[x][y][z] & 0xF - - def set_block_light(self, position, value): - x, y, z = position - self.lightmap[x][y][z] = (self.lightmap[x][y][z] & 0xF0) | value - - def get_sky_light(self, position): - x, y, z = position - return (self.lightmap[x][y][z] >> 4) & 0xF - - def set_sky_light(self, position, value): - x, y, z = position - self.lightmap[x][y][z] = (self.lightmap[x][y][z] & 0xF) | (value << 4) - - def get_raw_light(self, position): - x, y, z = position - return self.lightmap[x][y][z] - - def get_block_number(self, position): - lx, ly, lz = position - - block_number = self.blocks[lx][ly][lz] - return block_number - - def get_transparency(self, position): - block_type = self.world.block_types[self.get_block_number(position)] - - if not block_type: - return 2 - - return block_type.transparent - - def is_opaque_block(self, position): - # get block type and check if it's opaque or not - # air counts as a transparent block, so test for that too - - block_type = self.world.block_types[self.get_block_number(position)] - - if not block_type: - return False - - return not block_type.transparent - - def update_subchunk_meshes(self): - self.chunk_update_queue.clear() - for subchunk in self.subchunks.values(): - self.chunk_update_queue.append(subchunk) - - def update_at_position(self, position): - x, y, z = position - - lx = int(x % SUBCHUNK_WIDTH) - ly = int(y % SUBCHUNK_HEIGHT) - lz = int(z % SUBCHUNK_LENGTH) - - clx, cly, clz = self.world.get_local_position(position) - - sx = clx // SUBCHUNK_WIDTH - sy = cly // SUBCHUNK_HEIGHT - sz = clz // SUBCHUNK_LENGTH - - if self.subchunks[(sx, sy, sz)] not in self.chunk_update_queue: - self.chunk_update_queue.append(self.subchunks[(sx, sy, sz)]) - - def try_update_subchunk_mesh(subchunk_position): - if subchunk_position in self.subchunks: - if self.subchunks[subchunk_position] not in self.chunk_update_queue: - self.chunk_update_queue.append(self.subchunks[subchunk_position]) - - if lx == SUBCHUNK_WIDTH - 1: - try_update_subchunk_mesh((sx + 1, sy, sz)) - if lx == 0: - try_update_subchunk_mesh((sx - 1, sy, sz)) - - if ly == SUBCHUNK_HEIGHT - 1: - try_update_subchunk_mesh((sx, sy + 1, sz)) - if ly == 0: - try_update_subchunk_mesh((sx, sy - 1, sz)) - - if lz == SUBCHUNK_LENGTH - 1: - try_update_subchunk_mesh((sx, sy, sz + 1)) - if lz == 0: - try_update_subchunk_mesh((sx, sy, sz - 1)) - - def process_chunk_updates(self): - for _ in range(self.world.options.CHUNK_UPDATES): - if self.chunk_update_queue: - subchunk = self.chunk_update_queue.popleft() - subchunk.update_mesh() - self.world.chunk_update_counter += 1 - if not self.chunk_update_queue: - self.world.chunk_building_queue.append(self) - return - - def update_mesh(self): - # combine all the small subchunk meshes into one big chunk mesh - - for subchunk in self.subchunks.values(): - self.mesh += subchunk.mesh - self.translucent_mesh += subchunk.translucent_mesh - - # send the full mesh data to the GPU and free the memory used client-side (we don't need it anymore) - # don't forget to save the length of 'self.mesh_indices' before freeing - - self.mesh_quad_count = len(self.mesh) // 28 # 28 = 7 (attributes of a vertex) * 4 (number of vertices per quad) - self.translucent_quad_count = len(self.translucent_mesh) // 28 - - self.send_mesh_data_to_gpu() - - self.mesh = [] - self.translucent_mesh = [] - - def send_mesh_data_to_gpu(self): # pass mesh data to gpu - if not self.mesh_quad_count: - return - - gl.glBindVertexArray(self.vao) - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.vbo) - gl.glBufferData( - gl.GL_ARRAY_BUFFER, # Orphaning - ctypes.sizeof(gl.GLfloat * CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_LENGTH * 7), - None, - gl.GL_DYNAMIC_DRAW, - ) - gl.glBufferSubData( - gl.GL_ARRAY_BUFFER, 0, ctypes.sizeof(gl.GLfloat * len(self.mesh)), (gl.GLfloat * len(self.mesh))(*self.mesh) - ) - gl.glBufferSubData( - gl.GL_ARRAY_BUFFER, - ctypes.sizeof(gl.GLfloat * len(self.mesh)), - ctypes.sizeof(gl.GLfloat * len(self.translucent_mesh)), - (gl.GLfloat * len(self.translucent_mesh))(*self.translucent_mesh), - ) - - if not self.world.options.INDIRECT_RENDERING: - return - - self.draw_commands = [ - # Index Count Instance Count Base Index Base Vertex Base Instance - self.mesh_quad_count * 6, - 1, - 0, - 0, - 0, # Opaque mesh commands - self.translucent_quad_count * 6, - 1, - 0, - self.mesh_quad_count * 4, - 0, # Translucent mesh commands - ] - - gl.glBindBuffer(gl.GL_DRAW_INDIRECT_BUFFER, self.indirect_command_buffer) - gl.glBufferSubData( - gl.GL_DRAW_INDIRECT_BUFFER, - 0, - ctypes.sizeof(gl.GLuint * len(self.draw_commands)), - (gl.GLuint * len(self.draw_commands))(*self.draw_commands), - ) - - def draw_direct(self, mode): - if not self.mesh_quad_count: - return - gl.glBindVertexArray(self.vao) - gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2]) - gl.glDrawElements( - mode, - self.mesh_quad_count * 6, - gl.GL_UNSIGNED_INT, - None, - ) - - def draw_indirect(self, mode): - if not self.mesh_quad_count: - return - - gl.glBindVertexArray(self.vao) - gl.glBindBuffer(gl.GL_DRAW_INDIRECT_BUFFER, self.indirect_command_buffer) - gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2]) - - gl.glDrawElementsIndirect( - mode, - gl.GL_UNSIGNED_INT, - None, - ) - - def draw_direct_advanced(self, mode): - if not self.mesh_quad_count: - return - - gl.glBindVertexArray(self.vao) - gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2]) - - gl.glBeginQuery(gl.GL_ANY_SAMPLES_PASSED, self.occlusion_query) - gl.glDrawElements( - mode, - self.mesh_quad_count * 6, - gl.GL_UNSIGNED_INT, - None, - ) - gl.glEndQuery(gl.GL_ANY_SAMPLES_PASSED) - - gl.glBeginConditionalRender(self.occlusion_query, gl.GL_QUERY_BY_REGION_WAIT) - gl.glDrawElements( - mode, - self.mesh_quad_count * 6, - gl.GL_UNSIGNED_INT, - None, - ) - gl.glEndConditionalRender() - - def draw_indirect_advanced(self, mode): - if not self.mesh_quad_count: - return - - gl.glBindVertexArray(self.vao) - gl.glBindBuffer(gl.GL_DRAW_INDIRECT_BUFFER, self.indirect_command_buffer) - gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2]) - - gl.glBeginQuery(gl.GL_ANY_SAMPLES_PASSED, self.occlusion_query) - gl.glDrawElementsIndirect( - mode, - gl.GL_UNSIGNED_INT, - None, - ) - gl.glEndQuery(gl.GL_ANY_SAMPLES_PASSED) - - gl.glBeginConditionalRender(self.occlusion_query, gl.GL_QUERY_BY_REGION_WAIT) - gl.glDrawElementsIndirect( - mode, - gl.GL_UNSIGNED_INT, - None, - ) - gl.glEndConditionalRender() - - draw_normal = draw_indirect if options.INDIRECT_RENDERING else draw_direct - draw_advanced = draw_indirect_advanced if options.INDIRECT_RENDERING else draw_direct_advanced - draw = draw_advanced if options.ADVANCED_OPENGL else draw_normal - - def draw_translucent_direct(self, mode): - if not self.mesh_quad_count: - return - - gl.glBindVertexArray(self.vao) - gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2]) - - gl.glDrawElementsBaseVertex( - mode, self.translucent_quad_count * 6, gl.GL_UNSIGNED_INT, None, self.mesh_quad_count * 4 - ) - - def draw_translucent_indirect(self, mode): - if not self.translucent_quad_count: - return - - gl.glBindVertexArray(self.vao) - gl.glBindBuffer(gl.GL_DRAW_INDIRECT_BUFFER, self.indirect_command_buffer) - gl.glUniform2i(self.shader_chunk_offset_location, self.chunk_position[0], self.chunk_position[2]) - - gl.glMemoryBarrier(gl.GL_COMMAND_BARRIER_BIT) - - gl.glDrawElementsIndirect( - mode, - gl.GL_UNSIGNED_INT, - 5 - * ctypes.sizeof( - gl.GLuint - ), # offset pointer to the indirect command buffer pointing to the translucent mesh commands - ) - - draw_translucent = draw_translucent_indirect if options.INDIRECT_RENDERING else draw_translucent_direct diff --git a/community/src/chunk/subchunk.py b/community/src/chunk/subchunk.py deleted file mode 100644 index 43872064..00000000 --- a/community/src/chunk/subchunk.py +++ /dev/null @@ -1,274 +0,0 @@ -import glm -from functools import lru_cache as cache - -from src.util import UP, DOWN, NORTH, SOUTH, EAST, WEST, DIRECTIONS - -SUBCHUNK_WIDTH = 4 -SUBCHUNK_HEIGHT = 4 -SUBCHUNK_LENGTH = 4 - - -@cache(maxsize=None) -def smooth(a, b, c, d): - if not a or not b or not c or not d: - light = (a, *(i for i in (b, c, d) if i)) - min_val = min(light) - a = max(a, min_val) - b = max(b, min_val) - c = max(c, min_val) - d = max(d, min_val) - return (a + b + c + d) / 4 - - -@cache(maxsize=None) -def ao(s1, s2, c): - if s1 and s2: - return 0.25 - return 1 - (s1 + s2 + c) / 4 - - -class Subchunk: - def __init__(self, parent, subchunk_position): - self.parent = parent - self.world = self.parent.world - - self.subchunk_position = subchunk_position - - self.local_position = ( - self.subchunk_position[0] * SUBCHUNK_WIDTH, - self.subchunk_position[1] * SUBCHUNK_HEIGHT, - self.subchunk_position[2] * SUBCHUNK_LENGTH, - ) - - self.position = ( - self.parent.position[0] + self.local_position[0], - self.parent.position[1] + self.local_position[1], - self.parent.position[2] + self.local_position[2], - ) - - # mesh variables - - self.mesh = [] - self.mesh_array = None - - self.translucent_mesh = [] - self.translucent_mesh_array = None - - def get_raw_light(self, pos, npos): - if not npos: - light_levels = self.world.get_light(pos) - else: - light_levels = self.world.get_light(npos) - return [light_levels] * 4 - - def get_raw_skylight(self, pos, npos): - if not npos: - light_levels = self.world.get_skylight(pos) - else: - light_levels = self.world.get_skylight(npos) - return [light_levels] * 4 - - def get_face_ao(self, s1, s2, s3, s4, s5, s6, s7, s8): - vertex1 = ao(s2, s4, s1) - vertex2 = ao(s4, s7, s6) - vertex3 = ao(s5, s7, s8) - vertex4 = ao(s2, s5, s3) - return (vertex1, vertex2, vertex3, vertex4) - - def get_smooth_face_light(self, light, light1, light2, light3, light4, light5, light6, light7, light8): - vertex1 = smooth(light, light2, light4, light1) - vertex2 = smooth(light, light4, light7, light6) - vertex3 = smooth(light, light5, light7, light8) - vertex4 = smooth(light, light2, light5, light3) - return (vertex1, vertex2, vertex3, vertex4) - - def get_neighbour_voxels(self, npos, face): - if not face: # EAST - neighbours = [ - npos + UP + SOUTH, - npos + UP, - npos + UP + NORTH, - npos + SOUTH, - npos + NORTH, - npos + DOWN + SOUTH, - npos + DOWN, - npos + DOWN + NORTH, - ] - elif face == 1: # WEST - neighbours = [ - npos + UP + NORTH, - npos + UP, - npos + UP + SOUTH, - npos + NORTH, - npos + SOUTH, - npos + DOWN + NORTH, - npos + DOWN, - npos + DOWN + SOUTH, - ] - elif face == 2: # UP - neighbours = [ - npos + SOUTH + EAST, - npos + SOUTH, - npos + SOUTH + WEST, - npos + EAST, - npos + WEST, - npos + NORTH + EAST, - npos + NORTH, - npos + NORTH + WEST, - ] - elif face == 3: # DOWN - neighbours = [ - npos + SOUTH + WEST, - npos + SOUTH, - npos + SOUTH + EAST, - npos + WEST, - npos + EAST, - npos + NORTH + WEST, - npos + NORTH, - npos + NORTH + EAST, - ] - elif face == 4: - neighbours = [ - npos + UP + WEST, - npos + UP, - npos + UP + EAST, - npos + WEST, - npos + EAST, - npos + DOWN + WEST, - npos + DOWN, - npos + DOWN + EAST, - ] - elif face == 5: - neighbours = [ - npos + UP + EAST, - npos + UP, - npos + UP + WEST, - npos + EAST, - npos + WEST, - npos + DOWN + EAST, - npos + DOWN, - npos + DOWN + WEST, - ] - else: - return [] - return neighbours - - def get_light_smooth(self, block, face, pos, npos): - if not npos or block in self.world.light_blocks: - return [self.world.get_light(pos)] * 4 - - neighbours = self.get_neighbour_voxels(npos, face) - - nlights = (self.world.get_light(neighbour_pos) for neighbour_pos in neighbours) - - return self.get_smooth_face_light(self.world.get_light(npos), *nlights) - - def get_skylight_smooth(self, block, face, pos, npos): - if not npos or block in self.world.light_blocks: - return [self.world.get_skylight(pos)] * 4 - - neighbours = self.get_neighbour_voxels(npos, face) - - nlights = (self.world.get_skylight(neighbour_pos) for neighbour_pos in neighbours) - - return self.get_smooth_face_light(self.world.get_skylight(npos), *nlights) - - def get_ambient(self, block, block_type, face, npos): - raw_shading = block_type.shading_values[face] - if not block_type.is_cube or block in self.world.light_blocks: - return raw_shading - - neighbours = self.get_neighbour_voxels(npos, face) - - neighbour_opacity = (self.world.is_opaque_block(neighbour_pos) for neighbour_pos in neighbours) - - face_ao = self.get_face_ao(*neighbour_opacity) - - return [a * b for a, b in zip(face_ao, raw_shading)] - - def get_shading(self, block, block_type, face, npos): - return ( - self.get_ambient(block, block_type, face, npos) - if self.world.options.SMOOTH_LIGHTING - else block_type.shading_values[face] - ) - - def get_light(self, block, face, pos, npos): - return ( - self.get_light_smooth(block, face, pos, npos) - if self.world.options.SMOOTH_LIGHTING - else self.get_raw_light(pos, npos) - ) - - def get_skylight(self, block, face, pos, npos): - return ( - self.get_skylight_smooth(block, face, pos, npos) - if self.world.options.SMOOTH_LIGHTING - else self.get_raw_skylight(pos, npos) - ) - - def add_face(self, face, pos, lpos, block, block_type, npos=None): - lx, ly, lz = lpos - vertex_positions = block_type.vertex_positions[face] - tex_index = block_type.tex_indices[face] - shading = self.get_shading(block, block_type, face, npos) - lights = self.get_light(block, face, pos, npos) - skylights = self.get_skylight(block, face, pos, npos) - - if block_type.model.translucent: - mesh = self.translucent_mesh - else: - mesh = self.mesh - - for i in range(4): - mesh += [ - vertex_positions[i * 3 + 0] + lx, - vertex_positions[i * 3 + 1] + ly, - vertex_positions[i * 3 + 2] + lz, - tex_index * 4 + i, - shading[i], - lights[i], - skylights[i], - ] - - def can_render_face(self, block_type, block_number, position): - return not ( - self.world.is_opaque_block(position) - or (block_type.glass and self.world.get_block_number(position) == block_number) - ) - - def update_mesh(self): - self.mesh = [] - self.translucent_mesh = [] - - for local_x in range(SUBCHUNK_WIDTH): - for local_y in range(SUBCHUNK_HEIGHT): - for local_z in range(SUBCHUNK_LENGTH): - parent_lx = self.local_position[0] + local_x - parent_ly = self.local_position[1] + local_y - parent_lz = self.local_position[2] + local_z - - block_number = self.parent.blocks[parent_lx][parent_ly][parent_lz] - - parent_lpos = glm.ivec3(parent_lx, parent_ly, parent_lz) - - if block_number: - block_type = self.world.block_types[block_number] - - pos = glm.ivec3( - self.position[0] + local_x, self.position[1] + local_y, self.position[2] + local_z - ) - - # if block is cube, we want it to check neighbouring blocks so that we don't uselessly render faces - # if block isn't a cube, we just want to render all faces, regardless of neighbouring blocks - # since the vast majority of blocks are probably anyway going to be cubes, this won't impact performance all that much; the amount of useless faces drawn is going to be minimal - - if block_type.is_cube: - for face, direction in enumerate(DIRECTIONS): - npos = pos + direction - if self.can_render_face(block_type, block_number, npos): - self.add_face(face, pos, parent_lpos, block_number, block_type, npos) - - else: - for i in range(len(block_type.vertex_positions)): - self.add_face(i, pos, parent_lpos, block_number, block_type) diff --git a/community/src/controllers/__init__.py b/community/src/controllers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/src/controllers/controller.py b/community/src/controllers/controller.py deleted file mode 100644 index 3d4460e8..00000000 --- a/community/src/controllers/controller.py +++ /dev/null @@ -1,131 +0,0 @@ -import random -from enum import IntEnum - -from src.chunk.chunk import CHUNK_WIDTH, CHUNK_LENGTH, CHUNK_HEIGHT -from src.physics.hit import HIT_RANGE, HitRay -from src.entity.player import SPRINTING_SPEED, WALKING_SPEED - - -class Controller: - class InteractMode(IntEnum): - PLACE = 0 - BREAK = 1 - PICK = 2 - - class MiscMode(IntEnum): - RANDOM = 0 - SAVE = 1 - ESCAPE = 2 - SPEED_TIME = 3 - FULLSCREEN = 4 - FLY = 5 - TELEPORT = 6 - TOGGLE_F3 = 7 - TOGGLE_AO = 8 - - class MoveMode(IntEnum): - LEFT = 0 - RIGHT = 1 - DOWN = 2 - UP = 3 - BACKWARD = 4 - FORWARD = 5 - - class ModifierMode(IntEnum): - SPRINT = 0 - - def __init__(self, game): - self.game = game - - def interact(self, mode): - def hit_callback(current_block, next_block): - if mode == self.InteractMode.PLACE: - self.game.world.try_set_block(current_block, self.game.holding, self.game.player.collider) - elif mode == self.InteractMode.BREAK: - self.game.world.set_block(next_block, 0) - elif mode == self.InteractMode.PICK: - self.game.holding = self.game.world.get_block_number(next_block) - - x, y, z = self.game.player.position - y += self.game.player.eyelevel - - hit_ray = HitRay(self.game.world, self.game.player.rotation, (x, y, z)) - - while hit_ray.distance < HIT_RANGE: - if hit_ray.step(hit_callback): - break - - def misc(self, mode): - if mode == self.MiscMode.RANDOM: - self.game.holding = random.randint(1, len(self.game.world.block_types) - 1) - elif mode == self.MiscMode.SAVE: - self.game.world.save.save() - elif mode == self.MiscMode.ESCAPE: - self.game.mouse_captured = False - self.game.set_exclusive_mouse(False) - elif mode == self.MiscMode.SPEED_TIME: - self.game.world.speed_daytime() - elif mode == self.MiscMode.FULLSCREEN: - self.game.toggle_fullscreen() - elif mode == self.MiscMode.FLY: - self.game.player.flying = not self.game.player.flying - elif mode == self.MiscMode.TELEPORT: - # how large is the world? - - max_y = 0 - - max_x, max_z = (0, 0) - min_x, min_z = (0, 0) - - for pos in self.game.world.chunks: - x, y, z = pos - - max_y = max(max_y, (y + 1) * CHUNK_HEIGHT) - - max_x = max(max_x, (x + 1) * CHUNK_WIDTH) - min_x = min(min_x, x * CHUNK_WIDTH) - - max_z = max(max_z, (z + 1) * CHUNK_LENGTH) - min_z = min(min_z, z * CHUNK_LENGTH) - - # get random X & Z coordinates to teleport the player to - - x = random.randint(min_x, max_x) - z = random.randint(min_z, max_z) - - # find height at which to teleport to, by finding the first non-air block from the top of the world - - for y in range(CHUNK_HEIGHT - 1, -1, -1): - if not self.game.world.get_block_number((x, y, z)): - continue - - self.game.player.teleport((x, y + 1, z)) - break - elif mode == self.MiscMode.TOGGLE_F3: - self.game.show_f3 = not self.game.show_f3 - elif mode == self.MiscMode.TOGGLE_AO: - self.game.world.toggle_AO() - - def update_move(self, axis): - self.game.player.input[axis] = round(max(-1, min(self.game.controls[axis], 1))) - - def start_move(self, mode): - axis = int((mode if mode % 2 == 0 else mode - 1) / 2) - self.game.controls[axis] += -1 if mode % 2 == 0 else 1 - self.update_move(axis) - - def end_move(self, mode): - axis = int((mode if mode % 2 == 0 else mode - 1) / 2) - self.game.controls[axis] -= -1 if mode % 2 == 0 else 1 - self.update_move(axis) - - def start_modifier(self, mode): - if mode == self.ModifierMode.SPRINT: - self.game.player.target_speed = SPRINTING_SPEED - - def end_modifier(self, mode): - if mode == self.ModifierMode.SPRINT: - self.game.player.target_speed = WALKING_SPEED - - def apply_deadzone(self, value): - return value diff --git a/community/src/controllers/joystick.py b/community/src/controllers/joystick.py deleted file mode 100644 index ca6f38e7..00000000 --- a/community/src/controllers/joystick.py +++ /dev/null @@ -1,193 +0,0 @@ -import threading -import math -import time - -import pyglet.input - -from src.controllers.controller import Controller -from src.entity.player import WALKING_SPEED, SPRINTING_SPEED - - -class JoystickController(Controller): - def __init__(self, game): - super().__init__(game) - self.init_joysticks(pyglet.input.get_joysticks()) - - self.camera_sensitivity = 0.007 - self.deadzone = 0.25 - self.update_delay = 0.15 - self.last_update = 0 - - self.joystick_move = [0, 0] - self.joystick_look = [0, 0] - self.joystick_interact = [0, 0] - - self.joystick_updater = threading.Thread(target=self.updater, daemon=True, name="Joystick Updater") - self.joystick_updater.start() - - def updater(self): - while True: - joysticks = pyglet.input.get_joysticks() - - if joysticks is not None and len(joysticks) != len(self.joysticks): - self.init_joysticks(joysticks) - - time.sleep(2) - - def init_joysticks(self, joysticks): - self.joysticks = joysticks - - for joystick in self.joysticks: - joystick.on_joybutton_press = self.on_joybutton_press - joystick.on_joybutton_release = self.on_joybutton_release - joystick.on_joyaxis_motion = self.on_joyaxis_motion - joystick.open(exclusive=True) - - def update_controller(self): - if not self.game.mouse_captured or not self.joysticks: - return - - self.game.player.rotation[0] += self.joystick_look[0] * self.camera_sensitivity - self.game.player.rotation[1] += -self.joystick_look[1] * self.camera_sensitivity - - self.game.player.rotation[1] = max(-math.tau / 4, min(math.tau / 4, self.game.player.rotation[1])) - - if round(max(self.joystick_interact)) > 0 and (self.last_update + self.update_delay) <= time.process_time(): - if round(self.joystick_interact[0]) > 0: - self.interact(self.InteractMode.BREAK) - if round(self.joystick_interact[1]) > 0: - self.interact(self.InteractMode.PLACE) - - self.last_update = time.process_time() - - def on_joybutton_press(self, joystick, button): - if "xbox" in joystick.device.name.lower(): - if button == 1: - self.misc(self.MiscMode.RANDOM) - elif button == 2: - self.interact(self.InteractMode.PICK) - elif button == 3: - self.misc(self.MiscMode.SAVE) - - elif button == 0: - self.start_move(self.MoveMode.UP) - elif button == 9: - self.start_move(self.MoveMode.DOWN) - - elif button == 8: - if self.game.player.target_speed == SPRINTING_SPEED: - self.end_modifier(self.ModifierMode.SPRINT) - elif self.game.player.target_speed == WALKING_SPEED: - self.start_modifier(self.ModifierMode.SPRINT) - - elif "wireless controller" == joystick.device.name.lower(): - if button == 2: - self.misc(self.MiscMode.RANDOM) - elif button == 0: - self.interact(self.InteractMode.PICK) - elif button == 3: - self.misc(self.MiscMode.SAVE) - - elif button == 1: - self.start_move(self.MoveMode.UP) - elif button == 11: - self.start_move(self.MoveMode.DOWN) - - elif button == 10: - if self.game.player.target_speed == SPRINTING_SPEED: - self.end_modifier(self.ModifierMode.SPRINT) - elif self.game.player.target_speed == WALKING_SPEED: - self.start_modifier(self.ModifierMode.SPRINT) - - def on_joybutton_release(self, joystick, button): - if "xbox" in joystick.device.name.lower(): - if button == 0: - self.end_move(self.MoveMode.UP) - elif button == 9: - self.end_move(self.MoveMode.DOWN) - - elif "wireless controller" == joystick.device.name.lower(): - if button == 1: - self.end_move(self.MoveMode.UP) - elif button == 11: - self.end_move(self.MoveMode.DOWN) - - def on_joyaxis_motion(self, joystick, axis, value): - if abs(value) < self.deadzone: - value = 0 - - if "xbox" in joystick.device.name.lower(): - if axis == "x": - if math.ceil(value) > 0 and self.joystick_move[0] == 0: - self.start_move(self.MoveMode.RIGHT) - elif math.floor(value) < 0 and self.joystick_move[0] == 0: - self.start_move(self.MoveMode.LEFT) - elif value == 0 and math.ceil(self.joystick_move[0]) > 0: - self.end_move(self.MoveMode.RIGHT) - elif value == 0 and math.floor(self.joystick_move[0]) < 0: - self.end_move(self.MoveMode.LEFT) - - self.joystick_move[0] = value - elif axis == "y": - if math.ceil(value) > 0 and self.joystick_move[1] == 0: - self.start_move(self.MoveMode.BACKWARD) - elif math.floor(value) < 0 and self.joystick_move[1] == 0: - self.start_move(self.MoveMode.FORWARD) - elif value == 0 and math.ceil(self.joystick_move[1]) > 0: - self.end_move(self.MoveMode.BACKWARD) - elif value == 0 and math.floor(self.joystick_move[1]) < 0: - self.end_move(self.MoveMode.FORWARD) - - self.joystick_move[1] = value - - if axis == "rx": - self.joystick_look[0] = value - if axis == "ry": - self.joystick_look[1] = value - - if axis == "z": - if value < 0: - self.joystick_interact[0] = -value - if value > 0: - self.joystick_interact[1] = value - - elif "wireless controller" == joystick.device.name.lower(): - if axis == "x": - if math.ceil(value) > 0 and self.joystick_move[0] == 0: - self.start_move(self.MoveMode.RIGHT) - elif math.floor(value) < 0 and self.joystick_move[0] == 0: - self.start_move(self.MoveMode.LEFT) - elif value == 0 and math.ceil(self.joystick_move[0]) > 0: - self.end_move(self.MoveMode.RIGHT) - elif value == 0 and math.floor(self.joystick_move[0]) < 0: - self.end_move(self.MoveMode.LEFT) - - self.joystick_move[0] = value - elif axis == "y": - if math.ceil(value) > 0 and self.joystick_move[1] == 0: - self.start_move(self.MoveMode.BACKWARD) - elif math.floor(value) < 0 and self.joystick_move[1] == 0: - self.start_move(self.MoveMode.FORWARD) - elif value == 0 and math.ceil(self.joystick_move[1]) > 0: - self.end_move(self.MoveMode.BACKWARD) - elif value == 0 and math.floor(self.joystick_move[1]) < 0: - self.end_move(self.MoveMode.FORWARD) - - self.joystick_move[1] = value - - if axis == "z": - self.joystick_look[0] = value - if axis == "rz": - self.joystick_look[1] = value - - if axis == "rx": - self.joystick_interact[0] = value - if axis == "ry": - self.joystick_interact[1] = value - - def apply_deadzone(self, value): - if abs(value[0]) < self.deadzone: - value[0] = 0 - if abs(value[1]) < self.deadzone: - value[1] = 0 - return value diff --git a/community/src/controllers/keyboard_mouse.py b/community/src/controllers/keyboard_mouse.py deleted file mode 100644 index 3e6a5c34..00000000 --- a/community/src/controllers/keyboard_mouse.py +++ /dev/null @@ -1,102 +0,0 @@ -import math - -import pyglet.window.mouse - -from src.controllers.controller import Controller - - -class KeyboardMouseController(Controller): - def __init__(self, game): - super().__init__(game) - - self.game.on_mouse_press = self.on_mouse_press - self.game.on_mouse_motion = self.on_mouse_motion - self.game.on_mouse_drag = self.on_mouse_drag - - self.game.on_key_press = self.on_key_press - self.game.on_key_release = self.on_key_release - - def on_mouse_press(self, x, y, button, modifiers): - if not self.game.mouse_captured: - self.game.mouse_captured = True - self.game.set_exclusive_mouse(True) - - return - - if button == pyglet.window.mouse.RIGHT: - self.interact(self.InteractMode.PLACE) - elif button == pyglet.window.mouse.LEFT: - self.interact(self.InteractMode.BREAK) - elif button == pyglet.window.mouse.MIDDLE: - self.interact(self.InteractMode.PICK) - - def on_mouse_motion(self, x, y, delta_x, delta_y): - if self.game.mouse_captured: - sensitivity = 0.004 - - self.game.player.rotation[0] += delta_x * sensitivity - self.game.player.rotation[1] += delta_y * sensitivity - - self.game.player.rotation[1] = max(-math.tau / 4, min(math.tau / 4, self.game.player.rotation[1])) - - def on_mouse_drag(self, x, y, delta_x, delta_y, buttons, modifiers): - self.on_mouse_motion(x, y, delta_x, delta_y) - - def on_key_press(self, key, modifiers): - if not self.game.mouse_captured: - return - - if key == pyglet.window.key.D: - self.start_move(self.MoveMode.RIGHT) - elif key == pyglet.window.key.A: - self.start_move(self.MoveMode.LEFT) - elif key == pyglet.window.key.W: - self.start_move(self.MoveMode.FORWARD) - elif key == pyglet.window.key.S: - self.start_move(self.MoveMode.BACKWARD) - elif key == pyglet.window.key.SPACE: - self.start_move(self.MoveMode.UP) - elif key == pyglet.window.key.LSHIFT: - self.start_move(self.MoveMode.DOWN) - - elif key == pyglet.window.key.LCTRL: - self.start_modifier(self.ModifierMode.SPRINT) - - elif key == pyglet.window.key.F: - self.misc(self.MiscMode.FLY) - elif key == pyglet.window.key.G: - self.misc(self.MiscMode.RANDOM) - elif key == pyglet.window.key.O: - self.misc(self.MiscMode.SAVE) - elif key == pyglet.window.key.R: - self.misc(self.MiscMode.TELEPORT) - elif key == pyglet.window.key.ESCAPE: - self.misc(self.MiscMode.ESCAPE) - elif key == pyglet.window.key.F6: - self.misc(self.MiscMode.SPEED_TIME) - elif key == pyglet.window.key.F11: - self.misc(self.MiscMode.FULLSCREEN) - elif key == pyglet.window.key.F3: - self.misc(self.MiscMode.TOGGLE_F3) - elif key == pyglet.window.key.F10: - self.misc(self.MiscMode.TOGGLE_AO) - - def on_key_release(self, key, modifiers): - if not self.game.mouse_captured: - return - - if key == pyglet.window.key.D: - self.end_move(self.MoveMode.RIGHT) - elif key == pyglet.window.key.A: - self.end_move(self.MoveMode.LEFT) - elif key == pyglet.window.key.W: - self.end_move(self.MoveMode.FORWARD) - elif key == pyglet.window.key.S: - self.end_move(self.MoveMode.BACKWARD) - elif key == pyglet.window.key.SPACE: - self.end_move(self.MoveMode.UP) - elif key == pyglet.window.key.LSHIFT: - self.end_move(self.MoveMode.DOWN) - - elif key == pyglet.window.key.LCTRL: - self.end_modifier(self.ModifierMode.SPRINT) diff --git a/community/src/entity/__init__.py b/community/src/entity/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/src/entity/entity.py b/community/src/entity/entity.py deleted file mode 100644 index 16a60365..00000000 --- a/community/src/entity/entity.py +++ /dev/null @@ -1,171 +0,0 @@ -import math - -from src.physics.collider import Collider - -FLYING_ACCEL = (0, 0, 0) -GRAVITY_ACCEL = (0, -32, 0) - -# these values all come (loosely) from Minecraft, but are multiplied by 20 (since Minecraft runs at 20 TPS) - -FRICTION = (20, 20, 20) - -DRAG_FLY = (5, 5, 5) -DRAG_JUMP = (1.8, 0, 1.8) -DRAG_FALL = (1.8, 0.4, 1.8) - - -class Entity: - def __init__(self, world): - self.world = world - - # physical variables - - self.jump_height = 1.25 - self.flying = False - - self.position = [0.0, 80.0, 0.0] - self.rotation = [-math.tau / 4, 0.0] - - self.old_position = tuple(self.position) - self.old_rotation = tuple(self.rotation) - - self.step = 1 - - self.velocity = [0.0, 0.0, 0.0] - self.accel = [0.0, 0.0, 0.0] - - # collision variables - - self.width = 0.6 - self.height = 1.8 - - self.collider = Collider() - self.grounded = False - - def update_collider(self): - x, y, z = self.position - - self.collider.x1 = x - self.width / 2 - self.collider.x2 = x + self.width / 2 - - self.collider.y1 = y - self.collider.y2 = y + self.height - - self.collider.z1 = z - self.width / 2 - self.collider.z2 = z + self.width / 2 - - def teleport(self, pos: list[float]): - self.position = list(pos) - self.velocity = [0.0, 0.0, 0.0] # to prevent collisions - - def jump(self, height=None): - # obviously, we can't initiate a jump while in mid-air - - if not self.grounded: - return - - if height is None: - height = self.jump_height - - self.velocity[1] = math.sqrt(2 * height * -GRAVITY_ACCEL[1]) - - @property - def friction(self): - if self.flying: - return DRAG_FLY - - elif self.grounded: - return FRICTION - - elif self.velocity[1] > 0: - return DRAG_JUMP - - return DRAG_FALL - - def update(self, delta_time: float): - self.step = 1 - self.old_position = tuple(self.position) - - # apply input acceleration, and adjust for friction/drag - - self.velocity = [v + a * f * delta_time for v, a, f in zip(self.velocity, self.accel, self.friction)] - self.accel = [0.0, 0.0, 0.0] - - # compute collisions - - self.update_collider() - self.grounded = False - - for _ in range(3): - adjusted_velocity = [v * delta_time for v in self.velocity] - vx, vy, vz = adjusted_velocity - - # find all the blocks we could potentially be colliding with - # this step is known as "broad-phasing" - - step_x = 1 if vx > 0 else -1 - step_y = 1 if vy > 0 else -1 - step_z = 1 if vz > 0 else -1 - - steps_xz = int(self.width / 2) - steps_y = int(self.height) - - x, y, z = map(int, self.position) - cx, cy, cz = [int(x + v) for x, v in zip(self.position, adjusted_velocity)] - - potential_collisions = [] - - for i in range(x - step_x * (steps_xz + 1), cx + step_x * (steps_xz + 2), step_x): - for j in range(y - step_y * (steps_y + 2), cy + step_y * (steps_y + 3), step_y): - for k in range(z - step_z * (steps_xz + 1), cz + step_z * (steps_xz + 2), step_z): - pos = (i, j, k) - num = self.world.get_block_number(pos) - - if not num: - continue - - for _collider in self.world.block_types[num].colliders: - entry_time, normal = self.collider.collide(_collider + pos, adjusted_velocity) - - if normal is None: - continue - - potential_collisions.append((entry_time, normal)) - - # get first collision - - if not potential_collisions: - break - - entry_time, normal = min(potential_collisions, key=lambda x: x[0]) - entry_time -= 0.001 - - if normal[0]: - self.velocity[0] = 0 - self.position[0] += vx * entry_time - - if normal[1]: - self.velocity[1] = 0 - self.position[1] += vy * entry_time - - if normal[2]: - self.velocity[2] = 0 - self.position[2] += vz * entry_time - - if normal[1] == 1: - self.grounded = True - - self.position = [x + v * delta_time for x, v in zip(self.position, self.velocity)] - - # apply gravity acceleration - - gravity = (GRAVITY_ACCEL, FLYING_ACCEL)[self.flying] - self.velocity = [v + a * delta_time for v, a in zip(self.velocity, gravity)] - - # apply friction/drag - - self.velocity = [v - min(v * f * delta_time, v, key=abs) for v, f in zip(self.velocity, self.friction)] - - # make sure we can rely on the entity's collider outside of this function - - self.update_collider() diff --git a/community/src/entity/player.py b/community/src/entity/player.py deleted file mode 100644 index 8efee46e..00000000 --- a/community/src/entity/player.py +++ /dev/null @@ -1,187 +0,0 @@ -import math -import glm - -import src.options as options -from src.entity.entity import Entity -from src.chunk.chunk import CHUNK_HEIGHT, CHUNK_LENGTH, CHUNK_WIDTH - -WALKING_SPEED = 4.317 -SPRINTING_SPEED = 7 # faster than in Minecraft, feels better - - -class Frustum: - left = glm.vec4(1.0) - right = glm.vec4(1.0) - top = glm.vec4(1.0) - bottom = glm.vec4(1.0) - near = glm.vec4(1.0) - far = glm.vec4(1.0) - - -def normalize(plane): - return plane / glm.length(plane.xyz) - - -class Player(Entity): - def __init__(self, world, shader, width, height): - super().__init__(world) - - self.view_width = width - self.view_height = height - - # create matrices - - self.mv_matrix = glm.mat4() - self.p_matrix = glm.mat4() - - # shaders - - self.shader = shader - - self.mvp_matrix_location = self.shader.find_uniform(b"u_MVPMatrix") - - # camera variables - - self.eyelevel = self.height - 0.2 - self.input = [0, 0, 0] - - self.target_speed = WALKING_SPEED - self.speed = self.target_speed - - self.interpolated_position = self.position - self.rounded_position = self.position - self.view_ray = glm.vec3(1.0) - - def update(self, delta_time): - # process input - - self.view_ray = glm.vec3( - glm.cos(self.rotation[0]) * glm.cos(self.rotation[1]), - glm.sin(self.rotation[1]), - glm.sin(self.rotation[0]) * glm.cos(self.rotation[1]), - ) - - if delta_time * 20 > 1: - self.speed = self.target_speed - - else: - self.speed += (self.target_speed - self.speed) * delta_time * 20 - - multiplier = self.speed * (1, 2)[self.flying] - - if self.flying and self.input[1]: - self.accel[1] = self.input[1] * multiplier - - if self.input[0] or self.input[2]: - angle = self.rotation[0] - math.atan2(self.input[2], self.input[0]) + math.tau / 4 - - self.accel[0] = math.cos(angle) * multiplier - self.accel[2] = math.sin(angle) * multiplier - - if not self.flying and self.input[1] > 0: - self.jump() - - # process physics & collisions &c - - super().update(delta_time) - - self.rounded_position = [round(i) for i in self.position] - - def update_interpolation(self, delta_time): - self.interpolated_position = glm.mix(glm.vec3(*self.position), glm.vec3(*self.old_position), self.step) - self.step -= delta_time - - def update_frustum(self, mat): - mat = glm.transpose(mat) - for i in range(4): - Frustum.left[i] = mat[3][i] + mat[0][i] - Frustum.right[i] = mat[3][i] - mat[0][i] - Frustum.bottom[i] = mat[3][i] + mat[1][i] - Frustum.top[i] = mat[3][i] - mat[1][i] - Frustum.near[i] = mat[3][i] + mat[2][i] - Frustum.far[i] = mat[3][i] - mat[2][i] - - Frustum.left = normalize(Frustum.left) - Frustum.right = normalize(Frustum.right) - Frustum.bottom = normalize(Frustum.bottom) - Frustum.top = normalize(Frustum.top) - Frustum.near = normalize(Frustum.near) - Frustum.far = normalize(Frustum.far) - - def check_in_frustum(self, chunk_pos): - """Frustum check of each If the chunk is not in the view frustum, it is discarded""" - planes = (Frustum.left, Frustum.right, Frustum.bottom, Frustum.top, Frustum.near, Frustum.far) - result = 2 - center = glm.vec3( - chunk_pos * glm.ivec3(CHUNK_WIDTH, 0, CHUNK_LENGTH) - + glm.ivec3(CHUNK_WIDTH / 2, CHUNK_HEIGHT / 2, CHUNK_LENGTH / 2) - ) - - for plane in planes: - _in = 0 - _out = 0 - normal = plane.xyz - w = plane.w - if glm.dot(normal, center + glm.vec3(CHUNK_WIDTH / 2, CHUNK_HEIGHT / 2, CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(-CHUNK_WIDTH / 2, CHUNK_HEIGHT / 2, CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(CHUNK_WIDTH / 2, CHUNK_HEIGHT / 2, -CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(-CHUNK_WIDTH / 2, CHUNK_HEIGHT / 2, -CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(CHUNK_WIDTH / 2, -CHUNK_HEIGHT / 2, CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(-CHUNK_WIDTH / 2, -CHUNK_HEIGHT / 2, CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(CHUNK_WIDTH / 2, -CHUNK_HEIGHT / 2, -CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - if glm.dot(normal, center + glm.vec3(-CHUNK_WIDTH / 2, -CHUNK_HEIGHT / 2, -CHUNK_LENGTH / 2)) + w < 0: - _out += 1 - else: - _in += 1 - - if not _in: - return 0 - elif _out: - result = 1 - return result - - def update_matrices(self): - # create projection matrix - - self.p_matrix = glm.perspective( - glm.radians(options.FOV + 10 * (self.speed - WALKING_SPEED) / (SPRINTING_SPEED - WALKING_SPEED)), - float(self.view_width) / self.view_height, - 0.1, - 500, - ) - - # create modelview matrix - - self.mv_matrix = glm.mat4(1.0) - self.mv_matrix = glm.rotate(self.mv_matrix, self.rotation[1], -glm.vec3(1.0, 0.0, 0.0)) - self.mv_matrix = glm.rotate(self.mv_matrix, self.rotation[0] + math.tau / 4, glm.vec3(0.0, 1.0, 0.0)) - - self.mv_matrix = glm.translate( - self.mv_matrix, -glm.vec3(*self.interpolated_position) - glm.vec3(0, self.eyelevel, 0) - ) - - # modelviewprojection matrix - - self.shader.uniform_matrix(self.mvp_matrix_location, self.p_matrix * self.mv_matrix) - self.update_frustum(self.p_matrix * self.mv_matrix) diff --git a/community/src/music.py b/community/src/music.py deleted file mode 100644 index 73dc9ce4..00000000 --- a/community/src/music.py +++ /dev/null @@ -1,9 +0,0 @@ -import pyglet.media - - -class MusicPlayer(pyglet.media.Player): - def __init__(self): - super().__init__() - - self.standby = False - self.next_time = 0 diff --git a/community/src/options.py b/community/src/options.py deleted file mode 100644 index d1b4d8c8..00000000 --- a/community/src/options.py +++ /dev/null @@ -1,69 +0,0 @@ -# FAST = 0; FANCY = 1 -import pyglet.gl as gl - -# Render Distance (in chunks) -RENDER_DISTANCE = 4 - -# Field of view -FOV = 90 - -# --------------------------------- Performance --------------------------------- - -# Indirect Rendering -INDIRECT_RENDERING = False # Requires OpenGL 4.2+. Disable if having issues. -# Indirect rendering caches the draw command parameters in a seperate indirect command buffer, -# thus reducing the amount of data needed to supply the draw call - -# Conditional Rendering with Occlusion queries -ADVANCED_OPENGL = False # Not recommended unless using NVIDIA cards. -# Might cause more slowdowns that speedups. -# Do not expect any concrete framerate improvement. -# Max number of chunk updates per chunk every tick -CHUNK_UPDATES = 4 - -# Vertical Sync -VSYNC = False - -# Max CPU ahead frames -MAX_CPU_AHEAD_FRAMES = 3 # Number of frames the CPU can be ahead of the GPU until waiting for it to finish rendering. -# Higher values gives higher framerate but causes framerate instability and higher frame spikes -# Lower values causes average lower framerate but gives smoother framerate -# Recommended values are between 0 and 9 - -# Legacy Smooth FPS -SMOOTH_FPS = False # Legacy way to force the flushing of command buffer and forces the CPU to wait for the GPU to finish rendering. -# Incompatible Max CPU Ahead Frames (it won't be effective) -# Enable this to test whether its impact is better. Similar to Max CPU Ahead frames to 0 - -# --------------------------------- Quality --------------------------------- - -# Ambient Occlusion and Smooth Lighting -SMOOTH_LIGHTING = True # Smooth Lighting smoothes the light of each vertex to achieve a linear interpolation -# of light on each fragment, hence creating a smoother light effect -# It also adds ambient occlusion, to simulate light blocked by opaqua objects -# Chunk updates / building will be severely affecteds by this feature - -# Better Translucency blending -FANCY_TRANSLUCENCY = True - -# Minification Filter -MIPMAP_TYPE = gl.GL_NEAREST # Linear filtering samples the texture in a bilinear way in the distance, -# however its effect is negligible and should not be used. -# Mipmaps generates lower detailed textures -# that will be sampled in high distances, thus reducing aliasing. -# Possible filters: -# No filter (GL_NEAREST) -# Linear filter (GL_LINEAR), -# Nearest mipmap (GL_NEAREST_MIPMAP_NEAREST), -# Linear mipmap (GL_NEAREST_MIPMAP_LINEAR) -# Bilinear mipmap (GL_LINEAR_MIPMAP_NEAREST) -# Trilinear mipmap (GL_LINEAR_MIPMAP_LINEAR) - -# Colored Lighting -COLORED_LIGHTING = True # Uses an alternative shader program to achieve a more colored lighting -# No performance impact should happen -# It aims to look similar to Beta 1.8+ -# Disable for authentic Alpha - Beta look - -# Multisample Anti-aliasing (might not work) -ANTIALIASING = 0 diff --git a/community/src/physics/__init__.py b/community/src/physics/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/src/physics/hit.py b/community/src/physics/hit.py deleted file mode 100644 index e86d2aea..00000000 --- a/community/src/physics/hit.py +++ /dev/null @@ -1,105 +0,0 @@ -import math - -HIT_RANGE = 3 - - -class HitRay: - def __init__(self, world, rotation, starting_position): - self.world = world - - # get the ray unit vector based on rotation angles - # sqrt(ux ^ 2 + uy ^ 2 + uz ^ 2) must always equal 1 - - self.vector = ( - math.cos(rotation[0]) * math.cos(rotation[1]), - math.sin(rotation[1]), - math.sin(rotation[0]) * math.cos(rotation[1]), - ) - - # point position - self.position = list(starting_position) - - # block position in which point currently is - self.block = tuple(map(lambda x: int(round(x)), self.position)) - - # current distance the point has travelled - self.distance = 0 - - # 'check' and 'step' both return 'True' if something is hit, and 'False' if not - - def check(self, hit_callback, distance, current_block, next_block): - if self.world.get_block_number(next_block): - hit_callback(current_block, next_block) - return True - - else: - self.position = list(map(lambda x: self.position[x] + self.vector[x] * distance, range(3))) - - self.block = next_block - self.distance += distance - - return False - - def step(self, hit_callback): - bx, by, bz = self.block - - # point position relative to block centre - local_position = list(map(lambda x: self.position[x] - self.block[x], range(3))) - - # we don't want to deal with negatives, so remove the sign - # this is also cool because it means we don't need to take into account the sign of our ray vector - # we do need to remember which components were negative for later on, however - - sign = [1, 1, 1] # '1' for positive, '-1' for negative - absolute_vector = list(self.vector) - - for component, element in enumerate(self.vector): - sign[component] = 2 * (element >= 0) - 1 - absolute_vector[component] *= sign[component] - local_position[component] *= sign[component] - - lx, ly, lz = local_position - vx, vy, vz = absolute_vector - - # calculate intersections - # I only detail the math for the first component (X) because the rest is pretty self-explanatory - - # ray line (passing through the point) r ≡ (x - lx) / vx = (y - ly) / lz = (z - lz) / vz (parametric equation) - - # +x face fx ≡ x = 0.5 (y & z can be any real number) - # r ∩ fx ≡ (0.5 - lx) / vx = (y - ly) / vy = (z - lz) / vz - - # x: x = 0.5 - # y: (y - ly) / vy = (0.5 - lx) / vx IFF y = (0.5 - lx) / vx * vy + ly - # z: (z - lz) / vz = (0.5 - lx) / vx IFF z = (0.5 - lx) / vx * vz + lz - - if vx: - x = 0.5 - y = (0.5 - lx) / vx * vy + ly - z = (0.5 - lx) / vx * vz + lz - - if y >= -0.5 and y <= 0.5 and z >= -0.5 and z <= 0.5: - distance = math.sqrt((x - lx) ** 2 + (y - ly) ** 2 + (z - lz) ** 2) - - # we can return straight away here - # if we intersect with one face, we know for a fact we're not intersecting with any of the others - - return self.check(hit_callback, distance, (bx, by, bz), (bx + sign[0], by, bz)) - - if vy: - x = (0.5 - ly) / vy * vx + lx - y = 0.5 - z = (0.5 - ly) / vy * vz + lz - - if x >= -0.5 and x <= 0.5 and z >= -0.5 and z <= 0.5: - distance = math.sqrt((x - lx) ** 2 + (y - ly) ** 2 + (z - lz) ** 2) - return self.check(hit_callback, distance, (bx, by, bz), (bx, by + sign[1], bz)) - - if vz: - x = (0.5 - lz) / vz * vx + lx - y = (0.5 - lz) / vz * vy + ly - z = 0.5 - - if x >= -0.5 and x <= 0.5 and y >= -0.5 and y <= 0.5: - distance = math.sqrt((x - lx) ** 2 + (y - ly) ** 2 + (z - lz) ** 2) - return self.check(hit_callback, distance, (bx, by, bz), (bx, by, bz + sign[2])) diff --git a/community/src/renderer/__init__.py b/community/src/renderer/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/src/save.py b/community/src/save.py deleted file mode 100644 index 703eb3c5..00000000 --- a/community/src/save.py +++ /dev/null @@ -1,116 +0,0 @@ -import nbtlib as nbt -import base36 -import glm -import logging - -from src.chunk.chunk import Chunk, CHUNK_HEIGHT, CHUNK_LENGTH, CHUNK_WIDTH - - -class Save: - def __init__(self, world, path="save"): - self.world = world - self.path = path - - def chunk_position_to_path(self, chunk_position): - x, _, z = chunk_position - - chunk_path = "/".join( - (self.path, base36.dumps(x % 64), base36.dumps(z % 64), f"c.{base36.dumps(x)}.{base36.dumps(z)}.dat") - ) - - return chunk_path - - def load_chunk(self, chunk_position): - logging.debug(f"Loading chunk at position {chunk_position}") - # load the chunk file - - chunk_path = self.chunk_position_to_path(chunk_position) - - try: - chunk_blocks = nbt.load(chunk_path)["Level"]["Blocks"] - - except FileNotFoundError: - return - - # create chunk and fill it with the blocks from our chunk file - - self.world.chunks[glm.ivec3(chunk_position)] = Chunk(self.world, glm.ivec3(chunk_position)) - - for x in range(CHUNK_WIDTH): - for y in range(CHUNK_HEIGHT): - for z in range(CHUNK_LENGTH): - self.world.chunks[glm.ivec3(chunk_position)].blocks[x][y][z] = chunk_blocks[ - x * CHUNK_LENGTH * CHUNK_HEIGHT + z * CHUNK_HEIGHT + y - ] - - def save_chunk(self, chunk_position): - logging.debug(f"Saving chunk at position {chunk_position}") - x, y, z = chunk_position - - # try to load the chunk file - # if it doesn't exist, create a new one - - chunk_path = self.chunk_position_to_path(chunk_position) - - try: - chunk_data = nbt.load(chunk_path) - - except FileNotFoundError: - chunk_data = nbt.File({"": nbt.Compound({"Level": nbt.Compound()})}) - - chunk_data["Level"]["xPos"] = x - chunk_data["Level"]["zPos"] = z - - # fill the chunk file with the blocks from our chunk - - chunk_blocks = nbt.ByteArray([0] * (CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_LENGTH)) - - for x in range(CHUNK_WIDTH): - for y in range(CHUNK_HEIGHT): - for z in range(CHUNK_LENGTH): - block = self.world.chunks[chunk_position].blocks[x][y][z] - chunk_blocks[x * CHUNK_LENGTH * CHUNK_HEIGHT + z * CHUNK_HEIGHT + y] = block - - # save the chunk file - - chunk_data["Level"]["Blocks"] = chunk_blocks - chunk_data.save(chunk_path, gzipped=True) - - def load(self): - logging.info("Loading world") - - # for x in range(-1, 15): - # for y in range(-15, 1): - # self.load_chunk((x, 0, y)) - - for x in range(-4, 4): - for y in range(-4, 4): - self.load_chunk((x, 0, y)) - - # for x in range(-1, 1): - # for y in range(-1, 1): - # self.load_chunk((x, 0, y)) - - for chunk_position, unlit_chunk in self.world.chunks.items(): - for x in range(CHUNK_WIDTH): - for y in range(CHUNK_HEIGHT): - for z in range(CHUNK_LENGTH): - if unlit_chunk.blocks[x][y][z] in self.world.light_blocks: - world_pos = glm.ivec3( - chunk_position[0] * CHUNK_WIDTH + x, - chunk_position[1] * CHUNK_HEIGHT + y, - chunk_position[2] * CHUNK_LENGTH + z, - ) - self.world.increase_light(world_pos, 15, False) - - def save(self): - logging.info("Saving world") - for chunk_position in self.world.chunks: - if chunk_position[1] != 0: # reject all chunks above and below the world limit - continue - - chunk = self.world.chunks[chunk_position] - - if chunk.modified: - self.save_chunk(chunk_position) - chunk.modified = False diff --git a/community/src/util.py b/community/src/util.py deleted file mode 100644 index f44ced21..00000000 --- a/community/src/util.py +++ /dev/null @@ -1,17 +0,0 @@ -import glm - -DIRECTIONS = ( - glm.ivec3(1, 0, 0), - glm.ivec3(-1, 0, 0), - glm.ivec3(0, 1, 0), - glm.ivec3(0, -1, 0), - glm.ivec3(0, 0, 1), - glm.ivec3(0, 0, -1), -) - -EAST = glm.ivec3(1, 0, 0) -WEST = glm.ivec3(-1, 0, 0) -UP = glm.ivec3(0, 1, 0) -DOWN = glm.ivec3(0, -1, 0) -SOUTH = glm.ivec3(0, 0, 1) -NORTH = glm.ivec3(0, 0, -1) diff --git a/community/src/world.py b/community/src/world.py deleted file mode 100644 index a3216eaa..00000000 --- a/community/src/world.py +++ /dev/null @@ -1,605 +0,0 @@ -import ctypes -import math -import logging -import glm - -from functools import cmp_to_key -from collections import deque - -import pyglet.gl as gl - -from src.renderer.block_type import BlockType -from src.save import Save -from src.util import DIRECTIONS -from src.entity.player import Player -from src.chunk.chunk import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_LENGTH, Chunk - -import src.options as options -import models - - -def get_chunk_position(position): - x, y, z = position - - return glm.ivec3((x // CHUNK_WIDTH), (y // CHUNK_HEIGHT), (z // CHUNK_LENGTH)) - - -def get_local_position(position): - x, y, z = position - - return glm.ivec3(int(x % CHUNK_WIDTH), int(y % CHUNK_HEIGHT), int(z % CHUNK_LENGTH)) - - -class World: - def __init__(self, shader, player: Player | None, texture_manager, options): - self.options = options - self.shader = shader - self.player = player - self.texture_manager = texture_manager - self.block_types: list[BlockType | None] = [None] - - self.shader_daylight_location = shader.find_uniform(b"u_Daylight") - self.daylight = 1800 - self.incrementer = 0 - self.time = 0 - self.c = 0 - - # Compat - self.get_chunk_position = get_chunk_position - self.get_local_position = get_local_position - - # parse block type data file - - with open("data/blocks.mcpy") as f: - blocks_data = f.readlines() - - logging.info("Loading block models") - for block in blocks_data: - if block[0] in ["\n", "#"]: # skip if empty line or comment - continue - - number, props = block.split(":", 1) - number = int(number) - - # default block - - name = "Unknown" - model = models.cube - texture = {"all": "unknown"} - - # read properties - - for prop in props.split(","): - prop = prop.strip() - prop = list(filter(None, prop.split(" ", 1))) - - if prop[0] == "sameas": - sameas_number = int(prop[1]) - sameas = self.block_types[sameas_number] - - if sameas is not None: - name = sameas.name - texture = dict(sameas.block_face_textures) - model = sameas.model - - elif prop[0] == "name": - name = eval(prop[1]) - - elif prop[0][:7] == "texture": - _, side = prop[0].split(".") - texture[side] = prop[1].strip() - - elif prop[0] == "model": - model = eval(prop[1]) - - # add block type - - block_type = BlockType(self.texture_manager, name, texture, model) - - if number < len(self.block_types): - self.block_types[number] = block_type - - else: - self.block_types.append(block_type) - - self.light_blocks = [10, 11, 50, 51, 62, 75] - - self.texture_manager.generate_mipmaps() - - indices = [] - - for nquad in range(CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_LENGTH * 8): - indices.append(4 * nquad + 0) - indices.append(4 * nquad + 1) - indices.append(4 * nquad + 2) - indices.append(4 * nquad + 2) - indices.append(4 * nquad + 3) - indices.append(4 * nquad + 0) - - self.ibo = gl.GLuint(0) - gl.glGenBuffers(1, self.ibo) - gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, self.ibo) - gl.glBufferData( - gl.GL_ELEMENT_ARRAY_BUFFER, - ctypes.sizeof(gl.GLuint * len(indices)), - (gl.GLuint * len(indices))(*indices), - gl.GL_STATIC_DRAW, - ) - gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, 0) - - logging.debug("Created Shared Index Buffer") - - # load the world - - self.save = Save(self) - - self.chunks = {} - self.sorted_chunks = [] - - # light update queue - - self.light_increase_queue = deque() # Node: World Position, light - self.light_decrease_queue = deque() # Node: World position, light - self.skylight_increase_queue = deque() - self.skylight_decrease_queue = deque() - self.chunk_building_queue = deque() - - self.save.load() - - logging.info("Lighting chunks") - for world_chunk in self.chunks.values(): - self.init_skylight(world_chunk) - - logging.info("Generating chunks") - for world_chunk in self.chunks.values(): - world_chunk.update_subchunk_meshes() - - del indices - self.visible_chunks: list[Chunk] = [] - - # Debug variables - - self.pending_chunk_update_count = 0 - self.chunk_update_counter = 0 - - def __del__(self): - gl.glDeleteBuffers(1, ctypes.byref(self.ibo)) - - ################ LIGHTING ENGINE ################ - - def increase_light(self, world_pos, newlight, light_update=True): - chunk = self.chunks[get_chunk_position(world_pos)] - local_pos = get_local_position(world_pos) - - chunk.set_block_light(local_pos, newlight) - - self.light_increase_queue.append((world_pos, newlight)) - - self.propagate_increase(light_update) - - def propagate_increase(self, light_update): - """Starts propagating all queued block light increases - This algorithm is derived from the Seed of Andromeda's tutorial - It uses a FIFO queue to queue the pending blocks to light - It then checks its 6 neighbours and propagate light to one of them if the latter's light level - is lower than the former one""" - - while self.light_increase_queue: - pos, light_level = self.light_increase_queue.popleft() - - for direction in DIRECTIONS: - neighbour_pos = pos + direction - - chunk = self.chunks.get(get_chunk_position(neighbour_pos), None) - if not chunk: - continue - local_pos = get_local_position(neighbour_pos) - - if not self.is_opaque_block(neighbour_pos) and chunk.get_block_light(local_pos) + 2 <= light_level: - chunk.set_block_light(local_pos, light_level - 1) - - self.light_increase_queue.append((neighbour_pos, light_level - 1)) - - if light_update: - chunk.update_at_position(neighbour_pos) - - def init_skylight(self, pending_chunk): - """Initializes the skylight of each chunks - To avoid insufferable lag from propagating from the top of the chunks when - most of the heights would be air, it instead runs a simple algorithm - to check where the highest point of the chunk is and propagates skylight from - this height""" - - chunk_pos = pending_chunk.chunk_position - - # Retrieve the highest chunk point - height = 0 - for lx in range(CHUNK_WIDTH): - for lz in range(CHUNK_LENGTH): - ly = 0 - - for ly in range(CHUNK_HEIGHT - 1, -1, -1): - if pending_chunk.blocks[lx][ly][lz]: - break - if ly > height: - height = ly - - # Initialize skylight to 15 until that point and then queue a skylight propagation increase - for lx in range(CHUNK_WIDTH): - for lz in range(CHUNK_LENGTH): - ly = 0 - - for ly in range(CHUNK_HEIGHT - 1, height, -1): - pending_chunk.set_sky_light(glm.ivec3(lx, ly, lz), 15) - - pos = glm.ivec3(CHUNK_WIDTH * chunk_pos[0] + lx, ly, CHUNK_LENGTH * chunk_pos[2] + lz) - self.skylight_increase_queue.append((pos, 15)) - - self.propagate_skylight_increase(False) - - def propagate_skylight_increase(self, light_update): - """Similar to the block light algorithm, but - do not lower the light level in the downward direction""" - while self.skylight_increase_queue: - pos, light_level = self.skylight_increase_queue.popleft() - - for direction in DIRECTIONS: - neighbour_pos = pos + direction - if neighbour_pos.y > CHUNK_HEIGHT: - continue - - _chunk = self.chunks.get(get_chunk_position(neighbour_pos), None) - if not _chunk: - continue - local_pos = get_local_position(neighbour_pos) - - transparency = self.get_transparency(neighbour_pos) - - if transparency and _chunk.get_sky_light(local_pos) < light_level: - newlight = light_level - (2 - transparency) - - if light_update: - _chunk.update_at_position(neighbour_pos) - - if direction.y == -1: - _chunk.set_sky_light(local_pos, newlight) - self.skylight_increase_queue.append((neighbour_pos, newlight)) - elif _chunk.get_sky_light(local_pos) + 2 <= light_level: - _chunk.set_sky_light(local_pos, newlight - 1) - self.skylight_increase_queue.append((neighbour_pos, newlight - 1)) - - def decrease_light(self, world_pos): - chunk = self.chunks[get_chunk_position(world_pos)] - local_pos = get_local_position(world_pos) - old_light = chunk.get_block_light(local_pos) - chunk.set_block_light(local_pos, 0) - self.light_decrease_queue.append((world_pos, old_light)) - - self.propagate_decrease(True) - self.propagate_increase(True) - - def propagate_decrease(self, light_update): - """Starts propagating all queued block light decreases - This algorithm is derived from the Seed of Andromeda's tutorial - It uses a FIFO queue to queue the pending blocks to unlight - It then checks its 6 neighbours and unlight to one of them if the latter's light level - is lower than the former one""" - - while self.light_decrease_queue: - pos, light_level = self.light_decrease_queue.popleft() - - for direction in DIRECTIONS: - neighbour_pos = pos + direction - - chunk = self.chunks.get(get_chunk_position(neighbour_pos), None) - if not chunk: - continue - local_pos = get_local_position(neighbour_pos) - - if self.get_block_number(neighbour_pos) in self.light_blocks: - self.light_increase_queue.append((neighbour_pos, 15)) - continue - - if not self.is_opaque_block(neighbour_pos): - neighbour_level = chunk.get_block_light(local_pos) - if not neighbour_level: - continue - - if neighbour_level < light_level: - chunk.set_block_light(local_pos, 0) - if light_update: - chunk.update_at_position(neighbour_pos) - self.light_decrease_queue.append((neighbour_pos, neighbour_level)) - elif neighbour_level >= light_level: - self.light_increase_queue.append((neighbour_pos, neighbour_level)) - - def decrease_skylight(self, world_pos, light_update=True): - chunk = self.chunks[get_chunk_position(world_pos)] - local_pos = get_local_position(world_pos) - old_light = chunk.get_sky_light(local_pos) - chunk.set_sky_light(local_pos, 0) - self.skylight_decrease_queue.append((world_pos, old_light)) - - self.propagate_skylight_decrease(light_update) - self.propagate_skylight_increase(light_update) - - def propagate_skylight_decrease(self, light_update=True): - """Similar to the block light algorithm, but - always unlight in the downward direction""" - while self.skylight_decrease_queue: - pos, light_level = self.skylight_decrease_queue.popleft() - - for direction in DIRECTIONS: - neighbour_pos = pos + direction - - chunk = self.chunks.get(get_chunk_position(neighbour_pos), None) - if not chunk: - continue - local_pos = get_local_position(neighbour_pos) - - if self.get_transparency(neighbour_pos): - neighbour_level = chunk.get_sky_light(local_pos) - if not neighbour_level: - continue - - if direction.y == -1 or neighbour_level < light_level: - chunk.set_sky_light(local_pos, 0) - if light_update: - chunk.update_at_position(neighbour_pos) - self.skylight_decrease_queue.append((neighbour_pos, neighbour_level)) - elif neighbour_level >= light_level: - self.skylight_increase_queue.append((neighbour_pos, neighbour_level)) - - # Getter and setters - - def get_raw_light(self, position): - chunk = self.chunks.get(get_chunk_position(position), None) - if not chunk: - return 15 << 4 - local_position = self.get_local_position(position) - return chunk.get_raw_light(local_position) - - def get_light(self, position): - chunk = self.chunks.get(get_chunk_position(position), None) - if not chunk: - return 0 - local_position = self.get_local_position(position) - return chunk.get_block_light(local_position) - - def get_skylight(self, position): - chunk = self.chunks.get(get_chunk_position(position), None) - if not chunk: - return 15 - local_position = self.get_local_position(position) - return chunk.get_sky_light(local_position) - - def set_light(self, position, light): - chunk = self.chunks.get(get_chunk_position(position), None) - local_position = get_local_position(position) - chunk.set_block_light(local_position, light) - - def set_skylight(self, position, light): - chunk = self.chunks.get(get_chunk_position(position), None) - local_position = get_local_position(position) - chunk.set_sky_light(local_position, light) - - ################################################# - - def get_block_number(self, position): - chunk_position = get_chunk_position(position) - - if chunk_position not in self.chunks: - return 0 - - lx, ly, lz = get_local_position(position) - - block_number = self.chunks[chunk_position].blocks[lx][ly][lz] - return block_number - - def get_transparency(self, position): - block_type = self.block_types[self.get_block_number(position)] - - if not block_type: - return 2 - - return block_type.transparent - - def is_opaque_block(self, position): - # get block type and check if it's opaque or not - # air counts as a transparent block, so test for that too - - block_type = self.block_types[self.get_block_number(position)] - - if not block_type: - return False - - return not block_type.transparent - - def create_chunk(self, chunk_position): - self.chunks[chunk_position] = Chunk(self, chunk_position) - self.init_skylight(self.chunks[chunk_position]) - - def set_block(self, position, number): # set number to 0 (air) to remove block - x, y, z = position - chunk_position = get_chunk_position(position) - - if chunk_position not in self.chunks: # if no chunks exist at this position, create a new one - if number == 0: - return # no point in creating a whole new chunk if we're not gonna be adding anything - - self.create_chunk(chunk_position) - - if self.get_block_number(position) == number: # no point updating mesh if the block is the same - return - - lx, ly, lz = get_local_position(position) - - self.chunks[chunk_position].blocks[lx][ly][lz] = number - self.chunks[chunk_position].modified = True - - self.chunks[chunk_position].update_at_position((x, y, z)) - - if number: - if number in self.light_blocks: - self.increase_light(position, 15) - - elif self.block_types[number].transparent != 2: - self.decrease_light(position) - self.decrease_skylight(position) - - elif not number: - self.decrease_light(position) - self.decrease_skylight(position) - - cx, cy, cz = chunk_position - - def try_update_chunk_at_position(chunk_position, position): - if chunk_position in self.chunks: - self.chunks[chunk_position].update_at_position(position) - - if lx == CHUNK_WIDTH - 1: - try_update_chunk_at_position(glm.ivec3(cx + 1, cy, cz), (x + 1, y, z)) - if lx == 0: - try_update_chunk_at_position(glm.ivec3(cx - 1, cy, cz), (x - 1, y, z)) - - if ly == CHUNK_HEIGHT - 1: - try_update_chunk_at_position(glm.ivec3(cx, cy + 1, cz), (x, y + 1, z)) - if ly == 0: - try_update_chunk_at_position(glm.ivec3(cx, cy - 1, cz), (x, y - 1, z)) - - if lz == CHUNK_LENGTH - 1: - try_update_chunk_at_position(glm.ivec3(cx, cy, cz + 1), (x, y, z + 1)) - if lz == 0: - try_update_chunk_at_position(glm.ivec3(cx, cy, cz - 1), (x, y, z - 1)) - - def try_set_block(self, position, number, collider): - # if we're trying to remove a block, whatever let it go through - - if not number: - return self.set_block(position, 0) - - # make sure the block doesn't intersect with the passed collider - - for block_collider in self.block_types[number].colliders: - if collider & (block_collider + position): - return - - self.set_block(position, number) - - def toggle_AO(self): - self.options.SMOOTH_LIGHTING = not self.options.SMOOTH_LIGHTING - for chunk in self.chunks.values(): - chunk.update_subchunk_meshes() - - def speed_daytime(self): - if self.daylight <= 480: - self.incrementer = 1 - if self.daylight >= 1800: - self.incrementer = -1 - - def can_render_chunk(self, chunk_position): - if self.player is None: - return False - - return ( - self.player.check_in_frustum(chunk_position) - and math.dist(self.get_chunk_position(self.player.position), chunk_position) <= self.options.RENDER_DISTANCE - ) - - def prepare_rendering(self): - self.visible_chunks = [ - self.chunks[chunk_position] for chunk_position in self.chunks if self.can_render_chunk(chunk_position) - ] - self.sort_chunks() - - def sort_chunks(self): - if self.player is None: - return - - player_chunk_pos = self.get_chunk_position(self.player.position) - self.visible_chunks.sort( - key=cmp_to_key( - lambda a, b: int( - math.dist(player_chunk_pos, a.chunk_position) - math.dist(player_chunk_pos, b.chunk_position) - ) - ) - ) - self.sorted_chunks = tuple(reversed(self.visible_chunks)) - - def draw_translucent_fast(self): - gl.glEnable(gl.GL_BLEND) - gl.glDisable(gl.GL_CULL_FACE) - gl.glDepthMask(gl.GL_FALSE) - - for render_chunk in self.sorted_chunks: - render_chunk.draw_translucent(gl.GL_TRIANGLES) - - gl.glDepthMask(gl.GL_TRUE) - gl.glEnable(gl.GL_CULL_FACE) - gl.glDisable(gl.GL_BLEND) - - def draw_translucent_fancy(self): - gl.glDepthMask(gl.GL_FALSE) - gl.glFrontFace(gl.GL_CW) - gl.glEnable(gl.GL_BLEND) - - for render_chunk in self.sorted_chunks: - render_chunk.draw_translucent(gl.GL_TRIANGLES) - - gl.glFrontFace(gl.GL_CCW) - - for render_chunk in self.sorted_chunks: - render_chunk.draw_translucent(gl.GL_TRIANGLES) - - gl.glDisable(gl.GL_BLEND) - gl.glDepthMask(gl.GL_TRUE) - - draw_translucent = draw_translucent_fancy if options.FANCY_TRANSLUCENCY else draw_translucent_fast - - def draw(self): - self.c = 0 - daylight_multiplier = self.daylight / 1800 - gl.glClearColor( - 0.5 * (daylight_multiplier - 0.26), - 0.8 * (daylight_multiplier - 0.26), - (daylight_multiplier - 0.26) * 1.36, - 1.0, - ) - gl.glUniform1f(self.shader_daylight_location, daylight_multiplier) - - for render_chunk in self.visible_chunks: - render_chunk.draw(gl.GL_TRIANGLES) - - self.draw_translucent() - - def update_daylight(self): - if self.incrementer == -1: - if self.daylight < 480: # Moonlight of 4 - self.incrementer = 0 - elif self.incrementer == 1: - if self.daylight >= 1800: - self.incrementer = 0 - - if self.time % 36000 == 0: - self.incrementer = 1 - elif self.time % 36000 == 18000: - self.incrementer = -1 - - self.daylight += self.incrementer - - def build_pending_chunks(self): - if self.chunk_building_queue: - pending_chunk = self.chunk_building_queue.popleft() - pending_chunk.update_mesh() - - def process_chunk_updates(self): - for chunk in self.visible_chunks: - chunk.process_chunk_updates() - - def tick(self, delta_time): - self.chunk_update_counter = 0 - self.time += 1 - self.pending_chunk_update_count = sum(len(chunk.chunk_update_queue) for chunk in self.chunks.values()) - self.update_daylight() - self.build_pending_chunks() - self.process_chunk_updates() diff --git a/community/start.bat b/community/start.bat new file mode 100644 index 00000000..775351f9 --- /dev/null +++ b/community/start.bat @@ -0,0 +1,3 @@ +pip install pyglet +pip install noise +py main.py \ No newline at end of file diff --git a/community/subchunk.py b/community/subchunk.py new file mode 100644 index 00000000..dc27b92c --- /dev/null +++ b/community/subchunk.py @@ -0,0 +1,90 @@ +SUBCHUNK_WIDTH = 4 +SUBCHUNK_HEIGHT = 4 +SUBCHUNK_LENGTH = 4 + +class Subchunk: + def __init__(self, parent, subchunk_position): + self.parent = parent + self.world = self.parent.world + + self.subchunk_position = subchunk_position + + self.local_position = ( + self.subchunk_position[0] * SUBCHUNK_WIDTH, + self.subchunk_position[1] * SUBCHUNK_HEIGHT, + self.subchunk_position[2] * SUBCHUNK_LENGTH) + + self.position = ( + self.parent.position[0] + self.local_position[0], + self.parent.position[1] + self.local_position[1], + self.parent.position[2] + self.local_position[2]) + + # mesh variables + + self.mesh_vertex_positions = [] + self.mesh_tex_coords = [] + self.mesh_shading_values = [] + + self.mesh_index_counter = 0 + self.mesh_indices = [] + + def update_mesh(self): + self.mesh_vertex_positions = [] + self.mesh_tex_coords = [] + self.mesh_shading_values = [] + + self.mesh_index_counter = 0 + self.mesh_indices = [] + + def add_face(face): + vertex_positions = block_type.vertex_positions[face].copy() + + for i in range(4): + vertex_positions[i * 3 + 0] += x + vertex_positions[i * 3 + 1] += y + vertex_positions[i * 3 + 2] += z + + self.mesh_vertex_positions.extend(vertex_positions) + + indices = [0, 1, 2, 0, 2, 3] + for i in range(6): + indices[i] += self.mesh_index_counter + + self.mesh_indices.extend(indices) + self.mesh_index_counter += 4 + + self.mesh_tex_coords.extend(block_type.tex_coords[face]) + self.mesh_shading_values.extend(block_type.shading_values[face]) + + for local_x in range(SUBCHUNK_WIDTH): + for local_y in range(SUBCHUNK_HEIGHT): + for local_z in range(SUBCHUNK_LENGTH): + parent_lx = self.local_position[0] + local_x + parent_ly = self.local_position[1] + local_y + parent_lz = self.local_position[2] + local_z + + block_number = self.parent.blocks[parent_lx][parent_ly][parent_lz] + + if block_number: + block_type = self.world.block_types[block_number] + + x, y, z = ( + self.position[0] + local_x, + self.position[1] + local_y, + self.position[2] + local_z) + + # if block is cube, we want it to check neighbouring blocks so that we don't uselessly render faces + # if block isn't a cube, we just want to render all faces, regardless of neighbouring blocks + # since the vast majority of blocks are probably anyway going to be cubes, this won't impact performance all that much; the amount of useless faces drawn is going to be minimal + + if block_type.is_cube: + if not self.world.is_opaque_block((x + 1, y, z)): add_face(0) + if not self.world.is_opaque_block((x - 1, y, z)): add_face(1) + if not self.world.is_opaque_block((x, y + 1, z)): add_face(2) + if not self.world.is_opaque_block((x, y - 1, z)): add_face(3) + if not self.world.is_opaque_block((x, y, z + 1)): add_face(4) + if not self.world.is_opaque_block((x, y, z - 1)): add_face(5) + + else: + for i in range(len(block_type.vertex_positions)): + add_face(i) \ No newline at end of file diff --git a/community/src/renderer/texture_manager.py b/community/texture_manager.py similarity index 55% rename from community/src/renderer/texture_manager.py rename to community/texture_manager.py index 6fb7952b..6cfc9fdf 100644 --- a/community/src/renderer/texture_manager.py +++ b/community/texture_manager.py @@ -1,12 +1,9 @@ +import ctypes import pyglet -import logging import pyglet.gl as gl -import src.options as options - - -class TextureManager: +class Texture_manager: def __init__(self, texture_width, texture_height, max_textures): self.texture_width = texture_width self.texture_height = texture_height @@ -19,45 +16,27 @@ def __init__(self, texture_width, texture_height, max_textures): gl.glGenTextures(1, self.texture_array) gl.glBindTexture(gl.GL_TEXTURE_2D_ARRAY, self.texture_array) - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, options.MIPMAP_TYPE) + gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST) gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST) gl.glTexImage3D( - gl.GL_TEXTURE_2D_ARRAY, - 0, - gl.GL_RGBA, - self.texture_width, - self.texture_height, - self.max_textures, - 0, - gl.GL_RGBA, - gl.GL_UNSIGNED_BYTE, - None, - ) - + gl.GL_TEXTURE_2D_ARRAY, 0, gl.GL_RGBA, + self.texture_width, self.texture_height, self.max_textures, + 0, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, None) + def generate_mipmaps(self): - logging.debug(f"Generating Mipmaps, using mipmap type {options.MIPMAP_TYPE}") gl.glGenerateMipmap(gl.GL_TEXTURE_2D_ARRAY) - + def add_texture(self, texture): - logging.debug(f"Loading texture textures/{texture}.png") - - if texture not in self.textures: + if not texture in self.textures: self.textures.append(texture) texture_image = pyglet.image.load(f"textures/{texture}.png").get_image_data() gl.glBindTexture(gl.GL_TEXTURE_2D_ARRAY, self.texture_array) gl.glTexSubImage3D( - gl.GL_TEXTURE_2D_ARRAY, - 0, - 0, - 0, - self.textures.index(texture), - self.texture_width, - self.texture_height, - 1, - gl.GL_RGBA, - gl.GL_UNSIGNED_BYTE, - texture_image.get_data("RGBA", texture_image.width * 4), - ) + gl.GL_TEXTURE_2D_ARRAY, 0, + 0, 0, self.textures.index(texture), + self.texture_width, self.texture_height, 1, + gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, + texture_image.get_data("RGBA", texture_image.width * 4)) \ No newline at end of file diff --git a/community/textures/cow.png b/community/textures/cow.png new file mode 100644 index 00000000..f5ebec71 Binary files /dev/null and b/community/textures/cow.png differ diff --git a/community/textures/creeper.png b/community/textures/creeper.png new file mode 100644 index 00000000..25015dff Binary files /dev/null and b/community/textures/creeper.png differ diff --git a/community/textures/curry.png b/community/textures/curry.png new file mode 100644 index 00000000..3991d0fd Binary files /dev/null and b/community/textures/curry.png differ diff --git a/community/textures/daisy.png b/community/textures/daisy.png new file mode 100644 index 00000000..36d7c49a Binary files /dev/null and b/community/textures/daisy.png differ diff --git a/community/textures/log_top.png b/community/textures/log_top.png new file mode 100644 index 00000000..5f256e4b Binary files /dev/null and b/community/textures/log_top.png differ diff --git a/community/textures/pig.png b/community/textures/pig.png new file mode 100644 index 00000000..e3e7fdcb Binary files /dev/null and b/community/textures/pig.png differ diff --git a/community/textures/rose.png b/community/textures/rose.png new file mode 100644 index 00000000..4a202b59 Binary files /dev/null and b/community/textures/rose.png differ diff --git a/community/textures/skeleton.png b/community/textures/skeleton.png new file mode 100644 index 00000000..7e3f0957 Binary files /dev/null and b/community/textures/skeleton.png differ diff --git a/community/textures/temp b/community/textures/temp new file mode 100644 index 00000000..78981922 --- /dev/null +++ b/community/textures/temp @@ -0,0 +1 @@ +a diff --git a/community/textures/zombie.png b/community/textures/zombie.png new file mode 100644 index 00000000..81ec3d12 Binary files /dev/null and b/community/textures/zombie.png differ diff --git a/community/vert.glsl b/community/vert.glsl new file mode 100644 index 00000000..5a945d25 --- /dev/null +++ b/community/vert.glsl @@ -0,0 +1,18 @@ +#version 330 + +layout(location = 0) in vec3 vertex_position; +layout(location = 1) in vec3 tex_coords; +layout(location = 2) in float shading_value; + +out vec3 local_position; +out vec3 interpolated_tex_coords; +out float interpolated_shading_value; + +uniform mat4 matrix; + +void main(void) { + local_position = vertex_position; + interpolated_tex_coords = tex_coords; + interpolated_shading_value = shading_value; + gl_Position = matrix * vec4(vertex_position, 1.0); +} \ No newline at end of file diff --git a/community/world.py b/community/world.py new file mode 100644 index 00000000..f7543476 --- /dev/null +++ b/community/world.py @@ -0,0 +1,409 @@ +import math +from random import * +from noise import * +import time +import threading + +import chunk + +import block_type +import texture_manager + +# import custom block models +import models.leaves +import models.liquid +import models.plant +import models.cactus + +class World: + def __init__(self): + self.texture_manager = texture_manager.Texture_manager(16, 16, 256) + self.block_types = [None] + + self.block_types.append(block_type.Block_type(self.texture_manager, name="cobblestone", block_face_textures = {"all": "cobblestone"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="grass", block_face_textures = {"top": "grass", "bottom": "dirt", "sides": "grass_side"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="grass_block", block_face_textures = {"all": "grass"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="dirt", block_face_textures = {"all": "dirt"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="stone", block_face_textures = {"all": "stone"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="sand", block_face_textures = {"all": "sand"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="planks", block_face_textures = {"all": "planks"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="log", block_face_textures = {"top": "log_top", "bottom": "log_top", "sides": "log_side"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="water", block_face_textures = {"all": "water"}, model = models.liquid, transparent=True)) + self.block_types.append(block_type.Block_type(self.texture_manager, name="rose", block_face_textures = {"all": "rose"}, model = models.plant)) + self.block_types.append(block_type.Block_type(self.texture_manager, name="cactus", block_face_textures = {"top": "cactus_top", "bottom": "cactus_bottom", "sides": "cactus_side"}, model = models.cactus)) + self.block_types.append(block_type.Block_type(self.texture_manager, name="dead_bush", block_face_textures = {"all": "dead_bush"}, model = models.plant)) + self.block_types.append(block_type.Block_type(self.texture_manager, name="leaves", block_face_textures = {"all": "leaves"}, model = models.leaves)) + self.block_types.append(block_type.Block_type(self.texture_manager, name="bedrock", block_face_textures = {"all": "bedrock"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="lava", block_face_textures = {"all": "lava"}, model = models.liquid, transparent=True)) + self.block_types.append(block_type.Block_type(self.texture_manager, name="coal_ore", block_face_textures = {"all": "coal_ore"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="iron_ore", block_face_textures = {"all": "iron_ore"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="diamond_ore", block_face_textures = {"all": "diamond_ore"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="under_water", block_face_textures = {"all": "water"})) + self.block_types.append(block_type.Block_type(self.texture_manager, name="under_lava", block_face_textures = {"all": "lava"})) + + self.texture_manager.generate_mipmaps() + + self.chunks = {} + + self.scale = 100.0 # Controls the frequency of the noise + self.octaves = 4 # Increased number of layers of noise to combine for more detail + self.persistence = 0.5 + self.lacunarity = 2.0 + + self.cave_scale = 10.0 # Controls the frequency of the cave noise + self.cave_threshold = 0.1 # Threshold for cave generation + + for x in range(-8, 7): + for z in range(-8, 7): + self.generate_chunk(x, z) + + # multiprocessing + + self.chunk_load_queue = {} + self.active_loading_chunks = [] + self.active_threads = 0 + + for chunk_position in self.chunks: + self.add_chunk_to_load_queue(chunk_position) + + def generate_chunk(self, x, z): + chunk_position = (x, 0, z) + current_chunk = chunk.Chunk(self, chunk_position) + trees = list() + for i in range(5): + tree_x = randint(0, 15) + tree_z = randint(0, 15) + trees.append((tree_x, tree_z)) + + chunk_offset_x = x * chunk.CHUNK_WIDTH + chunk_offset_z = z * chunk.CHUNK_LENGTH + + for i in range(chunk.CHUNK_WIDTH): + for j in range(chunk.CHUNK_HEIGHT): + for k in range(chunk.CHUNK_LENGTH): + # Use chunk-specific offsets to avoid repeating patterns + surfaceY = 60 + pnoise2( + (chunk_offset_x + i) / self.scale, + (chunk_offset_z + k) / self.scale, + octaves=self.octaves, + persistence=self.persistence, + lacunarity=self.lacunarity + ) * 50 + surfaceY = max(0, surfaceY) # Ensure surfaceY is not below 0 + + if j == 0: + current_chunk.blocks[i][j][k] = 14 + + if 0 < j < surfaceY: + cave_noise = pnoise3( + (chunk_offset_x + i) / self.cave_scale, + j / self.cave_scale, + (chunk_offset_z + k) / self.cave_scale + ) + cave_noise2 = pnoise3( + (chunk_offset_x + i) / (self.cave_scale * 2), + j / (self.cave_scale * 2), + (chunk_offset_z + k) / (self.cave_scale * 2) + ) + + if cave_noise < self.cave_threshold and cave_noise2 < self.cave_threshold and j != surfaceY-2: + current_chunk.blocks[i][j][k] = 0 # Cave block + else: + current_chunk.blocks[i][j][k] = 5 # Ground block + + for l in range(math.ceil(surfaceY), 61): + if l < 60: + current_chunk.blocks[i][l][k] = 19 # Underground block + else: + current_chunk.blocks[i][l][k] = 9 + + + + for m in range(math.ceil(surfaceY), math.ceil(surfaceY) + 2): + current_chunk.blocks[i][m][k] = 4 # Surface block + + if surfaceY > 58: + current_chunk.blocks[i][math.ceil(surfaceY)+2][k] = 2 + + # Ore generation logic + if 30 <= j <= surfaceY: + if current_chunk.blocks[i][j][k] == 5 and randint(0, 100) < 5: # Chance to place coal + current_chunk.blocks[i][j][k] = 16 # Coal ore + if 10 <= j <= 50: + if current_chunk.blocks[i][j][k] == 5 and randint(0, 100) < 2: # Chance to place iron + current_chunk.blocks[i][j][k] = 17 # Iron ore + if 2 <= j <= 15: + if current_chunk.blocks[i][j][k] == 5 and randint(0, 1000) < 2: # Chance to place diamond + current_chunk.blocks[i][j][k] = 18 # Diamond ore + + # Cave entrance generation logic + if 100 > surfaceY > 60: + if randint(0, 5000) < 2: + cave_width = randint(2, 3) + for offset_x in range(-cave_width, cave_width + 1): + for offset_z in range(-cave_width, cave_width + 1): + if 0 <= i + offset_x < chunk.CHUNK_WIDTH and 0 <= k + offset_z < chunk.CHUNK_LENGTH: + for j in range(int(surfaceY), chunk.CHUNK_HEIGHT): + cave_noise = pnoise3( + (chunk_offset_x + i + offset_x)/ self.cave_scale, + j / self.cave_scale, + (chunk_offset_z + k + offset_z)/ self.cave_scale + ) + cave_noise2 = pnoise3( + (chunk_offset_x + i + offset_x)/ (self.cave_scale * 2), + j / (self.cave_scale * 2), + (chunk_offset_z + k + offset_z)/ (self.cave_scale * 2) + ) + if cave_noise < self.cave_threshold and cave_noise2 < self.cave_threshold: + current_chunk.blocks[i + offset_x][j][k + offset_z] = 0 # Tunnel block + else: + break + + if 1 <= j <= 3 and current_chunk.blocks[i][j][k] == 0: + current_chunk.blocks[i][j][k] = 5 + + if 4 <=j <=7 and current_chunk.blocks[i][j][k] == 0: + if j<7: + current_chunk.blocks[i][j][k] = 20 + else: + current_chunk.blocks[i][j][k] = 15 + + for _ in range(5): + placed = False + attempts = 0 + while not placed and attempts < 50: # Limit attempts to find a valid tree position + tree_x = randint(0, 15) + tree_z = randint(0, 15) + baseY = math.ceil(surfaceY) + tree_y = baseY + 2 + + if current_chunk.blocks[tree_x][tree_y][tree_z] == 2: # Check if the block is grass + # Check surrounding blocks for existing trees + has_adjacent_tree = False + for dx in range(-1, 2): + for dz in range(-1, 2): + if 0 <= tree_x + dx < chunk.CHUNK_WIDTH and 0 <= tree_z + dz < chunk.CHUNK_LENGTH: + if (tree_x + dx, tree_y, tree_z + dz) in trees: + has_adjacent_tree = True + break + if has_adjacent_tree: + break + + if not has_adjacent_tree: + # Place the log blocks + for n in range(5): + current_chunk.blocks[tree_x][tree_y + n][tree_z] = 8 # Log block + + # Place the leaves blocks + leaves_height = tree_y + 5 + for dx in range(-2, 3): + for dz in range(-2, 3): + if (0 <= tree_x + dx < chunk.CHUNK_WIDTH and + 0 <= tree_z + dz < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x + dx][leaves_height][tree_z + dz] = 13 + # Leaves block + if (0 <= tree_x< chunk.CHUNK_WIDTH and + 0 <= tree_z< chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 1][tree_z] = 13 + if (0 <= tree_x+1< chunk.CHUNK_WIDTH and + 0 <= tree_z + 1 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x+1][leaves_height + 1][tree_z+1] = 13 + if (0 <= tree_x - 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z + 1 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x-1][leaves_height + 1][tree_z+1] = 13 + if (0 <= tree_x - 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z - 1 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x-1][leaves_height + 1][tree_z-1] = 13 + if (0 <= tree_x + 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z -1 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x+1][leaves_height + 1][tree_z-1] = 13 + if (0 <= tree_x + 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z< chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x+1][leaves_height + 1][tree_z] = 13 + if (0 <= tree_x - 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x-1][leaves_height + 1][tree_z] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z + 1 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 1][tree_z+1] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z - 1 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 1][tree_z-1] = 13 + if (0 <= tree_x + 2 < chunk.CHUNK_WIDTH and + 0 <= tree_z < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x+2][leaves_height + 1][tree_z] = 13 + if (0 <= tree_x - 2 < chunk.CHUNK_WIDTH and + 0 <= tree_z < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x-2][leaves_height + 1][tree_z] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z + 2 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 1][tree_z+2] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z - 2 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 1][tree_z-2] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 2][tree_z] = 13 + if (0 <= tree_x + 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x+1][leaves_height + 2][tree_z] = 13 + if (0 <= tree_x - 1 < chunk.CHUNK_WIDTH and + 0 <= tree_z < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x-1][leaves_height + 2][tree_z] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z + 2 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 2][tree_z+1] = 13 + if (0 <= tree_x < chunk.CHUNK_WIDTH and + 0 <= tree_z - 2 < chunk.CHUNK_LENGTH): + current_chunk.blocks[tree_x][leaves_height + 2][tree_z-1] = 13 + + trees.append((tree_x, tree_y, tree_z)) + placed = True + attempts += 1 + + self.chunks[chunk_position] = current_chunk + + def add_chunk_to_load_queue(self, chunk_position): + def chunk_load_function(chunk): # in separate thread + # time.sleep(0.1) + + chunk.update_subchunk_meshes() + chunk.update_mesh() + + chunk = self.chunks[chunk_position] + + thread = threading.Thread(target = chunk_load_function, args = (chunk,)) + thread.daemon = True + + self.chunk_load_queue[chunk_position] = {"chunk": chunk, "thread": thread, "running": False} + + def process_load_queue(self, propagation_position = (0, 0, 0)): + closest_chunk_position = None + closest_chunk_distance = math.inf + + for chunk_position in self.chunk_load_queue: + queue_object = self.chunk_load_queue[chunk_position] + + if queue_object["running"]: + if not queue_object["thread"].is_alive(): + queue_object["chunk"].send_mesh_data_to_gpu() # we don't wanna put this in 'chunk_load_function' because we could lose the GIL at any time during the execution of this function + + del self.chunk_load_queue[chunk_position] + + self.active_loading_chunks.remove(chunk_position) + self.active_threads -= 1 + + break # break since we just changed our dictionary's size + + continue + + chunk_distance = math.sqrt( + (chunk_position[0] * chunk.CHUNK_WIDTH - propagation_position[0]) ** 2 + + (chunk_position[1] * chunk.CHUNK_HEIGHT - propagation_position[1]) ** 2 + + (chunk_position[2] * chunk.CHUNK_LENGTH - propagation_position[2]) ** 2) + + if chunk_distance < closest_chunk_distance: + closest_chunk_distance = chunk_distance + closest_chunk_position = chunk_position + + else: # else means we didn't artificially break out of the loop (idk why we can't use 'elif' here) + if closest_chunk_position and closest_chunk_distance < 320: + chunk_position = closest_chunk_position + queue_object = self.chunk_load_queue[chunk_position] + + if self.active_threads < 1: #len(os.sched_getaffinity(0)): # 'multiprocessing.cpu_count' gives us *total* CPU count, not CPU's usable by our program + queue_object["thread"].start() + queue_object["running"] = True + + self.active_loading_chunks.append(chunk_position) + self.active_threads += 1 + + def get_chunk_position(self, position): + x, y, z = position + + return ( + math.floor(x / chunk.CHUNK_WIDTH), + math.floor(y / chunk.CHUNK_HEIGHT), + math.floor(z / chunk.CHUNK_LENGTH)) + + def get_local_position(self, position): + x, y, z = position + + return ( + int(x % chunk.CHUNK_WIDTH), + int(y % chunk.CHUNK_HEIGHT), + int(z % chunk.CHUNK_LENGTH)) + + def get_block_number(self, position): + x, y, z = position + chunk_position = self.get_chunk_position(position) + + if not chunk_position in self.chunks: + return 0 + + lx, ly, lz = self.get_local_position(position) + + block_number = self.chunks[chunk_position].blocks[lx][ly][lz] + return block_number + + def is_opaque_block(self, position): + block_type = self.block_types[self.get_block_number(position)] + + if not block_type: + return False + + return not block_type.transparent + + def set_block(self, position, number): + x, y, z = position + chunk_position = self.get_chunk_position(position) + + if not chunk_position in self.chunks: + if number == 0: + return # no point in creating a whole new chunk if we're not gonna be adding anything to it + + self.chunks[chunk_position] = chunk.Chunk(self, chunk_position) + + if self.get_block_number(position) == number: + return + + lx, ly, lz = self.get_local_position(position) + + def try_update_chunk_at_position(chunk_position, position): + if chunk_position in self.chunks and not chunk_position in self.active_loading_chunks: + self.chunks[chunk_position].update_at_position(position) + + self.chunks[chunk_position].update_mesh() + self.chunks[chunk_position].send_mesh_data_to_gpu() + + self.chunks[chunk_position].blocks[lx][ly][lz] = number + try_update_chunk_at_position(chunk_position, position) + + cx, cy, cz = chunk_position + + if lx == chunk.CHUNK_WIDTH - 1: try_update_chunk_at_position((cx + 1, cy, cz), (x + 1, y, z)) + if lx == 0: try_update_chunk_at_position((cx - 1, cy, cz), (x - 1, y, z)) + + if ly == chunk.CHUNK_HEIGHT - 1: try_update_chunk_at_position((cx, cy + 1, cz), (x, y + 1, z)) + if ly == 0: try_update_chunk_at_position((cx, cy - 1, cz), (x, y - 1, z)) + + if lz == chunk.CHUNK_LENGTH - 1: try_update_chunk_at_position((cx, cy, cz + 1), (x, y, z + 1)) + if lz == 0: try_update_chunk_at_position((cx, cy, cz - 1), (x, y, z - 1)) + + def get_nearby_blocks(self, position): + # Return a list of block positions near the player's position. + # This is a placeholder implementation. You'll need to adapt this to your world's data structure. + x, y, z = map(int, position) + nearby_blocks = [] + for dx in range(-1, 2): + for dy in range(-1, 2): + for dz in range(-1, 2): + block_pos = (x + dx, y + dy, z + dz) + if self.get_block_number(block_pos): # Check if there's a block at this position + nearby_blocks.append(block_pos) + return nearby_blocks + + + def draw(self): + for chunk_position in self.chunks: + self.chunks[chunk_position].draw() \ No newline at end of file