support 3D texture/2D texture arrays

This commit is contained in:
Nick Fisher
2025-03-10 18:05:42 +08:00
parent 7d87d229d0
commit e91d1ca0aa
16 changed files with 451 additions and 97 deletions

View File

@@ -15,11 +15,12 @@ extern "C"
enum TTextureSamplerType
{
SAMPLER_2D = 0, // 2D texture
SAMPLER_CUBEMAP, // Cubemap texture
SAMPLER_EXTERNAL, // External texture (video/camera)
SAMPLER_3D, // 3D texture
SAMPLER_2D_ARRAY // 2D array texture
SAMPLER_2D = 0,
SAMPLER_2D_ARRAY = 1,
SAMPLER_CUBEMAP=2,
SAMPLER_EXTERNAL=3,
SAMPLER_3D=4,
SAMPLER_CUBEMAP_ARRAY=5
};
enum TTextureFormat
@@ -204,6 +205,22 @@ EMSCRIPTEN_KEEPALIVE bool Texture_setImage(
uint32_t bufferFormat,
uint32_t pixelDataType
);
EMSCRIPTEN_KEEPALIVE bool Texture_setImageWithDepth(
TEngine *tEngine,
TTexture *tTexture,
uint32_t level,
uint8_t *data,
size_t size,
uint32_t x_offset,
uint32_t y_offset,
uint32_t z_offset,
uint32_t width,
uint32_t height,
uint32_t channels,
uint32_t depth,
uint32_t bufferFormat,
uint32_t pixelDataType
);
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_createEmpty(uint32_t width,uint32_t height,uint32_t channel);
EMSCRIPTEN_KEEPALIVE TLinearImage *Image_decode(uint8_t* data, size_t length, const char* name = "image");
EMSCRIPTEN_KEEPALIVE float *Image_getBytes(TLinearImage *tLinearImage);