@scenoco-three/core 0.1.0
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/LICENSE +21 -0
- package/README.md +36 -0
- package/dist/components/Follow.d.ts +15 -0
- package/dist/components/Follow.js +41 -0
- package/dist/components/LookAt.d.ts +11 -0
- package/dist/components/LookAt.js +30 -0
- package/dist/components/Oscillator.d.ts +13 -0
- package/dist/components/Oscillator.js +42 -0
- package/dist/components/Rotator.d.ts +5 -0
- package/dist/components/Rotator.js +21 -0
- package/dist/core/Component.d.ts +60 -0
- package/dist/core/Component.js +63 -0
- package/dist/core/Engine.d.ts +169 -0
- package/dist/core/Engine.js +468 -0
- package/dist/core/NodeRegistry.d.ts +99 -0
- package/dist/core/NodeRegistry.js +87 -0
- package/dist/core/Registry.d.ts +55 -0
- package/dist/core/Registry.js +28 -0
- package/dist/core/System.d.ts +33 -0
- package/dist/core/System.js +23 -0
- package/dist/core/decorators.d.ts +50 -0
- package/dist/core/decorators.js +142 -0
- package/dist/dsl/PrefabRef.d.ts +36 -0
- package/dist/dsl/PrefabRef.js +33 -0
- package/dist/dsl/bundle-format.d.ts +74 -0
- package/dist/dsl/bundle-format.js +41 -0
- package/dist/dsl/bundle-shared.d.ts +18 -0
- package/dist/dsl/bundle-shared.js +33 -0
- package/dist/dsl/compiled.d.ts +64 -0
- package/dist/dsl/compiled.js +1 -0
- package/dist/dsl/deserialize.d.ts +9 -0
- package/dist/dsl/deserialize.js +125 -0
- package/dist/dsl/instantiate.d.ts +40 -0
- package/dist/dsl/instantiate.js +111 -0
- package/dist/dsl/nodes.d.ts +1 -0
- package/dist/dsl/nodes.js +10 -0
- package/dist/dsl/types.d.ts +45 -0
- package/dist/dsl/types.js +120 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +17 -0
- package/dist/internal.d.ts +7 -0
- package/dist/internal.js +7 -0
- package/dist/nodes/base.d.ts +31 -0
- package/dist/nodes/base.js +27 -0
- package/dist/nodes/geometry/BoxGeometry.d.ts +13 -0
- package/dist/nodes/geometry/BoxGeometry.js +44 -0
- package/dist/nodes/geometry/CylinderGeometry.d.ts +11 -0
- package/dist/nodes/geometry/CylinderGeometry.js +36 -0
- package/dist/nodes/geometry/PlaneGeometry.d.ts +11 -0
- package/dist/nodes/geometry/PlaneGeometry.js +36 -0
- package/dist/nodes/geometry/SphereGeometry.d.ts +10 -0
- package/dist/nodes/geometry/SphereGeometry.js +32 -0
- package/dist/nodes/geometry/TorusGeometry.d.ts +11 -0
- package/dist/nodes/geometry/TorusGeometry.js +36 -0
- package/dist/nodes/index.d.ts +36 -0
- package/dist/nodes/index.js +46 -0
- package/dist/nodes/manifest.d.ts +18 -0
- package/dist/nodes/manifest.js +64 -0
- package/dist/nodes/material/LineBasicMaterial.d.ts +11 -0
- package/dist/nodes/material/LineBasicMaterial.js +41 -0
- package/dist/nodes/material/MeshBasicMaterial.d.ts +11 -0
- package/dist/nodes/material/MeshBasicMaterial.js +41 -0
- package/dist/nodes/material/MeshStandardMaterial.d.ts +14 -0
- package/dist/nodes/material/MeshStandardMaterial.js +56 -0
- package/dist/nodes/material/PointsMaterial.d.ts +12 -0
- package/dist/nodes/material/PointsMaterial.js +46 -0
- package/dist/nodes/material/SpriteMaterial.d.ts +11 -0
- package/dist/nodes/material/SpriteMaterial.js +41 -0
- package/dist/nodes/object3d/AmbientLight.d.ts +7 -0
- package/dist/nodes/object3d/AmbientLight.js +26 -0
- package/dist/nodes/object3d/ArrayCamera.d.ts +5 -0
- package/dist/nodes/object3d/ArrayCamera.js +20 -0
- package/dist/nodes/object3d/BatchedMesh.d.ts +7 -0
- package/dist/nodes/object3d/BatchedMesh.js +31 -0
- package/dist/nodes/object3d/Bone.d.ts +5 -0
- package/dist/nodes/object3d/Bone.js +18 -0
- package/dist/nodes/object3d/DirectionalLight.d.ts +7 -0
- package/dist/nodes/object3d/DirectionalLight.js +29 -0
- package/dist/nodes/object3d/Group.d.ts +5 -0
- package/dist/nodes/object3d/Group.js +18 -0
- package/dist/nodes/object3d/HemisphereLight.d.ts +8 -0
- package/dist/nodes/object3d/HemisphereLight.js +30 -0
- package/dist/nodes/object3d/InstancedMesh.d.ts +6 -0
- package/dist/nodes/object3d/InstancedMesh.js +28 -0
- package/dist/nodes/object3d/LOD.d.ts +5 -0
- package/dist/nodes/object3d/LOD.js +20 -0
- package/dist/nodes/object3d/Line.d.ts +5 -0
- package/dist/nodes/object3d/Line.js +21 -0
- package/dist/nodes/object3d/LineLoop.d.ts +5 -0
- package/dist/nodes/object3d/LineLoop.js +21 -0
- package/dist/nodes/object3d/LineSegments.d.ts +5 -0
- package/dist/nodes/object3d/LineSegments.js +21 -0
- package/dist/nodes/object3d/Mesh.d.ts +5 -0
- package/dist/nodes/object3d/Mesh.js +21 -0
- package/dist/nodes/object3d/Object3D.d.ts +5 -0
- package/dist/nodes/object3d/Object3D.js +18 -0
- package/dist/nodes/object3d/OrthographicCamera.d.ts +11 -0
- package/dist/nodes/object3d/OrthographicCamera.js +42 -0
- package/dist/nodes/object3d/PerspectiveCamera.d.ts +8 -0
- package/dist/nodes/object3d/PerspectiveCamera.js +31 -0
- package/dist/nodes/object3d/PointLight.d.ts +9 -0
- package/dist/nodes/object3d/PointLight.js +34 -0
- package/dist/nodes/object3d/Points.d.ts +5 -0
- package/dist/nodes/object3d/Points.js +21 -0
- package/dist/nodes/object3d/RectAreaLight.d.ts +9 -0
- package/dist/nodes/object3d/RectAreaLight.js +34 -0
- package/dist/nodes/object3d/Scene.d.ts +5 -0
- package/dist/nodes/object3d/Scene.js +22 -0
- package/dist/nodes/object3d/SkinnedMesh.d.ts +5 -0
- package/dist/nodes/object3d/SkinnedMesh.js +23 -0
- package/dist/nodes/object3d/SpotLight.d.ts +11 -0
- package/dist/nodes/object3d/SpotLight.js +42 -0
- package/dist/nodes/object3d/Sprite.d.ts +5 -0
- package/dist/nodes/object3d/Sprite.js +21 -0
- package/dist/nodes/setting/Background.d.ts +6 -0
- package/dist/nodes/setting/Background.js +22 -0
- package/dist/nodes/setting/Fog.d.ts +8 -0
- package/dist/nodes/setting/Fog.js +30 -0
- package/dist/nodes/setting/FogExp2.d.ts +7 -0
- package/dist/nodes/setting/FogExp2.js +27 -0
- package/dist/nodes/targets.d.ts +5 -0
- package/dist/nodes/targets.js +5 -0
- package/package.json +42 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { CylinderGeometry } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { GEOMETRY_TARGETS } from '../targets.js';
|
|
11
|
+
let CylinderGeometryNode = class CylinderGeometryNode extends Attachment {
|
|
12
|
+
radiusTop = 1;
|
|
13
|
+
radiusBottom = 1;
|
|
14
|
+
height = 1;
|
|
15
|
+
radialSegments = 32;
|
|
16
|
+
cached;
|
|
17
|
+
attach(ctx) {
|
|
18
|
+
ctx.node.geometry = (this.cached ??= new CylinderGeometry(this.radiusTop, this.radiusBottom, this.height, this.radialSegments));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
property({ type: 'float', default: 1 })
|
|
23
|
+
], CylinderGeometryNode.prototype, "radiusTop", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
property({ type: 'float', default: 1 })
|
|
26
|
+
], CylinderGeometryNode.prototype, "radiusBottom", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
property({ type: 'float', default: 1 })
|
|
29
|
+
], CylinderGeometryNode.prototype, "height", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: 'int', default: 32 })
|
|
32
|
+
], CylinderGeometryNode.prototype, "radialSegments", void 0);
|
|
33
|
+
CylinderGeometryNode = __decorate([
|
|
34
|
+
attachment({ name: 'CylinderGeometry', target: GEOMETRY_TARGETS, group: 'geometry', required: true })
|
|
35
|
+
], CylinderGeometryNode);
|
|
36
|
+
export { CylinderGeometryNode };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class PlaneGeometryNode extends Attachment<Mesh> {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
widthSegments: number;
|
|
8
|
+
heightSegments: number;
|
|
9
|
+
private cached?;
|
|
10
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { PlaneGeometry } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { GEOMETRY_TARGETS } from '../targets.js';
|
|
11
|
+
let PlaneGeometryNode = class PlaneGeometryNode extends Attachment {
|
|
12
|
+
width = 1;
|
|
13
|
+
height = 1;
|
|
14
|
+
widthSegments = 1;
|
|
15
|
+
heightSegments = 1;
|
|
16
|
+
cached;
|
|
17
|
+
attach(ctx) {
|
|
18
|
+
ctx.node.geometry = (this.cached ??= new PlaneGeometry(this.width, this.height, this.widthSegments, this.heightSegments));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
property({ type: 'float', default: 1 })
|
|
23
|
+
], PlaneGeometryNode.prototype, "width", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
property({ type: 'float', default: 1 })
|
|
26
|
+
], PlaneGeometryNode.prototype, "height", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
property({ type: 'int', default: 1 })
|
|
29
|
+
], PlaneGeometryNode.prototype, "widthSegments", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: 'int', default: 1 })
|
|
32
|
+
], PlaneGeometryNode.prototype, "heightSegments", void 0);
|
|
33
|
+
PlaneGeometryNode = __decorate([
|
|
34
|
+
attachment({ name: 'PlaneGeometry', target: GEOMETRY_TARGETS, group: 'geometry', required: true })
|
|
35
|
+
], PlaneGeometryNode);
|
|
36
|
+
export { PlaneGeometryNode };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class SphereGeometryNode extends Attachment<Mesh> {
|
|
5
|
+
radius: number;
|
|
6
|
+
widthSegments: number;
|
|
7
|
+
heightSegments: number;
|
|
8
|
+
private cached?;
|
|
9
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { SphereGeometry } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { GEOMETRY_TARGETS } from '../targets.js';
|
|
11
|
+
let SphereGeometryNode = class SphereGeometryNode extends Attachment {
|
|
12
|
+
radius = 1;
|
|
13
|
+
widthSegments = 32;
|
|
14
|
+
heightSegments = 16;
|
|
15
|
+
cached;
|
|
16
|
+
attach(ctx) {
|
|
17
|
+
ctx.node.geometry = (this.cached ??= new SphereGeometry(this.radius, this.widthSegments, this.heightSegments));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
property({ type: 'float', default: 1 })
|
|
22
|
+
], SphereGeometryNode.prototype, "radius", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
property({ type: 'int', default: 32 })
|
|
25
|
+
], SphereGeometryNode.prototype, "widthSegments", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
property({ type: 'int', default: 16 })
|
|
28
|
+
], SphereGeometryNode.prototype, "heightSegments", void 0);
|
|
29
|
+
SphereGeometryNode = __decorate([
|
|
30
|
+
attachment({ name: 'SphereGeometry', target: GEOMETRY_TARGETS, group: 'geometry', required: true })
|
|
31
|
+
], SphereGeometryNode);
|
|
32
|
+
export { SphereGeometryNode };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class TorusGeometryNode extends Attachment<Mesh> {
|
|
5
|
+
radius: number;
|
|
6
|
+
tube: number;
|
|
7
|
+
radialSegments: number;
|
|
8
|
+
tubularSegments: number;
|
|
9
|
+
private cached?;
|
|
10
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { TorusGeometry } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { GEOMETRY_TARGETS } from '../targets.js';
|
|
11
|
+
let TorusGeometryNode = class TorusGeometryNode extends Attachment {
|
|
12
|
+
radius = 1;
|
|
13
|
+
tube = 0.4;
|
|
14
|
+
radialSegments = 12;
|
|
15
|
+
tubularSegments = 48;
|
|
16
|
+
cached;
|
|
17
|
+
attach(ctx) {
|
|
18
|
+
ctx.node.geometry = (this.cached ??= new TorusGeometry(this.radius, this.tube, this.radialSegments, this.tubularSegments));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
22
|
+
property({ type: 'float', default: 1 })
|
|
23
|
+
], TorusGeometryNode.prototype, "radius", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
property({ type: 'float', default: 0.4 })
|
|
26
|
+
], TorusGeometryNode.prototype, "tube", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
property({ type: 'int', default: 12 })
|
|
29
|
+
], TorusGeometryNode.prototype, "radialSegments", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: 'int', default: 48 })
|
|
32
|
+
], TorusGeometryNode.prototype, "tubularSegments", void 0);
|
|
33
|
+
TorusGeometryNode = __decorate([
|
|
34
|
+
attachment({ name: 'TorusGeometry', target: GEOMETRY_TARGETS, group: 'geometry', required: true })
|
|
35
|
+
], TorusGeometryNode);
|
|
36
|
+
export { TorusGeometryNode };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './object3d/Scene.js';
|
|
2
|
+
import './object3d/Object3D.js';
|
|
3
|
+
import './object3d/Group.js';
|
|
4
|
+
import './object3d/Bone.js';
|
|
5
|
+
import './object3d/LOD.js';
|
|
6
|
+
import './object3d/Mesh.js';
|
|
7
|
+
import './object3d/InstancedMesh.js';
|
|
8
|
+
import './object3d/SkinnedMesh.js';
|
|
9
|
+
import './object3d/BatchedMesh.js';
|
|
10
|
+
import './object3d/Line.js';
|
|
11
|
+
import './object3d/LineLoop.js';
|
|
12
|
+
import './object3d/LineSegments.js';
|
|
13
|
+
import './object3d/Points.js';
|
|
14
|
+
import './object3d/Sprite.js';
|
|
15
|
+
import './object3d/AmbientLight.js';
|
|
16
|
+
import './object3d/DirectionalLight.js';
|
|
17
|
+
import './object3d/HemisphereLight.js';
|
|
18
|
+
import './object3d/PointLight.js';
|
|
19
|
+
import './object3d/RectAreaLight.js';
|
|
20
|
+
import './object3d/SpotLight.js';
|
|
21
|
+
import './object3d/PerspectiveCamera.js';
|
|
22
|
+
import './object3d/OrthographicCamera.js';
|
|
23
|
+
import './object3d/ArrayCamera.js';
|
|
24
|
+
import './geometry/BoxGeometry.js';
|
|
25
|
+
import './geometry/SphereGeometry.js';
|
|
26
|
+
import './geometry/CylinderGeometry.js';
|
|
27
|
+
import './geometry/PlaneGeometry.js';
|
|
28
|
+
import './geometry/TorusGeometry.js';
|
|
29
|
+
import './material/MeshStandardMaterial.js';
|
|
30
|
+
import './material/MeshBasicMaterial.js';
|
|
31
|
+
import './material/LineBasicMaterial.js';
|
|
32
|
+
import './material/PointsMaterial.js';
|
|
33
|
+
import './material/SpriteMaterial.js';
|
|
34
|
+
import './setting/Fog.js';
|
|
35
|
+
import './setting/FogExp2.js';
|
|
36
|
+
import './setting/Background.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Built-in node tags. Importing this module registers every built-in into the
|
|
2
|
+
// NodeRegistry (each file self-registers via a define* call). Add a new built-in
|
|
3
|
+
// by dropping a file in the right folder and importing it here.
|
|
4
|
+
// ---- Object3D family: structural --------------------------------------------
|
|
5
|
+
import './object3d/Scene.js';
|
|
6
|
+
import './object3d/Object3D.js';
|
|
7
|
+
import './object3d/Group.js';
|
|
8
|
+
import './object3d/Bone.js';
|
|
9
|
+
import './object3d/LOD.js';
|
|
10
|
+
// ---- Object3D family: renderables -------------------------------------------
|
|
11
|
+
import './object3d/Mesh.js';
|
|
12
|
+
import './object3d/InstancedMesh.js';
|
|
13
|
+
import './object3d/SkinnedMesh.js';
|
|
14
|
+
import './object3d/BatchedMesh.js';
|
|
15
|
+
import './object3d/Line.js';
|
|
16
|
+
import './object3d/LineLoop.js';
|
|
17
|
+
import './object3d/LineSegments.js';
|
|
18
|
+
import './object3d/Points.js';
|
|
19
|
+
import './object3d/Sprite.js';
|
|
20
|
+
// ---- Object3D family: lights ------------------------------------------------
|
|
21
|
+
import './object3d/AmbientLight.js';
|
|
22
|
+
import './object3d/DirectionalLight.js';
|
|
23
|
+
import './object3d/HemisphereLight.js';
|
|
24
|
+
import './object3d/PointLight.js';
|
|
25
|
+
import './object3d/RectAreaLight.js';
|
|
26
|
+
import './object3d/SpotLight.js';
|
|
27
|
+
// ---- Object3D family: cameras -----------------------------------------------
|
|
28
|
+
import './object3d/PerspectiveCamera.js';
|
|
29
|
+
import './object3d/OrthographicCamera.js';
|
|
30
|
+
import './object3d/ArrayCamera.js';
|
|
31
|
+
// ---- Geometries -------------------------------------------------------------
|
|
32
|
+
import './geometry/BoxGeometry.js';
|
|
33
|
+
import './geometry/SphereGeometry.js';
|
|
34
|
+
import './geometry/CylinderGeometry.js';
|
|
35
|
+
import './geometry/PlaneGeometry.js';
|
|
36
|
+
import './geometry/TorusGeometry.js';
|
|
37
|
+
// ---- Materials --------------------------------------------------------------
|
|
38
|
+
import './material/MeshStandardMaterial.js';
|
|
39
|
+
import './material/MeshBasicMaterial.js';
|
|
40
|
+
import './material/LineBasicMaterial.js';
|
|
41
|
+
import './material/PointsMaterial.js';
|
|
42
|
+
import './material/SpriteMaterial.js';
|
|
43
|
+
// ---- Scene settings (config children of <Scene>) ----------------------------
|
|
44
|
+
import './setting/Fog.js';
|
|
45
|
+
import './setting/FogExp2.js';
|
|
46
|
+
import './setting/Background.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each built-in node tag to the package subpath that registers it, so the
|
|
3
|
+
* build tooling (Vite plugin) can emit **usage-based imports** for built-ins —
|
|
4
|
+
* exactly the way it does for project `@component` files. A scene that uses only
|
|
5
|
+
* `<Mesh><BoxGeometry/>` ships `Mesh.js` + `BoxGeometry.js` (and just their three
|
|
6
|
+
* classes), not the whole node set.
|
|
7
|
+
*
|
|
8
|
+
* The runtime entry (`@scenoco-three/core`) deliberately does NOT import these,
|
|
9
|
+
* so `import { Engine } from '@scenoco-three/core'` pulls in zero node modules
|
|
10
|
+
* and the bundler tree-shakes everything unused. `@scenoco-three/core/nodes`
|
|
11
|
+
* (the barrel) registers them all, for Node tooling / tests / non-bundled use.
|
|
12
|
+
*
|
|
13
|
+
* Kept in sync with `nodes/index.ts` by `tests/treeshake.test.ts`, which fails
|
|
14
|
+
* if a registered built-in is missing here (or vice versa).
|
|
15
|
+
*/
|
|
16
|
+
export declare const builtinNodeModules: Record<string, string>;
|
|
17
|
+
/** The package subpath that registers a built-in tag, or undefined if not a built-in. */
|
|
18
|
+
export declare function builtinNodeModule(tag: string): string | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each built-in node tag to the package subpath that registers it, so the
|
|
3
|
+
* build tooling (Vite plugin) can emit **usage-based imports** for built-ins —
|
|
4
|
+
* exactly the way it does for project `@component` files. A scene that uses only
|
|
5
|
+
* `<Mesh><BoxGeometry/>` ships `Mesh.js` + `BoxGeometry.js` (and just their three
|
|
6
|
+
* classes), not the whole node set.
|
|
7
|
+
*
|
|
8
|
+
* The runtime entry (`@scenoco-three/core`) deliberately does NOT import these,
|
|
9
|
+
* so `import { Engine } from '@scenoco-three/core'` pulls in zero node modules
|
|
10
|
+
* and the bundler tree-shakes everything unused. `@scenoco-three/core/nodes`
|
|
11
|
+
* (the barrel) registers them all, for Node tooling / tests / non-bundled use.
|
|
12
|
+
*
|
|
13
|
+
* Kept in sync with `nodes/index.ts` by `tests/treeshake.test.ts`, which fails
|
|
14
|
+
* if a registered built-in is missing here (or vice versa).
|
|
15
|
+
*/
|
|
16
|
+
export const builtinNodeModules = {
|
|
17
|
+
// object3d — structural
|
|
18
|
+
Scene: '@scenoco-three/core/nodes/object3d/Scene.js',
|
|
19
|
+
Object3D: '@scenoco-three/core/nodes/object3d/Object3D.js',
|
|
20
|
+
Group: '@scenoco-three/core/nodes/object3d/Group.js',
|
|
21
|
+
Bone: '@scenoco-three/core/nodes/object3d/Bone.js',
|
|
22
|
+
LOD: '@scenoco-three/core/nodes/object3d/LOD.js',
|
|
23
|
+
// object3d — renderables
|
|
24
|
+
Mesh: '@scenoco-three/core/nodes/object3d/Mesh.js',
|
|
25
|
+
InstancedMesh: '@scenoco-three/core/nodes/object3d/InstancedMesh.js',
|
|
26
|
+
SkinnedMesh: '@scenoco-three/core/nodes/object3d/SkinnedMesh.js',
|
|
27
|
+
BatchedMesh: '@scenoco-three/core/nodes/object3d/BatchedMesh.js',
|
|
28
|
+
Line: '@scenoco-three/core/nodes/object3d/Line.js',
|
|
29
|
+
LineLoop: '@scenoco-three/core/nodes/object3d/LineLoop.js',
|
|
30
|
+
LineSegments: '@scenoco-three/core/nodes/object3d/LineSegments.js',
|
|
31
|
+
Points: '@scenoco-three/core/nodes/object3d/Points.js',
|
|
32
|
+
Sprite: '@scenoco-three/core/nodes/object3d/Sprite.js',
|
|
33
|
+
// object3d — lights
|
|
34
|
+
AmbientLight: '@scenoco-three/core/nodes/object3d/AmbientLight.js',
|
|
35
|
+
DirectionalLight: '@scenoco-three/core/nodes/object3d/DirectionalLight.js',
|
|
36
|
+
HemisphereLight: '@scenoco-three/core/nodes/object3d/HemisphereLight.js',
|
|
37
|
+
PointLight: '@scenoco-three/core/nodes/object3d/PointLight.js',
|
|
38
|
+
RectAreaLight: '@scenoco-three/core/nodes/object3d/RectAreaLight.js',
|
|
39
|
+
SpotLight: '@scenoco-three/core/nodes/object3d/SpotLight.js',
|
|
40
|
+
// object3d — cameras
|
|
41
|
+
PerspectiveCamera: '@scenoco-three/core/nodes/object3d/PerspectiveCamera.js',
|
|
42
|
+
OrthographicCamera: '@scenoco-three/core/nodes/object3d/OrthographicCamera.js',
|
|
43
|
+
ArrayCamera: '@scenoco-three/core/nodes/object3d/ArrayCamera.js',
|
|
44
|
+
// geometries
|
|
45
|
+
BoxGeometry: '@scenoco-three/core/nodes/geometry/BoxGeometry.js',
|
|
46
|
+
SphereGeometry: '@scenoco-three/core/nodes/geometry/SphereGeometry.js',
|
|
47
|
+
CylinderGeometry: '@scenoco-three/core/nodes/geometry/CylinderGeometry.js',
|
|
48
|
+
PlaneGeometry: '@scenoco-three/core/nodes/geometry/PlaneGeometry.js',
|
|
49
|
+
TorusGeometry: '@scenoco-three/core/nodes/geometry/TorusGeometry.js',
|
|
50
|
+
// materials
|
|
51
|
+
MeshStandardMaterial: '@scenoco-three/core/nodes/material/MeshStandardMaterial.js',
|
|
52
|
+
MeshBasicMaterial: '@scenoco-three/core/nodes/material/MeshBasicMaterial.js',
|
|
53
|
+
LineBasicMaterial: '@scenoco-three/core/nodes/material/LineBasicMaterial.js',
|
|
54
|
+
PointsMaterial: '@scenoco-three/core/nodes/material/PointsMaterial.js',
|
|
55
|
+
SpriteMaterial: '@scenoco-three/core/nodes/material/SpriteMaterial.js',
|
|
56
|
+
// settings
|
|
57
|
+
Fog: '@scenoco-three/core/nodes/setting/Fog.js',
|
|
58
|
+
FogExp2: '@scenoco-three/core/nodes/setting/FogExp2.js',
|
|
59
|
+
Background: '@scenoco-three/core/nodes/setting/Background.js',
|
|
60
|
+
};
|
|
61
|
+
/** The package subpath that registers a built-in tag, or undefined if not a built-in. */
|
|
62
|
+
export function builtinNodeModule(tag) {
|
|
63
|
+
return builtinNodeModules[tag];
|
|
64
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class LineBasicMaterialNode extends Attachment<Mesh> {
|
|
5
|
+
color: number;
|
|
6
|
+
linewidth: number;
|
|
7
|
+
opacity: number;
|
|
8
|
+
transparent: boolean;
|
|
9
|
+
private cached?;
|
|
10
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LineBasicMaterial } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { MATERIAL_TARGETS } from '../targets.js';
|
|
11
|
+
let LineBasicMaterialNode = class LineBasicMaterialNode extends Attachment {
|
|
12
|
+
color = 0xffffff;
|
|
13
|
+
linewidth = 1;
|
|
14
|
+
opacity = 1;
|
|
15
|
+
transparent = false;
|
|
16
|
+
cached;
|
|
17
|
+
attach(ctx) {
|
|
18
|
+
ctx.node.material = (this.cached ??= new LineBasicMaterial({
|
|
19
|
+
color: this.color,
|
|
20
|
+
linewidth: this.linewidth,
|
|
21
|
+
opacity: this.opacity,
|
|
22
|
+
transparent: this.transparent,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
property({ type: 'color', default: 0xffffff })
|
|
28
|
+
], LineBasicMaterialNode.prototype, "color", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
property({ type: 'float', default: 1 })
|
|
31
|
+
], LineBasicMaterialNode.prototype, "linewidth", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ type: 'float', default: 1 })
|
|
34
|
+
], LineBasicMaterialNode.prototype, "opacity", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ type: 'bool', default: false })
|
|
37
|
+
], LineBasicMaterialNode.prototype, "transparent", void 0);
|
|
38
|
+
LineBasicMaterialNode = __decorate([
|
|
39
|
+
attachment({ name: 'LineBasicMaterial', target: MATERIAL_TARGETS, group: 'material' })
|
|
40
|
+
], LineBasicMaterialNode);
|
|
41
|
+
export { LineBasicMaterialNode };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class MeshBasicMaterialNode extends Attachment<Mesh> {
|
|
5
|
+
color: number;
|
|
6
|
+
opacity: number;
|
|
7
|
+
transparent: boolean;
|
|
8
|
+
wireframe: boolean;
|
|
9
|
+
private cached?;
|
|
10
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { MeshBasicMaterial } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { MATERIAL_TARGETS } from '../targets.js';
|
|
11
|
+
let MeshBasicMaterialNode = class MeshBasicMaterialNode extends Attachment {
|
|
12
|
+
color = 0xffffff;
|
|
13
|
+
opacity = 1;
|
|
14
|
+
transparent = false;
|
|
15
|
+
wireframe = false;
|
|
16
|
+
cached;
|
|
17
|
+
attach(ctx) {
|
|
18
|
+
ctx.node.material = (this.cached ??= new MeshBasicMaterial({
|
|
19
|
+
color: this.color,
|
|
20
|
+
opacity: this.opacity,
|
|
21
|
+
transparent: this.transparent,
|
|
22
|
+
wireframe: this.wireframe,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
property({ type: 'color', default: 0xffffff })
|
|
28
|
+
], MeshBasicMaterialNode.prototype, "color", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
property({ type: 'float', default: 1 })
|
|
31
|
+
], MeshBasicMaterialNode.prototype, "opacity", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ type: 'bool', default: false })
|
|
34
|
+
], MeshBasicMaterialNode.prototype, "transparent", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ type: 'bool', default: false })
|
|
37
|
+
], MeshBasicMaterialNode.prototype, "wireframe", void 0);
|
|
38
|
+
MeshBasicMaterialNode = __decorate([
|
|
39
|
+
attachment({ name: 'MeshBasicMaterial', target: MATERIAL_TARGETS, group: 'material' })
|
|
40
|
+
], MeshBasicMaterialNode);
|
|
41
|
+
export { MeshBasicMaterialNode };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class MeshStandardMaterialNode extends Attachment<Mesh> {
|
|
5
|
+
color: number;
|
|
6
|
+
roughness: number;
|
|
7
|
+
metalness: number;
|
|
8
|
+
emissive: number;
|
|
9
|
+
opacity: number;
|
|
10
|
+
transparent: boolean;
|
|
11
|
+
wireframe: boolean;
|
|
12
|
+
private cached?;
|
|
13
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { MeshStandardMaterial } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { MATERIAL_TARGETS } from '../targets.js';
|
|
11
|
+
let MeshStandardMaterialNode = class MeshStandardMaterialNode extends Attachment {
|
|
12
|
+
color = 0xffffff;
|
|
13
|
+
roughness = 1;
|
|
14
|
+
metalness = 0;
|
|
15
|
+
emissive = 0x000000;
|
|
16
|
+
opacity = 1;
|
|
17
|
+
transparent = false;
|
|
18
|
+
wireframe = false;
|
|
19
|
+
cached;
|
|
20
|
+
attach(ctx) {
|
|
21
|
+
ctx.node.material = (this.cached ??= new MeshStandardMaterial({
|
|
22
|
+
color: this.color,
|
|
23
|
+
roughness: this.roughness,
|
|
24
|
+
metalness: this.metalness,
|
|
25
|
+
emissive: this.emissive,
|
|
26
|
+
opacity: this.opacity,
|
|
27
|
+
transparent: this.transparent,
|
|
28
|
+
wireframe: this.wireframe,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ type: 'color', default: 0xffffff })
|
|
34
|
+
], MeshStandardMaterialNode.prototype, "color", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ type: 'float', default: 1 })
|
|
37
|
+
], MeshStandardMaterialNode.prototype, "roughness", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
property({ type: 'float', default: 0 })
|
|
40
|
+
], MeshStandardMaterialNode.prototype, "metalness", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
property({ type: 'color', default: 0x000000 })
|
|
43
|
+
], MeshStandardMaterialNode.prototype, "emissive", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
property({ type: 'float', default: 1 })
|
|
46
|
+
], MeshStandardMaterialNode.prototype, "opacity", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
property({ type: 'bool', default: false })
|
|
49
|
+
], MeshStandardMaterialNode.prototype, "transparent", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
property({ type: 'bool', default: false })
|
|
52
|
+
], MeshStandardMaterialNode.prototype, "wireframe", void 0);
|
|
53
|
+
MeshStandardMaterialNode = __decorate([
|
|
54
|
+
attachment({ name: 'MeshStandardMaterial', target: MATERIAL_TARGETS, group: 'material' })
|
|
55
|
+
], MeshStandardMaterialNode);
|
|
56
|
+
export { MeshStandardMaterialNode };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Mesh } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class PointsMaterialNode extends Attachment<Mesh> {
|
|
5
|
+
color: number;
|
|
6
|
+
size: number;
|
|
7
|
+
sizeAttenuation: boolean;
|
|
8
|
+
opacity: number;
|
|
9
|
+
transparent: boolean;
|
|
10
|
+
private cached?;
|
|
11
|
+
attach(ctx: AttachContext<Mesh>): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { PointsMaterial } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { MATERIAL_TARGETS } from '../targets.js';
|
|
11
|
+
let PointsMaterialNode = class PointsMaterialNode extends Attachment {
|
|
12
|
+
color = 0xffffff;
|
|
13
|
+
size = 1;
|
|
14
|
+
sizeAttenuation = true;
|
|
15
|
+
opacity = 1;
|
|
16
|
+
transparent = false;
|
|
17
|
+
cached;
|
|
18
|
+
attach(ctx) {
|
|
19
|
+
ctx.node.material = (this.cached ??= new PointsMaterial({
|
|
20
|
+
color: this.color,
|
|
21
|
+
size: this.size,
|
|
22
|
+
sizeAttenuation: this.sizeAttenuation,
|
|
23
|
+
opacity: this.opacity,
|
|
24
|
+
transparent: this.transparent,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
__decorate([
|
|
29
|
+
property({ type: 'color', default: 0xffffff })
|
|
30
|
+
], PointsMaterialNode.prototype, "color", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
property({ type: 'float', default: 1 })
|
|
33
|
+
], PointsMaterialNode.prototype, "size", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
property({ type: 'bool', default: true })
|
|
36
|
+
], PointsMaterialNode.prototype, "sizeAttenuation", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ type: 'float', default: 1 })
|
|
39
|
+
], PointsMaterialNode.prototype, "opacity", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
property({ type: 'bool', default: false })
|
|
42
|
+
], PointsMaterialNode.prototype, "transparent", void 0);
|
|
43
|
+
PointsMaterialNode = __decorate([
|
|
44
|
+
attachment({ name: 'PointsMaterial', target: MATERIAL_TARGETS, group: 'material' })
|
|
45
|
+
], PointsMaterialNode);
|
|
46
|
+
export { PointsMaterialNode };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Sprite } from 'three';
|
|
2
|
+
import { Attachment } from '../base.js';
|
|
3
|
+
import type { AttachContext } from '../../core/NodeRegistry.js';
|
|
4
|
+
export declare class SpriteMaterialNode extends Attachment<Sprite> {
|
|
5
|
+
color: number;
|
|
6
|
+
rotation: number;
|
|
7
|
+
opacity: number;
|
|
8
|
+
transparent: boolean;
|
|
9
|
+
private cached?;
|
|
10
|
+
attach(ctx: AttachContext<Sprite>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { SpriteMaterial } from 'three';
|
|
8
|
+
import { Attachment } from '../base.js';
|
|
9
|
+
import { attachment, property } from '../../core/decorators.js';
|
|
10
|
+
import { MATERIAL_TARGETS } from '../targets.js';
|
|
11
|
+
let SpriteMaterialNode = class SpriteMaterialNode extends Attachment {
|
|
12
|
+
color = 0xffffff;
|
|
13
|
+
rotation = 0;
|
|
14
|
+
opacity = 1;
|
|
15
|
+
transparent = false;
|
|
16
|
+
cached;
|
|
17
|
+
attach(ctx) {
|
|
18
|
+
ctx.node.material = (this.cached ??= new SpriteMaterial({
|
|
19
|
+
color: this.color,
|
|
20
|
+
rotation: this.rotation,
|
|
21
|
+
opacity: this.opacity,
|
|
22
|
+
transparent: this.transparent,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
__decorate([
|
|
27
|
+
property({ type: 'color', default: 0xffffff })
|
|
28
|
+
], SpriteMaterialNode.prototype, "color", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
property({ type: 'float', default: 0, description: 'Rotation of the sprite in radians' })
|
|
31
|
+
], SpriteMaterialNode.prototype, "rotation", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ type: 'float', default: 1 })
|
|
34
|
+
], SpriteMaterialNode.prototype, "opacity", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ type: 'bool', default: false })
|
|
37
|
+
], SpriteMaterialNode.prototype, "transparent", void 0);
|
|
38
|
+
SpriteMaterialNode = __decorate([
|
|
39
|
+
attachment({ name: 'SpriteMaterial', target: MATERIAL_TARGETS, group: 'material' })
|
|
40
|
+
], SpriteMaterialNode);
|
|
41
|
+
export { SpriteMaterialNode };
|