Skip to content

Commit 9d21cad

Browse files
committed
cleanup
1 parent c4a0471 commit 9d21cad

File tree

8 files changed

+19
-481
lines changed

8 files changed

+19
-481
lines changed

classes/Animations.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
import { getProject, types as t } from '@theatre/core'
22
import { ObjectType } from '@/classes/interfaces/ObjectType';
3-
4-
//import studio from '@theatre/studio';
53
import gsap from 'gsap'
64

75

86
export default class Animations {
97

10-
webgl: any
118
vector3D: any
129

13-
constructor(webgl) {
14-
15-
this.webgl = webgl
16-
17-
10+
constructor() {
11+
1812
const nudgableNumber = (defaultValue) => t.number(defaultValue, { nudgeMultiplier: 0.01 });
1913

2014
this.vector3D = {
@@ -26,7 +20,7 @@ export default class Animations {
2620
if(window.location.pathname === "/studio") {
2721

2822
import('@theatre/studio').then(studio => {
29-
studio.default.initialize() //.initialize()
23+
studio.default.initialize()
3024
});
3125

3226

@@ -119,11 +113,11 @@ export default class Animations {
119113
return sheet;
120114
}
121115

122-
createIntroduction() {
116+
createIntroduction(camera) {
123117
const project = this.createProject('Introduction')
124118
const sheet = this.createSheet(project, 'Camera Animation', '/sounds/initialisation.mp3')
125119

126-
this.createTheatreObject(sheet, "camera", this.webgl.camera.instance, {
120+
this.createTheatreObject(sheet, "camera", camera.instance, {
127121

128122
transforms: {
129123
position: this.vector3D,

classes/Audio.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Howl, Howler } from 'howler';
22

33

4-
54
export default class Audio {
65
sounds: any
76

classes/Raycaster.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ export default class Raycaster {
99
raycaster: THREE.Raycaster
1010
mouse: THREE.Vector2
1111
objects: any
12-
anims: Animations
1312
currentIntersect: any
1413

1514
constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera, renderer: THREE.WebGLRenderer) {
1615

1716
this.scene = scene
1817
this.renderer = renderer
1918
this.camera = camera
20-
this.anims = new Animations()
19+
2120

2221

2322
this.mouse = new THREE.Vector2()

classes/Smoke.ts

-145
This file was deleted.

classes/WebGL.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import Scene from '@/classes/Scene';
88
import Materials from '@/classes/Materials';
99
import useAudio from '@/composables/useAudio';
1010
import useAnimations from '@/composables/useAnimations';
11-
import Animations from '@/classes/Animations';
11+
import CameraManager from '@/classes/managers/CameraManager'
12+
1213

1314
export default class WebGL {
15+
cameraManager: CameraManager
1416
scene: THREE.Scene;
1517
camera: THREE.PerspectiveCamera;
1618
renderer: Renderer;
@@ -26,7 +28,6 @@ export default class WebGL {
2628
params: ObjectType;
2729

2830

29-
3031
raycast: Raycaster;
3132
emitter: any;
3233

@@ -52,7 +53,10 @@ export default class WebGL {
5253
this.renderer = new Renderer(this.width, this.height);
5354
this.scene = new Scene(this);
5455

55-
this.animations = new Animations(this)
56+
57+
// MANAGERS
58+
this.cameraManager = new CameraManager({ webgl: this})
59+
this.animations = useAnimations()
5660

5761

5862
this.raycast = new Raycaster(
@@ -76,7 +80,7 @@ export default class WebGL {
7680
// const cube = this.scene.instance.getObjectByProperty('name', 'cube-base');
7781
// console.log(cube)
7882

79-
this.animations.createIntroduction()
83+
this.animations.createIntroduction(this.camera)
8084

8185
// this.animations.start(this.camera.instance, target)
8286

classes/managers/Cameras.ts renamed to classes/managers/CameraManager.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as THREE from 'three';
22
import useDebug from "@/composables/useDebug";
3-
import { lerp } from "three/src/math/MathUtils";
43

5-
export default class Cameras {
4+
export default class CameraManager {
65
webgl:any
76
scene:any
87
cameras: any
@@ -15,15 +14,14 @@ export default class Cameras {
1514

1615
setCam(camera) {
1716

18-
if(this.currentCamera) this.scene.remove(this.currentCamera.instance)
17+
if(this.currentCamera) this.scene.instance.remove(this.currentCamera.instance)
1918

2019
this.currentCamera = camera
21-
this.scene.add(this.currentCamera.instance)
20+
this.scene.instance.add(this.currentCamera.instance)
2221
}
2322

2423
resize() {
2524
this.currentCamera.resize(this.currentCamera);
26-
// this.mainCamera.resize();
2725
}
2826

2927

0 commit comments

Comments
 (0)