Skip to content

EntropyCanvas::TextureClient

Client API for texture operations. More…

#include <TextureClient.h>

Name
~TextureClient()
EntropyEngine::Networking::Result< AssetId >uploadTextureSync(const TextureData & data, bool persistent =false)
Upload a texture and wait for completion.
std::shared_ptr< UploadTextureHandle >uploadTexture(const TextureData & data, bool persistent =false)
Upload a texture to CanvasEngine.
TextureClient &operator=(const TextureClient & ) =delete
boolisAvailable(const AssetId & id) const
Check if a texture is available (uploaded).
std::optional< TextureMetadata >getMetadata(const AssetId & id) const
Get cached texture metadata.
voidfetchTextureInfo(const AssetId & id, std::function< void(bool found, const TextureMetadata &metadata)> callback)
Request texture info from server (async).
size_tcachedMetadataCount() const
Get number of cached texture metadata entries.
TextureClient(CanvasClient & canvasClient)
Construct a TextureClient attached to a CanvasClient.
TextureClient(const TextureClient & ) =delete
Name
classCanvasClient
class EntropyCanvas::TextureClient;

Client API for texture operations.

TextureClient provides methods for:

  • Uploading textures to CanvasEngine
  • Checking if textures are available
  • Caching texture metadata

Uses AssetClient internally with ContentType::Texture. Same pattern as ShaderClient for API consistency.

Usage:

// Load texture from file
TextureData texture = TextureLoader::loadFromFile("diffuse.png");
// Upload via TextureClient
auto handle = textureClient->uploadTexture(texture);
handle->wait();
if (handle->success()) {
AssetId textureId = handle->result();
material.setTextureRef("baseColorTexture", textureId);
}
~TextureClient()
EntropyEngine::Networking::Result< AssetId > uploadTextureSync(
const TextureData & data,
bool persistent =false
)

Upload a texture and wait for completion.

Parameters:

  • data TextureData with loaded pixels
  • persistent If true, texture survives session disconnect

Return: Result with AssetId on success, or error

Convenience method that blocks until the operation completes.

std::shared_ptr< UploadTextureHandle > uploadTexture(
const TextureData & data,
bool persistent =false
)

Upload a texture to CanvasEngine.

Parameters:

  • data TextureData with loaded pixels
  • persistent If true, texture survives session disconnect

Return: Handle to track operation completion

The texture is registered with the server and assigned an AssetId computed from the pixel content. Identical textures get the same ID.

TextureClient & operator=(
const TextureClient &
) =delete
bool isAvailable(
const AssetId & id
) const

Check if a texture is available (uploaded).

Parameters:

Return: True if texture is available

std::optional< TextureMetadata > getMetadata(
const AssetId & id
) const

Get cached texture metadata.

Parameters:

Return: Metadata if cached, nullopt otherwise

void fetchTextureInfo(
const AssetId & id,
std::function< void(bool found, const TextureMetadata &metadata)> callback
)

Request texture info from server (async).

Parameters:

  • id Texture AssetId
  • callback Called with result

Fetches texture metadata from the server.

size_t cachedMetadataCount() const

Get number of cached texture metadata entries.

explicit TextureClient(
CanvasClient & canvasClient
)

Construct a TextureClient attached to a CanvasClient.

Parameters:

TextureClient(
const TextureClient &
) =delete
friend class CanvasClient(
CanvasClient
);

Updated on 2026-01-26 at 17:14:35 -0500