add setImage method to set texture image directly from buffer

This commit is contained in:
Nick Fisher committed 2025-03-04 18:17:17 +08:00
1 parent a245cf2915
commit cca9fba79f
3 files changed
+52 -3

No files matched your search

@@ -879,6 +879,31 @@ bool Texture_loadImage(
pixelDataType.value,
);
@ffi.Native<
ffi.Bool Function(
ffi.Pointer<TEngine>,
ffi.Pointer<TTexture>,
ffi.Uint32,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.Uint32,
ffi.Uint32,
ffi.Uint32,
ffi.Uint32,
ffi.Uint32)>(isLeaf: true)
external bool Texture_setImage(
ffi.Pointer<TEngine> tEngine,
ffi.Pointer<TTexture> tTexture,
int level,
ffi.Pointer<ffi.Uint8> data,
int size,
int width,
int height,
int channels,
int bufferFormat,
int pixelDataType,
);
@ffi.Native<
ffi.Pointer<TLinearImage> Function(
ffi.Uint32, ffi.Uint32, ffi.Uint32)>(isLeaf: true)
@@ -306,8 +306,8 @@ abstract class Texture {
covariant LinearImage image, PixelDataFormat format, PixelDataType type);
/// Sets the image data for a 2D texture or a texture level
Future setImage(
int level, Uint8List buffer, PixelDataFormat format, PixelDataType type);
Future setImage(int level, Uint8List buffer, int width, int height,
int channels, PixelDataFormat format, PixelDataType type);
/// Sets the image data for a region of a 2D texture
Future setSubImage(int level, int xOffset, int yOffset, int width, int height,