feat: expose setCastShadows/setReceiveShadows
This commit is contained in:
@@ -2502,7 +2502,6 @@ external bool RenderableManager_isRenderable(
|
||||
int entityId,
|
||||
);
|
||||
|
||||
/// Checks if the given entity has a renderable component
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external bool RenderableManager_hasComponent(
|
||||
@@ -2510,13 +2509,11 @@ external bool RenderableManager_hasComponent(
|
||||
int entityId,
|
||||
);
|
||||
|
||||
/// Returns true if this manager has no components
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TRenderableManager>)>(isLeaf: true)
|
||||
external bool RenderableManager_empty(
|
||||
ffi.Pointer<TRenderableManager> tRenderableManager,
|
||||
);
|
||||
|
||||
/// Returns whether a light channel is enabled on a specified renderable
|
||||
@ffi.Native<
|
||||
ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId,
|
||||
ffi.UnsignedInt)>(isLeaf: true)
|
||||
@@ -2526,7 +2523,6 @@ external bool RenderableManager_getLightChannel(
|
||||
int channel,
|
||||
);
|
||||
|
||||
/// Checks if the renderable can cast shadows
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external bool RenderableManager_isShadowCaster(
|
||||
@@ -2534,7 +2530,24 @@ external bool RenderableManager_isShadowCaster(
|
||||
int entityId,
|
||||
);
|
||||
|
||||
/// Checks if the renderable can receive shadows
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TRenderableManager>, EntityId, ffi.Bool)>(isLeaf: true)
|
||||
external void RenderableManager_setCastShadows(
|
||||
ffi.Pointer<TRenderableManager> tRenderableManager,
|
||||
int entityId,
|
||||
bool castShadows,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(
|
||||
ffi.Pointer<TRenderableManager>, EntityId, ffi.Bool)>(isLeaf: true)
|
||||
external void RenderableManager_setReceiveShadows(
|
||||
ffi.Pointer<TRenderableManager> tRenderableManager,
|
||||
int entityId,
|
||||
bool receiveShadows,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external bool RenderableManager_isShadowReceiver(
|
||||
@@ -2542,7 +2555,6 @@ external bool RenderableManager_isShadowReceiver(
|
||||
int entityId,
|
||||
);
|
||||
|
||||
/// Returns whether large-scale fog is enabled for this renderable
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TRenderableManager>, EntityId)>(
|
||||
isLeaf: true)
|
||||
external bool RenderableManager_getFogEnabled(
|
||||
|
||||
@@ -111,7 +111,7 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
if (view == nullptr) {
|
||||
throw Exception("Failed to create view");
|
||||
}
|
||||
return FFIView(view, _viewer!,_engine!);
|
||||
return FFIView(view, _viewer!, _engine!);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1678,9 +1678,6 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
throw Exception("Failed to create geometry");
|
||||
}
|
||||
|
||||
print(
|
||||
" is shadow caster : ${RenderableManager_isShadowCaster(_renderableManager!, SceneAsset_getEntity(assetPtr))} is shadow recevier : ${RenderableManager_isShadowReceiver(_renderableManager!, SceneAsset_getEntity(assetPtr))} ");
|
||||
|
||||
var asset = FFIAsset(
|
||||
assetPtr, _sceneManager!, _engine!, _unlitMaterialProvider!, this);
|
||||
|
||||
@@ -2185,10 +2182,36 @@ class ThermionViewerFFI extends ThermionViewer {
|
||||
gizmoEntities.toSet()
|
||||
..add(SceneAsset_getEntity(gizmo.cast<TSceneAsset>())));
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setCastShadows(ThermionEntity entity, bool castShadows) async {
|
||||
RenderableManager_setCastShadows(_renderableManager!, entity, castShadows);
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<bool> isCastShadowsEnabled(ThermionEntity entity) async {
|
||||
return RenderableManager_isShadowCaster(_renderableManager!, entity);
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setReceiveShadows(ThermionEntity entity, bool receiveShadows) async {
|
||||
RenderableManager_setReceiveShadows(_renderableManager!, entity, receiveShadows);
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<bool> isReceiveShadowsEnabled(ThermionEntity entity) async {
|
||||
return RenderableManager_isShadowReceiver(_renderableManager!, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class FFISwapChain extends SwapChain {
|
||||
final Pointer<TSwapChain> swapChain;
|
||||
final Pointer<TViewer> viewer;
|
||||
|
||||
@@ -918,4 +918,24 @@ abstract class ThermionViewer {
|
||||
/// Throws an exception if the index is out-of-bounds.
|
||||
///
|
||||
Camera getCameraAt(int index);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setCastShadows(ThermionEntity entity, bool castShadows);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<bool> isCastShadowsEnabled(ThermionEntity entity);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future setReceiveShadows(ThermionEntity entity, bool receiveShadows);
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<bool> isReceiveShadowsEnabled(ThermionEntity entity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user