Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/common/MemMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class MemMonitor extends Component {
color: 0x000000ff,
});

const payload = this.renderer.stage.txMemManager.getMemoryInfo();
const payload = renderer.stage.txMemManager.getMemoryInfo();
const { criticalThreshold, targetThreshold } = payload;
const targetFraction = targetThreshold / criticalThreshold;
this.targetTick.y = BAR_HEIGHT - BAR_HEIGHT * targetFraction;
Expand Down
2 changes: 1 addition & 1 deletion src/core/CoreNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ export class CoreNode extends EventEmitter {

// if the default texture isn't loaded yet, wait for it to load
// this only happens when the node is created before the stage is ready
const dt = this.stage.defaultTexture;
const dt = stage.defaultTexture;
if (dt !== null && dt.state !== 'loaded') {
dt.once('loaded', () => this.setUpdateType(UpdateType.IsRenderable));
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/renderers/canvas/CanvasRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class CanvasRenderer extends CoreRenderer {
const canvas = platform.canvas!;
this.canvas = canvas as HTMLCanvasElement;
this.context = canvas.getContext('2d') as CanvasRenderingContext2D;
this.pixelRatio = this.stage.pixelRatio;
this.clearColor = normalizeCanvasColor(this.stage.clearColor);
this.pixelRatio = stage.pixelRatio;
this.clearColor = normalizeCanvasColor(stage.clearColor);
}

reset(): void {
Expand Down
6 changes: 3 additions & 3 deletions src/core/renderers/canvas/CanvasShaderNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ export class CanvasShaderNode<
}

if (prevKey.length > 0) {
this.stage.shManager.mutateShaderValueUsage(prevKey, -1);
stage.shManager.mutateShaderValueUsage(prevKey, -1);
}

const computed = this.stage.shManager.getShaderValues(
const computed = stage.shManager.getShaderValues(
this.valueKey,
) as Record<string, unknown>;
if (computed !== undefined) {
this.computed = computed as Computed;
}
this.computed = {};
this.updater!(this.node as CoreNode);
this.stage.shManager.setShaderValues(this.valueKey, this.computed);
stage.shManager.setShaderValues(this.valueKey, this.computed);
};
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/renderers/webgl/WebGlRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,24 @@ export class WebGlRenderer extends CoreRenderer {
constructor(stage: Stage) {
super(stage);

this.quadBuffer = new ArrayBuffer(this.stage.options.quadBufferSize);
this.quadBuffer = new ArrayBuffer(stage.options.quadBufferSize);
this.fQuadBuffer = new Float32Array(this.quadBuffer);
this.uiQuadBuffer = new Uint32Array(this.quadBuffer);

this.mode = 'webgl';

const platform = this.stage.platform;
const platform = stage.platform;
const canvas = platform.canvas!;

const glw = (this.glw = platform.createContext() as GlContextWrapper);
glw.viewport(0, 0, canvas.width, canvas.height);

this.updateClearColor(this.stage.clearColor);
this.updateClearColor(stage.clearColor);

glw.setBlend(true);
glw.blendFunc(glw.ONE, glw.ONE_MINUS_SRC_ALPHA);

createIndexBuffer(glw, this.stage.bufferMemory);
createIndexBuffer(glw, stage.bufferMemory);

this.system = {
parameters: getWebGlParameters(this.glw),
Expand Down
6 changes: 3 additions & 3 deletions src/core/renderers/webgl/WebGlShaderNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export class WebGlShaderNode<
}

if (prevKey.length > 0) {
this.stage.shManager.mutateShaderValueUsage(prevKey, -1);
stage.shManager.mutateShaderValueUsage(prevKey, -1);
}

const values = this.stage.shManager.getShaderValues(
const values = stage.shManager.getShaderValues(
this.valueKey,
) as unknown as UniformCollection;
if (values !== undefined) {
Expand All @@ -112,7 +112,7 @@ export class WebGlShaderNode<
vec4: {},
};
this.updater!(this.node as CoreNode);
this.stage.shManager.setShaderValues(
stage.shManager.setShaderValues(
this.valueKey,
this.uniforms as unknown as Record<string, unknown>,
);
Expand Down
6 changes: 3 additions & 3 deletions src/core/textures/SubTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export class SubTexture extends Texture {
super(txManager);
this.props = props;

assertTruthy(this.props.texture, 'SubTexture requires a parent texture');
assertTruthy(props.texture, 'SubTexture requires a parent texture');
assertTruthy(
this.props.texture instanceof ImageTexture,
props.texture instanceof ImageTexture,
'SubTexture requires an ImageTexture parent',
);

// Resolve parent texture from cache or fallback to provided texture
this.parentTexture = txManager.resolveParentTexture(this.props.texture);
this.parentTexture = txManager.resolveParentTexture(props.texture);

if (this.renderableOwners.length > 0) {
this.parentTexture.setRenderableOwner(this.subtextureId, true);
Expand Down
2 changes: 1 addition & 1 deletion src/core/textures/Texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export abstract class Texture extends EventEmitter {

constructor(protected txManager: CoreTextureManager) {
super();
this.maxRetryCount = this.txManager.maxRetryCount;
this.maxRetryCount = txManager.maxRetryCount;
}

get dimensions(): Dimensions | null {
Expand Down
Loading