Add toggle for showing only intersecting particles
This commit is contained in:
+19
-9
@@ -1,4 +1,4 @@
|
||||
import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angular/core';
|
||||
import {AfterViewInit, Component, ElementRef, inject, OnDestroy, ViewChild} from '@angular/core';
|
||||
import {MatMiniFabButton} from '@angular/material/button';
|
||||
|
||||
import {IntersectionPlaneService, PlaneOrientation} from '../../services/intersection-plane.service';
|
||||
@@ -9,6 +9,7 @@ import {PlayerModelService} from '../../services/player-model.service';
|
||||
import {InputHandlerService} from '../../services/input-handler.service';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {MatFormField, MatInput, MatLabel} from '@angular/material/input';
|
||||
import {ParticleManagerService} from '../../services/particle-manager.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-render-container',
|
||||
@@ -20,20 +21,18 @@ import {MatFormField, MatInput, MatLabel} from '@angular/material/input';
|
||||
MatInput,
|
||||
MatFormField,
|
||||
MatLabel
|
||||
],
|
||||
],
|
||||
templateUrl: './render-container.component.html',
|
||||
styleUrl: './render-container.component.scss'
|
||||
})
|
||||
export class RenderContainerComponent implements AfterViewInit, OnDestroy {
|
||||
@ViewChild('rendererContainer') rendererContainer!: ElementRef;
|
||||
|
||||
constructor(
|
||||
private intersectionPlaneService: IntersectionPlaneService,
|
||||
private playerModelService: PlayerModelService,
|
||||
private inputHandlerService: InputHandlerService,
|
||||
private rendererService: RendererService,
|
||||
) {
|
||||
}
|
||||
private readonly intersectionPlaneService = inject(IntersectionPlaneService);
|
||||
private readonly playerModelService = inject(PlayerModelService);
|
||||
private readonly inputHandlerService = inject(InputHandlerService);
|
||||
private readonly rendererService = inject(RendererService);
|
||||
private readonly particleManagerService = inject(ParticleManagerService);
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.initializeScene();
|
||||
@@ -99,6 +98,10 @@ export class RenderContainerComponent implements AfterViewInit, OnDestroy {
|
||||
this.rendererService.resetCamera();
|
||||
}
|
||||
|
||||
public toggleShowParticlesWhenIntersectingPlane(): void {
|
||||
this.particleManagerService.onlyIntersectingParticles = !this.particleManagerService.onlyIntersectingParticles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current plane orientation
|
||||
*/
|
||||
@@ -106,6 +109,13 @@ export class RenderContainerComponent implements AfterViewInit, OnDestroy {
|
||||
return this.intersectionPlaneService.getCurrentOrientation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the value indicating whether only intersecting particles are being considered.
|
||||
*/
|
||||
public get onlyIntersecting(): boolean {
|
||||
return this.particleManagerService.onlyIntersectingParticles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plane orientation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user