Skip to content

Commit 9d778de

Browse files
committed
remove all old stuffs
1 parent 0e2feba commit 9d778de

File tree

457 files changed

+1230
-183230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

457 files changed

+1230
-183230
lines changed
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<ngt-canvas [sceneGraph]="scene" [camera]="{ fov: 50, near: 0.1, far: 10000 }" [shadows]="true" />
2-
<span
3-
style="
4-
position: absolute;
5-
top: 1rem;
6-
right: 1rem;
7-
font-size: x-large;
8-
font-family: 'Exo 2';
9-
font-weight: bold;
10-
color: #ffd700;
11-
"
12-
>
13-
Coins: {{ game.coins }}
14-
</span>
1+
<!--<ngt-canvas [sceneGraph]="scene" [camera]="{ fov: 50, near: 0.1, far: 10000 }" [shadows]="true" />-->
2+
<!--<span-->
3+
<!-- style="-->
4+
<!-- position: absolute;-->
5+
<!-- top: 1rem;-->
6+
<!-- right: 1rem;-->
7+
<!-- font-size: x-large;-->
8+
<!-- font-family: 'Exo 2';-->
9+
<!-- font-weight: bold;-->
10+
<!-- color: #ffd700;-->
11+
<!-- "-->
12+
<!--&gt;-->
13+
<!-- Coins: {{ game.coins }}-->
14+
<!--</span>-->
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { Component, inject } from '@angular/core';
2-
import { NgtCanvas } from 'angular-three-old';
3-
import { AviatorScene } from './scene.component';
4-
import { GameService } from './services/game.service';
5-
import { WorldService } from './services/world.service';
6-
7-
@Component({
8-
standalone: true,
9-
templateUrl: './canvas.component.html',
10-
imports: [NgtCanvas],
11-
providers: [WorldService, GameService],
12-
host: { class: 'aviator-canvas' },
13-
})
14-
export class AviatorCanvas {
15-
scene = AviatorScene;
16-
game = inject(GameService);
17-
}
1+
// import { Component, inject } from '@angular/core';
2+
// import { NgtCanvas } from 'angular-three-old';
3+
// import { AviatorScene } from './scene.component';
4+
// import { GameService } from './services/game.service';
5+
// import { WorldService } from './services/world.service';
6+
//
7+
// @Component({
8+
// standalone: true,
9+
// templateUrl: './canvas.component.html',
10+
// imports: [NgtCanvas],
11+
// providers: [WorldService, GameService],
12+
// host: { class: 'aviator-canvas' },
13+
// })
14+
// export class AviatorCanvas {
15+
// scene = AviatorScene;
16+
// game = inject(GameService);
17+
// }
Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
<ngt-object3D
2-
[castShadow]="true"
3-
[receiveShadow]="true"
4-
[scale]="0.25"
5-
[position]="[0, world.planeDefaultHeight, 0]"
6-
[ref]="refs.airplaneRef"
7-
(beforeRender)="onAirplaneBeforeRender($event)"
8-
>
9-
<!-- cabin -->
10-
<ngt-mesh [castShadow]="true" [receiveShadow]="true">
11-
<ngt-buffer-geometry>
12-
<ngt-buffer-attribute attach="attributes.position" *args="[cabinVertices, 3]" />
13-
</ngt-buffer-geometry>
14-
<ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" [side]="DoubleSide" />
15-
</ngt-mesh>
16-
17-
<!-- engine -->
18-
<ngt-mesh [position]="[50, 0, 0]" [castShadow]="true" [receiveShadow]="true">
19-
<ngt-box-geometry *args="[20, 50, 50]" />
20-
<ngt-mesh-phong-material [color]="Colors.white" [flatShading]="true" />
21-
</ngt-mesh>
22-
23-
<!-- tail plane -->
24-
<ngt-mesh [position]="[-40, 20, 0]" [castShadow]="true" [receiveShadow]="true">
25-
<ngt-box-geometry *args="[15, 20, 5]" />
26-
<ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" />
27-
</ngt-mesh>
28-
29-
<!-- side wing -->
30-
<ngt-mesh [position]="[0, 15, 0]" [castShadow]="true" [receiveShadow]="true">
31-
<ngt-box-geometry *args="[30, 5, 120]" />
32-
<ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" />
33-
</ngt-mesh>
34-
35-
<!-- windshield -->
36-
<ngt-mesh [position]="[20, 27, 0]" [castShadow]="true" [receiveShadow]="true">
37-
<ngt-box-geometry *args="[3, 15, 20]" />
38-
<ngt-mesh-phong-material [color]="Colors.white" [transparent]="true" [opacity]="0.3" [flatShading]="true" />
39-
</ngt-mesh>
40-
41-
<!-- propeller -->
42-
<app-propeller />
43-
44-
<!-- wheels -->
45-
<app-wheel [position]="[25, -20, 25]" />
46-
<app-tire [position]="[25, -28, 25]" />
47-
<app-wheel [position]="[25, -20, -25]" />
48-
<app-tire [position]="[25, -28, -25]" />
49-
<app-tire [position]="[-35, -5, 0]" [scale]="0.5" />
50-
51-
<!-- suspension -->
52-
<ngt-mesh [position]="[-35, -5, 0]" [rotation]="[0, 0, -0.3]">
53-
<ngt-box-geometry #suspensionGeometry *args="[4, 20, 4]" />
54-
<ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" />
55-
</ngt-mesh>
56-
57-
<!-- pilot -->
58-
<app-pilot [position]="[5, 27, 0]" />
59-
</ngt-object3D>
1+
<!--<ngt-object3D-->
2+
<!-- [castShadow]="true"-->
3+
<!-- [receiveShadow]="true"-->
4+
<!-- [scale]="0.25"-->
5+
<!-- [position]="[0, world.planeDefaultHeight, 0]"-->
6+
<!-- [ref]="refs.airplaneRef"-->
7+
<!-- (beforeRender)="onAirplaneBeforeRender($event)"-->
8+
<!--&gt;-->
9+
<!-- &lt;!&ndash; cabin &ndash;&gt;-->
10+
<!-- <ngt-mesh [castShadow]="true" [receiveShadow]="true">-->
11+
<!-- <ngt-buffer-geometry>-->
12+
<!-- <ngt-buffer-attribute attach="attributes.position" *args="[cabinVertices, 3]" />-->
13+
<!-- </ngt-buffer-geometry>-->
14+
<!-- <ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" [side]="DoubleSide" />-->
15+
<!-- </ngt-mesh>-->
16+
17+
<!-- &lt;!&ndash; engine &ndash;&gt;-->
18+
<!-- <ngt-mesh [position]="[50, 0, 0]" [castShadow]="true" [receiveShadow]="true">-->
19+
<!-- <ngt-box-geometry *args="[20, 50, 50]" />-->
20+
<!-- <ngt-mesh-phong-material [color]="Colors.white" [flatShading]="true" />-->
21+
<!-- </ngt-mesh>-->
22+
23+
<!-- &lt;!&ndash; tail plane &ndash;&gt;-->
24+
<!-- <ngt-mesh [position]="[-40, 20, 0]" [castShadow]="true" [receiveShadow]="true">-->
25+
<!-- <ngt-box-geometry *args="[15, 20, 5]" />-->
26+
<!-- <ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" />-->
27+
<!-- </ngt-mesh>-->
28+
29+
<!-- &lt;!&ndash; side wing &ndash;&gt;-->
30+
<!-- <ngt-mesh [position]="[0, 15, 0]" [castShadow]="true" [receiveShadow]="true">-->
31+
<!-- <ngt-box-geometry *args="[30, 5, 120]" />-->
32+
<!-- <ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" />-->
33+
<!-- </ngt-mesh>-->
34+
35+
<!-- &lt;!&ndash; windshield &ndash;&gt;-->
36+
<!-- <ngt-mesh [position]="[20, 27, 0]" [castShadow]="true" [receiveShadow]="true">-->
37+
<!-- <ngt-box-geometry *args="[3, 15, 20]" />-->
38+
<!-- <ngt-mesh-phong-material [color]="Colors.white" [transparent]="true" [opacity]="0.3" [flatShading]="true" />-->
39+
<!-- </ngt-mesh>-->
40+
41+
<!-- &lt;!&ndash; propeller &ndash;&gt;-->
42+
<!-- <app-propeller />-->
43+
44+
<!-- &lt;!&ndash; wheels &ndash;&gt;-->
45+
<!-- <app-wheel [position]="[25, -20, 25]" />-->
46+
<!-- <app-tire [position]="[25, -28, 25]" />-->
47+
<!-- <app-wheel [position]="[25, -20, -25]" />-->
48+
<!-- <app-tire [position]="[25, -28, -25]" />-->
49+
<!-- <app-tire [position]="[-35, -5, 0]" [scale]="0.5" />-->
50+
51+
<!-- &lt;!&ndash; suspension &ndash;&gt;-->
52+
<!-- <ngt-mesh [position]="[-35, -5, 0]" [rotation]="[0, 0, -0.3]">-->
53+
<!-- <ngt-box-geometry #suspensionGeometry *args="[4, 20, 4]" />-->
54+
<!-- <ngt-mesh-phong-material [color]="Colors.red" [flatShading]="true" />-->
55+
<!-- </ngt-mesh>-->
56+
57+
<!-- &lt;!&ndash; pilot &ndash;&gt;-->
58+
<!-- <app-pilot [position]="[5, 27, 0]" />-->
59+
<!--</ngt-object3D>-->
Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
import { CUSTOM_ELEMENTS_SCHEMA, Component, ElementRef, ViewChild, inject } from '@angular/core';
2-
import { NgtArgs, type NgtBeforeRenderEvent } from 'angular-three-old';
3-
import * as THREE from 'three';
4-
import { GameService } from '../../services/game.service';
5-
import { RefsService } from '../../services/refs.service';
6-
import { WorldService } from '../../services/world.service';
7-
import { Colors } from '../../utils/colors';
8-
import { makeTetrahedron } from '../../utils/make-tetrahedron';
9-
import { normalize } from '../../utils/normalize';
10-
import { Pilot } from './pilot/pilot.component';
11-
import { Propeller } from './propeller/propeller.component';
12-
import { Tire } from './tire/tire.component';
13-
import { Wheel } from './wheel/wheel.component';
14-
15-
const frontUR = [40, 25, -25];
16-
const frontUL = [40, 25, 25];
17-
const frontLR = [40, -25, -25];
18-
const frontLL = [40, -25, 25];
19-
const backUR = [-40, 15, -5];
20-
const backUL = [-40, 15, 5];
21-
const backLR = [-40, 5, -5];
22-
const backLL = [-40, 5, 5];
23-
24-
@Component({
25-
selector: 'app-airplane',
26-
standalone: true,
27-
templateUrl: './airplane.component.html',
28-
imports: [NgtArgs, Propeller, Wheel, Tire, Pilot],
29-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
30-
})
31-
export class Airplane {
32-
Colors = Colors;
33-
34-
DoubleSide = THREE.DoubleSide;
35-
36-
cabinVertices = new Float32Array(
37-
makeTetrahedron(frontUL, frontUR, frontLL, frontLR) // front
38-
.concat(makeTetrahedron(backUL, backUR, backLL, backLR)) // back
39-
.concat(makeTetrahedron(backUR, backLR, frontUR, frontLR)) // side
40-
.concat(makeTetrahedron(backUL, backLL, frontUL, frontLL)) // side
41-
.concat(makeTetrahedron(frontUL, backUL, frontUR, backUR)) // top
42-
.concat(makeTetrahedron(frontLL, backLL, frontLR, backLR)), // bottom
43-
);
44-
45-
@ViewChild('suspensionGeometry') set suspensionGeometry({ nativeElement }: ElementRef<THREE.BoxGeometry>) {
46-
nativeElement.applyMatrix4(new THREE.Matrix4().makeTranslation(0, 10, 0));
47-
}
48-
49-
world = inject(WorldService);
50-
game = inject(GameService);
51-
refs = inject(RefsService);
52-
53-
constructor() {
54-
console.log(this.world);
55-
}
56-
57-
onAirplaneBeforeRender({ object, state: { pointer, delta } }: NgtBeforeRenderEvent<THREE.Object3D>) {
58-
if (this.game.status === 'playing') {
59-
this.game.planeSpeed = normalize(pointer.x, -0.5, 0.5, this.world.planeMinSpeed, this.world.planeMaxSpeed);
60-
let targetX = normalize(pointer.x, -1, 1, -this.world.planeAmpWidth * 0.7, -this.world.planeAmpWidth);
61-
let targetY = normalize(
62-
pointer.y,
63-
-0.75,
64-
0.75,
65-
this.world.planeDefaultHeight - this.world.planeAmpHeight,
66-
this.world.planeDefaultHeight + this.world.planeAmpHeight,
67-
);
68-
69-
this.game.planeCollisionDisplacementX += this.game.planeCollisionSpeedX;
70-
targetX += this.game.planeCollisionDisplacementX;
71-
72-
this.game.planeCollisionDisplacementY += this.game.planeCollisionSpeedY;
73-
targetY += this.game.planeCollisionDisplacementY;
74-
75-
object.position.x += (targetX - object.position.x) * delta * 1000 * this.world.planeMoveSensivity;
76-
object.position.y += (targetY - object.position.y) * delta * 1000 * this.world.planeMoveSensivity;
77-
78-
object.rotation.x = (object.position.y - targetY) * delta * 1000 * this.world.planeRotZSensivity;
79-
object.rotation.z = (targetY - object.position.y) * delta * 1000 * this.world.planeRotXSensivity;
80-
}
81-
82-
this.game.planeCollisionSpeedX += (0 - this.game.planeCollisionSpeedX) * delta * 1000 * 0.03;
83-
this.game.planeCollisionDisplacementX += (0 - this.game.planeCollisionDisplacementX) * delta * 1000 * 0.01;
84-
this.game.planeCollisionSpeedY += (0 - this.game.planeCollisionSpeedY) * delta * 1000 * 0.03;
85-
this.game.planeCollisionDisplacementY += (0 - this.game.planeCollisionDisplacementY) * delta * 1000 * 0.01;
86-
}
87-
}
1+
// import { CUSTOM_ELEMENTS_SCHEMA, Component, ElementRef, ViewChild, inject } from '@angular/core';
2+
// import { NgtArgs, type NgtBeforeRenderEvent } from 'angular-three-old';
3+
// import * as THREE from 'three';
4+
// import { GameService } from '../../services/game.service';
5+
// import { RefsService } from '../../services/refs.service';
6+
// import { WorldService } from '../../services/world.service';
7+
// import { Colors } from '../../utils/colors';
8+
// import { makeTetrahedron } from '../../utils/make-tetrahedron';
9+
// import { normalize } from '../../utils/normalize';
10+
// import { Pilot } from './pilot/pilot.component';
11+
// import { Propeller } from './propeller/propeller.component';
12+
// import { Tire } from './tire/tire.component';
13+
// import { Wheel } from './wheel/wheel.component';
14+
//
15+
// const frontUR = [40, 25, -25];
16+
// const frontUL = [40, 25, 25];
17+
// const frontLR = [40, -25, -25];
18+
// const frontLL = [40, -25, 25];
19+
// const backUR = [-40, 15, -5];
20+
// const backUL = [-40, 15, 5];
21+
// const backLR = [-40, 5, -5];
22+
// const backLL = [-40, 5, 5];
23+
//
24+
// @Component({
25+
// selector: 'app-airplane',
26+
// standalone: true,
27+
// templateUrl: './airplane.component.html',
28+
// imports: [NgtArgs, Propeller, Wheel, Tire, Pilot],
29+
// schemas: [CUSTOM_ELEMENTS_SCHEMA],
30+
// })
31+
// export class Airplane {
32+
// Colors = Colors;
33+
//
34+
// DoubleSide = THREE.DoubleSide;
35+
//
36+
// cabinVertices = new Float32Array(
37+
// makeTetrahedron(frontUL, frontUR, frontLL, frontLR) // front
38+
// .concat(makeTetrahedron(backUL, backUR, backLL, backLR)) // back
39+
// .concat(makeTetrahedron(backUR, backLR, frontUR, frontLR)) // side
40+
// .concat(makeTetrahedron(backUL, backLL, frontUL, frontLL)) // side
41+
// .concat(makeTetrahedron(frontUL, backUL, frontUR, backUR)) // top
42+
// .concat(makeTetrahedron(frontLL, backLL, frontLR, backLR)), // bottom
43+
// );
44+
//
45+
// @ViewChild('suspensionGeometry') set suspensionGeometry({ nativeElement }: ElementRef<THREE.BoxGeometry>) {
46+
// nativeElement.applyMatrix4(new THREE.Matrix4().makeTranslation(0, 10, 0));
47+
// }
48+
//
49+
// world = inject(WorldService);
50+
// game = inject(GameService);
51+
// refs = inject(RefsService);
52+
//
53+
// constructor() {
54+
// console.log(this.world);
55+
// }
56+
//
57+
// onAirplaneBeforeRender({ object, state: { pointer, delta } }: NgtBeforeRenderEvent<THREE.Object3D>) {
58+
// if (this.game.status === 'playing') {
59+
// this.game.planeSpeed = normalize(pointer.x, -0.5, 0.5, this.world.planeMinSpeed, this.world.planeMaxSpeed);
60+
// let targetX = normalize(pointer.x, -1, 1, -this.world.planeAmpWidth * 0.7, -this.world.planeAmpWidth);
61+
// let targetY = normalize(
62+
// pointer.y,
63+
// -0.75,
64+
// 0.75,
65+
// this.world.planeDefaultHeight - this.world.planeAmpHeight,
66+
// this.world.planeDefaultHeight + this.world.planeAmpHeight,
67+
// );
68+
//
69+
// this.game.planeCollisionDisplacementX += this.game.planeCollisionSpeedX;
70+
// targetX += this.game.planeCollisionDisplacementX;
71+
//
72+
// this.game.planeCollisionDisplacementY += this.game.planeCollisionSpeedY;
73+
// targetY += this.game.planeCollisionDisplacementY;
74+
//
75+
// object.position.x += (targetX - object.position.x) * delta * 1000 * this.world.planeMoveSensivity;
76+
// object.position.y += (targetY - object.position.y) * delta * 1000 * this.world.planeMoveSensivity;
77+
//
78+
// object.rotation.x = (object.position.y - targetY) * delta * 1000 * this.world.planeRotZSensivity;
79+
// object.rotation.z = (targetY - object.position.y) * delta * 1000 * this.world.planeRotXSensivity;
80+
// }
81+
//
82+
// this.game.planeCollisionSpeedX += (0 - this.game.planeCollisionSpeedX) * delta * 1000 * 0.03;
83+
// this.game.planeCollisionDisplacementX += (0 - this.game.planeCollisionDisplacementX) * delta * 1000 * 0.01;
84+
// this.game.planeCollisionSpeedY += (0 - this.game.planeCollisionSpeedY) * delta * 1000 * 0.03;
85+
// this.game.planeCollisionDisplacementY += (0 - this.game.planeCollisionDisplacementY) * delta * 1000 * 0.01;
86+
// }
87+
// }

0 commit comments

Comments
 (0)