Bump engine submodule and merge vertex and param formats.

This commit is contained in:
Roz K 2023-01-06 18:45:34 +01:00
parent 4783f0ba2d
commit 830daec408
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
3 changed files with 7 additions and 7 deletions

2
engine

@ -1 +1 @@
Subproject commit f463db316fc9eae9f26a83605d1c05f662b6e7de
Subproject commit 7384a014ff0ec184bc970be39cf6d7e6e1fae6b4

View File

@ -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):

View File

@ -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)