简体   繁体   English

SVF文件未在Autodesk Forge Viewer 3D中加载

[英]SVF file not loading in Autodesk Forge Viewer 3D

I'm running into a warning message in Autodesk Forge Viewer3D. 我在Autodesk Forge Viewer3D中遇到警告消息。 Recently I updated the version of Autodesk Forge Viewer3D from 2.3 to 4.3. 最近,我将Autodesk Forge Viewer3D的版本从2.3更新到了4.3。 I have updated even the .css files and the .js files. 我已经更新了.css文件和.js文件。 But, the viewer is not loading the 3D model. 但是,查看器没有加载3D模型。 I would also like to mention all the .js and the 3D model is in my local system. 我还要提及所有.js ,而3D模型在我的本地系统中。 I have not hosted it on Autodesk Forge account. 我尚未将其托管在Autodesk Forge帐户上。

 The warning that I'm getting is: 

An LMV resource ( http://localhost/MyApplication/Models/Resource/3D_View/PSR1/CameraDefinitions.bin ) was not uncompressed by the browser. 浏览器未解压缩LMV资源( http://localhost/MyApplication/Models/Resource/3D_View/PSR1/CameraDefinitions.bin )。 This hurts performance. 这会损害性能。

If you are using offline mode, be aware of gzip compression. 如果您使用的是离线模式,请注意gzip压缩。

Typically, when a server, gives the browser the pf and bin files, these files are gzip compressed, with it's header containing 'content-type:gzip' to specify the file being served is gzip compressed. 通常,当服务器向浏览器提供pf和bin文件时,这些文件是gzip压缩的,其标头包含“ content-type:gzip”,以指定所提供的文件是gzip压缩的。 The browser sees this and natively decodes the file (in C++ land) before handing it off to the javascript engine. 浏览器会看到此情况,并在将文件交给javascript引擎之前对文件进行本地解码(在C ++领域)。

If the 'content-type:gzip' header is missing, then the browser doesn't decompress the file, and it hands the file directly to the javascript engine "as-is" (compressed). 如果缺少“ content-type:gzip”标头,则浏览器不会解压缩文件,而是将文件直接交给javascript引擎“按原样”(压缩)。

The 'Forge viewer' checks for this, and will perform the decompression in 'javascript-land' to make up for the mistake. “伪造查看器”对此进行检查,并将在“ javascript-land”中执行解压缩以弥补该错误。 Decompressing in javascript-land 'hurts performance' (especially on mobile devices). 在javascript-land上“解压缩性能”(尤其是在移动设备上)解压缩。

Since it looks like you are using local files, like file://localfolder/viewer3d.js?svf=mybuilding.svf, then try manually decompressing these pf, json and bin files (you need to add a .gz to the end of the file and then unzip each of them). 由于您似乎正在使用本地文件,例如file://localfolder/viewer3d.js?svf = mybuilding.svf,因此请尝试手动解压缩这些pf,json和bin文件(您需要在.gz的末尾添加.gz文件,然后解压缩每个文件)。 It will result in bigger files, but you won't get the warning. 这将导致更大的文件,但您不会收到警告。

Alternatively, and the recommended approach, is to create a local static server (localhost) that sets the 'content-type:gzip' header for the compressed files (PF, BIN and json). 或者,推荐的方法是创建一个本地静态服务器(localhost),该服务器为压缩文件(PF,BIN和json)设置“ content-type:gzip”标头。

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM