@hypersoniclabs/helix-cli 0.1.27-helix3.664 → 0.1.27-helix3.666
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/dist/character/stages/firstPersonHide.d.ts +8 -0
- package/dist/character/stages/firstPersonHide.js +1 -0
- package/dist/character/stages/firstPersonHide.js.map +1 -1
- package/dist/character/stages/joinDraws.d.ts +44 -0
- package/dist/character/stages/joinDraws.js +377 -0
- package/dist/character/stages/joinDraws.js.map +1 -0
- package/dist/character/vrmCharacter.d.ts +3 -0
- package/dist/character/vrmCharacter.js +7 -0
- package/dist/character/vrmCharacter.js.map +1 -1
- package/dist/city/assemble/terrain.d.ts +7 -2
- package/dist/city/assemble/terrain.js +19 -6
- package/dist/city/assemble/terrain.js.map +1 -1
- package/dist/terrain/tile.d.ts +6 -0
- package/dist/terrain/tile.js +10 -1
- package/dist/terrain/tile.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_abs.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_audio.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_engine.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_expression.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_jbeam.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_materials.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_stock_events.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/fmod_studio.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/fsb5.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/sim_audio.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/sim_audio_ac.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/sim_audio_beamng.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/sim_audio_fixtures.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/test_beamng_engine.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/test_sim_audio.cpython-312.pyc +0 -0
|
@@ -48,6 +48,14 @@ export interface FirstPersonHideResult {
|
|
|
48
48
|
export type FirstPersonAnnotation = 'thirdPersonOnly' | 'firstPersonOnly' | 'both' | 'auto';
|
|
49
49
|
/** VRM 0.x spells the flag PascalCase (`ThirdPersonOnly`), 1.0 camelCase; anything else is not an annotation. */
|
|
50
50
|
export declare function firstPersonAnnotation(value: unknown): FirstPersonAnnotation | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Runtime names for a mesh's primitives.
|
|
53
|
+
*
|
|
54
|
+
* `GLTFLoader` splits a multi-primitive mesh into one `Mesh` per primitive, naming the first after the mesh and
|
|
55
|
+
* suffixing the rest `_1`, `_2`… Matching is by substring, so the base name alone would hide every primitive in
|
|
56
|
+
* the mesh — which is wrong for a body mesh that carries the ears as one primitive among many.
|
|
57
|
+
*/
|
|
58
|
+
export declare function runtimeName(meshName: string, primitiveIndex: number): string;
|
|
51
59
|
/**
|
|
52
60
|
* Find every primitive the first-person camera sits inside, and write the list into each scene's extras.
|
|
53
61
|
*
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.primitiveVertices = primitiveVertices;
|
|
4
4
|
exports.firstPersonAnnotation = firstPersonAnnotation;
|
|
5
|
+
exports.runtimeName = runtimeName;
|
|
5
6
|
exports.declareFirstPersonHide = declareFirstPersonHide;
|
|
6
7
|
/**
|
|
7
8
|
* WHICH SURFACES THE CAMERA IS INSIDE, DECLARED BY THE AVATAR.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstPersonHide.js","sourceRoot":"","sources":["../../../src/character/stages/firstPersonHide.ts"],"names":[],"mappings":";;AA8BA,8CAUC;AA8BD,sDAIC;
|
|
1
|
+
{"version":3,"file":"firstPersonHide.js","sourceRoot":"","sources":["../../../src/character/stages/firstPersonHide.ts"],"names":[],"mappings":";;AA8BA,8CAUC;AA8BD,sDAIC;AASD,kCAOC;AAQD,wDA4EC;AA5KD;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAAC,SAAmD;IACnF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;IACvC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAChF,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,mFAAmF;AACnF,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,sEAAsE;AACtE,MAAM,UAAU,GAAG,MAAM,CAAC;AAuB1B,iHAAiH;AACjH,SAAgB,qBAAqB,CAAC,KAAc;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC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ACL,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAA6B,CAAC;YAC5D,MAAM,MAAM,GAAI,MAAM,CAAC,WAAmD,IAAI,EAAE,CAAC;YACjF,KAAK,CAAC,SAAS,CAAC;gBACd,GAAG,MAAM;gBACT,WAAW,EAAE;oBACX,GAAG,MAAM;oBACT,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;oBACrD,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;iBACvD;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Document } from '@gltf-transform/core';
|
|
2
|
+
/**
|
|
3
|
+
* DRAW-CALL JOIN FOR AN IMPORTED AVATAR.
|
|
4
|
+
*
|
|
5
|
+
* The publish gate counts one draw per primitive per node, and caps an avatar at `AVATAR_MAX_DRAW_CALLS` (12). A
|
|
6
|
+
* VRoid export is one primitive per surface spread over several skinned meshes, so after the material atlas an avatar
|
|
7
|
+
* with 8 materials still arrives at 13-33 draws. The web import joined them in the backend (`avatar-import.fit.ts`)
|
|
8
|
+
* after this converter had finished; the Creator Tools path (`helix bridge import`) never did, and 101 of the 273 corpus
|
|
9
|
+
* VRMs were refused at publish on draws alone. This is the same pass, run INSIDE the converter and BEFORE the LOD
|
|
10
|
+
* ladder, so LOD0 and every level derived from it are already within budget and both paths ship the same file.
|
|
11
|
+
*
|
|
12
|
+
* Joining primitives that share a material, skin and attribute layout changes no geometry, weight or material. What
|
|
13
|
+
* can go wrong, and what each step below does about it:
|
|
14
|
+
* - Blend shapes. `joinPrimitives` writes no morph targets, so a face joined naively loses every viseme. Morphed
|
|
15
|
+
* meshes are joined here, per mesh, rebuilding each target through the exact vertex order the joiner uses.
|
|
16
|
+
* - The first-/third-person hide lists name primitives (`Hair001baked_12`). The join renames everything it touches, so
|
|
17
|
+
* the lists are re-declared from the surviving primitives, and a view class never merges with another one.
|
|
18
|
+
* - Skins. The joiner groups by skin OBJECT. Morphed meshes and each view class get a clone over the same joints and
|
|
19
|
+
* inverse bind matrices for the duration of the join; identical skins are collapsed back to one afterwards, so the
|
|
20
|
+
* rig the next stages (LODs, preview) and the runtime see is the one that came in.
|
|
21
|
+
*/
|
|
22
|
+
/** The platform's `AVATAR_MAX_DRAW_CALLS`: the wall a published avatar may not cross. */
|
|
23
|
+
export declare const AVATAR_MAX_DRAW_CALLS = 12;
|
|
24
|
+
export interface JoinDrawsReport {
|
|
25
|
+
/** Draw calls (primitives over every mesh-bearing node) before and after. */
|
|
26
|
+
before: number;
|
|
27
|
+
after: number;
|
|
28
|
+
joined: boolean;
|
|
29
|
+
/** Why nothing was joined, when that is not simply "already within budget". */
|
|
30
|
+
skipped?: string;
|
|
31
|
+
/** Surfaces re-declared for the first-/third-person views after the join renamed them. */
|
|
32
|
+
viewHide?: {
|
|
33
|
+
firstPersonHide: number;
|
|
34
|
+
thirdPersonHide: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** What the publish gate counts for a single-scene avatar: primitives over every node that bears a mesh. */
|
|
38
|
+
export declare function countDraws(document: Document): number;
|
|
39
|
+
/**
|
|
40
|
+
* Bring a single-scene avatar within the draw-call budget by joining same-material primitives. A no-op (the document
|
|
41
|
+
* is not touched) when it is already within `limit`. Never throws on a join it cannot do: it leaves those primitives
|
|
42
|
+
* as they were and the publish gate states the real number.
|
|
43
|
+
*/
|
|
44
|
+
export declare function joinDraws(document: Document, limit?: number): JoinDrawsReport;
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AVATAR_MAX_DRAW_CALLS = void 0;
|
|
4
|
+
exports.countDraws = countDraws;
|
|
5
|
+
exports.joinDraws = joinDraws;
|
|
6
|
+
const functions_1 = require("@gltf-transform/functions");
|
|
7
|
+
const firstPersonHide_1 = require("./firstPersonHide");
|
|
8
|
+
/**
|
|
9
|
+
* DRAW-CALL JOIN FOR AN IMPORTED AVATAR.
|
|
10
|
+
*
|
|
11
|
+
* The publish gate counts one draw per primitive per node, and caps an avatar at `AVATAR_MAX_DRAW_CALLS` (12). A
|
|
12
|
+
* VRoid export is one primitive per surface spread over several skinned meshes, so after the material atlas an avatar
|
|
13
|
+
* with 8 materials still arrives at 13-33 draws. The web import joined them in the backend (`avatar-import.fit.ts`)
|
|
14
|
+
* after this converter had finished; the Creator Tools path (`helix bridge import`) never did, and 101 of the 273 corpus
|
|
15
|
+
* VRMs were refused at publish on draws alone. This is the same pass, run INSIDE the converter and BEFORE the LOD
|
|
16
|
+
* ladder, so LOD0 and every level derived from it are already within budget and both paths ship the same file.
|
|
17
|
+
*
|
|
18
|
+
* Joining primitives that share a material, skin and attribute layout changes no geometry, weight or material. What
|
|
19
|
+
* can go wrong, and what each step below does about it:
|
|
20
|
+
* - Blend shapes. `joinPrimitives` writes no morph targets, so a face joined naively loses every viseme. Morphed
|
|
21
|
+
* meshes are joined here, per mesh, rebuilding each target through the exact vertex order the joiner uses.
|
|
22
|
+
* - The first-/third-person hide lists name primitives (`Hair001baked_12`). The join renames everything it touches, so
|
|
23
|
+
* the lists are re-declared from the surviving primitives, and a view class never merges with another one.
|
|
24
|
+
* - Skins. The joiner groups by skin OBJECT. Morphed meshes and each view class get a clone over the same joints and
|
|
25
|
+
* inverse bind matrices for the duration of the join; identical skins are collapsed back to one afterwards, so the
|
|
26
|
+
* rig the next stages (LODs, preview) and the runtime see is the one that came in.
|
|
27
|
+
*/
|
|
28
|
+
/** The platform's `AVATAR_MAX_DRAW_CALLS`: the wall a published avatar may not cross. */
|
|
29
|
+
exports.AVATAR_MAX_DRAW_CALLS = 12;
|
|
30
|
+
const VIEW_KEYS = ['firstPersonHide', 'thirdPersonHide'];
|
|
31
|
+
/** What the publish gate counts for a single-scene avatar: primitives over every node that bears a mesh. */
|
|
32
|
+
function countDraws(document) {
|
|
33
|
+
let draws = 0;
|
|
34
|
+
for (const node of document.getRoot().listNodes())
|
|
35
|
+
draws += node.getMesh()?.listPrimitives().length ?? 0;
|
|
36
|
+
return draws;
|
|
37
|
+
}
|
|
38
|
+
function declaredViews(document) {
|
|
39
|
+
const out = {};
|
|
40
|
+
for (const scene of document.getRoot().listScenes()) {
|
|
41
|
+
const avatar = scene.getExtras().helixAvatar;
|
|
42
|
+
for (const key of VIEW_KEYS) {
|
|
43
|
+
const list = avatar?.[key];
|
|
44
|
+
if (Array.isArray(list))
|
|
45
|
+
out[key] = list.filter((v) => typeof v === 'string');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
/** The camera rig matches by case-insensitive substring; classify each primitive exactly the way it will. */
|
|
51
|
+
function viewOf(name, views) {
|
|
52
|
+
const lower = name.toLowerCase();
|
|
53
|
+
for (const key of VIEW_KEYS)
|
|
54
|
+
if (views[key]?.some((m) => lower.includes(m.toLowerCase())))
|
|
55
|
+
return key;
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
function cloneSkin(document, skin, suffix) {
|
|
59
|
+
const clone = document.createSkin(`${skin.getName()}-${suffix}`).setInverseBindMatrices(skin.getInverseBindMatrices());
|
|
60
|
+
const skeleton = skin.getSkeleton();
|
|
61
|
+
if (skeleton)
|
|
62
|
+
clone.setSkeleton(skeleton);
|
|
63
|
+
for (const joint of skin.listJoints())
|
|
64
|
+
clone.addJoint(joint);
|
|
65
|
+
return clone;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Each view class gets its own skin object so the joiner never merges one class into another, and a mesh whose
|
|
69
|
+
* primitives disagree is split so each class can move on its own.
|
|
70
|
+
*/
|
|
71
|
+
function separateViewClasses(document, views) {
|
|
72
|
+
const clones = new Map();
|
|
73
|
+
const cloneFor = (skin, key) => {
|
|
74
|
+
const id = `${document.getRoot().listSkins().indexOf(skin)}|${key}`;
|
|
75
|
+
let clone = clones.get(id);
|
|
76
|
+
if (!clone) {
|
|
77
|
+
clone = cloneSkin(document, skin, key);
|
|
78
|
+
clones.set(id, clone);
|
|
79
|
+
}
|
|
80
|
+
return clone;
|
|
81
|
+
};
|
|
82
|
+
for (const node of [...document.getRoot().listNodes()]) {
|
|
83
|
+
const mesh = node.getMesh();
|
|
84
|
+
const skin = node.getSkin();
|
|
85
|
+
if (!mesh || !skin)
|
|
86
|
+
continue;
|
|
87
|
+
const classes = mesh.listPrimitives().map((_, i) => viewOf((0, firstPersonHide_1.runtimeName)(mesh.getName(), i), views));
|
|
88
|
+
if (new Set(classes).size === 1) {
|
|
89
|
+
const only = classes[0];
|
|
90
|
+
if (only)
|
|
91
|
+
node.setSkin(cloneFor(skin, only));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
for (const key of VIEW_KEYS) {
|
|
95
|
+
const moving = mesh.listPrimitives().filter((_, i) => classes[i] === key);
|
|
96
|
+
if (moving.length === 0)
|
|
97
|
+
continue;
|
|
98
|
+
const split = document.createMesh(`${mesh.getName()}.${key}`).setExtras({ ...mesh.getExtras() }).setWeights(mesh.getWeights());
|
|
99
|
+
for (const primitive of moving) {
|
|
100
|
+
mesh.removePrimitive(primitive);
|
|
101
|
+
split.addPrimitive(primitive);
|
|
102
|
+
}
|
|
103
|
+
const sibling = document.createNode(`${node.getName()}.${key}`).setMesh(split).setSkin(cloneFor(skin, key))
|
|
104
|
+
.setTranslation(node.getTranslation()).setRotation(node.getRotation()).setScale(node.getScale());
|
|
105
|
+
const parent = node.getParentNode();
|
|
106
|
+
if (parent)
|
|
107
|
+
parent.addChild(sibling);
|
|
108
|
+
else
|
|
109
|
+
for (const scene of document.getRoot().listScenes())
|
|
110
|
+
if (scene.listChildren().includes(node))
|
|
111
|
+
scene.addChild(sibling);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Morph-targeted meshes get their own skin object (the joiner cannot concatenate a morphed primitive with an unmorphed one). */
|
|
116
|
+
function separateMorphedSkins(document) {
|
|
117
|
+
const clones = new Map();
|
|
118
|
+
for (const node of document.getRoot().listNodes()) {
|
|
119
|
+
const mesh = node.getMesh();
|
|
120
|
+
const skin = node.getSkin();
|
|
121
|
+
if (!mesh || !skin)
|
|
122
|
+
continue;
|
|
123
|
+
if (!mesh.listPrimitives().some((p) => p.listTargets().length > 0))
|
|
124
|
+
continue;
|
|
125
|
+
let clone = clones.get(skin);
|
|
126
|
+
if (!clone) {
|
|
127
|
+
clone = cloneSkin(document, skin, 'morph');
|
|
128
|
+
clones.set(skin, clone);
|
|
129
|
+
}
|
|
130
|
+
node.setSkin(clone);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const TRANSFORM_PRECISION = 5;
|
|
134
|
+
function transformKey(node) {
|
|
135
|
+
const fixed = (values) => values.map((value) => value.toFixed(TRANSFORM_PRECISION)).join(',');
|
|
136
|
+
return [fixed(node.getTranslation()), fixed(node.getRotation()), fixed(node.getScale())].join('/');
|
|
137
|
+
}
|
|
138
|
+
function attributeShape(primitive) {
|
|
139
|
+
return primitive.listSemantics().sort().map((semantic) => {
|
|
140
|
+
const accessor = primitive.getAttribute(semantic);
|
|
141
|
+
return `${semantic}:${accessor.getComponentType()}:${accessor.getNormalized() ? 'n' : 'r'}:${accessor.getElementSize()}`;
|
|
142
|
+
}).join(',');
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Join primitives that share material (by identity, never name), mode, attribute layout, node transform and skin
|
|
146
|
+
* OBJECT, across the nodes that carry them. A group the joiner declines is skipped, never fatal.
|
|
147
|
+
*/
|
|
148
|
+
function joinSkinnedPrimitives(document) {
|
|
149
|
+
const root = document.getRoot();
|
|
150
|
+
const materials = root.listMaterials();
|
|
151
|
+
const skins = root.listSkins();
|
|
152
|
+
const groups = new Map();
|
|
153
|
+
for (const node of root.listNodes()) {
|
|
154
|
+
const mesh = node.getMesh();
|
|
155
|
+
const skin = node.getSkin();
|
|
156
|
+
if (!mesh || !skin)
|
|
157
|
+
continue;
|
|
158
|
+
for (const primitive of mesh.listPrimitives()) {
|
|
159
|
+
const key = [`mat:${primitive.getMaterial() ? materials.indexOf(primitive.getMaterial()) : -1}`, primitive.getMode(),
|
|
160
|
+
attributeShape(primitive), Boolean(primitive.getIndices()), transformKey(node), `skin:${skins.indexOf(skin)}`].join('|');
|
|
161
|
+
const bucket = groups.get(key);
|
|
162
|
+
if (bucket)
|
|
163
|
+
bucket.push({ node, primitive });
|
|
164
|
+
else
|
|
165
|
+
groups.set(key, [{ node, primitive }]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
let joinedGroups = 0;
|
|
169
|
+
let skipped = null;
|
|
170
|
+
for (const entries of groups.values()) {
|
|
171
|
+
if (entries.length < 2)
|
|
172
|
+
continue;
|
|
173
|
+
let joined;
|
|
174
|
+
try {
|
|
175
|
+
joined = (0, functions_1.joinPrimitives)(entries.map((e) => e.primitive));
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
skipped ??= error instanceof Error ? error.message.split('\n')[0] : String(error);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
joinedGroups++;
|
|
182
|
+
const survivor = entries[0].node;
|
|
183
|
+
const survivorMesh = survivor.getMesh();
|
|
184
|
+
for (const { node, primitive } of entries) {
|
|
185
|
+
node.getMesh()?.removePrimitive(primitive);
|
|
186
|
+
primitive.dispose();
|
|
187
|
+
}
|
|
188
|
+
survivorMesh.addPrimitive(joined);
|
|
189
|
+
for (const { node } of entries.slice(1)) {
|
|
190
|
+
const mesh = node.getMesh();
|
|
191
|
+
if (mesh && mesh.listPrimitives().length === 0) {
|
|
192
|
+
mesh.dispose();
|
|
193
|
+
node.setMesh(null);
|
|
194
|
+
if (node.listChildren().length === 0)
|
|
195
|
+
node.dispose();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return { groups: joinedGroups, skipped };
|
|
200
|
+
}
|
|
201
|
+
function remapFor(primitive) {
|
|
202
|
+
const vertices = primitive.getAttribute('POSITION').getCount();
|
|
203
|
+
const indices = (primitive.getIndices()?.getArray() ?? null);
|
|
204
|
+
const remap = new Uint32Array(vertices).fill(0xffffffff);
|
|
205
|
+
let count = 0;
|
|
206
|
+
const n = indices ? indices.length : vertices;
|
|
207
|
+
for (let i = 0; i < n; i++) {
|
|
208
|
+
const index = indices ? indices[i] : i;
|
|
209
|
+
if (remap[index] === 0xffffffff)
|
|
210
|
+
remap[index] = count++;
|
|
211
|
+
}
|
|
212
|
+
return { remap, count };
|
|
213
|
+
}
|
|
214
|
+
function targetSignature(primitive) {
|
|
215
|
+
return primitive.listTargets().map((target) => target.listSemantics().sort()
|
|
216
|
+
.map((semantic) => `${semantic}:${target.getAttribute(semantic).getComponentType()}`).join(',')).join('|');
|
|
217
|
+
}
|
|
218
|
+
/** Join one morphed mesh's primitives per (material, mode, layout, targets), rebuilding every target through the joiner's vertex order. */
|
|
219
|
+
function joinMorphedMesh(document, node) {
|
|
220
|
+
const mesh = node.getMesh();
|
|
221
|
+
if (!mesh)
|
|
222
|
+
return 0;
|
|
223
|
+
const root = document.getRoot();
|
|
224
|
+
const groups = new Map();
|
|
225
|
+
for (const primitive of mesh.listPrimitives()) {
|
|
226
|
+
if (primitive.listTargets().length === 0)
|
|
227
|
+
continue;
|
|
228
|
+
const key = [root.listMaterials().indexOf(primitive.getMaterial()), primitive.getMode(), attributeShape(primitive),
|
|
229
|
+
Boolean(primitive.getIndices()), targetSignature(primitive)].join('|');
|
|
230
|
+
const group = groups.get(key);
|
|
231
|
+
if (group)
|
|
232
|
+
group.push(primitive);
|
|
233
|
+
else
|
|
234
|
+
groups.set(key, [primitive]);
|
|
235
|
+
}
|
|
236
|
+
let joinedGroups = 0;
|
|
237
|
+
for (const primitives of groups.values()) {
|
|
238
|
+
if (primitives.length < 2)
|
|
239
|
+
continue;
|
|
240
|
+
let joined;
|
|
241
|
+
try {
|
|
242
|
+
joined = (0, functions_1.joinPrimitives)(primitives);
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const remaps = primitives.map(remapFor);
|
|
248
|
+
const total = remaps.reduce((sum, r) => sum + r.count, 0);
|
|
249
|
+
if (total !== joined.getAttribute('POSITION').getCount()) {
|
|
250
|
+
joined.dispose();
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
primitives[0].listTargets().forEach((tplTarget, t) => {
|
|
254
|
+
const target = document.createPrimitiveTarget(tplTarget.getName());
|
|
255
|
+
for (const semantic of tplTarget.listSemantics()) {
|
|
256
|
+
const tpl = tplTarget.getAttribute(semantic);
|
|
257
|
+
const size = tpl.getElementSize();
|
|
258
|
+
const out = new Float32Array(total * size);
|
|
259
|
+
let offset = 0;
|
|
260
|
+
primitives.forEach((primitive, p) => {
|
|
261
|
+
const source = primitive.listTargets()[t].getAttribute(semantic).getArray();
|
|
262
|
+
const { remap, count } = remaps[p];
|
|
263
|
+
for (let v = 0; v < remap.length; v++) {
|
|
264
|
+
const dst = remap[v];
|
|
265
|
+
if (dst === 0xffffffff)
|
|
266
|
+
continue;
|
|
267
|
+
for (let k = 0; k < size; k++)
|
|
268
|
+
out[(offset + dst) * size + k] = source[v * size + k];
|
|
269
|
+
}
|
|
270
|
+
offset += count;
|
|
271
|
+
});
|
|
272
|
+
target.setAttribute(semantic, document.createAccessor().setType(tpl.getType()).setArray(out).setBuffer(tpl.getBuffer()));
|
|
273
|
+
}
|
|
274
|
+
joined.addTarget(target);
|
|
275
|
+
});
|
|
276
|
+
for (const primitive of primitives) {
|
|
277
|
+
mesh.removePrimitive(primitive);
|
|
278
|
+
primitive.dispose();
|
|
279
|
+
}
|
|
280
|
+
mesh.addPrimitive(joined);
|
|
281
|
+
joinedGroups++;
|
|
282
|
+
}
|
|
283
|
+
return joinedGroups;
|
|
284
|
+
}
|
|
285
|
+
/** Re-declare both view lists from the joined document, by the skin class each surviving primitive carries. */
|
|
286
|
+
function redeclareViews(document) {
|
|
287
|
+
const lists = { firstPersonHide: [], thirdPersonHide: [] };
|
|
288
|
+
for (const node of document.getRoot().listNodes()) {
|
|
289
|
+
const mesh = node.getMesh();
|
|
290
|
+
const key = VIEW_KEYS.find((k) => node.getSkin()?.getName().endsWith(`-${k}`));
|
|
291
|
+
if (!mesh || !key)
|
|
292
|
+
continue;
|
|
293
|
+
mesh.listPrimitives().forEach((_, i) => lists[key].push((0, firstPersonHide_1.runtimeName)(mesh.getName(), i)));
|
|
294
|
+
}
|
|
295
|
+
for (const scene of document.getRoot().listScenes()) {
|
|
296
|
+
const extras = scene.getExtras();
|
|
297
|
+
const avatar = { ...(extras.helixAvatar ?? {}) };
|
|
298
|
+
for (const key of VIEW_KEYS) {
|
|
299
|
+
if (lists[key].length > 0)
|
|
300
|
+
avatar[key] = lists[key];
|
|
301
|
+
else
|
|
302
|
+
delete avatar[key];
|
|
303
|
+
}
|
|
304
|
+
scene.setExtras({ ...extras, helixAvatar: avatar });
|
|
305
|
+
}
|
|
306
|
+
return { firstPersonHide: lists.firstPersonHide.length, thirdPersonHide: lists.thirdPersonHide.length };
|
|
307
|
+
}
|
|
308
|
+
/** Fold the skins this pass cloned back into the first skin with the same joints, skeleton and bind matrices. */
|
|
309
|
+
function collapseClonedSkins(document) {
|
|
310
|
+
const sameRig = (a, b) => {
|
|
311
|
+
const ja = a.listJoints();
|
|
312
|
+
const jb = b.listJoints();
|
|
313
|
+
if (ja.length !== jb.length || a.getSkeleton() !== b.getSkeleton() || ja.some((joint, i) => joint !== jb[i]))
|
|
314
|
+
return false;
|
|
315
|
+
const ia = a.getInverseBindMatrices();
|
|
316
|
+
const ib = b.getInverseBindMatrices();
|
|
317
|
+
if (ia === ib)
|
|
318
|
+
return true;
|
|
319
|
+
const x = ia?.getArray();
|
|
320
|
+
const y = ib?.getArray();
|
|
321
|
+
if (!x || !y || x.length !== y.length)
|
|
322
|
+
return false;
|
|
323
|
+
for (let i = 0; i < x.length; i++)
|
|
324
|
+
if (x[i] !== y[i])
|
|
325
|
+
return false;
|
|
326
|
+
return true;
|
|
327
|
+
};
|
|
328
|
+
const kept = [];
|
|
329
|
+
for (const skin of document.getRoot().listSkins()) {
|
|
330
|
+
const survivor = kept.find((candidate) => sameRig(candidate, skin));
|
|
331
|
+
if (survivor === undefined) {
|
|
332
|
+
kept.push(skin);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
for (const node of document.getRoot().listNodes())
|
|
336
|
+
if (node.getSkin() === skin)
|
|
337
|
+
node.setSkin(survivor);
|
|
338
|
+
skin.dispose();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Bring a single-scene avatar within the draw-call budget by joining same-material primitives. A no-op (the document
|
|
343
|
+
* is not touched) when it is already within `limit`. Never throws on a join it cannot do: it leaves those primitives
|
|
344
|
+
* as they were and the publish gate states the real number.
|
|
345
|
+
*/
|
|
346
|
+
function joinDraws(document, limit = exports.AVATAR_MAX_DRAW_CALLS) {
|
|
347
|
+
const before = countDraws(document);
|
|
348
|
+
if (before <= limit)
|
|
349
|
+
return { before, after: before, joined: false };
|
|
350
|
+
separateMorphedSkins(document);
|
|
351
|
+
const views = declaredViews(document);
|
|
352
|
+
const hasViews = VIEW_KEYS.some((key) => (views[key]?.length ?? 0) > 0);
|
|
353
|
+
if (hasViews)
|
|
354
|
+
separateViewClasses(document, views);
|
|
355
|
+
// Morphed meshes sit out the skinned joiner (it would key them with the unmorphed ones) and are joined target-aware below.
|
|
356
|
+
const morphed = document.getRoot().listNodes()
|
|
357
|
+
.filter((node) => node.getSkin() && node.getMesh()?.listPrimitives().some((p) => p.listTargets().length > 0))
|
|
358
|
+
.map((node) => ({ node, skin: node.getSkin() }));
|
|
359
|
+
for (const { node } of morphed)
|
|
360
|
+
node.setSkin(null);
|
|
361
|
+
let skipped;
|
|
362
|
+
try {
|
|
363
|
+
({ skipped } = joinSkinnedPrimitives(document));
|
|
364
|
+
}
|
|
365
|
+
finally {
|
|
366
|
+
for (const { node, skin } of morphed)
|
|
367
|
+
node.setSkin(skin);
|
|
368
|
+
}
|
|
369
|
+
for (const { node } of morphed)
|
|
370
|
+
joinMorphedMesh(document, node);
|
|
371
|
+
const viewHide = hasViews ? redeclareViews(document) : undefined;
|
|
372
|
+
// Skins this pass cloned go back to one skin per rig; the next stages and the runtime see the rig that came in.
|
|
373
|
+
collapseClonedSkins(document);
|
|
374
|
+
const after = countDraws(document);
|
|
375
|
+
return { before, after, joined: after < before, ...(skipped !== null && { skipped }), ...(viewHide && { viewHide }) };
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=joinDraws.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinDraws.js","sourceRoot":"","sources":["../../../src/character/stages/joinDraws.ts"],"names":[],"mappings":";;;AA4CA,gCAIC;AA8PD,8BAoBC;AAjUD,yDAA2D;AAC3D,uDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yFAAyF;AAC5E,QAAA,qBAAqB,GAAG,EAAE,CAAC;AAExC,MAAM,SAAS,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU,CAAC;AAelE,4GAA4G;AAC5G,SAAgB,UAAU,CAAC,QAAkB;IAC3C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE;QAAE,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,CAAC,MAAM,IAAI,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E,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAG,EAAE,CAAC,CAAC,CAAC;IACpD,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,OAAO;QAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,OAAsB,CAAC;IAC3B,IAAI,CAAC;QAAC,CAAC,EAAE,OAAO,EAAE,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAAC,CAAC;YAAS,CAAC;QAAC,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,OAAO;YAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,CAAC;IAC9H,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,OAAO;QAAE,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,gHAAgH;IAChH,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AACxH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Node } from '@gltf-transform/core';
|
|
2
2
|
import { type BakeRestSkinReport } from './stages/bakeRestSkin';
|
|
3
|
+
import { type JoinDrawsReport } from './stages/joinDraws';
|
|
3
4
|
import { type MergeSkinsReport } from './stages/mergeSkins';
|
|
4
5
|
import { type SpringChainReport } from './stages/vrmSpringChains';
|
|
5
6
|
import { type VrmMetaRecord } from './stages/vrmMeta';
|
|
@@ -87,6 +88,8 @@ export interface VrmCharacterResult {
|
|
|
87
88
|
/** Materials before and after atlasing — the publish gate's tightest constraint on an import. */
|
|
88
89
|
materialsBefore: number;
|
|
89
90
|
materialsAfter: number;
|
|
91
|
+
/** The draw-call join (`joinDraws`); `null` for a wearable or an untouched source. */
|
|
92
|
+
draws: JoinDrawsReport | null;
|
|
90
93
|
/** Surfaces the first-person camera sits inside, declared so the runtime can hide them. */
|
|
91
94
|
firstPersonHide: string[];
|
|
92
95
|
/** Surfaces marked `firstPersonOnly` (drawn only from inside the head), for the runtime's third-person view. */
|
|
@@ -21,6 +21,7 @@ const report_1 = require("./stages/report");
|
|
|
21
21
|
const mat4_1 = require("./mat4");
|
|
22
22
|
const bakeRestSkin_1 = require("./stages/bakeRestSkin");
|
|
23
23
|
const sceneOrphans_1 = require("./stages/sceneOrphans");
|
|
24
|
+
const joinDraws_1 = require("./stages/joinDraws");
|
|
24
25
|
const mergeSkins_1 = require("./stages/mergeSkins");
|
|
25
26
|
const vrmDynamics_1 = require("./stages/vrmDynamics");
|
|
26
27
|
const vrmSpringChains_1 = require("./stages/vrmSpringChains");
|
|
@@ -888,6 +889,11 @@ async function makeVrmCharacter(vrmPath, canonicalPath, outPath, options = {}) {
|
|
|
888
889
|
}
|
|
889
890
|
}
|
|
890
891
|
(0, sceneOrphans_1.disposeSceneOrphans)(document);
|
|
892
|
+
// DRAW CALLS: the gate counts a draw per primitive, and a VRoid export is one primitive per surface over several meshes.
|
|
893
|
+
// Joined here, before the LOD ladder, so LOD0 and every level cut from it ship inside the budget (the web path used to do
|
|
894
|
+
// this in the backend, after the file was finished; `helix bridge import` never did). Avatars only: a wearable has its own
|
|
895
|
+
// budget, and `budget === null` means the source is to be left untouched.
|
|
896
|
+
const draws = budget !== null && options.keepMaterials === undefined ? (0, joinDraws_1.joinDraws)(document) : null;
|
|
891
897
|
await document.transform((0, functions_1.prune)(), (0, functions_1.dedup)());
|
|
892
898
|
// ── LOD CHAIN, PREVIEW, WEB ENCODING ────────────────────────────────────────────────────────────────────────
|
|
893
899
|
// An avatar (not a wearable cut from one) ships LOD0/1/2 as separate scenes of one GLB, the shape the generic
|
|
@@ -935,6 +941,7 @@ async function makeVrmCharacter(vrmPath, canonicalPath, outPath, options = {}) {
|
|
|
935
941
|
faceMorphsRemoved,
|
|
936
942
|
springs: springReport,
|
|
937
943
|
constraints: helixConstraints.length,
|
|
944
|
+
draws,
|
|
938
945
|
warnings: [...toon.warnings, ...(dynamics?.warnings ?? []), ...built.warnings, ...constraintResult.warnings, ...(face?.warnings ?? [])], unitScale,
|
|
939
946
|
lods: lodReports, encoding, preview,
|
|
940
947
|
};
|