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
I have written this bunch of code to operate texture passed from WebGL.
exportclassU8_4{constructor(publicx: u8,publicy: u8,publicz: u8,publicw: u8){}}exportclassTexture{publicbaseAddress: u32=0publicwidth: u16=0publicheight: u16=0publicch: u8=0constructor(width: u16,height: u16,ch: u8){this.baseAddress=memory.allocate(<u32>(width*height*<u16>ch))this.width=widththis.height=heightthis.ch=ch//*************************************************//There are problems here//*************************************************console.logi(123456)// This logging is not called}publicgetAddressAt(i: u16,j: u16): u32{return(<u32>i*<u32>this.width+<u32>j)*<u32>this.ch}}exportclassTexture4CHextendsTexture{constructor(width: u16,height: u16){super(width,height,4)console.logi(width)console.logi(height)}publicgetAt(i: u16,j: u16): U8_4{letba: u32=this.getAddressAt(i,j)letx: u8=load<u8>(ba,0)lety: u8=load<u8>(ba,1)letz: u8=load<u8>(ba,2)letw: u8=load<u8>(ba,3)returnnewU8_4(x,y,z,w)}publicsetAt(i: u16,j: u16,col: U8_4): void{letba: u32=this.getAddressAt(i,j)store<u8>(ba,col.x,0)store<u8>(ba,col.y,1)store<u8>(ba,col.z,2)store<u8>(ba,col.w,3)}}
As you can see, I have inherited Texture class from Texture4CH. When I instanciate Texture4CH class, the super notation super(width, height, 4) seems not working as intended.
Is this intended limitation of assemblyscript?
The text was updated successfully, but these errors were encountered:
Class support is still relatively basic and when looking at the generated text format it appears that the super call is compiled incorrectly. Seems that its arguments are compiled, but just dropped instead of calling anything with them.
I haven't tried yet, but can we work around this by using a method instead of relying on constructors? F.e. an init method that you just have to remember to call, const foo = new Foo(); foo.init();.
I have written this bunch of code to operate texture passed from WebGL.
As you can see, I have inherited Texture class from Texture4CH. When I instanciate Texture4CH class, the super notation
super(width, height, 4)
seems not working as intended.Is this intended limitation of assemblyscript?
The text was updated successfully, but these errors were encountered: