use render thread methods for Texture/Image/TextureSampler
This commit is contained in:
@@ -71,6 +71,21 @@ Future<int> withIntCallback(
|
|||||||
return completer.future;
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<int> withUInt32Callback(
|
||||||
|
Function(Pointer<NativeFunction<Void Function(Uint32)>>) func) async {
|
||||||
|
final completer = Completer<int>();
|
||||||
|
// ignore: prefer_function_declarations_over_variables
|
||||||
|
void Function(int) callback = (int result) {
|
||||||
|
completer.complete(result);
|
||||||
|
};
|
||||||
|
final nativeCallable =
|
||||||
|
NativeCallable<Void Function(Uint32)>.listener(callback);
|
||||||
|
func.call(nativeCallable.nativeFunction);
|
||||||
|
await completer.future;
|
||||||
|
nativeCallable.close();
|
||||||
|
return completer.future;
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> withCharPtrCallback(
|
Future<String> withCharPtrCallback(
|
||||||
Function(Pointer<NativeFunction<Void Function(Pointer<Char>)>>)
|
Function(Pointer<NativeFunction<Void Function(Pointer<Char>)>>)
|
||||||
func) async {
|
func) async {
|
||||||
|
|||||||
@@ -9,26 +9,32 @@ class FFITexture extends Texture {
|
|||||||
|
|
||||||
FFITexture(this._engine, this.pointer);
|
FFITexture(this._engine, this.pointer);
|
||||||
|
|
||||||
Future setLinearImage(covariant FFILinearImage image, PixelDataFormat format,
|
Future<void> setLinearImage(covariant FFILinearImage image, PixelDataFormat format,
|
||||||
PixelDataType type) async {
|
PixelDataType type) async {
|
||||||
final result = Texture_loadImage(
|
final result = await withBoolCallback((cb) {
|
||||||
|
Texture_loadImageRenderThread(
|
||||||
_engine,
|
_engine,
|
||||||
pointer,
|
pointer,
|
||||||
image.pointer,
|
image.pointer,
|
||||||
TPixelDataFormat.values[format.index],
|
TPixelDataFormat.values[format.index],
|
||||||
TPixelDataType.values[type.index]);
|
TPixelDataType.values[type.index],
|
||||||
|
cb);
|
||||||
|
});
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
throw Exception("Failed to set linear image");
|
throw Exception("Failed to set linear image");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future dispose() async {
|
Future<void> dispose() async {
|
||||||
Engine_destroyTexture(_engine, pointer);
|
await withVoidCallback((cb) {
|
||||||
|
Engine_destroyTextureRenderThread(_engine, pointer, cb);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future generateMipmaps() {
|
Future<void> generateMipmaps() {
|
||||||
// TODO: implement generateMipmaps
|
// TODO: implement generateMipmaps
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
@@ -70,15 +76,16 @@ class FFITexture extends Texture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setExternalImage(externalImage) {
|
Future<void> setExternalImage(externalImage) {
|
||||||
// TODO: implement setExternalImage
|
// TODO: implement setExternalImage
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setImage(int level, Uint8List buffer, int width, int height,
|
Future<void> setImage(int level, Uint8List buffer, int width, int height,
|
||||||
int channels, PixelDataFormat format, PixelDataType type) async {
|
int channels, PixelDataFormat format, PixelDataType type) async {
|
||||||
final success = Texture_setImage(
|
final success = await withBoolCallback((cb) {
|
||||||
|
Texture_setImageRenderThread(
|
||||||
_engine,
|
_engine,
|
||||||
pointer,
|
pointer,
|
||||||
level,
|
level,
|
||||||
@@ -88,14 +95,17 @@ class FFITexture extends Texture {
|
|||||||
height,
|
height,
|
||||||
channels,
|
channels,
|
||||||
format.index,
|
format.index,
|
||||||
type.index);
|
type.index,
|
||||||
|
cb);
|
||||||
|
});
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw Exception("Failed to set image");
|
throw Exception("Failed to set image");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setImage3D(
|
Future<void> setImage3D(
|
||||||
int level,
|
int level,
|
||||||
int xOffset,
|
int xOffset,
|
||||||
int yOffset,
|
int yOffset,
|
||||||
@@ -111,7 +121,7 @@ class FFITexture extends Texture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future setSubImage(int level, int xOffset, int yOffset, int width, int height,
|
Future<void> setSubImage(int level, int xOffset, int yOffset, int width, int height,
|
||||||
Uint8List buffer, PixelDataFormat format, PixelDataType type) {
|
Uint8List buffer, PixelDataFormat format, PixelDataType type) {
|
||||||
// TODO: implement setSubImage
|
// TODO: implement setSubImage
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
@@ -123,23 +133,53 @@ class FFILinearImage extends LinearImage {
|
|||||||
|
|
||||||
FFILinearImage(this.pointer);
|
FFILinearImage(this.pointer);
|
||||||
|
|
||||||
Future destroy() async {
|
static Future<FFILinearImage> createEmpty(int width, int height, int channels) async {
|
||||||
Image_destroy(this.pointer);
|
final imagePtr = await withPointerCallback<TLinearImage>((cb) {
|
||||||
|
Image_createEmptyRenderThread(width, height, channels, cb);
|
||||||
|
});
|
||||||
|
|
||||||
|
return FFILinearImage(imagePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<FFILinearImage> decode(Uint8List data, [String name = "image"]) async {
|
||||||
|
final namePtr = name.toNativeUtf8();
|
||||||
|
|
||||||
|
try {
|
||||||
|
final imagePtr = await withPointerCallback<TLinearImage>((cb) {
|
||||||
|
Image_decodeRenderThread(data.address, data.lengthInBytes, namePtr.cast(), cb);
|
||||||
|
});
|
||||||
|
|
||||||
|
return FFILinearImage(imagePtr);
|
||||||
|
} finally {
|
||||||
|
calloc.free(namePtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> destroy() async {
|
||||||
|
await withVoidCallback((cb) {
|
||||||
|
Image_destroyRenderThread(this.pointer, cb);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<int> getChannels() async {
|
Future<int> getChannels() async {
|
||||||
return Image_getChannels(pointer);
|
return await withUInt32Callback((cb) {
|
||||||
|
Image_getChannelsRenderThread(pointer, cb);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<int> getHeight() async {
|
Future<int> getHeight() async {
|
||||||
return Image_getHeight(pointer);
|
return await withUInt32Callback((cb) {
|
||||||
|
Image_getHeightRenderThread(pointer, cb);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<int> getWidth() async {
|
Future<int> getWidth() async {
|
||||||
return Image_getWidth(pointer);
|
return await withUInt32Callback((cb) {
|
||||||
|
Image_getWidthRenderThread(pointer, cb);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -147,7 +187,128 @@ class FFILinearImage extends LinearImage {
|
|||||||
final height = await getHeight();
|
final height = await getHeight();
|
||||||
final width = await getWidth();
|
final width = await getWidth();
|
||||||
final channels = await getChannels();
|
final channels = await getChannels();
|
||||||
final ptr = Image_getBytes(pointer);
|
|
||||||
|
final ptr = await withPointerCallback<Float>((cb) {
|
||||||
|
Image_getBytesRenderThread(pointer, cb);
|
||||||
|
});
|
||||||
|
|
||||||
return ptr.asTypedList(height * width * channels);
|
return ptr.asTypedList(height * width * channels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add these to access TextureSampler functionality:
|
||||||
|
|
||||||
|
class FFITextureSampler extends TextureSampler {
|
||||||
|
final Pointer<TTextureSampler> pointer;
|
||||||
|
|
||||||
|
FFITextureSampler(this.pointer);
|
||||||
|
|
||||||
|
static Future<FFITextureSampler> create() async {
|
||||||
|
final samplerPtr = await withPointerCallback<TTextureSampler>((cb) {
|
||||||
|
TextureSampler_createRenderThread(cb);
|
||||||
|
});
|
||||||
|
|
||||||
|
return FFITextureSampler(samplerPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static Future<FFITextureSampler> createWithFiltering(
|
||||||
|
// SamplerMinFilter minFilter,
|
||||||
|
// SamplerMagFilter magFilter,
|
||||||
|
// SamplerWrapMode wrapS,
|
||||||
|
// SamplerWrapMode wrapT,
|
||||||
|
// SamplerWrapMode wrapR) async {
|
||||||
|
// final samplerPtr = await withPointerCallback<TTextureSampler>((cb) {
|
||||||
|
// TextureSampler_createWithFilteringRenderThread(
|
||||||
|
// TSamplerMinFilter.values[minFilter.index],
|
||||||
|
// TSamplerMagFilter.values[magFilter.index],
|
||||||
|
// TSamplerWrapMode.values[wrapS.index],
|
||||||
|
// TSamplerWrapMode.values[wrapT.index],
|
||||||
|
// TSamplerWrapMode.values[wrapR.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return FFITextureSampler(samplerPtr);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// static Future<FFITextureSampler> createWithComparison(
|
||||||
|
// SamplerCompareMode compareMode,
|
||||||
|
// SamplerCompareFunc compareFunc) async {
|
||||||
|
// final samplerPtr = await withPointerCallback<TTextureSampler>((cb) {
|
||||||
|
// TextureSampler_createWithComparisonRenderThread(
|
||||||
|
// TSamplerCompareMode.values[compareMode.index],
|
||||||
|
// TTextureSamplerCompareFunc.values[compareFunc.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return FFITextureSampler(samplerPtr);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setMinFilter(SamplerMinFilter filter) async {
|
||||||
|
// await withVoidCallback((cb) {
|
||||||
|
// TextureSampler_setMinFilterRenderThread(
|
||||||
|
// pointer,
|
||||||
|
// TSamplerMinFilter.values[filter.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setMagFilter(SamplerMagFilter filter) async {
|
||||||
|
// await withVoidCallback((cb) {
|
||||||
|
// TextureSampler_setMagFilterRenderThread(
|
||||||
|
// pointer,
|
||||||
|
// TSamplerMagFilter.values[filter.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setWrapModeS(SamplerWrapMode mode) async {
|
||||||
|
// await withVoidCallback((cb) {
|
||||||
|
// TextureSampler_setWrapModeSRenderThread(
|
||||||
|
// pointer,
|
||||||
|
// TSamplerWrapMode.values[mode.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setWrapModeT(SamplerWrapMode mode) async {
|
||||||
|
// await withVoidCallback((cb) {
|
||||||
|
// TextureSampler_setWrapModeTRenderThread(
|
||||||
|
// pointer,
|
||||||
|
// TSamplerWrapMode.values[mode.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setWrapModeR(SamplerWrapMode mode) async {
|
||||||
|
// await withVoidCallback((cb) {
|
||||||
|
// TextureSampler_setWrapModeRRenderThread(
|
||||||
|
// pointer,
|
||||||
|
// TSamplerWrapMode.values[mode.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<void> setAnisotropy(double anisotropy) async {
|
||||||
|
await withVoidCallback((cb) {
|
||||||
|
TextureSampler_setAnisotropyRenderThread(pointer, anisotropy, cb);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Future<void> setCompareMode(
|
||||||
|
// SamplerCompareMode mode, SamplerCompareFunc func) async {
|
||||||
|
// await withVoidCallback((cb) {
|
||||||
|
// TextureSampler_setCompareModeRenderThread(
|
||||||
|
// pointer,
|
||||||
|
// TSamplerCompareMode.values[mode.index],
|
||||||
|
// TTextureSamplerCompareFunc.values[func.index],
|
||||||
|
// cb);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future dispose() async {
|
||||||
|
await withVoidCallback((cb) {
|
||||||
|
TextureSampler_destroyRenderThread(pointer, cb);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -663,14 +663,6 @@ external void get_bounding_box_to_out(
|
|||||||
ffi.Pointer<ffi.Float> maxY,
|
ffi.Pointer<ffi.Float> maxY,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
|
||||||
ffi.Void Function(
|
|
||||||
ffi.Pointer<TSceneManager>, ffi.Pointer<ffi.Void>)>(isLeaf: true)
|
|
||||||
external void destroy_texture(
|
|
||||||
ffi.Pointer<TSceneManager> sceneManager,
|
|
||||||
ffi.Pointer<ffi.Void> texture,
|
|
||||||
);
|
|
||||||
|
|
||||||
@ffi.Native<TViewport Function(ffi.Pointer<TView>)>(isLeaf: true)
|
@ffi.Native<TViewport Function(ffi.Pointer<TView>)>(isLeaf: true)
|
||||||
external TViewport View_getViewport(
|
external TViewport View_getViewport(
|
||||||
ffi.Pointer<TView> view,
|
ffi.Pointer<TView> view,
|
||||||
@@ -1657,6 +1649,15 @@ void Engine_buildTextureRenderThread(
|
|||||||
onComplete,
|
onComplete,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TEngine>, ffi.Pointer<TTexture>,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||||
|
external void Engine_destroyTextureRenderThread(
|
||||||
|
ffi.Pointer<TEngine> engine,
|
||||||
|
ffi.Pointer<TTexture> tTexture,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Void Function(
|
ffi.Void Function(
|
||||||
ffi.Pointer<TMaterial>,
|
ffi.Pointer<TMaterial>,
|
||||||
@@ -2101,6 +2102,392 @@ external void AnimationManager_setMorphTargetWeightsRenderThread(
|
|||||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> callback,
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> callback,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Uint32,
|
||||||
|
ffi.Uint32,
|
||||||
|
ffi.Uint32,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Pointer<TLinearImage>)>>)>(isLeaf: true)
|
||||||
|
external void Image_createEmptyRenderThread(
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int channel,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TLinearImage>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<ffi.Uint8>,
|
||||||
|
ffi.Size,
|
||||||
|
ffi.Pointer<ffi.Char>,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Pointer<TLinearImage>)>>)>(isLeaf: true)
|
||||||
|
external void Image_decodeRenderThread(
|
||||||
|
ffi.Pointer<ffi.Uint8> data,
|
||||||
|
int length,
|
||||||
|
ffi.Pointer<ffi.Char> name,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TLinearImage>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TLinearImage>,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi
|
||||||
|
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Float>)>>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void Image_getBytesRenderThread(
|
||||||
|
ffi.Pointer<TLinearImage> tLinearImage,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Float>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TLinearImage>,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||||
|
external void Image_destroyRenderThread(
|
||||||
|
ffi.Pointer<TLinearImage> tLinearImage,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TLinearImage>,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Uint32)>>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void Image_getWidthRenderThread(
|
||||||
|
ffi.Pointer<TLinearImage> tLinearImage,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Uint32)>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TLinearImage>,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Uint32)>>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void Image_getHeightRenderThread(
|
||||||
|
ffi.Pointer<TLinearImage> tLinearImage,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Uint32)>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TLinearImage>,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Uint32)>>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void Image_getChannelsRenderThread(
|
||||||
|
ffi.Pointer<TLinearImage> tLinearImage,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Uint32)>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TEngine>,
|
||||||
|
ffi.Pointer<TTexture>,
|
||||||
|
ffi.Pointer<TLinearImage>,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>>)>(
|
||||||
|
symbol: "Texture_loadImageRenderThread", isLeaf: true)
|
||||||
|
external void _Texture_loadImageRenderThread(
|
||||||
|
ffi.Pointer<TEngine> tEngine,
|
||||||
|
ffi.Pointer<TTexture> tTexture,
|
||||||
|
ffi.Pointer<TLinearImage> tImage,
|
||||||
|
int bufferFormat,
|
||||||
|
int pixelDataType,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void Texture_loadImageRenderThread(
|
||||||
|
ffi.Pointer<TEngine> tEngine,
|
||||||
|
ffi.Pointer<TTexture> tTexture,
|
||||||
|
ffi.Pointer<TLinearImage> tImage,
|
||||||
|
TPixelDataFormat bufferFormat,
|
||||||
|
TPixelDataType pixelDataType,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> onComplete,
|
||||||
|
) =>
|
||||||
|
_Texture_loadImageRenderThread(
|
||||||
|
tEngine,
|
||||||
|
tTexture,
|
||||||
|
tImage,
|
||||||
|
bufferFormat.value,
|
||||||
|
pixelDataType.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void 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,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void Texture_setImageRenderThread(
|
||||||
|
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.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TRenderTarget>,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTexture>)>>)>(
|
||||||
|
isLeaf: true)
|
||||||
|
external void RenderTarget_getColorTextureRenderThread(
|
||||||
|
ffi.Pointer<TRenderTarget> tRenderTarget,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTexture>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TTextureSampler>)>>)>(isLeaf: true)
|
||||||
|
external void TextureSampler_createRenderThread(
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTextureSampler>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>)>>)>(
|
||||||
|
symbol: "TextureSampler_createWithFilteringRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_createWithFilteringRenderThread(
|
||||||
|
int minFilter,
|
||||||
|
int magFilter,
|
||||||
|
int wrapS,
|
||||||
|
int wrapT,
|
||||||
|
int wrapR,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTextureSampler>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_createWithFilteringRenderThread(
|
||||||
|
TSamplerMinFilter minFilter,
|
||||||
|
TSamplerMagFilter magFilter,
|
||||||
|
TSamplerWrapMode wrapS,
|
||||||
|
TSamplerWrapMode wrapT,
|
||||||
|
TSamplerWrapMode wrapR,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTextureSampler>)>>
|
||||||
|
onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_createWithFilteringRenderThread(
|
||||||
|
minFilter.value,
|
||||||
|
magFilter.value,
|
||||||
|
wrapS.value,
|
||||||
|
wrapT.value,
|
||||||
|
wrapR.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>)>>)>(
|
||||||
|
symbol: "TextureSampler_createWithComparisonRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_createWithComparisonRenderThread(
|
||||||
|
int compareMode,
|
||||||
|
int compareFunc,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTextureSampler>)>>
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_createWithComparisonRenderThread(
|
||||||
|
TSamplerCompareMode compareMode,
|
||||||
|
TSamplerCompareFunc compareFunc,
|
||||||
|
ffi.Pointer<
|
||||||
|
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TTextureSampler>)>>
|
||||||
|
onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_createWithComparisonRenderThread(
|
||||||
|
compareMode.value,
|
||||||
|
compareFunc.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>, ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(
|
||||||
|
symbol: "TextureSampler_setMinFilterRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_setMinFilterRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
int filter,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_setMinFilterRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
TSamplerMinFilter filter,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_setMinFilterRenderThread(
|
||||||
|
sampler,
|
||||||
|
filter.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>, ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(
|
||||||
|
symbol: "TextureSampler_setMagFilterRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_setMagFilterRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
int filter,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_setMagFilterRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
TSamplerMagFilter filter,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_setMagFilterRenderThread(
|
||||||
|
sampler,
|
||||||
|
filter.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>, ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(
|
||||||
|
symbol: "TextureSampler_setWrapModeSRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_setWrapModeSRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
int mode,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_setWrapModeSRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_setWrapModeSRenderThread(
|
||||||
|
sampler,
|
||||||
|
mode.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>, ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(
|
||||||
|
symbol: "TextureSampler_setWrapModeTRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_setWrapModeTRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
int mode,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_setWrapModeTRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_setWrapModeTRenderThread(
|
||||||
|
sampler,
|
||||||
|
mode.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>, ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(
|
||||||
|
symbol: "TextureSampler_setWrapModeRRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_setWrapModeRRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
int mode,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_setWrapModeRRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_setWrapModeRRenderThread(
|
||||||
|
sampler,
|
||||||
|
mode.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>, ffi.Double,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||||
|
external void TextureSampler_setAnisotropyRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
double anisotropy,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(
|
||||||
|
ffi.Pointer<TTextureSampler>,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.UnsignedInt,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(
|
||||||
|
symbol: "TextureSampler_setCompareModeRenderThread", isLeaf: true)
|
||||||
|
external void _TextureSampler_setCompareModeRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
int mode,
|
||||||
|
int func,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
void TextureSampler_setCompareModeRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
TSamplerCompareMode mode,
|
||||||
|
TSamplerCompareFunc func,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
) =>
|
||||||
|
_TextureSampler_setCompareModeRenderThread(
|
||||||
|
sampler,
|
||||||
|
mode.value,
|
||||||
|
func.value,
|
||||||
|
onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
|
@ffi.Native<
|
||||||
|
ffi.Void Function(ffi.Pointer<TTextureSampler>,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>>)>(isLeaf: true)
|
||||||
|
external void TextureSampler_destroyRenderThread(
|
||||||
|
ffi.Pointer<TTextureSampler> sampler,
|
||||||
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> onComplete,
|
||||||
|
);
|
||||||
|
|
||||||
@ffi.Native<
|
@ffi.Native<
|
||||||
ffi.Void Function(ffi.Pointer<TSceneManager>, EntityId,
|
ffi.Void Function(ffi.Pointer<TSceneManager>, EntityId,
|
||||||
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>>)>(
|
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Bool)>>)>(
|
||||||
|
|||||||
@@ -426,10 +426,3 @@ abstract class LinearImage {
|
|||||||
Future<int> getChannels();
|
Future<int> getChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
class FFITextureSampler extends TextureSampler {
|
|
||||||
final Pointer<TTextureSampler> pointer;
|
|
||||||
|
|
||||||
FFITextureSampler(this.pointer);
|
|
||||||
@override
|
|
||||||
Future dispose() async {}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ namespace thermion
|
|||||||
TTextureFormat format,
|
TTextureFormat format,
|
||||||
void (*onComplete)(TTexture*)
|
void (*onComplete)(TTexture*)
|
||||||
);
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Engine_destroyTextureRenderThread(TEngine *engine, TTexture* tTexture, void (*onComplete)());
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Material_createInstanceRenderThread(TMaterial *tMaterial, void (*onComplete)(TMaterialInstance *));
|
EMSCRIPTEN_KEEPALIVE void Material_createInstanceRenderThread(TMaterial *tMaterial, void (*onComplete)(TMaterialInstance *));
|
||||||
|
|
||||||
@@ -124,11 +125,8 @@ namespace thermion
|
|||||||
bool shadows,
|
bool shadows,
|
||||||
void (*callback)(EntityId));
|
void (*callback)(EntityId));
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_removeLightRenderThread(TSceneManager *tSceneManager, EntityId entityId, void (*callback)());
|
EMSCRIPTEN_KEEPALIVE void SceneManager_removeLightRenderThread(TSceneManager *tSceneManager, EntityId entityId, void (*callback)());
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_createCameraRenderThread(TSceneManager *tSceneManager, void (*callback)(TCamera *));
|
EMSCRIPTEN_KEEPALIVE void SceneManager_createCameraRenderThread(TSceneManager *tSceneManager, void (*callback)(TCamera *));
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_createInstanceRenderThread(TSceneAsset *asset, TMaterialInstance **tMaterialInstances, int materialInstanceCount, void (*callback)(TSceneAsset *));
|
EMSCRIPTEN_KEEPALIVE void SceneAsset_createInstanceRenderThread(TSceneAsset *asset, TMaterialInstance **tMaterialInstances, int materialInstanceCount, void (*callback)(TSceneAsset *));
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void MaterialProvider_createMaterialInstanceRenderThread(TMaterialProvider *tMaterialProvider, TMaterialKey *tKey, void (*callback)(TMaterialInstance *));
|
EMSCRIPTEN_KEEPALIVE void MaterialProvider_createMaterialInstanceRenderThread(TMaterialProvider *tMaterialProvider, TMaterialKey *tKey, void (*callback)(TMaterialInstance *));
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyMaterialInstanceRenderThread(TSceneManager *tSceneManager, TMaterialInstance *tMaterialInstance, void (*callback)());
|
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyMaterialInstanceRenderThread(TSceneManager *tSceneManager, TMaterialInstance *tMaterialInstance, void (*callback)());
|
||||||
|
|
||||||
@@ -144,6 +142,88 @@ namespace thermion
|
|||||||
int numWeights,
|
int numWeights,
|
||||||
void (*callback)(bool));
|
void (*callback)(bool));
|
||||||
|
|
||||||
|
// Image methods
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_createEmptyRenderThread(uint32_t width, uint32_t height, uint32_t channel, void (*onComplete)(TLinearImage *));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_decodeRenderThread(uint8_t* data, size_t length, const char* name, void (*onComplete)(TLinearImage *));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getBytesRenderThread(TLinearImage *tLinearImage, void (*onComplete)(float *));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_destroyRenderThread(TLinearImage *tLinearImage, void (*onComplete)());
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getWidthRenderThread(TLinearImage *tLinearImage, void (*onComplete)(uint32_t));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getHeightRenderThread(TLinearImage *tLinearImage, void (*onComplete)(uint32_t));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getChannelsRenderThread(TLinearImage *tLinearImage, void (*onComplete)(uint32_t));
|
||||||
|
|
||||||
|
// Texture methods
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Texture_loadImageRenderThread(TEngine *tEngine, TTexture *tTexture, TLinearImage *tImage, TPixelDataFormat bufferFormat, TPixelDataType pixelDataType, void (*onComplete)(bool));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Texture_setImageRenderThread(
|
||||||
|
TEngine *tEngine,
|
||||||
|
TTexture *tTexture,
|
||||||
|
uint32_t level,
|
||||||
|
uint8_t *data,
|
||||||
|
size_t size,
|
||||||
|
uint32_t width,
|
||||||
|
uint32_t height,
|
||||||
|
uint32_t channels,
|
||||||
|
uint32_t bufferFormat,
|
||||||
|
uint32_t pixelDataType,
|
||||||
|
void (*onComplete)(bool)
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderTarget_getColorTextureRenderThread(TRenderTarget *tRenderTarget, void (*onComplete)(TTexture *));
|
||||||
|
|
||||||
|
// TextureSampler methods
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_createRenderThread(void (*onComplete)(TTextureSampler*));
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_createWithFilteringRenderThread(
|
||||||
|
TSamplerMinFilter minFilter,
|
||||||
|
TSamplerMagFilter magFilter,
|
||||||
|
TSamplerWrapMode wrapS,
|
||||||
|
TSamplerWrapMode wrapT,
|
||||||
|
TSamplerWrapMode wrapR,
|
||||||
|
void (*onComplete)(TTextureSampler*)
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_createWithComparisonRenderThread(
|
||||||
|
TSamplerCompareMode compareMode,
|
||||||
|
TSamplerCompareFunc compareFunc,
|
||||||
|
void (*onComplete)(TTextureSampler*)
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setMinFilterRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
TSamplerMinFilter filter,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setMagFilterRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
TSamplerMagFilter filter,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setWrapModeSRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setWrapModeTRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setWrapModeRRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setAnisotropyRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
double anisotropy,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setCompareModeRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
TSamplerCompareMode mode,
|
||||||
|
TTextureSamplerCompareFunc func,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_destroyRenderThread(
|
||||||
|
TTextureSampler* sampler,
|
||||||
|
void (*onComplete)()
|
||||||
|
);
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void update_bone_matrices_render_thread(TSceneManager *sceneManager,
|
EMSCRIPTEN_KEEPALIVE void update_bone_matrices_render_thread(TSceneManager *sceneManager,
|
||||||
EntityId asset, void (*callback)(bool));
|
EntityId asset, void (*callback)(bool));
|
||||||
EMSCRIPTEN_KEEPALIVE void set_bone_transform_render_thread(
|
EMSCRIPTEN_KEEPALIVE void set_bone_transform_render_thread(
|
||||||
|
|||||||
@@ -209,6 +209,14 @@ namespace thermion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setAnisotropy(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
double anisotropy)
|
||||||
|
{
|
||||||
|
auto *textureSampler = reinterpret_cast<filament::TextureSampler *>(sampler);
|
||||||
|
textureSampler->setAnisotropy(static_cast<float>(anisotropy));
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void TextureSampler_setMagFilter(
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setMagFilter(
|
||||||
TTextureSampler *sampler,
|
TTextureSampler *sampler,
|
||||||
TSamplerMagFilter filter)
|
TSamplerMagFilter filter)
|
||||||
|
|||||||
@@ -292,7 +292,8 @@ extern "C"
|
|||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Viewer_destroyRenderTargetRenderThread(TViewer *tViewer, TRenderTarget *tRenderTarget, void (*onComplete)()) {
|
EMSCRIPTEN_KEEPALIVE void Viewer_destroyRenderTargetRenderThread(TViewer *tViewer, TRenderTarget *tRenderTarget, void (*onComplete)())
|
||||||
|
{
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
[=]() mutable
|
[=]() mutable
|
||||||
{
|
{
|
||||||
@@ -302,22 +303,32 @@ extern "C"
|
|||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Engine_buildTextureRenderThread(TEngine *engine,
|
EMSCRIPTEN_KEEPALIVE void Engine_buildTextureRenderThread(TEngine *engine,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint8_t levels,
|
uint8_t levels,
|
||||||
TTextureSamplerType sampler,
|
TTextureSamplerType sampler,
|
||||||
TTextureFormat format,
|
TTextureFormat format,
|
||||||
void (*onComplete)(TTexture*)
|
void (*onComplete)(TTexture *))
|
||||||
) {
|
{
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
[=]() mutable
|
[=]() mutable
|
||||||
{
|
{
|
||||||
auto texture = Engine_buildTexture(engine, width, height, levels, sampler, format);
|
auto texture = Engine_buildTexture(engine, width, height, levels, sampler, format);
|
||||||
onComplete(texture);
|
onComplete(texture);
|
||||||
});
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Engine_destroyTextureRenderThread(TEngine *engine, TTexture* tTexture, void (*onComplete)()) {
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
Engine_destroyTexture(engine, tTexture);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Engine_buildMaterialRenderThread(TEngine *tEngine, const uint8_t *materialData, size_t length, void (*onComplete)(TMaterial *))
|
EMSCRIPTEN_KEEPALIVE void Engine_buildMaterialRenderThread(TEngine *tEngine, const uint8_t *materialData, size_t length, void (*onComplete)(TMaterial *))
|
||||||
{
|
{
|
||||||
@@ -397,8 +408,7 @@ auto fut = _rl->add_task(lambda);
|
|||||||
std::packaged_task<void()> lambda([=]() mutable
|
std::packaged_task<void()> lambda([=]() mutable
|
||||||
{
|
{
|
||||||
auto *sceneAsset = SceneManager_createGrid(tSceneManager, tMaterial);
|
auto *sceneAsset = SceneManager_createGrid(tSceneManager, tMaterial);
|
||||||
callback(sceneAsset);
|
callback(sceneAsset); });
|
||||||
});
|
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +490,8 @@ auto fut = _rl->add_task(lambda);
|
|||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyMaterialInstanceRenderThread(TSceneManager *tSceneManager, TMaterialInstance *tMaterialInstance, void (*callback)()) {
|
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyMaterialInstanceRenderThread(TSceneManager *tSceneManager, TMaterialInstance *tMaterialInstance, void (*callback)())
|
||||||
|
{
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
[=]
|
[=]
|
||||||
{
|
{
|
||||||
@@ -562,8 +573,8 @@ auto fut = _rl->add_task(lambda);
|
|||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void Viewer_loadSkyboxRenderThread(TViewer *viewer,
|
EMSCRIPTEN_KEEPALIVE void Viewer_loadSkyboxRenderThread(TViewer *viewer,
|
||||||
const char *skyboxPath,
|
const char *skyboxPath,
|
||||||
void (*onComplete)())
|
void (*onComplete)())
|
||||||
{
|
{
|
||||||
std::packaged_task<void()> lambda([=]
|
std::packaged_task<void()> lambda([=]
|
||||||
{
|
{
|
||||||
@@ -577,8 +588,7 @@ auto fut = _rl->add_task(lambda);
|
|||||||
std::packaged_task<void()> lambda([=]
|
std::packaged_task<void()> lambda([=]
|
||||||
{
|
{
|
||||||
Viewer_removeSkybox(viewer);
|
Viewer_removeSkybox(viewer);
|
||||||
onComplete();
|
onComplete(); });
|
||||||
});
|
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,8 +601,9 @@ auto fut = _rl->add_task(lambda);
|
|||||||
});
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void View_setBloomRenderThread(TView *tView, bool enabled, double strength) {
|
EMSCRIPTEN_KEEPALIVE void View_setBloomRenderThread(TView *tView, bool enabled, double strength)
|
||||||
|
{
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
[=]
|
[=]
|
||||||
{
|
{
|
||||||
@@ -641,34 +652,36 @@ auto fut = _rl->add_task(lambda);
|
|||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_addLightRenderThread(
|
EMSCRIPTEN_KEEPALIVE void SceneManager_addLightRenderThread(
|
||||||
TSceneManager *tSceneManager,
|
TSceneManager *tSceneManager,
|
||||||
uint8_t type,
|
uint8_t type,
|
||||||
float colour,
|
float colour,
|
||||||
float intensity,
|
float intensity,
|
||||||
float posX,
|
float posX,
|
||||||
float posY,
|
float posY,
|
||||||
float posZ,
|
float posZ,
|
||||||
float dirX,
|
float dirX,
|
||||||
float dirY,
|
float dirY,
|
||||||
float dirZ,
|
float dirZ,
|
||||||
float falloffRadius,
|
float falloffRadius,
|
||||||
float spotLightConeInner,
|
float spotLightConeInner,
|
||||||
float spotLightConeOuter,
|
float spotLightConeOuter,
|
||||||
float sunAngularRadius,
|
float sunAngularRadius,
|
||||||
float sunHaloSize,
|
float sunHaloSize,
|
||||||
float sunHaloFallof,
|
float sunHaloFallof,
|
||||||
bool shadows,
|
bool shadows,
|
||||||
void (*callback)(EntityId entityId)) {
|
void (*callback)(EntityId entityId))
|
||||||
std::packaged_task<void()> lambda(
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
[=]() mutable
|
[=]() mutable
|
||||||
{
|
{
|
||||||
auto light = SceneManager_addLight(tSceneManager, type, colour, intensity, posX, posY, posZ, dirX, dirY, dirZ, falloffRadius, spotLightConeInner, spotLightConeOuter, sunAngularRadius, sunHaloSize, sunHaloFallof, shadows);
|
auto light = SceneManager_addLight(tSceneManager, type, colour, intensity, posX, posY, posZ, dirX, dirY, dirZ, falloffRadius, spotLightConeInner, spotLightConeOuter, sunAngularRadius, sunHaloSize, sunHaloFallof, shadows);
|
||||||
callback(light);
|
callback(light);
|
||||||
});
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_removeLightRenderThread(TSceneManager *tSceneManager, EntityId entityId, void (*callback)()) {
|
EMSCRIPTEN_KEEPALIVE void SceneManager_removeLightRenderThread(TSceneManager *tSceneManager, EntityId entityId, void (*callback)())
|
||||||
|
{
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
[=]() mutable
|
[=]() mutable
|
||||||
{
|
{
|
||||||
@@ -699,7 +712,7 @@ std::packaged_task<void()> lambda(
|
|||||||
});
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyLightsRenderThread(TSceneManager *tSceneManager, void (*callback)())
|
EMSCRIPTEN_KEEPALIVE void SceneManager_destroyLightsRenderThread(TSceneManager *tSceneManager, void (*callback)())
|
||||||
{
|
{
|
||||||
std::packaged_task<void()> lambda(
|
std::packaged_task<void()> lambda(
|
||||||
@@ -751,4 +764,287 @@ std::packaged_task<void()> lambda(
|
|||||||
});
|
});
|
||||||
auto fut = _rl->add_task(lambda);
|
auto fut = _rl->add_task(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add these implementations to your ThermionDartRenderThreadApi.cpp file
|
||||||
|
|
||||||
|
// Image methods
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_createEmptyRenderThread(uint32_t width, uint32_t height, uint32_t channel, void (*onComplete)(TLinearImage *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto image = Image_createEmpty(width, height, channel);
|
||||||
|
onComplete(image);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_decodeRenderThread(uint8_t *data, size_t length, const char *name, void (*onComplete)(TLinearImage *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto image = Image_decode(data, length, name);
|
||||||
|
onComplete(image);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getBytesRenderThread(TLinearImage *tLinearImage, void (*onComplete)(float *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto bytes = Image_getBytes(tLinearImage);
|
||||||
|
onComplete(bytes);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_destroyRenderThread(TLinearImage *tLinearImage, void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
Image_destroy(tLinearImage);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getWidthRenderThread(TLinearImage *tLinearImage, void (*onComplete)(uint32_t))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto width = Image_getWidth(tLinearImage);
|
||||||
|
onComplete(width);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getHeightRenderThread(TLinearImage *tLinearImage, void (*onComplete)(uint32_t))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto height = Image_getHeight(tLinearImage);
|
||||||
|
onComplete(height);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Image_getChannelsRenderThread(TLinearImage *tLinearImage, void (*onComplete)(uint32_t))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto channels = Image_getChannels(tLinearImage);
|
||||||
|
onComplete(channels);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Texture methods
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Texture_loadImageRenderThread(TEngine *tEngine, TTexture *tTexture, TLinearImage *tImage,
|
||||||
|
TPixelDataFormat bufferFormat, TPixelDataType pixelDataType,
|
||||||
|
void (*onComplete)(bool))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
bool result = Texture_loadImage(tEngine, tTexture, tImage, bufferFormat, pixelDataType);
|
||||||
|
onComplete(result);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void Texture_setImageRenderThread(
|
||||||
|
TEngine *tEngine,
|
||||||
|
TTexture *tTexture,
|
||||||
|
uint32_t level,
|
||||||
|
uint8_t *data,
|
||||||
|
size_t size,
|
||||||
|
uint32_t width,
|
||||||
|
uint32_t height,
|
||||||
|
uint32_t channels,
|
||||||
|
uint32_t bufferFormat,
|
||||||
|
uint32_t pixelDataType,
|
||||||
|
void (*onComplete)(bool))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
bool result = Texture_setImage(tEngine, tTexture, level, data, size, width, height, channels,
|
||||||
|
bufferFormat, pixelDataType);
|
||||||
|
onComplete(result);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void RenderTarget_getColorTextureRenderThread(TRenderTarget *tRenderTarget, void (*onComplete)(TTexture *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto texture = RenderTarget_getColorTexture(tRenderTarget);
|
||||||
|
onComplete(texture);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextureSampler methods
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_createRenderThread(void (*onComplete)(TTextureSampler *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto sampler = TextureSampler_create();
|
||||||
|
onComplete(sampler);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_createWithFilteringRenderThread(
|
||||||
|
TSamplerMinFilter minFilter,
|
||||||
|
TSamplerMagFilter magFilter,
|
||||||
|
TSamplerWrapMode wrapS,
|
||||||
|
TSamplerWrapMode wrapT,
|
||||||
|
TSamplerWrapMode wrapR,
|
||||||
|
void (*onComplete)(TTextureSampler *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto sampler = TextureSampler_createWithFiltering(minFilter, magFilter, wrapS, wrapT, wrapR);
|
||||||
|
onComplete(sampler);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_createWithComparisonRenderThread(
|
||||||
|
TSamplerCompareMode compareMode,
|
||||||
|
TSamplerCompareFunc compareFunc,
|
||||||
|
void (*onComplete)(TTextureSampler *))
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
auto sampler = TextureSampler_createWithComparison(compareMode, compareFunc);
|
||||||
|
onComplete(sampler);
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setMinFilterRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
TSamplerMinFilter filter,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setMinFilter(sampler, filter);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setMagFilterRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
TSamplerMagFilter filter,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setMagFilter(sampler, filter);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setWrapModeSRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setWrapModeS(sampler, mode);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setWrapModeTRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setWrapModeT(sampler, mode);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setWrapModeRRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
TSamplerWrapMode mode,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setWrapModeR(sampler, mode);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setAnisotropyRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
double anisotropy,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setAnisotropy(sampler, anisotropy);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_setCompareModeRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
TSamplerCompareMode mode,
|
||||||
|
TTextureSamplerCompareFunc func,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_setCompareMode(sampler, mode, func);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void TextureSampler_destroyRenderThread(
|
||||||
|
TTextureSampler *sampler,
|
||||||
|
void (*onComplete)())
|
||||||
|
{
|
||||||
|
std::packaged_task<void()> lambda(
|
||||||
|
[=]() mutable
|
||||||
|
{
|
||||||
|
TextureSampler_destroy(sampler);
|
||||||
|
onComplete();
|
||||||
|
});
|
||||||
|
auto fut = _rl->add_task(lambda);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user