|
1 | | -import * as THREE from "three"; |
| 1 | +import { BufferGeometry, BufferAttribute, Mesh, Vector3 } from "three"; |
2 | 2 | import { ChunkTerrain } from "./ChunkTerrain.js"; |
3 | 3 | import { AnimatedTextureAtlas } from "./AnimatedTextureAtlas.js"; |
4 | 4 | import { SectionComputer } from "./SectionComputer.js"; |
@@ -112,26 +112,26 @@ var World = class World { |
112 | 112 | var cellId = this.chunkTerrain.vecToStr(...data.info); |
113 | 113 | var cell = data.cell; |
114 | 114 | var mesh = this.cellMesh[cellId]; |
115 | | - var geometry = new THREE.BufferGeometry(); |
| 115 | + var geometry = new BufferGeometry(); |
116 | 116 | geometry.setAttribute( |
117 | 117 | "position", |
118 | | - new THREE.BufferAttribute(new Float32Array(cell.positions), 3) |
| 118 | + new BufferAttribute(new Float32Array(cell.positions), 3) |
119 | 119 | ); |
120 | 120 | geometry.setAttribute( |
121 | 121 | "normal", |
122 | | - new THREE.BufferAttribute(new Float32Array(cell.normals), 3) |
| 122 | + new BufferAttribute(new Float32Array(cell.normals), 3) |
123 | 123 | ); |
124 | 124 | geometry.setAttribute( |
125 | 125 | "uv", |
126 | | - new THREE.BufferAttribute(new Float32Array(cell.uvs), 2) |
| 126 | + new BufferAttribute(new Float32Array(cell.uvs), 2) |
127 | 127 | ); |
128 | 128 | geometry.setAttribute( |
129 | 129 | "color", |
130 | | - new THREE.BufferAttribute(new Float32Array(cell.colors), 3) |
| 130 | + new BufferAttribute(new Float32Array(cell.colors), 3) |
131 | 131 | ); |
132 | 132 | geometry.matrixAutoUpdate = false; |
133 | 133 | if (mesh === void 0) { |
134 | | - this.cellMesh[cellId] = new THREE.Mesh(geometry, this.material); |
| 134 | + this.cellMesh[cellId] = new Mesh(geometry, this.material); |
135 | 135 | this.cellMesh[cellId].matrixAutoUpdate = false; |
136 | 136 | this.cellMesh[cellId].frustumCulled = false; |
137 | 137 | this.cellMesh[cellId].onAfterRender = () => { |
@@ -244,10 +244,10 @@ var World = class World { |
244 | 244 | * @returns Pointing block |
245 | 245 | */ |
246 | 246 | getRayBlock() { |
247 | | - var start = new THREE.Vector3().setFromMatrixPosition( |
| 247 | + var start = new Vector3().setFromMatrixPosition( |
248 | 248 | this.game.camera.matrixWorld |
249 | 249 | ); |
250 | | - var end = new THREE.Vector3().set(0, 0, 1).unproject(this.game.camera); |
| 250 | + var end = new Vector3().set(0, 0, 1).unproject(this.game.camera); |
251 | 251 | var intersection = this.intersectsRay(start, end); |
252 | 252 | if (intersection) { |
253 | 253 | var posPlace = intersection.position.map(function (v, ndx) { |
|
0 commit comments