Constructor
new Texture(name, path, out, callback, filter, wrap)
Construct this for the texture to be added to the HB.textures Object, so you do not have to assign the instance to a value, it gets added to 'out' automatically.
| Name | Type | Default | Description |
|---|---|---|---|
name | string | Name of the texture, for indexing in the 'out' Object. | |
path | string | Path in the file system to the texture file, supported formats. | |
out | Object | HB.textures | The Object to add the texture to. |
callback | function | Is called when the texture has finished loading, logs the loaded textures to the browser console by default. | |
filter | number | gl.LINEAR | WebGL enum value for texture filtering, see gl.TEXTURE_MAG/MIN_FILTER on MDN. |
wrap | number | gl.CLAMP_TO_EDGE | WebGL enum value for texture wrapping, see gl.TEXTURE_WRAP_S/T on MDN. |
- Source
Methods
bind(slot)
(DO NOT USE) Internal method binding the texture to a specific slot.
| Name | Type | Default | Description |
|---|---|---|---|
slot | number | 1 | Which slot. |
- Source
createTexture(path, filter, wrap)
(DO NOT USE) Internal method for actually creating a texture, is called by constructor.
| Name | Type | Description |
|---|---|---|
path | string | Path of the texture. |
filter | number | WebGL enum value for texture filtering, see gl.TEXTURE_MAG/MIN_FILTER on MDN. |
wrap | number | WebGL enum value for texture wrapping, see gl.TEXTURE_WRAP_S/T on MDN. |
- Source
delete()
(DO NOT USE) Internal method for deleting this texture, is called on all textures by HB.Renderer#delete.
- Source
setErrorTexture()
(DO NOT USE) Method for setting an error texture in case of a texture failing to load etc.
- Source
unbind()
(DO NOT USE) Internal method for binding an empty texture, or unbinding this one.
- Source
(static) init()
(DO NOT USE) Internal method for creating the font, circle, error texture and blank textures needed for drawing text, ellipses and colored shapes.
- Source
(static) setTextureParameters(filter, wrap)
(DO NOT USE) Internal method for setting the texure parameters, is called by HB.Texture#createTexture.
| Name | Type | Description |
|---|---|---|
filter | number | WebGL enum value for texture filtering, see gl.TEXTURE_MAG/MIN_FILTER on MDN. |
wrap | number | WebGL enum value for texture wrapping, see gl.TEXTURE_WRAP_S/T on MDN. |
- Source