mirror of
https://github.com/storytold/spark.git
synced 2026-10-14 23:52:59 +00:00
Use JSDoc for documenting SparkRenderer and SparkViewpoint options (#123)
This commit is contained in:
+73
-33
@@ -29,53 +29,93 @@ import { withWorker } from "./splatWorker";
|
||||
import { FreeList, withinCoorientDist } from "./utils";
|
||||
|
||||
export type SparkViewpointOptions = {
|
||||
// Controls whether to auto-update its sort order whenever the SparkRenderer
|
||||
// updates the Gsplats. If you expect to render/display from this viewpoint
|
||||
// most frames, set this to true. (default: false)
|
||||
/**
|
||||
* Controls whether to auto-update its sort order whenever the SparkRenderer
|
||||
* updates the Gsplats. If you expect to render/display from this viewpoint
|
||||
* most frames, set this to true.
|
||||
* @default false
|
||||
*/
|
||||
autoUpdate?: boolean;
|
||||
// Set a THREE.Camera for this viewpoint to follow. (default: undefined)
|
||||
/**
|
||||
* Set a THREE.Camera for this viewpoint to follow.
|
||||
* @default undefined
|
||||
*/
|
||||
camera?: THREE.Camera;
|
||||
// Set an explicit view-to-world transformation matrix for this viewpoint (equivalent
|
||||
// to camera.matrixWorld), overrides any camera setting. (default: undefined)
|
||||
/**
|
||||
* Set an explicit view-to-world transformation matrix for this viewpoint (equivalent
|
||||
* to camera.matrixWorld), overrides any camera setting.
|
||||
* @default undefined
|
||||
*/
|
||||
viewToWorld?: THREE.Matrix4;
|
||||
// Configure viewpoint with an off-screen render target. (default: undefined)
|
||||
/**
|
||||
* Configure viewpoint with an off-screen render target.
|
||||
* @default undefined
|
||||
*/
|
||||
target?: {
|
||||
// Width of the render target in pixels.
|
||||
/**
|
||||
* Width of the render target in pixels.
|
||||
*/
|
||||
width: number;
|
||||
// Height of the render target in pixels.
|
||||
/**
|
||||
* Height of the render target in pixels.
|
||||
*/
|
||||
height: number;
|
||||
// If you want to be able to render a scene that depends on this target's
|
||||
// output (for example, a recursive viewport), set this to true to enable
|
||||
// double buffering. (default: false)
|
||||
/**
|
||||
* If you want to be able to render a scene that depends on this target's
|
||||
* output (for example, a recursive viewport), set this to true to enable
|
||||
* double buffering.
|
||||
* @default false
|
||||
*/
|
||||
doubleBuffer?: boolean;
|
||||
// Super-sampling factor for the render target. Values 1-4 are supported.
|
||||
// Note that re-sampling back down to .width x .height is done on the CPU
|
||||
// with simple averaging only when calling readTarget(). (default: 1)
|
||||
/**
|
||||
* Super-sampling factor for the render target. Values 1-4 are supported.
|
||||
* Note that re-sampling back down to .width x .height is done on the CPU
|
||||
* with simple averaging only when calling readTarget().
|
||||
* @default 1
|
||||
*/
|
||||
superXY?: number;
|
||||
};
|
||||
// Callback function that is called when the render target texture is updated.
|
||||
// Receives the texture as a parameter. Use this to update a viewport with
|
||||
// the latest viewpoint render each frame. (default: undefined)
|
||||
/**
|
||||
* Callback function that is called when the render target texture is updated.
|
||||
* Receives the texture as a parameter. Use this to update a viewport with
|
||||
* the latest viewpoint render each frame.
|
||||
* @default undefined
|
||||
*/
|
||||
onTextureUpdated?: (texture: THREE.Texture) => void;
|
||||
// Whether to sort splats radially (geometric distance) from the viewpoint (true)
|
||||
// or by Z-depth (false). Most scenes are trained with the Z-depth sort metric
|
||||
// and will render more accurately at certain viewpoints. However, radial sorting
|
||||
// is more stable under viewpoint rotations. (default: true)
|
||||
/**
|
||||
* Whether to sort splats radially (geometric distance) from the viewpoint (true)
|
||||
* or by Z-depth (false). Most scenes are trained with the Z-depth sort metric
|
||||
* and will render more accurately at certain viewpoints. However, radial sorting
|
||||
* is more stable under viewpoint rotations.
|
||||
* @default true
|
||||
*/
|
||||
sortRadial?: boolean;
|
||||
// Distance threshold for re-sorting splats. If the viewpoint moves more than
|
||||
// this distance, splats will be re-sorted. (default: 0.01 units)
|
||||
/**
|
||||
* Distance threshold for re-sorting splats. If the viewpoint moves more than
|
||||
* this distance, splats will be re-sorted.
|
||||
* @default 0.01 units
|
||||
*/
|
||||
sortDistance?: number;
|
||||
// View direction dot product threshold for re-sorting splats. For
|
||||
// sortRadial: true we use 0.99 while sortRadial: false uses 0.999 because it is
|
||||
// more sensitive to view direction. (default: 0.99 if sortRadial else 0.999)
|
||||
/**
|
||||
* View direction dot product threshold for re-sorting splats. For
|
||||
* sortRadial: true we use 0.99 while sortRadial: false uses 0.999 because it is
|
||||
* more sensitive to view direction.
|
||||
* @default 0.99 if sortRadial else 0.999
|
||||
*/
|
||||
sortCoorient?: boolean;
|
||||
// Constant added to Z-depth to bias values into the positive range for
|
||||
// sortRadial: false, but also used for culling Gsplats "well behind"
|
||||
// the viewpoint origin (default: 1.0)
|
||||
/**
|
||||
* Constant added to Z-depth to bias values into the positive range for
|
||||
* sortRadial: false, but also used for culling Gsplats "well behind"
|
||||
* the viewpoint origin
|
||||
* @default 1.0
|
||||
*/
|
||||
depthBias?: number;
|
||||
// Set this to true if rendering a 360 to disable "behind the viewpoint"
|
||||
// culling during sorting. This is set automatically when rendering 360 envMaps
|
||||
// using the SparkRenderer.renderEnvMap() utility function. (default: false)
|
||||
/**
|
||||
* Set this to true if rendering a 360 to disable "behind the viewpoint"
|
||||
* culling during sorting. This is set automatically when rendering 360 envMaps
|
||||
* using the SparkRenderer.renderEnvMap() utility function.
|
||||
* @default false
|
||||
*/
|
||||
sort360?: boolean;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user