Skip to content

Commit

Permalink
Fix test apps (#7684)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmconne authored Feb 11, 2025
1 parent c7fbf1e commit a112d26
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 16 deletions.
72 changes: 72 additions & 0 deletions common/api/core-frontend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,21 @@ export interface CustomQuantityTypeDefinition extends QuantityTypeDefinition {
secondaryPropEditorSpecs?: CustomFormatPropEditorSpec[];
}

// @internal
export class DebugShaderFile {
constructor(filename: string, src: string, isVS: boolean, isGL: boolean, isUsed: boolean);
// (undocumented)
readonly filename: string;
// (undocumented)
isGL: boolean;
// (undocumented)
isUsed: boolean;
// (undocumented)
isVS: boolean;
// (undocumented)
readonly src: string;
}

// @public
export class DecorateContext extends RenderContext {
// @internal
Expand Down Expand Up @@ -5030,6 +5045,63 @@ export class IModelRoutingContext {
readonly token: RpcRoutingToken;
}

// @internal
export class IModelTileTree extends TileTree {
// (undocumented)
[Symbol.dispose](): void;
constructor(params: IModelTileTreeParams, treeId: IModelTileTreeId);
// (undocumented)
get batchType(): BatchType;
// (undocumented)
get containsTransformNodes(): boolean;
// (undocumented)
readonly contentIdProvider: ContentIdProvider;
// (undocumented)
readonly contentIdQualifier?: string;
debugMaxDepth?: number;
// (undocumented)
readonly decoder: ImdlDecoder;
// (undocumented)
draw(args: TileDrawArgs): void;
// (undocumented)
get edgeOptions(): EdgeOptions | false;
// (undocumented)
readonly geometryGuid?: string;
// (undocumented)
getTransformNodeRange(nodeId: number): Range3d | undefined;
get hiddenElements(): Id64Array;
// (undocumented)
readonly iModelTileTreeId: IModelTileTreeId;
// (undocumented)
get is3d(): boolean;
// (undocumented)
get isContentUnbounded(): boolean;
// (undocumented)
get loadPriority(): TileLoadPriority;
// (undocumented)
get maxDepth(): number;
// (undocumented)
readonly maxInitialTilesToSkip: number;
// (undocumented)
readonly maxTilesToSkip: number;
// (undocumented)
prune(): void;
// (undocumented)
get rootTile(): Tile;
// (undocumented)
protected _selectTiles(args: TileDrawArgs): Tile[];
get staticBranch(): IModelTile;
// (undocumented)
readonly stringifiedSectionClip?: string;
// (undocumented)
readonly tileScreenSize: number;
get tileState(): "static" | "dynamic" | "interactive" | "disposed";
// (undocumented)
get timeline(): RenderSchedule.ModelTimeline | undefined;
// (undocumented)
get viewFlagOverrides(): {};
}

// @public
export abstract class InputCollector extends InteractiveTool {
// (undocumented)
Expand Down
2 changes: 2 additions & 0 deletions common/api/summary/core-frontend.exports.csv
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public;enum;CurrentState
public;interface;CustomFormatPropEditorSpec
public;interface;CustomGraphicBuilderOptions
public;interface;CustomQuantityTypeDefinition
internal;class;DebugShaderFile
public;class;DecorateContext
public;interface;DecorateContextCreateArgs
public;class;Decorations
Expand Down Expand Up @@ -302,6 +303,7 @@ public;namespace;IModelConnection
internal;class;IModelFrameLifecycle
public;interface;IModelIdArg
public;class;IModelRoutingContext
internal;class;IModelTileTree
public;class;InputCollector
public;enum;InputSource
beta;interface;Instance
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
5 changes: 5 additions & 0 deletions core/frontend/src/internal/cross-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ export {
type WGS84Extent,
WmsUtilities,
} from "../tile/internal";

// Used by display-test-app which currently builds using both ESModules and CommonJS.
// Remove once CommonJS is dropped.
export { DebugShaderFile } from "./render/RenderSystemDebugControl";
export { IModelTileTree } from "./tile/IModelTileTree";
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface GLTimerResult {

export type GLTimerResultCallback = (result: GLTimerResult) => void;

/** @internal exported strictly for display-test-app until we remove CommonJS support. */
export class DebugShaderFile {
public constructor(
public readonly filename: string,
Expand Down
1 change: 1 addition & 0 deletions core/frontend/src/internal/tile/IModelTileTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class RootTile extends Tile {
}

/** A TileTree whose contents are derived from geometry stored in a Model in an IModelDb.
* @internal exported strictly for display-test-app until we remove CommonJS support.
*/
export class IModelTileTree extends TileTree {
public readonly decoder: ImdlDecoder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import {
} from "@itwin/core-common";
import {
CheckpointConnection,
DisplayStyle3dState, DisplayStyleState, EntityState, FeatureSymbology, GLTimerResult, GLTimerResultCallback, IModelApp, IModelConnection,
DisplayStyle3dState, DisplayStyleState, EntityState, FeatureSymbology, GLTimerResult, IModelApp, IModelConnection,
ModelDisplayTransform,
ModelDisplayTransformProvider,
PerformanceMetrics, Pixel, RenderMemory, RenderSystem, ScreenViewport, Target, TileAdmin, ToolAdmin, ViewRect, ViewState,
} from "@itwin/core-frontend";
import { System } from "@itwin/core-frontend/lib/cjs/webgl";
import { HyperModeling } from "@itwin/hypermodeling-frontend";
import { TestFrontendAuthorizationClient } from "@itwin/oidc-signin-tool/lib/cjs/TestFrontendAuthorizationClient";
import DisplayPerfRpcInterface from "../common/DisplayPerfRpcInterface";
Expand Down Expand Up @@ -93,7 +92,7 @@ class Timings {
public readonly gpu = new Map<string, number[]>();
public readonly actualFps = new Array<Map<string, number>>();
public gpuFramesCollected = 0;
public readonly callback: GLTimerResultCallback;
public readonly callback: (result: GLTimerResult) => void;

public constructor(numFramesToCollect: number) {
this.callback = (result: GLTimerResult) => {
Expand Down Expand Up @@ -460,7 +459,7 @@ export class TestRunner {
if (++frameCount === numFrames)
target.performanceMetrics = undefined;

if (timings.gpuFramesCollected >= numFrames || (frameCount >= numFrames && !(IModelApp.renderSystem as System).isGLTimerSupported)) {
if (timings.gpuFramesCollected >= numFrames || (frameCount >= numFrames && !IModelApp.renderSystem.debugControl?.isGLTimerSupported)) {
removeListener();
IModelApp.viewManager.dropViewport(vp, false);
vp.continuousRendering = false;
Expand Down
6 changes: 3 additions & 3 deletions test-apps/display-test-app/src/frontend/DisplayScale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*--------------------------------------------------------------------------------------------*/

import { Matrix3d, Point3d, Transform } from "@itwin/core-geometry";
import { IModelApp, ModelDisplayTransformProvider, Tool } from "@itwin/core-frontend";
import { IModelApp, ModelDisplayTransform, ModelDisplayTransformProvider, Tool } from "@itwin/core-frontend";
import { parseArgs } from "@itwin/frontend-devtools";

class DisplayScaleTransformProvider implements ModelDisplayTransformProvider {
public constructor(private readonly _models: Set<string>, private readonly _scaleTransform: Transform) { }

public getModelDisplayTransform(modelId: string): Transform | undefined {
return this._models.has(modelId) ? this._scaleTransform.clone() : undefined;
public getModelDisplayTransform(modelId: string): ModelDisplayTransform | undefined {
return this._models.has(modelId) ? { transform: this._scaleTransform.clone() } : undefined;
}

public get transform(): Transform { return this._scaleTransform.clone(); }
Expand Down
4 changes: 2 additions & 2 deletions test-apps/display-test-app/src/frontend/DisplayTestApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const dtaFrontendMain = async () => {
[renderSystemOptions, tileAdminProps] = setConfigurationResults();
await DisplayTestApp.startup(configuration, renderSystemOptions, tileAdminProps);
if (false !== configuration.enableDiagnostics)
IModelApp.renderSystem.enableDiagnostics();
IModelApp.renderSystem.debugControl?.enableDiagnostics(undefined);

if (!configuration.standalone && !configuration.customOrchestratorUri) {
alert("Standalone iModel required. Set IMJS_STANDALONE_FILENAME in environment");
Expand All @@ -207,7 +207,7 @@ const dtaFrontendMain = async () => {
[renderSystemOptions, tileAdminProps] = setConfigurationResults();
await DisplayTestApp.startup(configuration, renderSystemOptions, tileAdminProps);
if (false !== configuration.enableDiagnostics)
IModelApp.renderSystem.enableDiagnostics();
IModelApp.renderSystem.debugControl?.enableDiagnostics(undefined);

if (!configuration.standalone && !configuration.customOrchestratorUri) {
alert("Standalone iModel required. Set IMJS_STANDALONE_FILENAME in environment");
Expand Down
6 changes: 3 additions & 3 deletions test-apps/display-test-app/src/frontend/TileContentTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { assert, ByteStream, Guid } from "@itwin/core-bentley";
import { PersistentGraphicsRequestProps } from "@itwin/core-common";
import {
ImdlReader, IModelApp, IModelConnection, Tool,
ImdlReader, IModelApp, IModelConnection, IModelTileTree, Tool,
} from "@itwin/core-frontend";
import { parseArgs } from "@itwin/frontend-devtools";

Expand Down Expand Up @@ -55,8 +55,8 @@ export class GenerateTileContentTool extends Tool {
return false;

for (const owner of iModel.tiles) {
const tree = owner.owner.tileTree;
if (tree && "modelId" in tree && tree.modelId === modelId)
const tree = owner.owner.tileTree instanceof IModelTileTree ? owner.owner.tileTree : undefined;
if (tree?.modelId === modelId)
return this.run({ tree, contentId });
}

Expand Down
5 changes: 1 addition & 4 deletions test-apps/display-test-app/src/frontend/TiledGraphics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ class Provider implements TiledGraphicsProvider {
// Any symbology overrides applied to the viewport are ignored.
this.ovrs = new FeatureSymbology.Overrides(view);

this._refs = [];
view.forEachModelTreeRef((ref) => {
this._refs.push(new Reference(ref, this));
});
this._refs = Array.from(view.getModelTreeRefs()).map((ref) => new Reference(ref, this));
}

public forEachTileTreeRef(_vp: Viewport, func: (ref: TileTreeReference) => void): void {
Expand Down

0 comments on commit a112d26

Please sign in to comment.