add shadow methods to wasm/js viewers
This commit is contained in:
@@ -826,4 +826,19 @@ class ThermionViewerJS implements ThermionViewer {
|
|||||||
void onDispose(Future Function() callback) {
|
void onDispose(Future Function() callback) {
|
||||||
_onDispose.add(callback);
|
_onDispose.add(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setShadowType(ShadowType shadowType) {
|
||||||
|
return _shim.setShadowType(shadowType).toDart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setShadowsEnabled(bool enabled) {
|
||||||
|
return _shim.setShadowsEnabled(enabled).toDart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setSoftShadowOptions(double penumbraScale, double penumbraRatioScale) {
|
||||||
|
return _shim.setSoftShadowOptions(penumbraScale, penumbraRatioScale).toDart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -405,5 +405,17 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
|
|||||||
@JS('setBoneTransform')
|
@JS('setBoneTransform')
|
||||||
external JSPromise setBoneTransform(
|
external JSPromise setBoneTransform(
|
||||||
ThermionEntity entity, int boneIndex, JSArray<JSNumber> transform, int skinIndex);
|
ThermionEntity entity, int boneIndex, JSArray<JSNumber> transform, int skinIndex);
|
||||||
|
|
||||||
|
@JS('setShadowsEnabled')
|
||||||
|
external JSPromise setShadowsEnabled(
|
||||||
|
bool enabled);
|
||||||
|
|
||||||
|
@JS('setShadowType')
|
||||||
|
external JSPromise setShadowType(
|
||||||
|
ShadowType shadowType);
|
||||||
|
|
||||||
|
@JS('setSoftShadowOptions')
|
||||||
|
external JSPromise setSoftShadowOptions(
|
||||||
|
double penumbraScale, double penumbraRatioScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -631,8 +631,8 @@ class ThermionViewerWasm implements ThermionViewer {
|
|||||||
final promise = _module.ccall(
|
final promise = _module.ccall(
|
||||||
"load_gltf",
|
"load_gltf",
|
||||||
"int",
|
"int",
|
||||||
["void*".toJS, "string".toJS, "string".toJS, "bool".toJS].toJS,
|
["void*".toJS, "string".toJS, "string".toJS].toJS,
|
||||||
[_sceneManager!, path.toJS, relativeResourcePath.toJS, force.toJS].toJS,
|
[_sceneManager!, path.toJS, relativeResourcePath.toJS].toJS,
|
||||||
{"async": true}.jsify()) as JSPromise<JSNumber>;
|
{"async": true}.jsify()) as JSPromise<JSNumber>;
|
||||||
final entityId = (await promise.toDart).toDartInt;
|
final entityId = (await promise.toDart).toDartInt;
|
||||||
if (entityId == -1) {
|
if (entityId == -1) {
|
||||||
@@ -1847,4 +1847,34 @@ class ThermionViewerWasm implements ThermionViewer {
|
|||||||
// TODO: implement zoomUpdate
|
// TODO: implement zoomUpdate
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setShadowType(ShadowType shadowType) async {
|
||||||
|
_module.ccall(
|
||||||
|
"set_shadow_type",
|
||||||
|
"void",
|
||||||
|
["void*".toJS, "int".toJS].toJS,
|
||||||
|
[_viewer!, shadowType.index.toJS].toJS,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setShadowsEnabled(bool enabled) async {
|
||||||
|
_module.ccall(
|
||||||
|
"set_shadows_enabled",
|
||||||
|
"void",
|
||||||
|
["void*".toJS, "bool".toJS].toJS,
|
||||||
|
[_viewer!, enabled.toJS].toJS,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future setSoftShadowOptions(double penumbraScale, double penumbraRatioScale) async {
|
||||||
|
_module.ccall(
|
||||||
|
"set_soft_shadow_options",
|
||||||
|
"void",
|
||||||
|
["void*".toJS, "float".toJS, "float".toJS].toJS,
|
||||||
|
[_viewer!, penumbraScale.toJS, penumbraRatioScale.toJS].toJS,
|
||||||
|
null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user