Skip to content

Commit 3812a14

Browse files
committed
fix
1 parent c56a254 commit 3812a14

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

webgpu/sketches/2023.01.16-13.50.26.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ async function main() {
3737
center: CENTER
3838
})
3939

40-
const result = await getLidarStreamer(device, 'https://nyc-lidar-demo.s3.amazonaws.com/987210.bin')
41-
// const result = await getLidarStreamer(device, 'https://nyc-lidar-demo.s3.amazonaws.com/midtown-sampled-xl.bin')
40+
// const result = await getLidarStreamer(device, 'https://nyc-lidar-demo.s3.amazonaws.com/987210.bin')
41+
const result = await getLidarStreamer(device, 'https://nyc-lidar-demo.s3.amazonaws.com/midtown-sampled-xl.bin')
4242
// const result = await getLidarStreamer(device, 'https://nyc-lidar-demo.s3.amazonaws.com/manhattan-sampled-lg.bin')
4343

4444
const { getCurrentPointCount, offset, buffer: vertexBuffer } = result
@@ -155,9 +155,9 @@ async function main() {
155155
},
156156
primitive: { topology: 'point-list' },
157157
depthStencil:{
158-
format: "depth24plus",
158+
format: 'depth24plus',
159159
depthWriteEnabled: true,
160-
depthCompare: "less"
160+
depthCompare: 'less'
161161
}
162162
})
163163

@@ -185,21 +185,22 @@ async function main() {
185185
]
186186
})
187187

188+
const depthTexture = device.createTexture({
189+
size: { width: canvas.width, height: canvas.height },
190+
format: 'depth24plus',
191+
usage: GPUTextureUsage.RENDER_ATTACHMENT
192+
})
193+
188194
requestAnimationFrame(function render(t) {
189195
requestAnimationFrame(render)
190196

191197
const commandEncoder = device.createCommandEncoder()
192198
const curTexture = context.getCurrentTexture()
193199
const textureView = curTexture.createView()
194200
const { width, height } = curTexture
195-
const depthTexture = device.createTexture({
196-
size: [width, height, 1],
197-
format: 'depth24plus',
198-
usage: GPUTextureUsage.RENDER_ATTACHMENT
199-
})
200201

201-
camera.up = [0, 0, 1]
202202
camera.tick()
203+
camera.up = [0, 0, 1]
203204
const projection = mat4.perspective(new Float32Array(16), Math.PI / 4, width / height, 1, 1000000)
204205
const view = camera.matrix
205206
const fadeHeightStart = minZ + 1200 // 2100

0 commit comments

Comments
 (0)