loadCRN(resourceOrUrlOrBuffer) → Promise.<CompressedTextureBuffer>|undefined
异步加载并解析给定的URL到CRN文件,或者解析CRN文件的原始二进制数据。
返回一个promise,它将在加载后解析为包含图像缓冲区、宽度、高度和格式的对象,
如果URL无法加载或无法解析数据,则拒绝。数据已加载
使用XMLHttpRequest,这意味着为了向另一个源发出请求,
服务器必须启用跨源资源共享(CORS)标头。
Name | Type | Description |
---|---|---|
resourceOrUrlOrBuffer |
Resource | String | ArrayBuffer | 二进制数据或ArrayBuffer的URL。 |
Returns:
加载时将解析为请求的数据的承诺。如果
request.throttle
为真且请求的优先级不够高,则返回未定义。Throws:
-
RuntimeError :不支持压缩格式。
Example:
// load a single URL asynchronously
Cesium.loadCRN('some/url').then(function(textureData) {
var width = textureData.width;
var height = textureData.height;
var format = textureData.internalFormat;
var arrayBufferView = textureData.bufferView;
// use the data to create a texture
}).otherwise(function(error) {
// an error occurred
});