diff --git a/projects/ngx-three-demo/src/app/app-routing.module.ts b/projects/ngx-three-demo/src/app/app-routing.module.ts index 70c2d278..c89c9622 100644 --- a/projects/ngx-three-demo/src/app/app-routing.module.ts +++ b/projects/ngx-three-demo/src/app/app-routing.module.ts @@ -23,6 +23,7 @@ import { ViewsExampleComponent } from './views-example/views-example.component'; import { MultiRendererExampleComponent } from './multi-renderer-example/multi-renderer-example.component'; import { CSS3dRendererExampleComponent } from './css3d-renderer-example/css3d-renderer-example.component'; import { HtmlWithCSS3dExampleComponent } from './html-with-css3d-example/html-with-css3d-example.component'; +import { FogExampleComponent } from './webgpu/fog-example.component'; export const EXAMPLE_ROUTES: (Route & { data: { @@ -284,6 +285,16 @@ export const EXAMPLE_ROUTES: (Route & { ], }, }, + { + path: 'webgpu-fog-example', + data: { + title: 'WebGPU Fog Example', + exampleComponent: FogExampleComponent, + codeUrls: [ + 'https://raw.githubusercontent.com/demike/ngx-three/main/projects/ngx-three-demo/src/app/webgpu/fog-example.component.ts', + ], + }, + }, ]; EXAMPLE_ROUTES.forEach((route) => (route.component = ExamplePageComponent)); diff --git a/projects/ngx-three-demo/src/app/loader-example/loader-example.component.ts b/projects/ngx-three-demo/src/app/loader-example/loader-example.component.ts index d529cd78..7ce72d9d 100644 --- a/projects/ngx-three-demo/src/app/loader-example/loader-example.component.ts +++ b/projects/ngx-three-demo/src/app/loader-example/loader-example.component.ts @@ -4,7 +4,7 @@ import { ASSET_PATH } from '../assets'; @Component({ selector: 'app-loader-example', templateUrl: './loader-example.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush, }) export class LoaderExampleComponent { public assetPath1 = `${ASSET_PATH}DamagedHelmet.glb`; diff --git a/projects/ngx-three-demo/src/app/webgpu/fog-example.component.ts b/projects/ngx-three-demo/src/app/webgpu/fog-example.component.ts new file mode 100644 index 00000000..05cfcd69 --- /dev/null +++ b/projects/ngx-three-demo/src/app/webgpu/fog-example.component.ts @@ -0,0 +1,118 @@ +import { ChangeDetectionStrategy, Component, AfterViewInit, ViewChild } from '@angular/core'; +import { NgxThreeModule, ThInstancedMesh } from 'ngx-three'; +import { provideWebGPURenderer } from 'projects/ngx-three/src/lib/renderer/renderer-providers'; +import * as THREE from 'three/webgpu'; +import { float, positionView, positionWorld, triNoise3D, uniform, color, fog, normalWorld } from 'three/src/nodes/TSL'; + +@Component({ + selector: 'app-fog-example', + template: ` + + + + + + + + + + + + + + + + + + `, + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [NgxThreeModule], + providers: [provideWebGPURenderer()], +}) +export class FogExampleComponent implements AfterViewInit { + readonly webGPUScene = new THREE.Scene(); + readonly Math = Math; + readonly NUM_INSTANCES = 4000; + readonly skyColor = color(0xf0f5f5); + readonly groundColor = color(0xd0dee7); + readonly aspect = window.innerWidth / window.innerHeight; + readonly near = 1; + readonly far = 600; + private fogNoiseDistance = positionView.z.negate().smoothstep(0, this.far - 300); + protected buildWindows = positionWorld.y + .mul(10) + .floor() + .mod(4) + .sign() + .mix(color(0x000066).add(this.fogNoiseDistance), color(0xffffff)); + private backgroundNode = normalWorld.y.max(0).mix(this.groundColor, this.skyColor); + private fogNode: ReturnType; + + @ViewChild('instancedMesh', { static: true }) + protected instancedMesh?: ThInstancedMesh; + + constructor() { + this.fogNode = this.initFogNode(); + this.webGPUScene.backgroundNode = this.backgroundNode; + this.webGPUScene.fogNode = this.fogNode; + } + + ngAfterViewInit() { + this.initInstanceMatrix(); + } + + initInstanceMatrix() { + const dummy = new THREE.Object3D(); + const center = new THREE.Vector3(); + const buildMesh = this.instancedMesh!.objRef!; + + for (let i = 0; i < buildMesh.count; i++) { + const scaleY = Math.random() * 7 + 0.5; + + dummy.position.x = Math.random() * 600 - 300; + dummy.position.z = Math.random() * 600 - 300; + + const distance = Math.max(dummy.position.distanceTo(center) * 0.012, 1); + + dummy.position.y = 0.5 * scaleY * distance; + + dummy.scale.x = dummy.scale.z = Math.random() * 3 + 0.5; + dummy.scale.y = scaleY * distance; + + dummy.updateMatrix(); + + buildMesh.setMatrixAt(i, dummy.matrix); + } + // buildMesh.instanceMatrix.needsUpdate = true; + } + + private initFogNode() { + const distance = this.fogNoiseDistance.mul(20).max(4); + const alpha = 0.98; + const groundFogArea = float(distance).sub(positionWorld.y).div(distance).pow(3).saturate().mul(alpha); + + // an alternative way to create a TimerNode + const timer = uniform(0).onFrameUpdate((frame) => frame.time); + + const fogNoiseA = triNoise3D(positionWorld.mul(0.005), 0.2, timer); + const fogNoiseB = triNoise3D(positionWorld.mul(0.01), 0.2, timer.mul(1.2)); + + const fogNoise = fogNoiseA.add(fogNoiseB).mul(this.groundColor); + + return fog(this.fogNoiseDistance.oneMinus().mix(this.groundColor, fogNoise), groundFogArea); + } +} diff --git a/projects/ngx-three/src/lib/ThEngine.service.ts b/projects/ngx-three/src/lib/ThEngine.service.ts index 888aa861..10b11b80 100644 --- a/projects/ngx-three/src/lib/ThEngine.service.ts +++ b/projects/ngx-three/src/lib/ThEngine.service.ts @@ -5,6 +5,7 @@ import { HOST_ELEMENT, ThView } from './ThView'; import { isObserved } from './util'; import { Observable, Subject, takeUntil } from 'rxjs'; import { RENDERER_PROVIDERS } from './renderer/renderer-providers'; +import { WebGPURenderer } from 'three/webgpu'; export interface RenderState { engine: ThEngineService; @@ -132,7 +133,7 @@ export class ThEngineService implements OnDestroy { } for (const renderer of this.renderers) { - if (view.effectComposer && !(renderer instanceof WebGLRenderer)) { + if (view.effectComposer && !(renderer instanceof WebGLRenderer || renderer instanceof WebGPURenderer)) { // effect composer needs a webgl renderer continue; } diff --git a/projects/ngx-three/src/lib/generated/ThInstancedPointsNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThInstancedPointsNodeMaterial.ts new file mode 100644 index 00000000..423d3092 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThInstancedPointsNodeMaterial.ts @@ -0,0 +1,153 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import Node from 'three/src/nodes/core/Node.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + InstancedPointsNodeMaterial, + InstancedPointsNodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-instancedPointsNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThInstancedPointsNodeMaterial), + }, + ], +}) +export class ThInstancedPointsNodeMaterial< + T extends InstancedPointsNodeMaterial = InstancedPointsNodeMaterial, + TARGS = /* params? */ InstancedPointsNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return InstancedPointsNodeMaterial; + } + + @Input() + public set useAlphaToCoverage(value: boolean) { + if (this._objRef) { + this._objRef.useAlphaToCoverage = value; + } + } + + public get useAlphaToCoverage(): boolean | undefined { + return this._objRef?.useAlphaToCoverage; + } + @Input() + public set useColor(value: boolean | undefined) { + if (this._objRef) { + this._objRef.useColor = value; + } + } + + public get useColor(): (boolean | undefined) | undefined { + return this._objRef?.useColor; + } + @Input() + public set pointWidth(value: number) { + if (this._objRef) { + this._objRef.pointWidth = value; + } + } + + public get pointWidth(): number | undefined { + return this._objRef?.pointWidth; + } + @Input() + public set pointColorNode(value: Node | null) { + if (this._objRef) { + this._objRef.pointColorNode = value; + } + } + + public get pointColorNode(): (Node | null) | undefined { + return this._objRef?.pointColorNode; + } + @Input() + public set pointWidthNode(value: Node | null) { + if (this._objRef) { + this._objRef.pointWidthNode = value; + } + } + + public get pointWidthNode(): (Node | null) | undefined { + return this._objRef?.pointWidthNode; + } + public get isPointsMaterial(): true | undefined { + return this._objRef?.isPointsMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set size(value: number) { + if (this._objRef) { + this._objRef.size = value; + } + } + + public get size(): number | undefined { + return this._objRef?.size; + } + @Input() + public set sizeAttenuation(value: boolean) { + if (this._objRef) { + this._objRef.sizeAttenuation = value; + } + } + + public get sizeAttenuation(): boolean | undefined { + return this._objRef?.sizeAttenuation; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThLine2NodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThLine2NodeMaterial.ts new file mode 100644 index 00000000..0dfdf14c --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThLine2NodeMaterial.ts @@ -0,0 +1,282 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import Node from 'three/src/nodes/core/Node.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + Line2NodeMaterial, + Line2NodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-line2NodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { provide: ThMaterial, useExisting: forwardRef(() => ThLine2NodeMaterial) }, + ], +}) +export class ThLine2NodeMaterial< + T extends Line2NodeMaterial = Line2NodeMaterial, + TARGS = /* parameters? */ Line2NodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return Line2NodeMaterial; + } + + @Input() + public set lights(value: boolean) { + if (this._objRef) { + this._objRef.lights = value; + } + } + + public get lights(): boolean | undefined { + return this._objRef?.lights; + } + public get isLineDashedMaterial(): true | undefined { + return this._objRef?.isLineDashedMaterial; + } + @Input() + public set scale(value: number) { + if (this._objRef) { + this._objRef.scale = value; + } + } + + public get scale(): number | undefined { + return this._objRef?.scale; + } + @Input() + public set dashSize(value: number) { + if (this._objRef) { + this._objRef.dashSize = value; + } + } + + public get dashSize(): number | undefined { + return this._objRef?.dashSize; + } + @Input() + public set gapSize(value: number) { + if (this._objRef) { + this._objRef.gapSize = value; + } + } + + public get gapSize(): number | undefined { + return this._objRef?.gapSize; + } + public get isLineBasicMaterial(): true | undefined { + return this._objRef?.isLineBasicMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } + @Input() + public set linewidth(value: number) { + if (this._objRef) { + this._objRef.linewidth = value; + } + } + + public get linewidth(): number | undefined { + return this._objRef?.linewidth; + } + @Input() + public set linecap(value: string) { + if (this._objRef) { + this._objRef.linecap = value; + } + } + + public get linecap(): string | undefined { + return this._objRef?.linecap; + } + @Input() + public set linejoin(value: string) { + if (this._objRef) { + this._objRef.linejoin = value; + } + } + + public get linejoin(): string | undefined { + return this._objRef?.linejoin; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set useAlphaToCoverage(value: boolean) { + if (this._objRef) { + this._objRef.useAlphaToCoverage = value; + } + } + + public get useAlphaToCoverage(): boolean | undefined { + return this._objRef?.useAlphaToCoverage; + } + @Input() + public set useColor(value: boolean) { + if (this._objRef) { + this._objRef.useColor = value; + } + } + + public get useColor(): boolean | undefined { + return this._objRef?.useColor; + } + @Input() + public set useDash(value: boolean) { + if (this._objRef) { + this._objRef.useDash = value; + } + } + + public get useDash(): boolean | undefined { + return this._objRef?.useDash; + } + @Input() + public set useWorldUnits(value: boolean) { + if (this._objRef) { + this._objRef.useWorldUnits = value; + } + } + + public get useWorldUnits(): boolean | undefined { + return this._objRef?.useWorldUnits; + } + @Input() + public set dashOffset(value: number) { + if (this._objRef) { + this._objRef.dashOffset = value; + } + } + + public get dashOffset(): number | undefined { + return this._objRef?.dashOffset; + } + @Input() + public set lineWidth(value: number) { + if (this._objRef) { + this._objRef.lineWidth = value; + } + } + + public get lineWidth(): number | undefined { + return this._objRef?.lineWidth; + } + @Input() + public set lineColorNode(value: Node | null) { + if (this._objRef) { + this._objRef.lineColorNode = value; + } + } + + public get lineColorNode(): (Node | null) | undefined { + return this._objRef?.lineColorNode; + } + @Input() + public set offsetNode(value: Node | null) { + if (this._objRef) { + this._objRef.offsetNode = value; + } + } + + public get offsetNode(): (Node | null) | undefined { + return this._objRef?.offsetNode; + } + @Input() + public set dashScaleNode(value: Node | null) { + if (this._objRef) { + this._objRef.dashScaleNode = value; + } + } + + public get dashScaleNode(): (Node | null) | undefined { + return this._objRef?.dashScaleNode; + } + @Input() + public set dashSizeNode(value: Node | null) { + if (this._objRef) { + this._objRef.dashSizeNode = value; + } + } + + public get dashSizeNode(): (Node | null) | undefined { + return this._objRef?.dashSizeNode; + } + @Input() + public set gapSizeNode(value: Node | null) { + if (this._objRef) { + this._objRef.gapSizeNode = value; + } + } + + public get gapSizeNode(): (Node | null) | undefined { + return this._objRef?.gapSizeNode; + } + public get worldUnits(): boolean | undefined { + return this._objRef?.worldUnits; + } + @Input() + public set worldUnits(value: boolean) { + if (this._objRef) { + this._objRef.worldUnits = value; + } + } + + public get dashed(): boolean | undefined { + return this._objRef?.dashed; + } + @Input() + public set dashed(value: boolean) { + if (this._objRef) { + this._objRef.dashed = value; + } + } +} diff --git a/projects/ngx-three/src/lib/generated/ThLineBasicNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThLineBasicNodeMaterial.ts new file mode 100644 index 00000000..e6c130d7 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThLineBasicNodeMaterial.ts @@ -0,0 +1,115 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + LineBasicNodeMaterial, + LineBasicNodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-lineBasicNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThLineBasicNodeMaterial), + }, + ], +}) +export class ThLineBasicNodeMaterial< + T extends LineBasicNodeMaterial = LineBasicNodeMaterial, + TARGS = /* parameters? */ LineBasicNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return LineBasicNodeMaterial; + } + + public get isLineBasicNodeMaterial(): true | undefined { + return this._objRef?.isLineBasicNodeMaterial; + } + public get isLineBasicMaterial(): true | undefined { + return this._objRef?.isLineBasicMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } + @Input() + public set linewidth(value: number) { + if (this._objRef) { + this._objRef.linewidth = value; + } + } + + public get linewidth(): number | undefined { + return this._objRef?.linewidth; + } + @Input() + public set linecap(value: string) { + if (this._objRef) { + this._objRef.linecap = value; + } + } + + public get linecap(): string | undefined { + return this._objRef?.linecap; + } + @Input() + public set linejoin(value: string) { + if (this._objRef) { + this._objRef.linejoin = value; + } + } + + public get linejoin(): string | undefined { + return this._objRef?.linejoin; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThLineDashedNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThLineDashedNodeMaterial.ts new file mode 100644 index 00000000..42412bc7 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThLineDashedNodeMaterial.ts @@ -0,0 +1,123 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { LineDashedMaterialParameters } from 'three/src/materials/LineDashedMaterial.js'; +import Node from 'three/src/nodes/core/Node.js'; +import { LineDashedNodeMaterial } from 'three/webgpu'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-lineDashedNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThLineDashedNodeMaterial), + }, + ], +}) +export class ThLineDashedNodeMaterial< + T extends LineDashedNodeMaterial = LineDashedNodeMaterial, + TARGS = /* parameters? */ LineDashedMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return LineDashedNodeMaterial; + } + + public get isLineDashedNodeMaterial(): true | undefined { + return this._objRef?.isLineDashedNodeMaterial; + } + @Input() + public set dashOffset(value: number) { + if (this._objRef) { + this._objRef.dashOffset = value; + } + } + + public get dashOffset(): number | undefined { + return this._objRef?.dashOffset; + } + @Input() + public set offsetNode(value: Node | null) { + if (this._objRef) { + this._objRef.offsetNode = value; + } + } + + public get offsetNode(): (Node | null) | undefined { + return this._objRef?.offsetNode; + } + @Input() + public set dashScaleNode(value: Node | null) { + if (this._objRef) { + this._objRef.dashScaleNode = value; + } + } + + public get dashScaleNode(): (Node | null) | undefined { + return this._objRef?.dashScaleNode; + } + @Input() + public set dashSizeNode(value: Node | null) { + if (this._objRef) { + this._objRef.dashSizeNode = value; + } + } + + public get dashSizeNode(): (Node | null) | undefined { + return this._objRef?.dashSizeNode; + } + @Input() + public set gapSizeNode(value: Node | null) { + if (this._objRef) { + this._objRef.gapSizeNode = value; + } + } + + public get gapSizeNode(): (Node | null) | undefined { + return this._objRef?.gapSizeNode; + } + public get isLineDashedMaterial(): true | undefined { + return this._objRef?.isLineDashedMaterial; + } + @Input() + public set scale(value: number) { + if (this._objRef) { + this._objRef.scale = value; + } + } + + public get scale(): number | undefined { + return this._objRef?.scale; + } + @Input() + public set dashSize(value: number) { + if (this._objRef) { + this._objRef.dashSize = value; + } + } + + public get dashSize(): number | undefined { + return this._objRef?.dashSize; + } + @Input() + public set gapSize(value: number) { + if (this._objRef) { + this._objRef.gapSize = value; + } + } + + public get gapSize(): number | undefined { + return this._objRef?.gapSize; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshBasicNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshBasicNodeMaterial.ts new file mode 100644 index 00000000..1683fab9 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshBasicNodeMaterial.ts @@ -0,0 +1,242 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { Combine } from 'three/src/constants.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + Euler, + EulerOrder, + MeshBasicNodeMaterial, + MeshBasicNodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshBasicNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshBasicNodeMaterial), + }, + ], +}) +export class ThMeshBasicNodeMaterial< + T extends MeshBasicNodeMaterial = MeshBasicNodeMaterial, + TARGS = /* parameters? */ MeshBasicNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshBasicNodeMaterial; + } + + public get isMeshBasicNodeMaterial(): true | undefined { + return this._objRef?.isMeshBasicNodeMaterial; + } + public get isMeshBasicMaterial(): true | undefined { + return this._objRef?.isMeshBasicMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set lightMap(value: Texture | null) { + if (this._objRef) { + this._objRef.lightMap = value; + } + } + + public get lightMap(): (Texture | null) | undefined { + return this._objRef?.lightMap; + } + @Input() + public set lightMapIntensity(value: number) { + if (this._objRef) { + this._objRef.lightMapIntensity = value; + } + } + + public get lightMapIntensity(): number | undefined { + return this._objRef?.lightMapIntensity; + } + @Input() + public set aoMap(value: Texture | null) { + if (this._objRef) { + this._objRef.aoMap = value; + } + } + + public get aoMap(): (Texture | null) | undefined { + return this._objRef?.aoMap; + } + @Input() + public set aoMapIntensity(value: number) { + if (this._objRef) { + this._objRef.aoMapIntensity = value; + } + } + + public get aoMapIntensity(): number | undefined { + return this._objRef?.aoMapIntensity; + } + @Input() + public set specularMap(value: Texture | null) { + if (this._objRef) { + this._objRef.specularMap = value; + } + } + + public get specularMap(): (Texture | null) | undefined { + return this._objRef?.specularMap; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set envMap(value: Texture | null) { + if (this._objRef) { + this._objRef.envMap = value; + } + } + + public get envMap(): (Texture | null) | undefined { + return this._objRef?.envMap; + } + @Input() + public set envMapRotation( + value: Euler | [x: number, y: number, z: number, order?: EulerOrder], + ) { + if (this._objRef) { + this._objRef.envMapRotation = applyValue( + this._objRef.envMapRotation, + value, + ); + } + } + public get envMapRotation(): Euler | undefined { + return this._objRef?.envMapRotation; + } + @Input() + public set combine(value: Combine) { + if (this._objRef) { + this._objRef.combine = value; + } + } + + public get combine(): Combine | undefined { + return this._objRef?.combine; + } + @Input() + public set reflectivity(value: number) { + if (this._objRef) { + this._objRef.reflectivity = value; + } + } + + public get reflectivity(): number | undefined { + return this._objRef?.reflectivity; + } + @Input() + public set refractionRatio(value: number) { + if (this._objRef) { + this._objRef.refractionRatio = value; + } + } + + public get refractionRatio(): number | undefined { + return this._objRef?.refractionRatio; + } + @Input() + public set wireframe(value: boolean) { + if (this._objRef) { + this._objRef.wireframe = value; + } + } + + public get wireframe(): boolean | undefined { + return this._objRef?.wireframe; + } + @Input() + public set wireframeLinewidth(value: number) { + if (this._objRef) { + this._objRef.wireframeLinewidth = value; + } + } + + public get wireframeLinewidth(): number | undefined { + return this._objRef?.wireframeLinewidth; + } + @Input() + public set wireframeLinecap(value: string) { + if (this._objRef) { + this._objRef.wireframeLinecap = value; + } + } + + public get wireframeLinecap(): string | undefined { + return this._objRef?.wireframeLinecap; + } + @Input() + public set wireframeLinejoin(value: string) { + if (this._objRef) { + this._objRef.wireframeLinejoin = value; + } + } + + public get wireframeLinejoin(): string | undefined { + return this._objRef?.wireframeLinejoin; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshLambertNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshLambertNodeMaterial.ts new file mode 100644 index 00000000..9bcb8683 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshLambertNodeMaterial.ts @@ -0,0 +1,362 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { Combine, NormalMapTypes } from 'three/src/constants.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + Euler, + EulerOrder, + MeshLambertNodeMaterial, + MeshLambertNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshLambertNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshLambertNodeMaterial), + }, + ], +}) +export class ThMeshLambertNodeMaterial< + T extends MeshLambertNodeMaterial = MeshLambertNodeMaterial, + TARGS = /* parameters? */ MeshLambertNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshLambertNodeMaterial; + } + + public get isMeshLambertNodeMaterial(): true | undefined { + return this._objRef?.isMeshLambertNodeMaterial; + } + public get isMeshLambertMaterial(): true | undefined { + return this._objRef?.isMeshLambertMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set bumpMap(value: Texture | null) { + if (this._objRef) { + this._objRef.bumpMap = value; + } + } + + public get bumpMap(): (Texture | null) | undefined { + return this._objRef?.bumpMap; + } + @Input() + public set bumpScale(value: number) { + if (this._objRef) { + this._objRef.bumpScale = value; + } + } + + public get bumpScale(): number | undefined { + return this._objRef?.bumpScale; + } + @Input() + public set displacementMap(value: Texture | null) { + if (this._objRef) { + this._objRef.displacementMap = value; + } + } + + public get displacementMap(): (Texture | null) | undefined { + return this._objRef?.displacementMap; + } + @Input() + public set displacementScale(value: number) { + if (this._objRef) { + this._objRef.displacementScale = value; + } + } + + public get displacementScale(): number | undefined { + return this._objRef?.displacementScale; + } + @Input() + public set displacementBias(value: number) { + if (this._objRef) { + this._objRef.displacementBias = value; + } + } + + public get displacementBias(): number | undefined { + return this._objRef?.displacementBias; + } + @Input() + public set emissive( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.emissive = applyValue(this._objRef.emissive, value); + } + } + public get emissive(): Color | undefined { + return this._objRef?.emissive; + } + @Input() + public set emissiveIntensity(value: number) { + if (this._objRef) { + this._objRef.emissiveIntensity = value; + } + } + + public get emissiveIntensity(): number | undefined { + return this._objRef?.emissiveIntensity; + } + @Input() + public set emissiveMap(value: Texture | null) { + if (this._objRef) { + this._objRef.emissiveMap = value; + } + } + + public get emissiveMap(): (Texture | null) | undefined { + return this._objRef?.emissiveMap; + } + @Input() + public set flatShading(value: boolean) { + if (this._objRef) { + this._objRef.flatShading = value; + } + } + + public get flatShading(): boolean | undefined { + return this._objRef?.flatShading; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set lightMap(value: Texture | null) { + if (this._objRef) { + this._objRef.lightMap = value; + } + } + + public get lightMap(): (Texture | null) | undefined { + return this._objRef?.lightMap; + } + @Input() + public set lightMapIntensity(value: number) { + if (this._objRef) { + this._objRef.lightMapIntensity = value; + } + } + + public get lightMapIntensity(): number | undefined { + return this._objRef?.lightMapIntensity; + } + @Input() + public set normalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.normalMap = value; + } + } + + public get normalMap(): (Texture | null) | undefined { + return this._objRef?.normalMap; + } + @Input() + public set normalMapType(value: NormalMapTypes) { + if (this._objRef) { + this._objRef.normalMapType = value; + } + } + + public get normalMapType(): NormalMapTypes | undefined { + return this._objRef?.normalMapType; + } + @Input() + public set normalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.normalScale = applyValue( + this._objRef.normalScale, + value, + ); + } + } + public get normalScale(): Vector2 | undefined { + return this._objRef?.normalScale; + } + @Input() + public set aoMap(value: Texture | null) { + if (this._objRef) { + this._objRef.aoMap = value; + } + } + + public get aoMap(): (Texture | null) | undefined { + return this._objRef?.aoMap; + } + @Input() + public set aoMapIntensity(value: number) { + if (this._objRef) { + this._objRef.aoMapIntensity = value; + } + } + + public get aoMapIntensity(): number | undefined { + return this._objRef?.aoMapIntensity; + } + @Input() + public set specularMap(value: Texture | null) { + if (this._objRef) { + this._objRef.specularMap = value; + } + } + + public get specularMap(): (Texture | null) | undefined { + return this._objRef?.specularMap; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set envMap(value: Texture | null) { + if (this._objRef) { + this._objRef.envMap = value; + } + } + + public get envMap(): (Texture | null) | undefined { + return this._objRef?.envMap; + } + @Input() + public set envMapRotation( + value: Euler | [x: number, y: number, z: number, order?: EulerOrder], + ) { + if (this._objRef) { + this._objRef.envMapRotation = applyValue( + this._objRef.envMapRotation, + value, + ); + } + } + public get envMapRotation(): Euler | undefined { + return this._objRef?.envMapRotation; + } + @Input() + public set combine(value: Combine) { + if (this._objRef) { + this._objRef.combine = value; + } + } + + public get combine(): Combine | undefined { + return this._objRef?.combine; + } + @Input() + public set reflectivity(value: number) { + if (this._objRef) { + this._objRef.reflectivity = value; + } + } + + public get reflectivity(): number | undefined { + return this._objRef?.reflectivity; + } + @Input() + public set refractionRatio(value: number) { + if (this._objRef) { + this._objRef.refractionRatio = value; + } + } + + public get refractionRatio(): number | undefined { + return this._objRef?.refractionRatio; + } + @Input() + public set wireframe(value: boolean) { + if (this._objRef) { + this._objRef.wireframe = value; + } + } + + public get wireframe(): boolean | undefined { + return this._objRef?.wireframe; + } + @Input() + public set wireframeLinewidth(value: number) { + if (this._objRef) { + this._objRef.wireframeLinewidth = value; + } + } + + public get wireframeLinewidth(): number | undefined { + return this._objRef?.wireframeLinewidth; + } + @Input() + public set wireframeLinecap(value: string) { + if (this._objRef) { + this._objRef.wireframeLinecap = value; + } + } + + public get wireframeLinecap(): string | undefined { + return this._objRef?.wireframeLinecap; + } + @Input() + public set wireframeLinejoin(value: string) { + if (this._objRef) { + this._objRef.wireframeLinejoin = value; + } + } + + public get wireframeLinejoin(): string | undefined { + return this._objRef?.wireframeLinejoin; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshMatcapNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshMatcapNodeMaterial.ts new file mode 100644 index 00000000..280d494c --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshMatcapNodeMaterial.ts @@ -0,0 +1,199 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { NormalMapTypes } from 'three/src/constants.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + MeshMatcapNodeMaterial, + MeshMatcapNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshMatcapNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshMatcapNodeMaterial), + }, + ], +}) +export class ThMeshMatcapNodeMaterial< + T extends MeshMatcapNodeMaterial = MeshMatcapNodeMaterial, + TARGS = /* parameters? */ MeshMatcapNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshMatcapNodeMaterial; + } + + public get isMeshMatcapNodeMaterial(): true | undefined { + return this._objRef?.isMeshMatcapNodeMaterial; + } + public get isMeshMatcapMaterial(): true | undefined { + return this._objRef?.isMeshMatcapMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set matcap(value: Texture | null) { + if (this._objRef) { + this._objRef.matcap = value; + } + } + + public get matcap(): (Texture | null) | undefined { + return this._objRef?.matcap; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set bumpMap(value: Texture | null) { + if (this._objRef) { + this._objRef.bumpMap = value; + } + } + + public get bumpMap(): (Texture | null) | undefined { + return this._objRef?.bumpMap; + } + @Input() + public set bumpScale(value: number) { + if (this._objRef) { + this._objRef.bumpScale = value; + } + } + + public get bumpScale(): number | undefined { + return this._objRef?.bumpScale; + } + @Input() + public set normalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.normalMap = value; + } + } + + public get normalMap(): (Texture | null) | undefined { + return this._objRef?.normalMap; + } + @Input() + public set normalMapType(value: NormalMapTypes) { + if (this._objRef) { + this._objRef.normalMapType = value; + } + } + + public get normalMapType(): NormalMapTypes | undefined { + return this._objRef?.normalMapType; + } + @Input() + public set normalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.normalScale = applyValue( + this._objRef.normalScale, + value, + ); + } + } + public get normalScale(): Vector2 | undefined { + return this._objRef?.normalScale; + } + @Input() + public set displacementMap(value: Texture | null) { + if (this._objRef) { + this._objRef.displacementMap = value; + } + } + + public get displacementMap(): (Texture | null) | undefined { + return this._objRef?.displacementMap; + } + @Input() + public set displacementScale(value: number) { + if (this._objRef) { + this._objRef.displacementScale = value; + } + } + + public get displacementScale(): number | undefined { + return this._objRef?.displacementScale; + } + @Input() + public set displacementBias(value: number) { + if (this._objRef) { + this._objRef.displacementBias = value; + } + } + + public get displacementBias(): number | undefined { + return this._objRef?.displacementBias; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set flatShading(value: boolean) { + if (this._objRef) { + this._objRef.flatShading = value; + } + } + + public get flatShading(): boolean | undefined { + return this._objRef?.flatShading; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshNormalNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshNormalNodeMaterial.ts new file mode 100644 index 00000000..30d06f38 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshNormalNodeMaterial.ts @@ -0,0 +1,160 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { NormalMapTypes } from 'three/src/constants.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + MeshNormalNodeMaterial, + MeshNormalNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshNormalNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshNormalNodeMaterial), + }, + ], +}) +export class ThMeshNormalNodeMaterial< + T extends MeshNormalNodeMaterial = MeshNormalNodeMaterial, + TARGS = /* parameters? */ MeshNormalNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshNormalNodeMaterial; + } + + public get isMeshNormalNodeMaterial(): true | undefined { + return this._objRef?.isMeshNormalNodeMaterial; + } + public get isMeshNormalMaterial(): true | undefined { + return this._objRef?.isMeshNormalMaterial; + } + @Input() + public set bumpMap(value: Texture | null) { + if (this._objRef) { + this._objRef.bumpMap = value; + } + } + + public get bumpMap(): (Texture | null) | undefined { + return this._objRef?.bumpMap; + } + @Input() + public set bumpScale(value: number) { + if (this._objRef) { + this._objRef.bumpScale = value; + } + } + + public get bumpScale(): number | undefined { + return this._objRef?.bumpScale; + } + @Input() + public set normalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.normalMap = value; + } + } + + public get normalMap(): (Texture | null) | undefined { + return this._objRef?.normalMap; + } + @Input() + public set normalMapType(value: NormalMapTypes) { + if (this._objRef) { + this._objRef.normalMapType = value; + } + } + + public get normalMapType(): NormalMapTypes | undefined { + return this._objRef?.normalMapType; + } + @Input() + public set normalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.normalScale = applyValue( + this._objRef.normalScale, + value, + ); + } + } + public get normalScale(): Vector2 | undefined { + return this._objRef?.normalScale; + } + @Input() + public set displacementMap(value: Texture | null) { + if (this._objRef) { + this._objRef.displacementMap = value; + } + } + + public get displacementMap(): (Texture | null) | undefined { + return this._objRef?.displacementMap; + } + @Input() + public set displacementScale(value: number) { + if (this._objRef) { + this._objRef.displacementScale = value; + } + } + + public get displacementScale(): number | undefined { + return this._objRef?.displacementScale; + } + @Input() + public set displacementBias(value: number) { + if (this._objRef) { + this._objRef.displacementBias = value; + } + } + + public get displacementBias(): number | undefined { + return this._objRef?.displacementBias; + } + @Input() + public set wireframe(value: boolean) { + if (this._objRef) { + this._objRef.wireframe = value; + } + } + + public get wireframe(): boolean | undefined { + return this._objRef?.wireframe; + } + @Input() + public set wireframeLinewidth(value: number) { + if (this._objRef) { + this._objRef.wireframeLinewidth = value; + } + } + + public get wireframeLinewidth(): number | undefined { + return this._objRef?.wireframeLinewidth; + } + @Input() + public set flatShading(value: boolean) { + if (this._objRef) { + this._objRef.flatShading = value; + } + } + + public get flatShading(): boolean | undefined { + return this._objRef?.flatShading; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshPhongNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshPhongNodeMaterial.ts new file mode 100644 index 00000000..74879496 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshPhongNodeMaterial.ts @@ -0,0 +1,430 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { Combine, NormalMapTypes } from 'three/src/constants.js'; +import Node from 'three/src/nodes/core/Node.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + Euler, + EulerOrder, + MeshPhongNodeMaterial, + MeshPhongNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshPhongNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshPhongNodeMaterial), + }, + ], +}) +export class ThMeshPhongNodeMaterial< + T extends MeshPhongNodeMaterial = MeshPhongNodeMaterial, + TARGS = /* parameters? */ MeshPhongNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshPhongNodeMaterial; + } + + public get isMeshPhongNodeMaterial(): true | undefined { + return this._objRef?.isMeshPhongNodeMaterial; + } + @Input() + public set shininessNode(value: Node | null) { + if (this._objRef) { + this._objRef.shininessNode = value; + } + } + + public get shininessNode(): (Node | null) | undefined { + return this._objRef?.shininessNode; + } + @Input() + public set specularNode(value: Node | null) { + if (this._objRef) { + this._objRef.specularNode = value; + } + } + + public get specularNode(): (Node | null) | undefined { + return this._objRef?.specularNode; + } + public get isMeshPhongMaterial(): true | undefined { + return this._objRef?.isMeshPhongMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set specular( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.specular = applyValue(this._objRef.specular, value); + } + } + public get specular(): Color | undefined { + return this._objRef?.specular; + } + @Input() + public set shininess(value: number) { + if (this._objRef) { + this._objRef.shininess = value; + } + } + + public get shininess(): number | undefined { + return this._objRef?.shininess; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set lightMap(value: Texture | null) { + if (this._objRef) { + this._objRef.lightMap = value; + } + } + + public get lightMap(): (Texture | null) | undefined { + return this._objRef?.lightMap; + } + @Input() + public set lightMapIntensity(value: number) { + if (this._objRef) { + this._objRef.lightMapIntensity = value; + } + } + + public get lightMapIntensity(): number | undefined { + return this._objRef?.lightMapIntensity; + } + @Input() + public set aoMap(value: Texture | null) { + if (this._objRef) { + this._objRef.aoMap = value; + } + } + + public get aoMap(): (Texture | null) | undefined { + return this._objRef?.aoMap; + } + @Input() + public set aoMapIntensity(value: number) { + if (this._objRef) { + this._objRef.aoMapIntensity = value; + } + } + + public get aoMapIntensity(): number | undefined { + return this._objRef?.aoMapIntensity; + } + @Input() + public set emissive( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.emissive = applyValue(this._objRef.emissive, value); + } + } + public get emissive(): Color | undefined { + return this._objRef?.emissive; + } + @Input() + public set emissiveIntensity(value: number) { + if (this._objRef) { + this._objRef.emissiveIntensity = value; + } + } + + public get emissiveIntensity(): number | undefined { + return this._objRef?.emissiveIntensity; + } + @Input() + public set emissiveMap(value: Texture | null) { + if (this._objRef) { + this._objRef.emissiveMap = value; + } + } + + public get emissiveMap(): (Texture | null) | undefined { + return this._objRef?.emissiveMap; + } + @Input() + public set bumpMap(value: Texture | null) { + if (this._objRef) { + this._objRef.bumpMap = value; + } + } + + public get bumpMap(): (Texture | null) | undefined { + return this._objRef?.bumpMap; + } + @Input() + public set bumpScale(value: number) { + if (this._objRef) { + this._objRef.bumpScale = value; + } + } + + public get bumpScale(): number | undefined { + return this._objRef?.bumpScale; + } + @Input() + public set normalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.normalMap = value; + } + } + + public get normalMap(): (Texture | null) | undefined { + return this._objRef?.normalMap; + } + @Input() + public set normalMapType(value: NormalMapTypes) { + if (this._objRef) { + this._objRef.normalMapType = value; + } + } + + public get normalMapType(): NormalMapTypes | undefined { + return this._objRef?.normalMapType; + } + @Input() + public set normalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.normalScale = applyValue( + this._objRef.normalScale, + value, + ); + } + } + public get normalScale(): Vector2 | undefined { + return this._objRef?.normalScale; + } + @Input() + public set displacementMap(value: Texture | null) { + if (this._objRef) { + this._objRef.displacementMap = value; + } + } + + public get displacementMap(): (Texture | null) | undefined { + return this._objRef?.displacementMap; + } + @Input() + public set displacementScale(value: number) { + if (this._objRef) { + this._objRef.displacementScale = value; + } + } + + public get displacementScale(): number | undefined { + return this._objRef?.displacementScale; + } + @Input() + public set displacementBias(value: number) { + if (this._objRef) { + this._objRef.displacementBias = value; + } + } + + public get displacementBias(): number | undefined { + return this._objRef?.displacementBias; + } + @Input() + public set specularMap(value: Texture | null) { + if (this._objRef) { + this._objRef.specularMap = value; + } + } + + public get specularMap(): (Texture | null) | undefined { + return this._objRef?.specularMap; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set envMap(value: Texture | null) { + if (this._objRef) { + this._objRef.envMap = value; + } + } + + public get envMap(): (Texture | null) | undefined { + return this._objRef?.envMap; + } + @Input() + public set envMapRotation( + value: Euler | [x: number, y: number, z: number, order?: EulerOrder], + ) { + if (this._objRef) { + this._objRef.envMapRotation = applyValue( + this._objRef.envMapRotation, + value, + ); + } + } + public get envMapRotation(): Euler | undefined { + return this._objRef?.envMapRotation; + } + @Input() + public set combine(value: Combine) { + if (this._objRef) { + this._objRef.combine = value; + } + } + + public get combine(): Combine | undefined { + return this._objRef?.combine; + } + @Input() + public set reflectivity(value: number) { + if (this._objRef) { + this._objRef.reflectivity = value; + } + } + + public get reflectivity(): number | undefined { + return this._objRef?.reflectivity; + } + @Input() + public set refractionRatio(value: number) { + if (this._objRef) { + this._objRef.refractionRatio = value; + } + } + + public get refractionRatio(): number | undefined { + return this._objRef?.refractionRatio; + } + @Input() + public set wireframe(value: boolean) { + if (this._objRef) { + this._objRef.wireframe = value; + } + } + + public get wireframe(): boolean | undefined { + return this._objRef?.wireframe; + } + @Input() + public set wireframeLinewidth(value: number) { + if (this._objRef) { + this._objRef.wireframeLinewidth = value; + } + } + + public get wireframeLinewidth(): number | undefined { + return this._objRef?.wireframeLinewidth; + } + @Input() + public set wireframeLinecap(value: string) { + if (this._objRef) { + this._objRef.wireframeLinecap = value; + } + } + + public get wireframeLinecap(): string | undefined { + return this._objRef?.wireframeLinecap; + } + @Input() + public set wireframeLinejoin(value: string) { + if (this._objRef) { + this._objRef.wireframeLinejoin = value; + } + } + + public get wireframeLinejoin(): string | undefined { + return this._objRef?.wireframeLinejoin; + } + @Input() + public set flatShading(value: boolean) { + if (this._objRef) { + this._objRef.flatShading = value; + } + } + + public get flatShading(): boolean | undefined { + return this._objRef?.flatShading; + } + @Input() + public set metal(value: boolean) { + if (this._objRef) { + this._objRef.metal = value; + } + } + + public get metal(): boolean | undefined { + return this._objRef?.metal; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshPhysicalNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshPhysicalNodeMaterial.ts new file mode 100644 index 00000000..6151e61e --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshPhysicalNodeMaterial.ts @@ -0,0 +1,590 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import Node from 'three/src/nodes/core/Node.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + MeshPhysicalNodeMaterial, + MeshPhysicalNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThMeshStandardNodeMaterial } from './ThMeshStandardNodeMaterial'; + +@Component({ + selector: 'th-meshPhysicalNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshPhysicalNodeMaterial), + }, + ], +}) +export class ThMeshPhysicalNodeMaterial< + T extends MeshPhysicalNodeMaterial = MeshPhysicalNodeMaterial, + TARGS = /* parameters? */ MeshPhysicalNodeMaterialParameters, +> extends ThMeshStandardNodeMaterial { + public getType(): Type { + return MeshPhysicalNodeMaterial; + } + + public get isMeshPhysicalNodeMaterial(): true | undefined { + return this._objRef?.isMeshPhysicalNodeMaterial; + } + @Input() + public set clearcoatNode(value: Node | null) { + if (this._objRef) { + this._objRef.clearcoatNode = value; + } + } + + public get clearcoatNode(): (Node | null) | undefined { + return this._objRef?.clearcoatNode; + } + @Input() + public set clearcoatRoughnessNode(value: Node | null) { + if (this._objRef) { + this._objRef.clearcoatRoughnessNode = value; + } + } + + public get clearcoatRoughnessNode(): (Node | null) | undefined { + return this._objRef?.clearcoatRoughnessNode; + } + @Input() + public set clearcoatNormalNode(value: Node | null) { + if (this._objRef) { + this._objRef.clearcoatNormalNode = value; + } + } + + public get clearcoatNormalNode(): (Node | null) | undefined { + return this._objRef?.clearcoatNormalNode; + } + @Input() + public set sheenNode(value: Node | null) { + if (this._objRef) { + this._objRef.sheenNode = value; + } + } + + public get sheenNode(): (Node | null) | undefined { + return this._objRef?.sheenNode; + } + @Input() + public set sheenRoughnessNode(value: Node | null) { + if (this._objRef) { + this._objRef.sheenRoughnessNode = value; + } + } + + public get sheenRoughnessNode(): (Node | null) | undefined { + return this._objRef?.sheenRoughnessNode; + } + @Input() + public set iridescenceNode(value: Node | null) { + if (this._objRef) { + this._objRef.iridescenceNode = value; + } + } + + public get iridescenceNode(): (Node | null) | undefined { + return this._objRef?.iridescenceNode; + } + @Input() + public set iridescenceIORNode(value: Node | null) { + if (this._objRef) { + this._objRef.iridescenceIORNode = value; + } + } + + public get iridescenceIORNode(): (Node | null) | undefined { + return this._objRef?.iridescenceIORNode; + } + @Input() + public set iridescenceThicknessNode(value: Node | null) { + if (this._objRef) { + this._objRef.iridescenceThicknessNode = value; + } + } + + public get iridescenceThicknessNode(): (Node | null) | undefined { + return this._objRef?.iridescenceThicknessNode; + } + @Input() + public set iorNode(value: Node | null) { + if (this._objRef) { + this._objRef.iorNode = value; + } + } + + public get iorNode(): (Node | null) | undefined { + return this._objRef?.iorNode; + } + @Input() + public set specularIntensityNode(value: Node | null) { + if (this._objRef) { + this._objRef.specularIntensityNode = value; + } + } + + public get specularIntensityNode(): (Node | null) | undefined { + return this._objRef?.specularIntensityNode; + } + @Input() + public set specularColorNode(value: Node | null) { + if (this._objRef) { + this._objRef.specularColorNode = value; + } + } + + public get specularColorNode(): (Node | null) | undefined { + return this._objRef?.specularColorNode; + } + @Input() + public set transmissionNode(value: Node | null) { + if (this._objRef) { + this._objRef.transmissionNode = value; + } + } + + public get transmissionNode(): (Node | null) | undefined { + return this._objRef?.transmissionNode; + } + @Input() + public set thicknessNode(value: Node | null) { + if (this._objRef) { + this._objRef.thicknessNode = value; + } + } + + public get thicknessNode(): (Node | null) | undefined { + return this._objRef?.thicknessNode; + } + @Input() + public set attenuationDistanceNode(value: Node | null) { + if (this._objRef) { + this._objRef.attenuationDistanceNode = value; + } + } + + public get attenuationDistanceNode(): (Node | null) | undefined { + return this._objRef?.attenuationDistanceNode; + } + @Input() + public set attenuationColorNode(value: Node | null) { + if (this._objRef) { + this._objRef.attenuationColorNode = value; + } + } + + public get attenuationColorNode(): (Node | null) | undefined { + return this._objRef?.attenuationColorNode; + } + @Input() + public set dispersionNode(value: Node | null) { + if (this._objRef) { + this._objRef.dispersionNode = value; + } + } + + public get dispersionNode(): (Node | null) | undefined { + return this._objRef?.dispersionNode; + } + @Input() + public set anisotropyNode(value: Node | null) { + if (this._objRef) { + this._objRef.anisotropyNode = value; + } + } + + public get anisotropyNode(): (Node | null) | undefined { + return this._objRef?.anisotropyNode; + } + public get isMeshPhysicalMaterial(): true | undefined { + return this._objRef?.isMeshPhysicalMaterial; + } + @Input() + public set anisotropyRotation(value: number) { + if (this._objRef) { + this._objRef.anisotropyRotation = value; + } + } + + public get anisotropyRotation(): number | undefined { + return this._objRef?.anisotropyRotation; + } + @Input() + public set anisotropyMap(value: Texture | null) { + if (this._objRef) { + this._objRef.anisotropyMap = value; + } + } + + public get anisotropyMap(): (Texture | null) | undefined { + return this._objRef?.anisotropyMap; + } + @Input() + public set clearcoatMap(value: Texture | null) { + if (this._objRef) { + this._objRef.clearcoatMap = value; + } + } + + public get clearcoatMap(): (Texture | null) | undefined { + return this._objRef?.clearcoatMap; + } + @Input() + public set clearcoatRoughness(value: number) { + if (this._objRef) { + this._objRef.clearcoatRoughness = value; + } + } + + public get clearcoatRoughness(): number | undefined { + return this._objRef?.clearcoatRoughness; + } + @Input() + public set clearcoatRoughnessMap(value: Texture | null) { + if (this._objRef) { + this._objRef.clearcoatRoughnessMap = value; + } + } + + public get clearcoatRoughnessMap(): (Texture | null) | undefined { + return this._objRef?.clearcoatRoughnessMap; + } + @Input() + public set clearcoatNormalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.clearcoatNormalScale = applyValue( + this._objRef.clearcoatNormalScale, + value, + ); + } + } + public get clearcoatNormalScale(): Vector2 | undefined { + return this._objRef?.clearcoatNormalScale; + } + @Input() + public set clearcoatNormalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.clearcoatNormalMap = value; + } + } + + public get clearcoatNormalMap(): (Texture | null) | undefined { + return this._objRef?.clearcoatNormalMap; + } + @Input() + public set ior(value: number) { + if (this._objRef) { + this._objRef.ior = value; + } + } + + public get ior(): number | undefined { + return this._objRef?.ior; + } + public get reflectivity(): number | undefined { + return this._objRef?.reflectivity; + } + @Input() + public set reflectivity(value: number) { + if (this._objRef) { + this._objRef.reflectivity = value; + } + } + + @Input() + public set iridescenceMap(value: Texture | null) { + if (this._objRef) { + this._objRef.iridescenceMap = value; + } + } + + public get iridescenceMap(): (Texture | null) | undefined { + return this._objRef?.iridescenceMap; + } + @Input() + public set iridescenceIOR(value: number) { + if (this._objRef) { + this._objRef.iridescenceIOR = value; + } + } + + public get iridescenceIOR(): number | undefined { + return this._objRef?.iridescenceIOR; + } + @Input() + public set iridescenceThicknessRange(value: [number, number]) { + if (this._objRef) { + this._objRef.iridescenceThicknessRange = value; + } + } + + public get iridescenceThicknessRange(): [number, number] | undefined { + return this._objRef?.iridescenceThicknessRange; + } + @Input() + public set iridescenceThicknessMap(value: Texture | null) { + if (this._objRef) { + this._objRef.iridescenceThicknessMap = value; + } + } + + public get iridescenceThicknessMap(): (Texture | null) | undefined { + return this._objRef?.iridescenceThicknessMap; + } + @Input() + public set sheenColor( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.sheenColor = applyValue( + this._objRef.sheenColor, + value, + ); + } + } + public get sheenColor(): Color | undefined { + return this._objRef?.sheenColor; + } + @Input() + public set sheenColorMap(value: Texture | null) { + if (this._objRef) { + this._objRef.sheenColorMap = value; + } + } + + public get sheenColorMap(): (Texture | null) | undefined { + return this._objRef?.sheenColorMap; + } + @Input() + public set sheenRoughness(value: number) { + if (this._objRef) { + this._objRef.sheenRoughness = value; + } + } + + public get sheenRoughness(): number | undefined { + return this._objRef?.sheenRoughness; + } + @Input() + public set sheenRoughnessMap(value: Texture | null) { + if (this._objRef) { + this._objRef.sheenRoughnessMap = value; + } + } + + public get sheenRoughnessMap(): (Texture | null) | undefined { + return this._objRef?.sheenRoughnessMap; + } + @Input() + public set transmissionMap(value: Texture | null) { + if (this._objRef) { + this._objRef.transmissionMap = value; + } + } + + public get transmissionMap(): (Texture | null) | undefined { + return this._objRef?.transmissionMap; + } + @Input() + public set thickness(value: number) { + if (this._objRef) { + this._objRef.thickness = value; + } + } + + public get thickness(): number | undefined { + return this._objRef?.thickness; + } + @Input() + public set thicknessMap(value: Texture | null) { + if (this._objRef) { + this._objRef.thicknessMap = value; + } + } + + public get thicknessMap(): (Texture | null) | undefined { + return this._objRef?.thicknessMap; + } + @Input() + public set attenuationDistance(value: number) { + if (this._objRef) { + this._objRef.attenuationDistance = value; + } + } + + public get attenuationDistance(): number | undefined { + return this._objRef?.attenuationDistance; + } + @Input() + public set attenuationColor( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.attenuationColor = applyValue( + this._objRef.attenuationColor, + value, + ); + } + } + public get attenuationColor(): Color | undefined { + return this._objRef?.attenuationColor; + } + @Input() + public set specularIntensity(value: number) { + if (this._objRef) { + this._objRef.specularIntensity = value; + } + } + + public get specularIntensity(): number | undefined { + return this._objRef?.specularIntensity; + } + @Input() + public set specularIntensityMap(value: Texture | null) { + if (this._objRef) { + this._objRef.specularIntensityMap = value; + } + } + + public get specularIntensityMap(): (Texture | null) | undefined { + return this._objRef?.specularIntensityMap; + } + @Input() + public set specularColor( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.specularColor = applyValue( + this._objRef.specularColor, + value, + ); + } + } + public get specularColor(): Color | undefined { + return this._objRef?.specularColor; + } + @Input() + public set specularColorMap(value: Texture | null) { + if (this._objRef) { + this._objRef.specularColorMap = value; + } + } + + public get specularColorMap(): (Texture | null) | undefined { + return this._objRef?.specularColorMap; + } + public get anisotropy(): number | undefined { + return this._objRef?.anisotropy; + } + @Input() + public set anisotropy(value: number) { + if (this._objRef) { + this._objRef.anisotropy = value; + } + } + + public get clearcoat(): number | undefined { + return this._objRef?.clearcoat; + } + @Input() + public set clearcoat(value: number) { + if (this._objRef) { + this._objRef.clearcoat = value; + } + } + + public get iridescence(): number | undefined { + return this._objRef?.iridescence; + } + @Input() + public set iridescence(value: number) { + if (this._objRef) { + this._objRef.iridescence = value; + } + } + + public get dispersion(): number | undefined { + return this._objRef?.dispersion; + } + @Input() + public set dispersion(value: number) { + if (this._objRef) { + this._objRef.dispersion = value; + } + } + + public get sheen(): number | undefined { + return this._objRef?.sheen; + } + @Input() + public set sheen(value: number) { + if (this._objRef) { + this._objRef.sheen = value; + } + } + + public get transmission(): number | undefined { + return this._objRef?.transmission; + } + @Input() + public set transmission(value: number) { + if (this._objRef) { + this._objRef.transmission = value; + } + } + + public get useClearcoat(): boolean | undefined { + return this._objRef?.useClearcoat; + } + public get useIridescence(): boolean | undefined { + return this._objRef?.useIridescence; + } + public get useSheen(): boolean | undefined { + return this._objRef?.useSheen; + } + public get useAnisotropy(): boolean | undefined { + return this._objRef?.useAnisotropy; + } + public get useTransmission(): boolean | undefined { + return this._objRef?.useTransmission; + } + public get useDispersion(): boolean | undefined { + return this._objRef?.useDispersion; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshSSSNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshSSSNodeMaterial.ts new file mode 100644 index 00000000..85344d97 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshSSSNodeMaterial.ts @@ -0,0 +1,101 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { MeshPhysicalNodeMaterialParameters } from 'three/src/materials/nodes/MeshPhysicalNodeMaterial.js'; +import ConstNode from 'three/src/nodes/core/ConstNode.js'; +import Node from 'three/src/nodes/core/Node.js'; +import { MeshSSSNodeMaterial } from 'three/webgpu'; +import { ThMaterial } from './ThMaterial'; +import { ThMeshPhysicalNodeMaterial } from './ThMeshPhysicalNodeMaterial'; + +@Component({ + selector: 'th-meshSSSNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshSSSNodeMaterial), + }, + ], +}) +export class ThMeshSSSNodeMaterial< + T extends MeshSSSNodeMaterial = MeshSSSNodeMaterial, + TARGS = /* parameters? */ MeshPhysicalNodeMaterialParameters, +> extends ThMeshPhysicalNodeMaterial { + public getType(): Type { + return MeshSSSNodeMaterial; + } + + @Input() + public set thicknessColorNode(value: Node | null) { + if (this._objRef) { + this._objRef.thicknessColorNode = value; + } + } + + public get thicknessColorNode(): (Node | null) | undefined { + return this._objRef?.thicknessColorNode; + } + @Input() + public set thicknessDistortionNode(value: ConstNode) { + if (this._objRef) { + this._objRef.thicknessDistortionNode = value; + } + } + + public get thicknessDistortionNode(): ConstNode | undefined { + return this._objRef?.thicknessDistortionNode; + } + @Input() + public set thicknessAmbientNode(value: ConstNode) { + if (this._objRef) { + this._objRef.thicknessAmbientNode = value; + } + } + + public get thicknessAmbientNode(): ConstNode | undefined { + return this._objRef?.thicknessAmbientNode; + } + @Input() + public set thicknessAttenuationNode(value: ConstNode) { + if (this._objRef) { + this._objRef.thicknessAttenuationNode = value; + } + } + + public get thicknessAttenuationNode(): ConstNode | undefined { + return this._objRef?.thicknessAttenuationNode; + } + @Input() + public set thicknessPowerNode(value: ConstNode) { + if (this._objRef) { + this._objRef.thicknessPowerNode = value; + } + } + + public get thicknessPowerNode(): ConstNode | undefined { + return this._objRef?.thicknessPowerNode; + } + @Input() + public set thicknessScaleNode(value: ConstNode) { + if (this._objRef) { + this._objRef.thicknessScaleNode = value; + } + } + + public get thicknessScaleNode(): ConstNode | undefined { + return this._objRef?.thicknessScaleNode; + } + public get useSSS(): boolean | undefined { + return this._objRef?.useSSS; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshStandardNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshStandardNodeMaterial.ts new file mode 100644 index 00000000..91e20092 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshStandardNodeMaterial.ts @@ -0,0 +1,413 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { NormalMapTypes } from 'three/src/constants.js'; +import Node from 'three/src/nodes/core/Node.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + Euler, + EulerOrder, + MeshStandardNodeMaterial, + MeshStandardNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshStandardNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshStandardNodeMaterial), + }, + ], +}) +export class ThMeshStandardNodeMaterial< + T extends MeshStandardNodeMaterial = MeshStandardNodeMaterial, + TARGS = /* parameters? */ MeshStandardNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshStandardNodeMaterial; + } + + public get isMeshStandardNodeMaterial(): true | undefined { + return this._objRef?.isMeshStandardNodeMaterial; + } + @Input() + public set emissiveNode(value: Node | null) { + if (this._objRef) { + this._objRef.emissiveNode = value; + } + } + + public get emissiveNode(): (Node | null) | undefined { + return this._objRef?.emissiveNode; + } + @Input() + public set metalnessNode(value: Node | null) { + if (this._objRef) { + this._objRef.metalnessNode = value; + } + } + + public get metalnessNode(): (Node | null) | undefined { + return this._objRef?.metalnessNode; + } + @Input() + public set roughnessNode(value: Node | null) { + if (this._objRef) { + this._objRef.roughnessNode = value; + } + } + + public get roughnessNode(): (Node | null) | undefined { + return this._objRef?.roughnessNode; + } + public get isMeshStandardMaterial(): true | undefined { + return this._objRef?.isMeshStandardMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set roughness(value: number) { + if (this._objRef) { + this._objRef.roughness = value; + } + } + + public get roughness(): number | undefined { + return this._objRef?.roughness; + } + @Input() + public set metalness(value: number) { + if (this._objRef) { + this._objRef.metalness = value; + } + } + + public get metalness(): number | undefined { + return this._objRef?.metalness; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set lightMap(value: Texture | null) { + if (this._objRef) { + this._objRef.lightMap = value; + } + } + + public get lightMap(): (Texture | null) | undefined { + return this._objRef?.lightMap; + } + @Input() + public set lightMapIntensity(value: number) { + if (this._objRef) { + this._objRef.lightMapIntensity = value; + } + } + + public get lightMapIntensity(): number | undefined { + return this._objRef?.lightMapIntensity; + } + @Input() + public set aoMap(value: Texture | null) { + if (this._objRef) { + this._objRef.aoMap = value; + } + } + + public get aoMap(): (Texture | null) | undefined { + return this._objRef?.aoMap; + } + @Input() + public set aoMapIntensity(value: number) { + if (this._objRef) { + this._objRef.aoMapIntensity = value; + } + } + + public get aoMapIntensity(): number | undefined { + return this._objRef?.aoMapIntensity; + } + @Input() + public set emissive( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.emissive = applyValue(this._objRef.emissive, value); + } + } + public get emissive(): Color | undefined { + return this._objRef?.emissive; + } + @Input() + public set emissiveIntensity(value: number) { + if (this._objRef) { + this._objRef.emissiveIntensity = value; + } + } + + public get emissiveIntensity(): number | undefined { + return this._objRef?.emissiveIntensity; + } + @Input() + public set emissiveMap(value: Texture | null) { + if (this._objRef) { + this._objRef.emissiveMap = value; + } + } + + public get emissiveMap(): (Texture | null) | undefined { + return this._objRef?.emissiveMap; + } + @Input() + public set bumpMap(value: Texture | null) { + if (this._objRef) { + this._objRef.bumpMap = value; + } + } + + public get bumpMap(): (Texture | null) | undefined { + return this._objRef?.bumpMap; + } + @Input() + public set bumpScale(value: number) { + if (this._objRef) { + this._objRef.bumpScale = value; + } + } + + public get bumpScale(): number | undefined { + return this._objRef?.bumpScale; + } + @Input() + public set normalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.normalMap = value; + } + } + + public get normalMap(): (Texture | null) | undefined { + return this._objRef?.normalMap; + } + @Input() + public set normalMapType(value: NormalMapTypes) { + if (this._objRef) { + this._objRef.normalMapType = value; + } + } + + public get normalMapType(): NormalMapTypes | undefined { + return this._objRef?.normalMapType; + } + @Input() + public set normalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.normalScale = applyValue( + this._objRef.normalScale, + value, + ); + } + } + public get normalScale(): Vector2 | undefined { + return this._objRef?.normalScale; + } + @Input() + public set displacementMap(value: Texture | null) { + if (this._objRef) { + this._objRef.displacementMap = value; + } + } + + public get displacementMap(): (Texture | null) | undefined { + return this._objRef?.displacementMap; + } + @Input() + public set displacementScale(value: number) { + if (this._objRef) { + this._objRef.displacementScale = value; + } + } + + public get displacementScale(): number | undefined { + return this._objRef?.displacementScale; + } + @Input() + public set displacementBias(value: number) { + if (this._objRef) { + this._objRef.displacementBias = value; + } + } + + public get displacementBias(): number | undefined { + return this._objRef?.displacementBias; + } + @Input() + public set roughnessMap(value: Texture | null) { + if (this._objRef) { + this._objRef.roughnessMap = value; + } + } + + public get roughnessMap(): (Texture | null) | undefined { + return this._objRef?.roughnessMap; + } + @Input() + public set metalnessMap(value: Texture | null) { + if (this._objRef) { + this._objRef.metalnessMap = value; + } + } + + public get metalnessMap(): (Texture | null) | undefined { + return this._objRef?.metalnessMap; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set envMap(value: Texture | null) { + if (this._objRef) { + this._objRef.envMap = value; + } + } + + public get envMap(): (Texture | null) | undefined { + return this._objRef?.envMap; + } + @Input() + public set envMapRotation( + value: Euler | [x: number, y: number, z: number, order?: EulerOrder], + ) { + if (this._objRef) { + this._objRef.envMapRotation = applyValue( + this._objRef.envMapRotation, + value, + ); + } + } + public get envMapRotation(): Euler | undefined { + return this._objRef?.envMapRotation; + } + @Input() + public set envMapIntensity(value: number) { + if (this._objRef) { + this._objRef.envMapIntensity = value; + } + } + + public get envMapIntensity(): number | undefined { + return this._objRef?.envMapIntensity; + } + @Input() + public set wireframe(value: boolean) { + if (this._objRef) { + this._objRef.wireframe = value; + } + } + + public get wireframe(): boolean | undefined { + return this._objRef?.wireframe; + } + @Input() + public set wireframeLinewidth(value: number) { + if (this._objRef) { + this._objRef.wireframeLinewidth = value; + } + } + + public get wireframeLinewidth(): number | undefined { + return this._objRef?.wireframeLinewidth; + } + @Input() + public set wireframeLinecap(value: string) { + if (this._objRef) { + this._objRef.wireframeLinecap = value; + } + } + + public get wireframeLinecap(): string | undefined { + return this._objRef?.wireframeLinecap; + } + @Input() + public set wireframeLinejoin(value: string) { + if (this._objRef) { + this._objRef.wireframeLinejoin = value; + } + } + + public get wireframeLinejoin(): string | undefined { + return this._objRef?.wireframeLinejoin; + } + @Input() + public set flatShading(value: boolean) { + if (this._objRef) { + this._objRef.flatShading = value; + } + } + + public get flatShading(): boolean | undefined { + return this._objRef?.flatShading; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThMeshToonNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThMeshToonNodeMaterial.ts new file mode 100644 index 00000000..82561973 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThMeshToonNodeMaterial.ts @@ -0,0 +1,306 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { NormalMapTypes } from 'three/src/constants.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + MeshToonNodeMaterial, + MeshToonNodeMaterialParameters, + Vector2, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-meshToonNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThMeshToonNodeMaterial), + }, + ], +}) +export class ThMeshToonNodeMaterial< + T extends MeshToonNodeMaterial = MeshToonNodeMaterial, + TARGS = /* parameters? */ MeshToonNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return MeshToonNodeMaterial; + } + + public get isMeshToonNodeMaterial(): true | undefined { + return this._objRef?.isMeshToonNodeMaterial; + } + public get isMeshToonMaterial(): true | undefined { + return this._objRef?.isMeshToonMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set gradientMap(value: Texture | null) { + if (this._objRef) { + this._objRef.gradientMap = value; + } + } + + public get gradientMap(): (Texture | null) | undefined { + return this._objRef?.gradientMap; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set lightMap(value: Texture | null) { + if (this._objRef) { + this._objRef.lightMap = value; + } + } + + public get lightMap(): (Texture | null) | undefined { + return this._objRef?.lightMap; + } + @Input() + public set lightMapIntensity(value: number) { + if (this._objRef) { + this._objRef.lightMapIntensity = value; + } + } + + public get lightMapIntensity(): number | undefined { + return this._objRef?.lightMapIntensity; + } + @Input() + public set aoMap(value: Texture | null) { + if (this._objRef) { + this._objRef.aoMap = value; + } + } + + public get aoMap(): (Texture | null) | undefined { + return this._objRef?.aoMap; + } + @Input() + public set aoMapIntensity(value: number) { + if (this._objRef) { + this._objRef.aoMapIntensity = value; + } + } + + public get aoMapIntensity(): number | undefined { + return this._objRef?.aoMapIntensity; + } + @Input() + public set emissive( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.emissive = applyValue(this._objRef.emissive, value); + } + } + public get emissive(): Color | undefined { + return this._objRef?.emissive; + } + @Input() + public set emissiveIntensity(value: number) { + if (this._objRef) { + this._objRef.emissiveIntensity = value; + } + } + + public get emissiveIntensity(): number | undefined { + return this._objRef?.emissiveIntensity; + } + @Input() + public set emissiveMap(value: Texture | null) { + if (this._objRef) { + this._objRef.emissiveMap = value; + } + } + + public get emissiveMap(): (Texture | null) | undefined { + return this._objRef?.emissiveMap; + } + @Input() + public set bumpMap(value: Texture | null) { + if (this._objRef) { + this._objRef.bumpMap = value; + } + } + + public get bumpMap(): (Texture | null) | undefined { + return this._objRef?.bumpMap; + } + @Input() + public set bumpScale(value: number) { + if (this._objRef) { + this._objRef.bumpScale = value; + } + } + + public get bumpScale(): number | undefined { + return this._objRef?.bumpScale; + } + @Input() + public set normalMap(value: Texture | null) { + if (this._objRef) { + this._objRef.normalMap = value; + } + } + + public get normalMap(): (Texture | null) | undefined { + return this._objRef?.normalMap; + } + @Input() + public set normalMapType(value: NormalMapTypes) { + if (this._objRef) { + this._objRef.normalMapType = value; + } + } + + public get normalMapType(): NormalMapTypes | undefined { + return this._objRef?.normalMapType; + } + @Input() + public set normalScale(value: Vector2 | [x: number, y: number]) { + if (this._objRef) { + this._objRef.normalScale = applyValue( + this._objRef.normalScale, + value, + ); + } + } + public get normalScale(): Vector2 | undefined { + return this._objRef?.normalScale; + } + @Input() + public set displacementMap(value: Texture | null) { + if (this._objRef) { + this._objRef.displacementMap = value; + } + } + + public get displacementMap(): (Texture | null) | undefined { + return this._objRef?.displacementMap; + } + @Input() + public set displacementScale(value: number) { + if (this._objRef) { + this._objRef.displacementScale = value; + } + } + + public get displacementScale(): number | undefined { + return this._objRef?.displacementScale; + } + @Input() + public set displacementBias(value: number) { + if (this._objRef) { + this._objRef.displacementBias = value; + } + } + + public get displacementBias(): number | undefined { + return this._objRef?.displacementBias; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set wireframe(value: boolean) { + if (this._objRef) { + this._objRef.wireframe = value; + } + } + + public get wireframe(): boolean | undefined { + return this._objRef?.wireframe; + } + @Input() + public set wireframeLinewidth(value: number) { + if (this._objRef) { + this._objRef.wireframeLinewidth = value; + } + } + + public get wireframeLinewidth(): number | undefined { + return this._objRef?.wireframeLinewidth; + } + @Input() + public set wireframeLinecap(value: string) { + if (this._objRef) { + this._objRef.wireframeLinecap = value; + } + } + + public get wireframeLinecap(): string | undefined { + return this._objRef?.wireframeLinecap; + } + @Input() + public set wireframeLinejoin(value: string) { + if (this._objRef) { + this._objRef.wireframeLinejoin = value; + } + } + + public get wireframeLinejoin(): string | undefined { + return this._objRef?.wireframeLinejoin; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThNodeMaterial.ts new file mode 100644 index 00000000..c678f6ee --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThNodeMaterial.ts @@ -0,0 +1,246 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { ChangeDetectionStrategy, Component, Input, Type, forwardRef } from '@angular/core'; +import MRTNode from 'three/src/nodes/core/MRTNode.js'; +import Node from 'three/src/nodes/core/Node.js'; +import LightsNode from 'three/src/nodes/lighting/LightsNode.js'; +import { NodeMaterial } from 'three/webgpu'; +import { ThMaterial } from './ThMaterial'; + +@Component({ + selector: 'th-nodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [{ provide: ThMaterial, useExisting: forwardRef(() => ThNodeMaterial) }], +}) +export class ThNodeMaterial extends ThMaterial { + public getType(): Type { + return NodeMaterial; + } + + public get isNodeMaterial(): true | undefined { + return this._objRef?.isNodeMaterial; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } + @Input() + public set lights(value: boolean) { + if (this._objRef) { + this._objRef.lights = value; + } + } + + public get lights(): boolean | undefined { + return this._objRef?.lights; + } + @Input() + public set hardwareClipping(value: boolean) { + if (this._objRef) { + this._objRef.hardwareClipping = value; + } + } + + public get hardwareClipping(): boolean | undefined { + return this._objRef?.hardwareClipping; + } + @Input() + public set lightsNode(value: LightsNode | null) { + if (this._objRef) { + this._objRef.lightsNode = value; + } + } + + public get lightsNode(): (LightsNode | null) | undefined { + return this._objRef?.lightsNode; + } + @Input() + public set envNode(value: Node | null) { + if (this._objRef) { + this._objRef.envNode = value; + } + } + + public get envNode(): (Node | null) | undefined { + return this._objRef?.envNode; + } + @Input() + public set aoNode(value: Node | null) { + if (this._objRef) { + this._objRef.aoNode = value; + } + } + + public get aoNode(): (Node | null) | undefined { + return this._objRef?.aoNode; + } + @Input() + public set colorNode(value: Node | null) { + if (this._objRef) { + this._objRef.colorNode = value; + } + } + + public get colorNode(): (Node | null) | undefined { + return this._objRef?.colorNode; + } + @Input() + public set normalNode(value: Node | null) { + if (this._objRef) { + this._objRef.normalNode = value; + } + } + + public get normalNode(): (Node | null) | undefined { + return this._objRef?.normalNode; + } + @Input() + public set opacityNode(value: Node | null) { + if (this._objRef) { + this._objRef.opacityNode = value; + } + } + + public get opacityNode(): (Node | null) | undefined { + return this._objRef?.opacityNode; + } + @Input() + public set backdropNode(value: Node | null) { + if (this._objRef) { + this._objRef.backdropNode = value; + } + } + + public get backdropNode(): (Node | null) | undefined { + return this._objRef?.backdropNode; + } + @Input() + public set backdropAlphaNode(value: Node | null) { + if (this._objRef) { + this._objRef.backdropAlphaNode = value; + } + } + + public get backdropAlphaNode(): (Node | null) | undefined { + return this._objRef?.backdropAlphaNode; + } + @Input() + public set alphaTestNode(value: Node | null) { + if (this._objRef) { + this._objRef.alphaTestNode = value; + } + } + + public get alphaTestNode(): (Node | null) | undefined { + return this._objRef?.alphaTestNode; + } + @Input() + public set positionNode(value: Node | null) { + if (this._objRef) { + this._objRef.positionNode = value; + } + } + + public get positionNode(): (Node | null) | undefined { + return this._objRef?.positionNode; + } + @Input() + public set geometryNode(value: Node | null) { + if (this._objRef) { + this._objRef.geometryNode = value; + } + } + + public get geometryNode(): (Node | null) | undefined { + return this._objRef?.geometryNode; + } + @Input() + public set depthNode(value: Node | null) { + if (this._objRef) { + this._objRef.depthNode = value; + } + } + + public get depthNode(): (Node | null) | undefined { + return this._objRef?.depthNode; + } + @Input() + public set shadowPositionNode(value: Node | null) { + if (this._objRef) { + this._objRef.shadowPositionNode = value; + } + } + + public get shadowPositionNode(): (Node | null) | undefined { + return this._objRef?.shadowPositionNode; + } + @Input() + public set receivedShadowNode(value: Node | null) { + if (this._objRef) { + this._objRef.receivedShadowNode = value; + } + } + + public get receivedShadowNode(): (Node | null) | undefined { + return this._objRef?.receivedShadowNode; + } + @Input() + public set castShadowNode(value: Node | null) { + if (this._objRef) { + this._objRef.castShadowNode = value; + } + } + + public get castShadowNode(): (Node | null) | undefined { + return this._objRef?.castShadowNode; + } + @Input() + public set outputNode(value: Node | null) { + if (this._objRef) { + this._objRef.outputNode = value; + } + } + + public get outputNode(): (Node | null) | undefined { + return this._objRef?.outputNode; + } + @Input() + public set mrtNode(value: MRTNode | null) { + if (this._objRef) { + this._objRef.mrtNode = value; + } + } + + public get mrtNode(): (MRTNode | null) | undefined { + return this._objRef?.mrtNode; + } + @Input() + public set fragmentNode(value: Node | null) { + if (this._objRef) { + this._objRef.fragmentNode = value; + } + } + + public get fragmentNode(): (Node | null) | undefined { + return this._objRef?.fragmentNode; + } + @Input() + public set vertexNode(value: Node | null) { + if (this._objRef) { + this._objRef.vertexNode = value; + } + } + + public get vertexNode(): (Node | null) | undefined { + return this._objRef?.vertexNode; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThPointsNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThPointsNodeMaterial.ts new file mode 100644 index 00000000..c323efee --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThPointsNodeMaterial.ts @@ -0,0 +1,105 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + PointsNodeMaterial, + PointsNodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-pointsNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThPointsNodeMaterial), + }, + ], +}) +export class ThPointsNodeMaterial< + T extends PointsNodeMaterial = PointsNodeMaterial, + TARGS = /* parameters? */ PointsNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return PointsNodeMaterial; + } + + public get isPointsNodeMaterial(): true | undefined { + return this._objRef?.isPointsNodeMaterial; + } + public get isPointsMaterial(): true | undefined { + return this._objRef?.isPointsMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set size(value: number) { + if (this._objRef) { + this._objRef.size = value; + } + } + + public get size(): number | undefined { + return this._objRef?.size; + } + @Input() + public set sizeAttenuation(value: boolean) { + if (this._objRef) { + this._objRef.sizeAttenuation = value; + } + } + + public get sizeAttenuation(): boolean | undefined { + return this._objRef?.sizeAttenuation; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThShadowNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThShadowNodeMaterial.ts new file mode 100644 index 00000000..26e0e902 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThShadowNodeMaterial.ts @@ -0,0 +1,74 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { + Color, + ColorRepresentation, + ShadowNodeMaterial, + ShadowNodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-shadowNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThShadowNodeMaterial), + }, + ], +}) +export class ThShadowNodeMaterial< + T extends ShadowNodeMaterial = ShadowNodeMaterial, + TARGS = /* parameters? */ ShadowNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return ShadowNodeMaterial; + } + + public get isShadowNodeMaterial(): true | undefined { + return this._objRef?.isShadowNodeMaterial; + } + public get isShadowMaterial(): true | undefined { + return this._objRef?.isShadowMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThSpriteNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThSpriteNodeMaterial.ts new file mode 100644 index 00000000..e96c83f0 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThSpriteNodeMaterial.ts @@ -0,0 +1,143 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import Node from 'three/src/nodes/core/Node.js'; +import { Texture } from 'three/src/textures/Texture.js'; +import { + Color, + ColorRepresentation, + SpriteNodeMaterial, + SpriteNodeMaterialParameters, +} from 'three/webgpu'; +import { applyValue } from '../util'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-spriteNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThSpriteNodeMaterial), + }, + ], +}) +export class ThSpriteNodeMaterial< + T extends SpriteNodeMaterial = SpriteNodeMaterial, + TARGS = /* parameters? */ SpriteNodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return SpriteNodeMaterial; + } + + @Input() + public set isSpriteNodeMaterial(value: true) { + if (this._objRef) { + this._objRef.isSpriteNodeMaterial = value; + } + } + + public get isSpriteNodeMaterial(): true | undefined { + return this._objRef?.isSpriteNodeMaterial; + } + @Input() + public set rotationNode(value: Node | null) { + if (this._objRef) { + this._objRef.rotationNode = value; + } + } + + public get rotationNode(): (Node | null) | undefined { + return this._objRef?.rotationNode; + } + @Input() + public set scaleNode(value: Node | null) { + if (this._objRef) { + this._objRef.scaleNode = value; + } + } + + public get scaleNode(): (Node | null) | undefined { + return this._objRef?.scaleNode; + } + public get isSpriteMaterial(): true | undefined { + return this._objRef?.isSpriteMaterial; + } + @Input() + public set color( + value: + | Color + | [ + ...args: + | [color: ColorRepresentation] + | [r: number, g: number, b: number], + ], + ) { + if (this._objRef) { + this._objRef.color = applyValue(this._objRef.color, value); + } + } + public get color(): Color | undefined { + return this._objRef?.color; + } + @Input() + public set map(value: Texture | null) { + if (this._objRef) { + this._objRef.map = value; + } + } + + public get map(): (Texture | null) | undefined { + return this._objRef?.map; + } + @Input() + public set alphaMap(value: Texture | null) { + if (this._objRef) { + this._objRef.alphaMap = value; + } + } + + public get alphaMap(): (Texture | null) | undefined { + return this._objRef?.alphaMap; + } + @Input() + public set rotation(value: number) { + if (this._objRef) { + this._objRef.rotation = value; + } + } + + public get rotation(): number | undefined { + return this._objRef?.rotation; + } + @Input() + public set sizeAttenuation(value: boolean) { + if (this._objRef) { + this._objRef.sizeAttenuation = value; + } + } + + public get sizeAttenuation(): boolean | undefined { + return this._objRef?.sizeAttenuation; + } + @Input() + public set fog(value: boolean) { + if (this._objRef) { + this._objRef.fog = value; + } + } + + public get fog(): boolean | undefined { + return this._objRef?.fog; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThTextBufferGeometry.ts b/projects/ngx-three/src/lib/generated/ThTextBufferGeometry.ts new file mode 100644 index 00000000..9a88d609 --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThTextBufferGeometry.ts @@ -0,0 +1,49 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Type, + forwardRef, +} from '@angular/core'; +import { Shape } from 'three'; +import { + TextBufferGeometry, + TextGeometryParameters, +} from 'three/examples/jsm/geometries/TextGeometry.js'; +import { ThBufferGeometry } from './ThBufferGeometry'; +import { ThExtrudeGeometry } from './ThExtrudeGeometry'; + +@Component({ + selector: 'th-textBufferGeometry', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThBufferGeometry, + useExisting: forwardRef(() => ThTextBufferGeometry), + }, + ], +}) +export class ThTextBufferGeometry< + T extends TextBufferGeometry = TextBufferGeometry, + TARGS = [text: string, parameters?: TextGeometryParameters], +> extends ThExtrudeGeometry { + public getType(): Type { + return TextBufferGeometry; + } + + public get type(): (string | 'TextGeometry') | undefined { + return this._objRef?.type; + } + public get parameters(): + | { + readonly shapes: Shape | Shape[]; + readonly options: TextGeometryParameters; + } + | undefined { + return this._objRef?.parameters; + } +} diff --git a/projects/ngx-three/src/lib/generated/ThVolumeNodeMaterial.ts b/projects/ngx-three/src/lib/generated/ThVolumeNodeMaterial.ts new file mode 100644 index 00000000..78c179ca --- /dev/null +++ b/projects/ngx-three/src/lib/generated/ThVolumeNodeMaterial.ts @@ -0,0 +1,60 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable no-underscore-dangle */ +/* eslint-disable @angular-eslint/component-selector, @angular-eslint/component-class-suffix */ +import { + ChangeDetectionStrategy, + Component, + Input, + Type, + forwardRef, +} from '@angular/core'; +import { NodeMaterialParameters } from 'three/src/materials/nodes/NodeMaterial.js'; +import Node from 'three/src/nodes/core/Node.js'; +import { VolumeNodeMaterial } from 'three/webgpu'; +import { ThMaterial } from './ThMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; + +@Component({ + selector: 'th-volumeNodeMaterial', + template: '', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: ThMaterial, + useExisting: forwardRef(() => ThVolumeNodeMaterial), + }, + ], +}) +export class ThVolumeNodeMaterial< + T extends VolumeNodeMaterial = VolumeNodeMaterial, + TARGS = /* parameters? */ NodeMaterialParameters, +> extends ThNodeMaterial { + public getType(): Type { + return VolumeNodeMaterial; + } + + @Input() + public set lights(value: boolean) { + if (this._objRef) { + this._objRef.lights = value; + } + } + + public get lights(): boolean | undefined { + return this._objRef?.lights; + } + public get isVolumeNodeMaterial(): true | undefined { + return this._objRef?.isVolumeNodeMaterial; + } + @Input() + public set testNode(value: Node | null) { + if (this._objRef) { + this._objRef.testNode = value; + } + } + + public get testNode(): (Node | null) | undefined { + return this._objRef?.testNode; + } +} diff --git a/projects/ngx-three/src/lib/generated/index.ts b/projects/ngx-three/src/lib/generated/index.ts index 5dac185e..2a840f49 100644 --- a/projects/ngx-three/src/lib/generated/index.ts +++ b/projects/ngx-three/src/lib/generated/index.ts @@ -63,14 +63,18 @@ export * from './ThHemisphereLightHelper'; export * from './ThIcosahedronGeometry'; export * from './ThInstancedBufferGeometry'; export * from './ThInstancedMesh'; +export * from './ThInstancedPointsNodeMaterial'; export * from './ThLOD'; export * from './ThLUTPass'; export * from './ThLatheGeometry'; export * from './ThLight'; export * from './ThLightProbe'; export * from './ThLine'; +export * from './ThLine2NodeMaterial'; export * from './ThLineBasicMaterial'; +export * from './ThLineBasicNodeMaterial'; export * from './ThLineDashedMaterial'; +export * from './ThLineDashedNodeMaterial'; export * from './ThLineLoop'; export * from './ThLineSegments'; export * from './ThMapControls'; @@ -78,15 +82,25 @@ export * from './ThMaskPass'; export * from './ThMaterial'; export * from './ThMesh'; export * from './ThMeshBasicMaterial'; +export * from './ThMeshBasicNodeMaterial'; export * from './ThMeshDepthMaterial'; export * from './ThMeshDistanceMaterial'; export * from './ThMeshLambertMaterial'; +export * from './ThMeshLambertNodeMaterial'; export * from './ThMeshMatcapMaterial'; +export * from './ThMeshMatcapNodeMaterial'; export * from './ThMeshNormalMaterial'; +export * from './ThMeshNormalNodeMaterial'; export * from './ThMeshPhongMaterial'; +export * from './ThMeshPhongNodeMaterial'; export * from './ThMeshPhysicalMaterial'; +export * from './ThMeshPhysicalNodeMaterial'; +export * from './ThMeshSSSNodeMaterial'; export * from './ThMeshStandardMaterial'; +export * from './ThMeshStandardNodeMaterial'; export * from './ThMeshToonMaterial'; +export * from './ThMeshToonNodeMaterial'; +export * from './ThNodeMaterial'; export * from './ThObject3D'; export * from './ThOctahedronGeometry'; export * from './ThOrbitControls'; @@ -103,6 +117,7 @@ export * from './ThPointLightHelper'; export * from './ThPointerLockControls'; export * from './ThPoints'; export * from './ThPointsMaterial'; +export * from './ThPointsNodeMaterial'; export * from './ThPolarGridHelper'; export * from './ThPolyhedronGeometry'; export * from './ThPositionalAudio'; @@ -121,6 +136,7 @@ export * from './ThScene'; export * from './ThShaderMaterial'; export * from './ThShaderPass'; export * from './ThShadowMaterial'; +export * from './ThShadowNodeMaterial'; export * from './ThShapeGeometry'; export * from './ThSkeletonHelper'; export * from './ThSkinnedMesh'; @@ -129,6 +145,7 @@ export * from './ThSpotLight'; export * from './ThSpotLightHelper'; export * from './ThSprite'; export * from './ThSpriteMaterial'; +export * from './ThSpriteNodeMaterial'; export * from './ThStereoCamera'; export * from './ThTAARenderPass'; export * from './ThTeapotGeometry'; @@ -143,6 +160,7 @@ export * from './ThTransformControlsGen'; export * from './ThTubeGeometry'; export * from './ThUnrealBloomPass'; export * from './ThVideoTexture'; +export * from './ThVolumeNodeMaterial'; export * from './ThWireframeGeometry'; export * from './overrides/ThCSS2DObject'; export * from './overrides/ThCSS3DObject'; diff --git a/projects/ngx-three/src/lib/generated/ngx-three-generated.module.ts b/projects/ngx-three/src/lib/generated/ngx-three-generated.module.ts index eaca815a..0646b0d1 100644 --- a/projects/ngx-three/src/lib/generated/ngx-three-generated.module.ts +++ b/projects/ngx-three/src/lib/generated/ngx-three-generated.module.ts @@ -60,13 +60,17 @@ import { ThHemisphereLightHelper } from './ThHemisphereLightHelper'; import { ThIcosahedronGeometry } from './ThIcosahedronGeometry'; import { ThInstancedBufferGeometry } from './ThInstancedBufferGeometry'; import { ThInstancedMesh } from './ThInstancedMesh'; +import { ThInstancedPointsNodeMaterial } from './ThInstancedPointsNodeMaterial'; import { ThLOD } from './ThLOD'; import { ThLUTPass } from './ThLUTPass'; import { ThLatheGeometry } from './ThLatheGeometry'; import { ThLightProbe } from './ThLightProbe'; import { ThLine } from './ThLine'; +import { ThLine2NodeMaterial } from './ThLine2NodeMaterial'; import { ThLineBasicMaterial } from './ThLineBasicMaterial'; +import { ThLineBasicNodeMaterial } from './ThLineBasicNodeMaterial'; import { ThLineDashedMaterial } from './ThLineDashedMaterial'; +import { ThLineDashedNodeMaterial } from './ThLineDashedNodeMaterial'; import { ThLineLoop } from './ThLineLoop'; import { ThLineSegments } from './ThLineSegments'; import { ThMapControls } from './ThMapControls'; @@ -74,15 +78,25 @@ import { ThMaskPass } from './ThMaskPass'; import { ThMaterial } from './ThMaterial'; import { ThMesh } from './ThMesh'; import { ThMeshBasicMaterial } from './ThMeshBasicMaterial'; +import { ThMeshBasicNodeMaterial } from './ThMeshBasicNodeMaterial'; import { ThMeshDepthMaterial } from './ThMeshDepthMaterial'; import { ThMeshDistanceMaterial } from './ThMeshDistanceMaterial'; import { ThMeshLambertMaterial } from './ThMeshLambertMaterial'; +import { ThMeshLambertNodeMaterial } from './ThMeshLambertNodeMaterial'; import { ThMeshMatcapMaterial } from './ThMeshMatcapMaterial'; +import { ThMeshMatcapNodeMaterial } from './ThMeshMatcapNodeMaterial'; import { ThMeshNormalMaterial } from './ThMeshNormalMaterial'; +import { ThMeshNormalNodeMaterial } from './ThMeshNormalNodeMaterial'; import { ThMeshPhongMaterial } from './ThMeshPhongMaterial'; +import { ThMeshPhongNodeMaterial } from './ThMeshPhongNodeMaterial'; import { ThMeshPhysicalMaterial } from './ThMeshPhysicalMaterial'; +import { ThMeshPhysicalNodeMaterial } from './ThMeshPhysicalNodeMaterial'; +import { ThMeshSSSNodeMaterial } from './ThMeshSSSNodeMaterial'; import { ThMeshStandardMaterial } from './ThMeshStandardMaterial'; +import { ThMeshStandardNodeMaterial } from './ThMeshStandardNodeMaterial'; import { ThMeshToonMaterial } from './ThMeshToonMaterial'; +import { ThMeshToonNodeMaterial } from './ThMeshToonNodeMaterial'; +import { ThNodeMaterial } from './ThNodeMaterial'; import { ThObject3D } from './ThObject3D'; import { ThOctahedronGeometry } from './ThOctahedronGeometry'; import { ThOrbitControls } from './ThOrbitControls'; @@ -99,6 +113,7 @@ import { ThPointLightHelper } from './ThPointLightHelper'; import { ThPointerLockControls } from './ThPointerLockControls'; import { ThPoints } from './ThPoints'; import { ThPointsMaterial } from './ThPointsMaterial'; +import { ThPointsNodeMaterial } from './ThPointsNodeMaterial'; import { ThPolarGridHelper } from './ThPolarGridHelper'; import { ThPolyhedronGeometry } from './ThPolyhedronGeometry'; import { ThPositionalAudio } from './ThPositionalAudio'; @@ -117,6 +132,7 @@ import { ThScene } from './ThScene'; import { ThShaderMaterial } from './ThShaderMaterial'; import { ThShaderPass } from './ThShaderPass'; import { ThShadowMaterial } from './ThShadowMaterial'; +import { ThShadowNodeMaterial } from './ThShadowNodeMaterial'; import { ThShapeGeometry } from './ThShapeGeometry'; import { ThSkeletonHelper } from './ThSkeletonHelper'; import { ThSkinnedMesh } from './ThSkinnedMesh'; @@ -125,6 +141,7 @@ import { ThSpotLight } from './ThSpotLight'; import { ThSpotLightHelper } from './ThSpotLightHelper'; import { ThSprite } from './ThSprite'; import { ThSpriteMaterial } from './ThSpriteMaterial'; +import { ThSpriteNodeMaterial } from './ThSpriteNodeMaterial'; import { ThStereoCamera } from './ThStereoCamera'; import { ThTAARenderPass } from './ThTAARenderPass'; import { ThTeapotGeometry } from './ThTeapotGeometry'; @@ -139,6 +156,7 @@ import { ThTransformControlsGen } from './ThTransformControlsGen'; import { ThTubeGeometry } from './ThTubeGeometry'; import { ThUnrealBloomPass } from './ThUnrealBloomPass'; import { ThVideoTexture } from './ThVideoTexture'; +import { ThVolumeNodeMaterial } from './ThVolumeNodeMaterial'; import { ThWireframeGeometry } from './ThWireframeGeometry'; import { ThCSS2DObject } from './overrides/ThCSS2DObject'; import { ThCSS3DObject } from './overrides/ThCSS3DObject'; @@ -294,6 +312,24 @@ import { ThTransformControls } from './overrides/ThTransformControls'; ThFramebufferTexture, ThTexture, ThVideoTexture, + ThInstancedPointsNodeMaterial, + ThLine2NodeMaterial, + ThLineBasicNodeMaterial, + ThLineDashedNodeMaterial, + ThMeshBasicNodeMaterial, + ThMeshLambertNodeMaterial, + ThMeshMatcapNodeMaterial, + ThMeshNormalNodeMaterial, + ThMeshPhongNodeMaterial, + ThMeshPhysicalNodeMaterial, + ThMeshSSSNodeMaterial, + ThMeshStandardNodeMaterial, + ThMeshToonNodeMaterial, + ThNodeMaterial, + ThPointsNodeMaterial, + ThShadowNodeMaterial, + ThSpriteNodeMaterial, + ThVolumeNodeMaterial, ], exports: [ ThTransformControlsGen, @@ -442,6 +478,24 @@ import { ThTransformControls } from './overrides/ThTransformControls'; ThFramebufferTexture, ThTexture, ThVideoTexture, + ThInstancedPointsNodeMaterial, + ThLine2NodeMaterial, + ThLineBasicNodeMaterial, + ThLineDashedNodeMaterial, + ThMeshBasicNodeMaterial, + ThMeshLambertNodeMaterial, + ThMeshMatcapNodeMaterial, + ThMeshNormalNodeMaterial, + ThMeshPhongNodeMaterial, + ThMeshPhysicalNodeMaterial, + ThMeshSSSNodeMaterial, + ThMeshStandardNodeMaterial, + ThMeshToonNodeMaterial, + ThNodeMaterial, + ThPointsNodeMaterial, + ThShadowNodeMaterial, + ThSpriteNodeMaterial, + ThVolumeNodeMaterial, ], }) export class NgxThreeGeneratedModule {} diff --git a/projects/ngx-three/src/lib/generator/NgxThreeClass.ts b/projects/ngx-three/src/lib/generator/NgxThreeClass.ts index 7ac487bf..aabc59c6 100644 --- a/projects/ngx-three/src/lib/generator/NgxThreeClass.ts +++ b/projects/ngx-three/src/lib/generator/NgxThreeClass.ts @@ -33,7 +33,10 @@ export abstract class NgxThreeClass { protected typeChecker: ts.TypeChecker, ) { this.classDecl = this.fetchClassDecleration(); - this.wrappedClassName = this.classSymbol.escapedName as string; + this.wrappedClassName = + this.classSymbol.escapedName !== 'default' + ? (this.classSymbol.escapedName as string) + : (classSymbol.escapedName as string); this.isAbstract = this.classDecl.modifiers?.find((m) => m.kind === SyntaxKind.AbstractKeyword) !== undefined; this.className = 'Th' + this.wrappedClassName; this.directiveName = 'th-' + pascalToCamelCase(this.wrappedClassName); diff --git a/projects/ngx-three/src/lib/generator/NgxThreeNodeMaterial.ts b/projects/ngx-three/src/lib/generator/NgxThreeNodeMaterial.ts new file mode 100644 index 00000000..1691867f --- /dev/null +++ b/projects/ngx-three/src/lib/generator/NgxThreeNodeMaterial.ts @@ -0,0 +1,31 @@ +import { SourceFile } from 'typescript'; +import { NgxThreeMaterial } from './NgxThreeMaterial'; + +/** + * A wrapper class generator for three.js node materials + */ +export class NgxThreeNodeMaterial extends NgxThreeMaterial { + public getBaseClassName(): string { + return 'Material'; + } + + public getWrapperBaseClassName(): string { + return 'ThMaterialBase'; + } + + protected override getImportPathForImportStatement(srcFilePath: string, importStatement: string): string { + const path = super.getImportPathForImportStatement(srcFilePath, importStatement); + if (path === 'three') { + return 'three/webgpu'; + } + return path; + } + + protected override getImportPathForSourceFile(srcFile: SourceFile): string { + const path = super.getImportPathForSourceFile(srcFile); + if (path === 'three') { + return 'three/webgpu'; + } + return path; + } +} diff --git a/projects/ngx-three/src/lib/generator/generateComponents.ts b/projects/ngx-three/src/lib/generator/generateComponents.ts index e3ffaa1b..d70d842f 100644 --- a/projects/ngx-three/src/lib/generator/generateComponents.ts +++ b/projects/ngx-three/src/lib/generator/generateComponents.ts @@ -15,6 +15,7 @@ import { NgxThreeBarrelGen } from './NgxThreeBarrelGen'; import { NgxThreePass } from './NgxThreePass'; import { NgxThreeTexture } from './NgxThreeTexture'; import { ESLint } from 'eslint'; +import { NgxThreeNodeMaterial } from './NgxThreeNodeMaterial'; class NgxThreeClassGenerator { public readonly baseOutPath = normalize(join(__dirname, '../generated/')); @@ -33,6 +34,7 @@ class NgxThreeClassGenerator { this.generateGeometries(), this.generatePasses(), this.generateTextures(), + this.generateNodeMaterials(), ]); return Promise.allSettled([ @@ -50,6 +52,10 @@ class NgxThreeClassGenerator { return this.generate('NgxThreeMaterials', NgxThreeMaterial); } + generateNodeMaterials() { + return this.generate('NgxThreeNodeMaterials', NgxThreeNodeMaterial); + } + generateGeometries() { return this.generate('NgxThreeBufferGeometries', NgxThreeBufferGeometry); } diff --git a/projects/ngx-three/src/lib/generator/three_types.ts b/projects/ngx-three/src/lib/generator/three_types.ts index c691d041..c0ac752d 100644 --- a/projects/ngx-three/src/lib/generator/three_types.ts +++ b/projects/ngx-three/src/lib/generator/three_types.ts @@ -3,6 +3,8 @@ import * as THREE from 'three'; import { OmitByValue } from 'utility-types'; type Three = typeof import('three'); +// type ThreeWebGPU = typeof import('three/webgpu'); +type NodeMaterials = typeof import('three/src/materials/nodes/NodeMaterials'); /** Classes exported `three/src/Three.d.ts` but not from `three/src/Three.js` */ type MissingInThreeRuntimeExports = @@ -53,6 +55,28 @@ type __ngxThreeMaterials = { // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface NgxThreeMaterials extends OmitByValue<__ngxThreeMaterials, never> {} +// ------ node materials ------ + +/* +type __ngxThreeNodeMaterials = { + [P in keyof ThreeWebGPU]: ThreeWebGPU[P] extends abstract new (...args: any) => any + ? InstanceType extends InstanceType + ? InstanceType + : never // InstanceType //never + : never; +}; +*/ +type __ngxThreeNodeMaterials = { + [P in keyof NodeMaterials]: NodeMaterials[P] extends abstract new (...args: any) => any + ? InstanceType extends InstanceType + ? InstanceType + : never + : never; +}; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface NgxThreeNodeMaterials extends OmitByValue<__ngxThreeNodeMaterials, never> {} + // ------ geometries ------ type __ngxThreeBufferGeometries = { diff --git a/projects/ngx-three/src/lib/renderer/renderer-providers.ts b/projects/ngx-three/src/lib/renderer/renderer-providers.ts index a673b39f..85c75b36 100644 --- a/projects/ngx-three/src/lib/renderer/renderer-providers.ts +++ b/projects/ngx-three/src/lib/renderer/renderer-providers.ts @@ -15,6 +15,8 @@ import { CSS3DParameters, CSS3DRenderer } from 'three/examples/jsm/renderers/CSS import { CSS2DParameters, CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer.js'; import { Renderer, WebGLRenderer, WebGLRendererParameters } from 'three'; +import { WebGPURenderer } from 'three/webgpu'; +import { WebGPURendererParameters } from 'three/src/renderers/webgpu/WebGPURenderer'; const RENDERER_DEFAULTS: WebGLRendererParameters = { alpha: true, // transparent background @@ -22,12 +24,18 @@ const RENDERER_DEFAULTS: WebGLRendererParameters = { preserveDrawingBuffer: true, }; +const WEBGPU_RENDERER_DEFAULTS: WebGPURendererParameters = { + alpha: true, // transparent background + antialias: true, // smooth edges +}; + export type ThRendererParameters = Partial; export const RENDERER_PROVIDERS = new InjectionToken('Renderer Providers'); export const CSS3D_RENDERER = new InjectionToken('CSS3DRenderer'); export const CSS2D_RENDERER = new InjectionToken('CSS2DRenderer'); export const WEBGL_RENDERER = new InjectionToken('WebGLRenderer'); +export const WEBGPU_RENDERER = new InjectionToken('WebGPURenderer'); @Directive({ selector: @@ -148,10 +156,11 @@ export function provideCSS2dRenderer(parameters?: CSS2DParameters) { return provider; } -export function provideWebGPURenderer(parameters?: WebGLRendererParameters) { +export function provideWebGPURenderer(parameters?: WebGPURendererParameters) { + const renderer = new WebGPURenderer({ ...WEBGPU_RENDERER_DEFAULTS, ...parameters }); const provider: Provider[] = [ - { provide: WEBGL_RENDERER, useValue: new WebGLRenderer(parameters) }, - { provide: RENDERER_PROVIDERS, multi: true, useExisting: WEBGL_RENDERER }, + { provide: WEBGPU_RENDERER, useValue: renderer }, + { provide: RENDERER_PROVIDERS, multi: true, useExisting: WEBGPU_RENDERER }, ]; return provider; }