@deck.gl-community/layers
Version:
Add-on layers for deck.gl
58 lines • 2.68 kB
TypeScript
import { type TextureCubeLoaderOptions, type TextureCubeManifest } from '@loaders.gl/textures';
import { Layer } from '@deck.gl/core';
import type { DefaultProps, LayerProps, UpdateParameters } from '@deck.gl/core';
import { DynamicTexture, Model, ShaderInputs } from '@luma.gl/engine';
type _SkyboxLayerProps = {
/** Cubemap manifest URL or manifest object to load and render. */
cubemap: string | TextureCubeManifest | null;
/** Optional loaders.gl texture-cube load options. */
loadOptions?: TextureCubeLoaderOptions | null;
/**
* Declares how the cubemap faces are oriented relative to deck.gl's Z-up
* world. Use `y-up` for cubemaps authored for Y-up scenes where the source
* `+Y` face should align with deck.gl's vertical `+Z` axis.
*/
orientation?: 'default' | 'y-up';
};
export type SkyboxLayerProps = _SkyboxLayerProps & LayerProps;
type SkyboxLayerState = {
/** Active GPU cubemap texture, if one has been loaded successfully. */
cubemapTexture: DynamicTexture | null;
/** Monotonic load token used to discard stale async cubemap loads. */
loadCount: number;
/** Backing model that renders the cube geometry. */
model?: Model;
/** Shader input manager for the skybox uniforms. */
shaderInputs?: ShaderInputs<any>;
};
/**
* Renders a camera-centered cubemap background for `MapView`, `GlobeView`,
* `FirstPersonView`, and other 3D-capable deck.gl views.
*/
export declare class SkyboxLayer<ExtraProps extends Record<string, unknown> = Record<string, unknown>> extends Layer<Required<_SkyboxLayerProps> & ExtraProps> {
static defaultProps: DefaultProps<SkyboxLayerProps>;
static layerName: string;
state: SkyboxLayerState;
/** Initializes the cube model and starts loading the cubemap texture. */
initializeState(): void;
/** Reloads the cubemap when its source manifest or load options change. */
updateState({ props, oldProps }: UpdateParameters<this>): void;
/** Releases GPU resources owned by the layer. */
finalizeState(): void;
/** Draws the skybox cube for the current viewport. */
draw(): void;
/** Creates the luma.gl model used to render the skybox cube. */
protected _getModel(shaderInputs: ShaderInputs<any>): Model;
/** Returns the WGSL/GLSL shader pair used by the layer. */
getShaders(): {
source: string;
vs: string;
fs: string;
};
/** Starts an asynchronous cubemap load for the current props. */
private _loadCubemap;
/** Swaps the active GPU cubemap texture and updates model bindings. */
private _setCubemapTexture;
}
export {};
//# sourceMappingURL=skybox-layer.d.ts.map