// Class: openfl.display3D.textures.Texture

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../../hxClasses_stub").default;
var $import = require("./../../../import_stub").default;
var $extend = require("./../../../extend_stub").default;
function openfl_display3D_textures_TextureBase() {return require("./../../../openfl/display3D/textures/TextureBase");}
function openfl__$internal_stage3D_opengl_GLTexture() {return require("./../../../openfl/_internal/stage3D/opengl/GLTexture");}
function haxe_Timer() {return require("./../../../haxe/Timer");}
function openfl_events_Event() {return require("./../../../openfl/events/Event");}

// Constructor

var Texture = function(context,width,height,format,optimizeForRenderToTexture,streamingLevels) {
	(openfl_display3D_textures_TextureBase().default).call(this,context);
	this.__width = width;
	this.__height = height;
	this.__optimizeForRenderToTexture = optimizeForRenderToTexture;
	this.__streamingLevels = streamingLevels;
	(openfl__$internal_stage3D_opengl_GLTexture().default).create(this,this.__context.__renderer);
}

// Meta

Texture.__name__ = ["openfl","display3D","textures","Texture"];
Texture.__super__ = (openfl_display3D_textures_TextureBase().default);
Texture.prototype = $extend((openfl_display3D_textures_TextureBase().default).prototype, {
	uploadCompressedTextureFromByteArray: function(data,byteArrayOffset,async) {
		if(async == null) {
			async = false;
		}
		var _gthis = this;
		if(!async) {
			(openfl__$internal_stage3D_opengl_GLTexture().default).uploadCompressedTextureFromByteArray(this,this.__context.__renderer,data,byteArrayOffset);
		} else {
			(haxe_Timer().default).delay(function() {
				(openfl__$internal_stage3D_opengl_GLTexture().default).uploadCompressedTextureFromByteArray(_gthis,_gthis.__context.__renderer,data,byteArrayOffset);
				_gthis.dispatchEvent(new (openfl_events_Event().default)("textureReady"));
			},1);
		}
	},
	uploadFromBitmapData: function(source,miplevel,generateMipmap) {
		if(generateMipmap == null) {
			generateMipmap = false;
		}
		if(miplevel == null) {
			miplevel = 0;
		}
		(openfl__$internal_stage3D_opengl_GLTexture().default).uploadFromBitmapData(this,this.__context.__renderer,source,miplevel,generateMipmap);
	},
	uploadFromByteArray: function(data,byteArrayOffset,miplevel) {
		if(miplevel == null) {
			miplevel = 0;
		}
		(openfl__$internal_stage3D_opengl_GLTexture().default).uploadFromByteArray(this,this.__context.__renderer,data,byteArrayOffset,miplevel);
	},
	uploadFromTypedArray: function(data,miplevel) {
		if(miplevel == null) {
			miplevel = 0;
		}
		(openfl__$internal_stage3D_opengl_GLTexture().default).uploadFromTypedArray(this,this.__context.__renderer,data,miplevel);
	},
	__setSamplerState: function(state) {
		(openfl__$internal_stage3D_opengl_GLTexture().default).setSamplerState(this,this.__context.__renderer,state);
	}
});
Texture.prototype.__class__ = $hxClasses["openfl.display3D.textures.Texture"] = Texture;

// Init



// Statics


Texture.__lowMemoryMode = false

// Export

exports.default = Texture;