@automovie/render 0.3.1 → 0.3.3
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/lib/AutoMovieFrameGrid.d.ts +54 -0
- package/lib/AutoMovieFrameGrid.js +71 -0
- package/lib/AutoMovieFrameGrid.js.map +1 -0
- package/lib/AutoMovieFrameGrid.mjs +20 -0
- package/lib/AutoMovieFrameGrid.mjs.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +2 -1
- package/lib/scene/applyAutoMovieShadowParticipation.d.ts +4 -5
- package/lib/scene/applyAutoMovieShadowParticipation.js +4 -5
- package/lib/scene/applyAutoMovieShadowParticipation.js.map +1 -1
- package/lib/scene/applyAutoMovieShadowParticipation.mjs +4 -5
- package/lib/scene/applyAutoMovieShadowParticipation.mjs.map +1 -1
- package/lib/scene/buildMaterial.d.ts +1 -0
- package/lib/scene/buildMaterial.js +5 -0
- package/lib/scene/buildMaterial.js.map +1 -1
- package/lib/scene/buildMaterial.mjs +2 -0
- package/lib/scene/buildMaterial.mjs.map +1 -1
- package/lib/scene/buildModel.d.ts +1 -0
- package/lib/scene/buildModel.js +2 -0
- package/lib/scene/buildModel.js.map +1 -1
- package/lib/scene/buildModel.mjs +2 -0
- package/lib/scene/buildModel.mjs.map +1 -1
- package/lib/scene/buildSpaceObject.d.ts +7 -9
- package/lib/scene/buildSpaceObject.js +12 -10
- package/lib/scene/buildSpaceObject.js.map +1 -1
- package/lib/scene/buildSpaceObject.mjs +9 -11
- package/lib/scene/buildSpaceObject.mjs.map +1 -1
- package/package.json +4 -4
- package/src/AutoMovieFrameGrid.ts +70 -0
- package/src/index.ts +1 -0
- package/src/scene/applyAutoMovieShadowParticipation.ts +4 -5
- package/src/scene/buildMaterial.ts +7 -0
- package/src/scene/buildModel.ts +2 -0
- package/src/scene/buildSpaceObject.ts +18 -10
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-based, regularly spaced presentation frames followed by the exact end.
|
|
3
|
+
* Takes and preview controls share the grid, including an endpoint that falls
|
|
4
|
+
* between regular frame times.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the index origin, temporal spacing, endpoint, and consumers.
|
|
7
|
+
* @evidence contracts/development/design.md#principled-representation Frame indices are zero-based integers, timestamps and duration are seconds, and cadence is positive frames per second. JavaScript numbers do not enforce these constraints, so the caller supplies a valid presentation clock and index.
|
|
8
|
+
* @evidence contracts/development/design.md#minimal-and-owned-surface Render owns frame schedules. The take producer reads the last index and frame times, and the preview controls also map a playhead second to a displayed frame index.
|
|
9
|
+
* @evidence contracts/development/design.md#prohibited-design-shortcuts The endpoint rule works for both exact-grid and fractional durations and requires no caller-specific mode.
|
|
10
|
+
*/
|
|
11
|
+
export declare namespace AutoMovieFrameGrid {
|
|
12
|
+
/**
|
|
13
|
+
* Find the final zero-based frame number for a nonnegative duration in
|
|
14
|
+
* seconds and a positive rate in frames per second. The exact end takes
|
|
15
|
+
* the place of the first regular frame at or past the end.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the units, index origin, and the final frame's relation to the regular cadence.
|
|
18
|
+
* @evidence contracts/development/implementation.md#principled-implementation Compares the candidate's canonical timestamp to the end since the product alone can round across an integer.
|
|
19
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Computes one candidate, then advances it if its timestamp is still before the end.
|
|
20
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Keeps a fractional end distinct from the regular frame immediately before it without an arbitrary epsilon.
|
|
21
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
22
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one candidate and its time.
|
|
23
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
24
|
+
*/
|
|
25
|
+
function last(duration: number, fps: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Read a zero-based frame's timestamp in seconds at the given rate in
|
|
28
|
+
* frames per second, clamped to the final timestamp, `duration`.
|
|
29
|
+
*
|
|
30
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the index origin, input and return units, and the end clamp.
|
|
31
|
+
* @evidence contracts/development/implementation.md#principled-implementation One division yields the canonical timestamp without accumulating rounding error.
|
|
32
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Divides the index by the rate and clamps the result.
|
|
33
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Returns the exact end when the next regular frame would run past it.
|
|
34
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
35
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one timestamp.
|
|
36
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
37
|
+
*/
|
|
38
|
+
function time(frame: number, duration: number, fps: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Show the closest regular frame for an in-range second, reserving the
|
|
41
|
+
* final frame for the exact end. The caller supplies the duration in
|
|
42
|
+
* seconds, the rate in frames per second, and the already computed last
|
|
43
|
+
* frame number.
|
|
44
|
+
*
|
|
45
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the rounding policy, the exact end, and the units of the supplied clock.
|
|
46
|
+
* @evidence contracts/development/implementation.md#principled-implementation Rounds within the regular grid and reserves the end index for the actual end, so it remains a separate scrubber position.
|
|
47
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Returns the last index at the end and otherwise rounds and caps the regular index.
|
|
48
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A playhead just before the end cannot occupy the end index.
|
|
49
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
50
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Uses the last frame number already computed for the grid.
|
|
51
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
52
|
+
*/
|
|
53
|
+
function nearest(seconds: number, duration: number, fps: number, last: number): number;
|
|
54
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutoMovieFrameGrid = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Zero-based, regularly spaced presentation frames followed by the exact end.
|
|
6
|
+
* Takes and preview controls share the grid, including an endpoint that falls
|
|
7
|
+
* between regular frame times.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the index origin, temporal spacing, endpoint, and consumers.
|
|
10
|
+
* @evidence contracts/development/design.md#principled-representation Frame indices are zero-based integers, timestamps and duration are seconds, and cadence is positive frames per second. JavaScript numbers do not enforce these constraints, so the caller supplies a valid presentation clock and index.
|
|
11
|
+
* @evidence contracts/development/design.md#minimal-and-owned-surface Render owns frame schedules. The take producer reads the last index and frame times, and the preview controls also map a playhead second to a displayed frame index.
|
|
12
|
+
* @evidence contracts/development/design.md#prohibited-design-shortcuts The endpoint rule works for both exact-grid and fractional durations and requires no caller-specific mode.
|
|
13
|
+
*/
|
|
14
|
+
var AutoMovieFrameGrid;
|
|
15
|
+
(function (AutoMovieFrameGrid) {
|
|
16
|
+
/**
|
|
17
|
+
* Find the final zero-based frame number for a nonnegative duration in
|
|
18
|
+
* seconds and a positive rate in frames per second. The exact end takes
|
|
19
|
+
* the place of the first regular frame at or past the end.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the units, index origin, and the final frame's relation to the regular cadence.
|
|
22
|
+
* @evidence contracts/development/implementation.md#principled-implementation Compares the candidate's canonical timestamp to the end since the product alone can round across an integer.
|
|
23
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Computes one candidate, then advances it if its timestamp is still before the end.
|
|
24
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Keeps a fractional end distinct from the regular frame immediately before it without an arbitrary epsilon.
|
|
25
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
26
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one candidate and its time.
|
|
27
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
28
|
+
*/
|
|
29
|
+
function last(duration, fps) {
|
|
30
|
+
const nearest = Math.round(duration * fps);
|
|
31
|
+
return nearest / fps < duration ? nearest + 1 : nearest;
|
|
32
|
+
}
|
|
33
|
+
AutoMovieFrameGrid.last = last;
|
|
34
|
+
/**
|
|
35
|
+
* Read a zero-based frame's timestamp in seconds at the given rate in
|
|
36
|
+
* frames per second, clamped to the final timestamp, `duration`.
|
|
37
|
+
*
|
|
38
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the index origin, input and return units, and the end clamp.
|
|
39
|
+
* @evidence contracts/development/implementation.md#principled-implementation One division yields the canonical timestamp without accumulating rounding error.
|
|
40
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Divides the index by the rate and clamps the result.
|
|
41
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Returns the exact end when the next regular frame would run past it.
|
|
42
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
43
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one timestamp.
|
|
44
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
45
|
+
*/
|
|
46
|
+
function time(frame, duration, fps) {
|
|
47
|
+
return Math.min(frame / fps, duration);
|
|
48
|
+
}
|
|
49
|
+
AutoMovieFrameGrid.time = time;
|
|
50
|
+
/**
|
|
51
|
+
* Show the closest regular frame for an in-range second, reserving the
|
|
52
|
+
* final frame for the exact end. The caller supplies the duration in
|
|
53
|
+
* seconds, the rate in frames per second, and the already computed last
|
|
54
|
+
* frame number.
|
|
55
|
+
*
|
|
56
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the rounding policy, the exact end, and the units of the supplied clock.
|
|
57
|
+
* @evidence contracts/development/implementation.md#principled-implementation Rounds within the regular grid and reserves the end index for the actual end, so it remains a separate scrubber position.
|
|
58
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Returns the last index at the end and otherwise rounds and caps the regular index.
|
|
59
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A playhead just before the end cannot occupy the end index.
|
|
60
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
61
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Uses the last frame number already computed for the grid.
|
|
62
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
63
|
+
*/
|
|
64
|
+
function nearest(seconds, duration, fps, last) {
|
|
65
|
+
return seconds >= duration
|
|
66
|
+
? last
|
|
67
|
+
: Math.min(last - 1, Math.round(seconds * fps));
|
|
68
|
+
}
|
|
69
|
+
AutoMovieFrameGrid.nearest = nearest;
|
|
70
|
+
})(AutoMovieFrameGrid || (exports.AutoMovieFrameGrid = AutoMovieFrameGrid = {}));
|
|
71
|
+
//# sourceMappingURL=AutoMovieFrameGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoMovieFrameGrid.js","sourceRoot":"","sources":["../src/AutoMovieFrameGrid.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,IAAiB,kBAAkB,CA2DlC;AA3DD,WAAiB,kBAAkB;IACjC;;;;;;;;;;;;OAYG;IACH,SAAgB,IAAI,CAAC,QAAgB,EAAE,GAAW;QAChD,MAAM,OAAO,GAAW,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;QACnD,OAAO,OAAO,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1D,CAAC;IAHe,mBAAA,IAAI,OAGnB,CAAA;IAED;;;;;;;;;;;OAWG;IACH,SAAgB,IAAI,CAAC,KAAa,EAAE,QAAgB,EAAE,GAAW;QAC/D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAFe,mBAAA,IAAI,OAEnB,CAAA;IAED;;;;;;;;;;;;;OAaG;IACH,SAAgB,OAAO,CACrB,OAAe,EACf,QAAgB,EAChB,GAAW,EACX,IAAY;QAEZ,OAAO,OAAO,IAAI,QAAQ;YACxB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IATe,mBAAA,OAAO,UAStB,CAAA;AACH,CAAC,EA3DgB,kBAAkB,aAAlB,kBAAkB,GAAlB,kBAAkB,QA2DlC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/AutoMovieFrameGrid.ts
|
|
2
|
+
let AutoMovieFrameGrid;
|
|
3
|
+
(function(_AutoMovieFrameGrid) {
|
|
4
|
+
function last(duration, fps) {
|
|
5
|
+
const nearest = Math.round(duration * fps);
|
|
6
|
+
return nearest / fps < duration ? nearest + 1 : nearest;
|
|
7
|
+
}
|
|
8
|
+
_AutoMovieFrameGrid.last = last;
|
|
9
|
+
function time(frame, duration, fps) {
|
|
10
|
+
return Math.min(frame / fps, duration);
|
|
11
|
+
}
|
|
12
|
+
_AutoMovieFrameGrid.time = time;
|
|
13
|
+
function nearest(seconds, duration, fps, last) {
|
|
14
|
+
return seconds >= duration ? last : Math.min(last - 1, Math.round(seconds * fps));
|
|
15
|
+
}
|
|
16
|
+
_AutoMovieFrameGrid.nearest = nearest;
|
|
17
|
+
})(AutoMovieFrameGrid || (AutoMovieFrameGrid = {}));
|
|
18
|
+
export { AutoMovieFrameGrid };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=AutoMovieFrameGrid.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoMovieFrameGrid.mjs","names":[],"sources":["../src/AutoMovieFrameGrid.ts"],"sourcesContent":["/**\n * Zero-based, regularly spaced presentation frames followed by the exact end.\n * Takes and preview controls share the grid, including an endpoint that falls\n * between regular frame times.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the index origin, temporal spacing, endpoint, and consumers.\n * @evidence contracts/development/design.md#principled-representation Frame indices are zero-based integers, timestamps and duration are seconds, and cadence is positive frames per second. JavaScript numbers do not enforce these constraints, so the caller supplies a valid presentation clock and index.\n * @evidence contracts/development/design.md#minimal-and-owned-surface Render owns frame schedules. The take producer reads the last index and frame times, and the preview controls also map a playhead second to a displayed frame index.\n * @evidence contracts/development/design.md#prohibited-design-shortcuts The endpoint rule works for both exact-grid and fractional durations and requires no caller-specific mode.\n */\nexport namespace AutoMovieFrameGrid {\n /**\n * Find the final zero-based frame number for a nonnegative duration in\n * seconds and a positive rate in frames per second. The exact end takes\n * the place of the first regular frame at or past the end.\n *\n * @evidence contracts/development/common.md#meaningful-documentation Defines the units, index origin, and the final frame's relation to the regular cadence.\n * @evidence contracts/development/implementation.md#principled-implementation Compares the candidate's canonical timestamp to the end since the product alone can round across an integer.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Computes one candidate, then advances it if its timestamp is still before the end.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Keeps a fractional end distinct from the regular frame immediately before it without an arbitrary epsilon.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one candidate and its time.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.\n */\n export function last(duration: number, fps: number): number {\n const nearest: number = Math.round(duration * fps);\n return nearest / fps < duration ? nearest + 1 : nearest;\n }\n\n /**\n * Read a zero-based frame's timestamp in seconds at the given rate in\n * frames per second, clamped to the final timestamp, `duration`.\n *\n * @evidence contracts/development/common.md#meaningful-documentation Defines the index origin, input and return units, and the end clamp.\n * @evidence contracts/development/implementation.md#principled-implementation One division yields the canonical timestamp without accumulating rounding error.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Divides the index by the rate and clamps the result.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Returns the exact end when the next regular frame would run past it.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one timestamp.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.\n */\n export function time(frame: number, duration: number, fps: number): number {\n return Math.min(frame / fps, duration);\n }\n\n /**\n * Show the closest regular frame for an in-range second, reserving the\n * final frame for the exact end. The caller supplies the duration in\n * seconds, the rate in frames per second, and the already computed last\n * frame number.\n *\n * @evidence contracts/development/common.md#meaningful-documentation Defines the rounding policy, the exact end, and the units of the supplied clock.\n * @evidence contracts/development/implementation.md#principled-implementation Rounds within the regular grid and reserves the end index for the actual end, so it remains a separate scrubber position.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Returns the last index at the end and otherwise rounds and caps the regular index.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A playhead just before the end cannot occupy the end index.\n * @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Uses the last frame number already computed for the grid.\n * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.\n */\n export function nearest(\n seconds: number,\n duration: number,\n fps: number,\n last: number,\n ): number {\n return seconds >= duration\n ? last\n : Math.min(last - 1, Math.round(seconds * fps));\n }\n}\n"],"mappings":";AAUO,IAAU;CAAV,SAAA,qBAAA;CAcE,SAAS,KAAK,UAAkB,KAAqB;EAC1D,MAAM,UAAkB,KAAK,MAAM,WAAW,GAAG;EACjD,OAAO,UAAU,MAAM,WAAW,UAAU,IAAI;CAClD;;CAcO,SAAS,KAAK,OAAe,UAAkB,KAAqB;EACzE,OAAO,KAAK,IAAI,QAAQ,KAAK,QAAQ;CACvC;;CAgBO,SAAS,QACd,SACA,UACA,KACA,MACQ;EACR,OAAO,WAAW,WACd,OACA,KAAK,IAAI,OAAO,GAAG,KAAK,MAAM,UAAU,GAAG,CAAC;CAClD;;AACD,EAAA,CAAA,uBAAA,qBAAA,CAAA,EAAD"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./caption/index.js"), exports);
|
|
18
18
|
__exportStar(require("./capture/index.js"), exports);
|
|
19
19
|
__exportStar(require("./delivery/index.js"), exports);
|
|
20
|
+
__exportStar(require("./AutoMovieFrameGrid.js"), exports);
|
|
20
21
|
__exportStar(require("./draw/index.js"), exports);
|
|
21
22
|
__exportStar(require("./film/index.js"), exports);
|
|
22
23
|
__exportStar(require("./ffmpegArgs.js"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,oDAAkC;AAClC,kDAAgC;AAChC,mEAAiD;AACjD,mEAAiD;AACjD,qEAAmD;AACnD,+DAA6C;AAC7C,oDAAkC;AAClC,mEAAiD;AACjD,8DAA4C;AAC5C,sDAAoC;AACpC,iEAA+C;AAC/C,mDAAiC;AACjC,qDAAmC;AACnC,mDAAiC;AACjC,wDAAsC;AACtC,gEAA8C;AAC9C,+DAA6C;AAC7C,8DAA4C;AAC5C,qEAAmD;AACnD,oEAAkD;AAClD,wEAAsD;AACtD,8EAA4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,4DAA0C;AAC1C,wEAAsD;AACtD,sEAAoD;AACpD,6EAA2D;AAC3D,4EAA0D;AAC1D,2DAAyC;AACzC,4DAA0C;AAC1C,0DAAwC;AACxC,8DAA4C;AAC5C,gEAA8C;AAC9C,4DAA0C;AAC1C,2DAAyC;AACzC,6DAA2C;AAC3C,oEAAkD;AAClD,kEAAgD;AAChD,iEAA+C;AAC/C,iEAA+C;AAC/C,8DAA4C;AAC5C,mDAAiC;AACjC,0DAAwC;AACxC,6DAA2C;AAC3C,iEAA+C;AAC/C,4DAA0C;AAC1C,4DAA0C;AAC1C,mDAAiC;AACjC,8EAA4D;AAC5D,gEAA8C;AAC9C,mDAAiC;AACjC,iFAA+D;AAC/D,6EAA2D;AAC3D,8EAA4D;AAC5D,+EAA6D;AAC7D,4EAA0D;AAC1D,kFAAgE;AAChE,qEAAmD;AACnD,kEAAgD;AAChD,4EAA0D;AAC1D,0EAAwD;AACxD,0EAAwD;AACxD,2EAAyD"}
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./caption/index.mjs";
|
|
2
2
|
import "./capture/index.mjs";
|
|
3
3
|
import "./delivery/index.mjs";
|
|
4
|
+
import { AutoMovieFrameGrid } from "./AutoMovieFrameGrid.mjs";
|
|
4
5
|
import { auditAutoMovieRenderObservation } from "./auditAutoMovieRenderObservation.mjs";
|
|
5
6
|
import "./draw/index.mjs";
|
|
6
7
|
import { parseAutoMovieCaptionLanguage } from "./caption/parseAutoMovieCaptionLanguage.mjs";
|
|
@@ -290,4 +291,4 @@ import { assertProductionOpusProfile } from "./delivery/assertProductionOpusProf
|
|
|
290
291
|
import { productionOpusDescription } from "./delivery/productionOpusDescription.mjs";
|
|
291
292
|
import { AUTOMOVIE_MP4_SRGB_COLOUR } from "./delivery/AUTOMOVIE_MP4_SRGB_COLOUR.mjs";
|
|
292
293
|
import { AUTOMOVIE_MP4_UNITY_MATRIX } from "./delivery/AUTOMOVIE_MP4_UNITY_MATRIX.mjs";
|
|
293
|
-
export { AUTOMOVIE_FORMATION_CYCLE_SAMPLES, AUTOMOVIE_GUIDE_PASSES, AUTOMOVIE_MP4_SRGB_COLOUR, AUTOMOVIE_MP4_UNITY_MATRIX, AUTOMOVIE_PRODUCTION_OPUS_PROFILE, AUTO_MOVIE_CAPTURE_PLAN_KEYS, AUTO_MOVIE_DRAW_GLOBALS, AUTO_MOVIE_INSPECTION_DEPTH_LEAD, AUTO_MOVIE_INSPECTION_KEYS, AUTO_MOVIE_INSPECTION_KINDS, AUTO_MOVIE_INSPECTION_PALETTE, AutoMovieCaptureFolder, AutoMovieDrawSession, AutoMovieGeometryPhysicalVertices, AutoMoviePlayer, AutoMovieRasterSheet, AutoMovieResourceRetirementScope, AutoMovieSkinnedMesh, AutoMovieTextureCache, DEPTH_NORMALIZATION_RANGE, DETAIL_NORMAL_TARGET, EDGE_SHELL_NAME, EDGE_WIDTH, POSE_OVERLAY_NAME, RELIEF_WEIGHT_TARGET, SPACE_GROUP_NAME, SUBSURFACE_TARGET, addMaterialShaderPatch, applyAutoMovieDeliveryCrop, applyAutoMovieInspection, applyAutoMovieInspectionSection, applyAutoMovieInspectionShade, applyAutoMovieRigLocals, applyAutoMovieSectionPlanes, applyAutoMovieSemanticMask, applyAutoMovieShadowParticipation, applyAutoMovieViewerSubjectPose, applyDetailNormal, applyDualQuaternionSkinning, applyExpression, applyFormationCycleCadence, applyFormationCycleMaterial, applyLightMotion, applyLightState, applyMaterialOverlays, applyMaterialShaderPatches, applyObjectMotion, applyObjectMotions, applyPose, applyPracticalSurfaceMaterials, applyReliefWeights, applyRenderMode, applyRendererEnvironment, applySceneEnvironment, applySceneFog, applySubsurfaceShading, applyTransform, assertAutoMovieCaptureClock, assertAutoMovieSceneShadowProfile, assertAutoMovieViewerCameraDepthPrecision, assertProductionOpusProfile, assertProductionPngPicture, assertProductionVideoProfile, assessAutoMovieRenderBudget, attachAutoMovieSemanticMask, auditAutoMovieDecodedFrames, auditAutoMovieEncodedPresentation, auditAutoMovieRenderObservation, auditAutoMovieSemanticMaskScene, autoMovieAnalysisRampColor, autoMovieCaptionLanguageComparisonKey, autoMovieInspectionPathOf, autoMovieRenderBudgetEvidence, autoMovieRenderBudgetRefusal, autoMovieRenderTargetRendererOfGraphics, autoMovieRenderTargetSettingsOfShot, autoMovieSemanticMaskOf, autoMovieViewerNamedViewpoints, autoMovieViewerPoseFromHeading, autoMovieViewerSubjectKey, autoMovieViewerTurntableViewpoints, bakeFormationCycle, beatCaptions, bindAutoMovieDrawSceneSoftProps, buildAnalysisOverlayObject, buildAutoMovieConstruction, buildAutoMovieInspectionMarks, buildAutoMovieMaterialLibrary, buildFluidSprayObject, buildFluidSurfaceObject, buildGeometry, buildHumanCartoonFace, buildHumanPolygon, buildInstancedEffect, buildInstancedFormation, buildInstancedInstanceSet, buildLight, buildMaterial, buildModel, buildPlantingObject, buildPolygonShotActor, buildPropArticulation, buildScene, buildSceneSoftProps, buildSoftBodyObject, buildSpaceObject, canonicalProductionWebVtt, canonicalizeAutoMovieCaptionText, captureAutoMovieFramebufferRestore, captureAutoMovieMetricFrame, captureAutoMovieViewerSubjectView, captureViewerSnapshot, chooseAutoMovieInspectionMarks, collectAutoMovieOwnedResources, colorAutoMovieInspectionObjects, compareAutoMovieCaptureRounds, compareAutoMovieRasters, constructAutoMovieOwnedResources, createAutoMovieClosedSphereGeometry, createAutoMovieHttpArtifactStore, createAutoMovieHumanPolygonFigure, createAutoMovieInspectionDots, createAutoMovieInspectionStrokes, createAutoMovieMetricOrthographicCamera, createAutoMoviePhysicalPoseAdapter, createAutoMovieResourceRetirement, createAutoMovieSurfaceAppearance, createDetailNormalShaderPatch, createDualQuaternionSkinningShaderPatch, createImportedModelObject, createReliefWeightShaderPatch, decodeAutoMovieDrawPixels, decodeAutoMovieRasterPng, defaultMaterial, describeAutoMovieDrawScene, detailNormalFragment, detailNormalVertex, disposeCrossDissolve, disposeFadeToBlack, dualQuaternionSkinningOf, dualQuaternionSkinningVertex, encodeAutoMovieDrawPixels, encodeAutoMovieRasterPng, encodeAutoMovieWavPcm16, equalOrderedScalars, evaluateAutoMovieViewerCameraDepthPrecision, expandAutoMovieInspectionSweep, ffmpegArgs, flattenInstancedModel, flattenInstancedObject, focusAutoMovieInspection, formatAutoMovieCapturePlanRequest, formatAutoMovieInspectionCameraView, formatAutoMovieInspectionRequest, formatAutoMovieInspectionView, formationCycleCadence, formationCycleGait, formationCycleOf, formationCyclePosition, formationCycleStride, frameAutoMovieViewerSubject, frameName, framePattern, frameTimes, guardAutoMovieRenderModeRetirement, guardAutoMovieSceneShadowRetirement, guidePassFrameName, guidePassFramePattern, hashAutoMovieRasterImage, inspectAutoMovieCaptionReadabilityWithRuntime, installAutoMovieDraw, instancedModelParts, invalidateAutoMovieSceneShadowPrograms, invalidateAutoMovieSkinnedPose, isAutoMovieWebVttIdentifier, isGuidePass, legendAutoMovieInspectionMarks, listAutoMovieInspectionKinds, listAutoMovieInspectionPaths, mapImportedHumanoidBones, markAutoMovieInspectionTrails, maskColor, matchAutoMovieInspectionPath, materialOverlayFragment, materialOverlayVertex, materialTextureBindings, measureAutoMovieInspectionBounds, measureAutoMovieInspectionDefects, measureAutoMovieInspectionEdges, measureAutoMovieInspectionMeshes, measureAutoMovieInspectionPaths, mergeAutoMovieInspectionLegends, mixAutoMovieAudioPcm, normalizeGuidePasses, observeAutoMovieRendererFrame, parseAutoMovieCaptionLanguage, parseAutoMovieCapturePlanRequest, parseAutoMovieInspectionRequest, parseAutoMovieInspectionView, parseAutoMovieViewerSubjectKey, placeAutoMovieInspectionLabels, planAutoMovieCapture, planAutoMovieCaptureFrames, planAutoMovieCaptureLayout, planAutoMovieCaptureUrl, planAutoMovieDrawCall, planAutoMovieInspectionTrailTimes, planAutoMovieVideoEncoding, planAutoMovieVideoFrames, planAutoMovieVideoSceneCuts, planCaptionSidecar, planChunkedSequenceRender, planGuidePassOutputs, planPoseKeypointSidecar, planProductionRenderJob, planSequenceRender, planViewerFrameTimes, productionOpusDescription, productionVisualDeliveryOccurrence, readAutoMovieCaptureArguments, readAutoMovieCubeShadowDepth, readAutoMovieDeliveryCrop, readAutoMovieDisplayDestinationEncoding, readAutoMovieFilmDisplayTextureResidency, readAutoMovieMaterialTextureSources, readAutoMovieRenderTextureTarget, readAutoMovieShadowLightSource, readAutoMovieShadowTextureTargets, readAutoMovieTextureSource, readAutoMovieTransmissionTextureTarget, readAutoMovieVideoSceneCuts, regenerateFormationSlot, regenerateInstanceSlot, releaseViewerRenderer, reliefWeightFragment, reliefWeightVertex, renderAndSee, renderAutoMovieDrawnVideo, renderAutoMovieFilmFrame, renderAutoMovieScenePass, renderCaptionSidecar, renderCrossDissolve, renderCrossDissolveFrames, renderFadeToBlackFrame, renderPathStem, renderPoseKeypointSidecar, renderScreenplay, renderSequenceAndSee, renderSequenceVideo, renderVideo, replaceAutoMovieDrawInspection, reportAutoMovieResourceRetirement, resetAutoMovieSceneShadowTargets, resolveAutoMovieCapturePatterns, resolveAutoMovieFilmBeautyComposition, resolveAutoMovieInspectionColors, resolveAutoMovieInspectionView, resolveProductionPngProfile, resolveProductionRenderTierFrameFormat, resolveProductionVideoProfile, restoreAutoMovieRenderModeOnce, restoreAutoMovieRenderModeState, retireAutoMovieCubeShadowDepth, runAutoMovieCapture, runAutoMovieVideoCapture, sampleAutoMovieInspectionTrails, sampleCompiledEffect, sampleFormationCycleMatrix, sampleFormationMotion, sampleFormationSlotMotion, scaleAutoMovieCaptureLabels, selectAutoMovieDrawSubject, selectAutoMovieRenderBudget, selectFormationLod, serializeAutoMovieWebVttCueText, serializeAutoMovieWebVttIdentifier, serializeAutoMovieWebVttSingleLineText, sliceCaptionSidecar, spliceTangentNormal, stampAutoMovieDrawLegend, stampAutoMovieRasterLabel, subsurfaceFragment, subsurfacePhysicalChunk, subsurfaceTable, textureBindingAsset, updateAutoMovieComparisonCamera };
|
|
294
|
+
export { AUTOMOVIE_FORMATION_CYCLE_SAMPLES, AUTOMOVIE_GUIDE_PASSES, AUTOMOVIE_MP4_SRGB_COLOUR, AUTOMOVIE_MP4_UNITY_MATRIX, AUTOMOVIE_PRODUCTION_OPUS_PROFILE, AUTO_MOVIE_CAPTURE_PLAN_KEYS, AUTO_MOVIE_DRAW_GLOBALS, AUTO_MOVIE_INSPECTION_DEPTH_LEAD, AUTO_MOVIE_INSPECTION_KEYS, AUTO_MOVIE_INSPECTION_KINDS, AUTO_MOVIE_INSPECTION_PALETTE, AutoMovieCaptureFolder, AutoMovieDrawSession, AutoMovieFrameGrid, AutoMovieGeometryPhysicalVertices, AutoMoviePlayer, AutoMovieRasterSheet, AutoMovieResourceRetirementScope, AutoMovieSkinnedMesh, AutoMovieTextureCache, DEPTH_NORMALIZATION_RANGE, DETAIL_NORMAL_TARGET, EDGE_SHELL_NAME, EDGE_WIDTH, POSE_OVERLAY_NAME, RELIEF_WEIGHT_TARGET, SPACE_GROUP_NAME, SUBSURFACE_TARGET, addMaterialShaderPatch, applyAutoMovieDeliveryCrop, applyAutoMovieInspection, applyAutoMovieInspectionSection, applyAutoMovieInspectionShade, applyAutoMovieRigLocals, applyAutoMovieSectionPlanes, applyAutoMovieSemanticMask, applyAutoMovieShadowParticipation, applyAutoMovieViewerSubjectPose, applyDetailNormal, applyDualQuaternionSkinning, applyExpression, applyFormationCycleCadence, applyFormationCycleMaterial, applyLightMotion, applyLightState, applyMaterialOverlays, applyMaterialShaderPatches, applyObjectMotion, applyObjectMotions, applyPose, applyPracticalSurfaceMaterials, applyReliefWeights, applyRenderMode, applyRendererEnvironment, applySceneEnvironment, applySceneFog, applySubsurfaceShading, applyTransform, assertAutoMovieCaptureClock, assertAutoMovieSceneShadowProfile, assertAutoMovieViewerCameraDepthPrecision, assertProductionOpusProfile, assertProductionPngPicture, assertProductionVideoProfile, assessAutoMovieRenderBudget, attachAutoMovieSemanticMask, auditAutoMovieDecodedFrames, auditAutoMovieEncodedPresentation, auditAutoMovieRenderObservation, auditAutoMovieSemanticMaskScene, autoMovieAnalysisRampColor, autoMovieCaptionLanguageComparisonKey, autoMovieInspectionPathOf, autoMovieRenderBudgetEvidence, autoMovieRenderBudgetRefusal, autoMovieRenderTargetRendererOfGraphics, autoMovieRenderTargetSettingsOfShot, autoMovieSemanticMaskOf, autoMovieViewerNamedViewpoints, autoMovieViewerPoseFromHeading, autoMovieViewerSubjectKey, autoMovieViewerTurntableViewpoints, bakeFormationCycle, beatCaptions, bindAutoMovieDrawSceneSoftProps, buildAnalysisOverlayObject, buildAutoMovieConstruction, buildAutoMovieInspectionMarks, buildAutoMovieMaterialLibrary, buildFluidSprayObject, buildFluidSurfaceObject, buildGeometry, buildHumanCartoonFace, buildHumanPolygon, buildInstancedEffect, buildInstancedFormation, buildInstancedInstanceSet, buildLight, buildMaterial, buildModel, buildPlantingObject, buildPolygonShotActor, buildPropArticulation, buildScene, buildSceneSoftProps, buildSoftBodyObject, buildSpaceObject, canonicalProductionWebVtt, canonicalizeAutoMovieCaptionText, captureAutoMovieFramebufferRestore, captureAutoMovieMetricFrame, captureAutoMovieViewerSubjectView, captureViewerSnapshot, chooseAutoMovieInspectionMarks, collectAutoMovieOwnedResources, colorAutoMovieInspectionObjects, compareAutoMovieCaptureRounds, compareAutoMovieRasters, constructAutoMovieOwnedResources, createAutoMovieClosedSphereGeometry, createAutoMovieHttpArtifactStore, createAutoMovieHumanPolygonFigure, createAutoMovieInspectionDots, createAutoMovieInspectionStrokes, createAutoMovieMetricOrthographicCamera, createAutoMoviePhysicalPoseAdapter, createAutoMovieResourceRetirement, createAutoMovieSurfaceAppearance, createDetailNormalShaderPatch, createDualQuaternionSkinningShaderPatch, createImportedModelObject, createReliefWeightShaderPatch, decodeAutoMovieDrawPixels, decodeAutoMovieRasterPng, defaultMaterial, describeAutoMovieDrawScene, detailNormalFragment, detailNormalVertex, disposeCrossDissolve, disposeFadeToBlack, dualQuaternionSkinningOf, dualQuaternionSkinningVertex, encodeAutoMovieDrawPixels, encodeAutoMovieRasterPng, encodeAutoMovieWavPcm16, equalOrderedScalars, evaluateAutoMovieViewerCameraDepthPrecision, expandAutoMovieInspectionSweep, ffmpegArgs, flattenInstancedModel, flattenInstancedObject, focusAutoMovieInspection, formatAutoMovieCapturePlanRequest, formatAutoMovieInspectionCameraView, formatAutoMovieInspectionRequest, formatAutoMovieInspectionView, formationCycleCadence, formationCycleGait, formationCycleOf, formationCyclePosition, formationCycleStride, frameAutoMovieViewerSubject, frameName, framePattern, frameTimes, guardAutoMovieRenderModeRetirement, guardAutoMovieSceneShadowRetirement, guidePassFrameName, guidePassFramePattern, hashAutoMovieRasterImage, inspectAutoMovieCaptionReadabilityWithRuntime, installAutoMovieDraw, instancedModelParts, invalidateAutoMovieSceneShadowPrograms, invalidateAutoMovieSkinnedPose, isAutoMovieWebVttIdentifier, isGuidePass, legendAutoMovieInspectionMarks, listAutoMovieInspectionKinds, listAutoMovieInspectionPaths, mapImportedHumanoidBones, markAutoMovieInspectionTrails, maskColor, matchAutoMovieInspectionPath, materialOverlayFragment, materialOverlayVertex, materialTextureBindings, measureAutoMovieInspectionBounds, measureAutoMovieInspectionDefects, measureAutoMovieInspectionEdges, measureAutoMovieInspectionMeshes, measureAutoMovieInspectionPaths, mergeAutoMovieInspectionLegends, mixAutoMovieAudioPcm, normalizeGuidePasses, observeAutoMovieRendererFrame, parseAutoMovieCaptionLanguage, parseAutoMovieCapturePlanRequest, parseAutoMovieInspectionRequest, parseAutoMovieInspectionView, parseAutoMovieViewerSubjectKey, placeAutoMovieInspectionLabels, planAutoMovieCapture, planAutoMovieCaptureFrames, planAutoMovieCaptureLayout, planAutoMovieCaptureUrl, planAutoMovieDrawCall, planAutoMovieInspectionTrailTimes, planAutoMovieVideoEncoding, planAutoMovieVideoFrames, planAutoMovieVideoSceneCuts, planCaptionSidecar, planChunkedSequenceRender, planGuidePassOutputs, planPoseKeypointSidecar, planProductionRenderJob, planSequenceRender, planViewerFrameTimes, productionOpusDescription, productionVisualDeliveryOccurrence, readAutoMovieCaptureArguments, readAutoMovieCubeShadowDepth, readAutoMovieDeliveryCrop, readAutoMovieDisplayDestinationEncoding, readAutoMovieFilmDisplayTextureResidency, readAutoMovieMaterialTextureSources, readAutoMovieRenderTextureTarget, readAutoMovieShadowLightSource, readAutoMovieShadowTextureTargets, readAutoMovieTextureSource, readAutoMovieTransmissionTextureTarget, readAutoMovieVideoSceneCuts, regenerateFormationSlot, regenerateInstanceSlot, releaseViewerRenderer, reliefWeightFragment, reliefWeightVertex, renderAndSee, renderAutoMovieDrawnVideo, renderAutoMovieFilmFrame, renderAutoMovieScenePass, renderCaptionSidecar, renderCrossDissolve, renderCrossDissolveFrames, renderFadeToBlackFrame, renderPathStem, renderPoseKeypointSidecar, renderScreenplay, renderSequenceAndSee, renderSequenceVideo, renderVideo, replaceAutoMovieDrawInspection, reportAutoMovieResourceRetirement, resetAutoMovieSceneShadowTargets, resolveAutoMovieCapturePatterns, resolveAutoMovieFilmBeautyComposition, resolveAutoMovieInspectionColors, resolveAutoMovieInspectionView, resolveProductionPngProfile, resolveProductionRenderTierFrameFormat, resolveProductionVideoProfile, restoreAutoMovieRenderModeOnce, restoreAutoMovieRenderModeState, retireAutoMovieCubeShadowDepth, runAutoMovieCapture, runAutoMovieVideoCapture, sampleAutoMovieInspectionTrails, sampleCompiledEffect, sampleFormationCycleMatrix, sampleFormationMotion, sampleFormationSlotMotion, scaleAutoMovieCaptureLabels, selectAutoMovieDrawSubject, selectAutoMovieRenderBudget, selectFormationLod, serializeAutoMovieWebVttCueText, serializeAutoMovieWebVttIdentifier, serializeAutoMovieWebVttSingleLineText, sliceCaptionSidecar, spliceTangentNormal, stampAutoMovieDrawLegend, stampAutoMovieRasterLabel, subsurfaceFragment, subsurfacePhysicalChunk, subsurfaceTable, textureBindingAsset, updateAutoMovieComparisonCamera };
|
|
@@ -14,11 +14,10 @@ import type * as THREE from "three";
|
|
|
14
14
|
* The requirement asks for caster and receiver to be **distinguished** rather
|
|
15
15
|
* than blanket-enabled, and the product knows the difference at exactly one
|
|
16
16
|
* place, which is here. A model's parts are solids: they cast and they receive.
|
|
17
|
-
* The standable surfaces under {@link SPACE_GROUP_NAME} are
|
|
18
|
-
*
|
|
19
|
-
* volume-free patch casting onto its own plane produces depth acne,
|
|
20
|
-
*
|
|
21
|
-
* evidence of a physical floor. Anything carrying no geometry is untouched.
|
|
17
|
+
* The standable surfaces under {@link SPACE_GROUP_NAME} are open patches for
|
|
18
|
+
* structural guides and optional flat color. They neither cast nor receive.
|
|
19
|
+
* A volume-free patch casting onto its own plane produces depth acne, and its
|
|
20
|
+
* basic material has no shadow response. Objects without geometry are untouched.
|
|
22
21
|
*
|
|
23
22
|
* Exported, and separate from {@link buildScene}, for the reason
|
|
24
23
|
* {@link applySceneFog} is: a host that assembles its own scene graph — a
|
|
@@ -17,11 +17,10 @@ const buildSpace_js_1 = require("./buildSpace.js");
|
|
|
17
17
|
* The requirement asks for caster and receiver to be **distinguished** rather
|
|
18
18
|
* than blanket-enabled, and the product knows the difference at exactly one
|
|
19
19
|
* place, which is here. A model's parts are solids: they cast and they receive.
|
|
20
|
-
* The standable surfaces under {@link SPACE_GROUP_NAME} are
|
|
21
|
-
*
|
|
22
|
-
* volume-free patch casting onto its own plane produces depth acne,
|
|
23
|
-
*
|
|
24
|
-
* evidence of a physical floor. Anything carrying no geometry is untouched.
|
|
20
|
+
* The standable surfaces under {@link SPACE_GROUP_NAME} are open patches for
|
|
21
|
+
* structural guides and optional flat color. They neither cast nor receive.
|
|
22
|
+
* A volume-free patch casting onto its own plane produces depth acne, and its
|
|
23
|
+
* basic material has no shadow response. Objects without geometry are untouched.
|
|
25
24
|
*
|
|
26
25
|
* Exported, and separate from {@link buildScene}, for the reason
|
|
27
26
|
* {@link applySceneFog} is: a host that assembles its own scene graph — a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAutoMovieShadowParticipation.js","sourceRoot":"","sources":["../../src/scene/applyAutoMovieShadowParticipation.ts"],"names":[],"mappings":";;;AAEA,mDAAmD;AAEnD
|
|
1
|
+
{"version":3,"file":"applyAutoMovieShadowParticipation.js","sourceRoot":"","sources":["../../src/scene/applyAutoMovieShadowParticipation.ts"],"names":[],"mappings":";;;AAEA,mDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACI,MAAM,iCAAiC,GAElC,CAAC,IAAoB,EAAQ,EAAE;IACzC,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAA8C,EAAQ,EAAE;QACrE,IAAI,MAAM,CAAC,IAAI,KAAK,gCAAgB;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GACV,IAAI,GAAG,EAAkB,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,MAAM;QACxB,KAAK,CAAC,QAAQ,CACZ,CACE,UAAkD,EACL,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CACzE,CAAC;IACJ,IAAI,CAAC,QAAQ,CAAC,CAAC,MAA8C,EAAQ,EAAE;QACrE,2EAA2E;QAC3E,2EAA2E;QAC3E,0BAA0B;QAC1B,IAAK,MAAqB,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO;QACnD,MAAM,KAAK,GAAY,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,UAAU,GAAG,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,aAAa,GAAG,CAAC,KAAK,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAxBW,QAAA,iCAAiC,GAAjC,iCAAiC,CAwB5C"}
|
|
@@ -16,11 +16,10 @@ import "./buildSpace.mjs";
|
|
|
16
16
|
* The requirement asks for caster and receiver to be **distinguished** rather
|
|
17
17
|
* than blanket-enabled, and the product knows the difference at exactly one
|
|
18
18
|
* place, which is here. A model's parts are solids: they cast and they receive.
|
|
19
|
-
* The standable surfaces under {@link SPACE_GROUP_NAME} are
|
|
20
|
-
*
|
|
21
|
-
* volume-free patch casting onto its own plane produces depth acne,
|
|
22
|
-
*
|
|
23
|
-
* evidence of a physical floor. Anything carrying no geometry is untouched.
|
|
19
|
+
* The standable surfaces under {@link SPACE_GROUP_NAME} are open patches for
|
|
20
|
+
* structural guides and optional flat color. They neither cast nor receive.
|
|
21
|
+
* A volume-free patch casting onto its own plane produces depth acne, and its
|
|
22
|
+
* basic material has no shadow response. Objects without geometry are untouched.
|
|
24
23
|
*
|
|
25
24
|
* Exported, and separate from {@link buildScene}, for the reason
|
|
26
25
|
* {@link applySceneFog} is: a host that assembles its own scene graph — a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAutoMovieShadowParticipation.mjs","names":[],"sources":["../../src/scene/applyAutoMovieShadowParticipation.ts"],"sourcesContent":["import type * as THREE from \"three\";\n\nimport { SPACE_GROUP_NAME } from \"./buildSpace.js\";\n\n/**\n * Say which objects cast a shadow and which receive one.\n *\n * `stageScene` validates a light's `castShadow` and refuses shadow settings without it; the render inventory counts casters and its budget constrains that count. {@link buildLight} applies the flag and shadow camera settings, while {@link applyRendererEnvironment} sets the renderer shadow policy reversibly. This adapter supplies the remaining mesh participation flags; enabled maps and casting lights alone do not make a mesh participate.\n *\n * That absence is not visible as an absence. A benchmark authored a fascia and\n * soffit band with a deliberate dark recess above the wall, and the darkening\n * reads as a shadow in every captured frame while being nothing but geometry\n * and material response to light direction. Building the appearance out of\n * geometry is what an author reaches for when the mechanism is missing and no\n * gate says it is missing.\n *\n * The requirement asks for caster and receiver to be **distinguished** rather\n * than blanket-enabled, and the product knows the difference at exactly one\n * place, which is here. A model's parts are solids: they cast and they receive.\n * The standable surfaces under {@link SPACE_GROUP_NAME} are
|
|
1
|
+
{"version":3,"file":"applyAutoMovieShadowParticipation.mjs","names":[],"sources":["../../src/scene/applyAutoMovieShadowParticipation.ts"],"sourcesContent":["import type * as THREE from \"three\";\n\nimport { SPACE_GROUP_NAME } from \"./buildSpace.js\";\n\n/**\n * Say which objects cast a shadow and which receive one.\n *\n * `stageScene` validates a light's `castShadow` and refuses shadow settings without it; the render inventory counts casters and its budget constrains that count. {@link buildLight} applies the flag and shadow camera settings, while {@link applyRendererEnvironment} sets the renderer shadow policy reversibly. This adapter supplies the remaining mesh participation flags; enabled maps and casting lights alone do not make a mesh participate.\n *\n * That absence is not visible as an absence. A benchmark authored a fascia and\n * soffit band with a deliberate dark recess above the wall, and the darkening\n * reads as a shadow in every captured frame while being nothing but geometry\n * and material response to light direction. Building the appearance out of\n * geometry is what an author reaches for when the mechanism is missing and no\n * gate says it is missing.\n *\n * The requirement asks for caster and receiver to be **distinguished** rather\n * than blanket-enabled, and the product knows the difference at exactly one\n * place, which is here. A model's parts are solids: they cast and they receive.\n * The standable surfaces under {@link SPACE_GROUP_NAME} are open patches for\n * structural guides and optional flat color. They neither cast nor receive.\n * A volume-free patch casting onto its own plane produces depth acne, and its\n * basic material has no shadow response. Objects without geometry are untouched.\n *\n * Exported, and separate from {@link buildScene}, for the reason\n * {@link applySceneFog} is: a host that assembles its own scene graph — a\n * production's film page, which is what the offline renderer captures — must\n * make the same call, or it captures a production whose shadows were declared\n * and never drawn.\n *\n * A scene that declares no shadows is unaffected. `three.js` compiles no shadow\n * code and renders no depth pass while `renderer.shadowMap.enabled` is false,\n * so these flags are inert until a production turns shadows on, and only such a\n * production sees its frames change.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Marks actual mesh/skinned/instanced geometry as caster/receiver except descendants of the reserved semantic-space group; declared support patches have no physical volume and are structural-guide geometry, while renderer/light owners separately enable actual shadow rendering.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns object participation once for built and manually assembled scene hosts, keeping light shadow configuration and renderer policy with their own declarations.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Reserved SPACE_GROUP_NAME is a structural viewer identity rather than a fixture name; this uniformly overwrites mesh flags by role and does not emulate a shadow with dark geometry or replace Three internals.\n * @evidence contracts/development/common.md#meaningful-documentation Describes model/semantic-ground distinction, mesh subclasses and the separate enabled-renderer/casting-light prerequisites; flags alone do not prove a visible shadow.\n * @evidence contracts/development/implementation.md#efficient-algorithms Traverses the scene to find reserved groups, visits their descendants into an identity Set and traverses meshes again for constant-time membership; time is O(objects plus reserved descendant visits), potentially repeated for nested reserved groups, and temporary space is linear in semantic-ground objects.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses the reserved shared naming contract and one ground Set within a call; scene hierarchy/roles can change, so no cross-call participation cache is retained.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Borrows scene objects, retains only temporary group/ground collections and acquires no shadow map or task; persistent boolean flags remain with each host-owned object.\n */\nexport const applyAutoMovieShadowParticipation: (\n root: THREE.Object3D,\n) => void = (root: THREE.Object3D): void => {\n const groups: THREE.Object3D[] = [];\n root.traverse((object: THREE.Object3D<THREE.Object3DEventMap>): void => {\n if (object.name === SPACE_GROUP_NAME) groups.push(object);\n });\n const ground: Set<THREE.Object3D<THREE.Object3DEventMap>> =\n new Set<THREE.Object3D>();\n for (const group of groups)\n group.traverse(\n (\n descendant: THREE.Object3D<THREE.Object3DEventMap>,\n ): Set<THREE.Object3D<THREE.Object3DEventMap>> => ground.add(descendant),\n );\n root.traverse((object: THREE.Object3D<THREE.Object3DEventMap>): void => {\n // `isMesh` covers `SkinnedMesh` and `InstancedMesh`, which is what makes a\n // compact population of several thousand members participate as one object\n // rather than not at all.\n if ((object as THREE.Mesh).isMesh !== true) return;\n const patch: boolean = ground.has(object);\n object.castShadow = !patch;\n object.receiveShadow = !patch;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,qCAEA,SAA+B;CAC1C,MAAM,SAA2B,CAAC;CAClC,KAAK,UAAU,WAAyD;EACtE,IAAI,OAAO,SAAA,qBAA2B,OAAO,KAAK,MAAM;CAC1D,CAAC;CACD,MAAM,yBACJ,IAAI,IAAoB;CAC1B,KAAK,MAAM,SAAS,QAClB,MAAM,UAEF,eACgD,OAAO,IAAI,UAAU,CACzE;CACF,KAAK,UAAU,WAAyD;EAItE,IAAK,OAAsB,WAAW,MAAM;EAC5C,MAAM,QAAiB,OAAO,IAAI,MAAM;EACxC,OAAO,aAAa,CAAC;EACrB,OAAO,gBAAgB,CAAC;CAC1B,CAAC;AACH"}
|
|
@@ -7,6 +7,7 @@ import { IAutoMovieTextureResolver } from "./IAutoMovieTextureResolver.js";
|
|
|
7
7
|
* meaning and leaving an omitted lobe at its neutral value. It
|
|
8
8
|
* carries the material's name, or its id when unnamed, as the glTF export
|
|
9
9
|
* does, so a preview can recognise a finish by it.
|
|
10
|
+
* A fully transparent blended surface with no transmission skips color, depth and shadow draws.
|
|
10
11
|
* The producer owns its new material before resolving texture bindings. Setup
|
|
11
12
|
* failure retires that material and preserves cleanup causes; resolver textures
|
|
12
13
|
* and shared shader tables remain owned by their actual producers.
|
|
@@ -46,6 +46,7 @@ const index_js_3 = require("./subsurfaceShading/index.js");
|
|
|
46
46
|
* meaning and leaving an omitted lobe at its neutral value. It
|
|
47
47
|
* carries the material's name, or its id when unnamed, as the glTF export
|
|
48
48
|
* does, so a preview can recognise a finish by it.
|
|
49
|
+
* A fully transparent blended surface with no transmission skips color, depth and shadow draws.
|
|
49
50
|
* The producer owns its new material before resolving texture bindings. Setup
|
|
50
51
|
* failure retires that material and preserves cleanup causes; resolver textures
|
|
51
52
|
* and shared shader tables remain owned by their actual producers.
|
|
@@ -70,6 +71,10 @@ const buildMaterial = (material, resolveTexture) => {
|
|
|
70
71
|
transparent: alphaMode === "blend",
|
|
71
72
|
depthWrite: alphaMode !== "blend",
|
|
72
73
|
opacity: material.opacity,
|
|
74
|
+
// Three's shadow materials copy alpha tests and maps, but do not copy opacity.
|
|
75
|
+
visible: !(alphaMode === "blend" &&
|
|
76
|
+
material.opacity === 0 &&
|
|
77
|
+
(material.transmission ?? 0) === 0),
|
|
73
78
|
alphaTest: alphaMode === "mask" ? (material.alphaCutoff ?? 0.5) : 0,
|
|
74
79
|
side: material.doubleSided === true ? THREE.DoubleSide : THREE.FrontSide,
|
|
75
80
|
transmission: material.transmission ?? 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildMaterial.js","sourceRoot":"","sources":["../../src/scene/buildMaterial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAY,KAAK,kCAAc;AAG/B,+FAAyF;AACzF,6DAAmE;AACnE,gEAA0E;AAC1E,6FAAuF;AACvF,2DAAsE;AAEtE
|
|
1
|
+
{"version":3,"file":"buildMaterial.js","sourceRoot":"","sources":["../../src/scene/buildMaterial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAY,KAAK,kCAAc;AAG/B,+FAAyF;AACzF,6DAAmE;AACnE,gEAA0E;AAC1E,6FAAuF;AACvF,2DAAsE;AAEtE;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,aAAa,GAGQ,CAChC,QAA4B,EAC5B,cAA0C,EACd,EAAE;IAC9B,OAAO,IAAA,sEAAgC,EACrC,CACE,GAEa,EACe,EAAE;QAC9B,MAAM,CAAC,GAAoB,QAAQ,CAAC,SAAS,CAAC;QAC9C,MAAM,SAAS,GACb,QAAQ,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACpE,MAAM,GAAG,GAA+B,GAAG,CACzC,IAAI,KAAK,CAAC,oBAAoB,CAAC;YAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,EAAE;YAClC,KAAK,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACrC,SAAS,EAAE,QAAQ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AG,CAAC,KAAK,GAAG,IAAA,oEAA+B,EACzC,QAAQ,CAAC,gBAAgB,EACzB,QAAQ,EACR,cAAc,CACf,CAAC;QACF,GAAG,CAAC,cAAc,GAAG,QAAQ,CAAC,iBAAiB,IAAI,CAAC,CAAC;QACrD,GAAG,CAAC,WAAW,GAAG,IAAA,oEAA+B,EAC/C,QAAQ,CAAC,eAAe,EACxB,MAAM,EACN,cAAc,CACf,CAAC;QACF,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI;YAC5B,GAAG,CAAC,QAAQ,GAAG,IAAI,KAAK,CAAC,KAAK,CAC5B,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACnB,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACnB,QAAQ,CAAC,QAAQ,CAAC,CAAC,CACpB,CAAC;aACC,IAAI,GAAG,CAAC,WAAW,KAAK,IAAI;YAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AA5LW,QAAA,aAAa,GAAb,aAAa,CA4LxB"}
|
|
@@ -14,6 +14,7 @@ import * as THREE from "three";
|
|
|
14
14
|
* meaning and leaving an omitted lobe at its neutral value. It
|
|
15
15
|
* carries the material's name, or its id when unnamed, as the glTF export
|
|
16
16
|
* does, so a preview can recognise a finish by it.
|
|
17
|
+
* A fully transparent blended surface with no transmission skips color, depth and shadow draws.
|
|
17
18
|
* The producer owns its new material before resolving texture bindings. Setup
|
|
18
19
|
* failure retires that material and preserves cleanup causes; resolver textures
|
|
19
20
|
* and shared shader tables remain owned by their actual producers.
|
|
@@ -38,6 +39,7 @@ const buildMaterial = (material, resolveTexture) => {
|
|
|
38
39
|
transparent: alphaMode === "blend",
|
|
39
40
|
depthWrite: alphaMode !== "blend",
|
|
40
41
|
opacity: material.opacity,
|
|
42
|
+
visible: !(alphaMode === "blend" && material.opacity === 0 && (material.transmission ?? 0) === 0),
|
|
41
43
|
alphaTest: alphaMode === "mask" ? material.alphaCutoff ?? .5 : 0,
|
|
42
44
|
side: material.doubleSided === true ? THREE.DoubleSide : THREE.FrontSide,
|
|
43
45
|
transmission: material.transmission ?? 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildMaterial.mjs","names":[],"sources":["../../src/scene/buildMaterial.ts"],"sourcesContent":["import {\n type IAutoMovieColor,\n IAutoMovieMaterial,\n type IAutoMovieMaterialOverlay,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport { IAutoMovieTextureResolver } from \"./IAutoMovieTextureResolver.js\";\nimport { constructAutoMovieOwnedResources } from \"./constructAutoMovieOwnedResources.js\";\nimport { applyDetailNormal } from \"./detailNormalShading/index.js\";\nimport { applyMaterialOverlays } from \"./materialOverlayShading/index.js\";\nimport { resolveAutoMovieMaterialTexture } from \"./resolveAutoMovieMaterialTexture.js\";\nimport { applySubsurfaceShading } from \"./subsurfaceShading/index.js\";\n\n/**\n * Build a `three.js` physical PBR material from an automovie material, mapping\n * each optional lobe to the `MeshPhysicalMaterial` property of the same glTF\n * meaning and leaving an omitted lobe at its neutral value. It\n * carries the material's name, or its id when unnamed, as the glTF export\n * does, so a preview can recognise a finish by it.\n * The producer owns its new material before resolving texture bindings. Setup\n * failure retires that material and preserves cleanup causes; resolver textures\n * and shared shader tables remain owned by their actual producers.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Maps admitted linear PBR coefficients/alpha policy and the glTF anisotropy, sheen, specular and volume parameters (degrees to radians, a declared sheen at intensity one) into MeshPhysicalMaterial and resolves binding-private textures with explicit color-space roles; glTF combined metallic-roughness uses one shared binding, while subsurface/detail/overlay shader features follow their actual producer conventions rather than claiming a measured full spectral material model.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns material field realization and delegates sampler admission plus feature-specific shader injection to their existing owners; optional omission yields documented scalar/default behavior without a second material representation.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Uses authored coefficients and contract defaults (mask cutoff0.5, ior1.5, specular intensity 1, isotropic and sheen-free lobes, neutral overlay factors), not expected-frame textures; no resolver/global method is replaced, and unresolved optional maps produce scalar material rather than pretending an image was decoded.\n * @evidence contracts/development/common.md#meaningful-documentation Documents name/id identity, new-material ownership, separate texture/shared-table lifetime and failure preservation; individual texture roles and detail-only normal fallback are explicit in their owning helpers/comments.\n * @evidence contracts/development/implementation.md#efficient-algorithms Performs fixed PBR/binding setup plus O(K) authored overlay resolution and feature source initialization; material storage grows with active texture/overlay bindings, not mesh vertices or instance population, and combined metallic/roughness reuses one resolved texture.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Resolves the shared metallic-roughness binding once and borrows primed texture-cache bindings, while model/library owners share equivalent material variants across parts/surfaces; this producer creates one independent material per request.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Registers its new material before binding/shader setup and retires it on failure; successful material transfers to caller, whereas resolver texture wrappers and shader tables stay with their owning cache/producer. Material references retain borrowed bindings until the material/owner becomes unreachable.\n */\nexport const buildMaterial: (\n material: IAutoMovieMaterial,\n resolveTexture?: IAutoMovieTextureResolver,\n) => THREE.MeshPhysicalMaterial = (\n material: IAutoMovieMaterial,\n resolveTexture?: IAutoMovieTextureResolver,\n): THREE.MeshPhysicalMaterial => {\n return constructAutoMovieOwnedResources(\n (\n own: <Resource extends { dispose(): void }>(\n resource: Resource,\n ) => Resource,\n ): THREE.MeshPhysicalMaterial => {\n const c: IAutoMovieColor = material.baseColor;\n const alphaMode: string =\n material.alphaMode ?? (material.opacity < 1 ? \"blend\" : \"opaque\");\n const std: THREE.MeshPhysicalMaterial = own(\n new THREE.MeshPhysicalMaterial({\n name: material.name ?? material.id,\n color: new THREE.Color(c.r, c.g, c.b),\n metalness: material.metallic,\n roughness: material.roughness,\n transparent: alphaMode === \"blend\",\n depthWrite: alphaMode !== \"blend\",\n opacity: material.opacity,\n alphaTest: alphaMode === \"mask\" ? (material.alphaCutoff ?? 0.5) : 0,\n side:\n material.doubleSided === true ? THREE.DoubleSide : THREE.FrontSide,\n transmission: material.transmission ?? 0,\n ior: material.ior ?? 1.5,\n thickness: material.thickness ?? 0,\n clearcoat: material.clearcoat ?? 0,\n specularIntensity: material.specularIntensity ?? 1,\n anisotropy: material.anisotropy?.strength ?? 0,\n anisotropyRotation:\n ((material.anisotropy?.rotationDeg ?? 0) * Math.PI) / 180,\n // glTF sheen has no intensity factor: a declared lobe is at full\n // intensity and its colour scales it\n sheen: material.sheen === undefined ? 0 : 1,\n sheenRoughness: material.sheen?.roughness ?? 1,\n }),\n );\n if (material.sheen !== undefined)\n std.sheenColor.setRGB(\n material.sheen.color.r,\n material.sheen.color.g,\n material.sheen.color.b,\n );\n if (material.subsurfaceRadius !== undefined)\n applySubsurfaceShading(std, material.subsurfaceRadius);\n std.map = resolveAutoMovieMaterialTexture(\n material.baseColorTexture,\n \"srgb\",\n resolveTexture,\n );\n const metallicRoughness: THREE.Texture<\n unknown,\n THREE.TextureEventMap\n > | null = resolveAutoMovieMaterialTexture(\n material.metallicRoughnessTexture,\n \"linear\",\n resolveTexture,\n );\n std.metalnessMap = metallicRoughness;\n std.roughnessMap = metallicRoughness;\n std.normalMap = resolveAutoMovieMaterialTexture(\n material.normalTexture,\n \"linear\",\n resolveTexture,\n );\n if (material.normalScale !== undefined)\n std.normalScale.setScalar(material.normalScale);\n const detailNormal: THREE.Texture<unknown, THREE.TextureEventMap> | null =\n resolveAutoMovieMaterialTexture(\n material.detailNormalTexture,\n \"linear\",\n resolveTexture,\n );\n if (detailNormal !== null) {\n if (std.normalMap !== null)\n applyDetailNormal(std, detailNormal, material.detailNormalScale ?? 1);\n else {\n // a detail map alone stands in as the normal map\n std.normalMap = detailNormal;\n std.normalScale.setScalar(material.detailNormalScale ?? 1);\n }\n }\n const overlays: {\n color: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n }[] = (material.overlays ?? []).map(\n (\n overlay: IAutoMovieMaterialOverlay,\n ): {\n color: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n } => ({\n color: resolveAutoMovieMaterialTexture(\n overlay.baseColorTexture,\n \"srgb\",\n resolveTexture,\n ),\n blend: overlay.blend,\n colorFactor: overlay.colorFactor ?? { r: 1, g: 1, b: 1 },\n roughness: overlay.roughness ?? null,\n normal: resolveAutoMovieMaterialTexture(\n overlay.normalTexture,\n \"linear\",\n resolveTexture,\n ),\n normalScale: overlay.normalScale ?? 1,\n strength: overlay.strength,\n }),\n );\n // an overlay shows only through its colour image; without a resolver there\n // is none, and the material shows alone\n applyMaterialOverlays(\n std,\n overlays.flatMap(\n (overlay: {\n color: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n }): {\n color: THREE.Texture<unknown, THREE.TextureEventMap>;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n }[] =>\n overlay.color === null\n ? []\n : [{ ...overlay, color: overlay.color }],\n ),\n );\n std.thicknessMap = resolveAutoMovieMaterialTexture(\n material.thicknessTexture,\n \"linear\",\n resolveTexture,\n );\n std.anisotropyMap = resolveAutoMovieMaterialTexture(\n material.anisotropy?.texture,\n \"linear\",\n resolveTexture,\n );\n std.aoMap = resolveAutoMovieMaterialTexture(\n material.occlusionTexture,\n \"linear\",\n resolveTexture,\n );\n std.aoMapIntensity = material.occlusionStrength ?? 1;\n std.emissiveMap = resolveAutoMovieMaterialTexture(\n material.emissiveTexture,\n \"srgb\",\n resolveTexture,\n );\n if (material.emissive !== null)\n std.emissive = new THREE.Color(\n material.emissive.r,\n material.emissive.g,\n material.emissive.b,\n );\n else if (std.emissiveMap !== null) std.emissive.setRGB(1, 1, 1);\n return std;\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,iBAIX,UACA,mBAC+B;CAC/B,OAAO,kCAEH,QAG+B;EAC/B,MAAM,IAAqB,SAAS;EACpC,MAAM,YACJ,SAAS,cAAc,SAAS,UAAU,IAAI,UAAU;EAC1D,MAAM,MAAkC,IACtC,IAAI,MAAM,qBAAqB;GAC7B,MAAM,SAAS,QAAQ,SAAS;GAChC,OAAO,IAAI,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;GACpC,WAAW,SAAS;GACpB,WAAW,SAAS;GACpB,aAAa,cAAc;GAC3B,YAAY,cAAc;GAC1B,SAAS,SAAS;GAClB,WAAW,cAAc,SAAU,SAAS,eAAe,KAAO;GAClE,MACE,SAAS,gBAAgB,OAAO,MAAM,aAAa,MAAM;GAC3D,cAAc,SAAS,gBAAgB;GACvC,KAAK,SAAS,OAAO;GACrB,WAAW,SAAS,aAAa;GACjC,WAAW,SAAS,aAAa;GACjC,mBAAmB,SAAS,qBAAqB;GACjD,YAAY,SAAS,YAAY,YAAY;GAC7C,qBACI,SAAS,YAAY,eAAe,KAAK,KAAK,KAAM;GAGxD,OAAO,SAAS,UAAU,KAAA,IAAY,IAAI;GAC1C,gBAAgB,SAAS,OAAO,aAAa;EAC/C,CAAC,CACH;EACA,IAAI,SAAS,UAAU,KAAA,GACrB,IAAI,WAAW,OACb,SAAS,MAAM,MAAM,GACrB,SAAS,MAAM,MAAM,GACrB,SAAS,MAAM,MAAM,CACvB;EACF,IAAI,SAAS,qBAAqB,KAAA,GAChC,uBAAuB,KAAK,SAAS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S,CACpB;OACG,IAAI,IAAI,gBAAgB,MAAM,IAAI,SAAS,OAAO,GAAG,GAAG,CAAC;EAC9D,OAAO;CACT,CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"buildMaterial.mjs","names":[],"sources":["../../src/scene/buildMaterial.ts"],"sourcesContent":["import {\n type IAutoMovieColor,\n IAutoMovieMaterial,\n type IAutoMovieMaterialOverlay,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport { IAutoMovieTextureResolver } from \"./IAutoMovieTextureResolver.js\";\nimport { constructAutoMovieOwnedResources } from \"./constructAutoMovieOwnedResources.js\";\nimport { applyDetailNormal } from \"./detailNormalShading/index.js\";\nimport { applyMaterialOverlays } from \"./materialOverlayShading/index.js\";\nimport { resolveAutoMovieMaterialTexture } from \"./resolveAutoMovieMaterialTexture.js\";\nimport { applySubsurfaceShading } from \"./subsurfaceShading/index.js\";\n\n/**\n * Build a `three.js` physical PBR material from an automovie material, mapping\n * each optional lobe to the `MeshPhysicalMaterial` property of the same glTF\n * meaning and leaving an omitted lobe at its neutral value. It\n * carries the material's name, or its id when unnamed, as the glTF export\n * does, so a preview can recognise a finish by it.\n * A fully transparent blended surface with no transmission skips color, depth and shadow draws.\n * The producer owns its new material before resolving texture bindings. Setup\n * failure retires that material and preserves cleanup causes; resolver textures\n * and shared shader tables remain owned by their actual producers.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Maps admitted linear PBR coefficients/alpha policy and the glTF anisotropy, sheen, specular and volume parameters (degrees to radians, a declared sheen at intensity one) into MeshPhysicalMaterial and resolves binding-private textures with explicit color-space roles; glTF combined metallic-roughness uses one shared binding, while subsurface/detail/overlay shader features follow their actual producer conventions rather than claiming a measured full spectral material model.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns material field realization and delegates sampler admission plus feature-specific shader injection to their existing owners; optional omission yields documented scalar/default behavior without a second material representation.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Uses authored coefficients and contract defaults (mask cutoff0.5, ior1.5, specular intensity 1, isotropic and sheen-free lobes, neutral overlay factors), not expected-frame textures; no resolver/global method is replaced, and unresolved optional maps produce scalar material rather than pretending an image was decoded.\n * @evidence contracts/development/common.md#meaningful-documentation Documents name/id identity, new-material ownership, separate texture/shared-table lifetime and failure preservation; individual texture roles and detail-only normal fallback are explicit in their owning helpers/comments.\n * @evidence contracts/development/implementation.md#efficient-algorithms Performs fixed PBR/binding setup plus O(K) authored overlay resolution and feature source initialization; material storage grows with active texture/overlay bindings, not mesh vertices or instance population, and combined metallic/roughness reuses one resolved texture.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Resolves the shared metallic-roughness binding once and borrows primed texture-cache bindings, while model/library owners share equivalent material variants across parts/surfaces; this producer creates one independent material per request.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Registers its new material before binding/shader setup and retires it on failure; successful material transfers to caller, whereas resolver texture wrappers and shader tables stay with their owning cache/producer. Material references retain borrowed bindings until the material/owner becomes unreachable.\n */\nexport const buildMaterial: (\n material: IAutoMovieMaterial,\n resolveTexture?: IAutoMovieTextureResolver,\n) => THREE.MeshPhysicalMaterial = (\n material: IAutoMovieMaterial,\n resolveTexture?: IAutoMovieTextureResolver,\n): THREE.MeshPhysicalMaterial => {\n return constructAutoMovieOwnedResources(\n (\n own: <Resource extends { dispose(): void }>(\n resource: Resource,\n ) => Resource,\n ): THREE.MeshPhysicalMaterial => {\n const c: IAutoMovieColor = material.baseColor;\n const alphaMode: string =\n material.alphaMode ?? (material.opacity < 1 ? \"blend\" : \"opaque\");\n const std: THREE.MeshPhysicalMaterial = own(\n new THREE.MeshPhysicalMaterial({\n name: material.name ?? material.id,\n color: new THREE.Color(c.r, c.g, c.b),\n metalness: material.metallic,\n roughness: material.roughness,\n transparent: alphaMode === \"blend\",\n depthWrite: alphaMode !== \"blend\",\n opacity: material.opacity,\n // Three's shadow materials copy alpha tests and maps, but do not copy opacity.\n visible: !(\n alphaMode === \"blend\" &&\n material.opacity === 0 &&\n (material.transmission ?? 0) === 0\n ),\n alphaTest: alphaMode === \"mask\" ? (material.alphaCutoff ?? 0.5) : 0,\n side:\n material.doubleSided === true ? THREE.DoubleSide : THREE.FrontSide,\n transmission: material.transmission ?? 0,\n ior: material.ior ?? 1.5,\n thickness: material.thickness ?? 0,\n clearcoat: material.clearcoat ?? 0,\n specularIntensity: material.specularIntensity ?? 1,\n anisotropy: material.anisotropy?.strength ?? 0,\n anisotropyRotation:\n ((material.anisotropy?.rotationDeg ?? 0) * Math.PI) / 180,\n // glTF sheen has no intensity factor: a declared lobe is at full\n // intensity and its colour scales it\n sheen: material.sheen === undefined ? 0 : 1,\n sheenRoughness: material.sheen?.roughness ?? 1,\n }),\n );\n if (material.sheen !== undefined)\n std.sheenColor.setRGB(\n material.sheen.color.r,\n material.sheen.color.g,\n material.sheen.color.b,\n );\n if (material.subsurfaceRadius !== undefined)\n applySubsurfaceShading(std, material.subsurfaceRadius);\n std.map = resolveAutoMovieMaterialTexture(\n material.baseColorTexture,\n \"srgb\",\n resolveTexture,\n );\n const metallicRoughness: THREE.Texture<\n unknown,\n THREE.TextureEventMap\n > | null = resolveAutoMovieMaterialTexture(\n material.metallicRoughnessTexture,\n \"linear\",\n resolveTexture,\n );\n std.metalnessMap = metallicRoughness;\n std.roughnessMap = metallicRoughness;\n std.normalMap = resolveAutoMovieMaterialTexture(\n material.normalTexture,\n \"linear\",\n resolveTexture,\n );\n if (material.normalScale !== undefined)\n std.normalScale.setScalar(material.normalScale);\n const detailNormal: THREE.Texture<unknown, THREE.TextureEventMap> | null =\n resolveAutoMovieMaterialTexture(\n material.detailNormalTexture,\n \"linear\",\n resolveTexture,\n );\n if (detailNormal !== null) {\n if (std.normalMap !== null)\n applyDetailNormal(std, detailNormal, material.detailNormalScale ?? 1);\n else {\n // a detail map alone stands in as the normal map\n std.normalMap = detailNormal;\n std.normalScale.setScalar(material.detailNormalScale ?? 1);\n }\n }\n const overlays: {\n color: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n }[] = (material.overlays ?? []).map(\n (\n overlay: IAutoMovieMaterialOverlay,\n ): {\n color: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n } => ({\n color: resolveAutoMovieMaterialTexture(\n overlay.baseColorTexture,\n \"srgb\",\n resolveTexture,\n ),\n blend: overlay.blend,\n colorFactor: overlay.colorFactor ?? { r: 1, g: 1, b: 1 },\n roughness: overlay.roughness ?? null,\n normal: resolveAutoMovieMaterialTexture(\n overlay.normalTexture,\n \"linear\",\n resolveTexture,\n ),\n normalScale: overlay.normalScale ?? 1,\n strength: overlay.strength,\n }),\n );\n // an overlay shows only through its colour image; without a resolver there\n // is none, and the material shows alone\n applyMaterialOverlays(\n std,\n overlays.flatMap(\n (overlay: {\n color: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n }): {\n color: THREE.Texture<unknown, THREE.TextureEventMap>;\n blend: \"multiply\" | \"replace\";\n colorFactor: { r: number; g: number; b: number };\n roughness: number | null;\n normal: THREE.Texture<unknown, THREE.TextureEventMap> | null;\n normalScale: number;\n strength: number;\n }[] =>\n overlay.color === null\n ? []\n : [{ ...overlay, color: overlay.color }],\n ),\n );\n std.thicknessMap = resolveAutoMovieMaterialTexture(\n material.thicknessTexture,\n \"linear\",\n resolveTexture,\n );\n std.anisotropyMap = resolveAutoMovieMaterialTexture(\n material.anisotropy?.texture,\n \"linear\",\n resolveTexture,\n );\n std.aoMap = resolveAutoMovieMaterialTexture(\n material.occlusionTexture,\n \"linear\",\n resolveTexture,\n );\n std.aoMapIntensity = material.occlusionStrength ?? 1;\n std.emissiveMap = resolveAutoMovieMaterialTexture(\n material.emissiveTexture,\n \"srgb\",\n resolveTexture,\n );\n if (material.emissive !== null)\n std.emissive = new THREE.Color(\n material.emissive.r,\n material.emissive.g,\n material.emissive.b,\n );\n else if (std.emissiveMap !== null) std.emissive.setRGB(1, 1, 1);\n return std;\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,iBAIX,UACA,mBAC+B;CAC/B,OAAO,kCAEH,QAG+B;EAC/B,MAAM,IAAqB,SAAS;EACpC,MAAM,YACJ,SAAS,cAAc,SAAS,UAAU,IAAI,UAAU;EAC1D,MAAM,MAAkC,IACtC,IAAI,MAAM,qBAAqB;GAC7B,MAAM,SAAS,QAAQ,SAAS;GAChC,OAAO,IAAI,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;GACpC,WAAW,SAAS;GACpB,WAAW,SAAS;GACpB,aAAa,cAAc;GAC3B,YAAY,cAAc;GAC1B,SAAS,SAAS;GAElB,SAAS,EACP,cAAc,WACd,SAAS,YAAY,MACpB,SAAS,gBAAgB,OAAO;GAEnC,WAAW,cAAc,SAAU,SAAS,eAAe,KAAO;GAClE,MACE,SAAS,gBAAgB,OAAO,MAAM,aAAa,MAAM;GAC3D,cAAc,SAAS,gBAAgB;GACvC,KAAK,SAAS,OAAO;GACrB,WAAW,SAAS,aAAa;GACjC,WAAW,SAAS,aAAa;GACjC,mBAAmB,SAAS,qBAAqB;GACjD,YAAY,SAAS,YAAY,YAAY;GAC7C,qBACI,SAAS,YAAY,eAAe,KAAK,KAAK,KAAM;GAGxD,OAAO,SAAS,UAAU,KAAA,IAAY,IAAI;GAC1C,gBAAgB,SAAS,OAAO,aAAa;EAC/C,CAAC,CACH;EACA,IAAI,SAAS,UAAU,KAAA,GACrB,IAAI,WAAW,OACb,S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,SAAS,iBACT,QACA,cACF;EACA,IAAI,SAAS,aAAa,MACxB,IAAI,WAAW,IAAI,MAAM,MACvB,SAAS,SAAS,GAClB,SAAS,SAAS,GAClB,SAAS,SAAS,CACpB;OACG,IAAI,IAAI,gBAAgB,MAAM,IAAI,SAAS,OAAO,GAAG,GAAG,CAAC;EAC9D,OAAO;CACT,CACF;AACF"}
|
|
@@ -51,6 +51,7 @@ import type { IAutoMovieTextureResolver } from "./IAutoMovieTextureResolver.js";
|
|
|
51
51
|
* cannot follow a morph or replace a transformed normal-map frame. This
|
|
52
52
|
* changes no source arrays or material coefficients, is not a MikkTSpace bake
|
|
53
53
|
* guarantee and leaves degenerate UVs on their existing fallback.
|
|
54
|
+
* Fully transparent, non-transmissive parts stay hidden when a guide swaps materials.
|
|
54
55
|
*
|
|
55
56
|
* @evidence contracts/development/implementation.md#principled-implementation Builds admitted semantic bone rest TR and part TRS, binds skin joints or rigid attached bones, selects linear or dual quaternion skinning per skin through the material shader patch and matching shadow materials, realizes geometry/PBR through their canonical owners and derives vertex tangents only for anisotropic rigid, morph-free, normal-map-free indexed normal/UV geometry. Nonfinite/zero derived axes discard the new attribute; mapped/deforming or unsupported geometry retains its existing derivative-frame limitations. Consistent source normals remain a premise; this is not a MikkTSpace bake guarantee. AttachedBone intentionally takes precedence over skin, bone rest scale is unit by engine convention and complete finite/unique hierarchy/material admission remains upstream.
|
|
56
57
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns one model graph plus semantic bone/part registries, one skeleton per ordered joint list, material variants by definition id with vertex-color/relief/skinning-method flags and one patched shadow pair per dual quaternion mesh; geometry, physical-vertex mapping, material shading and imported appearances remain separate producers.
|
package/lib/scene/buildModel.js
CHANGED
|
@@ -93,6 +93,7 @@ const index_js_2 = require("./reliefWeightShading/index.js");
|
|
|
93
93
|
* cannot follow a morph or replace a transformed normal-map frame. This
|
|
94
94
|
* changes no source arrays or material coefficients, is not a MikkTSpace bake
|
|
95
95
|
* guarantee and leaves degenerate UVs on their existing fallback.
|
|
96
|
+
* Fully transparent, non-transmissive parts stay hidden when a guide swaps materials.
|
|
96
97
|
*
|
|
97
98
|
* @evidence contracts/development/implementation.md#principled-implementation Builds admitted semantic bone rest TR and part TRS, binds skin joints or rigid attached bones, selects linear or dual quaternion skinning per skin through the material shader patch and matching shadow materials, realizes geometry/PBR through their canonical owners and derives vertex tangents only for anisotropic rigid, morph-free, normal-map-free indexed normal/UV geometry. Nonfinite/zero derived axes discard the new attribute; mapped/deforming or unsupported geometry retains its existing derivative-frame limitations. Consistent source normals remain a premise; this is not a MikkTSpace bake guarantee. AttachedBone intentionally takes precedence over skin, bone rest scale is unit by engine convention and complete finite/unique hierarchy/material admission remains upstream.
|
|
98
99
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns one model graph plus semantic bone/part registries, one skeleton per ordered joint list, material variants by definition id with vertex-color/relief/skinning-method flags and one patched shadow pair per dual quaternion mesh; geometry, physical-vertex mapping, material shading and imported appearances remain separate producers.
|
|
@@ -201,6 +202,7 @@ const buildModel = (model, resolveTexture) => {
|
|
|
201
202
|
const mesh = skin !== null
|
|
202
203
|
? new AutoMovieSkinnedMesh_js_1.AutoMovieSkinnedMesh(geo, mat, skin.method ?? "linear")
|
|
203
204
|
: new THREE.Mesh(geo, mat);
|
|
205
|
+
mesh.visible = mat.visible;
|
|
204
206
|
mesh.name = part.name ?? part.id;
|
|
205
207
|
parts.set(part.id, mesh);
|
|
206
208
|
// Three's Mesh constructor ran updateMorphTargets(), so the dictionary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildModel.js","sourceRoot":"","sources":["../../src/scene/buildModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAY,KAAK,kCAAc;AAE/B,uEAAiE;AAGjE,2DAAqD;AACrD,yDAAmD;AACnD,yDAAmD;AACnD,+FAAyF;AACzF,6DAAuD;AACvD,gEAAgF;AAChF,6DAAoE;AAEpE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AAK;YACL,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;SAChE,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AA9PW,QAAA,UAAU,GAAV,UAAU,CA8PrB"}
|
package/lib/scene/buildModel.mjs
CHANGED
|
@@ -59,6 +59,7 @@ import * as THREE from "three";
|
|
|
59
59
|
* cannot follow a morph or replace a transformed normal-map frame. This
|
|
60
60
|
* changes no source arrays or material coefficients, is not a MikkTSpace bake
|
|
61
61
|
* guarantee and leaves degenerate UVs on their existing fallback.
|
|
62
|
+
* Fully transparent, non-transmissive parts stay hidden when a guide swaps materials.
|
|
62
63
|
*
|
|
63
64
|
* @evidence contracts/development/implementation.md#principled-implementation Builds admitted semantic bone rest TR and part TRS, binds skin joints or rigid attached bones, selects linear or dual quaternion skinning per skin through the material shader patch and matching shadow materials, realizes geometry/PBR through their canonical owners and derives vertex tangents only for anisotropic rigid, morph-free, normal-map-free indexed normal/UV geometry. Nonfinite/zero derived axes discard the new attribute; mapped/deforming or unsupported geometry retains its existing derivative-frame limitations. Consistent source normals remain a premise; this is not a MikkTSpace bake guarantee. AttachedBone intentionally takes precedence over skin, bone rest scale is unit by engine convention and complete finite/unique hierarchy/material admission remains upstream.
|
|
64
65
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns one model graph plus semantic bone/part registries, one skeleton per ordered joint list, material variants by definition id with vertex-color/relief/skinning-method flags and one patched shadow pair per dual quaternion mesh; geometry, physical-vertex mapping, material shading and imported appearances remain separate producers.
|
|
@@ -132,6 +133,7 @@ const buildModel = (model, resolveTexture) => {
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
const mesh = skin !== null ? new AutoMovieSkinnedMesh(geo, mat, skin.method ?? "linear") : new THREE.Mesh(geo, mat);
|
|
136
|
+
mesh.visible = mat.visible;
|
|
135
137
|
mesh.name = part.name ?? part.id;
|
|
136
138
|
parts.set(part.id, mesh);
|
|
137
139
|
const driven = part.geometry.type === "mesh" ? (part.geometry.mesh.targets ?? []).filter((target) => target.driver !== void 0 && target.driver !== null).map((target) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildModel.mjs","names":[],"sources":["../../src/scene/buildModel.ts"],"sourcesContent":["import type {\n AutoMovieHumanoidBone,\n IAutoMovieMaterial,\n IAutoMovieMeshMorphTarget,\n IAutoMovieMeshSkin,\n IAutoMovieModel,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport { AutoMovieSkinnedMesh } from \"./AutoMovieSkinnedMesh.js\";\nimport type { IAutoMovieModelObject } from \"./IAutoMovieModelObject.js\";\nimport type { IAutoMovieTextureResolver } from \"./IAutoMovieTextureResolver.js\";\nimport { applyTransform } from \"./applyTransform.js\";\nimport { buildGeometry } from \"./buildGeometry.js\";\nimport { buildMaterial } from \"./buildMaterial.js\";\nimport { constructAutoMovieOwnedResources } from \"./constructAutoMovieOwnedResources.js\";\nimport { defaultMaterial } from \"./defaultMaterial.js\";\nimport { applyDualQuaternionSkinning } from \"./dualQuaternionSkinning/index.js\";\nimport { applyReliefWeights } from \"./reliefWeightShading/index.js\";\n\n/**\n * Build a renderable `three.js` object from an {@link IAutoMovieModel}.\n *\n * Constructs the bone hierarchy, then attaches each part. A rigid part is\n * parented to its `attachedBone` and rides that bone. A mesh with skin data and\n * no rigid attachment becomes a `THREE.SkinnedMesh` bound to the skeleton. If\n * both signals are present, `attachedBone` wins: the part is treated as a rigid\n * prop and its skin payload is ignored by the viewer. An `attachedBone` the\n * skeleton does not carry throws, the same class as a skin referencing a\n * missing bone (#1106): a silently root-parented prop renders frozen at the\n * origin while everything else looks right.\n *\n * A skin whose `method` is `\"dual-quaternion\"` takes a material variant with\n * the dual quaternion vertex patch, and its mesh casts shadows through its own\n * patched depth and distance materials, so the shadow deforms like the surface;\n * the mesh is flagged so guide passes patch the materials they swap in. Every\n * skinned part is an {@link AutoMovieSkinnedMesh} of its skin's method, so\n * bounds, culling, raycasts and vertex queries read the blend the shader draws.\n * Parts with the same ordered joint slots share one skeleton and bone texture\n * within this model; each mesh retains its own bind matrix and blend method.\n * Separate model builds own independent skeletons and pose state.\n *\n * A mesh's morph targets reach `morphTargetDictionary` by name, so\n * {@link applyExpression} drives them, and its driven targets are recorded on\n * the mesh for {@link applyPose}.\n *\n * The returned `bones` map is what {@link applyPose} drives, and the model's\n * `lookAt` rides along so {@link AutoMoviePlayer} can turn its eye bones.\n *\n * `resolveTexture` is how a declared PBR finish gets its pixels, and it is the\n * host's to supply because this package performs no I/O: the caller decodes the\n * model's bindings first (an `AutoMovieTextureCache` primes them in one pass)\n * and hands over an {@link IAutoMovieTextureResolver} that answers\n * synchronously. Omitting it builds every material with its scalar coefficients\n * and no maps, which is exactly what a model declaring no texture renders and\n * what every pre-texture production still renders. The resolver must answer\n * with a texture object PER BINDING, because {@link buildMaterial} writes that\n * binding's color space, UV transform and sampler onto whatever it is given,\n * and two slots sharing one object would fight over one repeat.\n * Every returned geometry and material is registered as soon as it is acquired,\n * before a later part, binding or attachment can fail. Failure independently\n * retires those owned objects, including objects not yet attached to the group;\n * successful return transfers them to the caller. Texture wrappers stay with\n * the resolver's owner. A nested producer retires its own failed allocation.\n * An anisotropic rigid mesh without morph targets or normal maps receives\n * native computed tangents when its indexed normal/UV geometry supports them.\n * Mapped and deforming meshes retain their derivative frame: a rest tangent\n * cannot follow a morph or replace a transformed normal-map frame. This\n * changes no source arrays or material coefficients, is not a MikkTSpace bake\n * guarantee and leaves degenerate UVs on their existing fallback.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Builds admitted semantic bone rest TR and part TRS, binds skin joints or rigid attached bones, selects linear or dual quaternion skinning per skin through the material shader patch and matching shadow materials, realizes geometry/PBR through their canonical owners and derives vertex tangents only for anisotropic rigid, morph-free, normal-map-free indexed normal/UV geometry. Nonfinite/zero derived axes discard the new attribute; mapped/deforming or unsupported geometry retains its existing derivative-frame limitations. Consistent source normals remain a premise; this is not a MikkTSpace bake guarantee. AttachedBone intentionally takes precedence over skin, bone rest scale is unit by engine convention and complete finite/unique hierarchy/material admission remains upstream.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns one model graph plus semantic bone/part registries, one skeleton per ordered joint list, material variants by definition id with vertex-color/relief/skinning-method flags and one patched shadow pair per dual quaternion mesh; geometry, physical-vertex mapping, material shading and imported appearances remain separate producers.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Missing referenced skin/attached bones throw rather than producing frozen geometry; missing material definitions currently select the ordinary default material, so this producer is not a substitute for complete source admission. No anatomical fixture names, patched Three methods or extra UV channels choose output.\n * @evidence contracts/development/common.md#meaningful-documentation Documents rigid-versus-skin precedence, ordered-joint skeleton sharing with per-mesh bind state, the dual quaternion material and shadow variants, morph target naming and the driven-target record, bone lookup, texture resolver/binding-private ownership, first-acquisition rollback and result transfer; comments give the shared engine unit bone-scale convention.\n * @evidence contracts/development/implementation.md#efficient-algorithms Builds B bones and P parts with id maps, updates the rest hierarchy once, allocates one skeleton per unique ordered joint list and updates only each newly attached skin's own world matrix before explicit binding. Joint-key construction costs O(J) per skin with J palette slots; inverse and GPU matrix storage costs O(sum of unique palette lengths), without a growing graph traversal per part. One geometry per part, one material per encountered definition/colored/weighted/skinning-method variant and two shadow materials per dual quaternion skin remain. Typed buffer work scales with vertices/indices; eligible anisotropic geometry adds one O(V+I) tangent pass, an owned four-component attribute and O(V) temporary accumulation.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares skeletons only inside this build when ordered joint identifiers match, because those slots resolve to the same Bone objects and unchanged rest-world inverse matrices; per-mesh bind matrices and blend methods stay independent. Shares material variants across matching part flags and borrows primed texture bindings; separate builds own independent bone/part graphs and skeletons because pose state cannot be shared across placements.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Registers created geometry/material/shadow material/skeleton immediately within construction rollback and transfers the complete model graph/registries on success; resolver textures stay externally owned. The returned record provides no universal disposer, so its scene/runtime owner must enumerate physical resources including skin skeleton state when retiring it.\n */\nexport const buildModel: (\n model: IAutoMovieModel,\n resolveTexture?: IAutoMovieTextureResolver,\n) => IAutoMovieModelObject = (\n model: IAutoMovieModel,\n resolveTexture?: IAutoMovieTextureResolver,\n): IAutoMovieModelObject => {\n return constructAutoMovieOwnedResources(\n (\n own: <Resource extends { dispose(): void }>(\n resource: Resource,\n ) => Resource,\n ): IAutoMovieModelObject => {\n const group: THREE.Group<THREE.Object3DEventMap> = new THREE.Group();\n group.name = model.name ?? model.id;\n\n const bones: Map<\n AutoMovieHumanoidBone,\n THREE.Bone<THREE.Object3DEventMap>\n > = new Map<AutoMovieHumanoidBone, THREE.Bone>();\n if (model.skeleton !== null) {\n for (const b of model.skeleton.bones) {\n const bone: THREE.Bone<THREE.Object3DEventMap> = new THREE.Bone();\n bone.name = b.bone;\n // Rig rest SCALE is ignored, the engine's pinned convention (#1052):\n // `resolvePose` composes rotation and translation only, and\n // `motionToClip` matches it (\"rest scale ignored on both sides\").\n // Applying it here would render every descendant at the accumulated\n // scale product while ground contact, collision, and framing measured\n // the unscaled body. Scale stays first-class on scene NODES and object\n // motions (#1049). This convention is about rig bones only.\n bone.position.set(\n b.rest.translation.x,\n b.rest.translation.y,\n b.rest.translation.z,\n );\n bone.quaternion.set(\n b.rest.rotation.x,\n b.rest.rotation.y,\n b.rest.rotation.z,\n b.rest.rotation.w,\n );\n bones.set(b.bone, bone);\n }\n for (const b of model.skeleton.bones) {\n const bone: THREE.Bone<THREE.Object3DEventMap> = bones.get(b.bone)!;\n const parent: THREE.Bone<THREE.Object3DEventMap> | undefined =\n b.parent !== null ? bones.get(b.parent) : undefined;\n (parent ?? group).add(bone);\n }\n }\n\n // Inverse binds depend on bone rest worlds, which no part changes.\n // Establish them once before adding any skin instead of revisiting the\n // growing part graph for every mesh.\n group.updateMatrixWorld(true);\n const skeletons: Map<string, THREE.Skeleton> = new Map();\n\n const definitions: Map<string, IAutoMovieMaterial> = new Map(\n model.materials.map(\n (m: IAutoMovieMaterial): [string, IAutoMovieMaterial] => [m.id, m],\n ),\n );\n const materials: Map<\n string,\n Map<string, THREE.MeshStandardMaterial>\n > = new Map<string, Map<string, THREE.MeshStandardMaterial>>();\n const parts: Map<\n string,\n THREE.Object3D<THREE.Object3DEventMap>\n > = new Map<string, THREE.Object3D>();\n for (const part of model.parts) {\n const geo: THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n > = own(buildGeometry(part.geometry));\n const colored: boolean = geo.hasAttribute(\"color\");\n // a mesh with relief weights takes its own variant, whose normal map's\n // slopes they scale; one without keeps the material as authored\n const weighted: boolean = geo.hasAttribute(\"reliefWeight\");\n const skin: IAutoMovieMeshSkin | null =\n part.attachedBone === null && part.geometry.type === \"mesh\"\n ? part.geometry.mesh.skin\n : null;\n const dualQuaternion: boolean = skin?.method === \"dual-quaternion\";\n const definition: IAutoMovieMaterial | undefined =\n part.material === null ? undefined : definitions.get(part.material);\n let mat: THREE.MeshStandardMaterial;\n if (definition === undefined) {\n mat = own(defaultMaterial());\n mat.vertexColors = colored;\n if (dualQuaternion) applyDualQuaternionSkinning(mat);\n } else {\n let variants: Map<string, THREE.MeshStandardMaterial> | undefined =\n materials.get(definition.id);\n if (variants === undefined) {\n variants = new Map();\n materials.set(definition.id, variants);\n }\n const key: string = `${colored}:${weighted}:${dualQuaternion}`;\n const cached: THREE.MeshStandardMaterial | undefined =\n variants.get(key);\n if (cached === undefined) {\n mat = own(buildMaterial(definition, resolveTexture));\n mat.vertexColors = colored;\n if (weighted && mat.normalMap !== null) applyReliefWeights(mat);\n if (dualQuaternion) applyDualQuaternionSkinning(mat);\n variants.set(key, mat);\n } else mat = cached;\n }\n // A supplied tangent also changes normal-map projection. Keep mapped\n // and deforming meshes on their prior derivative frame, rather than\n // replacing transformed UVs or a moving morph with UV0 rest tangents.\n const morphed: boolean =\n part.geometry.type === \"mesh\" &&\n (part.geometry.mesh.targets?.length ?? 0) > 0;\n if (\n (definition?.anisotropy?.strength ?? 0) > 0 &&\n skin === null &&\n !morphed &&\n mat.normalMap === null &&\n geo.index !== null &&\n geo.hasAttribute(\"normal\") &&\n geo.hasAttribute(\"uv\")\n ) {\n geo.computeTangents();\n const tangent:\n | THREE.BufferAttribute\n | THREE.InterleavedBufferAttribute = geo.getAttribute(\"tangent\");\n for (let k: number = 0; k < tangent.count; ++k) {\n const length: number = Math.hypot(\n tangent.getX(k),\n tangent.getY(k),\n tangent.getZ(k),\n );\n if (\n !Number.isFinite(tangent.getW(k)) ||\n !Number.isFinite(length) ||\n length === 0\n ) {\n geo.deleteAttribute(\"tangent\");\n break;\n }\n }\n }\n const mesh: THREE.Mesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n THREE.MeshStandardMaterial,\n THREE.Object3DEventMap\n > = skin !== null\n ? new AutoMovieSkinnedMesh(geo, mat, skin.method ?? \"linear\")\n : new THREE.Mesh(geo, mat);\n mesh.name = part.name ?? part.id;\n parts.set(part.id, mesh);\n // Three's Mesh constructor ran updateMorphTargets(), so the dictionary\n // already names each target; applyPose writes the driven ones.\n // Names and drivers only: Object3D.clone copies userData through JSON,\n // and the delta buffers already live in the geometry.\n const driven: Pick<IAutoMovieMeshMorphTarget, \"name\" | \"driver\">[] =\n part.geometry.type === \"mesh\"\n ? (part.geometry.mesh.targets ?? [])\n .filter(\n (target: IAutoMovieMeshMorphTarget): boolean =>\n target.driver !== undefined && target.driver !== null,\n )\n .map(\n (\n target: IAutoMovieMeshMorphTarget,\n ): Pick<IAutoMovieMeshMorphTarget, \"name\" | \"driver\"> => ({\n name: target.name,\n driver: target.driver,\n }),\n )\n : [];\n if (driven.length !== 0)\n mesh.userData.automovieMorphTargetDrivers = driven;\n if (part.transform !== null) applyTransform(mesh, part.transform);\n\n if (mesh instanceof THREE.SkinnedMesh && skin !== null) {\n const palette: string = JSON.stringify(skin.joints);\n let skeleton: THREE.Skeleton | undefined = skeletons.get(palette);\n if (skeleton === undefined) {\n const jointBones: THREE.Bone<THREE.Object3DEventMap>[] =\n skin.joints.map(\n (\n joint: AutoMovieHumanoidBone,\n ): THREE.Bone<THREE.Object3DEventMap> => {\n const bone: THREE.Bone<THREE.Object3DEventMap> | undefined =\n bones.get(joint);\n if (bone === undefined)\n throw new Error(\n `part \"${part.id}\" skin references missing bone \"${joint}\"`,\n );\n return bone;\n },\n );\n skeleton = own(new THREE.Skeleton(jointBones));\n skeletons.set(palette, skeleton);\n }\n group.add(mesh);\n\n // A palette's inverse binds are shared, but a mesh's authored TRS\n // determines its own bind matrix. Passing it explicitly also avoids\n // Three recalculating the shared inverses for each mesh.\n mesh.updateMatrixWorld(true);\n mesh.bind(skeleton, mesh.matrixWorld);\n mesh.normalizeSkinWeights();\n if (dualQuaternion) {\n // The depth and distance passes would otherwise draw this skin\n // linearly blended. Three copies the beauty material's alpha, side\n // and clipping onto a custom shadow material before each draw, so\n // each mesh keeps its own pair rather than toggling a shared one.\n const depth: THREE.MeshDepthMaterial = own(\n new THREE.MeshDepthMaterial(),\n );\n const distance: THREE.MeshDistanceMaterial = own(\n new THREE.MeshDistanceMaterial(),\n );\n applyDualQuaternionSkinning(depth);\n applyDualQuaternionSkinning(distance);\n mesh.customDepthMaterial = depth;\n mesh.customDistanceMaterial = distance;\n // guide passes that swap the material read this to patch theirs\n mesh.userData.automovieDualQuaternionSkinning = true;\n }\n } else if (part.attachedBone !== null) {\n // An unknown attachedBone must throw like the skin path above (#1106):\n // the silent fallback parented a hand-held prop to the model root,\n // rendering it frozen at the origin while everything else looked right,\n // the silent-skip class #1051 removed from the viewer.\n const parentBone: THREE.Bone<THREE.Object3DEventMap> | undefined =\n bones.get(part.attachedBone);\n if (parentBone === undefined)\n throw new Error(\n `part \"${part.id}\" attachedBone references missing bone \"${part.attachedBone}\"`,\n );\n parentBone.add(mesh);\n } else {\n group.add(mesh);\n }\n }\n\n return {\n object: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U,KAAK,WAAW;IACpC,KAAK,qBAAqB;IAC1B,IAAI,gBAAgB;KAKlB,MAAM,QAAiC,IACrC,IAAI,MAAM,kBAAkB,CAC9B;KACA,MAAM,WAAuC,IAC3C,IAAI,MAAM,qBAAqB,CACjC;KACA,4BAA4B,KAAK;KACjC,4BAA4B,QAAQ;KACpC,KAAK,sBAAsB;KAC3B,KAAK,yBAAyB;KAE9B,KAAK,SAAS,kCAAkC;IAClD;GACF,OAAO,IAAI,KAAK,iBAAiB,MAAM;IAKrC,MAAM,aACJ,MAAM,IAAI,KAAK,YAAY;IAC7B,IAAI,eAAe,KAAA,GACjB,MAAM,IAAI,MACR,SAAS,KAAK,GAAG,0CAA0C,KAAK,aAAa,EAC/E;IACF,WAAW,IAAI,IAAI;GACrB,OACE,MAAM,IAAI,IAAI;EAElB;EAEA,OAAO;GACL,QAAQ;GACR;GACA;GACA,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;EAC/D;CACF,CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"buildModel.mjs","names":[],"sources":["../../src/scene/buildModel.ts"],"sourcesContent":["import type {\n AutoMovieHumanoidBone,\n IAutoMovieMaterial,\n IAutoMovieMeshMorphTarget,\n IAutoMovieMeshSkin,\n IAutoMovieModel,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport { AutoMovieSkinnedMesh } from \"./AutoMovieSkinnedMesh.js\";\nimport type { IAutoMovieModelObject } from \"./IAutoMovieModelObject.js\";\nimport type { IAutoMovieTextureResolver } from \"./IAutoMovieTextureResolver.js\";\nimport { applyTransform } from \"./applyTransform.js\";\nimport { buildGeometry } from \"./buildGeometry.js\";\nimport { buildMaterial } from \"./buildMaterial.js\";\nimport { constructAutoMovieOwnedResources } from \"./constructAutoMovieOwnedResources.js\";\nimport { defaultMaterial } from \"./defaultMaterial.js\";\nimport { applyDualQuaternionSkinning } from \"./dualQuaternionSkinning/index.js\";\nimport { applyReliefWeights } from \"./reliefWeightShading/index.js\";\n\n/**\n * Build a renderable `three.js` object from an {@link IAutoMovieModel}.\n *\n * Constructs the bone hierarchy, then attaches each part. A rigid part is\n * parented to its `attachedBone` and rides that bone. A mesh with skin data and\n * no rigid attachment becomes a `THREE.SkinnedMesh` bound to the skeleton. If\n * both signals are present, `attachedBone` wins: the part is treated as a rigid\n * prop and its skin payload is ignored by the viewer. An `attachedBone` the\n * skeleton does not carry throws, the same class as a skin referencing a\n * missing bone (#1106): a silently root-parented prop renders frozen at the\n * origin while everything else looks right.\n *\n * A skin whose `method` is `\"dual-quaternion\"` takes a material variant with\n * the dual quaternion vertex patch, and its mesh casts shadows through its own\n * patched depth and distance materials, so the shadow deforms like the surface;\n * the mesh is flagged so guide passes patch the materials they swap in. Every\n * skinned part is an {@link AutoMovieSkinnedMesh} of its skin's method, so\n * bounds, culling, raycasts and vertex queries read the blend the shader draws.\n * Parts with the same ordered joint slots share one skeleton and bone texture\n * within this model; each mesh retains its own bind matrix and blend method.\n * Separate model builds own independent skeletons and pose state.\n *\n * A mesh's morph targets reach `morphTargetDictionary` by name, so\n * {@link applyExpression} drives them, and its driven targets are recorded on\n * the mesh for {@link applyPose}.\n *\n * The returned `bones` map is what {@link applyPose} drives, and the model's\n * `lookAt` rides along so {@link AutoMoviePlayer} can turn its eye bones.\n *\n * `resolveTexture` is how a declared PBR finish gets its pixels, and it is the\n * host's to supply because this package performs no I/O: the caller decodes the\n * model's bindings first (an `AutoMovieTextureCache` primes them in one pass)\n * and hands over an {@link IAutoMovieTextureResolver} that answers\n * synchronously. Omitting it builds every material with its scalar coefficients\n * and no maps, which is exactly what a model declaring no texture renders and\n * what every pre-texture production still renders. The resolver must answer\n * with a texture object PER BINDING, because {@link buildMaterial} writes that\n * binding's color space, UV transform and sampler onto whatever it is given,\n * and two slots sharing one object would fight over one repeat.\n * Every returned geometry and material is registered as soon as it is acquired,\n * before a later part, binding or attachment can fail. Failure independently\n * retires those owned objects, including objects not yet attached to the group;\n * successful return transfers them to the caller. Texture wrappers stay with\n * the resolver's owner. A nested producer retires its own failed allocation.\n * An anisotropic rigid mesh without morph targets or normal maps receives\n * native computed tangents when its indexed normal/UV geometry supports them.\n * Mapped and deforming meshes retain their derivative frame: a rest tangent\n * cannot follow a morph or replace a transformed normal-map frame. This\n * changes no source arrays or material coefficients, is not a MikkTSpace bake\n * guarantee and leaves degenerate UVs on their existing fallback.\n * Fully transparent, non-transmissive parts stay hidden when a guide swaps materials.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Builds admitted semantic bone rest TR and part TRS, binds skin joints or rigid attached bones, selects linear or dual quaternion skinning per skin through the material shader patch and matching shadow materials, realizes geometry/PBR through their canonical owners and derives vertex tangents only for anisotropic rigid, morph-free, normal-map-free indexed normal/UV geometry. Nonfinite/zero derived axes discard the new attribute; mapped/deforming or unsupported geometry retains its existing derivative-frame limitations. Consistent source normals remain a premise; this is not a MikkTSpace bake guarantee. AttachedBone intentionally takes precedence over skin, bone rest scale is unit by engine convention and complete finite/unique hierarchy/material admission remains upstream.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns one model graph plus semantic bone/part registries, one skeleton per ordered joint list, material variants by definition id with vertex-color/relief/skinning-method flags and one patched shadow pair per dual quaternion mesh; geometry, physical-vertex mapping, material shading and imported appearances remain separate producers.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Missing referenced skin/attached bones throw rather than producing frozen geometry; missing material definitions currently select the ordinary default material, so this producer is not a substitute for complete source admission. No anatomical fixture names, patched Three methods or extra UV channels choose output.\n * @evidence contracts/development/common.md#meaningful-documentation Documents rigid-versus-skin precedence, ordered-joint skeleton sharing with per-mesh bind state, the dual quaternion material and shadow variants, morph target naming and the driven-target record, bone lookup, texture resolver/binding-private ownership, first-acquisition rollback and result transfer; comments give the shared engine unit bone-scale convention.\n * @evidence contracts/development/implementation.md#efficient-algorithms Builds B bones and P parts with id maps, updates the rest hierarchy once, allocates one skeleton per unique ordered joint list and updates only each newly attached skin's own world matrix before explicit binding. Joint-key construction costs O(J) per skin with J palette slots; inverse and GPU matrix storage costs O(sum of unique palette lengths), without a growing graph traversal per part. One geometry per part, one material per encountered definition/colored/weighted/skinning-method variant and two shadow materials per dual quaternion skin remain. Typed buffer work scales with vertices/indices; eligible anisotropic geometry adds one O(V+I) tangent pass, an owned four-component attribute and O(V) temporary accumulation.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares skeletons only inside this build when ordered joint identifiers match, because those slots resolve to the same Bone objects and unchanged rest-world inverse matrices; per-mesh bind matrices and blend methods stay independent. Shares material variants across matching part flags and borrows primed texture bindings; separate builds own independent bone/part graphs and skeletons because pose state cannot be shared across placements.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Registers created geometry/material/shadow material/skeleton immediately within construction rollback and transfers the complete model graph/registries on success; resolver textures stay externally owned. The returned record provides no universal disposer, so its scene/runtime owner must enumerate physical resources including skin skeleton state when retiring it.\n */\nexport const buildModel: (\n model: IAutoMovieModel,\n resolveTexture?: IAutoMovieTextureResolver,\n) => IAutoMovieModelObject = (\n model: IAutoMovieModel,\n resolveTexture?: IAutoMovieTextureResolver,\n): IAutoMovieModelObject => {\n return constructAutoMovieOwnedResources(\n (\n own: <Resource extends { dispose(): void }>(\n resource: Resource,\n ) => Resource,\n ): IAutoMovieModelObject => {\n const group: THREE.Group<THREE.Object3DEventMap> = new THREE.Group();\n group.name = model.name ?? model.id;\n\n const bones: Map<\n AutoMovieHumanoidBone,\n THREE.Bone<THREE.Object3DEventMap>\n > = new Map<AutoMovieHumanoidBone, THREE.Bone>();\n if (model.skeleton !== null) {\n for (const b of model.skeleton.bones) {\n const bone: THREE.Bone<THREE.Object3DEventMap> = new THREE.Bone();\n bone.name = b.bone;\n // Rig rest SCALE is ignored, the engine's pinned convention (#1052):\n // `resolvePose` composes rotation and translation only, and\n // `motionToClip` matches it (\"rest scale ignored on both sides\").\n // Applying it here would render every descendant at the accumulated\n // scale product while ground contact, collision, and framing measured\n // the unscaled body. Scale stays first-class on scene NODES and object\n // motions (#1049). This convention is about rig bones only.\n bone.position.set(\n b.rest.translation.x,\n b.rest.translation.y,\n b.rest.translation.z,\n );\n bone.quaternion.set(\n b.rest.rotation.x,\n b.rest.rotation.y,\n b.rest.rotation.z,\n b.rest.rotation.w,\n );\n bones.set(b.bone, bone);\n }\n for (const b of model.skeleton.bones) {\n const bone: THREE.Bone<THREE.Object3DEventMap> = bones.get(b.bone)!;\n const parent: THREE.Bone<THREE.Object3DEventMap> | undefined =\n b.parent !== null ? bones.get(b.parent) : undefined;\n (parent ?? group).add(bone);\n }\n }\n\n // Inverse binds depend on bone rest worlds, which no part changes.\n // Establish them once before adding any skin instead of revisiting the\n // growing part graph for every mesh.\n group.updateMatrixWorld(true);\n const skeletons: Map<string, THREE.Skeleton> = new Map();\n\n const definitions: Map<string, IAutoMovieMaterial> = new Map(\n model.materials.map(\n (m: IAutoMovieMaterial): [string, IAutoMovieMaterial] => [m.id, m],\n ),\n );\n const materials: Map<\n string,\n Map<string, THREE.MeshStandardMaterial>\n > = new Map<string, Map<string, THREE.MeshStandardMaterial>>();\n const parts: Map<\n string,\n THREE.Object3D<THREE.Object3DEventMap>\n > = new Map<string, THREE.Object3D>();\n for (const part of model.parts) {\n const geo: THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n > = own(buildGeometry(part.geometry));\n const colored: boolean = geo.hasAttribute(\"color\");\n // a mesh with relief weights takes its own variant, whose normal map's\n // slopes they scale; one without keeps the material as authored\n const weighted: boolean = geo.hasAttribute(\"reliefWeight\");\n const skin: IAutoMovieMeshSkin | null =\n part.attachedBone === null && part.geometry.type === \"mesh\"\n ? part.geometry.mesh.skin\n : null;\n const dualQuaternion: boolean = skin?.method === \"dual-quaternion\";\n const definition: IAutoMovieMaterial | undefined =\n part.material === null ? undefined : definitions.get(part.material);\n let mat: THREE.MeshStandardMaterial;\n if (definition === undefined) {\n mat = own(defaultMaterial());\n mat.vertexColors = colored;\n if (dualQuaternion) applyDualQuaternionSkinning(mat);\n } else {\n let variants: Map<string, THREE.MeshStandardMaterial> | undefined =\n materials.get(definition.id);\n if (variants === undefined) {\n variants = new Map();\n materials.set(definition.id, variants);\n }\n const key: string = `${colored}:${weighted}:${dualQuaternion}`;\n const cached: THREE.MeshStandardMaterial | undefined =\n variants.get(key);\n if (cached === undefined) {\n mat = own(buildMaterial(definition, resolveTexture));\n mat.vertexColors = colored;\n if (weighted && mat.normalMap !== null) applyReliefWeights(mat);\n if (dualQuaternion) applyDualQuaternionSkinning(mat);\n variants.set(key, mat);\n } else mat = cached;\n }\n // A supplied tangent also changes normal-map projection. Keep mapped\n // and deforming meshes on their prior derivative frame, rather than\n // replacing transformed UVs or a moving morph with UV0 rest tangents.\n const morphed: boolean =\n part.geometry.type === \"mesh\" &&\n (part.geometry.mesh.targets?.length ?? 0) > 0;\n if (\n (definition?.anisotropy?.strength ?? 0) > 0 &&\n skin === null &&\n !morphed &&\n mat.normalMap === null &&\n geo.index !== null &&\n geo.hasAttribute(\"normal\") &&\n geo.hasAttribute(\"uv\")\n ) {\n geo.computeTangents();\n const tangent:\n | THREE.BufferAttribute\n | THREE.InterleavedBufferAttribute = geo.getAttribute(\"tangent\");\n for (let k: number = 0; k < tangent.count; ++k) {\n const length: number = Math.hypot(\n tangent.getX(k),\n tangent.getY(k),\n tangent.getZ(k),\n );\n if (\n !Number.isFinite(tangent.getW(k)) ||\n !Number.isFinite(length) ||\n length === 0\n ) {\n geo.deleteAttribute(\"tangent\");\n break;\n }\n }\n }\n const mesh: THREE.Mesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n THREE.MeshStandardMaterial,\n THREE.Object3DEventMap\n > = skin !== null\n ? new AutoMovieSkinnedMesh(geo, mat, skin.method ?? \"linear\")\n : new THREE.Mesh(geo, mat);\n mesh.visible = mat.visible;\n mesh.name = part.name ?? part.id;\n parts.set(part.id, mesh);\n // Three's Mesh constructor ran updateMorphTargets(), so the dictionary\n // already names each target; applyPose writes the driven ones.\n // Names and drivers only: Object3D.clone copies userData through JSON,\n // and the delta buffers already live in the geometry.\n const driven: Pick<IAutoMovieMeshMorphTarget, \"name\" | \"driver\">[] =\n part.geometry.type === \"mesh\"\n ? (part.geometry.mesh.targets ?? [])\n .filter(\n (target: IAutoMovieMeshMorphTarget): boolean =>\n target.driver !== undefined && target.driver !== null,\n )\n .map(\n (\n target: IAutoMovieMeshMorphTarget,\n ): Pick<IAutoMovieMeshMorphTarget, \"name\" | \"driver\"> => ({\n name: target.name,\n driver: target.driver,\n }),\n )\n : [];\n if (driven.length !== 0)\n mesh.userData.automovieMorphTargetDrivers = driven;\n if (part.transform !== null) applyTransform(mesh, part.transform);\n\n if (mesh instanceof THREE.SkinnedMesh && skin !== null) {\n const palette: string = JSON.stringify(skin.joints);\n let skeleton: THREE.Skeleton | undefined = skeletons.get(palette);\n if (skeleton === undefined) {\n const jointBones: THREE.Bone<THREE.Object3DEventMap>[] =\n skin.joints.map(\n (\n joint: AutoMovieHumanoidBone,\n ): THREE.Bone<THREE.Object3DEventMap> => {\n const bone: THREE.Bone<THREE.Object3DEventMap> | undefined =\n bones.get(joint);\n if (bone === undefined)\n throw new Error(\n `part \"${part.id}\" skin references missing bone \"${joint}\"`,\n );\n return bone;\n },\n );\n skeleton = own(new THREE.Skeleton(jointBones));\n skeletons.set(palette, skeleton);\n }\n group.add(mesh);\n\n // A palette's inverse binds are shared, but a mesh's authored TRS\n // determines its own bind matrix. Passing it explicitly also avoids\n // Three recalculating the shared inverses for each mesh.\n mesh.updateMatrixWorld(true);\n mesh.bind(skeleton, mesh.matrixWorld);\n mesh.normalizeSkinWeights();\n if (dualQuaternion) {\n // The depth and distance passes would otherwise draw this skin\n // linearly blended. Three copies the beauty material's alpha, side\n // and clipping onto a custom shadow material before each draw, so\n // each mesh keeps its own pair rather than toggling a shared one.\n const depth: THREE.MeshDepthMaterial = own(\n new THREE.MeshDepthMaterial(),\n );\n const distance: THREE.MeshDistanceMaterial = own(\n new THREE.MeshDistanceMaterial(),\n );\n applyDualQuaternionSkinning(depth);\n applyDualQuaternionSkinning(distance);\n mesh.customDepthMaterial = depth;\n mesh.customDistanceMaterial = distance;\n // guide passes that swap the material read this to patch theirs\n mesh.userData.automovieDualQuaternionSkinning = true;\n }\n } else if (part.attachedBone !== null) {\n // An unknown attachedBone must throw like the skin path above (#1106):\n // the silent fallback parented a hand-held prop to the model root,\n // rendering it frozen at the origin while everything else looked right,\n // the silent-skip class #1051 removed from the viewer.\n const parentBone: THREE.Bone<THREE.Object3DEventMap> | undefined =\n bones.get(part.attachedBone);\n if (parentBone === undefined)\n throw new Error(\n `part \"${part.id}\" attachedBone references missing bone \"${part.attachedBone}\"`,\n );\n parentBone.add(mesh);\n } else {\n group.add(mesh);\n }\n }\n\n return {\n object: group,\n bones,\n parts,\n ...(model.lookAt === undefined ? {} : { lookAt: model.lookAt }),\n };\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,MAAa,cAIX,OACA,mBAC0B;CAC1B,OAAO,kCAEH,QAG0B;EAC1B,MAAM,QAA6C,IAAI,MAAM,MAAM;EACnE,MAAM,OAAO,MAAM,QAAQ,MAAM;EAEjC,MAAM,wBAGF,IAAI,IAAuC;EAC/C,IAAI,MAAM,aAAa,MAAM;GAC3B,KAAK,MAAM,KAAK,MAAM,SAAS,OAAO;IACpC,MAAM,OAA2C,IAAI,MAAM,KAAK;IAChE,KAAK,OAAO,EAAE;IAQd,KAAK,SAAS,IACZ,EAAE,KAAK,YAAY,GACnB,EAAE,KAAK,YAAY,GACnB,EAAE,KAAK,YAAY,CACrB;IACA,KAAK,WAAW,IACd,EAAE,KAAK,SAAS,GAChB,EAAE,KAAK,SAAS,GAChB,EAAE,KAAK,SAAS,GAChB,EAAE,KAAK,SAAS,CAClB;IACA,MAAM,IAAI,EAAE,M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
14
14
|
* unlike a `GridHelper`, which is a `LineSegments` and must be hidden before
|
|
15
15
|
* every structural pass.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* depth would still let it occlude authored geometry. Guide passes replace the
|
|
22
|
-
* material and therefore keep the structural geometry #1173 introduced.
|
|
17
|
+
* A patch with an authored opaque color uses the same mesh in the beauty and
|
|
18
|
+
* guide passes. An uncolored support patch writes neither color nor depth in
|
|
19
|
+
* beauty, leaving any independently built floor to supply its appearance. All
|
|
20
|
+
* patches remain structural guide geometry when a guide replaces the material.
|
|
23
21
|
*
|
|
24
22
|
* The engine decomposes each footprint into its actual convex pieces, including
|
|
25
23
|
* notches and holes. Floors and ramps fan those pieces; heightfields clip them
|
|
@@ -33,9 +31,9 @@ import * as THREE from "three";
|
|
|
33
31
|
* and contributes no mesh rather than an invalid geometry.
|
|
34
32
|
*
|
|
35
33
|
* @evidence contracts/development/implementation.md#principled-implementation Uses the engine's actual footprint decomposition, height-rule tessellation, +Y winding and shared smooth normals, then realizes Float32 indexed geometry; admitted metre/Y-up surfaces satisfy engine premises, and bilinear cell interiors remain planar approximations rather than exact grounding geometry.
|
|
36
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns
|
|
37
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts
|
|
38
|
-
* @evidence contracts/development/common.md#meaningful-documentation Gives structural
|
|
34
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the Three mesh and opaque or guide-only material. The engine owns tessellation, and the guide passes own material replacement.
|
|
35
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The appearance option changes only the one mesh's material. No fixture paths, duplicate visual geometry or replacement height rules participate.
|
|
36
|
+
* @evidence contracts/development/common.md#meaningful-documentation Gives structural coverage, color opt-in, footprint regions, metre/Y-up winding, degenerate omission and the heightfield interior approximation.
|
|
39
37
|
* @evidence contracts/development/implementation.md#efficient-algorithms Builds one mesh per nondegenerate surface and copies each emitted position/normal/index once; engine cost depends on convex pieces and touched heightfield cells, and output memory grows with tessellated vertices/triangles rather than scene raster size.
|
|
40
38
|
* @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses the engine tessellation implementation but creates fresh scene-owned Three resources per build; mutable support surfaces have no immutable revision key here, so no cross-scene geometry cache is assumed.
|
|
41
39
|
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new geometries/materials to the returned group and retains no separate registry; population is bounded by this space's nondegenerate surfaces and tessellation output. No disposer or partial-build rollback is exposed here, so scene-host retirement and construction-failure cleanup remain a gap rather than guaranteed release.
|
|
@@ -51,12 +51,10 @@ const SPACE_GROUP_NAME_js_1 = require("./SPACE_GROUP_NAME.js");
|
|
|
51
51
|
* unlike a `GridHelper`, which is a `LineSegments` and must be hidden before
|
|
52
52
|
* every structural pass.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* depth would still let it occlude authored geometry. Guide passes replace the
|
|
59
|
-
* material and therefore keep the structural geometry #1173 introduced.
|
|
54
|
+
* A patch with an authored opaque color uses the same mesh in the beauty and
|
|
55
|
+
* guide passes. An uncolored support patch writes neither color nor depth in
|
|
56
|
+
* beauty, leaving any independently built floor to supply its appearance. All
|
|
57
|
+
* patches remain structural guide geometry when a guide replaces the material.
|
|
60
58
|
*
|
|
61
59
|
* The engine decomposes each footprint into its actual convex pieces, including
|
|
62
60
|
* notches and holes. Floors and ramps fan those pieces; heightfields clip them
|
|
@@ -70,9 +68,9 @@ const SPACE_GROUP_NAME_js_1 = require("./SPACE_GROUP_NAME.js");
|
|
|
70
68
|
* and contributes no mesh rather than an invalid geometry.
|
|
71
69
|
*
|
|
72
70
|
* @evidence contracts/development/implementation.md#principled-implementation Uses the engine's actual footprint decomposition, height-rule tessellation, +Y winding and shared smooth normals, then realizes Float32 indexed geometry; admitted metre/Y-up surfaces satisfy engine premises, and bilinear cell interiors remain planar approximations rather than exact grounding geometry.
|
|
73
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns
|
|
74
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts
|
|
75
|
-
* @evidence contracts/development/common.md#meaningful-documentation Gives structural
|
|
71
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the Three mesh and opaque or guide-only material. The engine owns tessellation, and the guide passes own material replacement.
|
|
72
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The appearance option changes only the one mesh's material. No fixture paths, duplicate visual geometry or replacement height rules participate.
|
|
73
|
+
* @evidence contracts/development/common.md#meaningful-documentation Gives structural coverage, color opt-in, footprint regions, metre/Y-up winding, degenerate omission and the heightfield interior approximation.
|
|
76
74
|
* @evidence contracts/development/implementation.md#efficient-algorithms Builds one mesh per nondegenerate surface and copies each emitted position/normal/index once; engine cost depends on convex pieces and touched heightfield cells, and output memory grows with tessellated vertices/triangles rather than scene raster size.
|
|
77
75
|
* @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses the engine tessellation implementation but creates fresh scene-owned Three resources per build; mutable support surfaces have no immutable revision key here, so no cross-scene geometry cache is assumed.
|
|
78
76
|
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new geometries/materials to the returned group and retains no separate registry; population is bounded by this space's nondegenerate surfaces and tessellation output. No disposer or partial-build rollback is exposed here, so scene-host retirement and construction-failure cleanup remain a gap rather than guaranteed release.
|
|
@@ -84,7 +82,11 @@ const buildSpaceObject = (space) => {
|
|
|
84
82
|
const geometry = buildSurfaceGeometry(surface);
|
|
85
83
|
if (geometry === null)
|
|
86
84
|
continue;
|
|
87
|
-
const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial(
|
|
85
|
+
const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial(surface.color === undefined
|
|
86
|
+
? { colorWrite: false, depthWrite: false }
|
|
87
|
+
: {
|
|
88
|
+
color: new THREE.Color(surface.color.r, surface.color.g, surface.color.b),
|
|
89
|
+
}));
|
|
88
90
|
mesh.name = surface.id;
|
|
89
91
|
group.add(mesh);
|
|
90
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSpaceObject.js","sourceRoot":"","sources":["../../src/scene/buildSpaceObject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsD;AAMtD,MAAY,KAAK,kCAAc;AAE/B,+DAAyD;AAEzD
|
|
1
|
+
{"version":3,"file":"buildSpaceObject.js","sourceRoot":"","sources":["../../src/scene/buildSpaceObject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsD;AAMtD,MAAY,KAAK,kCAAc;AAE/B,+DAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACI,MAAM,gBAAgB,GAA4C,CACvE,KAAsB,EACT,EAAE;IACf,MAAM,KAAK,GAAwC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IACrE,KAAK,CAAC,IAAI,GAAG,sCAAgB,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,QAAQ,GAGH,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,QAAQ,KAAK,IAAI;YAAE,SAAS;QAChC,MAAM,IAAI,GAON,IAAI,KAAK,CAAC,IAAI,CAChB,QAAQ,EACR,IAAI,KAAK,CAAC,iBAAiB,CACzB,OAAO,CAAC,KAAK,KAAK,SAAS;YACzB,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;YAC1C,CAAC,CAAC;gBACE,KAAK,EAAE,IAAI,KAAK,CAAC,KAAK,CACpB,OAAO,CAAC,KAAK,CAAC,CAAC,EACf,OAAO,CAAC,KAAK,CAAC,CAAC,EACf,OAAO,CAAC,KAAK,CAAC,CAAC,CAChB;aACF,CACN,CACF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AApCW,QAAA,gBAAgB,GAAhB,gBAAgB,CAoC3B;AAEF;;;GAGG;AACH,MAAM,oBAAoB,GAES,CACjC,OAA0B,EACG,EAAE;IAC/B,MAAM,IAAI,GAAkC,IAAA,0BAAiB,EAAC,OAAO,CAAC,CAAC;IACvE,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,QAAQ,GAGV,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;IAC/B,QAAQ,CAAC,YAAY,CACnB,UAAU,EACV,IAAI,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CACpD,CAAC;IACF,QAAQ,CAAC,YAAY,CACnB,QAAQ,EACR,IAAI,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAClD,CAAC;IACF,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -16,12 +16,10 @@ import * as THREE from "three";
|
|
|
16
16
|
* unlike a `GridHelper`, which is a `LineSegments` and must be hidden before
|
|
17
17
|
* every structural pass.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* depth would still let it occlude authored geometry. Guide passes replace the
|
|
24
|
-
* material and therefore keep the structural geometry #1173 introduced.
|
|
19
|
+
* A patch with an authored opaque color uses the same mesh in the beauty and
|
|
20
|
+
* guide passes. An uncolored support patch writes neither color nor depth in
|
|
21
|
+
* beauty, leaving any independently built floor to supply its appearance. All
|
|
22
|
+
* patches remain structural guide geometry when a guide replaces the material.
|
|
25
23
|
*
|
|
26
24
|
* The engine decomposes each footprint into its actual convex pieces, including
|
|
27
25
|
* notches and holes. Floors and ramps fan those pieces; heightfields clip them
|
|
@@ -35,9 +33,9 @@ import * as THREE from "three";
|
|
|
35
33
|
* and contributes no mesh rather than an invalid geometry.
|
|
36
34
|
*
|
|
37
35
|
* @evidence contracts/development/implementation.md#principled-implementation Uses the engine's actual footprint decomposition, height-rule tessellation, +Y winding and shared smooth normals, then realizes Float32 indexed geometry; admitted metre/Y-up surfaces satisfy engine premises, and bilinear cell interiors remain planar approximations rather than exact grounding geometry.
|
|
38
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns
|
|
39
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts
|
|
40
|
-
* @evidence contracts/development/common.md#meaningful-documentation Gives structural
|
|
36
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the Three mesh and opaque or guide-only material. The engine owns tessellation, and the guide passes own material replacement.
|
|
37
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The appearance option changes only the one mesh's material. No fixture paths, duplicate visual geometry or replacement height rules participate.
|
|
38
|
+
* @evidence contracts/development/common.md#meaningful-documentation Gives structural coverage, color opt-in, footprint regions, metre/Y-up winding, degenerate omission and the heightfield interior approximation.
|
|
41
39
|
* @evidence contracts/development/implementation.md#efficient-algorithms Builds one mesh per nondegenerate surface and copies each emitted position/normal/index once; engine cost depends on convex pieces and touched heightfield cells, and output memory grows with tessellated vertices/triangles rather than scene raster size.
|
|
42
40
|
* @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses the engine tessellation implementation but creates fresh scene-owned Three resources per build; mutable support surfaces have no immutable revision key here, so no cross-scene geometry cache is assumed.
|
|
43
41
|
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new geometries/materials to the returned group and retains no separate registry; population is bounded by this space's nondegenerate surfaces and tessellation output. No disposer or partial-build rollback is exposed here, so scene-host retirement and construction-failure cleanup remain a gap rather than guaranteed release.
|
|
@@ -48,10 +46,10 @@ const buildSpaceObject = (space) => {
|
|
|
48
46
|
for (const surface of space.surfaces) {
|
|
49
47
|
const geometry = buildSurfaceGeometry(surface);
|
|
50
48
|
if (geometry === null) continue;
|
|
51
|
-
const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({
|
|
49
|
+
const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial(surface.color === void 0 ? {
|
|
52
50
|
colorWrite: false,
|
|
53
51
|
depthWrite: false
|
|
54
|
-
}));
|
|
52
|
+
} : { color: new THREE.Color(surface.color.r, surface.color.g, surface.color.b) }));
|
|
55
53
|
mesh.name = surface.id;
|
|
56
54
|
group.add(mesh);
|
|
57
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSpaceObject.mjs","names":[],"sources":["../../src/scene/buildSpaceObject.ts"],"sourcesContent":["import { tessellateSurface } from \"@automovie/engine\";\nimport type {\n IAutoMovieSpace,\n IAutoMovieSurface,\n IAutoMovieTessellation,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport { SPACE_GROUP_NAME } from \"./SPACE_GROUP_NAME.js\";\n\n/**\n * Build the structural ground of an {@link IAutoMovieSpace}: one `Mesh` per\n * standable surface, grouped under {@link SPACE_GROUP_NAME}.\n *\n * This is what closes the gap between the space the feet obey and the world the\n * guide passes draw (#1173). The surfaces were already the engine's semantic\n * ground (`heightAt`, support contacts, walkability) but nothing ever drew\n * them, so a depth or mask pass of a staged scene showed actors floating in a\n * void. Building them as real meshes is enough: every structural pass collects\n * geometry by traversing the scene and checking isMesh, then replaces its material, so the\n * ground joins depth, mask, normal, and outline with no pass-side special case,\n * unlike a `GridHelper`, which is a `LineSegments` and must be hidden before\n * every structural pass.\n *\n *
|
|
1
|
+
{"version":3,"file":"buildSpaceObject.mjs","names":[],"sources":["../../src/scene/buildSpaceObject.ts"],"sourcesContent":["import { tessellateSurface } from \"@automovie/engine\";\nimport type {\n IAutoMovieSpace,\n IAutoMovieSurface,\n IAutoMovieTessellation,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport { SPACE_GROUP_NAME } from \"./SPACE_GROUP_NAME.js\";\n\n/**\n * Build the structural ground of an {@link IAutoMovieSpace}: one `Mesh` per\n * standable surface, grouped under {@link SPACE_GROUP_NAME}.\n *\n * This is what closes the gap between the space the feet obey and the world the\n * guide passes draw (#1173). The surfaces were already the engine's semantic\n * ground (`heightAt`, support contacts, walkability) but nothing ever drew\n * them, so a depth or mask pass of a staged scene showed actors floating in a\n * void. Building them as real meshes is enough: every structural pass collects\n * geometry by traversing the scene and checking isMesh, then replaces its material, so the\n * ground joins depth, mask, normal, and outline with no pass-side special case,\n * unlike a `GridHelper`, which is a `LineSegments` and must be hidden before\n * every structural pass.\n *\n * A patch with an authored opaque color uses the same mesh in the beauty and\n * guide passes. An uncolored support patch writes neither color nor depth in\n * beauty, leaving any independently built floor to supply its appearance. All\n * patches remain structural guide geometry when a guide replaces the material.\n *\n * The engine decomposes each footprint into its actual convex pieces, including\n * notches and holes. Floors and ramps fan those pieces; heightfields clip them\n * to authored lattice cells. Vertex heights use the grounding height query and\n * triangles face +Y. Inside a twisted bilinear cell the drawn planar triangles\n * approximate the height rule; identical vertex heights do not prove identical\n * interpolated interior heights.\n *\n * A degenerate footprint (fewer than three non-collinear points, rejected by\n * `validateSpace`, but a hand-built space may still carry one) encloses no area\n * and contributes no mesh rather than an invalid geometry.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Uses the engine's actual footprint decomposition, height-rule tessellation, +Y winding and shared smooth normals, then realizes Float32 indexed geometry; admitted metre/Y-up surfaces satisfy engine premises, and bilinear cell interiors remain planar approximations rather than exact grounding geometry.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the Three mesh and opaque or guide-only material. The engine owns tessellation, and the guide passes own material replacement.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The appearance option changes only the one mesh's material. No fixture paths, duplicate visual geometry or replacement height rules participate.\n * @evidence contracts/development/common.md#meaningful-documentation Gives structural coverage, color opt-in, footprint regions, metre/Y-up winding, degenerate omission and the heightfield interior approximation.\n * @evidence contracts/development/implementation.md#efficient-algorithms Builds one mesh per nondegenerate surface and copies each emitted position/normal/index once; engine cost depends on convex pieces and touched heightfield cells, and output memory grows with tessellated vertices/triangles rather than scene raster size.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses the engine tessellation implementation but creates fresh scene-owned Three resources per build; mutable support surfaces have no immutable revision key here, so no cross-scene geometry cache is assumed.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new geometries/materials to the returned group and retains no separate registry; population is bounded by this space's nondegenerate surfaces and tessellation output. No disposer or partial-build rollback is exposed here, so scene-host retirement and construction-failure cleanup remain a gap rather than guaranteed release.\n */\nexport const buildSpaceObject: (space: IAutoMovieSpace) => THREE.Group = (\n space: IAutoMovieSpace,\n): THREE.Group => {\n const group: THREE.Group<THREE.Object3DEventMap> = new THREE.Group();\n group.name = SPACE_GROUP_NAME;\n for (const surface of space.surfaces) {\n const geometry: THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n > | null = buildSurfaceGeometry(surface);\n if (geometry === null) continue;\n const mesh: THREE.Mesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n THREE.MeshBasicMaterial,\n THREE.Object3DEventMap\n > = new THREE.Mesh(\n geometry,\n new THREE.MeshBasicMaterial(\n surface.color === undefined\n ? { colorWrite: false, depthWrite: false }\n : {\n color: new THREE.Color(\n surface.color.r,\n surface.color.g,\n surface.color.b,\n ),\n },\n ),\n );\n mesh.name = surface.id;\n group.add(mesh);\n }\n return group;\n};\n\n/**\n * One surface footprint as a triangulated planar patch, or `null` when the\n * footprint encloses no area.\n */\nconst buildSurfaceGeometry: (\n surface: IAutoMovieSurface,\n) => THREE.BufferGeometry | null = (\n surface: IAutoMovieSurface,\n): THREE.BufferGeometry | null => {\n const mesh: IAutoMovieTessellation | null = tessellateSurface(surface);\n if (mesh === null) return null;\n const geometry: THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n > = new THREE.BufferGeometry();\n geometry.setAttribute(\n \"position\",\n new THREE.Float32BufferAttribute(mesh.positions, 3),\n );\n geometry.setAttribute(\n \"normal\",\n new THREE.Float32BufferAttribute(mesh.normals, 3),\n );\n geometry.setIndex(mesh.indices);\n return geometry;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAa,oBACX,UACgB;CAChB,MAAM,QAA6C,IAAI,MAAM,MAAM;CACnE,MAAM,OAAO;CACb,KAAK,MAAM,WAAW,MAAM,UAAU;EACpC,MAAM,WAGK,qBAAqB,OAAO;EACvC,IAAI,aAAa,MAAM;EACvB,MAAM,OAOF,IAAI,MAAM,KACZ,UACA,IAAI,MAAM,kBACR,QAAQ,UAAU,KAAA,IACd;GAAE,YAAY;GAAO,YAAY;EAAM,IACvC,EACE,OAAO,IAAI,MAAM,MACf,QAAQ,MAAM,GACd,QAAQ,MAAM,GACd,QAAQ,MAAM,CAChB,EACF,CACN,CACF;EACA,KAAK,OAAO,QAAQ;EACpB,MAAM,IAAI,IAAI;CAChB;CACA,OAAO;AACT;;;;;AAMA,MAAM,wBAGJ,YACgC;CAChC,MAAM,OAAsC,kBAAkB,OAAO;CACrE,IAAI,SAAS,MAAM,OAAO;CAC1B,MAAM,WAGF,IAAI,MAAM,eAAe;CAC7B,SAAS,aACP,YACA,IAAI,MAAM,uBAAuB,KAAK,WAAW,CAAC,CACpD;CACA,SAAS,aACP,UACA,IAAI,MAAM,uBAAuB,KAAK,SAAS,CAAC,CAClD;CACA,SAAS,SAAS,KAAK,OAAO;CAC9B,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automovie/render",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "automovie render: deterministic frame schedule + encode plan from a render spec",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@automovie/engine": "^0.3.
|
|
32
|
-
"@automovie/ingest": "^0.3.
|
|
33
|
-
"@automovie/interface": "^0.3.
|
|
31
|
+
"@automovie/engine": "^0.3.3",
|
|
32
|
+
"@automovie/ingest": "^0.3.3",
|
|
33
|
+
"@automovie/interface": "^0.3.3",
|
|
34
34
|
"three": "^0.186.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-based, regularly spaced presentation frames followed by the exact end.
|
|
3
|
+
* Takes and preview controls share the grid, including an endpoint that falls
|
|
4
|
+
* between regular frame times.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the index origin, temporal spacing, endpoint, and consumers.
|
|
7
|
+
* @evidence contracts/development/design.md#principled-representation Frame indices are zero-based integers, timestamps and duration are seconds, and cadence is positive frames per second. JavaScript numbers do not enforce these constraints, so the caller supplies a valid presentation clock and index.
|
|
8
|
+
* @evidence contracts/development/design.md#minimal-and-owned-surface Render owns frame schedules. The take producer reads the last index and frame times, and the preview controls also map a playhead second to a displayed frame index.
|
|
9
|
+
* @evidence contracts/development/design.md#prohibited-design-shortcuts The endpoint rule works for both exact-grid and fractional durations and requires no caller-specific mode.
|
|
10
|
+
*/
|
|
11
|
+
export namespace AutoMovieFrameGrid {
|
|
12
|
+
/**
|
|
13
|
+
* Find the final zero-based frame number for a nonnegative duration in
|
|
14
|
+
* seconds and a positive rate in frames per second. The exact end takes
|
|
15
|
+
* the place of the first regular frame at or past the end.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the units, index origin, and the final frame's relation to the regular cadence.
|
|
18
|
+
* @evidence contracts/development/implementation.md#principled-implementation Compares the candidate's canonical timestamp to the end since the product alone can round across an integer.
|
|
19
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Computes one candidate, then advances it if its timestamp is still before the end.
|
|
20
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Keeps a fractional end distinct from the regular frame immediately before it without an arbitrary epsilon.
|
|
21
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
22
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one candidate and its time.
|
|
23
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
24
|
+
*/
|
|
25
|
+
export function last(duration: number, fps: number): number {
|
|
26
|
+
const nearest: number = Math.round(duration * fps);
|
|
27
|
+
return nearest / fps < duration ? nearest + 1 : nearest;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Read a zero-based frame's timestamp in seconds at the given rate in
|
|
32
|
+
* frames per second, clamped to the final timestamp, `duration`.
|
|
33
|
+
*
|
|
34
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the index origin, input and return units, and the end clamp.
|
|
35
|
+
* @evidence contracts/development/implementation.md#principled-implementation One division yields the canonical timestamp without accumulating rounding error.
|
|
36
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Divides the index by the rate and clamps the result.
|
|
37
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Returns the exact end when the next regular frame would run past it.
|
|
38
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
39
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one timestamp.
|
|
40
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
41
|
+
*/
|
|
42
|
+
export function time(frame: number, duration: number, fps: number): number {
|
|
43
|
+
return Math.min(frame / fps, duration);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Show the closest regular frame for an in-range second, reserving the
|
|
48
|
+
* final frame for the exact end. The caller supplies the duration in
|
|
49
|
+
* seconds, the rate in frames per second, and the already computed last
|
|
50
|
+
* frame number.
|
|
51
|
+
*
|
|
52
|
+
* @evidence contracts/development/common.md#meaningful-documentation Defines the rounding policy, the exact end, and the units of the supplied clock.
|
|
53
|
+
* @evidence contracts/development/implementation.md#principled-implementation Rounds within the regular grid and reserves the end index for the actual end, so it remains a separate scrubber position.
|
|
54
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Returns the last index at the end and otherwise rounds and caps the regular index.
|
|
55
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A playhead just before the end cannot occupy the end index.
|
|
56
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
|
|
57
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Uses the last frame number already computed for the grid.
|
|
58
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
|
|
59
|
+
*/
|
|
60
|
+
export function nearest(
|
|
61
|
+
seconds: number,
|
|
62
|
+
duration: number,
|
|
63
|
+
fps: number,
|
|
64
|
+
last: number,
|
|
65
|
+
): number {
|
|
66
|
+
return seconds >= duration
|
|
67
|
+
? last
|
|
68
|
+
: Math.min(last - 1, Math.round(seconds * fps));
|
|
69
|
+
}
|
|
70
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,11 +17,10 @@ import { SPACE_GROUP_NAME } from "./buildSpace.js";
|
|
|
17
17
|
* The requirement asks for caster and receiver to be **distinguished** rather
|
|
18
18
|
* than blanket-enabled, and the product knows the difference at exactly one
|
|
19
19
|
* place, which is here. A model's parts are solids: they cast and they receive.
|
|
20
|
-
* The standable surfaces under {@link SPACE_GROUP_NAME} are
|
|
21
|
-
*
|
|
22
|
-
* volume-free patch casting onto its own plane produces depth acne,
|
|
23
|
-
*
|
|
24
|
-
* evidence of a physical floor. Anything carrying no geometry is untouched.
|
|
20
|
+
* The standable surfaces under {@link SPACE_GROUP_NAME} are open patches for
|
|
21
|
+
* structural guides and optional flat color. They neither cast nor receive.
|
|
22
|
+
* A volume-free patch casting onto its own plane produces depth acne, and its
|
|
23
|
+
* basic material has no shadow response. Objects without geometry are untouched.
|
|
25
24
|
*
|
|
26
25
|
* Exported, and separate from {@link buildScene}, for the reason
|
|
27
26
|
* {@link applySceneFog} is: a host that assembles its own scene graph — a
|
|
@@ -18,6 +18,7 @@ import { applySubsurfaceShading } from "./subsurfaceShading/index.js";
|
|
|
18
18
|
* meaning and leaving an omitted lobe at its neutral value. It
|
|
19
19
|
* carries the material's name, or its id when unnamed, as the glTF export
|
|
20
20
|
* does, so a preview can recognise a finish by it.
|
|
21
|
+
* A fully transparent blended surface with no transmission skips color, depth and shadow draws.
|
|
21
22
|
* The producer owns its new material before resolving texture bindings. Setup
|
|
22
23
|
* failure retires that material and preserves cleanup causes; resolver textures
|
|
23
24
|
* and shared shader tables remain owned by their actual producers.
|
|
@@ -55,6 +56,12 @@ export const buildMaterial: (
|
|
|
55
56
|
transparent: alphaMode === "blend",
|
|
56
57
|
depthWrite: alphaMode !== "blend",
|
|
57
58
|
opacity: material.opacity,
|
|
59
|
+
// Three's shadow materials copy alpha tests and maps, but do not copy opacity.
|
|
60
|
+
visible: !(
|
|
61
|
+
alphaMode === "blend" &&
|
|
62
|
+
material.opacity === 0 &&
|
|
63
|
+
(material.transmission ?? 0) === 0
|
|
64
|
+
),
|
|
58
65
|
alphaTest: alphaMode === "mask" ? (material.alphaCutoff ?? 0.5) : 0,
|
|
59
66
|
side:
|
|
60
67
|
material.doubleSided === true ? THREE.DoubleSide : THREE.FrontSide,
|
package/src/scene/buildModel.ts
CHANGED
|
@@ -68,6 +68,7 @@ import { applyReliefWeights } from "./reliefWeightShading/index.js";
|
|
|
68
68
|
* cannot follow a morph or replace a transformed normal-map frame. This
|
|
69
69
|
* changes no source arrays or material coefficients, is not a MikkTSpace bake
|
|
70
70
|
* guarantee and leaves degenerate UVs on their existing fallback.
|
|
71
|
+
* Fully transparent, non-transmissive parts stay hidden when a guide swaps materials.
|
|
71
72
|
*
|
|
72
73
|
* @evidence contracts/development/implementation.md#principled-implementation Builds admitted semantic bone rest TR and part TRS, binds skin joints or rigid attached bones, selects linear or dual quaternion skinning per skin through the material shader patch and matching shadow materials, realizes geometry/PBR through their canonical owners and derives vertex tangents only for anisotropic rigid, morph-free, normal-map-free indexed normal/UV geometry. Nonfinite/zero derived axes discard the new attribute; mapped/deforming or unsupported geometry retains its existing derivative-frame limitations. Consistent source normals remain a premise; this is not a MikkTSpace bake guarantee. AttachedBone intentionally takes precedence over skin, bone rest scale is unit by engine convention and complete finite/unique hierarchy/material admission remains upstream.
|
|
73
74
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns one model graph plus semantic bone/part registries, one skeleton per ordered joint list, material variants by definition id with vertex-color/relief/skinning-method flags and one patched shadow pair per dual quaternion mesh; geometry, physical-vertex mapping, material shading and imported appearances remain separate producers.
|
|
@@ -232,6 +233,7 @@ export const buildModel: (
|
|
|
232
233
|
> = skin !== null
|
|
233
234
|
? new AutoMovieSkinnedMesh(geo, mat, skin.method ?? "linear")
|
|
234
235
|
: new THREE.Mesh(geo, mat);
|
|
236
|
+
mesh.visible = mat.visible;
|
|
235
237
|
mesh.name = part.name ?? part.id;
|
|
236
238
|
parts.set(part.id, mesh);
|
|
237
239
|
// Three's Mesh constructor ran updateMorphTargets(), so the dictionary
|
|
@@ -22,12 +22,10 @@ import { SPACE_GROUP_NAME } from "./SPACE_GROUP_NAME.js";
|
|
|
22
22
|
* unlike a `GridHelper`, which is a `LineSegments` and must be hidden before
|
|
23
23
|
* every structural pass.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* depth would still let it occlude authored geometry. Guide passes replace the
|
|
30
|
-
* material and therefore keep the structural geometry #1173 introduced.
|
|
25
|
+
* A patch with an authored opaque color uses the same mesh in the beauty and
|
|
26
|
+
* guide passes. An uncolored support patch writes neither color nor depth in
|
|
27
|
+
* beauty, leaving any independently built floor to supply its appearance. All
|
|
28
|
+
* patches remain structural guide geometry when a guide replaces the material.
|
|
31
29
|
*
|
|
32
30
|
* The engine decomposes each footprint into its actual convex pieces, including
|
|
33
31
|
* notches and holes. Floors and ramps fan those pieces; heightfields clip them
|
|
@@ -41,9 +39,9 @@ import { SPACE_GROUP_NAME } from "./SPACE_GROUP_NAME.js";
|
|
|
41
39
|
* and contributes no mesh rather than an invalid geometry.
|
|
42
40
|
*
|
|
43
41
|
* @evidence contracts/development/implementation.md#principled-implementation Uses the engine's actual footprint decomposition, height-rule tessellation, +Y winding and shared smooth normals, then realizes Float32 indexed geometry; admitted metre/Y-up surfaces satisfy engine premises, and bilinear cell interiors remain planar approximations rather than exact grounding geometry.
|
|
44
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns
|
|
45
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts
|
|
46
|
-
* @evidence contracts/development/common.md#meaningful-documentation Gives structural
|
|
42
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the Three mesh and opaque or guide-only material. The engine owns tessellation, and the guide passes own material replacement.
|
|
43
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The appearance option changes only the one mesh's material. No fixture paths, duplicate visual geometry or replacement height rules participate.
|
|
44
|
+
* @evidence contracts/development/common.md#meaningful-documentation Gives structural coverage, color opt-in, footprint regions, metre/Y-up winding, degenerate omission and the heightfield interior approximation.
|
|
47
45
|
* @evidence contracts/development/implementation.md#efficient-algorithms Builds one mesh per nondegenerate surface and copies each emitted position/normal/index once; engine cost depends on convex pieces and touched heightfield cells, and output memory grows with tessellated vertices/triangles rather than scene raster size.
|
|
48
46
|
* @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses the engine tessellation implementation but creates fresh scene-owned Three resources per build; mutable support surfaces have no immutable revision key here, so no cross-scene geometry cache is assumed.
|
|
49
47
|
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new geometries/materials to the returned group and retains no separate registry; population is bounded by this space's nondegenerate surfaces and tessellation output. No disposer or partial-build rollback is exposed here, so scene-host retirement and construction-failure cleanup remain a gap rather than guaranteed release.
|
|
@@ -68,7 +66,17 @@ export const buildSpaceObject: (space: IAutoMovieSpace) => THREE.Group = (
|
|
|
68
66
|
THREE.Object3DEventMap
|
|
69
67
|
> = new THREE.Mesh(
|
|
70
68
|
geometry,
|
|
71
|
-
new THREE.MeshBasicMaterial(
|
|
69
|
+
new THREE.MeshBasicMaterial(
|
|
70
|
+
surface.color === undefined
|
|
71
|
+
? { colorWrite: false, depthWrite: false }
|
|
72
|
+
: {
|
|
73
|
+
color: new THREE.Color(
|
|
74
|
+
surface.color.r,
|
|
75
|
+
surface.color.g,
|
|
76
|
+
surface.color.b,
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
),
|
|
72
80
|
);
|
|
73
81
|
mesh.name = surface.id;
|
|
74
82
|
group.add(mesh);
|