remove TMaterialKey struct and pass directly as function params
This commit is contained in:
@@ -887,11 +887,86 @@ external void Gizmo_unhighlight(
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Pointer<TMaterialInstance> Function(ffi.Pointer<TMaterialProvider>,
|
||||
ffi.Pointer<TMaterialKey>)>(isLeaf: true)
|
||||
ffi.Pointer<TMaterialInstance> Function(
|
||||
ffi.Pointer<TMaterialProvider>,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Int,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Uint8,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool)>(isLeaf: true)
|
||||
external ffi.Pointer<TMaterialInstance> MaterialProvider_createMaterialInstance(
|
||||
ffi.Pointer<TMaterialProvider> provider,
|
||||
ffi.Pointer<TMaterialKey> key,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
int metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
int specularGlossinessUV,
|
||||
int baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
int clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
int clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
int clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
int emissiveUV,
|
||||
int aoUV,
|
||||
int normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
int transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
int sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
int sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
int volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
@@ -2121,14 +2196,88 @@ external void SceneAsset_createGeometryRenderThread(
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TMaterialProvider>,
|
||||
ffi.Pointer<TMaterialKey>,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Int,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Uint8,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Uint8,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Bool,
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TMaterialInstance>)>>)>(isLeaf: true)
|
||||
external void MaterialProvider_createMaterialInstanceRenderThread(
|
||||
ffi.Pointer<TMaterialProvider> tMaterialProvider,
|
||||
ffi.Pointer<TMaterialKey> tKey,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
int metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
int specularGlossinessUV,
|
||||
int baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
int clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
int clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
int clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
int emissiveUV,
|
||||
int aoUV,
|
||||
int normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
int transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
int sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
int sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
int volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
ffi.Pointer<
|
||||
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<TMaterialInstance>)>>
|
||||
callback,
|
||||
@@ -3323,134 +3472,6 @@ final class TFilamentAsset extends ffi.Opaque {}
|
||||
|
||||
final class TColorGrading extends ffi.Opaque {}
|
||||
|
||||
final class UnnamedStruct1 extends ffi.Struct {
|
||||
@ffi.Bool()
|
||||
external bool hasMetallicRoughnessTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int metallicRoughnessUV;
|
||||
}
|
||||
|
||||
final class UnnamedStruct2 extends ffi.Struct {
|
||||
@ffi.Bool()
|
||||
external bool hasSpecularGlossinessTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int specularGlossinessUV;
|
||||
}
|
||||
|
||||
final class UnnamedUnion1 extends ffi.Union {
|
||||
external UnnamedStruct1 unnamed;
|
||||
|
||||
external UnnamedStruct2 unnamed$1;
|
||||
}
|
||||
|
||||
final class TMaterialKey extends ffi.Struct {
|
||||
@ffi.Bool()
|
||||
external bool doubleSided;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool unlit;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasVertexColors;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasBaseColorTexture;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasNormalTexture;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasOcclusionTexture;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasEmissiveTexture;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool useSpecularGlossiness;
|
||||
|
||||
@ffi.Int()
|
||||
external int alphaMode;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool enableDiagnostics;
|
||||
|
||||
external UnnamedUnion1 unnamed;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int baseColorUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasClearCoatTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int clearCoatUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasClearCoatRoughnessTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int clearCoatRoughnessUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasClearCoatNormalTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int clearCoatNormalUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasClearCoat;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasTransmission;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasTextureTransforms;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int emissiveUV;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int aoUV;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int normalUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasTransmissionTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int transmissionUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasSheenColorTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int sheenColorUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasSheenRoughnessTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int sheenRoughnessUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasVolumeThicknessTexture;
|
||||
|
||||
@ffi.Uint8()
|
||||
external int volumeThicknessUV;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasSheen;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasIOR;
|
||||
|
||||
@ffi.Bool()
|
||||
external bool hasVolume;
|
||||
}
|
||||
|
||||
final class double3 extends ffi.Struct {
|
||||
@ffi.Double()
|
||||
external double x;
|
||||
|
||||
@@ -901,7 +901,44 @@ extension type NativeLibrary(JSObject _) implements JSObject {
|
||||
);
|
||||
external Pointer<TMaterialInstance> _MaterialProvider_createMaterialInstance(
|
||||
Pointer<TMaterialProvider> provider,
|
||||
Pointer<TMaterialKey> key,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
int metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
int specularGlossinessUV,
|
||||
int baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
int clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
int clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
int clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
int emissiveUV,
|
||||
int aoUV,
|
||||
int normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
int transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
int sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
int sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
int volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
);
|
||||
external Pointer<TRenderTarget> _RenderTarget_create(
|
||||
Pointer<TEngine> tEngine,
|
||||
@@ -1558,7 +1595,44 @@ extension type NativeLibrary(JSObject _) implements JSObject {
|
||||
);
|
||||
external void _MaterialProvider_createMaterialInstanceRenderThread(
|
||||
Pointer<TMaterialProvider> tMaterialProvider,
|
||||
Pointer<TMaterialKey> tKey,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
int metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
int specularGlossinessUV,
|
||||
int baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
int clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
int clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
int clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
int emissiveUV,
|
||||
int aoUV,
|
||||
int normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
int transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
int sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
int sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
int volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
Pointer<self.NativeFunction<void Function(PointerClass<TMaterialInstance>)>>
|
||||
callback,
|
||||
);
|
||||
@@ -3143,10 +3217,85 @@ void Gizmo_unhighlight(
|
||||
|
||||
self.Pointer<TMaterialInstance> MaterialProvider_createMaterialInstance(
|
||||
self.Pointer<TMaterialProvider> provider,
|
||||
self.Pointer<TMaterialKey> key,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
int metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
int specularGlossinessUV,
|
||||
int baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
int clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
int clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
int clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
int emissiveUV,
|
||||
int aoUV,
|
||||
int normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
int transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
int sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
int sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
int volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
) {
|
||||
final result = _lib._MaterialProvider_createMaterialInstance(
|
||||
provider.cast(), key.cast());
|
||||
provider.cast(),
|
||||
doubleSided,
|
||||
unlit,
|
||||
hasVertexColors,
|
||||
hasBaseColorTexture,
|
||||
hasNormalTexture,
|
||||
hasOcclusionTexture,
|
||||
hasEmissiveTexture,
|
||||
useSpecularGlossiness,
|
||||
alphaMode,
|
||||
enableDiagnostics,
|
||||
hasMetallicRoughnessTexture,
|
||||
metallicRoughnessUV,
|
||||
hasSpecularGlossinessTexture,
|
||||
specularGlossinessUV,
|
||||
baseColorUV,
|
||||
hasClearCoatTexture,
|
||||
clearCoatUV,
|
||||
hasClearCoatRoughnessTexture,
|
||||
clearCoatRoughnessUV,
|
||||
hasClearCoatNormalTexture,
|
||||
clearCoatNormalUV,
|
||||
hasClearCoat,
|
||||
hasTransmission,
|
||||
hasTextureTransforms,
|
||||
emissiveUV,
|
||||
aoUV,
|
||||
normalUV,
|
||||
hasTransmissionTexture,
|
||||
transmissionUV,
|
||||
hasSheenColorTexture,
|
||||
sheenColorUV,
|
||||
hasSheenRoughnessTexture,
|
||||
sheenRoughnessUV,
|
||||
hasVolumeThicknessTexture,
|
||||
volumeThicknessUV,
|
||||
hasSheen,
|
||||
hasIOR,
|
||||
hasVolume);
|
||||
return self.Pointer<TMaterialInstance>(result);
|
||||
}
|
||||
|
||||
@@ -4493,12 +4642,88 @@ void SceneAsset_createGeometryRenderThread(
|
||||
|
||||
void MaterialProvider_createMaterialInstanceRenderThread(
|
||||
self.Pointer<TMaterialProvider> tMaterialProvider,
|
||||
self.Pointer<TMaterialKey> tKey,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
int metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
int specularGlossinessUV,
|
||||
int baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
int clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
int clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
int clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
int emissiveUV,
|
||||
int aoUV,
|
||||
int normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
int transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
int sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
int sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
int volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
self.Pointer<self.NativeFunction<void Function(Pointer<TMaterialInstance>)>>
|
||||
callback,
|
||||
) {
|
||||
final result = _lib._MaterialProvider_createMaterialInstanceRenderThread(
|
||||
tMaterialProvider.cast(), tKey.cast(), callback.cast());
|
||||
tMaterialProvider.cast(),
|
||||
doubleSided,
|
||||
unlit,
|
||||
hasVertexColors,
|
||||
hasBaseColorTexture,
|
||||
hasNormalTexture,
|
||||
hasOcclusionTexture,
|
||||
hasEmissiveTexture,
|
||||
useSpecularGlossiness,
|
||||
alphaMode,
|
||||
enableDiagnostics,
|
||||
hasMetallicRoughnessTexture,
|
||||
metallicRoughnessUV,
|
||||
hasSpecularGlossinessTexture,
|
||||
specularGlossinessUV,
|
||||
baseColorUV,
|
||||
hasClearCoatTexture,
|
||||
clearCoatUV,
|
||||
hasClearCoatRoughnessTexture,
|
||||
clearCoatRoughnessUV,
|
||||
hasClearCoatNormalTexture,
|
||||
clearCoatNormalUV,
|
||||
hasClearCoat,
|
||||
hasTransmission,
|
||||
hasTextureTransforms,
|
||||
emissiveUV,
|
||||
aoUV,
|
||||
normalUV,
|
||||
hasTransmissionTexture,
|
||||
transmissionUV,
|
||||
hasSheenColorTexture,
|
||||
sheenColorUV,
|
||||
hasSheenRoughnessTexture,
|
||||
sheenRoughnessUV,
|
||||
hasVolumeThicknessTexture,
|
||||
volumeThicknessUV,
|
||||
hasSheen,
|
||||
hasIOR,
|
||||
hasVolume,
|
||||
callback.cast());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6415,22 +6640,6 @@ sealed class TGizmoAxis {
|
||||
static const Z = 2;
|
||||
}
|
||||
|
||||
extension TMaterialKeyExt on Pointer<TMaterialKey> {
|
||||
TMaterialKey toDart() {
|
||||
return TMaterialKey(this);
|
||||
}
|
||||
|
||||
void setFrom(TMaterialKey dartType) {}
|
||||
}
|
||||
|
||||
final class TMaterialKey extends self.Struct {
|
||||
TMaterialKey(super._address);
|
||||
|
||||
static Pointer<TMaterialKey> stackAlloc() {
|
||||
return Pointer<TMaterialKey>(_lib._stackAlloc<TMaterialKey>(0));
|
||||
}
|
||||
}
|
||||
|
||||
extension TSkyboxExt on Pointer<TSkybox> {
|
||||
TSkybox toDart() {
|
||||
return TSkybox(this);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:animation_tools_dart/animation_tools_dart.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:thermion_dart/src/bindings/src/js_interop.dart';
|
||||
import 'package:thermion_dart/src/utils/src/matrix.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_filament_app.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_material.dart';
|
||||
@@ -224,33 +223,33 @@ class FFIAsset extends ThermionAsset {
|
||||
.setStencilOpDepthStencilPass(StencilOperation.REPLACE);
|
||||
|
||||
await sourceMaterialInstance.setStencilReferenceValue(1);
|
||||
throw Exception("TODO");
|
||||
// final materialInstancePtr =
|
||||
// await withPointerCallback<TMaterialInstance>((cb) {
|
||||
|
||||
final materialInstancePtr =
|
||||
await withPointerCallback<TMaterialInstance>((cb) {
|
||||
final key = Struct.create<TMaterialKey>();
|
||||
MaterialProvider_createMaterialInstanceRenderThread(
|
||||
app.ubershaderMaterialProvider, key.address, cb);
|
||||
});
|
||||
final highlightMaterialInstance =
|
||||
FFIMaterialInstance(materialInstancePtr, app);
|
||||
await highlightMaterialInstance
|
||||
.setStencilCompareFunction(SamplerCompareFunction.NE);
|
||||
await highlightMaterialInstance.setStencilReferenceValue(1);
|
||||
// MaterialProvider_createMaterialInstanceRenderThread(
|
||||
// app.ubershaderMaterialProvider, , cb);
|
||||
// });
|
||||
// final highlightMaterialInstance =
|
||||
// FFIMaterialInstance(materialInstancePtr, app);
|
||||
// await highlightMaterialInstance
|
||||
// .setStencilCompareFunction(SamplerCompareFunction.NE);
|
||||
// await highlightMaterialInstance.setStencilReferenceValue(1);
|
||||
|
||||
await highlightMaterialInstance.setDepthCullingEnabled(false);
|
||||
// await highlightMaterialInstance.setDepthCullingEnabled(false);
|
||||
|
||||
await highlightMaterialInstance.setParameterFloat4(
|
||||
"baseColorFactor", r, g, b, 1.0);
|
||||
// await highlightMaterialInstance.setParameterFloat4(
|
||||
// "baseColorFactor", r, g, b, 1.0);
|
||||
|
||||
var highlightInstance = await this
|
||||
.createInstance(materialInstances: [highlightMaterialInstance]);
|
||||
_highlight = highlightInstance;
|
||||
// var highlightInstance = await this
|
||||
// .createInstance(materialInstances: [highlightMaterialInstance]);
|
||||
// _highlight = highlightInstance;
|
||||
|
||||
await highlightMaterialInstance.setStencilReferenceValue(1);
|
||||
RenderableManager_setPriority(app.renderableManager, targetEntity, 0);
|
||||
// await highlightMaterialInstance.setStencilReferenceValue(1);
|
||||
// RenderableManager_setPriority(app.renderableManager, targetEntity, 0);
|
||||
|
||||
TransformManager_setParent(
|
||||
app.transformManager, _highlight!.entity, entity, false);
|
||||
// TransformManager_setParent(
|
||||
// app.transformManager, _highlight!.entity, entity, false);
|
||||
}
|
||||
|
||||
var targetHighlightEntity = _highlight!.entity;
|
||||
@@ -365,9 +364,47 @@ class FFIAsset extends ThermionAsset {
|
||||
// Create unlit material instance for the wireframe
|
||||
final materialInstancePtr =
|
||||
await withPointerCallback<TMaterialInstance>((cb) {
|
||||
final key = Struct.create<TMaterialKey>();
|
||||
MaterialProvider_createMaterialInstanceRenderThread(
|
||||
app.ubershaderMaterialProvider, key.address, cb);
|
||||
app.ubershaderMaterialProvider,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
cb);
|
||||
});
|
||||
|
||||
final material = FFIMaterialInstance(materialInstancePtr, app);
|
||||
|
||||
@@ -247,8 +247,8 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
///
|
||||
///
|
||||
Future destroyAsset(covariant FFIAsset asset) async {
|
||||
await withVoidCallback(
|
||||
(requestId, cb) => SceneAsset_destroyRenderThread(asset.asset, requestId, cb));
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
SceneAsset_destroyRenderThread(asset.asset, requestId, cb));
|
||||
await asset.dispose();
|
||||
}
|
||||
|
||||
@@ -414,6 +414,8 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
bool enableDiagnostics = false,
|
||||
bool hasMetallicRoughnessTexture = false,
|
||||
int metallicRoughnessUV = 0,
|
||||
bool hasSpecularGlossiness = false,
|
||||
int specularGlossinessUV = 0,
|
||||
int baseColorUV = 0,
|
||||
bool hasClearCoatTexture = false,
|
||||
int clearCoatUV = 0,
|
||||
@@ -438,54 +440,48 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
bool hasSheen = false,
|
||||
bool hasIOR = false,
|
||||
bool hasVolume = false}) async {
|
||||
late Pointer stackPtr;
|
||||
if (FILAMENT_WASM) {
|
||||
//stackPtr = stackSave();
|
||||
}
|
||||
|
||||
final key = Struct.create<TMaterialKey>();
|
||||
|
||||
key.doubleSided = doubleSided;
|
||||
key.unlit = unlit;
|
||||
key.hasVertexColors = hasVertexColors;
|
||||
key.hasBaseColorTexture = hasBaseColorTexture;
|
||||
key.hasNormalTexture = hasNormalTexture;
|
||||
key.hasOcclusionTexture = hasOcclusionTexture;
|
||||
key.hasEmissiveTexture = hasEmissiveTexture;
|
||||
key.useSpecularGlossiness = useSpecularGlossiness;
|
||||
key.alphaMode = alphaMode.index;
|
||||
key.enableDiagnostics = enableDiagnostics;
|
||||
key.unnamed.unnamed.hasMetallicRoughnessTexture =
|
||||
hasMetallicRoughnessTexture;
|
||||
key.unnamed.unnamed.metallicRoughnessUV = 0;
|
||||
key.baseColorUV = baseColorUV;
|
||||
key.hasClearCoatTexture = hasClearCoatTexture;
|
||||
key.clearCoatUV = clearCoatUV;
|
||||
key.hasClearCoatRoughnessTexture = hasClearCoatRoughnessTexture;
|
||||
key.clearCoatRoughnessUV = clearCoatRoughnessUV;
|
||||
key.hasClearCoatNormalTexture = hasClearCoatNormalTexture;
|
||||
key.clearCoatNormalUV = clearCoatNormalUV;
|
||||
key.hasClearCoat = hasClearCoat;
|
||||
key.hasTransmission = hasTransmission;
|
||||
key.hasTextureTransforms = hasTextureTransforms;
|
||||
key.emissiveUV = emissiveUV;
|
||||
key.aoUV = aoUV;
|
||||
key.normalUV = normalUV;
|
||||
key.hasTransmissionTexture = hasTransmissionTexture;
|
||||
key.transmissionUV = transmissionUV;
|
||||
key.hasSheenColorTexture = hasSheenColorTexture;
|
||||
key.sheenColorUV = sheenColorUV;
|
||||
key.hasSheenRoughnessTexture = hasSheenRoughnessTexture;
|
||||
key.sheenRoughnessUV = sheenRoughnessUV;
|
||||
key.hasVolumeThicknessTexture = hasVolumeThicknessTexture;
|
||||
key.volumeThicknessUV = volumeThicknessUV;
|
||||
key.hasSheen = hasSheen;
|
||||
key.hasIOR = hasIOR;
|
||||
key.hasVolume = hasVolume;
|
||||
|
||||
final materialInstance = await withPointerCallback<TMaterialInstance>((cb) {
|
||||
MaterialProvider_createMaterialInstanceRenderThread(
|
||||
ubershaderMaterialProvider, key.address, cb);
|
||||
ubershaderMaterialProvider,
|
||||
doubleSided,
|
||||
unlit,
|
||||
hasVertexColors,
|
||||
hasBaseColorTexture,
|
||||
hasNormalTexture,
|
||||
hasOcclusionTexture,
|
||||
hasEmissiveTexture,
|
||||
useSpecularGlossiness,
|
||||
alphaMode.index,
|
||||
enableDiagnostics,
|
||||
hasMetallicRoughnessTexture,
|
||||
metallicRoughnessUV,
|
||||
hasSpecularGlossiness,
|
||||
specularGlossinessUV,
|
||||
baseColorUV,
|
||||
hasClearCoatTexture,
|
||||
clearCoatUV,
|
||||
hasClearCoatRoughnessTexture,
|
||||
clearCoatRoughnessUV,
|
||||
hasClearCoatNormalTexture,
|
||||
clearCoatNormalUV,
|
||||
hasClearCoat,
|
||||
hasTransmission,
|
||||
hasTextureTransforms,
|
||||
emissiveUV,
|
||||
aoUV,
|
||||
normalUV,
|
||||
hasTransmissionTexture,
|
||||
transmissionUV,
|
||||
hasSheenColorTexture,
|
||||
sheenColorUV,
|
||||
hasSheenRoughnessTexture,
|
||||
sheenRoughnessUV,
|
||||
hasVolumeThicknessTexture,
|
||||
volumeThicknessUV,
|
||||
hasSheen,
|
||||
hasIOR,
|
||||
hasVolume,
|
||||
cb);
|
||||
});
|
||||
|
||||
if (FILAMENT_WASM) {
|
||||
@@ -549,10 +545,11 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
});
|
||||
|
||||
if (FILAMENT_SINGLE_THREADED) {
|
||||
await withVoidCallback((requestId, cb) => Engine_executeRenderThread(engine, requestId, cb));
|
||||
} else {
|
||||
await withVoidCallback(
|
||||
(requestId, cb) => Engine_flushAndWaitRenderThread(engine, requestId, cb));
|
||||
(requestId, cb) => Engine_executeRenderThread(engine, requestId, cb));
|
||||
} else {
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
Engine_flushAndWaitRenderThread(engine, requestId, cb));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,7 +865,8 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
SceneAsset_createFromFilamentAssetRenderThread(engine,
|
||||
gltfAssetLoader, nameComponentManager, filamentAsset, cb));
|
||||
|
||||
await withVoidCallback((requestId, cb) => GltfResourceLoader_destroyRenderThread(
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
GltfResourceLoader_destroyRenderThread(
|
||||
engine, gltfResourceLoader, requestId, cb));
|
||||
|
||||
return FFIAsset(asset, this, animationManager.cast<TAnimationManager>());
|
||||
@@ -886,11 +884,12 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
Future destroyView(covariant FFIView view) async {
|
||||
View_setColorGrading(view.view, nullptr);
|
||||
for (final cg in view.colorGrading.entries) {
|
||||
await withVoidCallback(
|
||||
(requestId, cb) => Engine_destroyColorGradingRenderThread(engine, cg.value, requestId, cb));
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
Engine_destroyColorGradingRenderThread(
|
||||
engine, cg.value, requestId, cb));
|
||||
}
|
||||
await withVoidCallback(
|
||||
(requestId, cb) => Engine_destroyViewRenderThread(engine, view.view, requestId, cb));
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
Engine_destroyViewRenderThread(engine, view.view, requestId, cb));
|
||||
for (final swapchain in _swapChains.keys) {
|
||||
if (_swapChains[swapchain]!.contains(view)) {
|
||||
_swapChains[swapchain]!.remove(view);
|
||||
@@ -901,8 +900,8 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
}
|
||||
|
||||
Future destroyScene(covariant FFIScene scene) async {
|
||||
await withVoidCallback(
|
||||
(requestId, cb) => Engine_destroySceneRenderThread(engine, scene.scene, requestId, cb));
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
Engine_destroySceneRenderThread(engine, scene.scene, requestId, cb));
|
||||
}
|
||||
|
||||
Future<Pointer<TColorGrading>> createColorGrading(ToneMapper mapper) async {
|
||||
@@ -1028,10 +1027,11 @@ class FFIFilamentApp extends FilamentApp<Pointer> {
|
||||
///
|
||||
Future flush() async {
|
||||
if (FILAMENT_SINGLE_THREADED) {
|
||||
await withVoidCallback((requestId, cb) => Engine_executeRenderThread(engine, requestId, cb));
|
||||
} else {
|
||||
await withVoidCallback(
|
||||
(requestId, cb) => Engine_flushAndWaitRenderThread(engine, requestId, cb));
|
||||
(requestId, cb) => Engine_executeRenderThread(engine, requestId, cb));
|
||||
} else {
|
||||
await withVoidCallback((requestId, cb) =>
|
||||
Engine_flushAndWaitRenderThread(engine, requestId, cb));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:thermion_dart/src/bindings/src/js_interop.dart';
|
||||
import 'package:thermion_dart/src/filament/src/interface/scene.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_filament_app.dart';
|
||||
import 'package:thermion_dart/src/filament/src/implementation/ffi_render_target.dart';
|
||||
|
||||
@@ -45,68 +45,6 @@ extern "C"
|
||||
typedef struct TFilamentAsset TFilamentAsset;
|
||||
typedef struct TColorGrading TColorGrading;
|
||||
|
||||
struct TMaterialKey {
|
||||
bool doubleSided;
|
||||
bool unlit;
|
||||
bool hasVertexColors;
|
||||
bool hasBaseColorTexture;
|
||||
bool hasNormalTexture;
|
||||
bool hasOcclusionTexture;
|
||||
bool hasEmissiveTexture;
|
||||
bool useSpecularGlossiness;
|
||||
int alphaMode;
|
||||
bool enableDiagnostics;
|
||||
union {
|
||||
#ifdef __cplusplus
|
||||
struct {
|
||||
bool hasMetallicRoughnessTexture;
|
||||
uint8_t metallicRoughnessUV;
|
||||
};
|
||||
struct {
|
||||
bool hasSpecularGlossinessTexture;
|
||||
uint8_t specularGlossinessUV;
|
||||
};
|
||||
#else
|
||||
struct {
|
||||
bool hasMetallicRoughnessTexture;
|
||||
uint8_t metallicRoughnessUV;
|
||||
};
|
||||
struct {
|
||||
bool hasSpecularGlossinessTexture;
|
||||
uint8_t specularGlossinessUV;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
uint8_t baseColorUV;
|
||||
// -- 32 bit boundary --
|
||||
bool hasClearCoatTexture;
|
||||
uint8_t clearCoatUV;
|
||||
bool hasClearCoatRoughnessTexture;
|
||||
uint8_t clearCoatRoughnessUV;
|
||||
bool hasClearCoatNormalTexture;
|
||||
uint8_t clearCoatNormalUV;
|
||||
bool hasClearCoat;
|
||||
bool hasTransmission;
|
||||
bool hasTextureTransforms;
|
||||
// -- 32 bit boundary --
|
||||
uint8_t emissiveUV;
|
||||
uint8_t aoUV;
|
||||
uint8_t normalUV;
|
||||
bool hasTransmissionTexture;
|
||||
uint8_t transmissionUV;
|
||||
// -- 32 bit boundary --
|
||||
bool hasSheenColorTexture;
|
||||
uint8_t sheenColorUV;
|
||||
bool hasSheenRoughnessTexture;
|
||||
uint8_t sheenRoughnessUV;
|
||||
bool hasVolumeThicknessTexture;
|
||||
uint8_t volumeThicknessUV ;
|
||||
bool hasSheen;
|
||||
bool hasIOR;
|
||||
bool hasVolume;
|
||||
} ;
|
||||
typedef struct TMaterialKey TMaterialKey;
|
||||
|
||||
typedef struct {
|
||||
double x;
|
||||
double y;
|
||||
|
||||
@@ -9,7 +9,47 @@ extern "C"
|
||||
#endif
|
||||
|
||||
// EMSCRIPTEN_KEEPALIVE TMaterialProvider *MaterialProvider_create(TEngine *tEngine, uint8_t* data, size_t length);
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *MaterialProvider_createMaterialInstance(TMaterialProvider *provider, TMaterialKey *key);
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *MaterialProvider_createMaterialInstance(
|
||||
TMaterialProvider *provider,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
uint8_t metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
uint8_t specularGlossinessUV,
|
||||
uint8_t baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
uint8_t clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
uint8_t clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
uint8_t clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
uint8_t emissiveUV,
|
||||
uint8_t aoUV,
|
||||
uint8_t normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
uint8_t transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
uint8_t sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
uint8_t sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
uint8_t volumeThicknessUV ,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -116,7 +116,47 @@ namespace thermion
|
||||
int materialInstanceCount,
|
||||
void (*callback)(TSceneAsset *)
|
||||
);
|
||||
void MaterialProvider_createMaterialInstanceRenderThread(TMaterialProvider *tMaterialProvider, TMaterialKey *tKey, void (*callback)(TMaterialInstance *));
|
||||
void MaterialProvider_createMaterialInstanceRenderThread(
|
||||
TMaterialProvider *tMaterialProvider,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
uint8_t metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
uint8_t specularGlossinessUV,
|
||||
uint8_t baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
uint8_t clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
uint8_t clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
uint8_t clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
uint8_t emissiveUV,
|
||||
uint8_t aoUV,
|
||||
uint8_t normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
uint8_t transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
uint8_t sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
uint8_t sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
uint8_t volumeThicknessUV ,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
void (*callback)(TMaterialInstance *));
|
||||
|
||||
void AnimationManager_updateBoneMatricesRenderThread(
|
||||
TAnimationManager *tAnimationManager,
|
||||
|
||||
@@ -20,41 +20,81 @@ namespace thermion
|
||||
{
|
||||
#endif
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *MaterialProvider_createMaterialInstance(TMaterialProvider *tMaterialProvider, TMaterialKey *materialConfig)
|
||||
EMSCRIPTEN_KEEPALIVE TMaterialInstance *MaterialProvider_createMaterialInstance(
|
||||
TMaterialProvider *tMaterialProvider,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
uint8_t metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
uint8_t specularGlossinessUV,
|
||||
uint8_t baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
uint8_t clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
uint8_t clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
uint8_t clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
uint8_t emissiveUV,
|
||||
uint8_t aoUV,
|
||||
uint8_t normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
uint8_t transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
uint8_t sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
uint8_t sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
uint8_t volumeThicknessUV ,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume)
|
||||
{
|
||||
gltfio::MaterialKey config;
|
||||
gltfio::UvMap uvMap;
|
||||
memset(&config, 0, sizeof(gltfio::MaterialKey));
|
||||
|
||||
// Set and log each field
|
||||
config.unlit = materialConfig->unlit;
|
||||
config.doubleSided = materialConfig->doubleSided;
|
||||
config.useSpecularGlossiness = materialConfig->useSpecularGlossiness;
|
||||
config.alphaMode = static_cast<filament::gltfio::AlphaMode>(materialConfig->alphaMode);
|
||||
config.hasBaseColorTexture = materialConfig->hasBaseColorTexture;
|
||||
config.hasClearCoat = materialConfig->hasClearCoat;
|
||||
config.hasClearCoatNormalTexture = materialConfig->hasClearCoatNormalTexture;
|
||||
config.hasClearCoatRoughnessTexture = materialConfig->hasClearCoatRoughnessTexture;
|
||||
config.hasEmissiveTexture = materialConfig->hasEmissiveTexture;
|
||||
config.hasIOR = materialConfig->hasIOR;
|
||||
config.hasMetallicRoughnessTexture = materialConfig->hasMetallicRoughnessTexture;
|
||||
config.hasNormalTexture = materialConfig->hasNormalTexture;
|
||||
config.hasOcclusionTexture = materialConfig->hasOcclusionTexture;
|
||||
config.hasSheen = materialConfig->hasSheen;
|
||||
config.hasSheenColorTexture = materialConfig->hasSheenColorTexture;
|
||||
config.hasSheenRoughnessTexture = materialConfig->hasSheenRoughnessTexture;
|
||||
config.hasTextureTransforms = materialConfig->hasTextureTransforms;
|
||||
config.hasTransmission = materialConfig->hasTransmission;
|
||||
config.hasTransmissionTexture = materialConfig->hasTransmissionTexture;
|
||||
config.hasVolume = materialConfig->hasVolume;
|
||||
config.hasVolumeThicknessTexture = materialConfig->hasVolumeThicknessTexture;
|
||||
config.baseColorUV = materialConfig->baseColorUV;
|
||||
config.hasVertexColors = materialConfig->hasVertexColors;
|
||||
config.unlit = unlit;
|
||||
config.doubleSided = doubleSided;
|
||||
config.useSpecularGlossiness = useSpecularGlossiness;
|
||||
config.alphaMode = static_cast<filament::gltfio::AlphaMode>(alphaMode);
|
||||
config.hasBaseColorTexture = hasBaseColorTexture;
|
||||
config.hasClearCoat = hasClearCoat;
|
||||
config.hasClearCoatNormalTexture = hasClearCoatNormalTexture;
|
||||
config.hasClearCoatRoughnessTexture = hasClearCoatRoughnessTexture;
|
||||
config.hasEmissiveTexture = hasEmissiveTexture;
|
||||
config.hasIOR = hasIOR;
|
||||
config.hasMetallicRoughnessTexture = hasMetallicRoughnessTexture;
|
||||
config.hasNormalTexture = hasNormalTexture;
|
||||
config.hasOcclusionTexture = hasOcclusionTexture;
|
||||
config.hasSheen = hasSheen;
|
||||
config.hasSheenColorTexture = hasSheenColorTexture;
|
||||
config.hasSheenRoughnessTexture = hasSheenRoughnessTexture;
|
||||
config.hasTextureTransforms = hasTextureTransforms;
|
||||
config.hasTransmission = hasTransmission;
|
||||
config.hasTransmissionTexture = hasTransmissionTexture;
|
||||
config.hasVolume = hasVolume;
|
||||
config.hasVolumeThicknessTexture = hasVolumeThicknessTexture;
|
||||
config.baseColorUV = baseColorUV;
|
||||
config.hasVertexColors = hasVertexColors;
|
||||
|
||||
auto *materialProvider = reinterpret_cast<gltfio::MaterialProvider *>(tMaterialProvider);
|
||||
auto materialInstance = materialProvider->createMaterialInstance(&config, &uvMap);
|
||||
return reinterpret_cast<TMaterialInstance *>(materialInstance);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,7 @@ using namespace std::chrono_literals;
|
||||
#define PROXY(call) \
|
||||
auto startTime = std::chrono::high_resolution_clock::now(); \
|
||||
TRACE("PROXYING"); \
|
||||
_renderThread->queue.proxySync(_renderThread->outer, [=]() { \
|
||||
call; \
|
||||
});
|
||||
_renderThread->queue.proxySync(_renderThread->outer, [=]() { call; });
|
||||
#else
|
||||
#define PROXY(call) call
|
||||
#endif
|
||||
@@ -65,7 +63,8 @@ extern "C"
|
||||
|
||||
static std::unique_ptr<RenderThread> _renderThread;
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_create() {
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_create()
|
||||
{
|
||||
TRACE("RenderThread_create");
|
||||
if (_renderThread)
|
||||
{
|
||||
@@ -75,7 +74,8 @@ extern "C"
|
||||
TRACE("RenderThread created");
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_destroy() {
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_destroy()
|
||||
{
|
||||
TRACE("RenderThread_destroy");
|
||||
if (_renderThread)
|
||||
{
|
||||
@@ -83,7 +83,8 @@ extern "C"
|
||||
}
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_addTask(void (*task)()) {
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_addTask(void (*task)())
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -92,16 +93,19 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_setRenderTicker(TRenderTicker *tRenderTicker) {
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_setRenderTicker(TRenderTicker *tRenderTicker)
|
||||
{
|
||||
auto *renderTicker = reinterpret_cast<RenderTicker *>(tRenderTicker);
|
||||
_renderThread->setRenderTicker(renderTicker);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_requestFrameAsync() {
|
||||
EMSCRIPTEN_KEEPALIVE void RenderThread_requestFrameAsync()
|
||||
{
|
||||
_renderThread->requestFrame();
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void RenderTicker_renderRenderThread(TRenderTicker *tRenderTicker, uint64_t frameTimeInNanos, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void RenderTicker_renderRenderThread(TRenderTicker *tRenderTicker, uint64_t frameTimeInNanos, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -117,7 +121,8 @@ extern "C"
|
||||
void *sharedContext,
|
||||
uint8_t stereoscopicEyeCount,
|
||||
bool disableHandleUseAfterFreeCheck,
|
||||
void (*onComplete)(TEngine *)) {
|
||||
void (*onComplete)(TEngine *))
|
||||
{
|
||||
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
@@ -128,7 +133,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createRendererRenderThread(TEngine *tEngine, void (*onComplete)(TRenderer *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createRendererRenderThread(TEngine *tEngine, void (*onComplete)(TRenderer *))
|
||||
{
|
||||
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
@@ -139,7 +145,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createSwapChainRenderThread(TEngine *tEngine, void *window, uint64_t flags, void (*onComplete)(TSwapChain *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createSwapChainRenderThread(TEngine *tEngine, void *window, uint64_t flags, void (*onComplete)(TSwapChain *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -149,7 +156,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createHeadlessSwapChainRenderThread(TEngine *tEngine, uint32_t width, uint32_t height, uint64_t flags, void (*onComplete)(TSwapChain *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createHeadlessSwapChainRenderThread(TEngine *tEngine, uint32_t width, uint32_t height, uint64_t flags, void (*onComplete)(TSwapChain *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -159,7 +167,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroySwapChainRenderThread(TEngine *tEngine, TSwapChain *tSwapChain, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroySwapChainRenderThread(TEngine *tEngine, TSwapChain *tSwapChain, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -169,7 +178,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyViewRenderThread(TEngine *tEngine, TView *tView, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyViewRenderThread(TEngine *tEngine, TView *tView, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -179,7 +189,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroySceneRenderThread(TEngine *tEngine, TScene *tScene, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroySceneRenderThread(TEngine *tEngine, TScene *tScene, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -189,7 +200,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createCameraRenderThread(TEngine* tEngine, void (*onComplete)(TCamera *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createCameraRenderThread(TEngine *tEngine, void (*onComplete)(TCamera *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -199,7 +211,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createViewRenderThread(TEngine *tEngine, void (*onComplete)(TView *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createViewRenderThread(TEngine *tEngine, void (*onComplete)(TView *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -209,7 +222,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyRenderThread(TEngine *tEngine, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyRenderThread(TEngine *tEngine, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -230,7 +244,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroySkyboxRenderThread(TEngine *tEngine, TSkybox *tSkybox, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroySkyboxRenderThread(TEngine *tEngine, TSkybox *tSkybox, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -240,7 +255,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyIndirectLightRenderThread(TEngine *tEngine, TIndirectLight *tIndirectLight, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyIndirectLightRenderThread(TEngine *tEngine, TIndirectLight *tIndirectLight, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -261,7 +277,6 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyMaterialRenderThread(TEngine *tEngine, TMaterial *tMaterial, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
@@ -273,7 +288,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyMaterialInstanceRenderThread(TEngine *tEngine, TMaterialInstance *tMaterialInstance, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyMaterialInstanceRenderThread(TEngine *tEngine, TMaterialInstance *tMaterialInstance, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -283,7 +299,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createFenceRenderThread(TEngine *tEngine, void (*onComplete)(TFence*)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_createFenceRenderThread(TEngine *tEngine, void (*onComplete)(TFence *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -293,7 +310,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyFenceRenderThread(TEngine *tEngine, TFence *tFence, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_destroyFenceRenderThread(TEngine *tEngine, TFence *tFence, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -303,7 +321,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_flushAndWaitRenderThread(TEngine *tEngine, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_flushAndWaitRenderThread(TEngine *tEngine, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -313,7 +332,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_executeRenderThread(TEngine *tEngine, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_executeRenderThread(TEngine *tEngine, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -323,13 +343,15 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void execute_queue() {
|
||||
EMSCRIPTEN_KEEPALIVE void execute_queue()
|
||||
{
|
||||
#ifdef __EMSCRIPTEN__
|
||||
_renderThread->queue.execute();
|
||||
#endif
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_buildSkyboxRenderThread(TEngine *tEngine, uint8_t *skyboxData, size_t length, void (*onComplete)(TSkybox *), void (*onTextureUploadComplete)()) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_buildSkyboxRenderThread(TEngine *tEngine, uint8_t *skyboxData, size_t length, void (*onComplete)(TSkybox *), void (*onTextureUploadComplete)())
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -339,7 +361,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_buildIndirectLightRenderThread(TEngine *tEngine, uint8_t *iblData, size_t length, float intensity, void (*onComplete)(TIndirectLight *), void (*onTextureUploadComplete)()) {
|
||||
EMSCRIPTEN_KEEPALIVE void Engine_buildIndirectLightRenderThread(TEngine *tEngine, uint8_t *iblData, size_t length, float intensity, void (*onComplete)(TIndirectLight *), void (*onTextureUploadComplete)())
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -349,7 +372,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_beginFrameRenderThread(TRenderer *tRenderer, TSwapChain *tSwapChain, uint64_t frameTimeInNanos, void (*onComplete)(bool)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_beginFrameRenderThread(TRenderer *tRenderer, TSwapChain *tSwapChain, uint64_t frameTimeInNanos, void (*onComplete)(bool))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -358,7 +382,8 @@ extern "C"
|
||||
});
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_endFrameRenderThread(TRenderer *tRenderer, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_endFrameRenderThread(TRenderer *tRenderer, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -368,7 +393,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_renderRenderThread(TRenderer *tRenderer, TView *tView, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_renderRenderThread(TRenderer *tRenderer, TView *tView, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -378,7 +404,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_renderStandaloneViewRenderThread(TRenderer *tRenderer, TView *tView, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Renderer_renderStandaloneViewRenderThread(TRenderer *tRenderer, TView *tView, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -396,7 +423,8 @@ extern "C"
|
||||
double clearA,
|
||||
uint8_t clearStencil,
|
||||
bool clear,
|
||||
bool discard, uint32_t requestId, VoidCallback onComplete) {
|
||||
bool discard, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -414,7 +442,8 @@ extern "C"
|
||||
TPixelDataType tPixelDataType,
|
||||
uint8_t *out,
|
||||
size_t outLength,
|
||||
uint32_t requestId, VoidCallback onComplete) {
|
||||
uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -424,7 +453,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Material_createImageMaterialRenderThread(TEngine *tEngine, void (*onComplete)(TMaterial *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Material_createImageMaterialRenderThread(TEngine *tEngine, void (*onComplete)(TMaterial *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -434,7 +464,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Material_createGizmoMaterialRenderThread(TEngine *tEngine, void (*onComplete)(TMaterial *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void Material_createGizmoMaterialRenderThread(TEngine *tEngine, void (*onComplete)(TMaterial *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -444,7 +475,6 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Material_createInstanceRenderThread(TMaterial *tMaterial, void (*onComplete)(TMaterialInstance *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
@@ -456,7 +486,8 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_destroyRenderThread(TSceneAsset *tSceneAsset, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_destroyRenderThread(TSceneAsset *tSceneAsset, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -466,7 +497,6 @@ extern "C"
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void SceneAsset_createGeometryRenderThread(
|
||||
TEngine *tEngine,
|
||||
float *vertices,
|
||||
@@ -480,8 +510,8 @@ extern "C"
|
||||
TPrimitiveType tPrimitiveType,
|
||||
TMaterialInstance **materialInstances,
|
||||
int materialInstanceCount,
|
||||
void (*callback)(TSceneAsset *)
|
||||
) {
|
||||
void (*callback)(TSceneAsset *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]
|
||||
{
|
||||
@@ -496,8 +526,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
TGltfAssetLoader *tAssetLoader,
|
||||
TNameComponentManager *tNameComponentManager,
|
||||
TFilamentAsset *tFilamentAsset,
|
||||
void (*onComplete)(TSceneAsset *)
|
||||
) {
|
||||
void (*onComplete)(TSceneAsset *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]
|
||||
{
|
||||
@@ -521,12 +551,91 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void MaterialProvider_createMaterialInstanceRenderThread(TMaterialProvider *tMaterialProvider, TMaterialKey *tKey, void (*callback)(TMaterialInstance *))
|
||||
EMSCRIPTEN_KEEPALIVE void MaterialProvider_createMaterialInstanceRenderThread(
|
||||
TMaterialProvider *tMaterialProvider,
|
||||
bool doubleSided,
|
||||
bool unlit,
|
||||
bool hasVertexColors,
|
||||
bool hasBaseColorTexture,
|
||||
bool hasNormalTexture,
|
||||
bool hasOcclusionTexture,
|
||||
bool hasEmissiveTexture,
|
||||
bool useSpecularGlossiness,
|
||||
int alphaMode,
|
||||
bool enableDiagnostics,
|
||||
bool hasMetallicRoughnessTexture,
|
||||
uint8_t metallicRoughnessUV,
|
||||
bool hasSpecularGlossinessTexture,
|
||||
uint8_t specularGlossinessUV,
|
||||
uint8_t baseColorUV,
|
||||
bool hasClearCoatTexture,
|
||||
uint8_t clearCoatUV,
|
||||
bool hasClearCoatRoughnessTexture,
|
||||
uint8_t clearCoatRoughnessUV,
|
||||
bool hasClearCoatNormalTexture,
|
||||
uint8_t clearCoatNormalUV,
|
||||
bool hasClearCoat,
|
||||
bool hasTransmission,
|
||||
bool hasTextureTransforms,
|
||||
uint8_t emissiveUV,
|
||||
uint8_t aoUV,
|
||||
uint8_t normalUV,
|
||||
bool hasTransmissionTexture,
|
||||
uint8_t transmissionUV,
|
||||
bool hasSheenColorTexture,
|
||||
uint8_t sheenColorUV,
|
||||
bool hasSheenRoughnessTexture,
|
||||
uint8_t sheenRoughnessUV,
|
||||
bool hasVolumeThicknessTexture,
|
||||
uint8_t volumeThicknessUV,
|
||||
bool hasSheen,
|
||||
bool hasIOR,
|
||||
bool hasVolume,
|
||||
void (*callback)(TMaterialInstance *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]
|
||||
{
|
||||
auto materialInstance = MaterialProvider_createMaterialInstance(tMaterialProvider, tKey);
|
||||
auto materialInstance = MaterialProvider_createMaterialInstance(
|
||||
tMaterialProvider,
|
||||
doubleSided,
|
||||
unlit,
|
||||
hasVertexColors,
|
||||
hasBaseColorTexture,
|
||||
hasNormalTexture,
|
||||
hasOcclusionTexture,
|
||||
hasEmissiveTexture,
|
||||
useSpecularGlossiness,
|
||||
alphaMode,
|
||||
enableDiagnostics,
|
||||
hasMetallicRoughnessTexture,
|
||||
metallicRoughnessUV,
|
||||
hasSpecularGlossinessTexture,
|
||||
specularGlossinessUV,
|
||||
baseColorUV,
|
||||
hasClearCoatTexture,
|
||||
clearCoatUV,
|
||||
hasClearCoatRoughnessTexture,
|
||||
clearCoatRoughnessUV,
|
||||
hasClearCoatNormalTexture,
|
||||
clearCoatNormalUV,
|
||||
hasClearCoat,
|
||||
hasTransmission,
|
||||
hasTextureTransforms,
|
||||
emissiveUV,
|
||||
aoUV,
|
||||
normalUV,
|
||||
hasTransmissionTexture,
|
||||
transmissionUV,
|
||||
hasSheenColorTexture,
|
||||
sheenColorUV,
|
||||
hasSheenRoughnessTexture,
|
||||
sheenRoughnessUV,
|
||||
hasVolumeThicknessTexture,
|
||||
volumeThicknessUV,
|
||||
hasSheen,
|
||||
hasIOR,
|
||||
hasVolume);
|
||||
PROXY(callback(materialInstance));
|
||||
});
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
@@ -554,11 +663,11 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void View_pickRenderThread(TView *tView, uint32_t requestId, uint32_t x, uint32_t y, PickCallback callback) {
|
||||
EMSCRIPTEN_KEEPALIVE void View_pickRenderThread(TView *tView, uint32_t requestId, uint32_t x, uint32_t y, PickCallback callback)
|
||||
{
|
||||
auto *view = reinterpret_cast<View *>(tView);
|
||||
view->pick(x, y, [=](filament::View::PickingQueryResult const &result) {
|
||||
PROXY(callback(requestId, utils::Entity::smuggle(result.renderable), result.depth, result.fragCoords.x, result.fragCoords.y, result.fragCoords.z));
|
||||
});
|
||||
view->pick(x, y, [=](filament::View::PickingQueryResult const &result)
|
||||
{ PROXY(callback(requestId, utils::Entity::smuggle(result.renderable), result.depth, result.fragCoords.x, result.fragCoords.y, result.fragCoords.z)); });
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void View_setColorGradingRenderThread(TView *tView, TColorGrading *tColorGrading, uint32_t requestId, VoidCallback onComplete)
|
||||
@@ -594,7 +703,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void AnimationManager_createRenderThread(TEngine *tEngine, TScene *tScene, void (*onComplete)(TAnimationManager *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void AnimationManager_createRenderThread(TEngine *tEngine, TScene *tScene, void (*onComplete)(TAnimationManager *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -723,7 +833,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
uint16_t tUsage,
|
||||
intptr_t import,
|
||||
TTextureSamplerType sampler,
|
||||
TTextureFormat format, void (*onComplete)(TTexture *)) {
|
||||
TTextureFormat format, void (*onComplete)(TTexture *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -785,8 +896,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
uint32_t depth,
|
||||
uint32_t bufferFormat,
|
||||
uint32_t pixelDataType,
|
||||
void (*onComplete)(bool)
|
||||
) {
|
||||
void (*onComplete)(bool))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -804,8 +915,7 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
channels,
|
||||
depth,
|
||||
bufferFormat,
|
||||
pixelDataType
|
||||
);
|
||||
pixelDataType);
|
||||
PROXY(onComplete(result));
|
||||
});
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
@@ -845,8 +955,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
EMSCRIPTEN_KEEPALIVE void RenderTarget_destroyRenderThread(
|
||||
TEngine *tEngine,
|
||||
TRenderTarget *tRenderTarget,
|
||||
uint32_t requestId, VoidCallback onComplete
|
||||
) {
|
||||
uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -856,7 +966,6 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void TextureSampler_createRenderThread(void (*onComplete)(TTextureSampler *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
@@ -1011,7 +1120,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void GltfAssetLoader_createRenderThread(TEngine *tEngine, TMaterialProvider *tMaterialProvider, void (*callback)(TGltfAssetLoader *)) {
|
||||
EMSCRIPTEN_KEEPALIVE void GltfAssetLoader_createRenderThread(TEngine *tEngine, TMaterialProvider *tMaterialProvider, void (*callback)(TGltfAssetLoader *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1031,7 +1141,9 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_destroyRenderThread(TEngine *tEngine, TGltfResourceLoader *tResourceLoader, uint32_t requestId, VoidCallback onComplete) {
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_destroyRenderThread(TEngine *tEngine, TGltfResourceLoader *tResourceLoader, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1041,7 +1153,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_loadResourcesRenderThread(TGltfResourceLoader *tGltfResourceLoader, TFilamentAsset *tFilamentAsset, void (*callback)(bool)) {
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_loadResourcesRenderThread(TGltfResourceLoader *tGltfResourceLoader, TFilamentAsset *tFilamentAsset, void (*callback)(bool))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1056,7 +1169,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
const char *uri,
|
||||
uint8_t *data,
|
||||
size_t length,
|
||||
uint32_t requestId, VoidCallback onComplete) {
|
||||
uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1069,7 +1183,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_asyncBeginLoadRenderThread(
|
||||
TGltfResourceLoader *tGltfResourceLoader,
|
||||
TFilamentAsset *tFilamentAsset,
|
||||
void (*callback)(bool)) {
|
||||
void (*callback)(bool))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1080,7 +1195,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_asyncUpdateLoadRenderThread(
|
||||
TGltfResourceLoader *tGltfResourceLoader) {
|
||||
TGltfResourceLoader *tGltfResourceLoader)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1091,7 +1207,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void GltfResourceLoader_asyncGetLoadProgressRenderThread(
|
||||
TGltfResourceLoader *tGltfResourceLoader,
|
||||
void (*callback)(float)) {
|
||||
void (*callback)(float))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1107,8 +1224,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
uint8_t *data,
|
||||
size_t length,
|
||||
uint8_t numInstances,
|
||||
void (*callback)(TFilamentAsset *)
|
||||
) {
|
||||
void (*callback)(TFilamentAsset *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1118,7 +1235,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
auto fut = _renderThread->add_task(lambda);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE void Scene_addFilamentAssetRenderThread(TScene* tScene, TFilamentAsset *tAsset, uint32_t requestId, VoidCallback onComplete) {
|
||||
EMSCRIPTEN_KEEPALIVE void Scene_addFilamentAssetRenderThread(TScene *tScene, TFilamentAsset *tAsset, uint32_t requestId, VoidCallback onComplete)
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
@@ -1136,8 +1254,8 @@ EMSCRIPTEN_KEEPALIVE void SceneAsset_createFromFilamentAssetRenderThread(
|
||||
TView *tView,
|
||||
TMaterial *tMaterial,
|
||||
TGizmoType tGizmoType,
|
||||
void (*callback)(TGizmo *)
|
||||
) {
|
||||
void (*callback)(TGizmo *))
|
||||
{
|
||||
std::packaged_task<void()> lambda(
|
||||
[=]() mutable
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user