safecat / krpano-exp Goto Github PK
View Code? Open in Web Editor NEWSome experience about krpano.
Some experience about krpano.
在 iOS 设备中有一些 iPhone 闪退的情况,这里总结一些调优的经验,尽量提高 krpano 运行的稳定性。
在 iOS 中,所有功能都是经过调优并测试通过的,但在一些第三方应用或浏览器中,由于第三方应用的实现方式不同,可能导致一些问题,例如横纵显示错误,这是由于第三方应用的错误实现导致的。
根据本文调试前,请确认你的 krpano 已经升级到较新的版本(1.17.2+),并且确认你的闪退问题是偶然的,如果你的闪退是由某个固定操作触发的,或者固定在某个时间点触发,则并非本文描述的问题。
加载多重资源会导致更多的内存占用,可以使用下面的代码以保证在 iPhone 上只加载一套资源图片。
<image multires="true" devices="!iphone" ...>
<level tiledimagewidth="3402" tiledimageheight="3402"><cube url="..." /></level>
<level tiledimagewidth="1702" tiledimageheight="1702"><cube url="..." /></level>
<mobile><cube url="..." /></mobile>
</image>
<image devices="iphone" ...>
<cube url="..." />
</image>
对于设备的识别,如果想做的更精细,可以参考 http://krpano.com/docu/xml/#devices-notes
<memory maxmem="$LOW_VALUE" />
http://krpano.com/docu/xml/#memory
cube模式下,每一面图片的像素大小,决定了该场景的内存占用大小,计算公式为
'tile-image-width * tile-image-height * 4 / 1024 / 1024'
例如,当每一面的图片为 512 * 512 时,单张图片占用的内存为 1M 大小,六张图占用的是 6M。1024 * 1024 的全景场景,就会占用到 24M。
当使用 multires 功能时,一个场景占用的内存将会是所有资源级别的和,前面关于 multires 的 demo xml,如果在浏览器中加载,内存将会达到 330M。
在 iOS 设备(包括iPad)上,请尽量避免 tilesize > 1024 * 1024。
<display hardwarelimit="$LOW_VALUE" />
http://krpano.com/docu/xml/#display.hardwarelimit
该属性会强制限制每一面的像素大小,该属性建议和 device 属性一起使用。
<image multiresthreshold="$HIGH_VALUE">
http://krpano.com/docu/xml/#image.multiresthreshold
如果你非使用 multires 不可,那么可以降低 multires 切换的灵敏度,但是这样做在大部分场景会出现较多的马赛克。
iOS 7.0 存在一些内存泄露的问题,在 iOS 7.1 及以上的版本情况有很大改善。
全景展示的内存占用由图片的像素尺寸决定,不论是 75% 质量的 JPG 图片,还是 100%,只要其像素尺寸一样,则占用的内存大小都一样,所以降低 JPEG 质量并不能减少 krpano 的内存占用。
在 skin 或 xml中其它层 的图片也属于krpano的内存占用范围,注意它们的像素大小。
最后,当操作系统确实存在内存控制上的问题时,不论 krpano 方面如何努力,都无法完全避免此类问题。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.