zscript-doc/api/drawing/TexMan.md

109 lines
5.7 KiB
Markdown
Raw Permalink Normal View History

2018-12-29 16:05:19 -08:00
# TexMan
The **Tex**ture **Man**ager is used for loading, finding, replacing and getting
information on textures.
2018-12-29 16:05:19 -08:00
```
struct TexMan
{
2019-08-14 03:32:51 -07:00
static textureid CheckForTexture(string name, int usetype, int flags = TexMan.TryAny);
static int CheckRealHeight(textureid tex);
static string GetName(textureid tex);
static vector2 GetScaledOffset(textureid tex);
static vector2 GetScaledSize(textureid tex);
static int, int GetSize(textureid tex);
static void SetCameraToTexture(Actor viewpoint, string texture, double fov);
static bool OkForLocalization(textureid patch, string textSubstitute);
2019-04-07 03:11:50 -07:00
2019-08-14 03:32:51 -07:00
deprecated("3.8") static void ReplaceTextures(string from, string to, int flags);
2018-12-29 16:05:19 -08:00
}
```
2019-08-14 03:31:41 -07:00
### `CheckForTexture`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns a `textureid` for the texture named `name`. `usetype` may be one of the
following, which selects what kind of texture to find:
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
| Name | Description |
| ---- | ----------- |
| `TexMan.TYPE_ANY` | Any kind of texture. |
| `TexMan.TYPE_AUTOPAGE` | Unused. |
| `TexMan.TYPE_BUILD` | Unused. |
| `TexMan.TYPE_DECAL` | A decal pic defined in `DECALDEF`. |
| `TexMan.TYPE_FIRSTDEFINED` | The first composite texture defined by the IWad. |
| `TexMan.TYPE_FLAT` | A flat (ceiling/floor texture,) i.e. `FLOOR0_1`. |
| `TexMan.TYPE_FONTCHAR` | Unused. |
| `TexMan.TYPE_MISCPATCH` | A loose graphic, i.e. `M_DOOM`. |
| `TexMan.TYPE_NULL` | Reserved for the null graphic. Ignores `name`. |
| `TexMan.TYPE_OVERRIDE` | Overridable generalized textures, for instance textures defined in `TX_START` or BUILD ART tiles. |
| `TexMan.TYPE_SKINGRAPHIC` | Any loose graphic defined in `S_SKIN` i.e. statusbar faces. |
| `TexMan.TYPE_SKINSPRITE` | Any sprite defined in `S_SKIN`. |
| `TexMan.TYPE_SPRITE` | A sprite in `S_START`, i.e. `MEDIA0`. |
| `TexMan.TYPE_WALLPATCH` | An uncomposited patch, i.e. `DOOR2_1`. |
| `TexMan.TYPE_WALL` | Any composited wall texture, i.e. `STARTAN2`. |
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
`flags` may be any of the following combined (with the bitwise OR operator
`|`:)
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
| Name | Description |
| ---- | ----------- |
| `TexMan.ALLOWSKINS` | Allows `SkinGraphic`s to be returned under normal circumstances. |
| `TexMan.DONTCREATE` | Will never create a new texture when searching. |
| `TexMan.LOCALIZE` | TODO . |
| `TexMan.OVERRIDABLE` | Allows overriding of this texture by for instance `TEXTURES`. |
| `TexMan.RETURNFIRST` | Allows returning the `FirstDefined` "null" texture under normal circumstances. |
| `TexMan.SHORTNAMEONLY` | Will force use of a short name when searching. |
| `TexMan.TRYANY` | Returns any other type of texture if one is not found in the specified use type. Default. |
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `CheckRealHeight`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the height in pixels of the texture down to the last scanline which has
actual pixel data. Note that this operation is extremely slow and should be
used sparingly.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetName`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the original name of a `textureid`.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetScaledOffset`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the offsets for this texture used to display it (rather than the
original offsets.)
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetScaledSize`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the size used to display this texture (rather than the physical size.)
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetSize`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the width and height of a `textureid`.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `SetCameraToTexture`
2019-04-07 03:11:50 -07:00
2019-08-14 03:31:41 -07:00
Sets the camera texture (as defined in `ANIMDEFS`) `texture` to the viewpoint
of `viewpoint` with a fov of `fov`.
2019-04-07 03:11:50 -07:00
2019-08-14 03:31:41 -07:00
### `OkForLocalization`
2019-04-07 03:11:50 -07:00
2019-08-14 03:31:41 -07:00
TODO
2019-04-07 03:11:50 -07:00
2019-08-14 03:31:41 -07:00
### `ReplaceTextures`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Note: This function is deprecated and `LevelLocals::ReplaceTextures` should be
used instead.
2019-04-07 03:11:50 -07:00
2019-08-14 03:31:41 -07:00
Replaces textures named `from` with `to` within the map. `flags` may be used to
filter out certain textures from being replaced:
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
| Name | Description |
| ---- | ----------- |
| `TexMan.NOT_BOTTOM` | Filters out linedef bottom textures. |
| `TexMan.NOT_CEILING` | Filters out ceiling flats. |
| `TexMan.NOT_FLAT` | Filters out any flat texture. |
| `TexMan.NOT_FLOOR` | Filters out floor flats. |
| `TexMan.NOT_MIDDLE` | Filters out linedef middle textures. |
| `TexMan.NOT_TOP` | Filters out linedef upper textures. |
| `TexMan.NOT_WALL` | Filters out any linedef texture. |
2018-12-29 16:05:19 -08:00
<!-- EOF -->