EntropyCanvas::TextureClient
EntropyCanvas::TextureClient
Section titled “EntropyCanvas::TextureClient”Client API for texture operations. More…
#include <TextureClient.h>
Public Functions
Section titled “Public Functions”| 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 |
| bool | isAvailable(const AssetId & id) const Check if a texture is available (uploaded). |
| std::optional< TextureMetadata > | getMetadata(const AssetId & id) const Get cached texture metadata. |
| void | fetchTextureInfo(const AssetId & id, std::function< void(bool found, const TextureMetadata &metadata)> callback) Request texture info from server (async). |
| size_t | cachedMetadataCount() const Get number of cached texture metadata entries. |
| TextureClient(CanvasClient & canvasClient) Construct a TextureClient attached to a CanvasClient. | |
| TextureClient(const TextureClient & ) =delete |
Friends
Section titled “Friends”| Name | |
|---|---|
| class | CanvasClient |
Detailed Description
Section titled “Detailed Description”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 fileTextureData texture = TextureLoader::loadFromFile("diffuse.png");
// Upload via TextureClientauto handle = textureClient->uploadTexture(texture);handle->wait();
if (handle->success()) { AssetId textureId = handle->result(); material.setTextureRef("baseColorTexture", textureId);}Public Functions Documentation
Section titled “Public Functions Documentation”function ~TextureClient
Section titled “function ~TextureClient”~TextureClient()function uploadTextureSync
Section titled “function uploadTextureSync”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.
function uploadTexture
Section titled “function uploadTexture”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.
function operator=
Section titled “function operator=”TextureClient & operator=( const TextureClient &) =deletefunction isAvailable
Section titled “function isAvailable”bool isAvailable( const AssetId & id) constCheck if a texture is available (uploaded).
Parameters:
- id Texture AssetId
Return: True if texture is available
function getMetadata
Section titled “function getMetadata”std::optional< TextureMetadata > getMetadata( const AssetId & id) constGet cached texture metadata.
Parameters:
- id Texture AssetId
Return: Metadata if cached, nullopt otherwise
function fetchTextureInfo
Section titled “function fetchTextureInfo”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.
function cachedMetadataCount
Section titled “function cachedMetadataCount”size_t cachedMetadataCount() constGet number of cached texture metadata entries.
function TextureClient
Section titled “function TextureClient”explicit TextureClient( CanvasClient & canvasClient)Construct a TextureClient attached to a CanvasClient.
Parameters:
- canvasClient Parent CanvasClient (must remain valid)
function TextureClient
Section titled “function TextureClient”TextureClient( const TextureClient &) =deleteFriends
Section titled “Friends”friend CanvasClient
Section titled “friend CanvasClient”friend class CanvasClient( CanvasClient);Updated on 2026-01-26 at 17:14:35 -0500