Texture¶
This page contains types/classes defined in hakowan.texture
module.
TextureLike: TypeAlias = ColorLike | Texture
module-attribute
¶
TextureLike is a type alias for a texture or color.
Texture
dataclass
¶
Texture provides the mapping from raw data to visual properties such as color.
Source code in hakowan/grammar/texture/texture.py
Uniform
dataclass
¶
Image
dataclass
¶
Bases: Texture
The image texture uses a texture image to provide a color field.
Attributes:
Name | Type | Description |
---|---|---|
filename |
PathLike
|
The path to the texture image. |
uv |
AttributeLike
|
The attribute to use as the texture coordinates. |
raw |
bool
|
Whether to use the raw image data, i.e. use linear color transfer function. This should be set to True for normal maps. |
Source code in hakowan/grammar/texture/texture.py
Checkerboard
dataclass
¶
Bases: Texture
The checkerboard texture provides a checkerboard color/value field.
Attributes:
Name | Type | Description |
---|---|---|
uv |
AttributeLike
|
The attribute to use as the texture coordinates. |
texture1 |
TextureLike
|
The texture to use for the first color/value. |
texture2 |
TextureLike
|
The texture to use for the second color/value. |
size |
int
|
The size of the checkerboard (e.g. 8 means 8x8 checkerboard). |
Source code in hakowan/grammar/texture/texture.py
Isocontour
dataclass
¶
Bases: Texture
The isocontour texture provides a color/value field based on the isocontours of an attribute.
Attributes:
Name | Type | Description |
---|---|---|
data |
AttributeLike
|
The attribute used to generate the isocontours. |
ratio |
float
|
The ratio of the isocontour thickness to non-isocontour thickness. |
texture1 |
TextureLike
|
The texture to use for the isocontour regions. |
texture2 |
TextureLike
|
The texture to use for the non-isocontour regions. |
num_contours |
int
|
The number of isocontours to generate within a unit distance. |
Source code in hakowan/grammar/texture/texture.py
ScalarField
dataclass
¶
Bases: Texture
The scalar field texture converts an attribute to a either a value field or color field.
Attributes:
Name | Type | Description |
---|---|---|
data |
AttributeLike
|
The attribute to convert to a color field. |
colormap |
str | list[ColorLike]
|
The name of the colormap to use or a list colors. |
domain |
tuple[float, float]
|
The domain of the attribute to map to the colormap. |
range |
tuple[float, float]
|
The range of the colormap to map the attribute to. |
categories |
bool
|
Whether the attribute represents categorical data (i.e. discrete values). |