From ebc6ededf3cda48a71fbd1315f327f113a90d76b Mon Sep 17 00:00:00 2001 From: Roz K Date: Wed, 4 Jan 2023 09:06:13 +0100 Subject: [PATCH] Improve mesh struct after switching to mesh indices. --- __init__.py | 3 ++- cpp/render.hpp | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/__init__.py b/__init__.py index bbbd4c9..582003f 100644 --- a/__init__.py +++ b/__init__.py @@ -380,8 +380,9 @@ _create_vertices.argtypes = ( ctypes.c_void_p) # meshes def create_vertices(format, nvertices, vertices, indices, meshes): + assert len(meshes) % 2 == 0 return _create_vertices(format, - nvertices, _ubyte_addr(vertices), len(indices), _ushort_addr(indices), len(meshes), _uint_addr(meshes)) + nvertices, _ubyte_addr(vertices), len(indices), _ushort_addr(indices), len(meshes) // 2, _uint_addr(meshes)) create_batch = _engine.rk_create_batch create_batch.restype = _handle diff --git a/cpp/render.hpp b/cpp/render.hpp index efdde96..4629b98 100644 --- a/cpp/render.hpp +++ b/cpp/render.hpp @@ -72,12 +72,9 @@ enum : rk_ubyte { RK_INSTANCE_FLAGS_SPAWNED_VISIBLE = RK_INSTANCE_FLAG_SPAWNED | enum : rk_uint { RK_BATCH_MAX_SIZE = 65536 }; -union rk_mesh { - rk_uint packed; - struct { - rk_ushort base_index; - rk_ushort ntriangles; - }; +struct rk_mesh { + rk_uint base_index; + rk_uint ntriangles; }; RK_EXPORT void rk_render_initialize(