From 830daec408b5723463d5e549b7610968a56c11f3 Mon Sep 17 00:00:00 2001 From: Roz K Date: Fri, 6 Jan 2023 18:45:34 +0100 Subject: [PATCH] Bump engine submodule and merge vertex and param formats. --- engine | 2 +- game/batch.py | 6 +++--- game/game.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engine b/engine index f463db3..7384a01 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit f463db316fc9eae9f26a83605d1c05f662b6e7de +Subproject commit 7384a014ff0ec184bc970be39cf6d7e6e1fae6b4 diff --git a/game/batch.py b/game/batch.py index d70f451..25297a0 100644 --- a/game/batch.py +++ b/game/batch.py @@ -16,7 +16,7 @@ from ctypes import c_ubyte, c_ushort, c_void_p, POINTER, addressof from engine import ( - buffer, INSTANCE_FLAG_SPAWNED, BATCH_MAX_SIZE, param_type, params_format, + buffer, INSTANCE_FLAG_SPAWNED, BATCH_MAX_SIZE, vertex_type, vertex_format, create_batch, fill_batch, draw_batch, destroy_batch) _flags_t = c_ubyte @@ -32,7 +32,7 @@ class Batch: assert max_size <= BATCH_MAX_SIZE nparams = len(params_decls) if nparams: - self._batch = create_batch(vertices._vertices, max_size, params_format(*params_decls.values())) + self._batch = create_batch(vertices._vertices, max_size, vertex_format(*params_decls.values())) else: self._batch = create_batch(vertices._vertices, max_size, None) self.vertices = vertices @@ -43,7 +43,7 @@ class Batch: self.mesh = buffer(_mesh_t, max_size) self._meshes = _mesh_p(self.mesh) if nparams: - self.param = tuple(map(lambda f: buffer(param_type(f), max_size), params_decls.values())) + self.param = tuple(map(lambda f: buffer(vertex_type(f), max_size), params_decls.values())) self._params = (c_void_p * nparams)(*map(addressof, self.param)) self._name = dict(zip(params_decls.keys(), range(nparams))) for name, value in zip(params_decls.keys(), self.param): diff --git a/game/game.py b/game/game.py index a349cdc..8a17fee 100644 --- a/game/game.py +++ b/game/game.py @@ -137,7 +137,7 @@ def create_scene(keyboard, mouse): rock_mesh = tiles_vertices.get_mesh('rock') mud_mesh = tiles_vertices.get_mesh('mud') lava_mesh = tiles_vertices.get_mesh('lava') - tiles_batch = Batch(Vertices(*tiles_vertices), generated.size ** 2, translation = PARAM_FORMAT_VEC3_SHORT) + tiles_batch = Batch(Vertices(*tiles_vertices), generated.size ** 2, translation = VERTEX_FORMAT_VEC3_SHORT) #TODO: generator & for real vc = generated.volcano_c @@ -179,8 +179,8 @@ def create_scene(keyboard, mouse): cube_mesh = tests_vertices.get_mesh('cube') clouds_mesh = tests_vertices.get_mesh('clouds') tests_batch = Batch(Vertices(*tests_vertices), 3, - translation = PARAM_FORMAT_VEC3_FLOAT, - orientation = PARAM_FORMAT_MAT3_INT10 | PARAM_FORMAT_NORMALIZE) + translation = VERTEX_FORMAT_VEC3_FLOAT, + orientation = VERTEX_FORMAT_MAT3_INT10 | VERTEX_FORMAT_NORMALIZE) blob_forward = math.vec3_normalize((sun_direction[0], sun_direction[1], 0.0)) blob_right = math.vec3_cross(blob_forward, math.vec3_up) blob_orientation = mat3(vec3(*blob_right), vec3(*blob_forward), vec3_up)