Class reference
WorldScape3DAssets
Inherits Resource
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
WorldScape3DMeshAsset[] mesh_list = []
The list of mesh assets.
WorldScape3DTextureAsset[] texture_list = []
The list of texture assets.
Methods
void clear_textures(bool update = false)
bool update = 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 [code skip-lint]clear_meshes[/code] is less useful so hasn't been included. However you can do the same thing with [code skip-lint]get_mesh_list().clear()[/code].
void create_mesh_thumbnails(int id = -1, Vector2i size = Vector2i(128, 128))
int id = -1, Vector2i size = 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
RID get_albedo_array_rid() constReturns the resource ID of the TextureArray generated from combining all albedo and height textures.
WorldScape3DMeshAsset get_mesh_asset(int id) const
WorldScape3DMeshAsset get_mesh_asset(int id) constReturns the specified WorldScape3DMeshAsset resource.
int get_mesh_count() const
int get_mesh_count() constReturns the number of mesh assets in the list.
RID get_normal_array_rid() const
RID get_normal_array_rid() constReturns the resource ID of the TextureArray generated from combining all normal and roughness textures.
WorldScape3DTextureAsset get_texture(int id) const
WorldScape3DTextureAsset get_texture(int id) constReturns the WorldScape3DTextureAsset with the requested ID.
PackedFloat32Array get_texture_ao_strengths() const
PackedFloat32Array get_texture_ao_strengths() constReturns the array of AO strengths for each texture asset, indexed by asset id.
PackedColorArray get_texture_colors() const
PackedColorArray get_texture_colors() constReturns the array of albedo tints for each texture asset, indexed by asset id.
int get_texture_count() const
int get_texture_count() constReturns the number of texture slots used.
PackedVector2Array get_texture_detiles() const
PackedVector2Array get_texture_detiles() constReturns the array of detiling values for each texture asset, indexed by asset id.
PackedFloat32Array get_texture_normal_depths() const
PackedFloat32Array get_texture_normal_depths() constReturns the array of normal strengths for each texture asset, indexed by asset id.
PackedFloat32Array get_texture_roughness_mods() const
PackedFloat32Array get_texture_roughness_mods() constReturns the array of roughness modification values for each texture asset, indexed by asset id.
PackedFloat32Array get_texture_uv_scales() const
PackedFloat32Array get_texture_uv_scales() constReturns the array of uv scale values for each texture asset, indexed by asset id.
int save(String path = "")
int save(String path = "")Saves this texture list resource to disk, if saved as an external [code skip-lint].tres[/code] or [code skip-lint].res[/code] resource file. path - specifies a directory and file name to use from now on.
void set_mesh_asset(int id, WorldScape3DMeshAsset mesh)
int id, WorldScape3DMeshAsset mesh)Assigns the WorldScape3DMeshAsset to the specified ID slot. It can be null to clear the slot. See set_texture().
void set_texture(int id, WorldScape3DTextureAsset texture)
int id, WorldScape3DTextureAsset texture)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.
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.
Constants
TYPE_TEXTURE = 0
Asset is type WorldScape3DTextureAsset.
TYPE_MESH = 1
Asset is type WorldScape3DMeshAsset.
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.