public static AsTexture fromAtfData(AsByteArray data, float scale) { AsContext3D context = AsStarling.getContext(); if (context == null) { throw new AsMissingContextError(); } AsAtfData atfData = new AsAtfData(data); bc.flash.display3D.textures.AsTexture nativeTexture = context.createTexture(atfData.getWidth(), atfData.getHeight(), atfData.getFormat(), false); uploadAtfData(nativeTexture, data); AsConcreteTexture concreteTexture = new AsConcreteTexture(nativeTexture, atfData.getFormat(), atfData.getWidth(), atfData.getHeight(), atfData.getNumTextures() > 1, false, false, scale); if (AsStarling.getHandleLostContext()) { concreteTexture.restoreOnLostContext(atfData); } return(concreteTexture); }
public static AsTexture fromAtfData(AsByteArray data, float scale) { AsContext3D context = AsStarling.getContext(); if(context == null) { throw new AsMissingContextError(); } AsAtfData atfData = new AsAtfData(data); bc.flash.display3D.textures.AsTexture nativeTexture = context.createTexture(atfData.getWidth(), atfData.getHeight(), atfData.getFormat(), false); uploadAtfData(nativeTexture, data); AsConcreteTexture concreteTexture = new AsConcreteTexture(nativeTexture, atfData.getFormat(), atfData.getWidth(), atfData.getHeight(), atfData.getNumTextures() > 1, false, false, scale); if(AsStarling.getHandleLostContext()) { concreteTexture.restoreOnLostContext(atfData); } return concreteTexture; }
private void onContextCreated(AsEvent _event) { AsContext3D context = AsStarling.getContext(); AsBitmapData bitmapData = mData as AsBitmapData; AsAtfData atfData = mData as AsAtfData; bc.flash.display3D.textures.AsTexture nativeTexture = null; if (bitmapData != null) { nativeTexture = context.createTexture(mWidth, mHeight, AsContext3DTextureFormat.BGRA, mOptimizedForRenderTexture); AsTexture.uploadBitmapData(nativeTexture, bitmapData, mMipMapping); } else { if (atfData != null) { nativeTexture = context.createTexture(atfData.getWidth(), atfData.getHeight(), atfData.getFormat(), mOptimizedForRenderTexture); AsTexture.uploadAtfData(nativeTexture, atfData.getData()); } } mBase = nativeTexture; }