Removed magic number

This commit is contained in:
Lucas Dower 2023-09-04 00:58:06 +01:00
parent bcdd92ed33
commit 6c1325d8e6
No known key found for this signature in database
GPG Key ID: B3EE6B8499593605
4 changed files with 8 additions and 8 deletions

View File

@ -25,11 +25,12 @@ export class AppConfig {
public readonly RENDER_TRIANGLE_THRESHOLD = 1_000_000;
public readonly MAXIMUM_IMAGE_MEM_ALLOC = 2048;
public readonly CAMERA_FOV_DEGREES = 30.0;
public readonly CAMERA_DEFAULT_DISTANCE_UNITS = 18.0;
public readonly CAMERA_DEFAULT_DISTANCE_UNITS = 4.0;
public readonly CAMERA_DEFAULT_AZIMUTH_RADIANS = -1.0;
public readonly CAMERA_DEFAULT_ELEVATION_RADIANS = 1.3;
public readonly CAMERA_SENSITIVITY_ROTATION = 0.005;
public readonly CAMERA_SENSITIVITY_ZOOM = 0.005;
public readonly CAMERA_SENSITIVITY_ZOOM = 0.0025;
public readonly CONSTRAINT_MINIMUM_HEIGHT = 3;
public readonly CONSTRAINT_MAXIMUM_HEIGHT = 380;
public readonly SMOOTHNESS_MAX = 3.0;
public readonly CAMERA_SMOOTHING = 1.0;

View File

@ -57,7 +57,6 @@ export class Mesh {
private _materials!: MaterialMap;
private _loadedTextures: Map<string, Texture>;
public static desiredHeight = 8.0;
constructor(vertices: Vector3[], normals: Vector3[], uvs: UV[], tris: Tri[], materials: MaterialMap) {
this.id = getRandomID();
@ -298,7 +297,7 @@ export class Mesh {
private _normaliseMesh() {
const bounds = this.getBounds();
const size = Vector3.sub(bounds.max, bounds.min);
const scaleFactor = Mesh.desiredHeight / size.y;
const scaleFactor = 1.0 / size.y;
if (isNaN(scaleFactor) || !isFinite(scaleFactor)) {
throw new AppError(LOC('import.could_not_scale_mesh'));

View File

@ -135,9 +135,9 @@ export class Renderer {
{ name: 'position', numComponents: 3 },
{ name: 'colour', numComponents: 4 },
]);
this._axisBuffer.add(DebugGeometryTemplates.arrow(new Vector3(0, 0, 0), new Vector3(1, 0, 0), { r: 0.96, g: 0.21, b: 0.32, a: 1.0 }));
this._axisBuffer.add(DebugGeometryTemplates.arrow(new Vector3(0, 0, 0), new Vector3(0, 1, 0), { r: 0.44, g: 0.64, b: 0.11, a: 1.0 }));
this._axisBuffer.add(DebugGeometryTemplates.arrow(new Vector3(0, 0, 0), new Vector3(0, 0, 1), { r: 0.18, g: 0.52, b: 0.89, a: 1.0 }));
this._axisBuffer.add(DebugGeometryTemplates.arrow(new Vector3(0, 0, 0), new Vector3(0.125, 0, 0), { r: 0.96, g: 0.21, b: 0.32, a: 1.0 }));
this._axisBuffer.add(DebugGeometryTemplates.arrow(new Vector3(0, 0, 0), new Vector3(0, 0.125, 0), { r: 0.44, g: 0.64, b: 0.11, a: 1.0 }));
this._axisBuffer.add(DebugGeometryTemplates.arrow(new Vector3(0, 0, 0), new Vector3(0, 0, 0.125), { r: 0.18, g: 0.52, b: 0.89, a: 1.0 }));
const resizeObserver = new ResizeObserver(() => {
this.forceRedraw();

View File

@ -154,7 +154,7 @@ export class WorkerClient {
return {
buffer: buffer,
dimensions: this._loadedVoxelMesh.getBounds().getDimensions(),
voxelSize: 8.0 / params.desiredHeight,
voxelSize: 1.0 / params.desiredHeight,
moreVoxelsToBuffer: buffer.moreVoxelsToBuffer,
isFirstChunk: isFirstChunk,
};