@7ots/cli 0.1.19 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +14 -0
- package/brand/logos/base.svg +1 -0
- package/brand/logos/clawpump.png +0 -0
- package/brand/logos/conductors.svg +1 -0
- package/brand/logos/notlogin.svg +12 -0
- package/brand/logos/pumpfun.png +0 -0
- package/brand/logos/solana.png +0 -0
- package/brand/logos/spawnerbot.svg +1 -0
- package/brand/logos/virtuals.png +0 -0
- package/cli/7ots.mjs +59 -1
- package/cli/lib/account.mjs +23 -3
- package/cli/lib/assistant.mjs +88 -13
- package/cli/lib/brain.mjs +76 -8
- package/cli/lib/config.mjs +14 -3
- package/cli/lib/desktop-sync.mjs +177 -0
- package/cli/lib/i18n.mjs +9 -0
- package/cli/lib/inferences.mjs +19 -2
- package/cli/lib/integrations.mjs +61 -6
- package/cli/lib/pet-server.mjs +316 -41
- package/cli/lib/prompts.mjs +1 -1
- package/cli/lib/senses/gestures.mjs +121 -0
- package/cli/lib/senses/index.mjs +490 -0
- package/cli/lib/senses/rules.mjs +159 -0
- package/cli/lib/senses/sources/activity.mjs +95 -0
- package/cli/lib/senses/sources/calendar.mjs +75 -0
- package/cli/lib/senses/sources/index.mjs +17 -0
- package/cli/lib/senses/sources/mail.mjs +48 -0
- package/cli/lib/senses/sources/system.mjs +39 -0
- package/cli/lib/senses/util.mjs +41 -0
- package/cli/lib/senses/vendor.mjs +78 -0
- package/cli/lib/stt-local.py +16 -8
- package/cli/lib/stt.mjs +53 -6
- package/cli/lib/tooluse.mjs +56 -0
- package/cli/lib/vm.mjs +1 -1
- package/cli/lib/wake-local.py +109 -0
- package/cli/lib/wake.mjs +102 -0
- package/cli/pet/electron/main.cjs +145 -16
- package/cli/pet/pet.html +127 -27
- package/cli/pet/senses.html +342 -0
- package/cli/pet/settings.html +787 -86
- package/dist/7ots.esm.js +374 -146
- package/dist/7ots.esm.js.map +4 -4
- package/dist/7ots.iife.js +374 -146
- package/dist/7ots.iife.js.map +4 -4
- package/llms.txt +27 -0
- package/package.json +5 -2
- package/server/channels/apuchat.mjs +2 -0
- package/server/errors.mjs +90 -0
- package/server/notify.mjs +78 -0
- package/server/server.mjs +68 -12
- package/server/settings.mjs +3 -0
- package/server/site.mjs +401 -0
- package/server/tts.mjs +29 -5
- package/src/avatar/AvatarStage.js +2 -2
- package/src/avatar/three.js +3 -2
- package/src/character/AvatarEditor.js +2 -1
- package/src/character/Character.js +1 -1
- package/src/character/TradingCard.js +2 -0
- package/src/character/beat.js +64 -2
- package/src/character/mods/orc.js +8 -1
- package/src/character/mods.js +104 -10
- package/src/character/motion.js +162 -0
- package/src/character/parts.js +40 -38
- package/src/character/styles.js +40 -38
- package/src/character3d/Character3D.js +26 -5
- package/src/character3d/body.js +14 -12
- package/src/character3d/export.js +693 -0
- package/src/character3d/fx.js +13 -0
- package/src/character3d/index.js +2 -0
- package/src/character3d/materials.js +106 -10
- package/src/character3d/room-themes.js +1184 -0
- package/src/character3d/room.js +487 -0
- package/src/character3d/stage.js +9 -3
- package/src/creator/StepCreator.js +316 -0
- package/src/i18n/index.js +3 -3
- package/src/i18n/messages/character.js +352 -4
- package/src/i18n/messages/creator.js +138 -0
- package/src/i18n/messages/identity.js +89 -1
- package/src/i18n/messages/platform.js +255 -1
- package/src/i18n/messages/server.js +443 -1
- package/src/i18n/messages/widget.js +233 -0
- package/src/identity/random.js +14 -2
- package/src/identity/schema.js +2 -1
- package/src/index.js +10 -2
- package/src/voice/tags.js +22 -0
- package/server/platform/apuchat.mjs +0 -266
- package/server/platform/auth.mjs +0 -337
- package/server/platform/byte.mjs +0 -291
- package/server/platform/connect.mjs +0 -391
- package/server/platform/crypto.mjs +0 -80
- package/server/platform/db.mjs +0 -293
- package/server/platform/device.mjs +0 -247
- package/server/platform/integrations.mjs +0 -169
- package/server/platform/look.mjs +0 -20
- package/server/platform/mods.mjs +0 -222
- package/server/platform/orquesta.mjs +0 -611
- package/server/platform/profile.mjs +0 -182
- package/server/platform/routes.mjs +0 -589
- package/server/platform/runtime.mjs +0 -286
- package/server/platform/sites.mjs +0 -146
- package/server/platform/stage3d.mjs +0 -82
- package/server/platform/store.mjs +0 -469
- package/server/platform/vm.mjs +0 -1057
- package/server/platform/wallet.mjs +0 -255
package/src/character/styles.js
CHANGED
|
@@ -27,55 +27,57 @@ import { addCatalog } from '../i18n/index.js';
|
|
|
27
27
|
const n = (v) => Math.round(v * 100) / 100;
|
|
28
28
|
|
|
29
29
|
export const STYLES = [
|
|
30
|
-
{ id: 'none', label: { es: 'Ninguno', en: 'None', pt: 'Nenhum' } },
|
|
31
|
-
{ id: 'ukiyoe', label: { es: 'Ukiyo-e', en: 'Ukiyo-e', pt: 'Ukiyo-e' } },
|
|
32
|
-
{ id: 'clay', label: { es: 'Plastilina', en: 'Claymation', pt: 'Massinha' } },
|
|
33
|
-
{ id: 'glass', label: { es: 'Vitral', en: 'Stained glass', pt: 'Vitral' } },
|
|
34
|
-
{ id: 'bauhaus', label: { es: 'Bauhaus', en: 'Bauhaus', pt: 'Bauhaus' } },
|
|
35
|
-
{ id: 'manuscript', label: { es: 'Manuscrito', en: 'Manuscript', pt: 'Iluminura' } },
|
|
36
|
-
{ id: 'glitch', label: { es: 'Glitch', en: 'Glitch', pt: 'Glitch' } },
|
|
37
|
-
{ id: 'ink', label: { es: 'Tinta', en: 'Ink sketch', pt: 'Nanquim' } },
|
|
38
|
-
{ id: 'pop', label: { es: 'Pop art', en: 'Pop art', pt: 'Pop art' } },
|
|
39
|
-
{ id: 'watercolor', label: { es: 'Acuarela', en: 'Watercolor', pt: 'Aquarela' } },
|
|
40
|
-
{ id: 'pixel', label: { es: 'Píxel 8 bits', en: '8-bit pixel', pt: 'Pixel 8 bits' } },
|
|
41
|
-
{ id: 'synthwave', label: { es: 'Synthwave', en: 'Synthwave', pt: 'Synthwave' } },
|
|
42
|
-
{ id: 'nouveau', label: { es: 'Art nouveau', en: 'Art nouveau', pt: 'Art nouveau' } },
|
|
43
|
-
{ id: 'cubism', label: { es: 'Cubismo', en: 'Cubism', pt: 'Cubismo' } },
|
|
44
|
-
{ id: 'crayon', label: { es: 'Crayones', en: 'Crayon', pt: 'Giz de cera' } },
|
|
45
|
-
{ id: 'blueprint', label: { es: 'Plano técnico', en: 'Blueprint', pt: 'Planta técnica' } },
|
|
46
|
-
{ id: 'pointillism', label: { es: 'Puntillismo', en: 'Pointillism', pt: 'Pontilhismo' } },
|
|
47
|
-
{ id: 'woodcut', label: { es: 'Xilografía', en: 'Woodcut', pt: 'Xilogravura' } },
|
|
48
|
-
{ id: 'riso', label: { es: 'Risografía', en: 'Riso print', pt: 'Risografia' } },
|
|
49
|
-
{ id: 'dotmatrix', label: { es: 'Matriz verde', en: 'Dot matrix', pt: 'Matriz verde' } },
|
|
50
|
-
{ id: 'chalk', label: { es: 'Tiza', en: 'Chalk', pt: 'Giz' } },
|
|
51
|
-
{ id: 'sticker', label: { es: 'Calcomanía', en: 'Sticker', pt: 'Adesivo' } },
|
|
52
|
-
{ id: 'felt', label: { es: 'Fieltro', en: 'Felt', pt: 'Feltro' } },
|
|
53
|
-
{ id: 'papercut', label: { es: 'Papel recortado', en: 'Papercut', pt: 'Papel recortado' } },
|
|
54
|
-
{ id: 'lowpoly', label: { es: 'Low poly', en: 'Low poly', pt: 'Low poly' } },
|
|
55
|
-
{ id: 'marble', label: { es: 'Mármol', en: 'Marble', pt: 'Mármore' } },
|
|
56
|
-
{ id: 'candy', label: { es: 'Gomita', en: 'Gummy', pt: 'Bala de goma' } },
|
|
57
|
-
{ id: 'holo', label: { es: 'Holográfico', en: 'Holographic', pt: 'Holográfico' } },
|
|
58
|
-
{ id: 'sumie', label: { es: 'Sumi-e', en: 'Sumi-e', pt: 'Sumi-e' } },
|
|
59
|
-
{ id: 'tarot', label: { es: 'Tarot', en: 'Tarot', pt: 'Tarô' } },
|
|
60
|
-
{ id: 'retro70', label: { es: 'Años 70', en: 'Seventies', pt: 'Anos 70' } },
|
|
61
|
-
{ id: 'mosaic', label: { es: 'Mosaico', en: 'Mosaic', pt: 'Mosaico' } },
|
|
62
|
-
{ id: 'neonsign', label: { es: 'Letrero de neón', en: 'Neon sign', pt: 'Letreiro neon' } },
|
|
63
|
-
{ id: 'graffiti', label: { es: 'Grafiti', en: 'Graffiti', pt: 'Grafite' } },
|
|
64
|
-
{ id: 'thermal', label: { es: 'Cámara térmica', en: 'Thermal', pt: 'Câmera térmica' } },
|
|
30
|
+
{ id: 'none', label: { es: 'Ninguno', en: 'None', pt: 'Nenhum', zh: '无', hi: 'कोई नहीं' } },
|
|
31
|
+
{ id: 'ukiyoe', label: { es: 'Ukiyo-e', en: 'Ukiyo-e', pt: 'Ukiyo-e', zh: '浮世绘', hi: 'उकियो-ए' } },
|
|
32
|
+
{ id: 'clay', label: { es: 'Plastilina', en: 'Claymation', pt: 'Massinha', zh: '黏土动画', hi: 'क्ले एनिमेशन' } },
|
|
33
|
+
{ id: 'glass', label: { es: 'Vitral', en: 'Stained glass', pt: 'Vitral', zh: '彩色玻璃', hi: 'रंगीन काँच' } },
|
|
34
|
+
{ id: 'bauhaus', label: { es: 'Bauhaus', en: 'Bauhaus', pt: 'Bauhaus', zh: '包豪斯', hi: 'बाउहाउस' } },
|
|
35
|
+
{ id: 'manuscript', label: { es: 'Manuscrito', en: 'Manuscript', pt: 'Iluminura', zh: '泥金手抄本', hi: 'पांडुलिपि' } },
|
|
36
|
+
{ id: 'glitch', label: { es: 'Glitch', en: 'Glitch', pt: 'Glitch', zh: '故障风', hi: 'ग्लिच' } },
|
|
37
|
+
{ id: 'ink', label: { es: 'Tinta', en: 'Ink sketch', pt: 'Nanquim', zh: '墨水速写', hi: 'स्याही स्केच' } },
|
|
38
|
+
{ id: 'pop', label: { es: 'Pop art', en: 'Pop art', pt: 'Pop art', zh: '波普艺术', hi: 'पॉप आर्ट' } },
|
|
39
|
+
{ id: 'watercolor', label: { es: 'Acuarela', en: 'Watercolor', pt: 'Aquarela', zh: '水彩', hi: 'जलरंग' } },
|
|
40
|
+
{ id: 'pixel', label: { es: 'Píxel 8 bits', en: '8-bit pixel', pt: 'Pixel 8 bits', zh: '8 位像素', hi: '8-बिट पिक्सेल' } },
|
|
41
|
+
{ id: 'synthwave', label: { es: 'Synthwave', en: 'Synthwave', pt: 'Synthwave', zh: '合成波', hi: 'सिंथवेव' } },
|
|
42
|
+
{ id: 'nouveau', label: { es: 'Art nouveau', en: 'Art nouveau', pt: 'Art nouveau', zh: '新艺术', hi: 'आर्ट नूवो' } },
|
|
43
|
+
{ id: 'cubism', label: { es: 'Cubismo', en: 'Cubism', pt: 'Cubismo', zh: '立体主义', hi: 'घनवाद' } },
|
|
44
|
+
{ id: 'crayon', label: { es: 'Crayones', en: 'Crayon', pt: 'Giz de cera', zh: '蜡笔', hi: 'क्रेयॉन' } },
|
|
45
|
+
{ id: 'blueprint', label: { es: 'Plano técnico', en: 'Blueprint', pt: 'Planta técnica', zh: '蓝图', hi: 'ब्लूप्रिंट' } },
|
|
46
|
+
{ id: 'pointillism', label: { es: 'Puntillismo', en: 'Pointillism', pt: 'Pontilhismo', zh: '点彩画', hi: 'बिंदुवाद' } },
|
|
47
|
+
{ id: 'woodcut', label: { es: 'Xilografía', en: 'Woodcut', pt: 'Xilogravura', zh: '木刻', hi: 'काष्ठ छापा' } },
|
|
48
|
+
{ id: 'riso', label: { es: 'Risografía', en: 'Riso print', pt: 'Risografia', zh: '孔版印刷', hi: 'रिसो प्रिंट' } },
|
|
49
|
+
{ id: 'dotmatrix', label: { es: 'Matriz verde', en: 'Dot matrix', pt: 'Matriz verde', zh: '点阵', hi: 'डॉट मैट्रिक्स' } },
|
|
50
|
+
{ id: 'chalk', label: { es: 'Tiza', en: 'Chalk', pt: 'Giz', zh: '粉笔', hi: 'चॉक' } },
|
|
51
|
+
{ id: 'sticker', label: { es: 'Calcomanía', en: 'Sticker', pt: 'Adesivo', zh: '贴纸', hi: 'स्टिकर' } },
|
|
52
|
+
{ id: 'felt', label: { es: 'Fieltro', en: 'Felt', pt: 'Feltro', zh: '毛毡', hi: 'फ़ेल्ट' } },
|
|
53
|
+
{ id: 'papercut', label: { es: 'Papel recortado', en: 'Papercut', pt: 'Papel recortado', zh: '剪纸', hi: 'पेपरकट' } },
|
|
54
|
+
{ id: 'lowpoly', label: { es: 'Low poly', en: 'Low poly', pt: 'Low poly', zh: '低多边形', hi: 'लो पॉली' } },
|
|
55
|
+
{ id: 'marble', label: { es: 'Mármol', en: 'Marble', pt: 'Mármore', zh: '大理石', hi: 'संगमरमर' } },
|
|
56
|
+
{ id: 'candy', label: { es: 'Gomita', en: 'Gummy', pt: 'Bala de goma', zh: '软糖', hi: 'गमी' } },
|
|
57
|
+
{ id: 'holo', label: { es: 'Holográfico', en: 'Holographic', pt: 'Holográfico', zh: '镭射', hi: 'होलोग्राफ़िक' } },
|
|
58
|
+
{ id: 'sumie', label: { es: 'Sumi-e', en: 'Sumi-e', pt: 'Sumi-e', zh: '水墨画', hi: 'सुमी-ए' } },
|
|
59
|
+
{ id: 'tarot', label: { es: 'Tarot', en: 'Tarot', pt: 'Tarô', zh: '塔罗', hi: 'टैरो' } },
|
|
60
|
+
{ id: 'retro70', label: { es: 'Años 70', en: 'Seventies', pt: 'Anos 70', zh: '七十年代', hi: 'सत्तर का दशक' } },
|
|
61
|
+
{ id: 'mosaic', label: { es: 'Mosaico', en: 'Mosaic', pt: 'Mosaico', zh: '马赛克', hi: 'मोज़ेक' } },
|
|
62
|
+
{ id: 'neonsign', label: { es: 'Letrero de neón', en: 'Neon sign', pt: 'Letreiro neon', zh: '霓虹招牌', hi: 'नियॉन साइन' } },
|
|
63
|
+
{ id: 'graffiti', label: { es: 'Grafiti', en: 'Graffiti', pt: 'Grafite', zh: '涂鸦', hi: 'ग्राफ़िटी' } },
|
|
64
|
+
{ id: 'thermal', label: { es: 'Cámara térmica', en: 'Thermal', pt: 'Câmera térmica', zh: '热成像', hi: 'थर्मल' } },
|
|
65
65
|
];
|
|
66
66
|
export const STYLE_IDS = STYLES.map((s) => s.id);
|
|
67
67
|
|
|
68
68
|
const lang = (l) => ({
|
|
69
|
-
character: { styles: Object.fromEntries(STYLES.map((s) => [s.id, s.label[l]])) },
|
|
69
|
+
character: { styles: Object.fromEntries(STYLES.map((s) => [s.id, s.label[l] || s.label.en])) },
|
|
70
70
|
editor: {
|
|
71
71
|
artStyle: {
|
|
72
72
|
es: { title: 'Estilo artístico', hint: 'Redibuja el mismo personaje en otro estilo, con un fondo a juego.' },
|
|
73
73
|
en: { title: 'Art style', hint: 'Redraws the same character in another art style, with a matching backdrop.' },
|
|
74
74
|
pt: { title: 'Estilo artístico', hint: 'Redesenha o mesmo personagem em outro estilo, com um fundo combinando.' },
|
|
75
|
+
zh: { title: '艺术风格', hint: '用另一种艺术风格重新绘制同一个角色,并配上相称的背景。' },
|
|
76
|
+
hi: { title: 'कला शैली', hint: 'उसी किरदार को दूसरी कला शैली में फिर से बनाता है, मेल खाती पृष्ठभूमि के साथ।' },
|
|
75
77
|
}[l],
|
|
76
78
|
},
|
|
77
79
|
});
|
|
78
|
-
addCatalog(
|
|
80
|
+
addCatalog(Object.fromEntries(['es', 'en', 'pt', 'zh', 'hi'].map((l) => [l, lang(l)])));
|
|
79
81
|
|
|
80
82
|
// ───────────────────────────── color ─────────────────────────────
|
|
81
83
|
|
|
@@ -467,7 +469,7 @@ export function stylizeSpec(spec) {
|
|
|
467
469
|
a.color2 = m(a.color2, 'acc');
|
|
468
470
|
}
|
|
469
471
|
s.finish = look.finish;
|
|
470
|
-
s.texture = look.texture;
|
|
472
|
+
s.texture = spec.texture && spec.texture !== 'auto' ? spec.texture : look.texture; // a texture the owner picked wins over the style's
|
|
471
473
|
s._style = { id, seed: styleSeed(spec), ink: typeof look.ink === 'function' ? look.ink(s) : look.ink, lw: look.lw };
|
|
472
474
|
return s;
|
|
473
475
|
}
|
|
@@ -24,6 +24,16 @@ const STYLE_FINISH = {
|
|
|
24
24
|
riso: 'toon', dotmatrix: 'toon', chalk: 'sketch', sticker: 'glossy', felt: 'clay', papercut: 'soft3d', lowpoly: 'toon', marble: 'soft3d', candy: 'glossy',
|
|
25
25
|
holo: 'glossy', sumie: 'sketch', tarot: 'toon', retro70: 'toon', mosaic: 'toon', neonsign: 'neon', graffiti: 'toon', thermal: 'soft3d',
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Materiales del ot en 3D (look.material, LOOK_MATERIALS de identity/schema.js): plush = peluche, vinyl = el acabado
|
|
29
|
+
* y la textura de su spec; los demás fijan el acabado y la textura del cuerpo (los estilos artísticos mandan igual).
|
|
30
|
+
*/
|
|
31
|
+
export const MATERIAL3D = {
|
|
32
|
+
clay: { finish: 'clay', texture: 'none' }, metal: { finish: 'metal', texture: 'none' }, glass: { finish: 'glass', texture: 'none' },
|
|
33
|
+
pearl: { finish: 'pearl', texture: 'none' }, holo: { finish: 'holo', texture: 'none' }, wood: { finish: 'clay', texture: 'wood' },
|
|
34
|
+
stone: { finish: 'clay', texture: 'stone' }, knit: { finish: 'velvet', texture: 'knit' }, glitter: { finish: 'glossy', texture: 'glitter' },
|
|
35
|
+
quilt: { finish: 'velvet', texture: 'quilt' }, honeycomb: { finish: 'glossy', texture: 'honeycomb' }, bubbles: { finish: 'glass', texture: 'bubbles' },
|
|
36
|
+
};
|
|
27
37
|
/** Piezas del catálogo 2 sin modelo 3D propio → la existente más parecida (campo `as3d` en parts.js). */
|
|
28
38
|
function alias3D(s) {
|
|
29
39
|
s.eyes = { ...s.eyes, type: as3d('eyes', s.eyes.type) };
|
|
@@ -43,10 +53,12 @@ function styled3D(spec) {
|
|
|
43
53
|
return s;
|
|
44
54
|
}
|
|
45
55
|
import { shade, luminance, as3d } from '../character/parts.js';
|
|
56
|
+
|
|
57
|
+
const FINISH3D = new Set(['metal', 'glass', 'pearl', 'holo', 'velvet', 'pastel']);
|
|
46
58
|
import { textureOf } from '../character/skin.js';
|
|
47
59
|
import { GESTURES, GESTURE_ALIAS, VISEMES, EASE, clamp, lerp, approach, textToVisemes, babbleVisemes, HAND_POSES, MORPHS, EFFECTS, shapePoints, seeded } from '../character/motion.js';
|
|
48
60
|
import { U, bodyGeometry, surfaceProbe } from './body.js';
|
|
49
|
-
import { bodyMaterials, surfaceMaterial, mat, shadowTexture, CHEEK_IDS } from './materials.js';
|
|
61
|
+
import { bodyMaterials, surfaceMaterial, mat, shadowTexture, CHEEK_IDS, TEX_IDS } from './materials.js';
|
|
50
62
|
import { FX3D, glyph, disposeFx } from './fx.js';
|
|
51
63
|
import { buildModel, tickModel, modelGesture } from './model.js';
|
|
52
64
|
|
|
@@ -194,8 +206,12 @@ export class Character3D {
|
|
|
194
206
|
const kk = (this.kk = Math.sqrt(W * H) / 1.25); // escala de accesorios (1 ≈ ot medio)
|
|
195
207
|
const Y = (this.Y = (y) => (B.bottom - y) * U);
|
|
196
208
|
const X = (this.X = (x) => (x - L.cx) * U);
|
|
197
|
-
const
|
|
198
|
-
|
|
209
|
+
const mat3 = !st && MATERIAL3D[this.opts.material];
|
|
210
|
+
if (mat3) s.finish = mat3.finish;
|
|
211
|
+
const tex = (this.tex = mat3 ? mat3.texture : as3d('textures', textureOf(s)));
|
|
212
|
+
// a finish or texture picked in the creator (Acabado/Textura) that the shader draws wins over the default plush fur
|
|
213
|
+
const picked = !mat3 && (FINISH3D.has(s.finish) || (s.texture && s.texture !== 'auto' && tex in TEX_IDS));
|
|
214
|
+
const plush = (this.plush = !st && !mat3 && (['fur', 'fuzz', 'feathers'].includes(tex) || ((this.opts.material || 'plush') === 'plush' && !picked)));
|
|
199
215
|
const furLen = (this.furLen = plush ? (tex === 'fuzz' || tex === 'none' ? 0.05 : 0.065) * kk : 0);
|
|
200
216
|
const density = (this.density = furLen ? (this.quality === 'high' ? 1 / (furLen * 0.2) : 1 / (furLen * 0.32)) : 0);
|
|
201
217
|
this.maxShells = this.quality === 'high' ? 28 : 10;
|
|
@@ -207,6 +223,7 @@ export class Character3D {
|
|
|
207
223
|
lip: s.mouth.color || shade(body, dark ? 0.6 : -0.55),
|
|
208
224
|
});
|
|
209
225
|
this.furs = [];
|
|
226
|
+
this.pending = []; // glb de los mods que aún cargan (export.js los espera)
|
|
210
227
|
this.parts = [];
|
|
211
228
|
this.anims = [];
|
|
212
229
|
this.bodyMeshes = [];
|
|
@@ -1210,7 +1227,7 @@ export class Character3D {
|
|
|
1210
1227
|
holder.scale.setScalar(sc);
|
|
1211
1228
|
g.add(holder);
|
|
1212
1229
|
const tint = p.tint === 'body' ? this.spec.body.color : p.tint === 'color' ? a.color : '';
|
|
1213
|
-
loadGlb(p.glb).then((scene) => {
|
|
1230
|
+
const job = loadGlb(p.glb).then((scene) => {
|
|
1214
1231
|
const o = scene.clone(true);
|
|
1215
1232
|
o.traverse((m) => {
|
|
1216
1233
|
if (!m.isMesh) return;
|
|
@@ -1223,6 +1240,7 @@ export class Character3D {
|
|
|
1223
1240
|
});
|
|
1224
1241
|
holder.add(o);
|
|
1225
1242
|
}).catch(() => g.add(plane()));
|
|
1243
|
+
this.pending.push(job);
|
|
1226
1244
|
return g;
|
|
1227
1245
|
}
|
|
1228
1246
|
|
|
@@ -1242,10 +1260,12 @@ export class Character3D {
|
|
|
1242
1260
|
cv.getContext('2d').drawImage(img, 0, 0, cv.width, cv.height);
|
|
1243
1261
|
tex.needsUpdate = true;
|
|
1244
1262
|
};
|
|
1245
|
-
|
|
1263
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${vx} ${vy} ${vw} ${vh}" width="${cv.width}" height="${cv.height}">${inner}</svg>`;
|
|
1264
|
+
img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
1246
1265
|
const m = new THREE.Mesh(new THREE.PlaneGeometry(vw * sc, vh * sc), new THREE.MeshBasicMaterial({ map: tex, transparent: true, depthWrite: false, side: THREE.DoubleSide }));
|
|
1247
1266
|
m.position.set((vx + vw / 2) * sc, -(vy + vh / 2) * sc, p.layer === 'back' ? -0.01 : 0.01);
|
|
1248
1267
|
m.userData.ownMaterial = true;
|
|
1268
|
+
m.userData.modPlane = { svg, w: cv.width, h: cv.height }; // export.js lo rasteriza con o.rasterSvg (si no, lo deja fuera)
|
|
1249
1269
|
return m;
|
|
1250
1270
|
}
|
|
1251
1271
|
|
|
@@ -1473,6 +1493,7 @@ export class Character3D {
|
|
|
1473
1493
|
this.fxg.rotation.y = this.yaw;
|
|
1474
1494
|
|
|
1475
1495
|
for (const f of this.furs) f.u.uTime.value = sec;
|
|
1496
|
+
this.bodyU.uTime.value = sec; // destellos de la purpurina
|
|
1476
1497
|
for (const a of this.anims) a(rm ? 0 : sec);
|
|
1477
1498
|
}
|
|
1478
1499
|
|
package/src/character3d/body.js
CHANGED
|
@@ -92,6 +92,17 @@ export function bodyGeometry(pts, box, quality = 'high') {
|
|
|
92
92
|
const Dc = depthK * mean;
|
|
93
93
|
|
|
94
94
|
const [ws, hs] = quality === 'high' ? [96, 64] : [40, 26];
|
|
95
|
+
/** Dirección unitaria de la esfera → punto de la superficie (out). También la usa export.js para hornear. */
|
|
96
|
+
const surface = (x, y, z, out = new THREE.Vector3()) => {
|
|
97
|
+
const s2 = x * x + y * y;
|
|
98
|
+
const ang = Math.atan2(-y, x); // a coordenadas 2D (y hacia abajo)
|
|
99
|
+
const R = sampleTable(T, ang);
|
|
100
|
+
const Dt = depthK * Math.min(R, mean * 1.05);
|
|
101
|
+
const D = Dc + (Dt - Dc) * s2;
|
|
102
|
+
let py = (bottom - cy) * U + y * R * U;
|
|
103
|
+
if (py < 0.03) py = 0.03 + (py - 0.03) * 0.35; // asiento: aplana un poco la base para que «se apoye» en el suelo
|
|
104
|
+
return out.set(x * R * U, py, z * D * U);
|
|
105
|
+
};
|
|
95
106
|
let g = new THREE.SphereGeometry(1, ws, hs);
|
|
96
107
|
g.deleteAttribute('uv');
|
|
97
108
|
g.deleteAttribute('normal');
|
|
@@ -100,23 +111,14 @@ export function bodyGeometry(pts, box, quality = 'high') {
|
|
|
100
111
|
const v = new THREE.Vector3();
|
|
101
112
|
for (let i = 0; i < pos.count; i++) {
|
|
102
113
|
v.fromBufferAttribute(pos, i).normalize();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const R = sampleTable(T, ang);
|
|
106
|
-
const Dt = depthK * Math.min(R, mean * 1.05);
|
|
107
|
-
const D = Dc + (Dt - Dc) * s2;
|
|
108
|
-
pos.setXYZ(i, v.x * R * U, (bottom - cy) * U + v.y * R * U, v.z * D * U);
|
|
109
|
-
}
|
|
110
|
-
// asiento: aplana un poco la base para que «se apoye» en el suelo
|
|
111
|
-
for (let i = 0; i < pos.count; i++) {
|
|
112
|
-
const y = pos.getY(i);
|
|
113
|
-
if (y < 0.03) pos.setY(i, 0.03 + (y - 0.03) * 0.35);
|
|
114
|
+
surface(v.x, v.y, v.z, v);
|
|
115
|
+
pos.setXYZ(i, v.x, v.y, v.z);
|
|
114
116
|
}
|
|
115
117
|
g.computeVertexNormals();
|
|
116
118
|
g.computeBoundingBox();
|
|
117
119
|
g.computeBoundingSphere();
|
|
118
120
|
g.userData.shared = true; // cacheada: no se libera con el personaje
|
|
119
|
-
const out = { geometry: g, table: T, cx, cy, bottom, mean, depth: Dc * U };
|
|
121
|
+
const out = { geometry: g, table: T, cx, cy, bottom, mean, depth: Dc * U, surface, segments: [ws, hs] };
|
|
120
122
|
cache.set(key, out);
|
|
121
123
|
if (cache.size > 160) cache.delete(cache.keys().next().value);
|
|
122
124
|
return out;
|