feat: Add support for loading meshes from PK3 archives

- Updated CMakeLists.txt to find and link libzip.
- Modified conanfile.py to include libzip as a dependency.
- Created a new configuration file for Quake 3 runtime settings.
- Implemented loading of Quake 3 maps from PK3 archives in mesh_service.
- Added new Lua bindings for loading meshes from archives in script_engine_service.
- Enhanced material handling in materialx_shader_generator to support vertex data blocks.
This commit is contained in:
2026-01-06 17:33:43 +00:00
parent 7ec101cbf6
commit 7b6f2d4567
10 changed files with 823 additions and 106 deletions

View File

@@ -471,6 +471,7 @@ void ScriptEngineService::RegisterBindings(lua_State* L) {
};
bind("load_mesh_from_file", &ScriptEngineService::LoadMeshFromFile);
bind("load_mesh_from_pk3", &ScriptEngineService::LoadMeshFromArchive);
bind("physics_create_box", &ScriptEngineService::PhysicsCreateBox);
bind("physics_step_simulation", &ScriptEngineService::PhysicsStepSimulation);
bind("physics_get_transform", &ScriptEngineService::PhysicsGetTransform);
@@ -528,6 +529,36 @@ int ScriptEngineService::LoadMeshFromFile(lua_State* L) {
return 2;
}
int ScriptEngineService::LoadMeshFromArchive(lua_State* L) {
auto* context = static_cast<LuaBindingContext*>(lua_touserdata(L, lua_upvalueindex(1)));
auto logger = context ? context->logger : nullptr;
if (!context || !context->meshService) {
lua_pushnil(L);
lua_pushstring(L, "Mesh service not available");
return 2;
}
const char* archivePath = luaL_checkstring(L, 1);
const char* entryPath = luaL_checkstring(L, 2);
if (logger) {
logger->Trace("ScriptEngineService", "LoadMeshFromArchive",
"archivePath=" + std::string(archivePath) +
", entryPath=" + std::string(entryPath));
}
MeshPayload payload;
std::string error;
if (!context->meshService->LoadFromArchive(archivePath, entryPath, payload, error)) {
lua_pushnil(L);
lua_pushstring(L, error.c_str());
return 2;
}
context->meshService->PushMeshToLua(L, payload);
lua_pushnil(L);
return 2;
}
int ScriptEngineService::PhysicsCreateBox(lua_State* L) {
auto* context = static_cast<LuaBindingContext*>(lua_touserdata(L, lua_upvalueindex(1)));
auto logger = context ? context->logger : nullptr;