Skip to content

Commit 8203bbb

Browse files
committed
stars
1 parent 1bc4763 commit 8203bbb

File tree

18 files changed

+265
-62
lines changed

18 files changed

+265
-62
lines changed

libs/core/src/lib/renderer/store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ export type NgtRendererNode = {
4545
__ngt_renderer__: NgtRendererState;
4646
};
4747
export class NgtRendererStore {
48-
private readonly comments = [] as Array<NgtRendererNode>;
48+
private comments = [] as Array<NgtRendererNode>;
4949

50-
constructor(private readonly root: NgtRendererRootState) {}
50+
constructor(private root: NgtRendererRootState) {}
5151

5252
createNode(type: NgtRendererState[NgtRendererClassId.type], node: NgtAnyRecord) {
5353
const state = [

libs/soba/abstractions/src/billboard/billboard.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ export class NgtsBillboard {
4040

4141
@Input() billboardRef = injectNgtRef<Group>();
4242

43-
@Input() set follow(follow: boolean) {
43+
@Input({ alias: 'follow' }) set _follow(follow: boolean) {
4444
this.inputs.set({ follow });
4545
}
46-
@Input() set lockX(lockX: boolean) {
46+
@Input({ alias: 'lockX' }) set _lockX(lockX: boolean) {
4747
this.inputs.set({ lockX });
4848
}
49-
@Input() set lockY(lockY: boolean) {
49+
@Input({ alias: 'lockY' }) set _lockY(lockY: boolean) {
5050
this.inputs.set({ lockY });
5151
}
52-
@Input() set lockZ(lockZ: boolean) {
52+
@Input({ alias: 'lockZ' }) set _lockZ(lockZ: boolean) {
5353
this.inputs.set({ lockZ });
5454
}
5555

libs/soba/abstractions/src/text-3d/text-3d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class NgtsText3D {
136136
private letterSpacing = this.inputs.select('letterSpacing');
137137
private lineHeight = this.inputs.select('lineHeight');
138138

139-
readonly geometryArgs = computed(() => {
139+
geometryArgs = computed(() => {
140140
const fontData = this.fontData();
141141
if (!fontData) return null;
142142

libs/soba/cameras/src/camera/camera.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ export abstract class NgtsCamera<TCamera extends NgtCamera> {
1919
manual: false,
2020
});
2121

22-
@Input() set makeDefault(makeDefault: boolean) {
22+
@Input({ alias: 'makeDefault' }) set _makeDefault(makeDefault: boolean) {
2323
this.inputs.set({ makeDefault });
2424
}
2525

26-
@Input() set manual(manual: boolean) {
26+
@Input({ alias: 'manual' }) set _manual(manual: boolean) {
2727
this.inputs.set({ manual });
2828
}
2929

30-
@Input() set frames(frames: number) {
30+
@Input({ alias: 'frames' }) set _frames(frames: number) {
3131
this.inputs.set({ frames });
3232
}
3333

34-
@Input() set resolution(resolution: number) {
34+
@Input({ alias: 'resolution' }) set _resolution(resolution: number) {
3535
this.inputs.set({ resolution });
3636
}
3737

38-
@Input() set envMap(envMap: THREE.Texture) {
38+
@Input({ alias: 'envMap' }) set _envMap(envMap: THREE.Texture) {
3939
this.inputs.set({ envMap });
4040
}
4141

libs/soba/controls/src/orbit-controls/orbit-controls.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ declare global {
3232
@Component({
3333
selector: 'ngts-orbit-controls',
3434
standalone: true,
35-
template: ` <ngt-primitive *args="args()" ngtCompound [enableDamping]="damping()" /> `,
35+
template: ` <ngt-primitive *args="args()" ngtCompound [enableDamping]="enableDamping()" /> `,
3636
imports: [NgtArgs],
3737
schemas: [CUSTOM_ELEMENTS_SCHEMA],
3838
})
@@ -46,31 +46,31 @@ export class NgtsOrbitControls {
4646

4747
@Input() controlsRef = injectNgtRef<OrbitControls>();
4848

49-
@Input() set camera(camera: THREE.Camera) {
49+
@Input({ alias: 'camera' }) set _camera(camera: THREE.Camera) {
5050
this.inputs.set({ camera });
5151
}
5252

53-
@Input() set domElement(domElement: HTMLElement) {
53+
@Input({ alias: 'domElement' }) set _domElement(domElement: HTMLElement) {
5454
this.inputs.set({ domElement });
5555
}
5656

57-
@Input() set makeDefault(makeDefault: boolean) {
57+
@Input({ alias: 'makeDefault' }) set _makeDefault(makeDefault: boolean) {
5858
this.inputs.set({ makeDefault });
5959
}
6060

61-
@Input() set regress(regress: boolean) {
61+
@Input({ alias: 'regress' }) set _regress(regress: boolean) {
6262
this.inputs.set({ regress });
6363
}
6464

65-
@Input() set target(target: THREE.Vector3 | Parameters<THREE.Vector3['set']>) {
65+
@Input({ alias: 'target' }) set _target(target: THREE.Vector3 | Parameters<THREE.Vector3['set']>) {
6666
this.inputs.set({ target });
6767
}
6868

69-
@Input() set enableDamping(enableDamping: boolean) {
69+
@Input({ alias: 'enableDamping' }) set _enableDamping(enableDamping: boolean) {
7070
this.inputs.set({ enableDamping });
7171
}
7272

73-
@Input() set keyEvents(keyEvents: boolean) {
73+
@Input({ alias: 'keyEvents' }) set _keyEvents(keyEvents: boolean) {
7474
this.inputs.set({ keyEvents });
7575
}
7676

@@ -80,8 +80,8 @@ export class NgtsOrbitControls {
8080

8181
private store = injectNgtStore();
8282

83-
readonly args = computed(() => [this.controlsRef.nativeElement]);
84-
readonly damping = this.inputs.select('enableDamping');
83+
args = computed(() => [this.controlsRef.nativeElement]);
84+
enableDamping = this.inputs.select('enableDamping');
8585

8686
constructor() {
8787
injectBeforeRender(

libs/soba/loaders/src/loader/loader.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,27 @@ export class NgtsLoader {
6666
bar = this.inputs.select('barClass');
6767
data = this.inputs.select('dataClass');
6868

69-
@Input() set containerClass(containerClass: string) {
69+
@Input({ alias: 'containerClass' }) set _containerClass(containerClass: string) {
7070
this.inputs.set({ containerClass });
7171
}
7272

73-
@Input() set innerClass(innerClass: string) {
73+
@Input({ alias: 'innerClass' }) set _innerClass(innerClass: string) {
7474
this.inputs.set({ innerClass });
7575
}
7676

77-
@Input() set barClass(barClass: string) {
77+
@Input({ alias: 'barClass' }) set _barClass(barClass: string) {
7878
this.inputs.set({ barClass });
7979
}
8080

81-
@Input() set dataClass(dataClass: string) {
81+
@Input({ alias: 'dataClass' }) set _dataClass(dataClass: string) {
8282
this.inputs.set({ dataClass });
8383
}
8484

85-
@Input() set dataInterpolation(dataInterpolation: (value: number) => string) {
85+
@Input({ alias: 'dataInterpolation' }) set _dataInterpolation(dataInterpolation: (value: number) => string) {
8686
this.inputs.set({ dataInterpolation });
8787
}
8888

89-
@Input() set initialState(initialState: (value: boolean) => boolean) {
89+
@Input({ alias: 'initialState' }) set _initialState(initialState: (value: boolean) => boolean) {
9090
this.inputs.set({ initialState });
9191
}
9292

libs/soba/shaders/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './grid-material/grid-material';
22
export * from './shader-material/shader-material';
33
export * from './sparkles-material/sparkles-material';
44
export * from './spot-light-material/spot-light-material';
5+
export * from './star-field-material/star-field-material';
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { NgtShaderMaterial } from 'angular-three';
2+
import * as THREE from 'three';
3+
import { shaderMaterial } from '../shader-material/shader-material';
4+
5+
export const StarFieldMaterial = shaderMaterial(
6+
{ time: 0.0, fade: 0.0 },
7+
// language=GLSL
8+
`
9+
uniform float time;
10+
attribute float size;
11+
varying vec3 vColor;
12+
void main() {
13+
vColor = color;
14+
vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
15+
gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
16+
gl_Position = projectionMatrix * mvPosition;
17+
}
18+
`,
19+
// language=GLSL
20+
`
21+
uniform sampler2D pointTexture;
22+
uniform float fade;
23+
varying vec3 vColor;
24+
void main() {
25+
float opacity = 1.0;
26+
if (fade == 1.0) {
27+
float d = distance(gl_PointCoord, vec2(0.5, 0.5));
28+
opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
29+
}
30+
gl_FragColor = vec4(vColor, opacity);
31+
32+
#include <tonemapping_fragment>
33+
#include <${parseInt(THREE.REVISION.replace(/\D+/g, '')) >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
34+
}
35+
`,
36+
);
37+
38+
declare global {
39+
interface HTMLElementTagNameMap {
40+
/**
41+
* @extends ngt-shader-material
42+
*/
43+
'ngt-star-field-material': NgtShaderMaterial;
44+
}
45+
}

libs/soba/src/abstractions/text.stories.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import { color, makeDecorators, makeStoryObject, turn } from '../setup-canvas';
2828
class CustomMaterialTextStory {
2929
@Input() text = '';
3030
@Input() color = 'turquoise';
31-
readonly turn = turn;
32-
readonly DoubleSide = DoubleSide;
31+
turn = turn;
32+
DoubleSide = DoubleSide;
3333
}
3434

3535
@Component({
@@ -55,7 +55,7 @@ class CustomMaterialTextStory {
5555
})
5656
class LTRTextStory {
5757
@Input() text = '';
58-
readonly turn = turn;
58+
turn = turn;
5959
}
6060

6161
@Component({
@@ -85,7 +85,7 @@ class LTRTextStory {
8585
})
8686
class ShadowTextStory {
8787
@Input() text = '';
88-
readonly turn = turn;
88+
turn = turn;
8989
}
9090

9191
@Component({
@@ -112,7 +112,7 @@ class ShadowTextStory {
112112
})
113113
class StrokeTextStory {
114114
@Input() text = '';
115-
readonly turn = turn;
115+
turn = turn;
116116
}
117117

118118
@Component({
@@ -139,7 +139,7 @@ class StrokeTextStory {
139139
})
140140
class OutlineTextStory {
141141
@Input() text = '';
142-
readonly turn = turn;
142+
turn = turn;
143143
}
144144

145145
@Component({
@@ -165,7 +165,7 @@ class OutlineTextStory {
165165
class DefaultTextStory {
166166
@Input() text = '';
167167
@Input() color = '#ec2d2d';
168-
readonly turn = turn;
168+
turn = turn;
169169
}
170170

171171
export default {

libs/soba/src/staging/camera-shake.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const argsOptions = {
3434
schemas: [CUSTOM_ELEMENTS_SCHEMA],
3535
})
3636
class Scene {
37-
readonly Math = Math;
38-
readonly DoubleSide = THREE.DoubleSide;
37+
Math = Math;
38+
DoubleSide = THREE.DoubleSide;
3939

4040
onBeforeRender({ object: mesh }: NgtBeforeRenderEvent<THREE.Mesh>) {
4141
mesh.rotation.x = mesh.rotation.y += 0.01;

0 commit comments

Comments
 (0)