From 7743ada8d4055f0e4bc10dc696a39d90fb788f4e Mon Sep 17 00:00:00 2001 From: tillvit Date: Wed, 10 Jan 2024 17:48:32 -0500 Subject: [PATCH] Update noteskin arrow tex using update --- .../dance/default/DanceDefaultNoteTexture.ts | 33 +++++++++---------- .../dance/default/DanceDefaultNoteskin.ts | 3 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/app/src/chart/gameTypes/dance/default/DanceDefaultNoteTexture.ts b/app/src/chart/gameTypes/dance/default/DanceDefaultNoteTexture.ts index cd2d269b..9d612782 100644 --- a/app/src/chart/gameTypes/dance/default/DanceDefaultNoteTexture.ts +++ b/app/src/chart/gameTypes/dance/default/DanceDefaultNoteTexture.ts @@ -10,7 +10,6 @@ import { Sprite, Texture, } from "pixi.js" -import { App } from "../../../../App" import { Options } from "../../../../util/Options" import { NotedataEntry } from "../../../sm/NoteTypes" @@ -60,7 +59,7 @@ export class DanceDefaultNoteTexture { private static loaded = false - static async initArrowTex(app: App) { + static async initArrowTex() { if (this.loaded) return // Initialize rendertextures in here so we can read options @@ -162,21 +161,6 @@ export class DanceDefaultNoteTexture { DanceDefaultNoteTexture.mineConainer.addChild(mine_frame) } - app.ticker.add(() => { - app.renderer.render(DanceDefaultNoteTexture.arrowFrame, { - renderTexture: DanceDefaultNoteTexture.arrowFrameTex, - }) - app.renderer.render(DanceDefaultNoteTexture.arrowContainer, { - renderTexture: DanceDefaultNoteTexture.arrowTex, - }) - app.renderer.render(DanceDefaultNoteTexture.mineConainer, { - renderTexture: DanceDefaultNoteTexture.mineTex, - }) - app.renderer.render(DanceDefaultNoteTexture.liftContainer, { - renderTexture: DanceDefaultNoteTexture.liftTex, - }) - }) - this.loaded = true } @@ -221,7 +205,7 @@ export class DanceDefaultNoteTexture { .addIndex(vIndex) } - static setArrowTexTime(beat: number, second: number) { + static setArrowTexTime(app: App, beat: number, second: number) { if (!this.loaded) return for (let i = 0; i < 10; i++) { const tapShader: Mesh = @@ -235,6 +219,19 @@ export class DanceDefaultNoteTexture { DanceDefaultNoteTexture.mineConainer.children[0] )).shader.uniforms.time = second DanceDefaultNoteTexture.mineConainer.rotation = (second % 1) * Math.PI * 2 + + app.renderer.render(DanceDefaultNoteTexture.arrowFrame, { + renderTexture: DanceDefaultNoteTexture.arrowFrameTex, + }) + app.renderer.render(DanceDefaultNoteTexture.arrowContainer, { + renderTexture: DanceDefaultNoteTexture.arrowTex, + }) + app.renderer.render(DanceDefaultNoteTexture.mineConainer, { + renderTexture: DanceDefaultNoteTexture.mineTex, + }) + app.renderer.render(DanceDefaultNoteTexture.liftContainer, { + renderTexture: DanceDefaultNoteTexture.liftTex, + }) } static setNoteTex(arrow: Sprite, note: NotedataEntry) { diff --git a/app/src/chart/gameTypes/dance/default/DanceDefaultNoteskin.ts b/app/src/chart/gameTypes/dance/default/DanceDefaultNoteskin.ts index 071b10ce..0c4db6db 100644 --- a/app/src/chart/gameTypes/dance/default/DanceDefaultNoteskin.ts +++ b/app/src/chart/gameTypes/dance/default/DanceDefaultNoteskin.ts @@ -11,7 +11,7 @@ class DanceDefaultNoteskinObject extends NoteSkin { constructor(renderer: ChartRenderer) { super(renderer) - DanceDefaultNoteTexture.initArrowTex(renderer.chartManager.app) + DanceDefaultNoteTexture.initArrowTex() } createReceptor(_: number) { @@ -31,6 +31,7 @@ class DanceDefaultNoteskinObject extends NoteSkin { update(): void { DanceDefaultNoteTexture.setArrowTexTime( + this.renderer.chartManager.app, this.renderer.getVisualBeat(), this.renderer.getVisualTime() )