diff options
Diffstat (limited to 'CONTEXT.md')
| -rw-r--r-- | CONTEXT.md | 26 |
1 files changed, 21 insertions, 5 deletions
| @@ -329,11 +329,27 @@ vocabulary / decisions. | |||
| 329 | already-loaded `materialsystem.so` and walk every material with | 329 | already-loaded `materialsystem.so` and walk every material with |
| 330 | `FirstMaterial` / `NextMaterial` / `GetMaterial`. | 330 | `FirstMaterial` / `NextMaterial` / `GetMaterial`. |
| 331 | - `IMaterial::ColorModulate(r,g,b)` is applied to materials whose | 331 | - `IMaterial::ColorModulate(r,g,b)` is applied to materials whose |
| 332 | `GetTextureGroupName()` is `World textures` (sky names excluded), to | 332 | `GetTextureGroupName()` is `World textures` (sky names excluded) and to |
| 333 | `SkyBox textures` (or names containing `sky`), and to prop materials whose | 333 | `SkyBox textures` (or names containing `sky`). Lightmaps are not touched. |
| 334 | name starts with `models/props` (static props and prop_physics share those | 334 | - Props are NOT tinted through their materials: VertexLitGeneric materials get |
| 335 | model materials; NPC/player/weapon materials are excluded). Lightmaps are | 335 | their colour modulation from `IStudioRender`, which the engine sets per |
| 336 | not touched. | 336 | model draw (white), so the material var is overridden. `src/studio.cpp` |
| 337 | hooks the `VStudioRender025` interface object instead: | ||
| 338 | `SetColorModulation`/`SetAlphaModulation` (slots 27/28), `DrawModel` (29), | ||
| 339 | `DrawModelStaticProp` (30) and `DrawModelArray` (46), all checked against | ||
| 340 | `CStudioRenderContext`'s vtable in `studiorender.so`. | ||
| 341 | `DrawModel` checks `DrawModelInfo_t::m_pStudioHdr->name`; note the name is | ||
| 342 | the short form with Windows separators (`props_junk\wood_crate002a.mdl`, | ||
| 343 | no `models/` prefix), so prop detection matches `props/`, `props\` and | ||
| 344 | `props_` after stripping `models/` (excluding `props_skybox`). For a prop it | ||
| 345 | sets the prop colour right before calling the original draw; setting the | ||
| 346 | colour from a flag inside the draw does not work because the engine calls | ||
| 347 | `SetColorModulation(1,1,1)` *before* `DrawModel`. | ||
| 348 | Do not force `SetAlphaModulation` there: the earlier attempt produced | ||
| 349 | error-material props and a material-system crash. | ||
| 350 | - `prop_tint_update()` also writes `m_clrRender` on prop entities (dynamic | ||
| 351 | props) as a secondary path; the netvar resolver rejects offset 0 (an | ||
| 352 | embedded-table false positive) and only accepts 0x20..0x2000. | ||
| 337 | - Slot map (2013 SDK layout, registered under `VMaterialSystem080`): | 353 | - Slot map (2013 SDK layout, registered under `VMaterialSystem080`): |
| 338 | `IMaterialSystem` 73/74/75/76/77 = First/Next/Invalid/Get/GetNumMaterials; | 354 | `IMaterialSystem` 73/74/75/76/77 = First/Next/Invalid/Get/GetNumMaterials; |
| 339 | `IMaterial` 0/1/28 = GetName/GetTextureGroupName/ColorModulate. | 355 | `IMaterial` 0/1/28 = GetName/GetTextureGroupName/ColorModulate. |
