- if( reg->workshop_id ){
- vg_error( "Workshop files unsupported\n" );
- vg_async_call( pointcloud_clear_async, NULL, 0 );
- }
- else{
- char path_buf[4096];
- vg_str path;
- vg_strnull( &path, path_buf, 4096 );
- vg_strcat( &path, "maps/" );
- vg_strcat( &path, reg->foldername );
- vg_strcat( &path, "/preview.bin" );
-
- vg_linear_clear(vg_mem.scratch);
- u32 size;
-
- void *data = vg_file_read( vg_mem.scratch, path_buf, &size );
- if( data ){
- if( size < sizeof(pointcloud_buffer) ){
- vg_async_call( pointcloud_clear_async, NULL, 0 );
- return;
- }
-
- vg_async_item *call = vg_async_alloc(size);
- pointcloud_buffer *pcbuf = call->payload;
- memcpy( pcbuf, data, size );
-
- u32 point_count = (size-sizeof(pointcloud_buffer)) /
- sizeof(struct pointcloud_vert);
- pcbuf->max = point_count;
- pcbuf->count = point_count;
- pcbuf->op = k_pointcloud_op_clear;
-
- vg_async_dispatch( call, async_pointcloud_sub );
- vg_async_call( pointcloud_async_end, NULL, 0 );
- }
- else{