Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
feat(core): add cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Nov 30, 2021
1 parent 1cc074a commit 56fcaaf
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 5 deletions.
8 changes: 7 additions & 1 deletion packages/core/cameras/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export const greeting = 'Hello World!';
// GENERATED
export * from './lib/camera/camera.directive';
export * from './lib/perspective-camera/perspective-camera.directive';
export * from './lib/orthographic-camera/orthographic-camera.directive';
export * from './lib/array-camera/array-camera.directive';
export * from './lib/stereo-camera/stereo-camera.directive';
export * from './lib/cube-camera/cube-camera.directive';
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// GENERATED
import {
NgtCommonCamera,
NGT_OBJECT_CONTROLLER_PROVIDER,
} from '@angular-three/core';
import { NgModule, Directive, Input } from '@angular/core';
import * as THREE from 'three';

@Directive({
selector: 'ngt-array-camera',
exportAs: 'ngtArrayCamera',
providers: [
{
provide: NgtCommonCamera,
useExisting: NgtArrayCamera,
},
NGT_OBJECT_CONTROLLER_PROVIDER,
],
})
export class NgtArrayCamera extends NgtCommonCamera<THREE.ArrayCamera> {
static ngAcceptInputType_args:
| ConstructorParameters<typeof THREE.ArrayCamera>
| undefined;

@Input() set args(v: ConstructorParameters<typeof THREE.ArrayCamera>) {
this.cameraArgs = v;
}

cameraType = THREE.ArrayCamera;
}

@NgModule({
declarations: [NgtArrayCamera],
exports: [NgtArrayCamera],
})
export class NgtArrayCameraModule {}
36 changes: 36 additions & 0 deletions packages/core/cameras/src/lib/camera/camera.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// GENERATED
import {
NgtCommonCamera,
NGT_OBJECT_CONTROLLER_PROVIDER,
} from '@angular-three/core';
import { NgModule, Directive, Input } from '@angular/core';
import * as THREE from 'three';

@Directive({
selector: 'ngt-camera',
exportAs: 'ngtCamera',
providers: [
{
provide: NgtCommonCamera,
useExisting: NgtCamera,
},
NGT_OBJECT_CONTROLLER_PROVIDER,
],
})
export class NgtCamera extends NgtCommonCamera<THREE.Camera> {
static ngAcceptInputType_args:
| ConstructorParameters<typeof THREE.Camera>
| undefined;

@Input() set args(v: ConstructorParameters<typeof THREE.Camera>) {
this.cameraArgs = v;
}

cameraType = THREE.Camera;
}

@NgModule({
declarations: [NgtCamera],
exports: [NgtCamera],
})
export class NgtCameraModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// GENERATED
import {
NgtCommonCamera,
NGT_OBJECT_CONTROLLER_PROVIDER,
} from '@angular-three/core';
import { NgModule, Directive, Input } from '@angular/core';
import * as THREE from 'three';

@Directive({
selector: 'ngt-orthographic-camera',
exportAs: 'ngtOrthographicCamera',
providers: [
{
provide: NgtCommonCamera,
useExisting: NgtOrthographicCamera,
},
NGT_OBJECT_CONTROLLER_PROVIDER,
],
})
export class NgtOrthographicCamera extends NgtCommonCamera<THREE.OrthographicCamera> {
static ngAcceptInputType_args:
| ConstructorParameters<typeof THREE.OrthographicCamera>
| undefined;

@Input() set args(v: ConstructorParameters<typeof THREE.OrthographicCamera>) {
this.cameraArgs = v;
}

cameraType = THREE.OrthographicCamera;
}

@NgModule({
declarations: [NgtOrthographicCamera],
exports: [NgtOrthographicCamera],
})
export class NgtOrthographicCameraModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// GENERATED
import {
NgtCommonCamera,
NGT_OBJECT_CONTROLLER_PROVIDER,
} from '@angular-three/core';
import { NgModule, Directive, Input } from '@angular/core';
import * as THREE from 'three';

@Directive({
selector: 'ngt-perspective-camera',
exportAs: 'ngtPerspectiveCamera',
providers: [
{
provide: NgtCommonCamera,
useExisting: NgtPerspectiveCamera,
},
NGT_OBJECT_CONTROLLER_PROVIDER,
],
})
export class NgtPerspectiveCamera extends NgtCommonCamera<THREE.PerspectiveCamera> {
static ngAcceptInputType_args:
| ConstructorParameters<typeof THREE.PerspectiveCamera>
| undefined;

@Input() set args(v: ConstructorParameters<typeof THREE.PerspectiveCamera>) {
this.cameraArgs = v;
}

cameraType = THREE.PerspectiveCamera;
}

@NgModule({
declarations: [NgtPerspectiveCamera],
exports: [NgtPerspectiveCamera],
})
export class NgtPerspectiveCameraModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// GENERATED
import {
NgtCommonCamera,
NGT_OBJECT_CONTROLLER_PROVIDER,
} from '@angular-three/core';
import { NgModule, Directive, Input } from '@angular/core';
import * as THREE from 'three';

@Directive({
selector: 'ngt-stereo-camera',
exportAs: 'ngtStereoCamera',
providers: [
{
provide: NgtCommonCamera,
useExisting: NgtStereoCamera,
},
NGT_OBJECT_CONTROLLER_PROVIDER,
],
})
export class NgtStereoCamera extends NgtCommonCamera<THREE.StereoCamera> {
static ngAcceptInputType_args:
| ConstructorParameters<typeof THREE.StereoCamera>
| undefined;

@Input() set args(v: ConstructorParameters<typeof THREE.StereoCamera>) {
this.cameraArgs = v;
}

cameraType = THREE.StereoCamera;
}

@NgModule({
declarations: [NgtStereoCamera],
exports: [NgtStereoCamera],
})
export class NgtStereoCameraModule {}
10 changes: 8 additions & 2 deletions packages/core/src/lib/controllers/object-3d-inputs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,21 @@ import { Controller, createControllerProviderFactory } from './controller';
ngt-box-helper,
ngt-box3-helper,
ngt-grid-helper,
ngt-camera-helper
ngt-camera-helper,
ngt-directional-light-helper,
ngt-hemisphere-light-helper,
ngt-plane-helper,
ngt-point-light-helper,
ngt-polar-grid-helper,
ngt-skeleton-helper,
ngt-skeleton-helper
ngt-spot-light-helper,
ngt-sprite,
ngt-camera,
ngt-perspective-camera,
ngt-orthographic-camera,
ngt-array-camera,
ngt-stereo-camera,
ngt-cube-camera,
`,
exportAs: 'ngtObject3dInputsController',
})
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/lib/controllers/object-3d.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,21 @@ const supportedEvents = [
ngt-box-helper,
ngt-box3-helper,
ngt-grid-helper,
ngt-camera-helper
ngt-camera-helper,
ngt-directional-light-helper,
ngt-hemisphere-light-helper,
ngt-plane-helper,
ngt-point-light-helper,
ngt-polar-grid-helper,
ngt-skeleton-helper,
ngt-skeleton-helper
ngt-spot-light-helper,
ngt-sprite,
ngt-camera,
ngt-perspective-camera,
ngt-orthographic-camera,
ngt-array-camera,
ngt-stereo-camera,
ngt-cube-camera,
`,
exportAs: 'ngtObject3dController',
providers: [
Expand Down

0 comments on commit 56fcaaf

Please sign in to comment.