aboutsummaryrefslogtreecommitdiff
path: root/docs/specs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-02-19 04:19:18 +0300
committerValentin Popov <valentin@popov.link>2026-02-19 04:19:18 +0300
commita281ffa32ea615670d369503692f057b2dc60e6f (patch)
tree321bcc1bfc489e2e7d0ff10dae620864ab08d054 /docs/specs
parent18d4c6cf9fabc18282b29d103c8d30024f66e49b (diff)
downloadfparkan-a281ffa32ea615670d369503692f057b2dc60e6f.tar.xz
fparkan-a281ffa32ea615670d369503692f057b2dc60e6f.zip
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.
Diffstat (limited to 'docs/specs')
-rw-r--r--docs/specs/render.md8
-rw-r--r--docs/specs/texture.md14
2 files changed, 22 insertions, 0 deletions
diff --git a/docs/specs/render.md b/docs/specs/render.md
index 2994049..ea63197 100644
--- a/docs/specs/render.md
+++ b/docs/specs/render.md
@@ -87,6 +87,14 @@ Material pipeline на кадре:
4. Резолвятся ссылки на texture/lightmap.
5. Невалидные ссылки обрабатываются fallback-стратегией.
+Практическая цепочка привязки для большинства `*.msh` ассетов из `*.rlb`:
+
+1. Для модели выбирается одноимённый `WEAR` (`<model_stem>.wea`).
+2. Из `WEAR` берётся material-слот (по имени, `legacyId` не участвует в выборе).
+3. В `Material.lib` ищется `MAT0` по имени (`DEFAULT`, затем индекс `0` как fallback).
+4. Из выбранной material-фазы берётся `textureName`.
+5. `Texm` ищется в `Textures.lib` (и/или lightmap-архиве для lightmap-ветки).
+
## 6. Texture path
При резолве текстуры:
diff --git a/docs/specs/texture.md b/docs/specs/texture.md
index 5fa1e9d..c25ec56 100644
--- a/docs/specs/texture.md
+++ b/docs/specs/texture.md
@@ -59,6 +59,20 @@ pixelCount = sum(max(1, width>>i) * max(1, height>>i), i=0..mipCount-1);
sizeCore = 32 + (format==0 ? 1024 : 0) + bytesPerPixel * pixelCount;
```
+## 4.1. Декодирование в RGBA8 (runtime/инструменты)
+
+Для CPU-пути (preview, валидация, оффлайн-конвертация) используется декодирование:
+
+- `0` (`Indexed8`): `index -> palette[index]` (`RGBA` из палитры 256×4).
+- `565`: `R5 G6 B5`, `A=255`.
+- `556`: `R5 G5 B6`, `A=255`.
+- `4444`: `A4 R4 G4 B4` (с расширением 4-битных каналов в 8-битные).
+- `88`: `L8 A8` (`R=G=B=L`).
+- `888`: `R8 G8 B8` + padding/служебный байт, `A=255`.
+- `8888`: `A8 R8 G8 B8`.
+
+Это декодирование соответствует текущему test/demo pipeline проекта.
+
## 5. `Page` chunk
```c