aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/styles.js
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-05 14:42:08 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-05 14:42:08 +0900
commit1bf7ee115176bc366315a90ab31740e6cd968744 (patch)
tree752b2db6126700c920f7e8b98bc167c95035341a /public/bluebey-studio/src/styles.js
parent88010ce24f3a863518071c4bd5dd5d351d1bad26 (diff)
bluebey-studio: ハートの白目内クリップ・まつげ追従・まばたき修正、帽子の線画と位置、手描き目UI削除
指定場所を見るときもハートが白目内に収まるようクリップ。まつげを上まぶたに連動。閉じ目はまばたきせず、ハート選択後のまばたきで3の目/わらうが一瞬出る不具合を修正。帽子をランナンスタイル登録して線画対応、横・奥行き追加。手描きの目UIを削除。
Diffstat (limited to 'public/bluebey-studio/src/styles.js')
-rw-r--r--public/bluebey-studio/src/styles.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/public/bluebey-studio/src/styles.js b/public/bluebey-studio/src/styles.js
index d7bd7b9..1b6a08d 100644
--- a/public/bluebey-studio/src/styles.js
+++ b/public/bluebey-studio/src/styles.js
@@ -183,6 +183,52 @@ export class Styles {
return hulls;
}
+ /**
+ * Register a mesh that is built at runtime (a hat), so it follows the render
+ * styles and gets an outline hull like the GLB parts. `removeMesh` undoes it.
+ */
+ addMesh(mesh) {
+ if (!mesh || this.originals.has(mesh)) return;
+ this.originals.set(mesh, mesh.material);
+ this.meshes.push(mesh);
+ const kind = this.kindOf(mesh);
+ if (!OUTLINE_SKIP.has(kind)) {
+ const overlay = OUTLINE_SILHOUETTE_ONLY.has(kind);
+ const hull = new THREE.Mesh(mesh.geometry, this.hullMaterialFor(this.scaleFor(kind), overlay));
+ hull.name = `${mesh.name || 'mesh'}:outline`;
+ hull.position.copy(mesh.position);
+ hull.quaternion.copy(mesh.quaternion);
+ hull.scale.copy(mesh.scale);
+ hull.frustumCulled = false;
+ hull.castShadow = false;
+ hull.receiveShadow = false;
+ if (overlay) hull.renderOrder = -1;
+ hull.userData.kind = kind;
+ hull.userData.source = mesh;
+ hull.userData.lineOnly = OUTLINE_LINE_ONLY.has(kind);
+ hull.userData.shadedOnly = OUTLINE_SHADED_ONLY.has(kind);
+ mesh.parent?.add(hull);
+ this.outlineMeshes.push(hull);
+ mesh.userData.hull = hull;
+ }
+ this.setStyle(this.style);
+ }
+
+ /** Take a runtime mesh (and its outline hull) back out. */
+ removeMesh(mesh) {
+ if (!mesh || !this.originals.has(mesh)) return;
+ const hull = mesh.userData.hull;
+ if (hull) {
+ hull.removeFromParent();
+ const i = this.outlineMeshes.indexOf(hull);
+ if (i >= 0) this.outlineMeshes.splice(i, 1);
+ delete mesh.userData.hull;
+ }
+ this.originals.delete(mesh);
+ const j = this.meshes.indexOf(mesh);
+ if (j >= 0) this.meshes.splice(j, 1);
+ }
+
/** The outline factor for a part in the current style (line art wants more). */
scaleFor(kind) {
const line = LINE_STYLES.has(this.style);