Attention: Here be dragons (unstable version)
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Redot.
Checking the stable version of the documentation...
WorldScape3DAssets
Inherits: Resource < RefCounted < Object
Description
This class contains arrays of WorldScape3DTextureAsset and WorldScape3DMeshAsset resources. It is a savable resource, so you can save it to disk and use the same asset list in multiple scenes that use WorldScape3D. The amount of data is small, so it can be saved as a git-friendly, text based .tres file or left within the scene file.
Properties
|
||
|
Methods
void |
clear_textures(update: bool = false) |
void |
create_mesh_thumbnails(id: int = -1, size: Vector2i = Vector2i(128, 128)) |
get_albedo_array_rid() const |
|
get_mesh_asset(id: int) const |
|
get_mesh_count() const |
|
get_normal_array_rid() const |
|
get_texture(id: int) const |
|
get_texture_ao_strengths() const |
|
get_texture_colors() const |
|
get_texture_count() const |
|
get_texture_detiles() const |
|
get_texture_normal_depths() const |
|
get_texture_roughness_mods() const |
|
get_texture_uv_scales() const |
|
void |
set_mesh_asset(id: int, mesh: WorldScape3DMeshAsset) |
void |
set_texture(id: int, texture: WorldScape3DTextureAsset) |
void |
|
void |
Signals
meshes_changed() 🔗
Emitted when the mesh list is updated, which happens as a result of a WorldScape3DMeshAsset changing.
textures_changed() 🔗
Emitted when this list is updated due to changes in the texture slots, or the files or settings of any WorldScape3DTextureAsset.
Enumerations
enum AssetType: 🔗
AssetType TYPE_TEXTURE = 0
Asset is type WorldScape3DTextureAsset.
AssetType TYPE_MESH = 1
Asset is type WorldScape3DMeshAsset.
Constants
MAX_TEXTURES = 32 🔗
Hard coded maximum number of textures, with IDs in the range of 0-31. Cannot easily be expanded.
MAX_MESHES = 256 🔗
Limit of the maximum number of meshes. Arbitrary, easily expanded.
Property Descriptions
Array[WorldScape3DMeshAsset] mesh_list = [] 🔗
void set_mesh_list(value: Array[WorldScape3DMeshAsset])
Array[WorldScape3DMeshAsset] get_mesh_list()
The list of mesh assets.
Array[WorldScape3DTextureAsset] texture_list = [] 🔗
void set_texture_list(value: Array[WorldScape3DTextureAsset])
Array[WorldScape3DTextureAsset] get_texture_list()
The list of texture assets.
Method Descriptions
void clear_textures(update: bool = false) 🔗
After textures are loaded, they are combined into a TextureArray. The originals remain in VRAM and are only used if the WorldScape3DTextureAsset settings are changed and regenerating the TextureArrays are necessary. Use this function to clear the originals if not needed. It removes all textures from the asset list, freeing them if they are not referenced by other objects.
Update will regenerate the texture arrays housing the textures drawn on the terrain. This will remove all textures and turn the terrain checkerboard.
A similar clear_meshes is less useful so hasn't been included. However you can do the same thing with get_mesh_list().clear().
void create_mesh_thumbnails(id: int = -1, size: Vector2i = Vector2i(128, 128)) 🔗
Generates mesh asset preview thumbnails for the asset dock, stored within each mesh asset. Specify id -1 to generate all.
RID get_albedo_array_rid() const 🔗
Returns the resource ID of the TextureArray generated from combining all albedo and height textures.
WorldScape3DMeshAsset get_mesh_asset(id: int) const 🔗
Returns the specified WorldScape3DMeshAsset resource.
Returns the number of mesh assets in the list.
RID get_normal_array_rid() const 🔗
Returns the resource ID of the TextureArray generated from combining all normal and roughness textures.
WorldScape3DTextureAsset get_texture(id: int) const 🔗
Returns the WorldScape3DTextureAsset with the requested ID.
PackedFloat32Array get_texture_ao_strengths() const 🔗
Returns the array of AO strengths for each texture asset, indexed by asset id.
PackedColorArray get_texture_colors() const 🔗
Returns the array of albedo tints for each texture asset, indexed by asset id.
int get_texture_count() const 🔗
Returns the number of texture slots used.
PackedVector2Array get_texture_detiles() const 🔗
Returns the array of detiling values for each texture asset, indexed by asset id.
PackedFloat32Array get_texture_normal_depths() const 🔗
Returns the array of normal strengths for each texture asset, indexed by asset id.
PackedFloat32Array get_texture_roughness_mods() const 🔗
Returns the array of roughness modification values for each texture asset, indexed by asset id.
PackedFloat32Array get_texture_uv_scales() const 🔗
Returns the array of uv scale values for each texture asset, indexed by asset id.
Error save(path: String = "") 🔗
Saves this texture list resource to disk, if saved as an external .tres or .res resource file.
path - specifies a directory and file name to use from now on.
void set_mesh_asset(id: int, mesh: WorldScape3DMeshAsset) 🔗
Assigns the WorldScape3DMeshAsset to the specified ID slot. It can be null to clear the slot. See set_texture().
void set_texture(id: int, texture: WorldScape3DTextureAsset) 🔗
Adds a WorldScape3DTextureAsset at the specified ID slot. The texture can be null to clear the slot, or remove it if its the last in the list. If the specified slot is full, it will be swapped with the source texture ID, or will find the next available ID.
void update_mesh_list() 🔗
Updates the internal list of meshes used by the instancer.
void update_texture_list() 🔗
Regenerates the texture arrays from the list of texture assets, which is sent to the shader.