You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cast.bitmapData() fails to identify data that is of type ImageTexture (i.e. lines 278 and 279 are skipped) even tho in the debugger I'm seeing that data is of such type. I believe that this is because TS's instanceof operator is not as powerful as AS3's is operator and in this case is failing to identify the type.
The globe demo doesn't work because of this. Funny thing is, I've tried to identify all image datas that WOULD come into Cast.bitmapData() as ImageTexture and instead send them through this method:
private castBitmapDataCustom(data:any, forceImageTexture:boolean = false):BitmapData {
if(!forceImageTexture) {
return Cast.bitmapData(data);
}
else {
console.log("forcing from ImageTexture...");
data = ( data).htmlImageElement;
var imageElement:HTMLImageElement = data;
console.log("w: " + imageElement.width + ", h: " + imageElement.height);
var bitmapData:BitmapData = new BitmapData(imageElement.width, imageElement.height, true, 0x0);
bitmapData.draw(imageElement)
return bitmapData;
}
}
There is no error thrown this time while loading the assets, but there is one while rendering:
Uncaught TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided.
TextureWebGL line 74
Cast.bitmapData() fails to identify data that is of type ImageTexture (i.e. lines 278 and 279 are skipped) even tho in the debugger I'm seeing that data is of such type. I believe that this is because TS's instanceof operator is not as powerful as AS3's is operator and in this case is failing to identify the type.
In code:
https://github.com/awayjs/awayjs-display/blob/master/lib/utils/Cast.ts#L278
Stack Overflow comments:
http://stackoverflow.com/questions/12789231/class-type-check-with-typescript
The text was updated successfully, but these errors were encountered: