@fps-games/engine 0.0.1-beta.1 → 0.0.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babylon/lighting-controller.d.ts +27 -0
- package/dist/babylon/lighting-controller.d.ts.map +1 -0
- package/dist/babylon/lighting-controller.js +126 -0
- package/dist/babylon/lighting-controller.js.map +1 -0
- package/dist/babylon.d.ts +1 -0
- package/dist/babylon.d.ts.map +1 -1
- package/dist/babylon.js +1 -0
- package/dist/babylon.js.map +1 -1
- package/dist/build-info.json +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lighting.d.ts +54 -0
- package/dist/lighting.d.ts.map +1 -0
- package/dist/lighting.js +187 -0
- package/dist/lighting.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight.js';
|
|
2
|
+
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight.js';
|
|
3
|
+
import type { Scene } from '@babylonjs/core/scene.js';
|
|
4
|
+
import { type FpsRuntimeLight, type FpsRuntimeLightNodeSnapshot } from '../lighting.js';
|
|
5
|
+
export type FpsBabylonRuntimeLight = DirectionalLight | HemisphericLight;
|
|
6
|
+
export type FpsBabylonLightingMutation = 'created' | 'updated' | 'replaced';
|
|
7
|
+
export interface FpsBabylonLightingApplyResult {
|
|
8
|
+
readonly nodeId: string;
|
|
9
|
+
readonly mutation: FpsBabylonLightingMutation;
|
|
10
|
+
readonly light: FpsBabylonRuntimeLight;
|
|
11
|
+
readonly previousType?: FpsRuntimeLight['type'];
|
|
12
|
+
}
|
|
13
|
+
export interface FpsBabylonLightingController {
|
|
14
|
+
applyNode(snapshot: FpsRuntimeLightNodeSnapshot): Readonly<FpsBabylonLightingApplyResult>;
|
|
15
|
+
getLight(nodeId: string): FpsBabylonRuntimeLight | null;
|
|
16
|
+
/** Returns true only when an existing Light changed enabled state. */
|
|
17
|
+
setNodeEnabled(nodeId: string, enabled: boolean): boolean;
|
|
18
|
+
removeNode(nodeId: string): boolean;
|
|
19
|
+
getNodeIds(): readonly string[];
|
|
20
|
+
dispose(): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Owns only Babylon Light resources. Editor helpers, shadows, cameras and
|
|
24
|
+
* authoring data remain outside this controller.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createFpsBabylonLightingController(scene: Scene): FpsBabylonLightingController;
|
|
27
|
+
//# sourceMappingURL=lighting-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting-controller.d.ts","sourceRoot":"","sources":["../../src/babylon/lighting-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EACjC,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAE5E,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,QAAQ,EAAE,2BAA2B,GAAG,QAAQ,CAAC,6BAA6B,CAAC,CAAC;IAC1F,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI,CAAC;IACxD,sEAAsE;IACtE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;IAC1D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,UAAU,IAAI,SAAS,MAAM,EAAE,CAAC;IAChC,OAAO,IAAI,IAAI,CAAC;CACjB;AAOD;;;GAGG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,KAAK,GACX,4BAA4B,CA8E9B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight.js';
|
|
2
|
+
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight.js';
|
|
3
|
+
import { Color3 } from '@babylonjs/core/Maths/math.color.js';
|
|
4
|
+
import { Vector3 } from '@babylonjs/core/Maths/math.vector.js';
|
|
5
|
+
import { createFpsRuntimeLightSnapshot, } from '../lighting.js';
|
|
6
|
+
/**
|
|
7
|
+
* Owns only Babylon Light resources. Editor helpers, shadows, cameras and
|
|
8
|
+
* authoring data remain outside this controller.
|
|
9
|
+
*/
|
|
10
|
+
export function createFpsBabylonLightingController(scene) {
|
|
11
|
+
const entries = new Map();
|
|
12
|
+
let disposed = false;
|
|
13
|
+
const assertActive = () => {
|
|
14
|
+
if (disposed)
|
|
15
|
+
throw new Error('runtime.lighting.controllerDisposed');
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
applyNode(snapshot) {
|
|
19
|
+
assertActive();
|
|
20
|
+
const nodeId = readNodeId(snapshot?.nodeId);
|
|
21
|
+
const enabled = readEnabled(snapshot?.enabled);
|
|
22
|
+
const lightSnapshot = createFpsRuntimeLightSnapshot(snapshot?.light, `$.scene.nodes[${JSON.stringify(nodeId)}].light`);
|
|
23
|
+
const existing = entries.get(nodeId);
|
|
24
|
+
if (existing?.type === lightSnapshot.type) {
|
|
25
|
+
applyLightSnapshot(existing.light, lightSnapshot, enabled);
|
|
26
|
+
return Object.freeze({
|
|
27
|
+
nodeId,
|
|
28
|
+
mutation: 'updated',
|
|
29
|
+
light: existing.light,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
let replacement = null;
|
|
33
|
+
try {
|
|
34
|
+
replacement = createLight(scene, nodeId, lightSnapshot);
|
|
35
|
+
applyLightSnapshot(replacement, lightSnapshot, enabled);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
replacement?.dispose();
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
entries.set(nodeId, { type: lightSnapshot.type, light: replacement });
|
|
42
|
+
existing?.light.dispose();
|
|
43
|
+
return Object.freeze({
|
|
44
|
+
nodeId,
|
|
45
|
+
mutation: existing ? 'replaced' : 'created',
|
|
46
|
+
light: replacement,
|
|
47
|
+
...(existing ? { previousType: existing.type } : {}),
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
getLight(nodeId) {
|
|
51
|
+
assertActive();
|
|
52
|
+
return entries.get(nodeId)?.light ?? null;
|
|
53
|
+
},
|
|
54
|
+
setNodeEnabled(nodeId, enabled) {
|
|
55
|
+
assertActive();
|
|
56
|
+
const entry = entries.get(readNodeId(nodeId));
|
|
57
|
+
if (!entry)
|
|
58
|
+
return false;
|
|
59
|
+
const resolvedEnabled = readEnabled(enabled);
|
|
60
|
+
if (entry.light.isEnabled() === resolvedEnabled)
|
|
61
|
+
return false;
|
|
62
|
+
entry.light.setEnabled(resolvedEnabled);
|
|
63
|
+
return true;
|
|
64
|
+
},
|
|
65
|
+
removeNode(nodeId) {
|
|
66
|
+
assertActive();
|
|
67
|
+
const resolvedNodeId = readNodeId(nodeId);
|
|
68
|
+
const entry = entries.get(resolvedNodeId);
|
|
69
|
+
if (!entry)
|
|
70
|
+
return false;
|
|
71
|
+
entries.delete(resolvedNodeId);
|
|
72
|
+
entry.light.dispose();
|
|
73
|
+
return true;
|
|
74
|
+
},
|
|
75
|
+
getNodeIds() {
|
|
76
|
+
assertActive();
|
|
77
|
+
return Object.freeze([...entries.keys()]);
|
|
78
|
+
},
|
|
79
|
+
dispose() {
|
|
80
|
+
if (disposed)
|
|
81
|
+
return;
|
|
82
|
+
disposed = true;
|
|
83
|
+
for (const entry of entries.values())
|
|
84
|
+
entry.light.dispose();
|
|
85
|
+
entries.clear();
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function createLight(scene, nodeId, snapshot) {
|
|
90
|
+
if (snapshot.type === 'directional') {
|
|
91
|
+
return new DirectionalLight(`${nodeId}.directionalLight`, toVector3(snapshot.direction), scene);
|
|
92
|
+
}
|
|
93
|
+
return new HemisphericLight(`${nodeId}.hemisphericLight`, Vector3.Up(), scene);
|
|
94
|
+
}
|
|
95
|
+
function applyLightSnapshot(light, snapshot, enabled) {
|
|
96
|
+
light.intensity = snapshot.intensity;
|
|
97
|
+
copyColor(light.diffuse, snapshot.diffuseColor);
|
|
98
|
+
light.setEnabled(enabled);
|
|
99
|
+
if (snapshot.type === 'directional') {
|
|
100
|
+
const directional = light;
|
|
101
|
+
copyVector(directional.direction, snapshot.direction);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
copyColor(light.groundColor, snapshot.groundColor);
|
|
105
|
+
}
|
|
106
|
+
function copyVector(target, source) {
|
|
107
|
+
target.copyFromFloats(source.x, source.y, source.z);
|
|
108
|
+
}
|
|
109
|
+
function copyColor(target, source) {
|
|
110
|
+
target.copyFromFloats(source.r, source.g, source.b);
|
|
111
|
+
}
|
|
112
|
+
function toVector3(source) {
|
|
113
|
+
return new Vector3(source.x, source.y, source.z);
|
|
114
|
+
}
|
|
115
|
+
function readNodeId(value) {
|
|
116
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
117
|
+
throw new Error('runtime.lighting.nodeIdInvalid');
|
|
118
|
+
}
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
function readEnabled(value) {
|
|
122
|
+
if (typeof value !== 'boolean')
|
|
123
|
+
throw new Error('runtime.lighting.enabledInvalid');
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=lighting-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting-controller.js","sourceRoot":"","sources":["../../src/babylon/lighting-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EACL,6BAA6B,GAK9B,MAAM,gBAAgB,CAAC;AA2BxB;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAChD,KAAY;IAEZ,MAAM,OAAO,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC3D,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,MAAM,YAAY,GAAG,GAAS,EAAE;QAC9B,IAAI,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,CAAC,QAAQ;YAChB,YAAY,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC/C,MAAM,aAAa,GAAG,6BAA6B,CACjD,QAAQ,EAAE,KAAK,EACf,iBAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CACjD,CAAC;YACF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrC,IAAI,QAAQ,EAAE,IAAI,KAAK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,UAAU,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACnF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/babylon.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const ENGINE_BABYLON_SUBPATH = "@fps-games/engine/babylon";
|
|
2
|
+
export { createFpsBabylonLightingController, type FpsBabylonLightingApplyResult, type FpsBabylonLightingController, type FpsBabylonLightingMutation, type FpsBabylonRuntimeLight, } from './babylon/lighting-controller.js';
|
|
2
3
|
//# sourceMappingURL=babylon.d.ts.map
|
package/dist/babylon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babylon.d.ts","sourceRoot":"","sources":["../src/babylon.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"babylon.d.ts","sourceRoot":"","sources":["../src/babylon.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,OAAO,EACL,kCAAkC,EAClC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,GAC5B,MAAM,kCAAkC,CAAC"}
|
package/dist/babylon.js
CHANGED
package/dist/babylon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babylon.js","sourceRoot":"","sources":["../src/babylon.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"babylon.js","sourceRoot":"","sources":["../src/babylon.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAElE,OAAO,EACL,kCAAkC,GAKnC,MAAM,kCAAkC,CAAC"}
|
package/dist/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "@fps-games/engine",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
5
|
-
"gitSha": "
|
|
6
|
-
"distHash": "
|
|
7
|
-
"cacheKey": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.2",
|
|
5
|
+
"gitSha": "a9d2210d8a8ad81aa0a1d0a2606df1fa36ce0c2d",
|
|
6
|
+
"distHash": "2f04a9cf130c7933cda2047dc29b154b9461bc6915800c97e2f9cfd2ef2503fc",
|
|
7
|
+
"cacheKey": "0.0.1-beta.2-2f04a9cf130c"
|
|
8
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const ENGINE_PACKAGE_MARKER = "@fps-games/engine";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ENGINE_IMPLEMENTATION_PHASE = "domain-migration";
|
|
3
3
|
export interface FpsEngineRuntimeDataMarker {
|
|
4
4
|
readonly schemaVersion: 1;
|
|
5
5
|
readonly marker: typeof ENGINE_PACKAGE_MARKER;
|
|
6
6
|
}
|
|
7
|
+
export { FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION, FpsRuntimeLightingDataError, createFpsRuntimeLightSnapshot, createFpsRuntimeSystemLightingSnapshot, normalizeFpsRuntimeLightDirection, type FpsRuntimeDirectionalLight, type FpsRuntimeHemisphericLight, type FpsRuntimeLight, type FpsRuntimeLightColorRgb, type FpsRuntimeLightNodeSnapshot, type FpsRuntimeLightVec3, type FpsRuntimeSystemLightingSnapshot, } from './lighting.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAE9D,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,qBAAqB,CAAC;CAC/C;AAED,OAAO,EACL,0CAA0C,EAC1C,2BAA2B,EAC3B,6BAA6B,EAC7B,sCAAsC,EACtC,iCAAiC,EACjC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,GACtC,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const ENGINE_PACKAGE_MARKER = '@fps-games/engine';
|
|
2
|
-
export const
|
|
2
|
+
export const ENGINE_IMPLEMENTATION_PHASE = 'domain-migration';
|
|
3
|
+
export { FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION, FpsRuntimeLightingDataError, createFpsRuntimeLightSnapshot, createFpsRuntimeSystemLightingSnapshot, normalizeFpsRuntimeLightDirection, } from './lighting.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACzD,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACzD,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,CAAC;AAO9D,OAAO,EACL,0CAA0C,EAC1C,2BAA2B,EAC3B,6BAA6B,EAC7B,sCAAsC,EACtC,iCAAiC,GAQlC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION: 1;
|
|
2
|
+
export interface FpsRuntimeLightVec3 {
|
|
3
|
+
readonly x: number;
|
|
4
|
+
readonly y: number;
|
|
5
|
+
readonly z: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FpsRuntimeLightColorRgb {
|
|
8
|
+
readonly r: number;
|
|
9
|
+
readonly g: number;
|
|
10
|
+
readonly b: number;
|
|
11
|
+
}
|
|
12
|
+
export interface FpsRuntimeDirectionalLight {
|
|
13
|
+
readonly schemaVersion: typeof FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION;
|
|
14
|
+
readonly type: 'directional';
|
|
15
|
+
readonly intensity: number;
|
|
16
|
+
readonly direction: FpsRuntimeLightVec3;
|
|
17
|
+
readonly diffuseColor: FpsRuntimeLightColorRgb;
|
|
18
|
+
}
|
|
19
|
+
export interface FpsRuntimeHemisphericLight {
|
|
20
|
+
readonly schemaVersion: typeof FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION;
|
|
21
|
+
readonly type: 'hemispheric';
|
|
22
|
+
readonly intensity: number;
|
|
23
|
+
readonly diffuseColor: FpsRuntimeLightColorRgb;
|
|
24
|
+
readonly groundColor: FpsRuntimeLightColorRgb;
|
|
25
|
+
}
|
|
26
|
+
export type FpsRuntimeLight = FpsRuntimeDirectionalLight | FpsRuntimeHemisphericLight;
|
|
27
|
+
export interface FpsRuntimeLightNodeSnapshot<TLight extends FpsRuntimeLight = FpsRuntimeLight> {
|
|
28
|
+
readonly nodeId: string;
|
|
29
|
+
readonly enabled: boolean;
|
|
30
|
+
readonly light: TLight;
|
|
31
|
+
}
|
|
32
|
+
export interface FpsRuntimeSystemLightingSnapshot {
|
|
33
|
+
readonly environment: FpsRuntimeLightNodeSnapshot<FpsRuntimeHemisphericLight>;
|
|
34
|
+
readonly directional: FpsRuntimeLightNodeSnapshot<FpsRuntimeDirectionalLight>;
|
|
35
|
+
}
|
|
36
|
+
export declare class FpsRuntimeLightingDataError extends Error {
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly reason: string;
|
|
39
|
+
readonly code = "runtime.lighting.invalid";
|
|
40
|
+
constructor(path: string, reason: string);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Producer-side helper used by compilers to emit the single canonical Runtime
|
|
44
|
+
* representation. Runtime validation still rejects non-unit directions.
|
|
45
|
+
*/
|
|
46
|
+
export declare function normalizeFpsRuntimeLightDirection(value: unknown, path?: string): Readonly<FpsRuntimeLightVec3>;
|
|
47
|
+
export declare function createFpsRuntimeLightSnapshot(value: unknown, path?: string): Readonly<FpsRuntimeLight>;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves the two required system lights before a Renderer creates resources.
|
|
50
|
+
* Extra non-light scene nodes are ignored; duplicate or missing system roles
|
|
51
|
+
* fail closed.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createFpsRuntimeSystemLightingSnapshot(value: unknown, path?: string): Readonly<FpsRuntimeSystemLightingSnapshot>;
|
|
54
|
+
//# sourceMappingURL=lighting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting.d.ts","sourceRoot":"","sources":["../src/lighting.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0CAA0C,EAAG,CAAU,CAAC;AAErE,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E,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;CAC/E;AAED,qBAAa,2BAA4B,SAAQ,KAAK;IAIlD,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAJzB,QAAQ,CAAC,IAAI,8BAA8B;gBAGhC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAK1B;AAqBD;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,EACd,IAAI,SAAgB,GACnB,QAAQ,CAAC,mBAAmB,CAAC,CAS/B;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,IAAI,SAAY,GACf,QAAQ,CAAC,eAAe,CAAC,CAyC3B;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,OAAO,EACd,IAAI,SAAkB,GACrB,QAAQ,CAAC,gCAAgC,CAAC,CA8B5C"}
|
package/dist/lighting.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export const FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION = 1;
|
|
2
|
+
export class FpsRuntimeLightingDataError extends Error {
|
|
3
|
+
path;
|
|
4
|
+
reason;
|
|
5
|
+
code = 'runtime.lighting.invalid';
|
|
6
|
+
constructor(path, reason) {
|
|
7
|
+
super(`Invalid Runtime Lighting data at ${path}: ${reason}`);
|
|
8
|
+
this.path = path;
|
|
9
|
+
this.reason = reason;
|
|
10
|
+
this.name = 'FpsRuntimeLightingDataError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const DIRECTION_LENGTH_EPSILON = 0.000001;
|
|
14
|
+
const DIRECTION_UNIT_TOLERANCE = 0.000001;
|
|
15
|
+
const DIRECTIONAL_FIELDS = new Set([
|
|
16
|
+
'schemaVersion',
|
|
17
|
+
'type',
|
|
18
|
+
'intensity',
|
|
19
|
+
'direction',
|
|
20
|
+
'diffuseColor',
|
|
21
|
+
]);
|
|
22
|
+
const HEMISPHERIC_FIELDS = new Set([
|
|
23
|
+
'schemaVersion',
|
|
24
|
+
'type',
|
|
25
|
+
'intensity',
|
|
26
|
+
'diffuseColor',
|
|
27
|
+
'groundColor',
|
|
28
|
+
]);
|
|
29
|
+
const VEC3_FIELDS = new Set(['x', 'y', 'z']);
|
|
30
|
+
const COLOR_FIELDS = new Set(['r', 'g', 'b']);
|
|
31
|
+
/**
|
|
32
|
+
* Producer-side helper used by compilers to emit the single canonical Runtime
|
|
33
|
+
* representation. Runtime validation still rejects non-unit directions.
|
|
34
|
+
*/
|
|
35
|
+
export function normalizeFpsRuntimeLightDirection(value, path = '$.direction') {
|
|
36
|
+
const direction = readVec3(value, path);
|
|
37
|
+
const length = Math.hypot(direction.x, direction.y, direction.z);
|
|
38
|
+
if (length <= DIRECTION_LENGTH_EPSILON)
|
|
39
|
+
invalid(path, 'expected a non-zero direction vector');
|
|
40
|
+
return Object.freeze({
|
|
41
|
+
x: direction.x / length,
|
|
42
|
+
y: direction.y / length,
|
|
43
|
+
z: direction.z / length,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function createFpsRuntimeLightSnapshot(value, path = '$.light') {
|
|
47
|
+
const light = record(value, path);
|
|
48
|
+
if (light.schemaVersion !== FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION) {
|
|
49
|
+
invalid(`${path}.schemaVersion`, `expected ${FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION}`);
|
|
50
|
+
}
|
|
51
|
+
const intensity = nonNegativeFiniteNumber(light.intensity, `${path}.intensity`);
|
|
52
|
+
if (light.type === 'directional') {
|
|
53
|
+
assertKnownFields(light, DIRECTIONAL_FIELDS, path);
|
|
54
|
+
const direction = readVec3(light.direction, `${path}.direction`);
|
|
55
|
+
const length = Math.hypot(direction.x, direction.y, direction.z);
|
|
56
|
+
if (length <= DIRECTION_LENGTH_EPSILON) {
|
|
57
|
+
invalid(`${path}.direction`, 'expected a non-zero direction vector');
|
|
58
|
+
}
|
|
59
|
+
if (Math.abs(length - 1) > DIRECTION_UNIT_TOLERANCE) {
|
|
60
|
+
invalid(`${path}.direction`, 'expected a normalized direction vector');
|
|
61
|
+
}
|
|
62
|
+
return Object.freeze({
|
|
63
|
+
schemaVersion: FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION,
|
|
64
|
+
type: 'directional',
|
|
65
|
+
intensity,
|
|
66
|
+
direction,
|
|
67
|
+
diffuseColor: readColor(light.diffuseColor, `${path}.diffuseColor`),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (light.type === 'hemispheric') {
|
|
71
|
+
assertKnownFields(light, HEMISPHERIC_FIELDS, path);
|
|
72
|
+
return Object.freeze({
|
|
73
|
+
schemaVersion: FPS_RUNTIME_LIGHT_COMPONENT_SCHEMA_VERSION,
|
|
74
|
+
type: 'hemispheric',
|
|
75
|
+
intensity,
|
|
76
|
+
diffuseColor: readColor(light.diffuseColor, `${path}.diffuseColor`),
|
|
77
|
+
groundColor: readColor(light.groundColor, `${path}.groundColor`),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
invalid(`${path}.type`, 'expected directional or hemispheric');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the two required system lights before a Renderer creates resources.
|
|
84
|
+
* Extra non-light scene nodes are ignored; duplicate or missing system roles
|
|
85
|
+
* fail closed.
|
|
86
|
+
*/
|
|
87
|
+
export function createFpsRuntimeSystemLightingSnapshot(value, path = '$.scene.nodes') {
|
|
88
|
+
if (!Array.isArray(value))
|
|
89
|
+
invalid(path, 'expected an array of Runtime scene nodes');
|
|
90
|
+
let environment;
|
|
91
|
+
let directional;
|
|
92
|
+
const lightNodeIds = new Set();
|
|
93
|
+
value.forEach((candidate, index) => {
|
|
94
|
+
const nodePath = `${path}[${index}]`;
|
|
95
|
+
const node = record(candidate, nodePath);
|
|
96
|
+
if (!Object.prototype.hasOwnProperty.call(node, 'light'))
|
|
97
|
+
return;
|
|
98
|
+
const nodeId = nonEmptyString(node.id, `${nodePath}.id`);
|
|
99
|
+
if (lightNodeIds.has(nodeId))
|
|
100
|
+
invalid(`${nodePath}.id`, `duplicate light node id: ${nodeId}`);
|
|
101
|
+
lightNodeIds.add(nodeId);
|
|
102
|
+
const enabled = node.active === undefined
|
|
103
|
+
? true
|
|
104
|
+
: booleanValue(node.active, `${nodePath}.active`);
|
|
105
|
+
const light = createFpsRuntimeLightSnapshot(node.light, `${nodePath}.light`);
|
|
106
|
+
if (light.type === 'hemispheric') {
|
|
107
|
+
if (environment)
|
|
108
|
+
invalid(nodePath, 'duplicate Environment/Hemispheric system light');
|
|
109
|
+
environment = Object.freeze({ nodeId, enabled, light });
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
if (directional)
|
|
113
|
+
invalid(nodePath, 'duplicate Directional/Sun system light');
|
|
114
|
+
directional = Object.freeze({ nodeId, enabled, light });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
if (!environment)
|
|
118
|
+
invalid(path, 'missing Environment/Hemispheric system light');
|
|
119
|
+
if (!directional)
|
|
120
|
+
invalid(path, 'missing Directional/Sun system light');
|
|
121
|
+
return Object.freeze({ environment, directional });
|
|
122
|
+
}
|
|
123
|
+
function readVec3(value, path) {
|
|
124
|
+
const vector = record(value, path);
|
|
125
|
+
assertKnownFields(vector, VEC3_FIELDS, path);
|
|
126
|
+
return Object.freeze({
|
|
127
|
+
x: finiteNumber(vector.x, `${path}.x`),
|
|
128
|
+
y: finiteNumber(vector.y, `${path}.y`),
|
|
129
|
+
z: finiteNumber(vector.z, `${path}.z`),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function readColor(value, path) {
|
|
133
|
+
const color = record(value, path);
|
|
134
|
+
assertKnownFields(color, COLOR_FIELDS, path);
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
r: unitNumber(color.r, `${path}.r`),
|
|
137
|
+
g: unitNumber(color.g, `${path}.g`),
|
|
138
|
+
b: unitNumber(color.b, `${path}.b`),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function record(value, path) {
|
|
142
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
143
|
+
invalid(path, 'expected a plain object');
|
|
144
|
+
}
|
|
145
|
+
const prototype = Object.getPrototypeOf(value);
|
|
146
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
147
|
+
invalid(path, 'expected a plain object');
|
|
148
|
+
}
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
function assertKnownFields(value, fields, path) {
|
|
152
|
+
for (const field of Object.keys(value)) {
|
|
153
|
+
if (!fields.has(field))
|
|
154
|
+
invalid(`${path}.${field}`, 'unknown field');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function nonEmptyString(value, path) {
|
|
158
|
+
if (typeof value !== 'string' || !value.trim())
|
|
159
|
+
invalid(path, 'expected a non-empty string');
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
function booleanValue(value, path) {
|
|
163
|
+
if (typeof value !== 'boolean')
|
|
164
|
+
invalid(path, 'expected a boolean');
|
|
165
|
+
return value;
|
|
166
|
+
}
|
|
167
|
+
function finiteNumber(value, path) {
|
|
168
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
169
|
+
invalid(path, 'expected a finite number');
|
|
170
|
+
return value;
|
|
171
|
+
}
|
|
172
|
+
function nonNegativeFiniteNumber(value, path) {
|
|
173
|
+
const result = finiteNumber(value, path);
|
|
174
|
+
if (result < 0)
|
|
175
|
+
invalid(path, 'expected a non-negative number');
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
function unitNumber(value, path) {
|
|
179
|
+
const result = finiteNumber(value, path);
|
|
180
|
+
if (result < 0 || result > 1)
|
|
181
|
+
invalid(path, 'expected a number between 0 and 1');
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
function invalid(path, reason) {
|
|
185
|
+
throw new FpsRuntimeLightingDataError(path, reason);
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=lighting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting.js","sourceRoot":"","sources":["../src/lighting.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0CAA0C,GAAG,CAAU,CAAC;AA2CrE,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAIzC;IACA;IAJF,IAAI,GAAG,0BAA0B,CAAC;IAE3C,YACW,IAAY,EACZ,MAAc;QAEvB,KAAK,CAAC,oCAAoC,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QAHpD,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QAGvB,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF;AAED,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,eAAe;IACf,MAAM;IACN,WAAW;IACX,WAAW;IACX,cAAc;CACf,CAAC,CAAC;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,eAAe;IACf,MAAM;IACN,WAAW;IACX,cAAc;IACd,aAAa;CACd,CAAC,CAAC;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC7C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,UAAU,iCAAiC,CAC/C,KAAc,EACd,IAAI,GAAG,aAAa;IAEpB,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CA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YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,IAAI,EAAE,gCAAgC,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,KAAc,EAAE,IAAY;IAC9C,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;IACjF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,MAAc;IAC3C,MAAM,IAAI,2BAA2B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fps-games/engine",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"description": "Forge Play game engine
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
|
+
"description": "Forge Play game engine Runtime Data and renderer backend product.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@babylonjs/core": "^8.0.0",
|
|
42
43
|
"typescript": "^5.9.3"
|
|
43
44
|
}
|
|
44
45
|
}
|