This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): ready to start core generators
- Loading branch information
Showing
97 changed files
with
3,033 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @angular-three/core/audios | ||
|
||
Secondary entry point of `@angular-three/core`. It can be used by importing from `@angular-three/core/audios`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const greeting = 'Hello World!'; |
83 changes: 83 additions & 0 deletions
83
packages/core/audios/src/lib/audio-listener/audio-listener.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { | ||
applyProps, | ||
EnhancedComponentStore, | ||
NgtDestroyedService, | ||
NgtStore, | ||
tapEffect, | ||
} from '@angular-three/core'; | ||
import { | ||
Directive, | ||
EventEmitter, | ||
Input, | ||
NgModule, | ||
NgZone, | ||
OnInit, | ||
Output, | ||
} from '@angular/core'; | ||
import { withLatestFrom } from 'rxjs'; | ||
import * as THREE from 'three'; | ||
|
||
@Directive({ | ||
selector: 'ngt-audio-listener', | ||
exportAs: 'ngtAudioListener', | ||
}) | ||
export class NgtAudioListener extends EnhancedComponentStore implements OnInit { | ||
@Input() filter?: AudioNode; | ||
@Input() timeDelta?: number; | ||
|
||
@Output() ready = new EventEmitter(); | ||
|
||
#listener!: THREE.AudioListener; | ||
get listener() { | ||
return this.#listener; | ||
} | ||
|
||
constructor( | ||
private store: NgtStore, | ||
private destroyed: NgtDestroyedService, | ||
private ngZone: NgZone | ||
) { | ||
super({}); | ||
} | ||
|
||
ngOnInit() { | ||
this.ngZone.runOutsideAngular(() => { | ||
this.#listener = new THREE.AudioListener(); | ||
const props = { | ||
filter: this.filter, | ||
timeDelta: this.timeDelta, | ||
}; | ||
applyProps(this.listener, props); | ||
this.#ready(this.store.selectors.ready$); | ||
}); | ||
} | ||
|
||
#ready = this.effect<boolean>((ready$) => | ||
ready$.pipe( | ||
withLatestFrom(this.store.selectors.camera$), | ||
tapEffect(([ready, camera]) => { | ||
this.ngZone.runOutsideAngular(() => { | ||
if (ready && camera) { | ||
camera.add(this.listener); | ||
this.ready.emit(); | ||
} | ||
}); | ||
|
||
return () => { | ||
this.ngZone.runOutsideAngular(() => { | ||
if (ready && camera) { | ||
this.listener.clear(); | ||
camera.remove(this.listener); | ||
} | ||
}); | ||
}; | ||
}) | ||
) | ||
); | ||
} | ||
|
||
@NgModule({ | ||
declarations: [NgtAudioListener], | ||
exports: [NgtAudioListener], | ||
}) | ||
export class NgtAudioListenerModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @angular-three/core/cameras | ||
|
||
Secondary entry point of `@angular-three/core`. It can be used by importing from `@angular-three/core/cameras`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/core/cameras/src/cube-camera/cube-camera.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { | ||
NGT_OBJECT_CONTROLLER_PROVIDER, | ||
NGT_OBJECT_WATCHED_CONTROLLER, | ||
NgtObject3dController, | ||
} from '@angular-three/core'; | ||
import { | ||
Directive, | ||
Inject, | ||
Input, | ||
NgModule, | ||
NgZone, | ||
OnInit, | ||
} from '@angular/core'; | ||
import * as THREE from 'three'; | ||
|
||
@Directive({ | ||
selector: 'ngt-cube-camera', | ||
exportAs: 'ngtCubeCamera', | ||
providers: [NGT_OBJECT_CONTROLLER_PROVIDER], | ||
}) | ||
export class NgtCubeCamera implements OnInit { | ||
static ngAcceptInputType_args: ConstructorParameters<typeof THREE.CubeCamera>; | ||
|
||
#cubeCamera?: THREE.CubeCamera; | ||
get cubeCamera() { | ||
return this.#cubeCamera; | ||
} | ||
|
||
@Input() args!: ConstructorParameters<typeof THREE.CubeCamera>; | ||
|
||
constructor( | ||
@Inject(NGT_OBJECT_WATCHED_CONTROLLER) | ||
private objectController: NgtObject3dController, | ||
private ngZone: NgZone | ||
) {} | ||
|
||
ngOnInit() { | ||
this.objectController.initFn = () => { | ||
return this.ngZone.runOutsideAngular(() => { | ||
this.#cubeCamera = new THREE.CubeCamera(...this.args); | ||
return this.#cubeCamera; | ||
}); | ||
}; | ||
} | ||
} | ||
|
||
@NgModule({ | ||
declarations: [NgtCubeCamera], | ||
exports: [NgtCubeCamera], | ||
}) | ||
export class NgtCubeCameraModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const greeting = 'Hello World!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @angular-three/core/geometries | ||
|
||
Secondary entry point of `@angular-three/core`. It can be used by importing from `@angular-three/core/geometries`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/core/geometries/src/box-geometry/box-geometry.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// GENERATED | ||
import { NgtGeometry } from '@angular-three/core'; | ||
import { Directive, Input, NgModule } from '@angular/core'; | ||
import * as THREE from 'three'; | ||
|
||
@Directive({ | ||
selector: 'ngt-box-geometry', | ||
exportAs: 'ngtBoxGeometry', | ||
providers: [ | ||
{ | ||
provide: NgtGeometry, | ||
useExisting: NgtBoxGeometry, | ||
}, | ||
], | ||
}) | ||
export class NgtBoxGeometry extends NgtGeometry<THREE.BoxGeometry> { | ||
static ngAcceptInputType_args: | ||
| ConstructorParameters<typeof THREE.BoxGeometry> | ||
| undefined; | ||
|
||
@Input() set args(v: ConstructorParameters<typeof THREE.BoxGeometry>) { | ||
this.geometryArgs = v; | ||
} | ||
|
||
geometryType = THREE.BoxGeometry; | ||
} | ||
|
||
@NgModule({ | ||
declarations: [NgtBoxGeometry], | ||
exports: [NgtBoxGeometry], | ||
}) | ||
export class NgtBoxGeometryModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './box-geometry/box-geometry.directive'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @angular-three/core/group | ||
|
||
Secondary entry point of `@angular-three/core`. It can be used by importing from `@angular-three/core/group`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lib/group.directive'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
NGT_OBJECT_CONTROLLER_PROVIDER, | ||
NGT_OBJECT_WATCHED_CONTROLLER, | ||
NgtObject3dController, | ||
} from '@angular-three/core'; | ||
import { Directive, Inject, NgModule, NgZone, OnInit } from '@angular/core'; | ||
import * as THREE from 'three'; | ||
|
||
@Directive({ | ||
selector: 'ngt-group', | ||
exportAs: 'ngtGroup', | ||
providers: [NGT_OBJECT_CONTROLLER_PROVIDER], | ||
}) | ||
export class NgtGroup implements OnInit { | ||
#group?: THREE.Group; | ||
get group() { | ||
return this.#group; | ||
} | ||
|
||
constructor( | ||
@Inject(NGT_OBJECT_WATCHED_CONTROLLER) | ||
private objectController: NgtObject3dController, | ||
private ngZone: NgZone | ||
) {} | ||
|
||
ngOnInit() { | ||
this.objectController.initFn = () => { | ||
return this.ngZone.runOutsideAngular(() => { | ||
this.#group = new THREE.Group(); | ||
return this.#group; | ||
}); | ||
}; | ||
} | ||
} | ||
|
||
@NgModule({ | ||
declarations: [NgtGroup], | ||
exports: [NgtGroup], | ||
}) | ||
export class NgtGroupModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @angular-three/core/materials | ||
|
||
Secondary entry point of `@angular-three/core`. It can be used by importing from `@angular-three/core/materials`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './mesh-basic-material/mesh-basic-material.directive'; |
31 changes: 31 additions & 0 deletions
31
packages/core/materials/src/mesh-basic-material/mesh-basic-material.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// GENERATED | ||
import { NgtMaterial } from '@angular-three/core'; | ||
import { Directive, NgModule } from '@angular/core'; | ||
import * as THREE from 'three'; | ||
|
||
@Directive({ | ||
selector: 'ngt-mesh-basic-material', | ||
exportAs: 'ngtMeshBasicMaterial', | ||
providers: [ | ||
{ | ||
provide: NgtMaterial, | ||
useExisting: NgtMeshBasicMaterial, | ||
}, | ||
], | ||
}) | ||
export class NgtMeshBasicMaterial extends NgtMaterial< | ||
THREE.MeshBasicMaterialParameters, | ||
THREE.MeshBasicMaterial | ||
> { | ||
static ngAcceptInputType_parameters: | ||
| THREE.MeshBasicMaterialParameters | ||
| undefined; | ||
|
||
materialType = THREE.MeshBasicMaterial; | ||
} | ||
|
||
@NgModule({ | ||
declarations: [NgtMeshBasicMaterial], | ||
exports: [NgtMeshBasicMaterial], | ||
}) | ||
export class NgtMeshBasicMaterialModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @angular-three/core/meshes | ||
|
||
Secondary entry point of `@angular-three/core`. It can be used by importing from `@angular-three/core/meshes`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './mesh/mesh.directive'; | ||
export * from './instanced-mesh/instanced-mesh.directive'; | ||
export * from './skinned-mesh/skinned-mesh.directive'; |
Oops, something went wrong.