Skip to content

Commit 394b95c

Browse files
committed
feat(plugin): add angular-three-plugin
1 parent dd0aafb commit 394b95c

File tree

16 files changed

+542
-77
lines changed

16 files changed

+542
-77
lines changed

libs/core/package.json

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,7 @@
2828
"three": ">=0.156.0 <0.174.0"
2929
},
3030
"dependencies": {
31-
"tslib": "^2.7.0",
32-
"@nx/devkit": "^20.0.0",
33-
"@phenomnomnominal/tsquery": "^6.0.0",
34-
"nx": "^20.0.0"
35-
},
36-
"generators": "./plugin/generators.json",
37-
"schematics": "./plugin/generators.json",
38-
"nx-migrations": {
39-
"migrations": "./plugin/migrations.json",
40-
"packageGroup": [
41-
"angular-three-soba",
42-
"angular-three-postprocessing",
43-
"angular-three-cannon",
44-
"angular-three-rapier"
45-
]
46-
},
47-
"ng-update": {
48-
"migrations": "./plugin/migrations.json",
49-
"packageGroup": [
50-
"angular-three-soba",
51-
"angular-three-postprocessing",
52-
"angular-three-cannon",
53-
"angular-three-rapier"
54-
]
31+
"tslib": "^2.7.0"
5532
},
5633
"web-types": [
5734
"./web-types.json",

libs/plugin/package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,28 @@
77
"types": "./src/index.d.ts",
88
"dependencies": {
99
"@nx/devkit": "^20.0.0",
10-
"@phenomnomnominal/tsquery": "^6.0.0",
1110
"nx": "^20.0.0",
11+
"ts-morph": "^25.0.0",
1212
"tslib": "^2.3.0"
1313
},
1414
"generators": "./generators.json",
15-
"schematics": "./generators.json"
15+
"schematics": "./generators.json",
16+
"nx-migrations": {
17+
"migrations": "./migrations.json",
18+
"packageGroup": [
19+
"angular-three-soba",
20+
"angular-three-postprocessing",
21+
"angular-three-cannon",
22+
"angular-three-rapier"
23+
]
24+
},
25+
"ng-update": {
26+
"migrations": "./migrations.json",
27+
"packageGroup": [
28+
"angular-three-soba",
29+
"angular-three-postprocessing",
30+
"angular-three-cannon",
31+
"angular-three-rapier"
32+
]
33+
}
1634
}

libs/plugin/project.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
"options": {
4444
"jestConfig": "libs/plugin/jest.config.ts"
4545
}
46+
},
47+
"publish-next": {
48+
"command": "npm publish --tag=next",
49+
"options": {
50+
"cwd": "{workspaceRoot}/dist/{projectRoot}"
51+
}
4652
}
4753
}
4854
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { CUSTOM_ELEMENTS_SCHEMA, Component, viewChild, ElementRef, ChangeDetectionStrategy } from '@angular/core';
2+
import { extend, injectBeforeRender } from 'angular-three';
3+
import { Mesh, BoxGeometry, MeshBasicMaterial } from 'three';
4+
5+
@Component({
6+
selector: 'app-scene-graph',
7+
template: `
8+
<ngt-mesh #mesh>
9+
<ngt-box-geometry />
10+
<ngt-mesh-basic-material color="hotpink" />
11+
</ngt-mesh>
12+
`,
13+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
14+
changeDetection: ChangeDetectionStrategy.OnPush,
15+
})
16+
export class SceneGraph {
17+
private meshRef = viewChild.required<ElementRef<Mesh>>('mesh');
18+
19+
constructor() {
20+
extend({ Mesh, BoxGeometry, MeshBasicMaterial });
21+
22+
injectBeforeRender(({ delta }) => {
23+
const mesh = this.meshRef().nativeElement;
24+
mesh.rotation.x += delta;
25+
mesh.rotation.y += delta;
26+
})
27+
}
28+
}
29+

libs/plugin/src/generators/init/files/src/index.ts.template

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/plugin/src/generators/init/init.spec.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)