From cad36a7e40768a852e5598e0cf5e87d2981681d3 Mon Sep 17 00:00:00 2001 From: _Bastler <_Bastler@bstly.de> Date: Mon, 17 May 2021 15:24:56 +0200 Subject: [PATCH] updates --- front/dist/index.tmpl.html | 2 +- front/dist/resources/style/style.css | 1 + .../Phaser/Menu/HelpCameraSettingsScene.ts | 8 +-- front/src/Phaser/Shaders/OutlinePipeline.ts | 50 ++++++++++++++----- .../src/Phaser/UserInput/UserInputManager.ts | 2 +- 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/front/dist/index.tmpl.html b/front/dist/index.tmpl.html index c9ee7eef..0135915b 100644 --- a/front/dist/index.tmpl.html +++ b/front/dist/index.tmpl.html @@ -145,4 +145,4 @@ - \ No newline at end of file + diff --git a/front/dist/resources/style/style.css b/front/dist/resources/style/style.css index 7bd70f40..3d477afb 100644 --- a/front/dist/resources/style/style.css +++ b/front/dist/resources/style/style.css @@ -46,6 +46,7 @@ body .message-info.warning { position: relative; transition: all 0.2s ease; cursor: url('/resources/logos/cursor_pointer.png'), pointer; + height: 100%; } .video-container i { diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts index 172aa6cb..6e80b8d4 100644 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts @@ -24,7 +24,7 @@ export class HelpCameraSettingsScene extends DirtyScene { this.createHelpCameraSettings(); } - private createHelpCameraSettings(): void { + private createHelpCameraSettings() : void { const middleX = this.getMiddleX(); this.helpCameraSettingsElement = this.add.dom(middleX, -800, undefined, {overflow: 'scroll'}).createFromCache(helpCameraSettings); this.revealMenusAfterInit(this.helpCameraSettingsElement, helpCameraSettings); @@ -36,7 +36,7 @@ export class HelpCameraSettingsScene extends DirtyScene { event.preventDefault(); if((event?.target as HTMLInputElement).id === 'helpCameraSettingsFormRefresh') { window.location.reload(); - } else if((event?.target as HTMLInputElement).id === 'helpCameraSettingsFormContinue') { + }else if((event?.target as HTMLInputElement).id === 'helpCameraSettingsFormContinue') { this.closeHelpCameraSettingsOpened(); } }); @@ -51,7 +51,7 @@ export class HelpCameraSettingsScene extends DirtyScene { }); } - private openHelpCameraSettingsOpened(): void { + private openHelpCameraSettingsOpened(): void{ HtmlUtils.getElementByIdOrFail('webRtcSetup').style.display = 'none'; this.helpCameraSettingsOpened = true; try{ @@ -77,7 +77,7 @@ export class HelpCameraSettingsScene extends DirtyScene { this.dirty = true; } - private closeHelpCameraSettingsOpened(): void { + private closeHelpCameraSettingsOpened(): void{ const middleX = this.getMiddleX(); /*const helpCameraSettingsInfo = this.helpCameraSettingsElement.getChildByID('helpCameraSettings') as HTMLParagraphElement; helpCameraSettingsInfo.innerText = ''; diff --git a/front/src/Phaser/Shaders/OutlinePipeline.ts b/front/src/Phaser/Shaders/OutlinePipeline.ts index 175fb917..0d074bc3 100644 --- a/front/src/Phaser/Shaders/OutlinePipeline.ts +++ b/front/src/Phaser/Shaders/OutlinePipeline.ts @@ -16,20 +16,44 @@ export class OutlinePipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeli uniform sampler2D uMainSampler; uniform vec2 uTextureSize; - vec2 onePixel = vec2(1.0, 1.0) / uTextureSize; - float upAlpha = texture2D(uMainSampler, outTexCoord + vec2(0.0, onePixel.y)).a; - float leftAlpha = texture2D(uMainSampler, outTexCoord + vec2(-onePixel.x, 0.0)).a; - float downAlpha = texture2D(uMainSampler, outTexCoord + vec2(0.0, -onePixel.y)).a; - float rightAlpha = texture2D(uMainSampler, outTexCoord + vec2(onePixel.x, 0.0)).a; + varying vec2 outTexCoord; + varying float outTintEffect; + varying vec4 outTint; - if (texture.a == 0.0 && max(max(upAlpha, downAlpha), max(leftAlpha, rightAlpha)) == 1.0) + void main(void) { - color = vec4(1.0, 1.0, 0.0, 1.0); - } + vec4 texture = texture2D(uMainSampler, outTexCoord); + vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a); + vec4 color = texture; - gl_FragColor = color; - } - ` - }); - } + if (outTintEffect == 0.0) + { + color = texture * texel; + } + else if (outTintEffect == 1.0) + { + color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a); + color.a = texture.a * texel.a; + } + else if (outTintEffect == 2.0) + { + color = texel; + } + + vec2 onePixel = vec2(1.0, 1.0) / uTextureSize; + float upAlpha = texture2D(uMainSampler, outTexCoord + vec2(0.0, onePixel.y)).a; + float leftAlpha = texture2D(uMainSampler, outTexCoord + vec2(-onePixel.x, 0.0)).a; + float downAlpha = texture2D(uMainSampler, outTexCoord + vec2(0.0, -onePixel.y)).a; + float rightAlpha = texture2D(uMainSampler, outTexCoord + vec2(onePixel.x, 0.0)).a; + + if (texture.a == 0.0 && max(max(upAlpha, downAlpha), max(leftAlpha, rightAlpha)) == 1.0) + { + color = vec4(1.0, 1.0, 0.0, 1.0); + } + + gl_FragColor = color; + } + ` + }); + } } diff --git a/front/src/Phaser/UserInput/UserInputManager.ts b/front/src/Phaser/UserInput/UserInputManager.ts index 2e8bb22b..70bb9b1b 100644 --- a/front/src/Phaser/UserInput/UserInputManager.ts +++ b/front/src/Phaser/UserInput/UserInputManager.ts @@ -173,7 +173,7 @@ export class UserInputManager { } destroy(): void { - this.joystick && this.joystick.destroy(); + this.joystick?.destroy(); } private initMouseWheel() {