Bump engine submodule and merge vertex and param formats.
This commit is contained in:
parent
4783f0ba2d
commit
830daec408
2
engine
2
engine
@ -1 +1 @@
|
|||||||
Subproject commit f463db316fc9eae9f26a83605d1c05f662b6e7de
|
Subproject commit 7384a014ff0ec184bc970be39cf6d7e6e1fae6b4
|
@ -16,7 +16,7 @@
|
|||||||
from ctypes import c_ubyte, c_ushort, c_void_p, POINTER, addressof
|
from ctypes import c_ubyte, c_ushort, c_void_p, POINTER, addressof
|
||||||
|
|
||||||
from engine import (
|
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)
|
create_batch, fill_batch, draw_batch, destroy_batch)
|
||||||
|
|
||||||
_flags_t = c_ubyte
|
_flags_t = c_ubyte
|
||||||
@ -32,7 +32,7 @@ class Batch:
|
|||||||
assert max_size <= BATCH_MAX_SIZE
|
assert max_size <= BATCH_MAX_SIZE
|
||||||
nparams = len(params_decls)
|
nparams = len(params_decls)
|
||||||
if nparams:
|
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:
|
else:
|
||||||
self._batch = create_batch(vertices._vertices, max_size, None)
|
self._batch = create_batch(vertices._vertices, max_size, None)
|
||||||
self.vertices = vertices
|
self.vertices = vertices
|
||||||
@ -43,7 +43,7 @@ class Batch:
|
|||||||
self.mesh = buffer(_mesh_t, max_size)
|
self.mesh = buffer(_mesh_t, max_size)
|
||||||
self._meshes = _mesh_p(self.mesh)
|
self._meshes = _mesh_p(self.mesh)
|
||||||
if nparams:
|
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._params = (c_void_p * nparams)(*map(addressof, self.param))
|
||||||
self._name = dict(zip(params_decls.keys(), range(nparams)))
|
self._name = dict(zip(params_decls.keys(), range(nparams)))
|
||||||
for name, value in zip(params_decls.keys(), self.param):
|
for name, value in zip(params_decls.keys(), self.param):
|
||||||
|
@ -137,7 +137,7 @@ def create_scene(keyboard, mouse):
|
|||||||
rock_mesh = tiles_vertices.get_mesh('rock')
|
rock_mesh = tiles_vertices.get_mesh('rock')
|
||||||
mud_mesh = tiles_vertices.get_mesh('mud')
|
mud_mesh = tiles_vertices.get_mesh('mud')
|
||||||
lava_mesh = tiles_vertices.get_mesh('lava')
|
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
|
#TODO: generator & for real
|
||||||
vc = generated.volcano_c
|
vc = generated.volcano_c
|
||||||
@ -179,8 +179,8 @@ def create_scene(keyboard, mouse):
|
|||||||
cube_mesh = tests_vertices.get_mesh('cube')
|
cube_mesh = tests_vertices.get_mesh('cube')
|
||||||
clouds_mesh = tests_vertices.get_mesh('clouds')
|
clouds_mesh = tests_vertices.get_mesh('clouds')
|
||||||
tests_batch = Batch(Vertices(*tests_vertices), 3,
|
tests_batch = Batch(Vertices(*tests_vertices), 3,
|
||||||
translation = PARAM_FORMAT_VEC3_FLOAT,
|
translation = VERTEX_FORMAT_VEC3_FLOAT,
|
||||||
orientation = PARAM_FORMAT_MAT3_INT10 | PARAM_FORMAT_NORMALIZE)
|
orientation = VERTEX_FORMAT_MAT3_INT10 | VERTEX_FORMAT_NORMALIZE)
|
||||||
blob_forward = math.vec3_normalize((sun_direction[0], sun_direction[1], 0.0))
|
blob_forward = math.vec3_normalize((sun_direction[0], sun_direction[1], 0.0))
|
||||||
blob_right = math.vec3_cross(blob_forward, math.vec3_up)
|
blob_right = math.vec3_cross(blob_forward, math.vec3_up)
|
||||||
blob_orientation = mat3(vec3(*blob_right), vec3(*blob_forward), vec3_up)
|
blob_orientation = mat3(vec3(*blob_right), vec3(*blob_forward), vec3_up)
|
||||||
|
Loading…
Reference in New Issue
Block a user