aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/face.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bluebey-studio/src/face.js')
-rw-r--r--public/bluebey-studio/src/face.js35
1 files changed, 22 insertions, 13 deletions
diff --git a/public/bluebey-studio/src/face.js b/public/bluebey-studio/src/face.js
index ac48527..3d21022 100644
--- a/public/bluebey-studio/src/face.js
+++ b/public/bluebey-studio/src/face.js
@@ -278,19 +278,28 @@ export class Face {
}
if (this.hairMesh) {
- // `overEyes` decides the draw order: the hair plate sits in front of the
- // eyes (bangs over the face) or behind them.
- this.hairMesh.renderOrder = p.eyes.headMark?.overEyes === false ? 0 : 3;
- const layout = this.hairLayout;
- const ctx = this.hairCtx;
- ctx.setTransform(1, 0, 0, 1, 0, 0);
- ctx.clearRect(0, 0, layout.width * HAIR_SCALE, layout.height * HAIR_SCALE);
- ctx.scale(HAIR_SCALE, HAIR_SCALE);
- // `drawHeadCoverWrap` works in canvas coordinates (its x axis is the UV
- // angle already normalised), so it is not shifted by the window offset.
- drawHeadCoverWrap(ctx, p.eyes.headMark ?? {}, layout);
- ctx.setTransform(1, 0, 0, 1, 0, 0);
- this.hairTexture.needsUpdate = true;
+ const hairShape = p.eyes.headMark?.shape ?? 'off';
+ // Shapes that draw nothing (the retired front-plate ones, or なし). A fully
+ // transparent texture still tinted the head on iOS, so the plate is hidden
+ // outright when there is no hair rather than left showing an empty texture.
+ const hairShown = !(hairShape === 'off' || hairShape === 'none'
+ || hairShape === 'split' || hairShape === 'wave' || hairShape === 'side');
+ this.hairMesh.visible = hairShown;
+ if (hairShown) {
+ // `overEyes` decides the draw order: the hair plate sits in front of the
+ // eyes (bangs over the face) or behind them.
+ this.hairMesh.renderOrder = p.eyes.headMark?.overEyes === false ? 0 : 3;
+ const layout = this.hairLayout;
+ const ctx = this.hairCtx;
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.clearRect(0, 0, layout.width * HAIR_SCALE, layout.height * HAIR_SCALE);
+ ctx.scale(HAIR_SCALE, HAIR_SCALE);
+ // `drawHeadCoverWrap` works in canvas coordinates (its x axis is the UV
+ // angle already normalised), so it is not shifted by the window offset.
+ drawHeadCoverWrap(ctx, p.eyes.headMark ?? {}, layout);
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ this.hairTexture.needsUpdate = true;
+ }
}
this.dirty = false;