Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
ResourceManagerBindings.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
3#pragma once
4
5
6#include "../core/Types.hpp"
8#include <string>
9
10// The value type embind returns for array/object results. Web-only: a native
11// build compiles this same TU (see cmake/ESEngineSources.cmake) and simply does
12// not carry the entry points that return one.
13#ifdef __EMSCRIPTEN__
14namespace emscripten {
15 class val;
16}
17#endif
18
19namespace esengine {
20
23 uintptr_t pixelsPtr, u32 pixelsLen, i32 format, bool flipY, u32 content);
25 uintptr_t pixelsPtr, u32 pixelsLen, i32 format, bool flipY,
26 i32 filterMode, i32 wrapMode, u32 content);
32 uintptr_t pixelsPtr, u32 pixelsLen, i32 format,
33 i32 filterMode, i32 wrapMode, u32 content);
35 const std::string& vertSrc, const std::string& fragSrc);
38
41 i32 format, uintptr_t dataPtr, u32 dataLen, u32 mipLevels, u32 content);
42
44 u32 width, u32 height, u32 content);
45
47u32 rm_wrapDeviceTexture(resource::ResourceManager& rm, u32 textureId, u32 width, u32 height);
48
53
56
59
63
66
68 u32 width, u32 height, u32 bytes, u32 content);
71void rm_registerTextureWithPath(resource::ResourceManager& rm, u32 handleId, const std::string& path);
74u32 rm_acquireTextureByPath(resource::ResourceManager& rm, const std::string& path);
75bool rm_invalidateTexturePath(resource::ResourceManager& rm, const std::string& path);
77#ifdef __EMSCRIPTEN__
78emscripten::val rm_getResourceStats(resource::ResourceManager& rm);
79#endif
83#ifdef __EMSCRIPTEN__
84emscripten::val rm_getTextureDimensions(resource::ResourceManager& rm, u32 handleId);
85#endif
86#ifdef ES_ENABLE_BITMAP_TEXT
87u32 rm_loadBitmapFont(resource::ResourceManager& rm, const std::string& fntContent,
88 u32 textureHandle, u32 texWidth, u32 texHeight);
89u32 rm_createLabelAtlasFont(resource::ResourceManager& rm, u32 textureHandle,
90 u32 texWidth, u32 texHeight, const std::string& chars,
91 u32 charWidth, u32 charHeight);
92void rm_releaseBitmapFont(resource::ResourceManager& rm, u32 handleId);
93u32 rm_getBitmapFontRefCount(resource::ResourceManager& rm, u32 handleId);
94#ifdef __EMSCRIPTEN__
95emscripten::val rm_measureBitmapText(resource::ResourceManager& rm, u32 fontHandle,
96 const std::string& text, f32 fontSize, f32 spacing);
97#endif
98#endif
100 u32 x, u32 y, u32 width, u32 height,
101 uintptr_t pixelsPtr, u32 pixelsLen);
102
104 f32 left, f32 right, f32 top, f32 bottom);
105
106} // namespace esengine
107
Central resource management system.
Core type definitions and utilities for ESEngine.
Central manager for GPU resources.
u32 rm_createTexture(resource::ResourceManager &rm, u32 width, u32 height, uintptr_t pixelsPtr, u32 pixelsLen, i32 format, bool flipY, u32 content)
u32 rm_registerExternalTextureSized(resource::ResourceManager &rm, u32 glTextureId, u32 width, u32 height, u32 bytes, u32 content)
std::string rm_texturesAwaitingReupload(resource::ResourceManager &rm)
The textures the device is waiting for content for, as handle|content|path lines.
u32 rm_createTextureArray(resource::ResourceManager &rm, u32 width, u32 height, u32 layers, uintptr_t pixelsPtr, u32 pixelsLen, i32 format, i32 filterMode, i32 wrapMode, u32 content)
std::int32_t i32
Signed 32-bit integer.
Definition Types.hpp:54
std::string rm_meshesAwaitingRemat(resource::ResourceManager &rm)
Replayable meshes still owed their geometry, as comma-separated handle ids. No path: the engine never...
void rm_setTextureBudget(resource::ResourceManager &rm, u32 bytes)
bool rm_invalidateTexturePath(resource::ResourceManager &rm, const std::string &path)
void rm_releaseTexture(resource::ResourceManager &rm, u32 handleId)
u32 rm_getShaderRefCount(resource::ResourceManager &rm, u32 handleId)
void rm_setRetainedBudget(resource::ResourceManager &rm, u32 bytes)
u32 rm_registerExternalTexture(resource::ResourceManager &rm, u32 glTextureId, u32 width, u32 height, u32 content)
void rm_restoreTextureContent(resource::ResourceManager &rm, u32 handle)
void rm_releaseShader(resource::ResourceManager &rm, u32 handleId)
bool rm_supportsCompressedFormat(resource::ResourceManager &rm, i32 format)
u32 rm_getTextureRefCount(resource::ResourceManager &rm, u32 handleId)
u32 rm_getTextureGLId(resource::ResourceManager &rm, u32 handleId)
void rm_setTextureMetadata(resource::ResourceManager &rm, u32 handleId, f32 left, f32 right, f32 top, f32 bottom)
u32 rm_trimTextureCache(resource::ResourceManager &rm)
u32 rm_getTextureNativeId(resource::ResourceManager &rm, u32 handle)
void rm_registerTextureWithPath(resource::ResourceManager &rm, u32 handleId, const std::string &path)
void rm_forgoTextureContent(resource::ResourceManager &rm, u32 handle)
Gives up on an owed texture's content; it keeps blank storage.
std::uint32_t u32
Unsigned 32-bit integer.
Definition Types.hpp:45
u32 rm_acquireTextureByPath(resource::ResourceManager &rm, const std::string &path)
bool rm_adoptTextureContent(resource::ResourceManager &rm, u32 target, u32 source)
Moves a freshly loaded texture's pixels behind an owed handle.
u32 rm_createCompressedTexture(resource::ResourceManager &rm, u32 width, u32 height, i32 format, uintptr_t dataPtr, u32 dataLen, u32 mipLevels, u32 content)
u32 rm_createShader(resource::ResourceManager &rm, const std::string &vertSrc, const std::string &fragSrc)
void rm_updateTextureSubregion(resource::ResourceManager &rm, u32 handleId, u32 x, u32 y, u32 width, u32 height, uintptr_t pixelsPtr, u32 pixelsLen)
std::string rm_meshRealizations(resource::ResourceManager &rm)
Every live mesh as handle:realized.
u32 rm_createTextureEx(resource::ResourceManager &rm, u32 width, u32 height, uintptr_t pixelsPtr, u32 pixelsLen, i32 format, bool flipY, i32 filterMode, i32 wrapMode, u32 content)
float f32
32-bit floating point
Definition Types.hpp:59
u32 rm_wrapDeviceTexture(resource::ResourceManager &rm, u32 textureId, u32 width, u32 height)
A resource handle for a device texture another owner keeps (a render target's colour).