Compare commits

..

No commits in common. "984bbae7e383d917c4b1be94f7664c1925386d2b" and "87a75639cfb9f4f5e9029ef5bbf059172d9f10d8" have entirely different histories.

5 changed files with 3 additions and 118 deletions

View File

@ -5,10 +5,6 @@
<mat-label>Opacity</mat-label> <mat-label>Opacity</mat-label>
<input matInput type="number" [(ngModel)]="opacity" min="0" max="1" step="0.01" placeholder=""> <input matInput type="number" [(ngModel)]="opacity" min="0" max="1" step="0.01" placeholder="">
</mat-form-field> </mat-form-field>
<mat-form-field appearance="outline" style="width: 12ch; margin-left: 8px;">
<mat-label>Grid density</mat-label>
<input matInput type="number" [(ngModel)]="gridDensity" min="2" max="64" step="2" placeholder="">
</mat-form-field>
</div> </div>
<div class="button-row"> <div class="button-row">
<button mat-mini-fab color="primary" (click)="resetCamera()" <button mat-mini-fab color="primary" (click)="resetCamera()"
@ -30,11 +26,6 @@
[matTooltip]="isPlaneLocked ? 'Unlock plane' : 'Lock plane'"> [matTooltip]="isPlaneLocked ? 'Unlock plane' : 'Lock plane'">
<mat-icon>{{ isPlaneLocked ? 'lock' : 'lock_open' }}</mat-icon> <mat-icon>{{ isPlaneLocked ? 'lock' : 'lock_open' }}</mat-icon>
</button> </button>
<button mat-mini-fab color="primary" (click)="gridVisible = !gridVisible"
[matTooltip]="gridVisible ? 'Hide grid' : 'Show grid'">
<mat-icon>{{ gridVisible ? 'grid_off' : 'grid_on' }}</mat-icon>
</button>
</div> </div>
@if (isPlaneLocked) { @if (isPlaneLocked) {

View File

@ -86,23 +86,6 @@ export class RenderContainerComponent implements AfterViewInit, OnDestroy {
return this.intersectionPlaneService.currentOpacity; return this.intersectionPlaneService.currentOpacity;
} }
// Grid proxies
public get gridVisible(): boolean {
return this.intersectionPlaneService.getGridVisible();
}
public set gridVisible(v: boolean) {
this.intersectionPlaneService.setGridVisible(v);
}
public get gridDensity(): number {
return this.intersectionPlaneService.getGridDensity();
}
public set gridDensity(d: number) {
this.intersectionPlaneService.setGridDensity(d);
}
/** /**
* Toggle the plane locked state * Toggle the plane locked state
*/ */

View File

@ -28,11 +28,6 @@ export class IntersectionPlaneService {
private planeLocked: boolean = false; private planeLocked: boolean = false;
private opacity: number = 0.05; private opacity: number = 0.05;
// Grid overlay
private gridHelper?: THREE.GridHelper;
private gridVisible: boolean = true;
private gridDensity: number = 4;
// Emits whenever plane position, orientation, or lock-affecting orientation updates change visuals // Emits whenever plane position, orientation, or lock-affecting orientation updates change visuals
public readonly planeChanged$ = new Subject<void>(); public readonly planeChanged$ = new Subject<void>();
private lastPlaneSignature: string | null = null; private lastPlaneSignature: string | null = null;
@ -40,77 +35,6 @@ export class IntersectionPlaneService {
constructor(private rendererService: RendererService) { constructor(private rendererService: RendererService) {
} }
public get stepSize() {
return 5
}
/**
* Creates or updates the grid helper attached to the intersection plane
* without affecting raycasting/placement.
*/
private createOrUpdateGrid(): void {
if (!this.intersectionPlane) return;
if (this.gridHelper) {
this.intersectionPlane.remove(this.gridHelper);
(this.gridHelper.geometry as THREE.BufferGeometry).dispose();
if (this.gridHelper.material.dispose) {
this.gridHelper.material.dispose();
}
this.gridHelper = undefined;
}
const size = this.stepSize;
const divisions = Math.max(1, Math.floor(size * this.gridDensity));
this.gridHelper = new THREE.GridHelper(size, divisions, 0x888888, 0xcccccc);
this.gridHelper.rotation.x = Math.PI / 2;
this.gridHelper.position.z -= 0.005;
this.gridHelper.renderOrder = 2;
const gridMat = this.gridHelper.material as THREE.Material | THREE.Material[];
if (Array.isArray(gridMat)) {
gridMat.forEach(material => {
material.transparent = true;
material.depthWrite = false;
if (material.opacity !== undefined) {
material.opacity = 0.25;
}
});
} else {
gridMat.transparent = true;
gridMat.depthWrite = false;
gridMat.opacity = 0.25;
}
this.gridHelper.raycast = () => {
};
this.gridHelper.visible = this.gridVisible;
this.intersectionPlane.add(this.gridHelper);
}
public setGridVisible(visible: boolean): void {
this.gridVisible = visible;
if (this.gridHelper) this.gridHelper.visible = visible;
}
public getGridVisible(): boolean {
return this.gridVisible;
}
public setGridDensity(density: number): void {
this.gridDensity = Math.max(1, Math.min(64, Math.floor(density)));
if (this.intersectionPlane) {
this.createOrUpdateGrid();
}
}
public getGridDensity(): number {
return this.gridDensity;
}
/** /**
* Creates the intersection plane and adds it to the scene * Creates the intersection plane and adds it to the scene
*/ */
@ -127,10 +51,6 @@ export class IntersectionPlaneService {
this.intersectionPlane.position.z = 0; this.intersectionPlane.position.z = 0;
// Center the plane vertically with the player (player is about 2 blocks tall) // Center the plane vertically with the player (player is about 2 blocks tall)
this.intersectionPlane.position.y = 1; this.intersectionPlane.position.y = 1;
// Add grid overlay as a child so it follows rotation/position
this.createOrUpdateGrid();
this.rendererService.scene.add(this.intersectionPlane); this.rendererService.scene.add(this.intersectionPlane);
this.intersectionPlane.renderOrder = 1; this.intersectionPlane.renderOrder = 1;
@ -204,17 +124,17 @@ export class IntersectionPlaneService {
// Convert from 1/16th block to Three.js units // Convert from 1/16th block to Three.js units
const position = (this.planePosition / 16) const position = (this.planePosition / 16)
this.intersectionPlane.position.y = 1; this.intersectionPlane.position.y = 0.8;
this.intersectionPlane.position.x = 0; this.intersectionPlane.position.x = 0;
this.intersectionPlane.position.z = 0; this.intersectionPlane.position.z = 0;
// Position based on the current orientation // Position based on the current orientation
switch (this.currentOrientation) { switch (this.currentOrientation) {
case PlaneOrientation.VERTICAL_ABOVE: case PlaneOrientation.VERTICAL_ABOVE:
this.intersectionPlane.position.y = position; this.intersectionPlane.position.y = 0.8 - position;
break; break;
case PlaneOrientation.VERTICAL_BELOW: case PlaneOrientation.VERTICAL_BELOW:
this.intersectionPlane.position.y = position; this.intersectionPlane.position.y = 0.8 + position;
break; break;
case PlaneOrientation.HORIZONTAL_FRONT: case PlaneOrientation.HORIZONTAL_FRONT:
this.intersectionPlane.position.z = position; this.intersectionPlane.position.z = position;

View File

@ -53,13 +53,6 @@ export class ParticleManagerService {
* Adds a particle at the specified position * Adds a particle at the specified position
*/ */
addParticle(x: number, y: number, z: number): void { addParticle(x: number, y: number, z: number): void {
const planeSize = this.intersectionPlaneService.stepSize;
const divisions = Math.max(1, Math.floor(planeSize * this.intersectionPlaneService.getGridDensity()));
const gridStepPlane = planeSize / divisions;
x = Math.round(x / gridStepPlane) * gridStepPlane;
y = Math.round(y / gridStepPlane) * gridStepPlane;
z = Math.round(z / gridStepPlane) * gridStepPlane;
// Create a visual representation of the particle // Create a visual representation of the particle
const particleGeometry = new THREE.SphereGeometry(0.03 * this.selectedSize, 16, 16); const particleGeometry = new THREE.SphereGeometry(0.03 * this.selectedSize, 16, 16);
const particleMaterial = new THREE.MeshBasicMaterial({color: this.selectedColor}); const particleMaterial = new THREE.MeshBasicMaterial({color: this.selectedColor});
@ -73,7 +66,6 @@ export class ParticleManagerService {
const hexColor = this.selectedColor.replace('#', ''); const hexColor = this.selectedColor.replace('#', '');
//TODO make this work for more than just type DUST //TODO make this work for more than just type DUST
const particleInfo: ParticleInfo = { const particleInfo: ParticleInfo = {
particle_type: this.selectedParticle, particle_type: this.selectedParticle,
x: x, x: x,

View File

@ -56,7 +56,6 @@ export class PlayerModelService {
} }
this.playerModel.renderOrder = 0; this.playerModel.renderOrder = 0;
this.playerModel.position.y = 0.2;
this.rendererService.scene.add(this.playerModel); this.rendererService.scene.add(this.playerModel);
return this.playerModel; return this.playerModel;
} }