異步加載并解析給定的CRN文件的URL或解析CRN文件的原始二進制數據。返回一個承諾,該承諾在加載后將解析為包含圖像緩沖區、寬度、高度和格式的對象;如果URL未能加載或分析數據失敗,則拒絕。使用xmlhttpRequest加載數據,這意味著為了向另一個來源發出請求,服務器必須啟用跨來源資源共享(cors)頭。
Parameters:
Example
// load a single URL asynchronously
bmgl.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
});
Throws
-
RuntimeError : 不支持的壓縮格式。