feat: add removeStencilHighlight, queuePositionUpdateFromViewportCoords to ThermionViewer

This commit is contained in:
Nick Fisher
2024-09-07 17:54:42 +08:00
parent 286910e722
commit 9b91da3798
2 changed files with 52 additions and 11 deletions
@@ -203,10 +203,11 @@ abstract class ThermionViewer {
/// If you want to be able to call [createInstance] at a later time, you must pass true for [keepData].
/// If [keepData] is false, the source glTF data will be released and [createInstance] will throw an exception.
///
Future<ThermionEntity> loadGlb(String path, {int numInstances = 1, bool keepData = false});
Future<ThermionEntity> loadGlb(String path,
{int numInstances = 1, bool keepData = false});
///
/// Create a new instance of [entity].
/// Create a new instance of [entity].
///
Future<ThermionEntity> createInstance(ThermionEntity entity);
@@ -224,7 +225,7 @@ abstract class ThermionViewer {
/// Load the .gltf asset at the given path and insert into the scene.
/// [relativeResourcePath] is the folder path where the glTF resources are stored;
/// this is usually the parent directory of the .gltf file itself.
///
///
/// See [loadGlb] for an explanation of [keepData].
///
Future<ThermionEntity> loadGltf(String path, String relativeResourcePath,
@@ -609,12 +610,20 @@ abstract class ThermionViewer {
ThermionEntity entity, double x, double y, double z,
{bool relative = false});
///
/// TODO
///
Future queuePositionUpdateFromViewportCoords(
ThermionEntity entity, double x, double y);
///
/// TODO
///
Future queueRelativePositionUpdateWorldAxis(ThermionEntity entity,
double viewportX, double viewportY, double x, double y, double z);
///
/// Queues an update to the worldspace rotation for [entity].
/// The actual update will occur on the next frame, and will be subject to collision detection.
@@ -818,7 +827,13 @@ abstract class ThermionViewer {
Future setGizmoVisibility(bool visible);
///
/// Outlines [entity].
///
Future setStencilHighlight(ThermionEntity entity);
/// Renders an outline around [entity] with the given color.
///
Future setStencilHighlight(ThermionEntity entity,
{double r = 1.0, double g = 0.0, double b = 0.0});
///
/// Removes the outline around [entity]. Noop if there was no highlight.
///
Future removeStencilHighlight(ThermionEntity entity);
}