Skip to content

Commit 858a23d

Browse files
authored
refactor: remove texture info and overlay (#649)
Summary: This PR removes the texture info accessor and the overlay that used it. The overlay was used for debugging purposes so it's safe to remove it. The texture info is bad because it exposes renderer information via public API. It's also added to the WebGL renderer instead of the Renderer base class.
1 parent 0fe8d06 commit 858a23d

6 files changed

Lines changed: 4 additions & 145 deletions

File tree

examples/chunk_streaming/chunk_info_overlay.ts

Lines changed: 0 additions & 99 deletions
This file was deleted.

examples/chunk_streaming/index.html

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@
2121
height: 100%;
2222
}
2323

24-
#chunk-info {
25-
position: absolute;
26-
bottom: 0.5em;
27-
right: 0.3em;
28-
width: 40%;
29-
margin: 1em;
30-
padding: 1em;
31-
color: white;
32-
background-color: rgba(0, 0, 0, 0.5);
33-
user-select: none;
34-
}
35-
3624
#left-overlays {
3725
position: absolute;
3826
bottom: 0.5em;
@@ -76,7 +64,6 @@
7664

7765
<body>
7866
<canvas id="canvas"></canvas>
79-
<div id="chunk-info">Chunks: Loading...</div>
8067
<div id="left-overlays">
8168
<div id="time-point"></div>
8269
<div id="scale-bar-box">

examples/chunk_streaming/main.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
OrthographicCamera,
77
} from "@";
88
import { PanZoomControls } from "@/objects/cameras/controls";
9-
import { ChunkInfoOverlay } from "./chunk_info_overlay";
109
import { ScaleBar } from "./scale_bar";
1110
import { addDimensionSlider } from "../lil_gui_utils";
1211
import {
@@ -62,12 +61,6 @@ const imageLayer = new ImageLayer({
6261
});
6362
imageLayer.debugMode = true;
6463

65-
const overlaySelector = document.querySelector<HTMLDivElement>("#chunk-info")!;
66-
const chunkInfoOverlay = new ChunkInfoOverlay({
67-
textDiv: overlaySelector,
68-
imageLayer: imageLayer,
69-
});
70-
7164
const timePointDiv = document.querySelector<HTMLDivElement>("#time-point")!;
7265
const timePointOverlay = {
7366
update(_idetik: Idetik, _timestamp?: DOMHighResTimeStamp) {
@@ -91,13 +84,12 @@ new Idetik({
9184
layers: [imageLayer],
9285
},
9386
],
94-
overlays: [chunkInfoOverlay, timePointOverlay, scaleBar],
87+
overlays: [timePointOverlay, scaleBar],
9588
showStats: true,
9689
}).start();
9790

9891
const controls = {
9992
showWireframes: imageLayer.debugMode,
100-
showChunkInfoOverlay: true,
10193
showTimePointOverlay: true,
10294
window: initialWindow,
10395
level: initialLevel,
@@ -147,13 +139,6 @@ overlaysFolder
147139
.name("Show tile wireframes")
148140
.onChange((show: boolean) => (imageLayer.debugMode = show));
149141

150-
overlaysFolder
151-
.add(controls, "showChunkInfoOverlay")
152-
.name("Show chunk information overlay")
153-
.onChange((show: boolean) => {
154-
overlaySelector.style.display = show ? "block" : "none";
155-
});
156-
157142
const contrastFolder = gui.addFolder("Window/Level");
158143
contrastFolder
159144
.add(controls, "window", 1, 100, 1)

src/idetik.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { WebGLRenderer } from "./renderers/webgl_renderer";
22
import { Logger } from "./utilities/logger";
33
import { ChunkManager } from "./core/chunk_manager";
4+
import { Renderer } from "./core/renderer";
45
import { createStats, type Stats } from "./utilities/stats";
56
import {
67
parseViewportConfigs,
@@ -28,8 +29,8 @@ export type IdetikContext = {
2829
export class Idetik {
2930
private readonly chunkManager_: ChunkManager;
3031
private readonly context_: IdetikContext;
31-
private readonly renderer_: WebGLRenderer;
32-
private viewports_: Viewport[];
32+
private readonly renderer_: Renderer;
33+
private readonly viewports_: Viewport[];
3334
public readonly canvas: HTMLCanvasElement;
3435
public readonly overlays: Overlay[];
3536
private readonly stats_?: Stats;
@@ -136,10 +137,6 @@ export class Idetik {
136137
return this.renderer_.height;
137138
}
138139

139-
public get textureInfo() {
140-
return this.renderer_.textureInfo;
141-
}
142-
143140
public get viewports(): readonly Viewport[] {
144141
return this.viewports_;
145142
}

src/renderers/webgl_renderer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ export class WebGLRenderer extends Renderer {
112112
this.renderedObjects_ = this.renderedObjectsPerFrame_;
113113
}
114114

115-
public get textureInfo() {
116-
return this.textures_.textureInfo;
117-
}
118-
119115
private initStencil() {
120116
// We use the stencil buffer to mark pixels objects have been drawn,
121117
// which is used to avoid overdrawing high resolution tiles with lower

src/renderers/webgl_textures.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ export class WebGLTextures {
8686
this.textureCount_ = 0;
8787
}
8888

89-
public get textureInfo() {
90-
return {
91-
textures: this.textureCount_,
92-
totalBytes: this.gpuTextureBytes_,
93-
};
94-
}
95-
9689
private alreadyActive(texture: Texture) {
9790
return this.currentTexture_ === texture && !texture.needsUpdate;
9891
}

0 commit comments

Comments
 (0)