Skip to content

Commit d9bcca6

Browse files
committed
refactor(soba): adjust shaders with new renderer
1 parent a83ba07 commit d9bcca6

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default class Hud {}

libs/soba/shaders/src/lib/grid-material.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { NgtMaterial } from 'angular-three';
1+
import { NgtThreeElement } from 'angular-three';
22
import { getVersion } from 'angular-three-soba/misc';
33
import { shaderMaterial } from 'angular-three-soba/vanilla-exports';
4-
import { Color, ColorRepresentation, Side, Vector3 } from 'three';
4+
import * as THREE from 'three';
55

66
export interface GridMaterialOptions {
77
/** Cell size, default: 0.5 */
88
cellSize: number;
99
/** Cell thickness, default: 0.5 */
1010
cellThickness: number;
1111
/** Cell color, default: black */
12-
cellColor: ColorRepresentation;
12+
cellColor: THREE.ColorRepresentation;
1313
/** Section size, default: 1 */
1414
sectionSize: number;
1515
/** Section thickness, default: 1 */
1616
sectionThickness: number;
1717
/** Section color, default: #2080ff */
18-
sectionColor: ColorRepresentation;
18+
sectionColor: THREE.ColorRepresentation;
1919
/** Follow camera, default: false */
2020
followCamera: boolean;
2121
/** Display the grid infinitely, default: false */
@@ -27,7 +27,7 @@ export interface GridMaterialOptions {
2727
/** Fade from camera (1) or origin (0), or somewhere in between, default: camera */
2828
fadeFrom: number;
2929
/** Material side, default: THREE.BackSide */
30-
side: Side;
30+
side: THREE.Side;
3131
}
3232

3333
export const GridMaterial = shaderMaterial(
@@ -39,12 +39,12 @@ export const GridMaterial = shaderMaterial(
3939
fadeFrom: 1,
4040
cellThickness: 0.5,
4141
sectionThickness: 1,
42-
cellColor: new Color(),
43-
sectionColor: new Color(),
42+
cellColor: new THREE.Color(),
43+
sectionColor: new THREE.Color(),
4444
infiniteGrid: false,
4545
followCamera: false,
46-
worldCamProjPosition: new Vector3(),
47-
worldPlanePosition: new Vector3(),
46+
worldCamProjPosition: new THREE.Vector3(),
47+
worldPlanePosition: new THREE.Vector3(),
4848
},
4949
/* language=glsl glsl */ `
5050
varying vec3 localPosition;
@@ -110,7 +110,7 @@ export const GridMaterial = shaderMaterial(
110110
`,
111111
);
112112

113-
export type NgtGridMaterial = NgtMaterial<InstanceType<typeof GridMaterial>, [GridMaterialOptions]>;
113+
export type NgtGridMaterial = NgtThreeElement<typeof GridMaterial>;
114114

115115
declare global {
116116
interface HTMLElementTagNameMap {

libs/soba/shaders/src/lib/point-material.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { NgtMaterial } from 'angular-three';
1+
import { NgtThreeElement } from 'angular-three';
22
import { getVersion } from 'angular-three-soba/misc';
3-
import { PointsMaterial, PointsMaterialParameters } from 'three';
3+
import * as THREE from 'three';
44

55
const opaque_fragment = getVersion() >= 154 ? 'opaque_fragment' : 'output_fragment';
66

7-
export class PointMaterial extends PointsMaterial {
8-
constructor(props: PointsMaterialParameters) {
7+
export class PointMaterial extends THREE.PointsMaterial {
8+
constructor(props: THREE.PointsMaterialParameters) {
99
super(props);
1010
this.onBeforeCompile = (shader, renderer) => {
1111
const { isWebGL2 } = renderer.capabilities;
@@ -30,7 +30,7 @@ export class PointMaterial extends PointsMaterial {
3030
}
3131
}
3232

33-
export type NgtPointMaterial = NgtMaterial<PointMaterial, [PointsMaterialParameters]>;
33+
export type NgtPointMaterial = NgtThreeElement<typeof PointMaterial>;
3434

3535
declare global {
3636
interface HTMLElementTagNameMap {

0 commit comments

Comments
 (0)