From a281ffa32ea615670d369503692f057b2dc60e6f Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 19 Feb 2026 05:19:18 +0400 Subject: feat: Enhance model and texture loading with improved error handling and new features - Introduced `LoadedModel` and `LoadedTexture` structs for better encapsulation of model and texture data. - Added functions to load models and textures from archives, including support for resolving textures based on materials and wear entries. - Implemented error handling for missing textures, materials, and wear entries. - Updated the rendering pipeline to support texture loading and binding, including command-line arguments for texture customization. - Enhanced the `texm` crate with new decoding capabilities for various pixel formats, including indexed textures. - Added tests for texture decoding and loading to ensure reliability and correctness. - Updated documentation to reflect changes in the material and texture resolution process. --- crates/render-demo/README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'crates/render-demo/README.md') diff --git a/crates/render-demo/README.md b/crates/render-demo/README.md index 0a1fb45..32d85ef 100644 --- a/crates/render-demo/README.md +++ b/crates/render-demo/README.md @@ -5,6 +5,7 @@ ## Назначение - Проверить, что `nres + msh-core + render-core` дают рабочий draw-path на реальных ассетах. +- Проверить текстурный path `WEAR -> MAT0 -> Texm` на реальных ассетах. - Служить минимальным reference-приложением. ## Запуск @@ -26,6 +27,20 @@ cargo run -p render-demo --features demo -- \ - `--width`, `--height` (опционально, default `1280x720`). - `--angle` (опционально): фиксированный угол поворота вокруг Y (в радианах). - `--spin-rate` (опционально, default `0.35`): скорость вращения в интерактивном режиме. +- `--texture `: явное имя `Texm` (override авто-резолва). +- `--texture-archive `: путь к архиву текстур (по умолчанию `textures.lib` рядом с `--archive`). +- `--material-archive `: путь к `material.lib` (по умолчанию соседний `material.lib`). +- `--wear `: имя wear-entry внутри модельного архива (по умолчанию `.wea`). +- `--no-texture`: отключить текстуры и рендерить однотонным цветом. + +## Авто-резолв текстуры + +Если не передан `--texture`, демо пытается взять текстуру из игровых данных: + +1. `model.msh -> model.wea` (первый wear-материал), +2. `material.lib` (`MAT0`) по имени материала с fallback `DEFAULT`, +3. первая непустая `textureName` фаза материала, +4. загрузка `Texm` из `textures.lib` (или `lightmap.lib` как fallback). ## Детерминированный снимок кадра @@ -43,7 +58,16 @@ cargo run -p render-demo --features demo -- \ --capture "target/render-parity/current/animals_a_l_01.png" ``` +Явный выбор текстуры: + +```bash +cargo run -p render-demo --features demo -- \ + --archive "testdata/Parkan - Iron Strategy/animals.rlb" \ + --model "A_L_01.msh" \ + --texture "PG09.0" +``` + ## Ограничения -- Рендер только геометрии (без материалов/текстур/FX). -- Вывод через `glDrawArrays(GL_TRIANGLES)` из расширенного triangle-list. +- Используется только базовая texture-фаза (без полной material/fx анимации). +- Вывод через `glDrawArrays(GL_TRIANGLES)` из расширенного triangle-list (позиции+UV). -- cgit v1.2.3