-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageryProvider.loadImage bug about KTX/CRN image #7979
Comments
Thanks for reporting this @progsung - it does look like a bug to me. Were you able to get it to load the KTX image by changing that line? If you want to open a pull request to fix this, that would be awesome! The contributing guide is a good place to start here: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request |
@OmarShehata This seems to be working as intended. KTX takes in a resource, url or buffer and then loads it through our Resource API. function loadKTX(resourceOrUrlOrBuffer) {
//>>includeStart('debug', pragmas.debug);
Check.defined('resourceOrUrlOrBuffer', resourceOrUrlOrBuffer);
//>>includeEnd('debug');
var loadPromise;
if (resourceOrUrlOrBuffer instanceof ArrayBuffer || ArrayBuffer.isView(resourceOrUrlOrBuffer)) {
loadPromise = when.resolve(resourceOrUrlOrBuffer);
} else {
var resource = Resource.createIfNeeded(resourceOrUrlOrBuffer);
loadPromise = resource.fetchArrayBuffer();
}
if (!defined(loadPromise)) {
return undefined;
}
return loadPromise.then(function(data) {
if (defined(data)) {
return parseKTX(data);
}
});
} Same goes for LoadCRN function loadCRN(resourceOrUrlOrBuffer) {
//>>includeStart('debug', pragmas.debug);
if (!defined(resourceOrUrlOrBuffer)) {
throw new DeveloperError('resourceOrUrlOrBuffer is required.');
}
//>>includeEnd('debug');
var loadPromise;
if (resourceOrUrlOrBuffer instanceof ArrayBuffer || ArrayBuffer.isView(resourceOrUrlOrBuffer)) {
loadPromise = when.resolve(resourceOrUrlOrBuffer);
} else {
var resource = Resource.createIfNeeded(resourceOrUrlOrBuffer);
loadPromise = resource.fetchArrayBuffer();
}
if (!defined(loadPromise)) {
return undefined;
}
return loadPromise.then(function(data) {
if (!defined(data)) {
return;
}
var transferrableObjects = [];
if (data instanceof ArrayBuffer) {
transferrableObjects.push(data);
} else if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
transferrableObjects.push(data.buffer);
} else {
// data is a view of an array buffer. need to copy so it is transferrable to web worker
data = data.slice(0, data.length);
transferrableObjects.push(data.buffer);
}
return transcodeTaskProcessor.scheduleTask(data, transferrableObjects);
}).then(function(compressedTextureBuffer) {
return CompressedTextureBuffer.clone(compressedTextureBuffer);
});
} So while passing a URL should work it is no different than what we are doing currently. Let me know if I missed anything; otherwise, we can probably close this issue. |
@ProjectBarks take another look at the issue original description and sample code. The issue here is that we are passing Resource objects to the ktxRegex and crnRegex regular expression to determine the file type, not that we are passing resources This is happening in both ImageryProvider and Material |
@mramato ahh totally missed it! Fix coming soon. |
Fixed in #8064 |
I think found a bug:
Recently I tested ktx and crn image Imagery using UrlTemplateImageryProvider.
I reviewed cesium source code and I thought it's no problem to service.
But at runtime, It's not working. So I review cesium source especially about Imagery.
And found one! at ImageryProvider.js
https://github.com/AnalyticalGraphicsInc/cesium/blob/32fc04d9e7e3b26e78ca1ca4b607091846a68c1e/Source/Scene/ImageryProvider.js#L336
I hope it can help someone.
thanks.
The text was updated successfully, but these errors were encountered: