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)

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))

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.

int get_mesh_count() const

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.

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.

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_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

Enum: AssetType

Asset is type WorldScape3DTextureAsset.

TYPE_MESH = 1

Enum: AssetType

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.

Source revision 5592dc3a7a61
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.