From d80ef81fcfbc90147867c6a3d90ea7d33db8535a Mon Sep 17 00:00:00 2001 From: fallenoak Date: Thu, 8 Feb 2024 17:06:00 -0700 Subject: [PATCH] chore(map): reduce allocations of tiny typed arrays --- package-lock.json | 8 ++++---- package.json | 2 +- src/lib/map/loader/types.ts | 6 +++--- src/lib/map/terrain/TerrainMesh.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index a1aa52d..d22d25e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@tweenjs/tween.js": "^23.1.1", - "@wowserhq/format": "^0.23.0" + "@wowserhq/format": "^0.24.0" }, "devDependencies": { "@commitlint/config-conventional": "^18.5.0", @@ -2342,9 +2342,9 @@ } }, "node_modules/@wowserhq/format": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@wowserhq/format/-/format-0.23.0.tgz", - "integrity": "sha512-pqZTtp00oYPaugaaU5G8fW+4oJgd2dPxqyXbuQCsnp35VznFyFQcomULnO9Ds+FiS1z3HCw8+m9/dyvFcCXLfQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@wowserhq/format/-/format-0.24.0.tgz", + "integrity": "sha512-4olscHNgFkMZ7zHXFYNw5naZd0RSPbJGemZWFcdfFSHbppT5+VQI8mCSA+3gS99dBTviqCFxxU/aPtPjW61A6Q==", "dependencies": { "@wowserhq/io": "^2.0.2", "gl-matrix": "^3.4.3" diff --git a/package.json b/package.json index d554ad6..29ea833 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ ], "dependencies": { "@tweenjs/tween.js": "^23.1.1", - "@wowserhq/format": "^0.23.0" + "@wowserhq/format": "^0.24.0" }, "peerDependencies": { "three": "^0.160.0" diff --git a/src/lib/map/loader/types.ts b/src/lib/map/loader/types.ts index f6641ae..92d4343 100644 --- a/src/lib/map/loader/types.ts +++ b/src/lib/map/loader/types.ts @@ -5,8 +5,8 @@ type MapSpec = { type MapDoodadDefSpec = { id: number; name: string; - position: Float32Array; - rotation: Float32Array; + position: number[]; + rotation: number[]; scale: number; }; @@ -34,7 +34,7 @@ type TerrainGeometrySpec = { }; type TerrainSpec = { - position: Float32Array; + position: number[]; geometry: TerrainGeometrySpec; material: TerrainMaterialSpec; }; diff --git a/src/lib/map/terrain/TerrainMesh.ts b/src/lib/map/terrain/TerrainMesh.ts index 2eb39a0..fa020b6 100644 --- a/src/lib/map/terrain/TerrainMesh.ts +++ b/src/lib/map/terrain/TerrainMesh.ts @@ -1,7 +1,7 @@ import * as THREE from 'three'; class TerrainMesh extends THREE.Mesh { - constructor(position: Float32Array, geometry: THREE.BufferGeometry, material: THREE.Material) { + constructor(position: number[], geometry: THREE.BufferGeometry, material: THREE.Material) { super(geometry, material); this.position.set(position[0], position[1], position[2]);