Skip to content

Commit

Permalink
Clean up skybox (#2661)
Browse files Browse the repository at this point in the history
* core-common

* DisplayStyle3dSettings has an Environment member.

* ...

* Comment out stuff to get core-frontend compiling.

* Remove texture image provider.

* EnvironmentDecorations.

* Load skybox; image url is just a string.

* Image from URL; cache sky cube textures.

* Hook up decorations; move EnvironmentDecorations to separate file.

* adjust frontend-devtools.

* adjust backend

* wheee...

* WIP EnvironmentEditor is bad.

* fix.

* adjust tests.

* docs.

* fix core-common tests.

* detachFromViewport must call super.

* adjust core-full-stack-tests.

* extract-api

* lint

* NextVersion.md

* fix md table layout

* fix md table layout

* remove empty test file

* extract-api...

* fix doc links.

* merge cleanup.

* Revert "remove empty test file"

This reverts commit b6e19cb.

* WIP tests.

* tests

* tests.

* Finish tests.

* lint, api

* keyins for setting sky sphere/cube.

* extract-api

* document constraints on sky cube images.

* clean up types used to create graphics from skybox.

(cherry picked from commit 0245103)
  • Loading branch information
pmconne committed Nov 8, 2021
1 parent 40c7990 commit 9b6d64f
Show file tree
Hide file tree
Showing 51 changed files with 1,738 additions and 892 deletions.
162 changes: 136 additions & 26 deletions common/api/core-common.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2068,9 +2068,8 @@ export class DisplayStyle3dSettings extends DisplayStyleSettings {
// @internal
applyOverrides(overrides: DisplayStyle3dSettingsProps): void;
clearSunTime(): void;
// @internal (undocumented)
get environment(): EnvironmentProps;
set environment(environment: EnvironmentProps);
get environment(): Environment;
set environment(environment: Environment);
getPlanProjectionSettings(modelId: Id64String): PlanProjectionSettings | undefined;
get hiddenLineSettings(): HiddenLine.Settings;
set hiddenLineSettings(hline: HiddenLine.Settings);
Expand All @@ -2087,6 +2086,8 @@ export class DisplayStyle3dSettings extends DisplayStyleSettings {
get sunTime(): number | undefined;
get thematic(): ThematicDisplay;
set thematic(thematic: ThematicDisplay);
toggleGroundPlane(display?: boolean): void;
toggleSkyBox(display?: boolean): void;
// @internal (undocumented)
toJSON(): DisplayStyle3dSettingsProps;
// @internal (undocumented)
Expand Down Expand Up @@ -2193,7 +2194,7 @@ export class DisplayStyleSettings {
readonly onBackgroundColorChanged: BeEvent<(newColor: ColorDef) => void>;
readonly onBackgroundMapChanged: BeEvent<(newMap: BackgroundMapSettings) => void>;
readonly onClipStyleChanged: BeEvent<(newStyle: ClipStyle) => void>;
readonly onEnvironmentChanged: BeEvent<(newProps: Readonly<EnvironmentProps>) => void>;
readonly onEnvironmentChanged: BeEvent<(newEnv: Readonly<Environment>) => void>;
readonly onExcludedElementsChanged: BeEvent<() => void>;
readonly onHiddenLineSettingsChanged: BeEvent<(newSettings: HiddenLine.Settings) => void>;
readonly onLightsChanged: BeEvent<(newLights: LightSettings) => void>;
Expand Down Expand Up @@ -2816,11 +2817,30 @@ export interface EntityQueryParams {
where?: string;
}

// @public
export class Environment {
protected constructor(props?: Partial<EnvironmentProperties>);
clone(changedProps?: Partial<EnvironmentProperties>): Environment;
static create(props?: Partial<EnvironmentProperties>): Environment;
static readonly defaults: Environment;
readonly displayGround: boolean;
readonly displaySky: boolean;
static fromJSON(props?: EnvironmentProps): Environment;
readonly ground: GroundPlane;
readonly sky: SkyBox;
toJSON(): EnvironmentProps;
withDisplay(display: {
sky?: boolean;
ground?: boolean;
}): Environment;
}

// @public
export type EnvironmentProperties = NonFunctionPropertiesOf<Environment>;

// @public
export interface EnvironmentProps {
// (undocumented)
ground?: GroundPlaneProps;
// (undocumented)
sky?: SkyBoxProps;
}

Expand Down Expand Up @@ -4016,17 +4036,20 @@ export enum GridOrientationType {

// @public
export class GroundPlane {
constructor(ground?: GroundPlaneProps);
aboveColor: ColorDef;
belowColor: ColorDef;
display: boolean;
elevation: number;
// @internal
getGroundPlaneGradient(aboveGround: boolean): Gradient.Symb;
// (undocumented)
toJSON(): GroundPlaneProps;
protected constructor(props: Partial<GroundPlaneProperties>);
readonly aboveColor: ColorDef;
readonly belowColor: ColorDef;
clone(changedProps?: Partial<GroundPlaneProperties>): GroundPlane;
static create(props?: Partial<GroundPlaneProperties>): GroundPlane;
static readonly defaults: GroundPlane;
readonly elevation: number;
static fromJSON(props?: GroundPlaneProps): GroundPlane;
toJSON(display?: boolean): GroundPlaneProps;
}

// @public
export type GroundPlaneProperties = NonFunctionPropertiesOf<GroundPlane>;

// @public
export interface GroundPlaneProps {
aboveColor?: ColorDefProps;
Expand Down Expand Up @@ -7983,18 +8006,29 @@ export class SilhouetteEdgeArgs extends EdgeArgs {
}

// @public
export interface SkyBoxImageProps {
texture?: Id64String;
textures?: SkyCubeProps;
type?: SkyBoxImageType;
export class SkyBox {
protected constructor(gradient: SkyGradient);
static createGradient(gradient?: SkyGradient): SkyBox;
static readonly defaults: SkyBox;
static fromJSON(props?: SkyBoxProps): SkyBox;
readonly gradient: SkyGradient;
// @internal (undocumented)
get textureIds(): Iterable<Id64String>;
toJSON(display?: boolean): SkyBoxProps;
}

// @public
export type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | {
type?: SkyBoxImageType;
texture?: never;
textures?: never;
};

// @public
export enum SkyBoxImageType {
Cube = 3,
// @internal
Cylindrical = 2,
// (undocumented)
None = 0,
Spherical = 1
}
Expand All @@ -8012,14 +8046,87 @@ export interface SkyBoxProps {
zenithColor?: ColorDefProps;
}

// @public
export class SkyCube extends SkyBox {
constructor(images: SkyCubeProps, gradient?: SkyGradient);
readonly images: SkyCubeProps;
// @internal (undocumented)
get textureIds(): Iterable<Id64String>;
// @internal
toJSON(display?: boolean): SkyBoxProps;
}

// @public
export interface SkyCubeImageProps {
// @internal (undocumented)
texture?: never;
// (undocumented)
textures: SkyCubeProps;
// (undocumented)
type: SkyBoxImageType.Cube;
}

// @public
export interface SkyCubeProps {
back?: Id64String;
bottom?: Id64String;
front?: Id64String;
left?: Id64String;
right?: Id64String;
top?: Id64String;
// (undocumented)
back: TextureImageSpec;
// (undocumented)
bottom: TextureImageSpec;
// (undocumented)
front: TextureImageSpec;
// (undocumented)
left: TextureImageSpec;
// (undocumented)
right: TextureImageSpec;
// (undocumented)
top: TextureImageSpec;
}

// @public
export class SkyGradient {
clone(changedProps: SkyGradientProperties): SkyGradient;
static create(props?: Partial<SkyGradientProperties>): SkyGradient;
static readonly defaults: SkyGradient;
equals(other: SkyGradient): boolean;
static fromJSON(props?: SkyBoxProps): SkyGradient;
// (undocumented)
readonly groundColor: ColorDef;
// (undocumented)
readonly groundExponent: number;
// (undocumented)
readonly nadirColor: ColorDef;
// (undocumented)
readonly skyColor: ColorDef;
// (undocumented)
readonly skyExponent: number;
toJSON(): SkyBoxProps;
// (undocumented)
readonly twoColor: boolean;
// (undocumented)
readonly zenithColor: ColorDef;
}

// @public
export type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;

// @public
export class SkySphere extends SkyBox {
constructor(image: TextureImageSpec, gradient?: SkyGradient);
readonly image: TextureImageSpec;
// @internal (undocumented)
get textureIds(): Iterable<Id64String>;
// @internal
toJSON(display?: boolean): SkyBoxProps;
}

// @public
export interface SkySphereImageProps {
// (undocumented)
texture: TextureImageSpec;
// @internal (undocumented)
textures?: never;
// (undocumented)
type: SkyBoxImageType.Spherical;
}

// @internal
Expand Down Expand Up @@ -8459,6 +8566,9 @@ export interface TextureData {
width: number;
}

// @public
export type TextureImageSpec = Id64String | string;

// @public
export interface TextureLoadProps {
maxTextureSize?: number;
Expand Down
Loading

0 comments on commit 9b6d64f

Please sign in to comment.