define("displayengineImpl", ["displayEngineApi", "displayEngineUtils", "PIXI", "BABYLON", "clientkernelModulesApi", "preloadjs"],
    function(displayEngineApi, displayEngineUtils, PIXI, BABYLON, clientkernelModulesApi, preloadjs) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof displayengineImpl == 'undefined') {
            var displayengineImpl = {};
        };
        displayengineImpl.Activator = function() {};
        displayengineImpl.Activator = ck_implements(displayengineImpl.Activator, clientkernelModulesApi.IModuleActivator);
        displayengineImpl.Activator.__interfaces__ = [clientkernelModulesApi.IModuleActivator];
        displayengineImpl.Activator.__name__ = ["displayengineImpl", "Activator"];
        displayengineImpl.Activator.prototype.start = function(context) {
            context.registerService(new displayengineImpl.DisplayProvider(), displayEngineApi.IDisplayProvider, null);
        };
        displayengineImpl.Activator.prototype.stop = function(context) {};
        displayengineImpl.Activator.main = function() {};
        displayengineImpl.Activator.prototype.__class__ = displayengineImpl.Activator;
        displayengineImpl.Animation = function(name, object, animDef) {
            if (name == null) name = "";
            this.loop = true;
            if (animDef.anims != null) {
                if (object.emitter != null) this.object = object.emitter;
                else this.object = object;
                this.propertiesMap = new _hcmn_.haxe_ds_StringMap();
                var v = [];
                this.propertiesMap.set("x", v);
                v;
                var v1 = [];
                this.propertiesMap.set("y", v1);
                v1;
                var _g = 0;
                var _g1;
                _g1 = _hcmn_.js_Boot.__cast(animDef.anims, Array);
                while (_g < _g1.length) {
                    var anim = _g1[_g];
                    ++_g;
                    var _g2 = anim.prop;
                    switch (_g2) {
                        case "x":
                            this.propertiesMap.get("x").push(anim);
                            break;
                        case "y":
                            this.propertiesMap.get("y").push(anim);
                            break;
                    }
                }
                if (animDef.loop != null) this.loop = animDef.loop;
            }
        };
        displayengineImpl.Animation = ck_implements(displayengineImpl.Animation, displayEngineApi.IAnimation);
        displayengineImpl.Animation.__interfaces__ = [displayEngineApi.IAnimation];
        displayengineImpl.Animation.__name__ = ["displayengineImpl", "Animation"];
        displayengineImpl.Animation.prototype.propertiesMap = null;
        displayengineImpl.Animation.prototype.object = null;
        displayengineImpl.Animation.prototype.currentTween = null;
        displayengineImpl.Animation.prototype.loop = null;
        displayengineImpl.Animation.prototype.start = function() {
            this.currentTween = displayEngineUtils.TweenX.parallel([displayEngineUtils.TweenX.serial((function($this) {
                var $r;
                var _g = []; {
                    var _g2 = 0;
                    var _g1 = $this.propertiesMap.get("x").length;
                    while (_g2 < _g1) {
                        var i = _g2++;
                        _g.push($this.createParticlesAnimation($this.object, $this.propertiesMap.get("x")[i]));
                    }
                }
                $r = _g;
                return $r;
            }(this)), null, {
                fileName: "Animation.hx",
                lineNumber: 54,
                className: "displayengine.impl.displaylist.Animation",
                methodName: "start"
            }), displayEngineUtils.TweenX.serial((function($this) {
                var $r;
                var _g11 = []; {
                    var _g3 = 0;
                    var _g21 = $this.propertiesMap.get("y").length;
                    while (_g3 < _g21) {
                        var i1 = _g3++;
                        _g11.push($this.createParticlesAnimation($this.object, $this.propertiesMap.get("y")[i1]));
                    }
                }
                $r = _g11;
                return $r;
            }(this)), null, {
                fileName: "Animation.hx",
                lineNumber: 59,
                className: "displayengine.impl.displaylist.Animation",
                methodName: "start"
            })], null, {
                fileName: "Animation.hx",
                lineNumber: 53,
                className: "displayengine.impl.displaylist.Animation",
                methodName: "start"
            }).repeat(this.loop ? 0 : 1);
        };
        displayengineImpl.Animation.prototype.stop = function() {
            this.currentTween.stop();
        };
        displayengineImpl.Animation.prototype.createParticlesAnimation = function(emitter, anim) {
            var _g = anim.prop;
            switch (_g) {
                case "x":
                    return displayEngineUtils.ChainX.x(displayEngineUtils.TweenX.to(emitter.spawnPos, null, null, null, null, null, null, null, null, null, {
                        fileName: "Animation.hx",
                        lineNumber: 74,
                        className: "displayengine.impl.displaylist.Animation",
                        methodName: "createParticlesAnimation"
                    }), anim.val).time(anim.time).ease(this.extractEase(anim.ease));
                case "y":
                    return displayEngineUtils.ChainX.y(displayEngineUtils.TweenX.to(emitter.spawnPos, null, null, null, null, null, null, null, null, null, {
                        fileName: "Animation.hx",
                        lineNumber: 77,
                        className: "displayengine.impl.displaylist.Animation",
                        methodName: "createParticlesAnimation"
                    }), anim.val).time(anim.time).ease(this.extractEase(anim.ease));
            }
            return null;
        };
        displayengineImpl.Animation.prototype.extractEase = function(tweenDef) {
            switch (tweenDef) {
                case "Linear.EaseNone":
                    return displayEngineUtils.EaseX.linear;
                case "Quadratic.EaseIn":
                    return displayEngineUtils.EaseX.quadIn;
                case "Quadratic.EaseOut":
                    return displayEngineUtils.EaseX.quadOut;
                case "Quadratic.EaseInOut":
                    return displayEngineUtils.EaseX.quadInOut;
                case "Cubic.EaseIn":
                    return displayEngineUtils.EaseX.cubicIn;
                case "Cubic.EaseOut":
                    return displayEngineUtils.EaseX.cubicOut;
                case "Cubic.EaseInOut":
                    return displayEngineUtils.EaseX.cubicInOut;
                case "Elastic.EaseIn":
                    return displayEngineUtils.EaseX.elasticIn;
                case "Elastic.EaseOut":
                    return displayEngineUtils.EaseX.elasticOut;
                case "Elastic.EaseInOut":
                    return displayEngineUtils.EaseX.elasticInOut;
                case "Back.EaseIn":
                    return displayEngineUtils.EaseX.backIn;
                case "Back.EaseOut":
                    return displayEngineUtils.EaseX.backOut;
                case "Back.EaseInOut":
                    return displayEngineUtils.EaseX.backInOut;
                case "Bounce.EaseIn":
                    return displayEngineUtils.EaseX.bounceIn;
                case "Bounce.EaseOut":
                    return displayEngineUtils.EaseX.bounceOut;
                case "Bounce.EaseInOut":
                    return displayEngineUtils.EaseX.bounceInOut;
            }
            return displayEngineUtils.EaseX.linear;
        };
        displayengineImpl.Animation.prototype.__class__ = displayengineImpl.Animation;
        displayengineImpl.PixiDisplayObject = function() {
            this.stageName = displayEngineApi.DisplayConstants.DEFAULT_STAGE;
            this._allListeners = new _hcmn_.haxe_ds_StringMap();
            this._obj = new PIXI.Container();
            this.id = displayEngineUtils.Utils.uuid();
        };
        displayengineImpl.PixiDisplayObject = ck_implements(displayengineImpl.PixiDisplayObject, displayEngineApi.IDisplayObject);
        displayengineImpl.PixiDisplayObject.__interfaces__ = [displayEngineApi.IDisplayObject];
        displayengineImpl.PixiDisplayObject.__name__ = ["displayengineImpl", "PixiDisplayObject"];
        displayengineImpl.PixiDisplayObject.prototype._allListeners = null;
        displayengineImpl.PixiDisplayObject.prototype.stageName = null;
        displayengineImpl.PixiDisplayObject.prototype._obj = null;
        displayengineImpl.PixiDisplayObject.prototype.id = null;
        displayengineImpl.PixiDisplayObject.prototype.getDisplayObject = function() {
            return this._obj;
        };
        displayengineImpl.PixiDisplayObject.prototype.isType = function(type) {
            return false;
        };
        displayengineImpl.PixiDisplayObject.prototype.getId = function() {
            return this.id;
        };
        displayengineImpl.PixiDisplayObject.prototype.getStageName = function() {
            return this.stageName;
        };
        displayengineImpl.PixiDisplayObject.prototype.getName = function() {
            return this.getDisplayObject().name;
        };
        displayengineImpl.PixiDisplayObject.prototype.setName = function(val) {
            this.id = val;
            this.getDisplayObject().id = val;
            this.getDisplayObject().name = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getPivot = function() {
            return new displayEngineApi.Point(this._obj.pivot.x, this._obj.pivot.y);
        };
        displayengineImpl.PixiDisplayObject.prototype.setPivot = function(val) {
            this._obj.pivot.set(val.x, val.y);
        };
        displayengineImpl.PixiDisplayObject.prototype.getWidth = function() {
            return this._obj.width;
        };
        displayengineImpl.PixiDisplayObject.prototype.setWidth = function(val) {
            this._obj.width = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getHeight = function() {
            return this._obj.height;
        };
        displayengineImpl.PixiDisplayObject.prototype.setHeight = function(val) {
            this._obj.height = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getAlpha = function() {
            return this._obj.alpha;
        };
        displayengineImpl.PixiDisplayObject.prototype.setAlpha = function(val) {
            this._obj.alpha = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getRotation = function() {
            return displayEngineUtils.Utils.radToDeg(this._obj.rotation);
        };
        displayengineImpl.PixiDisplayObject.prototype.setRotation = function(val) {
            this._obj.rotation = displayEngineUtils.Utils.degToRad(val);
        };
        displayengineImpl.PixiDisplayObject.prototype.getVisible = function() {
            return this._obj.visible;
        };
        displayengineImpl.PixiDisplayObject.prototype.setVisible = function(val) {
            this._obj.visible = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getX = function() {
            return this._obj.x;
        };
        displayengineImpl.PixiDisplayObject.prototype.setX = function(val) {
            if (this.getUserData().isLabel == true) this._obj.x = val | 0;
            else this._obj.x = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getY = function() {
            return this._obj.y;
        };
        displayengineImpl.PixiDisplayObject.prototype.setY = function(val) {
            if (this.getUserData().isLabel == true) this._obj.y = val | 0;
            else this._obj.y = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getScaleX = function() {
            return this._obj.scale.x;
        };
        displayengineImpl.PixiDisplayObject.prototype.setScaleX = function(val) {
            this._obj.scale.x = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getScaleY = function() {
            return this._obj.scale.y;
        };
        displayengineImpl.PixiDisplayObject.prototype.setScaleY = function(val) {
            this._obj.scale.y = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getCursor = function() {
            return this._obj.defaultCursor;
        };
        displayengineImpl.PixiDisplayObject.prototype.setCursor = function(val) {
            this._obj.defaultCursor = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getButtonMode = function() {
            return this._obj.buttonMode;
        };
        displayengineImpl.PixiDisplayObject.prototype.setButtonMode = function(val) {
            this._obj.buttonMode = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getMask = function() {
            return this._obj.mask;
        };
        displayengineImpl.PixiDisplayObject.prototype.setMask = function(val) {
            if (val == null) {
                if (this._obj.mask != null) this._obj.removeChild(this._obj.mask);
                this._obj.mask = null;
                return;
            }
            this._obj.addChild((_hcmn_.js_Boot.__cast(val, displayengineImpl.Graphics)).getDisplayObject());
            this._obj.mask = (_hcmn_.js_Boot.__cast(val, displayengineImpl.Graphics)).getDisplayObject();
        };
        displayengineImpl.PixiDisplayObject.prototype.getHitArea = function() {
            return this._obj.hitArea;
        };
        displayengineImpl.PixiDisplayObject.prototype.setHitArea = function(val) {
            var pixiHitArea = new PIXI.Polygon(val);
            this._obj.hitArea = pixiHitArea;
        };
        displayengineImpl.PixiDisplayObject.prototype.getMouseEnabled = function() {
            return this._obj.interactive;
        };
        displayengineImpl.PixiDisplayObject.prototype.setMouseEnabled = function(val) {
            this._obj.interactive = val;
        };
        displayengineImpl.PixiDisplayObject.prototype.getParent = function() {
            if (this._obj != null && this._obj.parent != null && this._obj.parent.isStage == true) return displayengineImpl.DisplayProvider.stages.get(this.stageName);
            if (this._obj != null) {
                if (this._obj._parent != null) return this._obj._parent;
            }
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.setCacheAsBitmap = function(val) {
            if (displayengineImpl.DisplayProvider.stages.exists(this.stageName)) {
                if (displayengineImpl.DisplayProvider.stages.get(this.stageName).getRendererType() != displayEngineApi.RendererType.RENDERER_WEBGL) this._obj.cacheAsBitmap = val;
            }
        };
        displayengineImpl.PixiDisplayObject.prototype.getCacheAsBitmap = function() {
            return this._obj.cacheAsBitmap;
        };
        displayengineImpl.PixiDisplayObject.prototype.updateCache = function() {
            if (displayengineImpl.DisplayProvider.stages.exists(this.stageName)) {
                if (displayengineImpl.DisplayProvider.stages.get(this.stageName).getRendererType() != displayEngineApi.RendererType.RENDERER_WEBGL) {}
            }
        };
        displayengineImpl.PixiDisplayObject.prototype.getBounds = function() {
            var pixiRect = this.getDisplayObject().getBounds();
            return new displayEngineApi.Rectangle(pixiRect.x, pixiRect.y, pixiRect.width, pixiRect.height);
        };
        displayengineImpl.PixiDisplayObject.prototype.setBounds = function(x, y, width, height) {};
        displayengineImpl.PixiDisplayObject.prototype.globalToLocal = function(x, y) {
            var point = new displayEngineApi.Point(x, y);
            return this.getDisplayObject().toLocal(point);
        };
        displayengineImpl.PixiDisplayObject.prototype.localToGlobal = function(x, y) {
            var point = new displayEngineApi.Point(x, y);
            return this.getDisplayObject().toGlobal(point);
        };
        displayengineImpl.PixiDisplayObject.prototype.addEventListener = function(type, listener, useCapture) {
            var _g = this;
            this._obj.interactive = true;
            if (this._allListeners.exists(type)) this._allListeners.get(type).push(listener);
            else {
                var v = [];
                this._allListeners.set(type, v);
                v;
                this._allListeners.get(type).push(listener);
            }
            if (!Object.prototype.hasOwnProperty.call(this._obj, type)) this._obj[type] = function(evt) {
                if (_g._allListeners.get(type) != null) {
                    var _g1 = 0;
                    var _g2 = _g._allListeners.get(type);
                    while (_g1 < _g2.length) {
                        var fn = _g2[_g1];
                        ++_g1;
                        fn(evt);
                    }
                }
            };
        };
        displayengineImpl.PixiDisplayObject.prototype.removeEventListener = function(type, listener, useCapture) {
            var $it0 = this._allListeners.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (key == type) {
                    var _this = this._allListeners.get(key);
                    var x = listener;
                    _hcmn_.HxOverrides.remove(_this, x);
                    return;
                }
            }
        };
        displayengineImpl.PixiDisplayObject.prototype.dispose = function() {
            this._allListeners = null;
            if (this.getParent() != null) {
                if (this.getParent().removeChild != null) this.getParent().removeChild(this);
            }
            this._obj = null;
        };
        displayengineImpl.PixiDisplayObject.prototype.getUserData = function() {
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.isDraggable = function() {
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.setDraggable = function(val) {};
        displayengineImpl.PixiDisplayObject.prototype.getDragBounds = function() {
            return null;
        };
        displayengineImpl.PixiDisplayObject.prototype.setDragBounds = function(val) {};
        displayengineImpl.PixiDisplayObject.prototype.on = function(type, listener, useCapture) {};
        displayengineImpl.PixiDisplayObject.prototype.onAddedToStage = function(handler) {};
        displayengineImpl.PixiDisplayObject.prototype.off = function(type, listener, useCapture) {};
        displayengineImpl.PixiDisplayObject.prototype.setScale = function(factor) {};
        displayengineImpl.PixiDisplayObject.prototype.setPos = function(x, y) {};
        displayengineImpl.PixiDisplayObject.prototype.setDim = function(width, height) {};
        displayengineImpl.PixiDisplayObject.prototype.getZIndex = function() {
            return -1;
        };
        displayengineImpl.PixiDisplayObject.prototype.setZIndex = function(zIndex) {};
        displayengineImpl.PixiDisplayObject.prototype.getZOrder = function() {
            return -1;
        };
        displayengineImpl.PixiDisplayObject.prototype.setZOrder = function(value) {};
        displayengineImpl.PixiDisplayObject.prototype.bringToTop = function() {};
        displayengineImpl.PixiDisplayObject.prototype.sendToBottom = function() {};
        displayengineImpl.PixiDisplayObject.prototype.__class__ = displayengineImpl.PixiDisplayObject;
        displayengineImpl.DisplayObject = function() {
            this.zIndex = -1;
            this._onDragHandlers = [];
            this._draggable = false;
            this.userData = {};
            displayengineImpl.PixiDisplayObject.call(this);
            this._obj._owner = this;
            this.setDisplayType();
        };
        displayengineImpl.DisplayObject = ck_implements(displayengineImpl.DisplayObject, displayEngineApi.IDisplayObject);
        displayengineImpl.DisplayObject.__interfaces__ = [displayEngineApi.IDisplayObject];
        displayengineImpl.DisplayObject.__name__ = ["displayengineImpl", "DisplayObject"];
        displayengineImpl.DisplayObject.__super__ = displayengineImpl.PixiDisplayObject;
        for (var k in displayengineImpl.PixiDisplayObject.prototype) displayengineImpl.DisplayObject.prototype[k] = displayengineImpl.PixiDisplayObject.prototype[k];
        displayengineImpl.DisplayObject.prototype.userData = null;
        displayengineImpl.DisplayObject.prototype._dragBounds = null;
        displayengineImpl.DisplayObject.prototype.__onDrag = null;
        displayengineImpl.DisplayObject.prototype.__dragOffset = null;
        displayengineImpl.DisplayObject.prototype._draggable = null;
        displayengineImpl.DisplayObject.prototype._onDragHandlers = null;
        displayengineImpl.DisplayObject.prototype.displayType = null;
        displayengineImpl.DisplayObject.prototype.displayObjectEvents = null;
        displayengineImpl.DisplayObject.prototype.zIndex = null;
        displayengineImpl.DisplayObject.prototype._onAddedToStage = null;
        displayengineImpl.DisplayObject.prototype.setDisplayType = function() {
            if (this.displayType == null) this.displayType = [];
            this.displayType.push(displayEngineApi.DisplayType.DISPLAY_OBJECT);
        };
        displayengineImpl.DisplayObject.prototype.isType = function(type) {
            var _g1 = 0;
            var _g = this.displayType.length;
            while (_g1 < _g) {
                var i = _g1++;
                if (_hcmn_.Std.string(type) == _hcmn_.Std.string(this.displayType[i])) return true;
            }
            return false;
        };
        displayengineImpl.DisplayObject.prototype.getUserData = function() {
            return this.userData;
        };
        displayengineImpl.DisplayObject.prototype.isDraggable = function() {
            return this._draggable;
        };
        displayengineImpl.DisplayObject.prototype.setDraggable = function(val) {
            this._draggable = val;
            if (val) this.addEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_DOWN, $bind(this, this.onMouseDown_DRAG));
            else this.removeEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_DOWN, $bind(this, this.onMouseDown_DRAG));
        };
        displayengineImpl.DisplayObject.prototype.getDisplayObject = function() {
            return this._obj;
        };
        displayengineImpl.DisplayObject.prototype.getDragBounds = function() {
            return this._dragBounds;
        };
        displayengineImpl.DisplayObject.prototype.setDragBounds = function(val) {
            if (val.x > val.w) {
                var _temp = val.w;
                val.w = val.x;
                val.x = _temp;
            }
            if (val.y > val.h) {
                var _temp1 = val.h;
                val.h = val.y;
                val.y = _temp1;
            }
            this._dragBounds = val;
        };
        displayengineImpl.DisplayObject.prototype.onMouseDown_DRAG = function(evt) {
            this.__dragOffset = new displayEngineApi.Point(this._obj.x - displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).x, this._obj.y - displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).y);
            displayengineImpl.DisplayProvider.stages.get(this.stageName).getCanvas().addEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.onMouseUp_DRAG));
            this.addEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_MOVE, $bind(this, this.onMouseMove_DRAG));
        };
        displayengineImpl.DisplayObject.prototype.onMouseUp_DRAG = function(evt) {
            displayengineImpl.DisplayProvider.stages.get(this.stageName).getCanvas().removeEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.onMouseUp_DRAG));
            this.removeEventListener(displayEngineApi.DisplayObjectEvents.MOUSE_MOVE, $bind(this, this.onMouseMove_DRAG));
        };
        displayengineImpl.DisplayObject.prototype.onMouseMove_DRAG = function(evt) {
            if (this._draggable) {
                this.setX(displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).x + this.__dragOffset.x);
                this.setY(displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse(evt).y + this.__dragOffset.y);
                if (this._dragBounds != null) {
                    if (this._obj.x < this._dragBounds.x) {
                        if (this.getUserData().isLabel == true) this._obj.x = val | 0;
                        else this._obj.x = this._dragBounds.x;
                    }
                    if (this._obj.y < this._dragBounds.y) {
                        if (this.getUserData().isLabel == true) this._obj.y = val | 0;
                        else this._obj.y = this._dragBounds.y;
                    }
                    if (this._obj.x > this._dragBounds.w) {
                        if (this.getUserData().isLabel == true) this._obj.x = val | 0;
                        else this._obj.x = this._dragBounds.w;
                    }
                    if (this._obj.y > this._dragBounds.h) {
                        if (this.getUserData().isLabel == true) this._obj.y = val | 0;
                        else this._obj.y = this._dragBounds.h;
                    }
                }
                if (this.__onDrag != null) this.__onDrag(evt);
                var _g = 0;
                var _g1 = this._onDragHandlers;
                while (_g < _g1.length) {
                    var f = _g1[_g];
                    ++_g;
                    f();
                }
            }
        };
        displayengineImpl.DisplayObject.prototype.addEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_DRAG) {
                this.__onDrag = listener;
                return;
            }
            displayengineImpl.PixiDisplayObject.prototype.addEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.removeEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_DRAG) {
                this.__onDrag = null;
                return;
            }
            displayengineImpl.PixiDisplayObject.prototype.removeEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.on = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL) this.addBrowserSpecificEventListener(type, listener, useCapture);
            else this.addEventListener(type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.onAddedToStage = function(handler) {
            this._onAddedToStage = handler;
        };
        displayengineImpl.DisplayObject.prototype.addBrowserSpecificEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL)
                if (window.navigator.userAgent.toLowerCase().indexOf("firefox") == -1) type = "mousewheel";
                else type = "DOMMouseScroll";
            window.document.addEventListener(type, listener);
        };
        displayengineImpl.DisplayObject.prototype.removeBrowserSpecificEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL)
                if (window.navigator.userAgent.toLowerCase().indexOf("firefox") == -1) type = "mousewheel";
                else type = "DOMMouseScroll";
            window.document.removeEventListener(type, listener);
        };
        displayengineImpl.DisplayObject.prototype.off = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.MOUSE_WHEEL) this.removeBrowserSpecificEventListener(type, listener, useCapture);
            else this.removeEventListener(type, listener, useCapture);
        };
        displayengineImpl.DisplayObject.prototype.addDragHandler = function(f) {
            this._onDragHandlers.push(f);
        };
        displayengineImpl.DisplayObject.prototype.setScale = function(factor) {
            this._obj.scale.x = this._obj.scale.y = factor;
        };
        displayengineImpl.DisplayObject.prototype.setPos = function(x, y) {
            this._obj.x = x;
            this._obj.y = y;
        };
        displayengineImpl.DisplayObject.prototype.setDim = function(width, height) {
            this._obj.width = width;
            this._obj.height = height;
        };
        displayengineImpl.DisplayObject.prototype.bringToTop = function() {
            this._obj.parent.setChildIndex(this._obj, this._obj.parent.children.length - 1);
        };
        displayengineImpl.DisplayObject.prototype.sendToBottom = function() {
            this._obj.parent.setChildIndex(this._obj, 0);
        };
        displayengineImpl.DisplayObject.prototype.getZOrder = function() {
            return this._obj.parent.getChildIndex(this._obj);
        };
        displayengineImpl.DisplayObject.prototype.setZOrder = function(value) {
            if (this.getParent() == null) return;
            if (value < 0) value = 0;
            if (value > this._obj.parent.children.length - 1) value = this._obj.parent.children.length - 1 | 0;
            this._obj.parent.setChildIndex(this._obj, value);
        };
        displayengineImpl.DisplayObject.prototype.getZIndex = function() {
            return this.zIndex;
        };
        displayengineImpl.DisplayObject.prototype.setZIndex = function(value) {
            this.zIndex = value;
            if (this.getParent() != null) {
                var allChildren = this.getParent().children;
                var sortedChildren = [];
                var lowestZIndex = 0;
                var count = 0;
                var allC = allChildren;
                var $it0 = allC.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    var c;
                    c = _hcmn_.__map_reserved[key] != null ? allC.getReserved(key) : allC.h[key];
                    sortedChildren.push(c);
                    if (count++ == 0) lowestZIndex = this.getParent().getChildIndex(_hcmn_.__map_reserved[key] != null ? allC.getReserved(key) : allC.h[key]);
                    else {
                        var currZIndex = this.getParent().getChildIndex(_hcmn_.__map_reserved[key] != null ? allC.getReserved(key) : allC.h[key]);
                        if (currZIndex < lowestZIndex) lowestZIndex = currZIndex;
                    }
                }
                sortedChildren.sort(function(a, b) {
                    return a.getZIndex() - b.getZIndex();
                });
                var _g1 = 0;
                var _g = sortedChildren.length;
                while (_g1 < _g) {
                    var i = _g1++;
                    sortedChildren[i]._setZIndex(lowestZIndex + i | 0);
                }
            }
        };
        displayengineImpl.DisplayObject.prototype._getZIndex = function() {
            if (this.getParent() != null) {
                if (this.getParent().getCanvas == null) return this.getParent().children.indexOf(this._obj);
                else return this.getParent().getChildIndex(this);
            } else if (this.parent != null) return this.parent.getChildIndex(this);
            return -1;
        };
        displayengineImpl.DisplayObject.prototype._setZIndex = function(zIndex) {
            if (this.getParent() != null) {
                if (this.getParent().getCanvas == null) this.getParent().setChildIndex(this._obj, zIndex);
                else this.getParent().setChildIndex(this, zIndex);
            }
        };
        displayengineImpl.DisplayObject.prototype.dispose = function() {
            this.userData = null;
            displayengineImpl.PixiDisplayObject.prototype.dispose.call(this);
        };
        displayengineImpl.DisplayObject.prototype.__class__ = displayengineImpl.DisplayObject;
        displayengineImpl.PixiBitmap = function(image, offset) {
            this.offscreenStage = null;
            this._imgUrl = "";
            this.type = "bitmap";
            var _g = this;
            displayengineImpl.DisplayObject.call(this);
            this._offset = offset;
            if (typeof(image) == "string" && (offset.w > 0 && offset.h > 0)) {
                var _this = window.document;
                this._image = _this.createElement("canvas");
                this._image.width = offset.w;
                this._image.height = offset.h;
                this.ctx = this._image.getContext("2d");
                this.ctx.scale(2, 2);
                this.imgData = this.ctx.getImageData(0, 0, offset.w / 2, offset.h / 2);
                this.ctx.fillStyle = image;
                this.ctx.fillRect(0, 0, offset.w / 2, offset.h / 2);
                var _bTexture = new PIXI.BaseTexture(this._image, PIXI.SCALE_MODES.LINEAR);
                this._texture = new PIXI.Texture(_bTexture);
            } else {
                if (Object.prototype.hasOwnProperty.call(image, "_stage") || _hcmn_.js_Boot.__instanceof(image, displayengineImpl.OffscreenStage)) {
                    this.offscreenStage = _hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage);
                    if (this.offscreenStage.getMaskedCanvas() != null) this._image = (_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).getMaskedCanvas();
                    else this._image = (_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).getCanvas();
                } else {
                    if (image.src != null) {
                        this._imgUrl = _hcmn_.Std.string(image.src) + "";
                        if (!displayengineImpl.PixiBitmap._imageBuffer.exists(this._imgUrl)) {
                            var value = image;
                            displayengineImpl.PixiBitmap._imageBuffer.set(this._imgUrl, value);
                            displayengineImpl.PixiBitmap.totalSourceImageCount.push({
                                url: image.src,
                                size: _hcmn_.Std.string(image.width) + "x" + _hcmn_.Std.string(image.height)
                            });
                        }
                    } else if (_hcmn_.js_Boot.__instanceof(image, HTMLCanvasElement) && (_hcmn_.js_Boot.__cast(image, HTMLCanvasElement)).getAttribute("__DEStage3D__") == "true") this._image = image;
                    if (displayengineImpl.PixiBitmap._imageBuffer.exists(this._imgUrl)) this._image = displayengineImpl.PixiBitmap._imageBuffer.get(this._imgUrl);
                    else this._image = image;
                }
                var _bTexture1 = null;
                var _tex = null;
                if (offset != null) this._off = new PIXI.Rectangle(offset.x, offset.y, offset.w, offset.h);
                else this._off = null;
                if (image != null && image.src != null) {
                    if (!(function($this) {
                            var $r;
                            var key = image.src;
                            $r = displayengineImpl.PixiBitmap._textures.exists(key);
                            return $r;
                        }(this))) {
                        _bTexture1 = new PIXI.BaseTexture(this._image, PIXI.SCALE_MODES.LINEAR);
                        _tex = new PIXI.Texture(_bTexture1, this._off);
                        var key1 = image.src;
                        displayengineImpl.PixiBitmap._textures.set(key1, _tex);
                    } else _tex = new PIXI.Texture((function($this) {
                        var $r;
                        var key2 = image.src;
                        $r = displayengineImpl.PixiBitmap._textures.get(key2);
                        return $r;
                    }(this)), this._off);
                } else {
                    _bTexture1 = new PIXI.BaseTexture(this._image, PIXI.SCALE_MODES.LINEAR);
                    _tex = new PIXI.Texture(_bTexture1, this._off);
                }
                this._texture = _tex;
                if (_hcmn_.js_Boot.__instanceof(image, displayengineImpl.OffscreenStage))(_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).addBitmapChild(this);
            }
            this._texture.baseTexture.scaleMode = PIXI.SCALE_MODES.LINEAR;
            this._obj = new PIXI.Sprite(this._texture);
            try {
                var stage;
                var key3 = this.getStageName();
                stage = displayengineImpl.DisplayProvider.stages.get(key3);
                if (stage != null && stage.getRendererType() == displayEngineApi.RendererType.RENDERER_WEBGL) {
                    if (_hcmn_.js_Boot.__instanceof(image, displayengineImpl.OffscreenStage))(_hcmn_.js_Boot.__cast(image, displayengineImpl.OffscreenStage)).getStage().on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, function() {
                        _g._texture.update();
                    });
                }
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
                null;
            }
        };
        displayengineImpl.PixiBitmap = ck_implements(displayengineImpl.PixiBitmap, displayEngineApi.IBitmap);
        displayengineImpl.PixiBitmap.__interfaces__ = [displayEngineApi.IBitmap];
        displayengineImpl.PixiBitmap.__name__ = ["displayengineImpl", "PixiBitmap"];
        displayengineImpl.PixiBitmap.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.PixiBitmap.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.PixiBitmap.prototype.type = null;
        displayengineImpl.PixiBitmap.prototype._imgUrl = null;
        displayengineImpl.PixiBitmap.prototype._image = null;
        displayengineImpl.PixiBitmap.prototype._texture = null;
        displayengineImpl.PixiBitmap.prototype._offset = null;
        displayengineImpl.PixiBitmap.prototype._off = null;
        displayengineImpl.PixiBitmap.prototype.imgData = null;
        displayengineImpl.PixiBitmap.prototype.ctx = null;
        displayengineImpl.PixiBitmap.prototype.offscreenStage = null;
        displayengineImpl.PixiBitmap.prototype.setWebGL = function() {
            ((function($this) {
                var $r;
                var key = $this.getStageName();
                $r = displayengineImpl.DisplayProvider.stages.get(key);
                return $r;
            }(this))).on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.webGLUpdate));
        };
        displayengineImpl.PixiBitmap.prototype.webGLUpdate = function(e) {
            this._texture.update();
        };
        displayengineImpl.PixiBitmap.prototype.getInfo = function() {
            return null;
        };
        displayengineImpl.PixiBitmap.prototype.clone = function(filter) {
            var newBmp = null;
            if (filter != null) {
                if (filter.tint != null) {
                    var tint;
                    var _this = window.document;
                    tint = _this.createElement("canvas");
                    tint.width = this._obj.width | 0;
                    tint.height = this._obj.height | 0;
                    var tintCtx = tint.getContext("2d", null);
                    tintCtx.fillStyle = filter.tint;
                    tintCtx.fillRect(0, 0, tint.width, tint.width);
                    tintCtx.globalCompositeOperation = "destination-atop";
                    if (typeof(this._image) == "string") {
                        var imgg;
                        var _this1 = window.document;
                        imgg = _this1.createElement("img");
                        imgg.src = this._image;
                        tintCtx.drawImage(imgg, 0, 0);
                    } else tintCtx.drawImage(this._image, 0, 0);
                    var img;
                    var _this2 = window.document;
                    img = _this2.createElement("img");
                    img.src = tint.toDataURL("image/png");
                    tintCtx.clearRect(0, 0, tint.width, tint.height);
                    tintCtx.drawImage(img, 0, 0);
                    tintCtx.globalAlpha = 0.5;
                    tintCtx.drawImage(tint, 0, 0);
                    newBmp = new displayengineImpl.PixiBitmap(tint, this._offset);
                }
            } else newBmp = new displayengineImpl.PixiBitmap(this._image, this._offset);
            if (newBmp != null) {
                if (newBmp.getUserData().isLabel == true) newBmp._obj.x = val | 0;
                else newBmp._obj.x = this._obj.x;
                if (newBmp.getUserData().isLabel == true) newBmp._obj.y = val | 0;
                else newBmp._obj.y = this._obj.y;
                newBmp._obj.alpha = this._obj.alpha;
                newBmp.setRotation(displayEngineUtils.Utils.radToDeg(this._obj.rotation));
                newBmp.setDraggable(this.isDraggable());
            }
            return newBmp;
        };
        displayengineImpl.PixiBitmap.prototype.update = function(c, width, height) {
            var _w = width | 0;
            var _h = _hcmn_.Std["int"](height);
            var _baseTexture = PIXI.BaseTexture.fromCanvas(c, PIXI.SCALE_MODES.LINEAR);
            _baseTexture.update();
            var tex = new PIXI.Texture(_baseTexture, this._off);
            (_hcmn_.js_Boot.__cast(this._obj, PIXI.Sprite)).texture = tex;
            if (displayengineImpl.DisplayProvider.stages.exists(this.stageName)) {
                if (displayengineImpl.DisplayProvider.stages.get(this.stageName).getRendererType() == displayEngineApi.RendererType.RENDERER_WEBGL) {
                    this._obj.width = _w;
                    this._obj.height = _h + 1;
                } else {}
            }
        };
        displayengineImpl.PixiBitmap.prototype.renderNoise = function(r, g, b, a) {};
        displayengineImpl.PixiBitmap.prototype.getFiltered = function(filter, params) {
            return null;
        };
        displayengineImpl.PixiBitmap.prototype.dispose = function() {
            if (this.getUserData().webGL)((function($this) {
                var $r;
                var key = $this.getStageName();
                $r = displayengineImpl.DisplayProvider.stages.get(key);
                return $r;
            }(this))).off(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.webGLUpdate));
            displayengineImpl.DisplayObject.prototype.dispose.call(this);
            this._obj = null;
            this._image = null;
            this._imgUrl = null;
            this._texture = null;
            this._offset = null;
            this.imgData = null;
            this.ctx = null;
            this.offscreenStage = null;
        };
        displayengineImpl.PixiBitmap.prototype.__class__ = displayengineImpl.PixiBitmap;
        displayengineImpl.Bitmap = function(image, offset) {
            this.t = 0;
            if (typeof(image) == "string" && (offset.w > 0 && offset.h > 0)) this.perlinNoise = new displayengine.impl.displaylist.Perlin();
            displayengineImpl.PixiBitmap.call(this, image, offset);
            displayengineImpl.Bitmap.bmpCount++;
        };
        displayengineImpl.Bitmap = ck_implements(displayengineImpl.Bitmap, displayEngineApi.IBitmap);
        displayengineImpl.Bitmap.__interfaces__ = [displayEngineApi.IBitmap];
        displayengineImpl.Bitmap.__name__ = ["displayengineImpl", "Bitmap"];
        displayengineImpl.Bitmap.__super__ = displayengineImpl.PixiBitmap;
        for (var k in displayengineImpl.PixiBitmap.prototype) displayengineImpl.Bitmap.prototype[k] = displayengineImpl.PixiBitmap.prototype[k];
        displayengineImpl.Bitmap.prototype.perlinNoise = null;
        displayengineImpl.Bitmap.prototype.t = null;
        displayengineImpl.Bitmap.prototype.getFiltered = function(filter, params) {
            var oStage = new displayengineImpl.OffscreenStage(this._obj.width, this._obj.height, null, displayEngineApi.TimingMode.ONCE);
            var ctx;
            var _this = oStage.getCanvas();
            ctx = _this.getContext("2d", null);
            ctx.drawImage(this._image, 0, 0);
            oStage.applyFilter(filter, params);
            var img = new Image();
            img.src = oStage.getCanvas().toDataURL();
            oStage.dispose();
            return new displayengineImpl.Bitmap(img);
        };
        displayengineImpl.Bitmap.prototype.setDisplayType = function() {
            displayengineImpl.PixiBitmap.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.BITMAP);
        };
        displayengineImpl.Bitmap.prototype.clone = function(filter) {
            displayengineImpl.Bitmap.bmpCount++;
            return displayengineImpl.PixiBitmap.prototype.clone.call(this, filter);
        };
        displayengineImpl.Bitmap.prototype.renderNoise = function(r, g, b, a) {
            var count = this._image.width / 2 | 0;
            var _g = 0;
            while (_g < count) {
                var x = _g++;
                var _g1 = 0;
                while (_g1 < count) {
                    var y = _g1++;
                    var _r = this.perlinNoise.noise3d(x / r.size, y / r.size, this.t / 16, null, null, null, null) * 0.5 + 0.5;
                    var _g2 = this.perlinNoise.noise3d(x / g.size, y / g.size, this.t / 16, null, null, null, null) * 0.5 + 0.5;
                    var _b = this.perlinNoise.noise3d(x / b.size, y / b.size, this.t / 16, null, null, null, null) * 0.5 + 0.5;
                    this.imgData.data[(x + y * count) * 4] = _r * r.strength;
                    this.imgData.data[(x + y * count) * 4 + 1] = _g2 * r.strength;
                    this.imgData.data[(x + y * count) * 4 + 2] = _b * r.strength;
                    this.imgData.data[(x + y * count) * 4 + 3] = a;
                }
            }
            this.t++;
            this.ctx.putImageData(this.imgData, 0, 0);
            this.ctx.drawImage(this._image, 0, 0, count * 2, count * 2);
            this.update(this._image, this._image.width, this._image.height);
        };
        displayengineImpl.Bitmap.prototype.dispose = function() {
            displayengineImpl.PixiBitmap.prototype.dispose.call(this);
            displayengineImpl.Bitmap.bmpCount--;
        };
        displayengineImpl.Bitmap.prototype.__class__ = displayengineImpl.Bitmap;
        if (typeof displayengine == 'undefined') {
            var displayengine = {};
        };
        if (!displayengine.impl) {
            displayengine.impl = {};
        };
        if (!displayengine.impl.displaylist) {
            displayengine.impl.displaylist = {};
        };
        displayengine.impl.displaylist.Gradient = function(x, y, z) {
            this.x = x;
            this.y = y;
            this.z = z;
        };
        displayengine.impl.displaylist.Gradient.__name__ = ["displayengine", "impl", "displaylist", "Gradient"];
        displayengine.impl.displaylist.Gradient.prototype.x = null;
        displayengine.impl.displaylist.Gradient.prototype.y = null;
        displayengine.impl.displaylist.Gradient.prototype.z = null;
        displayengine.impl.displaylist.Gradient.prototype.dot2 = function(x, y) {
            return this.x * x + this.y * y;
        };
        displayengine.impl.displaylist.Gradient.prototype.dot3 = function(x, y, z) {
            return this.x * x + this.y * y + this.z * z;
        };
        displayengine.impl.displaylist.Gradient.prototype.__class__ = displayengine.impl.displaylist.Gradient;
        displayengine.impl.displaylist.Perlin = function(seed) {
            this.perm = [];
            this.gradP = [];
            var _g = 0;
            while (_g < 512) {
                var i = _g++;
                this.perm.push(0);
                this.gradP.push(null);
            }
            if (seed == null) seed = _hcmn_.Std["int"](_hcmn_.Math.random() * 65536);
            seed %= 65536;
            if (seed < 256) seed |= seed << 8;
            var v;
            var _g1 = 0;
            while (_g1 < 256) {
                var i1 = _g1++;
                if ((i1 & 1) == 1) v = displayengine.impl.displaylist.Perlin.P[i1] ^ seed & 255;
                else v = displayengine.impl.displaylist.Perlin.P[i1] ^ seed >> 8 & 255;
                this.perm[i1] = this.perm[i1 + 256] = v;
                this.gradP[i1] = this.gradP[i1 + 256] = displayengine.impl.displaylist.Perlin.GRAD3[v % 12];
            }
        };
        displayengine.impl.displaylist.Perlin.__name__ = ["displayengine", "impl", "displaylist", "Perlin"];
        displayengine.impl.displaylist.Perlin.prototype.perm = null;
        displayengine.impl.displaylist.Perlin.prototype.gradP = null;
        displayengine.impl.displaylist.Perlin.prototype.fade = function(t) {
            return t * t * t * (t * (t * 6 - 15) + 10);
        };
        displayengine.impl.displaylist.Perlin.prototype.lerp = function(a, b, t) {
            return (1 - t) * a + t * b;
        };
        displayengine.impl.displaylist.Perlin.prototype.n2d = function(x, y) {
            var X = _hcmn_.Math.floor(x);
            var Y = _hcmn_.Math.floor(y);
            x = x - X;
            y = y - Y;
            X = X & 255;
            Y = Y & 255;
            var n00 = this.gradP[X + this.perm[Y]].dot2(x, y);
            var n01 = this.gradP[X + this.perm[Y + 1]].dot2(x, y - 1);
            var n10 = this.gradP[X + 1 + this.perm[Y]].dot2(x - 1, y);
            var n11 = this.gradP[X + 1 + this.perm[Y + 1]].dot2(x - 1, y - 1);
            var u = this.fade(x);
            var result = this.lerp(this.lerp(n00, n10, u), this.lerp(n01, n11, u), this.fade(y));
            return result / (_hcmn_.Math.sqrt(2) * 0.5);
        };
        displayengine.impl.displaylist.Perlin.prototype.n3d = function(x, y, z) {
            var X = _hcmn_.Math.floor(x);
            var Y = _hcmn_.Math.floor(y);
            var Z = _hcmn_.Math.floor(z);
            x = x - X;
            y = y - Y;
            z = z - Z;
            X = X & 255;
            Y = Y & 255;
            Z = Z & 255;
            var n000 = this.gradP[X + this.perm[Y + this.perm[Z]]].dot3(x, y, z);
            var n001 = this.gradP[X + this.perm[Y + this.perm[Z + 1]]].dot3(x, y, z - 1);
            var n010 = this.gradP[X + this.perm[Y + 1 + this.perm[Z]]].dot3(x, y - 1, z);
            var n011 = this.gradP[X + this.perm[Y + 1 + this.perm[Z + 1]]].dot3(x, y - 1, z - 1);
            var n100 = this.gradP[X + 1 + this.perm[Y + this.perm[Z]]].dot3(x - 1, y, z);
            var n101 = this.gradP[X + 1 + this.perm[Y + this.perm[Z + 1]]].dot3(x - 1, y, z - 1);
            var n110 = this.gradP[X + 1 + this.perm[Y + 1 + this.perm[Z]]].dot3(x - 1, y - 1, z);
            var n111 = this.gradP[X + 1 + this.perm[Y + 1 + this.perm[Z + 1]]].dot3(x - 1, y - 1, z - 1);
            var u = this.fade(x);
            var v = this.fade(y);
            var w = this.fade(z);
            var result = this.lerp(this.lerp(this.lerp(n000, n100, u), this.lerp(n001, n101, u), w), this.lerp(this.lerp(n010, n110, u), this.lerp(n011, n111, u), w), v);
            return result / (_hcmn_.Math.sqrt(3) * 0.5);
        };
        displayengine.impl.displaylist.Perlin.prototype.noise2d = function(x, y, octaves, amplitude, persistence, lacunarity) {
            if (lacunarity == null) lacunarity = 2;
            if (persistence == null) persistence = 0.9;
            if (amplitude == null) amplitude = 1;
            if (octaves == null) octaves = 1;
            if (octaves == 1) return amplitude * this.n2d(x, y);
            var sum = 0;
            var _g = 0;
            while (_g < octaves) {
                var i = _g++;
                sum += amplitude * this.n2d(x, y);
                amplitude *= persistence;
                x *= lacunarity;
                y *= lacunarity;
            }
            return sum;
        };
        displayengine.impl.displaylist.Perlin.prototype.noise3d = function(x, y, z, octaves, amplitude, persistence, lacunarity) {
            if (lacunarity == null) lacunarity = 2;
            if (persistence == null) persistence = 0.9;
            if (amplitude == null) amplitude = 1;
            if (octaves == null) octaves = 1;
            if (octaves == 1) return amplitude * this.n3d(x, y, z);
            var sum = 0;
            var _g = 0;
            while (_g < octaves) {
                var i = _g++;
                sum += amplitude * this.n3d(x, y, z);
                amplitude *= persistence;
                x *= lacunarity;
                y *= lacunarity;
            }
            return sum;
        };
        displayengine.impl.displaylist.Perlin.prototype.__class__ = displayengine.impl.displaylist.Perlin;
        displayengineImpl.PixiBitmapText = function(text, style) {
            displayengineImpl.DisplayObject.call(this);
            this._obj = new PIXI.extras.BitmapText(text, style);
        };
        displayengineImpl.PixiBitmapText.__name__ = ["displayengineImpl", "PixiBitmapText"];
        displayengineImpl.PixiBitmapText.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.PixiBitmapText.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.PixiBitmapText.prototype.getText = function() {
            return this._obj.text;
        };
        displayengineImpl.PixiBitmapText.prototype.setText = function(value) {
            return this._obj.text = value;
        };
        displayengineImpl.PixiBitmapText.prototype.getAlign = function() {
            return this._obj.align;
        };
        displayengineImpl.PixiBitmapText.prototype.setAlign = function(value) {
            return this._obj.align = value.toLowerCase();
        };
        displayengineImpl.PixiBitmapText.prototype.__class__ = displayengineImpl.PixiBitmapText;
        displayengineImpl.BitmapText = function(text, style) {
            displayengineImpl.PixiBitmapText.call(this, text, style);
        };
        displayengineImpl.BitmapText = ck_implements(displayengineImpl.BitmapText, displayEngineApi.IBitmapText);
        displayengineImpl.BitmapText.__interfaces__ = [displayEngineApi.IBitmapText];
        displayengineImpl.BitmapText.__name__ = ["displayengineImpl", "BitmapText"];
        displayengineImpl.BitmapText.__super__ = displayengineImpl.PixiBitmapText;
        for (var k in displayengineImpl.PixiBitmapText.prototype) displayengineImpl.BitmapText.prototype[k] = displayengineImpl.PixiBitmapText.prototype[k];
        displayengineImpl.BitmapText.prototype.text = null;
        displayengineImpl.BitmapText.prototype.get_text = function() {
            return this._obj.text;
        };
        displayengineImpl.BitmapText.prototype.set_text = function(value) {
            return this._obj.text = value;
        };
        displayengineImpl.BitmapText.prototype.align = null;
        displayengineImpl.BitmapText.prototype.get_align = function() {
            return this._obj.align;
        };
        displayengineImpl.BitmapText.prototype.set_align = function(value) {
            return this.setAlign(value.toLowerCase());
        };
        displayengineImpl.BitmapText.prototype.__class__ = displayengineImpl.BitmapText;
        displayengineImpl.Cache = function() {};
        displayengineImpl.Cache.__name__ = ["displayengineImpl", "Cache"];
        displayengineImpl.Cache.cache = function(elements) {
            var elementsParent = null;
            var _g = 0;
            while (_g < elements.length) {
                var e = elements[_g];
                ++_g;
                if (null == elementsParent) elementsParent = e.getParent();
                if (e.getParent() != elementsParent) return null;
            }
            var isParentStage = false;
            isParentStage = _hcmn_.js_Boot.__instanceof(elementsParent, displayengineImpl.Stage);
            elements.sort(function(a, b) {
                return a.getZOrder() - b.getZOrder();
            });
            var lowestZ;
            if (isParentStage) lowestZ = elements[0].getZIndex();
            else lowestZ = elements[0].getZOrder();
            var _g1 = 1;
            var _g2 = elements.length;
            while (_g1 < _g2) {
                var i = _g1++;
                if (elements[i].getZOrder() != elements[i - 1].getZOrder() + 1) return null;
            }
            var cachingContainer = new displayengineImpl.DisplayObjectContainer();
            if (isParentStage) cachingContainer.setZIndex(lowestZ);
            else cachingContainer.setZOrder(lowestZ);
            var _g3 = 0;
            while (_g3 < elements.length) {
                var e1 = elements[_g3];
                ++_g3;
                if (e1.getDisplayObject().cacheAsBitmap == true) {
                    e1.getUserData().prevCacheAsBitmap = true;
                    e1.setCacheAsBitmap(false);
                }
                cachingContainer.addChild(e1);
            }
            cachingContainer.setCacheAsBitmap(true);
            cachingContainer.getUserData().originalParent = elementsParent;
            elementsParent.addChild(cachingContainer);
            var cachedObjectID;
            cachedObjectID = "@_HCACHE_" + (function($this) {
                var $r;
                var _this = displayEngineUtils.Utils.uuid();
                $r = _hcmn_.HxOverrides.substr(_this, 0, 23);
                return $r;
            }(this));
            displayengineImpl.Cache.cachedObjects.set(cachedObjectID, cachingContainer);
            cachingContainer.getDisplayObject().name = cachedObjectID;
            return cachedObjectID;
        };
        displayengineImpl.Cache.uncache = function(objectID) {
            var object = displayengineImpl.Cache.cachedObjects.get(objectID);
            object.setCacheAsBitmap(false);
            var elements = object.getChildren();
            var lowestZ = object.getZOrder();
            var originalParent = object.getParent();
            originalParent.removeChild(object);
            var isParentStage = _hcmn_.js_Boot.__instanceof(originalParent, displayengineImpl.Stage);
            elements.sort(function(a, b) {
                return a.getZOrder() - b.getZOrder();
            });
            while (elements.length > 0) {
                var e = elements.shift();
                originalParent.addChild(e);
                e.setZOrder(lowestZ++);
                if (e.getUserData().prevCacheAsBitmap == true) {
                    e.getUserData().prevCacheAsBitmap = false;
                    e.setCacheAsBitmap(true);
                }
            }
            object = null;
            displayengineImpl.Cache.cachedObjects.remove(objectID);
        };
        displayengineImpl.Cache.prototype.__class__ = displayengineImpl.Cache;
        displayengineImpl.DisplayObjectContainer = function() {
            this.children = [];
            displayengineImpl.DisplayObject.call(this);
            displayengineImpl.DisplayObjectContainer.docCount++;
        };
        displayengineImpl.DisplayObjectContainer = ck_implements(displayengineImpl.DisplayObjectContainer, displayEngineApi.IDisplayObjectContainer);
        displayengineImpl.DisplayObjectContainer.__interfaces__ = [displayEngineApi.IDisplayObjectContainer];
        displayengineImpl.DisplayObjectContainer.__name__ = ["displayengineImpl", "DisplayObjectContainer"];
        displayengineImpl.DisplayObjectContainer.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.DisplayObjectContainer.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.DisplayObjectContainer.prototype.children = null;
        displayengineImpl.DisplayObjectContainer.prototype.setDisplayType = function() {
            displayengineImpl.DisplayObject.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.DISPLAY_OBJECT_CONTAINER);
        };
        displayengineImpl.DisplayObjectContainer.prototype.updateChildren = function(child, action) {
            if (action == null) action = "add";
            var _g = 0;
            var _g1 = child.children;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                if (action == "add") c.stageName = child.stageName;
                else c.stageName = c.stageName;
                if (action == "remove") c.stageName = "";
                else c.stageName = c.stageName;
                if (_hcmn_.js_Boot.__instanceof(c, displayengineImpl.DisplayObjectContainer)) this.updateChildren(c, action);
            }
        };
        displayengineImpl.DisplayObjectContainer.prototype.addChild = function(childToAdd) {
            var child = childToAdd;
            if (child.getParent != null && child.getParent() != null) {
                if (child.getParent().removeChild != null) child.getParent().removeChild(child);
            }
            if (child.getDisplayObject == null || child.getDisplayObject() == null) this._obj.addChild(child);
            else {
                this._obj.addChild(child.getDisplayObject());
                child._obj._parent = this;
                child.stageName = this.stageName;
                if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
            }
            this.children.push(child);
            if (child._onAddedToStage != null) {
                child._onAddedToStage();
                child._onAddedToStage = null;
            }
            return child;
        };
        displayengineImpl.DisplayObjectContainer.prototype.addChildAt = function(child, index) {
            var child1 = child;
            if ($bind(child1, child1.getParent) != null && child1.getParent() != null) {
                if (child1.getParent().removeChild != null) child1.getParent().removeChild(child1);
            }
            if ($bind(child1, child1.getDisplayObject) == null || child1.getDisplayObject() == null) this._obj.addChildAt(child1, index);
            else {
                this._obj.addChildAt(child1.getDisplayObject(), index);
                child1._obj._parent = this;
            }
            this.children.push(child1);
            if (child1._onAddedToStage != null) {
                child1._onAddedToStage();
                child1._onAddedToStage = null;
            }
            return child1;
        };
        displayengineImpl.DisplayObjectContainer.prototype.addChildren = function(_children_) {
            var _g = 0;
            while (_g < _children_.length) {
                var child = _children_[_g];
                ++_g;
                var child1 = child;
                if ($bind(child1, child1.getParent) != null && child1.getParent() != null) {
                    if (child1.getParent().removeChild != null) child1.getParent().removeChild(child1);
                }
                if ($bind(child1, child1.getDisplayObject) == null || child1.getDisplayObject() == null) this._obj.addChild(child1);
                else {
                    this._obj.addChild(child1.getDisplayObject());
                    child1._obj._parent = this;
                }
                this.children.push(child1);
                if (child1._onAddedToStage != null) {
                    child1._onAddedToStage();
                    child1._onAddedToStage = null;
                }
            }
        };
        displayengineImpl.DisplayObjectContainer.prototype.removeChild = function(child) {
            var child1 = child;
            if (this._obj != null && ($bind(child1, child1.getDisplayObject) == null || child1.getDisplayObject() == null)) this._obj.removeChild(child1);
            else if (this._obj != null) this._obj.removeChild(child1.getDisplayObject());
            _hcmn_.HxOverrides.remove(this.children, child1);
        };
        displayengineImpl.DisplayObjectContainer.prototype.removeChildAt = function(index) {
            var x = this.getChildAt(index)._owner;
            _hcmn_.HxOverrides.remove(this.children, x);
            this._obj.removeChildAt(index);
        };
        displayengineImpl.DisplayObjectContainer.prototype.removeChildren = function() {
            this.getDisplayObject().removeChildren();
            this.children = [];
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildAt = function(index) {
            return this.children[index];
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildIndex = function(child) {
            if (child._obj != null) child = child._obj;
            return this.getDisplayObject().getChildIndex(child);
        };
        displayengineImpl.DisplayObjectContainer.prototype.setChildIndex = function(child, index) {
            var child1 = child;
            if (child1.getDisplayObject() == null) this.getDisplayObject().setChildIndex(child1, index);
            else this._obj.setChildIndex(child1.getDisplayObject(), index);
        };
        displayengineImpl.DisplayObjectContainer.prototype.getNumChildren = function() {
            return this._obj.children.length;
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildren = function() {
            return this.children;
        };
        displayengineImpl.DisplayObjectContainer.prototype.getChildByName = function(name) {
            var _g = 0;
            var _g1 = this.children;
            while (_g < _g1.length) {
                var child = _g1[_g];
                ++_g;
                var child1 = child;
                if (child1.getName() == name) return child1;
            }
            return null;
        };
        displayengineImpl.DisplayObjectContainer.prototype.dispose = function() {
            var _g = 0;
            var _g1 = this.children;
            while (_g < _g1.length) {
                var child = _g1[_g];
                ++_g;
                if (_hcmn_.js_Boot.__instanceof(child, displayEngineApi.IDisplayObject)) child.dispose();
                else {
                    child.parent.removeChild(child);
                    child = null;
                }
            }
            displayengineImpl.DisplayObject.prototype.dispose.call(this);
            displayengineImpl.DisplayObjectContainer.docCount--;
        };
        displayengineImpl.DisplayObjectContainer.create = function() {
            return new displayengineImpl.DisplayObjectContainer();
        };
        displayengineImpl.DisplayObjectContainer.prototype.__class__ = displayengineImpl.DisplayObjectContainer;
        displayengineImpl.PixiGraphics = function(cacheCommands) {
            if (cacheCommands == null) cacheCommands = false;
            this._lineStyle = {
                lineWidth: 1,
                color: 0,
                alpha: 1.0
            };
            this.commands = [];
            displayengineImpl.DisplayObject.call(this);
            this.cacheCommands = cacheCommands;
            this._g = new PIXI.Graphics();
            this._obj = this._g;
        };
        displayengineImpl.PixiGraphics = ck_implements(displayengineImpl.PixiGraphics, displayEngineApi.IGraphics);
        displayengineImpl.PixiGraphics.__interfaces__ = [displayEngineApi.IGraphics];
        displayengineImpl.PixiGraphics.__name__ = ["displayengineImpl", "PixiGraphics"];
        displayengineImpl.PixiGraphics.__super__ = displayengineImpl.DisplayObject;
        for (var k in displayengineImpl.DisplayObject.prototype) displayengineImpl.PixiGraphics.prototype[k] = displayengineImpl.DisplayObject.prototype[k];
        displayengineImpl.PixiGraphics.prototype.commands = null;
        displayengineImpl.PixiGraphics.prototype.cacheCommands = null;
        displayengineImpl.PixiGraphics.prototype._g = null;
        displayengineImpl.PixiGraphics.prototype._lineStyle = null;
        displayengineImpl.PixiGraphics.prototype.beginFill = function(color, alpha, cache) {
            if (cache == null) cache = true;
            if (alpha == null) alpha = 1.0;
            if (this.cacheCommands && cache) this.commands.push({
                name: "beginFill",
                data: {
                    color: color,
                    alpha: alpha
                }
            });
            this._g.beginFill(color, alpha);
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.lineStyle = function(thickness, color, alpha, cache) {
            if (cache == null) cache = true;
            if (alpha == null) alpha = 1.0;
            if (this.cacheCommands && cache) this.commands.push({
                name: "lineStyle",
                data: {
                    thickness: thickness,
                    color: color,
                    alpha: alpha
                }
            });
            this._lineStyle.lineWidth = thickness;
            this._lineStyle.color = color;
            this._lineStyle.alpha = alpha;
            this._g.lineStyle(this._lineStyle.lineWidth | 0, this._lineStyle.color, this._lineStyle.alpha);
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawRoundRect = function(x, y, width, height, borderRadius, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "drawRoundRect",
                data: {
                    x: x,
                    y: y,
                    height: height,
                    width: width,
                    borderRadius: borderRadius
                }
            });
            this._g.drawRoundedRect(x, y, width, height, borderRadius);
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.getDisplayObject = function() {
            return this._g;
        };
        displayengineImpl.PixiGraphics.prototype.dispose = function() {
            displayengineImpl.DisplayObject.prototype.dispose.call(this);
            this._g = null;
            this._lineStyle = null;
        };
        displayengineImpl.PixiGraphics.prototype.lineTo = function(x, y, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.moveTo = function(x, y, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.clear = function(cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawRect = function(x, y, width, height, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawCircle = function(x, y, radius, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawEllipse = function(x, y, width, height, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.drawPoly = function(polyDef, close, cache) {
            if (cache == null) cache = true;
            if (close == null) close = false;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise, cache) {
            if (cache == null) cache = true;
            if (anticlockwise == null) anticlockwise = false;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY, cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.endFill = function(cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.endStroke = function(cache) {
            if (cache == null) cache = true;
            return this;
        };
        displayengineImpl.PixiGraphics.prototype.clone = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            return null;
        };
        displayengineImpl.PixiGraphics.prototype.update = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            return null;
        };
        displayengineImpl.PixiGraphics.prototype.__class__ = displayengineImpl.PixiGraphics;
        displayengineImpl.Graphics = function(cacheCommands) {
            if (cacheCommands == null) cacheCommands = false;
            displayengineImpl.PixiGraphics.call(this, cacheCommands);
        };
        displayengineImpl.Graphics = ck_implements(displayengineImpl.Graphics, displayEngineApi.IGraphics);
        displayengineImpl.Graphics.__interfaces__ = [displayEngineApi.IGraphics];
        displayengineImpl.Graphics.__name__ = ["displayengineImpl", "Graphics"];
        displayengineImpl.Graphics.__super__ = displayengineImpl.PixiGraphics;
        for (var k in displayengineImpl.PixiGraphics.prototype) displayengineImpl.Graphics.prototype[k] = displayengineImpl.PixiGraphics.prototype[k];
        displayengineImpl.Graphics.prototype.setDisplayType = function() {
            displayengineImpl.PixiGraphics.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.GRAPHICS);
        };
        displayengineImpl.Graphics.prototype.update = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            this.redraw(this, fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha);
            return this;
        };
        displayengineImpl.Graphics.prototype.clone = function(fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            var g = new displayengineImpl.Graphics(this.cacheCommands);
            g.commands = this.commands.slice();
            this.redraw(g, fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha);
            return g;
        };
        displayengineImpl.Graphics.prototype.redraw = function(g, fillColor, fillAlpha, strokeColor, strokeThickness, strokeAlpha) {
            g.clear(false);
            var _g = 0;
            var _g1 = this.commands;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                var _g2 = c.name;
                switch (_g2) {
                    case "moveTo":
                        g.moveTo(c.data.x, c.data.y, false);
                        break;
                    case "beginFill":
                        g.beginFill(fillColor != null ? fillColor : c.data.color, fillAlpha != null ? fillAlpha : c.data.alpha, false);
                        break;
                    case "lineStyle":
                        g.lineStyle(strokeThickness != null ? strokeThickness : c.data.thickness, strokeColor != null ? strokeColor : c.data.color, strokeAlpha != null ? strokeAlpha : c.data.alpha, false);
                        break;
                    case "clear":
                        g.clear(false);
                        break;
                    case "lineTo":
                        g.lineTo(c.data.x, c.data.y, false);
                        break;
                    case "drawRect":
                        g.drawRect(c.data.x, c.data.y, c.data.width, c.data.height, false);
                        break;
                    case "drawCircle":
                        g.drawCircle(c.data.x, c.data.y, c.data.radius, false);
                        break;
                    case "drawEllipse":
                        g.drawEllipse(c.data.x, c.data.y, c.data.width, c.data.height, false);
                        break;
                    case "drawPoly":
                        g.drawPoly(c.data.polyDef, c.data.close, false);
                        break;
                    case "arc":
                        g.arc(c.data.cx, c.data.cy, c.data.radius, c.data.startAngle, c.data.endAngle, c.data.anticlockwise, false);
                        break;
                    case "bezierCurveTo":
                        g.bezierCurveTo(c.data.cpX, c.data.cpY, c.data.cpX2, c.data.cpY2, c.data.toX, c.data.toY, false);
                        break;
                    case "quadraticCurveTo":
                        g.quadraticCurveTo(c.data.cpX, c.data.cpY, c.data.toX, c.data.toY, false);
                        break;
                    case "endFill":
                        g.endFill(false);
                        break;
                    case "endStroke":
                        g.endStroke(false);
                        break;
                }
            }
        };
        displayengineImpl.Graphics.prototype.moveTo = function(x, y, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "moveTo",
                data: {
                    x: x,
                    y: y
                }
            });
            this._g.moveTo(x, y);
            return this;
        };
        displayengineImpl.Graphics.prototype.clear = function(cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "clear",
                data: {}
            });
            this._g.clear();
            return this;
        };
        displayengineImpl.Graphics.prototype.lineTo = function(x, y, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "lineTo",
                data: {
                    x: x,
                    y: y
                }
            });
            this._g.lineTo(x, y);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawRect = function(x, y, width, height, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "drawRect",
                data: {
                    x: x,
                    y: y,
                    width: width,
                    height: height
                }
            });
            this._g.drawRect(x, y, width, height);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawCircle = function(x, y, radius, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "drawCircle",
                data: {
                    x: x,
                    y: y,
                    radius: radius
                }
            });
            this._g.drawCircle(x, y, radius);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawEllipse = function(x, y, width, height, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "drawEllipse",
                data: {
                    x: x,
                    y: y,
                    width: width,
                    height: height
                }
            });
            this._g.drawEllipse(x, y, width, height);
            return this;
        };
        displayengineImpl.Graphics.prototype.drawPoly = function(polyDef, close, cache) {
            if (cache == null) cache = true;
            if (close == null) close = false;
            if (this.cacheCommands && cache) this.commands.push({
                name: "drawPoly",
                data: {
                    polyDef: polyDef,
                    close: close
                }
            });
            var points = [];
            if (typeof(polyDef) == "string") {
                var pts = (_hcmn_.js_Boot.__cast(polyDef, String)).split(",");
                var i = 0;
                while (i < pts.length) {
                    points.push(new displayEngineApi.Point(parseFloat(pts[i]), parseFloat(pts[i + 1])));
                    i += 2;
                }
            } else if ((polyDef instanceof Array) && polyDef.__enum__ == null) {
                var i1 = 0;
                while (i1 < polyDef.length) points.push(new displayEngineApi.Point(polyDef[i1], polyDef[i1 + 1]));
            }
            this._g.moveTo(points[0].x, points[0].y);
            var _g1 = 1;
            var _g = points.length;
            while (_g1 < _g) {
                var i2 = _g1++;
                this._g.lineTo(points[i2].x, points[i2].y);
            }
            if (close) this._g.lineTo(points[0].x, points[0].y);
            return this;
        };
        displayengineImpl.Graphics.prototype.arc = function(cx, cy, radius, startAngle, endAngle, anticlockwise, cache) {
            if (cache == null) cache = true;
            if (anticlockwise == null) anticlockwise = false;
            if (this.cacheCommands && cache) this.commands.push({
                name: "arc",
                data: {
                    cx: cx,
                    cy: cy,
                    radius: radius,
                    startAngle: startAngle,
                    endAngle: endAngle,
                    anticlockwise: anticlockwise
                }
            });
            this._g.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);
            return this;
        };
        displayengineImpl.Graphics.prototype.bezierCurveTo = function(cpX, cpY, cpX2, cpY2, toX, toY, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "bezierCurveTo",
                data: {
                    cpX: cpX,
                    cpY: cpY,
                    cpX2: cpX2,
                    cpY2: cpY2,
                    toX: toX,
                    toY: toY
                }
            });
            this._g.bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY);
            return this;
        };
        displayengineImpl.Graphics.prototype.quadraticCurveTo = function(cpX, cpY, toX, toY, cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) this.commands.push({
                name: "quadraticCurveTo",
                data: {
                    cpX: cpX,
                    cpY: cpY,
                    toX: toX,
                    toY: toY
                }
            });
            this._g.quadraticCurveTo(cpX, cpY, toX, toY);
            return this;
        };
        displayengineImpl.Graphics.prototype.endFill = function(cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) {
                this.commands.push({
                    name: "endFill",
                    data: {}
                });
                this.cacheCommands = false;
            }
            this._g.endFill();
            return this;
        };
        displayengineImpl.Graphics.prototype.endStroke = function(cache) {
            if (cache == null) cache = true;
            if (this.cacheCommands && cache) {
                this.commands.push({
                    name: "endStroke",
                    data: {}
                });
                this.cacheCommands = false;
            }
            displayengineImpl.PixiGraphics.prototype.endStroke.call(this);
            return this;
        };
        displayengineImpl.Graphics.prototype.__class__ = displayengineImpl.Graphics;
        displayengine.impl.displaylist.VideoFilter = {
            __ename__: ["displayengine", "impl", "displaylist", "VideoFilter"],
            __constructs__: ["NONE", "GRAYSCALE", "CONVOLUTION", "INVERT", "RGB_TO_BRG", "RGB_TO_RBG", "RGB_TO_GBR", "RGB_TO_BGR", "RGB_TO_GRB", "GRADIENT", "SEPIA1", "SEPIA2", "GAMMA", "BRIGHTNESS", "NOISE"]
        };
        displayengine.impl.displaylist.VideoFilter.SEPIA2 = ["SEPIA2", 11];
        displayengine.impl.displaylist.VideoFilter.SEPIA2.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.SEPIA2.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BGR = ["RGB_TO_BGR", 7];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BGR.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BGR.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.GRAYSCALE = ["GRAYSCALE", 1];
        displayengine.impl.displaylist.VideoFilter.GRAYSCALE.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.GRAYSCALE.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.NONE = ["NONE", 0];
        displayengine.impl.displaylist.VideoFilter.NONE.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.NONE.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BRG = ["RGB_TO_BRG", 4];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BRG.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_BRG.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.GAMMA = ["GAMMA", 12];
        displayengine.impl.displaylist.VideoFilter.GAMMA.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.GAMMA.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GBR = ["RGB_TO_GBR", 6];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GBR.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GBR.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GRB = ["RGB_TO_GRB", 8];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GRB.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_GRB.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_RBG = ["RGB_TO_RBG", 5];
        displayengine.impl.displaylist.VideoFilter.RGB_TO_RBG.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.RGB_TO_RBG.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.GRADIENT = ["GRADIENT", 9];
        displayengine.impl.displaylist.VideoFilter.GRADIENT.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.GRADIENT.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.INVERT = ["INVERT", 3];
        displayengine.impl.displaylist.VideoFilter.INVERT.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.INVERT.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.NOISE = ["NOISE", 14];
        displayengine.impl.displaylist.VideoFilter.NOISE.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.NOISE.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.CONVOLUTION = ["CONVOLUTION", 2];
        displayengine.impl.displaylist.VideoFilter.CONVOLUTION.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.CONVOLUTION.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.BRIGHTNESS = ["BRIGHTNESS", 13];
        displayengine.impl.displaylist.VideoFilter.BRIGHTNESS.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.BRIGHTNESS.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengine.impl.displaylist.VideoFilter.SEPIA1 = ["SEPIA1", 10];
        displayengine.impl.displaylist.VideoFilter.SEPIA1.toString = $estr;
        displayengine.impl.displaylist.VideoFilter.SEPIA1.__enum__ = displayengine.impl.displaylist.VideoFilter;
        displayengineImpl.MCVideo = function(src, poster, width, height, framerate, autoPlay, loop) {
            if (loop == null) loop = true;
            if (autoPlay == null) autoPlay = true;
            if (framerate == null) framerate = 30;
            if (height == null) height = -1;
            if (width == null) width = -1;
            this.onPlayHandlers = [];
            this.noiseFilterFactor = 60;
            this.brightnessFilterFactor = 100;
            this.gammaFilterFactor = 5;
            this.gradientFilterFactor = 0;
            this.filterZone = new displayEngineApi.Rectangle(0, 0, 10, 0);
            this.filter = displayengine.impl.displaylist.VideoFilter.NONE;
            this.tiles = [];
            this.tileSpacing = 4;
            this.cols = 0;
            this.rows = 0;
            var _this = window.document;
            this.video = _this.createElement("video");
            if (this.canPlayFormat("video/mp4")) this.video.src = src + ".mp4";
            else if (this.canPlayFormat("video/webm")) this.video.src = src + ".webm";
            else if (this.canPlayFormat("video/ogg")) this.video.src = src + ".ogv";
            else {
                throw new js._Boot.HaxeError("Browser can't play video!");
                return;
            }
            this.video.loop = loop;
            this.video.autoplay = autoPlay;
            this.video.onplay = $bind(this, this.render);
            this.video.addEventListener("timeupdate", $bind(this, this.playerTimeUpdate));
            this.video.addEventListener("loadedmetadata", $bind(this, this.playerReady));
            if (width == -1) width = this.video.width;
            if (height == -1) height = this.video.height;
            this._w = width;
            this._h = height;
            this.filterZone.w = this._w;
            this.filterZone.h = this._h;
            var _this1 = window.document;
            this.canvas = _this1.createElement("canvas");
            this.canvas.setAttribute("width", this._w + "px");
            this.canvas.setAttribute("height", this._h + "px");
            this.canvas.style.backgroundColor = "transparent";
            this.ctx = this.canvas.getContext("2d", null);
            if (poster != null) {
                this.poster = new displayengineImpl.Bitmap(poster);
                this.ctx.drawImage(poster, 0, 0, this._w, this._h);
            }
            displayengineImpl.Bitmap.call(this, this.canvas);
            this.on(displayEngineApi.DisplayObjectEvents.MOUSE_DOWN, $bind(this, this.beginFilterZoneDraw));
        };
        displayengineImpl.MCVideo.__name__ = ["displayengineImpl", "MCVideo"];
        displayengineImpl.MCVideo.__super__ = displayengineImpl.Bitmap;
        for (var k in displayengineImpl.Bitmap.prototype) displayengineImpl.MCVideo.prototype[k] = displayengineImpl.Bitmap.prototype[k];
        displayengineImpl.MCVideo.prototype.isPaused = null;
        displayengineImpl.MCVideo.prototype.duration = null;
        displayengineImpl.MCVideo.prototype.currentTime = null;
        displayengineImpl.MCVideo.prototype.onPlayerReady = null;
        displayengineImpl.MCVideo.prototype.canvas = null;
        displayengineImpl.MCVideo.prototype.video = null;
        displayengineImpl.MCVideo.prototype.poster = null;
        displayengineImpl.MCVideo.prototype._w = null;
        displayengineImpl.MCVideo.prototype._h = null;
        displayengineImpl.MCVideo.prototype.rows = null;
        displayengineImpl.MCVideo.prototype.cols = null;
        displayengineImpl.MCVideo.prototype.tileSpacing = null;
        displayengineImpl.MCVideo.prototype.tiles = null;
        displayengineImpl.MCVideo.prototype.tileWidth = null;
        displayengineImpl.MCVideo.prototype.tileHeight = null;
        displayengineImpl.MCVideo.prototype.filter = null;
        displayengineImpl.MCVideo.prototype.filterZone = null;
        displayengineImpl.MCVideo.prototype.filterZoneGFX = null;
        displayengineImpl.MCVideo.prototype.filterZoneStartPoint = null;
        displayengineImpl.MCVideo.prototype.gradientFilterFactor = null;
        displayengineImpl.MCVideo.prototype.gammaFilterFactor = null;
        displayengineImpl.MCVideo.prototype.brightnessFilterFactor = null;
        displayengineImpl.MCVideo.prototype.noiseFilterFactor = null;
        displayengineImpl.MCVideo.prototype.onPlayHandlers = null;
        displayengineImpl.MCVideo.prototype.setDisplayType = function() {
            displayengineImpl.Bitmap.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.VIDEO);
        };
        displayengineImpl.MCVideo.prototype.showPoster = function() {
            if (this.poster != null) this.poster._obj.visible = true;
        };
        displayengineImpl.MCVideo.prototype.play = function() {
            this.video.play();
        };
        displayengineImpl.MCVideo.prototype.pause = function() {
            this.video.pause();
        };
        displayengineImpl.MCVideo.prototype.getTimeFormated = function() {
            return this.secondsToTime(this.video.currentTime);
        };
        displayengineImpl.MCVideo.prototype.render = function() {
            if (this.video.paused || this.video.ended) return;
            if (this.poster != null) this.poster._obj.visible = false;
            this.ctx.clearRect(0, 0, this._w, this._h);
            this.ctx.drawImage(this.video, 0, 0, this._w, this._h);
            if (this.filter != displayengine.impl.displaylist.VideoFilter.NONE) this.applyFilter();
            this.update(this.canvas, this._w, this._h);
            window.setTimeout($bind(this, this.render), 20);
        };
        displayengineImpl.MCVideo.prototype.setFilter = function(filter) {
            this.filter = filter;
        };
        displayengineImpl.MCVideo.prototype.addOnPlayHandler = function(handler) {
            this.onPlayHandlers.push(handler);
        };
        displayengineImpl.MCVideo.prototype.removeOnPlayHandler = function(handler) {
            var x = handler;
            _hcmn_.HxOverrides.remove(this.onPlayHandlers, x);
        };
        displayengineImpl.MCVideo.prototype.playerTimeUpdate = function(e) {
            var _g = 0;
            var _g1 = this.onPlayHandlers;
            while (_g < _g1.length) {
                var fn = _g1[_g];
                ++_g;
                fn();
            }
        };
        displayengineImpl.MCVideo.prototype.beginFilterZoneDraw = function(e) {
            if (this.filterZoneGFX == null) this.filterZoneGFX = new displayengineImpl.Sprite();
            var mouse = displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse();
            this.filterZoneStartPoint = this.globalToLocal(mouse.x, mouse.y);
            this.filterZoneGFX.setX(this._obj.x);
            this.filterZoneGFX.setY(this._obj.y);
            this.getParent().addChild(this.filterZoneGFX.getDisplayObject());
            this.on(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.endFilterZoneDraw));
            displayengineImpl.DisplayProvider.stages.get(this.stageName).on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.drawFilterZone));
        };
        displayengineImpl.MCVideo.prototype.endFilterZoneDraw = function(e) {
            this.getParent().removeChild(this.filterZoneGFX.getDisplayObject());
            this.off(displayEngineApi.DisplayObjectEvents.MOUSE_UP, $bind(this, this.endFilterZoneDraw));
            displayengineImpl.DisplayProvider.stages.get(this.stageName).off(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.drawFilterZone));
        };
        displayengineImpl.MCVideo.prototype.drawFilterZone = function(e) {
            var xy = this.globalToLocal(displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse().x, displayengineImpl.DisplayProvider.stages.get(this.stageName).getMouse().y);
            if (xy.x >= 0 && xy.x <= this._w && xy.y >= 0 && xy.y <= this._h) {
                var g = this.filterZoneGFX.getGraphics();
                var x1 = this.filterZoneStartPoint.x;
                var y1 = this.filterZoneStartPoint.y;
                var x2 = xy.x;
                var y2 = xy.y;
                if (x2 < x1) {
                    var temp = x1;
                    x1 = x2;
                    x2 = temp;
                }
                if (y2 < y1) {
                    var temp1 = y1;
                    y1 = y2;
                    y2 = temp1;
                }
                g.clear().lineStyle(2, 16711680, .8).beginFill(16711680, 0.4).drawRect(x1, y1, x2 - x1, y2 - y1);
                this.filterZone = new displayEngineApi.Rectangle(x1, y1, x2 - x1, y2 - y1);
            }
        };
        displayengineImpl.MCVideo.prototype.playerReady = function(e) {
            if (this.onPlayerReady != null) this.onPlayerReady(e.target);
        };
        displayengineImpl.MCVideo.prototype.canPlayFormat = function(format) {
            var res = this.video.canPlayType(format);
            if (res == "probably" || res == "maybe") return true;
            return false;
        };
        displayengineImpl.MCVideo.prototype.applyFilter = function() {
            var idata = this.ctx.getImageData(this.filterZone.x, this.filterZone.y, this.filterZone.w == 0 ? 1 : this.filterZone.w, this.filterZone.h == 0 ? 1 : this.filterZone.h);
            var data = idata.data;
            var _g = this.filter;
            switch (_g[1]) {
                case 2:
                    var w = idata.width;
                    var limit = data.length;
                    var _g1 = 0;
                    while (_g1 < limit) {
                        var i = _g1++;
                        if (i % 4 == 3) continue;
                        data[i] = 127 + 2 * data[i] - data[i + 4] - data[i + w * 4];
                    }
                    break;
                case 1:
                    var i1 = 0;
                    while (i1 < data.length) {
                        var r = data[i1];
                        var g = data[i1 + 1];
                        var b = data[i1 + 2];
                        var brightness = 3 * r + 4 * g + b >>> 3;
                        data[i1] = brightness;
                        data[i1 + 1] = brightness;
                        data[i1 + 2] = brightness;
                        i1 += 4;
                    }
                    break;
                case 3:
                    var i2 = 0;
                    while (i2 < data.length) {
                        data[i2] = 255 - data[i2];
                        data[i2 + 1] = 255 - data[i2 + 1];
                        data[i2 + 2] = 255 - data[i2 + 2];
                        i2 += 4;
                    }
                    break;
                case 9:
                    var total = data.length;
                    var i3 = 0;
                    while (i3 < data.length) {
                        data[i3 + 3] = this.gradientFilterFactor + 255 * (total - i3) / total | 0;
                        i3 += 4;
                    }
                    break;
                case 4:
                    var r1 = 0;
                    var g1 = 0;
                    var b1 = 0;
                    var i4 = 0;
                    while (i4 < data.length) {
                        r1 = data[i4];
                        g1 = data[i4 + 1];
                        b1 = data[i4 + 2];
                        data[i4] = b1;
                        data[i4 + 1] = r1;
                        data[i4 + 2] = g1;
                        i4 += 4;
                    }
                    break;
                case 5:
                    var g2 = 0;
                    var b2 = 0;
                    var i5 = 0;
                    while (i5 < data.length) {
                        g2 = data[i5 + 1];
                        b2 = data[i5 + 2];
                        data[i5 + 1] = b2;
                        data[i5 + 2] = g2;
                        i5 += 4;
                    }
                    break;
                case 6:
                    var r2 = 0;
                    var g3 = 0;
                    var b3 = 0;
                    var i6 = 0;
                    while (i6 < data.length) {
                        r2 = data[i6];
                        g3 = data[i6 + 1];
                        b3 = data[i6 + 2];
                        data[i6] = g3;
                        data[i6 + 1] = b3;
                        data[i6 + 2] = r2;
                        i6 += 4;
                    }
                    break;
                case 7:
                    var r3 = 0;
                    var g4 = 0;
                    var b4 = 0;
                    var i7 = 0;
                    while (i7 < data.length) {
                        r3 = data[i7];
                        g4 = data[i7 + 1];
                        b4 = data[i7 + 2];
                        data[i7] = b4;
                        data[i7 + 1] = g4;
                        data[i7 + 2] = r3;
                        i7 += 4;
                    }
                    break;
                case 8:
                    var r4 = 0;
                    var g5 = 0;
                    var b5 = 0;
                    var i8 = 0;
                    while (i8 < data.length) {
                        r4 = data[i8];
                        g5 = data[i8 + 1];
                        b5 = data[i8 + 2];
                        data[i8] = g5;
                        data[i8 + 1] = r4;
                        data[i8 + 2] = b5;
                        i8 += 4;
                    }
                    break;
                case 10:
                    var avg = 0;
                    var i9 = 0;
                    while (i9 < data.length) {
                        avg = 0.3 * data[i9] + 0.59 * data[i9 + 1] + 0.11 * data[i9 + 2] | 0;
                        data[i9] = avg + 100;
                        data[i9 + 1] = avg + 50;
                        data[i9 + 2] = avg;
                        i9 += 4;
                    }
                    break;
                case 11:
                    var i10 = 0;
                    while (i10 < data.length) {
                        data[i10] = (data[i10] * 0.393 + data[i10 + 1] * 0.769 + data[i10 + 2] * 0.189) / 1.351 | 0;
                        data[i10 + 1] = (data[i10] * 0.349 + data[i10 + 1] * 0.686 + data[i10 + 2] * 0.168) / 1.203 | 0;
                        data[i10 + 2] = (data[i10] * 0.272 + data[i10 + 1] * 0.534 + data[i10 + 2] * 0.131) / 2.140 | 0;
                        i10 += 4;
                    }
                    break;
                case 13:
                    var i11 = 0;
                    while (i11 < data.length) {
                        data[i11] += this.brightnessFilterFactor;
                        data[i11 + 1] += this.brightnessFilterFactor;
                        data[i11 + 2] += this.brightnessFilterFactor;
                        i11 += 4;
                    }
                    break;
                case 12:
                    var i12 = 0;
                    while (i12 < data.length) {
                        data[i12] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12] / 255, this.gammaFilterFactor) * 255);
                        data[i12 + 1] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12 + 1] / 255, this.gammaFilterFactor) * 255);
                        data[i12 + 2] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12 + 2] / 255, this.gammaFilterFactor) * 255);
                        i12 += 4;
                    }
                    break;
                case 14:
                    var rand = 0;
                    var i13 = 0;
                    while (i13 < data.length) {
                        rand = _hcmn_.Std["int"]((0.5 - _hcmn_.Math.random()) * this.noiseFilterFactor);
                        data[i13] += rand;
                        data[i13 + 1] += rand;
                        data[i13 + 2] += rand;
                        i13 += 4;
                    }
                    break;
                default:
            }
            this.ctx.putImageData(idata, this.filterZone.x, this.filterZone.y);
        };
        displayengineImpl.MCVideo.prototype.setFilterZone = function(rec) {
            this.filterZone = rec;
        };
        displayengineImpl.MCVideo.prototype.setGradinetFactor = function(factor) {
            if (factor >= 0 && factor <= 255) this.gradientFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.setGammaFactor = function(factor) {
            if (factor >= 2 && factor <= 10) this.gammaFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.setBrightnessFactor = function(factor) {
            if (factor >= 0 && factor <= 255) this.brightnessFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.setNoiseFactor = function(factor) {
            if (factor >= 0 && factor <= 500) this.noiseFilterFactor = factor;
        };
        displayengineImpl.MCVideo.prototype.get_isPaused = function() {
            return this.video.paused;
        };
        displayengineImpl.MCVideo.prototype.get_duration = function() {
            return this.video.duration;
        };
        displayengineImpl.MCVideo.prototype.set_currentTime = function(val) {
            this.video.currentTime = val;
            return val;
        };
        displayengineImpl.MCVideo.prototype.get_currentTime = function() {
            return this.video.currentTime;
        };
        displayengineImpl.MCVideo.prototype.secondsToTime = function(s) {
            var h = _hcmn_.Math.floor(s / 3600);
            s -= h * 3600;
            var m = _hcmn_.Math.floor(s / 60);
            s -= m * 60;
            var ss = _hcmn_.Math.floor(s);
            return (h < 10 ? "0" + h : h + "") + ":" + (m < 10 ? "0" + m : m + "") + ":" + (ss < 10 ? "0" + ss : ss + "");
        };
        displayengineImpl.MCVideo.prototype.__class__ = displayengineImpl.MCVideo;
        displayengineImpl.Sprite = function() {
            displayengineImpl.DisplayObjectContainer.call(this);
        };
        displayengineImpl.Sprite = ck_implements(displayengineImpl.Sprite, displayEngineApi.ISprite);
        displayengineImpl.Sprite.__interfaces__ = [displayEngineApi.ISprite];
        displayengineImpl.Sprite.__name__ = ["displayengineImpl", "Sprite"];
        displayengineImpl.Sprite.__super__ = displayengineImpl.DisplayObjectContainer;
        for (var k in displayengineImpl.DisplayObjectContainer.prototype) displayengineImpl.Sprite.prototype[k] = displayengineImpl.DisplayObjectContainer.prototype[k];
        displayengineImpl.Sprite.prototype._graphics = null;
        displayengineImpl.Sprite.prototype.setDisplayType = function() {
            displayengineImpl.DisplayObjectContainer.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.SPRITE);
        };
        displayengineImpl.Sprite.prototype.getGraphics = function() {
            if (this._graphics == null) {
                this._graphics = new displayengineImpl.Graphics();
                this.addChild(this._graphics);
            }
            return this._graphics;
        };
        displayengineImpl.Sprite.prototype.__class__ = displayengineImpl.Sprite;
        displayengineImpl.PixiMovieClip = function(mcDef) {
            this.mcDefVersion = 1;
            this.currentStateName = "default";
            this.allOnStartHandlers = [];
            this.allOnCompleteHandlers = [];
            this._enabled = true;
            this.allTextures = new _hcmn_.haxe_ds_StringMap();
            this.anims = new _hcmn_.haxe_ds_StringMap();
            this.allFrames = [];
            displayengineImpl.Sprite.call(this);
            this.mcDef = mcDef;
            if (mcDef.videoDef == null) {
                var tex;
                var _baseTexture = new PIXI.BaseTexture(mcDef.animationBitmap, PIXI.SCALE_MODES.LINEAR);
                tex = new PIXI.Texture(_baseTexture);
                if (mcDef.animeDef.frames == null) this.mcDefVersion = 2;
                if (this.mcDefVersion == 1) {
                    var frames = mcDef.animeDef.frames;
                    var _g = 0;
                    while (_g < frames.length) {
                        var f = frames[_g];
                        ++_g;
                        if (f.spriteName == mcDef.name) this.allFrames.push(f);
                    }
                    this.allFrames.sort(function(a, b) {
                        return _hcmn_.Reflect.compare(a.frameNumber | 0, b.frameNumber | 0);
                    });
                    var maxW = -1;
                    var maxH = -1;
                    var _g1 = 0;
                    var _g11 = this.allFrames;
                    while (_g1 < _g11.length) {
                        var f1 = _g11[_g1];
                        ++_g1;
                        if (f1.frame.w > maxW) maxW = f1.frame.w;
                        if (f1.frame.h > maxH) maxH = f1.frame.h;
                    }
                    var tmpC;
                    var _this = window.document;
                    tmpC = _this.createElement("canvas");
                    tmpC.width = maxW;
                    tmpC.height = maxH;
                    var _g2 = 0;
                    var _g12 = this.allFrames;
                    while (_g2 < _g12.length) {
                        var f2 = _g12[_g2];
                        ++_g2;
                        if (!(function($this) {
                                var $r;
                                var key = f2.state;
                                $r = $this.allTextures.exists(key);
                                return $r;
                            }(this))) {
                            var key1 = f2.state;
                            this.anims.set(key1, [f2.frameNumber]);
                            var key2 = f2.state;
                            var value = [new PIXI.Texture(tex, new PIXI.Rectangle(_hcmn_.Std.parseFloat(f2.frame.x), _hcmn_.Std.parseFloat(f2.frame.y), _hcmn_.Std.parseFloat(f2.frame.w), _hcmn_.Std.parseFloat(f2.frame.h)))];
                            this.allTextures.set(key2, value);
                        } else {
                            ((function($this) {
                                var $r;
                                var key3 = f2.state;
                                $r = $this.anims.get(key3);
                                return $r;
                            }(this))).push(f2.frameNumber);
                            ((function($this) {
                                var $r;
                                var key4 = f2.state;
                                $r = $this.allTextures.get(key4);
                                return $r;
                            }(this))).push(new PIXI.Texture(tex, new PIXI.Rectangle(_hcmn_.Std.parseFloat(f2.frame.x), _hcmn_.Std.parseFloat(f2.frame.y), _hcmn_.Std.parseFloat(f2.frame.w), _hcmn_.Std.parseFloat(f2.frame.h))));
                        }
                    }
                } else if (this.mcDefVersion == 2) {
                    this.allFrames = _hcmn_.Reflect.getProperty(mcDef.animeDef, mcDef.name).frames;
                    var fields = _hcmn_.Reflect.fields(this.allFrames);
                    var hasOffsets = false;
                    var _g3 = 0;
                    while (_g3 < fields.length) {
                        var field = fields[_g3];
                        ++_g3;
                        var f3 = _hcmn_.Reflect.getProperty(this.allFrames, field);
                        if (f3.offset != null) {
                            hasOffsets = true;
                            break;
                        }
                    }
                    if (hasOffsets) {
                        var _g4 = 0;
                        while (_g4 < fields.length) {
                            var field1 = fields[_g4];
                            ++_g4;
                            var f4 = _hcmn_.Reflect.getProperty(this.allFrames, field1);
                            if (!this.allTextures.exists(f4.lbl)) {
                                var value1 = [_hcmn_.Std.parseInt(field1)];
                                this.anims.set(f4.lbl, value1);
                                var orig = new PIXI.Rectangle(_hcmn_.Std.parseInt(f4.rect.x), _hcmn_.Std.parseInt(f4.rect.y), _hcmn_.Std.parseInt(f4.rect.w), _hcmn_.Std.parseInt(f4.rect.h));
                                var trim = new PIXI.Rectangle(_hcmn_.Std.parseInt(f4.offset.x), _hcmn_.Std.parseInt(f4.offset.y), _hcmn_.Std.parseInt(f4.rect.w), _hcmn_.Std.parseInt(f4.rect.h));
                                var tmpBaseTex = PIXI.BaseTexture.fromCanvas(mcDef.animationBitmap, PIXI.SCALE_MODES.LINEAR);
                                var value2 = [new PIXI.Texture(tmpBaseTex, orig, trim, trim)];
                                this.allTextures.set(f4.lbl, value2);
                            } else {
                                this.anims.get(f4.lbl).push(_hcmn_.Std.parseInt(field1));
                                var orig1 = new PIXI.Rectangle(_hcmn_.Std.parseInt(f4.rect.x), _hcmn_.Std.parseInt(f4.rect.y), _hcmn_.Std.parseInt(f4.rect.w), _hcmn_.Std.parseInt(f4.rect.h));
                                var trim1 = new PIXI.Rectangle(_hcmn_.Std.parseInt(f4.offset.x), _hcmn_.Std.parseInt(f4.offset.y), _hcmn_.Std.parseInt(f4.rect.w), _hcmn_.Std.parseInt(f4.rect.h));
                                var tmpBaseTex1 = PIXI.BaseTexture.fromCanvas(mcDef.animationBitmap, PIXI.SCALE_MODES.LINEAR);
                                this.allTextures.get(f4.lbl).push(new PIXI.Texture(tmpBaseTex1, orig1, trim1, trim1));
                            }
                        }
                    } else {
                        var _g5 = 0;
                        while (_g5 < fields.length) {
                            var field2 = fields[_g5];
                            ++_g5;
                            var f5 = _hcmn_.Reflect.getProperty(this.allFrames, field2);
                            if (!this.allTextures.exists(f5.lbl)) {
                                var value3 = [_hcmn_.Std.parseInt(field2)];
                                this.anims.set(f5.lbl, value3);
                                var value4 = [new PIXI.Texture(tex, new PIXI.Rectangle(parseFloat(f5.rect.x), parseFloat(f5.rect.y), parseFloat(f5.rect.w), parseFloat(f5.rect.h)))];
                                this.allTextures.set(f5.lbl, value4);
                            } else {
                                this.anims.get(f5.lbl).push(_hcmn_.Std.parseInt(field2));
                                this.allTextures.get(f5.lbl).push(new PIXI.Texture(tex, new PIXI.Rectangle(parseFloat(f5.rect.x), parseFloat(f5.rect.y), parseFloat(f5.rect.w), parseFloat(f5.rect.h))));
                            }
                        }
                    }
                }
                this._mc = new PIXI.extras.AnimatedSprite(this.allTextures.get(mcDef.animDefState != null ? mcDef.animDefState : "default"));
                this._mc.interactive = false;
                this._mc.buttonMode = false;
                this._mc.animationSpeed = 0.5;
                this._mc.onComplete = $bind(this, this.runAllHandlers);
                this._mc.loop = false;
                this.currentStateName = mcDef.animDefState;
                if (mcDef.offScreen == true) {
                    this.osStage = new displayengineImpl.OffscreenStage(this._mc.width | 0, this._mc.height | 0);
                    this.osStage.getStage().addChild(this._mc);
                    this.bitmap = new displayengineImpl.Bitmap(this.osStage, new displayEngineApi.Rectangle(0, 0, this._mc.width, this._mc.height));
                    this._obj.addChild(this.bitmap.getDisplayObject());
                } else this._obj.addChild(this._mc);
            }
        };
        displayengineImpl.PixiMovieClip = ck_implements(displayengineImpl.PixiMovieClip, displayEngineApi.IMovieClip);
        displayengineImpl.PixiMovieClip.__interfaces__ = [displayEngineApi.IMovieClip];
        displayengineImpl.PixiMovieClip.__name__ = ["displayengineImpl", "PixiMovieClip"];
        displayengineImpl.PixiMovieClip.__super__ = displayengineImpl.Sprite;
        for (var k in displayengineImpl.Sprite.prototype) displayengineImpl.PixiMovieClip.prototype[k] = displayengineImpl.Sprite.prototype[k];
        displayengineImpl.PixiMovieClip.prototype._mc = null;
        displayengineImpl.PixiMovieClip.prototype.allFrames = null;
        displayengineImpl.PixiMovieClip.prototype.anims = null;
        displayengineImpl.PixiMovieClip.prototype.allTextures = null;
        displayengineImpl.PixiMovieClip.prototype._enabled = null;
        displayengineImpl.PixiMovieClip.prototype.allOnCompleteHandlers = null;
        displayengineImpl.PixiMovieClip.prototype.allOnStartHandlers = null;
        displayengineImpl.PixiMovieClip.prototype.currentStateName = null;
        displayengineImpl.PixiMovieClip.prototype.mcDefVersion = null;
        displayengineImpl.PixiMovieClip.prototype.mcDef = null;
        displayengineImpl.PixiMovieClip.prototype.bitmap = null;
        displayengineImpl.PixiMovieClip.prototype.osStage = null;
        displayengineImpl.PixiMovieClip.prototype.applyPNGMask = function(mask) {
            if (this.osStage != null) this.osStage.applyMask(mask);
        };
        displayengineImpl.PixiMovieClip.prototype.toBitmap = function() {
            if (this.osStage != null) return new displayengineImpl.Bitmap(this.osStage, new displayEngineApi.Rectangle(0, 0, this._obj.width, this._obj.height));
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.getStateFrameCount = function(stateName) {
            if (stateName == null) stateName = this.currentStateName;
            if (this.anims.exists(stateName)) return this.anims.get(stateName).length;
            return -1;
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndPlay = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                this._mc.textures = this.allTextures.get(scene);
                this._mc.gotoAndPlay(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndStop = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                this._mc.textures = this.allTextures.get(scene);
                this._mc.gotoAndStop(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndPlayReversed = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                var _this = this.allTextures.get(scene);
                this._mc.textures = _this.slice();
                this._mc.textures.reverse();
                this._mc.gotoAndPlay(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.gotoAndStopReversed = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            this.currentStateName = scene;
            if (this.allTextures.exists(scene)) {
                var _this = this.allTextures.get(scene);
                this._mc.textures = _this.slice();
                this._mc.textures.reverse();
                this._mc.gotoAndStop(fromFrame);
            }
        };
        displayengineImpl.PixiMovieClip.prototype.nextFrame = function() {
            if (this._mc.currentFrame >= this.getStateFrameCount(this.currentStateName)) this._mc.currentFrame = 0;
            this.gotoAndStop(this.currentStateName, this._mc.currentFrame);
            ++this._mc.currentFrame;
        };
        displayengineImpl.PixiMovieClip.prototype.prevFrame = function() {
            this.gotoAndStop(this.currentStateName, this._mc.currentFrame);
            --this._mc.currentFrame;
            if (this._mc.currentFrame == 0) this._mc.currentFrame = this.getStateFrameCount(this.currentStateName) - 1;
        };
        displayengineImpl.PixiMovieClip.prototype.nextScene = function() {};
        displayengineImpl.PixiMovieClip.prototype.prevScene = function() {};
        displayengineImpl.PixiMovieClip.prototype.play = function() {
            this._mc.play();
        };
        displayengineImpl.PixiMovieClip.prototype.stop = function() {
            this._mc.stop();
        };
        displayengineImpl.PixiMovieClip.prototype.onAnimationEnd = function(handler) {
            this.allOnCompleteHandlers.push(handler);
        };
        displayengineImpl.PixiMovieClip.prototype.offAnimationEnd = function(handler) {
            var x = handler;
            _hcmn_.HxOverrides.remove(this.allOnCompleteHandlers, x);
        };
        displayengineImpl.PixiMovieClip.prototype.onAnimationStart = function(handler) {
            this.allOnStartHandlers.push(handler);
        };
        displayengineImpl.PixiMovieClip.prototype.offAnimationStart = function(handler) {
            var x = handler;
            _hcmn_.HxOverrides.remove(this.allOnStartHandlers, x);
        };
        displayengineImpl.PixiMovieClip.prototype.runAllHandlers = function() {
            var _g = 0;
            var _g1 = this.allOnCompleteHandlers;
            while (_g < _g1.length) {
                var handler = _g1[_g];
                ++_g;
                handler();
            }
            var _g2 = 0;
            var _g11 = this.allOnStartHandlers;
            while (_g2 < _g11.length) {
                var handler1 = _g11[_g2];
                ++_g2;
                handler1();
            }
        };
        displayengineImpl.PixiMovieClip.prototype.getEnabled = function() {
            return this._enabled;
        };
        displayengineImpl.PixiMovieClip.prototype.setEnabled = function(val) {
            this._enabled = val;
        };
        displayengineImpl.PixiMovieClip.prototype.getAnimationSpeed = function() {
            return this._mc.animationSpeed * 10 * 6;
        };
        displayengineImpl.PixiMovieClip.prototype.setAnimationSpeed = function(val) {
            this._mc.animationSpeed = val / 10 / 6;
        };
        displayengineImpl.PixiMovieClip.prototype.getPaused = function() {
            return !this._mc.playing;
        };
        displayengineImpl.PixiMovieClip.prototype.setPaused = function(value) {
            this._mc.playing = false;
        };
        displayengineImpl.PixiMovieClip.prototype.getLoop = function() {
            return this._mc.loop;
        };
        displayengineImpl.PixiMovieClip.prototype.setLoop = function(value) {
            this._mc.loop = value;
        };
        displayengineImpl.PixiMovieClip.prototype.getCurrentFrame = function() {
            return this._mc.currentFrame;
        };
        displayengineImpl.PixiMovieClip.prototype.setCurrentFrame = function(value) {
            this._mc.currentFrame = value;
        };
        displayengineImpl.PixiMovieClip.prototype.getMCEvents = function() {
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.dispose = function() {
            this.stop();
            var _g = 0;
            var _g1 = this.allFrames;
            while (_g < _g1.length) {
                var frame = _g1[_g];
                ++_g;
                frame = null;
            }
            this.allFrames = null;
            if (this.anims != null) {
                var $it0 = this.anims.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    this.anims.remove(key);
                }
                this.anims = null;
            }
            if (this.allTextures != null) {
                var $it1 = this.allTextures.keys();
                while ($it1.hasNext()) {
                    var key1 = $it1.next();
                    this.allTextures.remove(key1);
                }
                this.allTextures = null;
            }
            var _g2 = 0;
            var _g11 = this.allOnCompleteHandlers;
            while (_g2 < _g11.length) {
                var handler = _g11[_g2];
                ++_g2;
                handler = null;
            }
            this.allOnCompleteHandlers = null;
            var _g3 = 0;
            var _g12 = this.allOnStartHandlers;
            while (_g3 < _g12.length) {
                var handler1 = _g12[_g3];
                ++_g3;
                handler1 = null;
            }
            this.allOnStartHandlers = null;
            displayengineImpl.Sprite.prototype.dispose.call(this);
            if (this.osStage != null) {
                this.osStage.dispose();
                this.osStage = null;
                this.bitmap.dispose();
            }
        };
        displayengineImpl.PixiMovieClip.prototype.clone = function() {
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.getOffscreenBitmaps = function() {
            return null;
        };
        displayengineImpl.PixiMovieClip.prototype.addUnderMask = function(maskId, objToMask) {
            null;
            return;
        };
        displayengineImpl.PixiMovieClip.prototype.__class__ = displayengineImpl.PixiMovieClip;
        displayengineImpl.MovieClip = function(mcDef) {
            if (mcDef.offScreen == null) mcDef.offScreen = false;
            displayengineImpl.PixiMovieClip.call(this, mcDef);
            if (mcDef.videoDef != null) this.initVideo(mcDef.videoDef);
            displayengineImpl.MovieClip.mcCount++;
        };
        displayengineImpl.MovieClip = ck_implements(displayengineImpl.MovieClip, displayEngineApi.IMovieClip);
        displayengineImpl.MovieClip.__interfaces__ = [displayEngineApi.IMovieClip];
        displayengineImpl.MovieClip.__name__ = ["displayengineImpl", "MovieClip"];
        displayengineImpl.MovieClip.__super__ = displayengineImpl.PixiMovieClip;
        for (var k in displayengineImpl.PixiMovieClip.prototype) displayengineImpl.MovieClip.prototype[k] = displayengineImpl.PixiMovieClip.prototype[k];
        displayengineImpl.MovieClip.prototype.getOffscreenBitmaps = function() {
            if (this.osStage != null) return this.osStage.getRegisteredBitmaps();
            return null;
        };
        displayengineImpl.MovieClip.prototype.createShapeMask = function(cfg) {
            var shape = new displayengineImpl.Graphics(true);
            shape.lineStyle(1, 0, 0);
            shape.beginFill(0);
            var shapePoints = cfg;
            shape.moveTo(shapePoints[0][0][0], shapePoints[0][0][1]);
            var _g1 = 0;
            var _g = shapePoints.length;
            while (_g1 < _g) {
                var i = _g1++;
                var points = shapePoints[i];
                var _g3 = 0;
                var _g2 = points.length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    shape.quadraticCurveTo(points[1][0], points[1][1], points[2][0], points[2][1]);
                }
            }
            return shape;
        };
        displayengineImpl.MovieClip.prototype.createPNGMask = function(cfg) {
            var canvasMask;
            var _this = window.document;
            canvasMask = _this.createElement("canvas");
            var ctx = canvasMask.getContext("2d", null);
            ctx.fillStyle = "#ffffff";
            ctx.beginPath();
            ctx.moveTo(cfg[0][0][0], cfg[0][0][1]);
            var _g1 = 0;
            var _g = cfg.length;
            while (_g1 < _g) {
                var i = _g1++;
                var points = cfg[i];
                var _g3 = 0;
                var _g2 = points.length;
                while (_g3 < _g2) {
                    var j = _g3++;
                    ctx.quadraticCurveTo(points[1][0], points[1][1], points[2][0], points[2][1]);
                }
            }
            ctx.closePath();
            return canvasMask;
        };
        displayengineImpl.MovieClip.prototype.findDispObjByName = function(id, children) {
            var _g1 = 0;
            var _g = children.length;
            while (_g1 < _g) {
                var i = _g1++;
                var ob = children[i];
                if (ob.name == id) return ob;
                else if (ob != null && ob.getChildren != null && ob.getChildren() != null) {
                    var displayObj = this.findDispObjByName(id, ob.getChildren());
                    if (displayObj != null) return displayObj;
                } else {}
            }
            return null;
        };
        displayengineImpl.MovieClip.prototype.initVideo = function(videoDef) {
            var video = new displayengineImpl.MCVideo(videoDef.src, videoDef.poster, videoDef.width, videoDef.height, videoDef.framerate, videoDef.autoPlay, videoDef.loop);
            this.addChild(video);
        };
        displayengineImpl.MovieClip.prototype.setDisplayType = function() {
            displayengineImpl.PixiMovieClip.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.MOVIE_CLIP);
        };
        displayengineImpl.MovieClip.prototype.gotoAndPlay = function(scene, fromFrame) {
            if (fromFrame == null) fromFrame = 0;
            if (scene == null) scene = "default";
            displayengineImpl.PixiMovieClip.prototype.gotoAndPlay.call(this, scene, fromFrame);
        };
        displayengineImpl.MovieClip.prototype.play = function() {
            displayengineImpl.PixiMovieClip.prototype.play.call(this);
        };
        displayengineImpl.MovieClip.prototype.stop = function() {
            displayengineImpl.PixiMovieClip.prototype.stop.call(this);
        };
        displayengineImpl.MovieClip.prototype.getPaused = function() {
            return displayengineImpl.PixiMovieClip.prototype.getPaused.call(this);
        };
        displayengineImpl.MovieClip.prototype.on = function(type, listener, useCapture) {
            this.addEventListener(type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.addEventListener = function(type, listener, useCapture) {
            if (_hcmn_.StringTools.startsWith(type, "mc_")) switch (type) {
                case "mc_animationcomplete":
                    this.onAnimationEnd(listener);
                    break;
                case "mc_animationstart":
                    this.onAnimationStart(listener);
                    break;
                case "mc_animationtick":
                    break;
                default:
            } else displayengineImpl.PixiMovieClip.prototype.addEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.off = function(type, listener, useCapture) {
            this.removeEventListener(type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.removeEventListener = function(type, listener, useCapture) {
            if (_hcmn_.StringTools.startsWith(type, "mc_")) switch (type) {
                case "mc_animationcomplete":
                    this.offAnimationEnd(listener);
                    break;
                case "mc_animationstart":
                    this.offAnimationStart(listener);
                    break;
                case "mc_animationtick":
                    break;
                default:
            } else displayengineImpl.PixiMovieClip.prototype.removeEventListener.call(this, type, listener, useCapture);
        };
        displayengineImpl.MovieClip.prototype.dispose = function() {
            displayengineImpl.PixiMovieClip.prototype.dispose.call(this);
            displayengineImpl.MovieClip.mcCount--;
        };
        displayengineImpl.MovieClip.prototype.clone = function() {
            return new displayengineImpl.MovieClip(this.mcDef);
        };
        displayengineImpl.MovieClip.prototype.__class__ = displayengineImpl.MovieClip;
        displayengineImpl.OffscreenStage = function(width, height, isWebGL, timingMode, targetFPS) {
            if (targetFPS == null) targetFPS = 30;
            if (isWebGL == null) isWebGL = false;
            this.maskY = 0;
            this.maskX = 0;
            this._bitmapChildren = [];
            if (timingMode == null) timingMode = displayEngineApi.TimingMode.RAF;
            var _this = window.document;
            this._canvas = _this.createElement("canvas");
            this._canvas.width = width;
            this._canvas.height = height;
            this._canvas.setAttribute("style", "pointer-events: none; width: " + width + "px; height: " + height + "px; display: none;");
            this._width = width;
            this._height = height;
            this._isWebGL = isWebGL;
            if (!isWebGL) this._context = this._canvas.getContext("2d", null);
            this.id = displayEngineUtils.Utils.uuid();
            var stageDef = new displayEngineApi.StageDef("offscreen" + _hcmn_.Math.round(_hcmn_.Math.random() * 1000), new displayEngineApi.Point(width, height), this._canvas, isWebGL, timingMode, targetFPS);
            stageDef.targetFPS = targetFPS;
            if (this._isWebGL) stageDef.forceWebGL = true;
            this._stage = new displayengineImpl.Stage(stageDef);
            this._stage.set_isOffscreen(true);
            if (this.detectIE()) window.document.body.appendChild(this._canvas);
            displayengineImpl.OffscreenStage.allOffscreenStages.push(this);
        };
        displayengineImpl.OffscreenStage = ck_implements(displayengineImpl.OffscreenStage, displayEngineApi.IOffscreenStage);
        displayengineImpl.OffscreenStage.__interfaces__ = [displayEngineApi.IOffscreenStage];
        displayengineImpl.OffscreenStage.__name__ = ["displayengineImpl", "OffscreenStage"];
        displayengineImpl.OffscreenStage.prototype._canvas = null;
        displayengineImpl.OffscreenStage.prototype._maskedCanvas = null;
        displayengineImpl.OffscreenStage.prototype._context = null;
        displayengineImpl.OffscreenStage.prototype._maskedContext = null;
        displayengineImpl.OffscreenStage.prototype._stage = null;
        displayengineImpl.OffscreenStage.prototype._bitmapChildren = null;
        displayengineImpl.OffscreenStage.prototype._mask = null;
        displayengineImpl.OffscreenStage.prototype._isWebGL = null;
        displayengineImpl.OffscreenStage.prototype._width = null;
        displayengineImpl.OffscreenStage.prototype._height = null;
        displayengineImpl.OffscreenStage.prototype.maskX = null;
        displayengineImpl.OffscreenStage.prototype.maskY = null;
        displayengineImpl.OffscreenStage.prototype.id = null;
        displayengineImpl.OffscreenStage.prototype.applyMask = function(mask) {
            if (!this._isWebGL) {
                if (mask != null) this._mask = mask;
                if (this._mask != null) {
                    var _this = window.document;
                    this._maskedCanvas = _this.createElement("canvas");
                    this._maskedCanvas.width = this._width;
                    this._maskedCanvas.height = this._height;
                    this._maskedCanvas.setAttribute("style", "pointer-events: none; width: " + this._width + "px; height: " + this._height + "px; display: none;");
                    this._maskedContext = this._maskedCanvas.getContext("2d", null);
                    this._stage.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.drawMask));
                    var _g = 0;
                    var _g1 = this._bitmapChildren;
                    while (_g < _g1.length) {
                        var bmp = _g1[_g];
                        ++_g;
                        bmp.update(this._maskedCanvas, this._width, this._height);
                    }
                }
            } else null;
        };
        displayengineImpl.OffscreenStage.prototype.drawMask = function() {
            this._maskedContext.drawImage(this._mask, this.maskX, this.maskY);
            this._maskedContext.globalCompositeOperation = "source-atop";
            this._maskedContext.drawImage(this._canvas, 0, 0, this._width, this._height);
        };
        displayengineImpl.OffscreenStage.prototype.dispose = function() {
            _hcmn_.HxOverrides.remove(displayengineImpl.OffscreenStage.allOffscreenStages, this);
            var _g = 0;
            var _g1 = this._bitmapChildren;
            while (_g < _g1.length) {
                var bitmap = _g1[_g];
                ++_g;
                if (bitmap != null && bitmap.getParent() != null) {
                    bitmap.getParent().removeChild(bitmap.getDisplayObject());
                    bitmap.dispose();
                    bitmap = null;
                }
            }
            this._bitmapChildren = null;
            this._stage.dispose();
            this._stage = null;
            if (this.detectIE() || this._canvas.parentElement != null) window.document.body.removeChild(this._canvas);
            this._context = null;
            this._canvas = null;
            this._maskedContext = null;
            this._mask = null;
            this._maskedCanvas = null;
        };
        displayengineImpl.OffscreenStage.prototype.addBitmapChild = function(bmp) {
            this._bitmapChildren.push(bmp);
        };
        displayengineImpl.OffscreenStage.prototype.getRegisteredBitmaps = function() {
            return this._bitmapChildren;
        };
        displayengineImpl.OffscreenStage.prototype.getCanvas = function() {
            return this._canvas;
        };
        displayengineImpl.OffscreenStage.prototype.getMaskedCanvas = function() {
            return this._maskedCanvas;
        };
        displayengineImpl.OffscreenStage.prototype.getStage = function() {
            return this._stage;
        };
        displayengineImpl.OffscreenStage.prototype.setMask = function(m) {
            this._mask = m;
        };
        displayengineImpl.OffscreenStage.prototype.getWidth = function() {
            return this._canvas.width;
        };
        displayengineImpl.OffscreenStage.prototype.getHeight = function() {
            return this._canvas.height;
        };
        displayengineImpl.OffscreenStage.prototype.detectIE = function() {
            var ua = window.navigator.userAgent.toUpperCase();
            var msie = ua.indexOf("MSIE ");
            if (msie > 0) return true;
            var trident = ua.indexOf("TRIDENT/");
            if (trident > 0) {
                var rv = ua.indexOf("RV:");
                return rv > 0;
            }
            var edge = ua.indexOf("EDGE/");
            if (edge > 0) return true;
            return false;
        };
        displayengineImpl.OffscreenStage.prototype.applyFilter = function(filter, params) {
            var ctx = this._canvas.getContext("2d", null);
            var idata = ctx.getImageData(0, 0, this._width, this._height);
            var data = idata.data;
            if (params == null) params = {};
            var saturation = 0;
            if (params.saturation != 0) saturation = params.saturation;
            if (saturation < -1) saturation = -1;
            if (saturation > 1) saturation = 1;
            var gradientFilterFactor = 0;
            var gammaFilterFactor = 5;
            var brightnessFilterFactor = 100;
            var noiseFilterFactor = 60;
            switch (filter[1]) {
                case 2:
                    var w = idata.width;
                    var limit = data.length;
                    var _g = 0;
                    while (_g < limit) {
                        var i = _g++;
                        if (i % 4 == 3) continue;
                        data[i] = 127 + 2 * data[i] - data[i + 4] - data[i + w * 4];
                    }
                    break;
                case 1:
                    var i1 = 0;
                    while (i1 < data.length) {
                        var r = data[i1];
                        var g = data[i1 + 1];
                        var b = data[i1 + 2];
                        var brightness = 3 * r + 4 * g + b >>> 3;
                        data[i1] = brightness;
                        data[i1 + 1] = brightness;
                        data[i1 + 2] = brightness;
                        i1 += 4;
                    }
                    break;
                case 3:
                    var i2 = 0;
                    while (i2 < data.length) {
                        data[i2] = 255 - data[i2];
                        data[i2 + 1] = 255 - data[i2 + 1];
                        data[i2 + 2] = 255 - data[i2 + 2];
                        i2 += 4;
                    }
                    break;
                case 9:
                    var total = data.length;
                    var i3 = 0;
                    while (i3 < data.length) {
                        data[i3 + 3] = gradientFilterFactor + 255 * (total - i3) / total | 0;
                        i3 += 4;
                    }
                    break;
                case 4:
                    var r1 = 0;
                    var g1 = 0;
                    var b1 = 0;
                    var i4 = 0;
                    while (i4 < data.length) {
                        r1 = data[i4];
                        g1 = data[i4 + 1];
                        b1 = data[i4 + 2];
                        data[i4] = b1;
                        data[i4 + 1] = r1;
                        data[i4 + 2] = g1;
                        i4 += 4;
                    }
                    break;
                case 5:
                    var g2 = 0;
                    var b2 = 0;
                    var i5 = 0;
                    while (i5 < data.length) {
                        g2 = data[i5 + 1];
                        b2 = data[i5 + 2];
                        data[i5 + 1] = b2;
                        data[i5 + 2] = g2;
                        i5 += 4;
                    }
                    break;
                case 6:
                    var r2 = 0;
                    var g3 = 0;
                    var b3 = 0;
                    var i6 = 0;
                    while (i6 < data.length) {
                        r2 = data[i6];
                        g3 = data[i6 + 1];
                        b3 = data[i6 + 2];
                        data[i6] = g3;
                        data[i6 + 1] = b3;
                        data[i6 + 2] = r2;
                        i6 += 4;
                    }
                    break;
                case 7:
                    var r3 = 0;
                    var g4 = 0;
                    var b4 = 0;
                    var i7 = 0;
                    while (i7 < data.length) {
                        r3 = data[i7];
                        g4 = data[i7 + 1];
                        b4 = data[i7 + 2];
                        data[i7] = b4;
                        data[i7 + 1] = g4;
                        data[i7 + 2] = r3;
                        i7 += 4;
                    }
                    break;
                case 8:
                    var r4 = 0;
                    var g5 = 0;
                    var b5 = 0;
                    var i8 = 0;
                    while (i8 < data.length) {
                        r4 = data[i8];
                        g5 = data[i8 + 1];
                        b5 = data[i8 + 2];
                        data[i8] = g5;
                        data[i8 + 1] = r4;
                        data[i8 + 2] = b5;
                        i8 += 4;
                    }
                    break;
                case 10:
                    var avg = 0;
                    var i9 = 0;
                    while (i9 < data.length) {
                        avg = 0.3 * data[i9] + 0.59 * data[i9 + 1] + 0.11 * data[i9 + 2] | 0;
                        data[i9] = avg + 100;
                        data[i9 + 1] = avg + 50;
                        data[i9 + 2] = avg;
                        i9 += 4;
                    }
                    break;
                case 11:
                    var i10 = 0;
                    while (i10 < data.length) {
                        data[i10] = (data[i10] * 0.393 + data[i10 + 1] * 0.769 + data[i10 + 2] * 0.189) / 1.351 | 0;
                        data[i10 + 1] = (data[i10] * 0.349 + data[i10 + 1] * 0.686 + data[i10 + 2] * 0.168) / 1.203 | 0;
                        data[i10 + 2] = (data[i10] * 0.272 + data[i10 + 1] * 0.534 + data[i10 + 2] * 0.131) / 2.140 | 0;
                        i10 += 4;
                    }
                    break;
                case 13:
                    var i11 = 0;
                    while (i11 < data.length) {
                        data[i11] += brightnessFilterFactor;
                        data[i11 + 1] += brightnessFilterFactor;
                        data[i11 + 2] += brightnessFilterFactor;
                        i11 += 4;
                    }
                    break;
                case 12:
                    var i12 = 0;
                    while (i12 < data.length) {
                        data[i12] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12] / 255, gammaFilterFactor) * 255);
                        data[i12 + 1] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12 + 1] / 255, gammaFilterFactor) * 255);
                        data[i12 + 2] = _hcmn_.Std["int"](_hcmn_.Math.pow(data[i12 + 2] / 255, gammaFilterFactor) * 255);
                        i12 += 4;
                    }
                    break;
                case 14:
                    var rand = 0;
                    var i13 = 0;
                    while (i13 < data.length) {
                        rand = _hcmn_.Std["int"]((0.5 - _hcmn_.Math.random()) * noiseFilterFactor);
                        data[i13] += rand;
                        data[i13 + 1] += rand;
                        data[i13 + 2] += rand;
                        i13 += 4;
                    }
                    break;
                case 15:
                    if (saturation == 0) return;
                    var adjust = -saturation;
                    var max = 0;
                    var i14 = 0;
                    while (i14 < data.length) {
                        max = _hcmn_.Math.max(data[i14], _hcmn_.Math.max(data[i14 + 1], data[i14 + 2]));
                        if (max != data[i14]) data[i14] += (max - data[i14]) * adjust | 0;
                        else data[i14] += 0;
                        if (max != data[i14 + 1]) data[i14 + 1] += (max - data[i14 + 1]) * adjust | 0;
                        else data[i14 + 1] += 0;
                        if (max != data[i14 + 2]) data[i14 + 2] += (max - data[i14 + 2]) * adjust | 0;
                        else data[i14 + 2] += 0;
                        i14 += 4;
                    }
                    break;
                default:
            }
            ctx.putImageData(idata, 0, 0);
        };
        displayengineImpl.OffscreenStage.getAllStages = function() {
            return displayengineImpl.OffscreenStage.allOffscreenStages;
        };
        displayengineImpl.OffscreenStage.prototype.__class__ = displayengineImpl.OffscreenStage;
        displayengineImpl.ParticleSystem = function(bmp, type, config) {
            this.isRunning = false;
            this.loop = true;
            this.pathPassesNum = 0;
            this.position = 0;
            this.speed = 1;
            displayengineImpl.DisplayObjectContainer.call(this);
            if (_hcmn_.js_Boot.__instanceof(bmp, displayengineImpl.MovieClip)) this.bmp = bmp.toBitmap();
            else this.bmp = bmp;
            this.type = type;
            this.config = config;
            var art = null;
            if (_hcmn_.js_Boot.__instanceof(bmp, displayEngineApi.IBitmap)) art = bmp._texture;
            else if ((bmp instanceof Array) && bmp.__enum__ == null) {
                art = [];
                var _g = 0;
                var _g1;
                _g1 = _hcmn_.js_Boot.__cast(bmp, Array);
                while (_g < _g1.length) {
                    var b = _g1[_g];
                    ++_g;
                    if (_hcmn_.js_Boot.__instanceof(b, displayengineImpl.MovieClip)) {
                        var mcBMP = b.toBitmap();
                        if (mcBMP != null) art.push(mcBMP._texture);
                    } else art.push(b._texture);
                }
            }
            this.emitter = new PIXI.particles.Emitter(this._obj, art, config);
            if (type == "anim") this.emitter._particleConstructor = PIXI.particles.AnimatedParticle;
            else if (type == "path") this.emitter._particleConstructor = PIXI.particles.PathParticle;
        };
        displayengineImpl.ParticleSystem = ck_implements(displayengineImpl.ParticleSystem, displayEngineApi.IParticleSystem);
        displayengineImpl.ParticleSystem.__interfaces__ = [displayEngineApi.IParticleSystem];
        displayengineImpl.ParticleSystem.__name__ = ["displayengineImpl", "ParticleSystem"];
        displayengineImpl.ParticleSystem.__super__ = displayengineImpl.DisplayObjectContainer;
        for (var k in displayengineImpl.DisplayObjectContainer.prototype) displayengineImpl.ParticleSystem.prototype[k] = displayengineImpl.DisplayObjectContainer.prototype[k];
        displayengineImpl.ParticleSystem.prototype.emitter = null;
        displayengineImpl.ParticleSystem.prototype.speed = null;
        displayengineImpl.ParticleSystem.prototype.position = null;
        displayengineImpl.ParticleSystem.prototype.pathPassesNum = null;
        displayengineImpl.ParticleSystem.prototype.polypoints = null;
        displayengineImpl.ParticleSystem.prototype.loop = null;
        displayengineImpl.ParticleSystem.prototype.bmp = null;
        displayengineImpl.ParticleSystem.prototype.type = null;
        displayengineImpl.ParticleSystem.prototype.config = null;
        displayengineImpl.ParticleSystem.prototype.stage = null;
        displayengineImpl.ParticleSystem.prototype.isRunning = null;
        displayengineImpl.ParticleSystem.prototype.makePolyPoints = function(path) {
            var points = [];
            var firstPoint = path.points[0];
            var _g1 = 1;
            var _g = path.points.length;
            while (_g1 < _g) {
                var i = _g1++;
                var startPt = path.points[i - 1];
                var endPt = path.points[i];
                var dx = endPt.x - startPt.x;
                var dy = endPt.y - startPt.y;
                var _g2 = 0;
                while (_g2 < 51) {
                    var n = _g2++;
                    var x = startPt.x + dx * n / 50;
                    var y = startPt.y + dy * n / 50;
                    points.push(new displayEngineApi.Point(x - firstPoint.x, y - firstPoint.y));
                }
            }
            return points;
        };
        displayengineImpl.ParticleSystem.prototype.animateParticlesOnPath = function() {
            this.position += this.speed;
            if (this.position > this.polypoints.length - 1) {
                if (this.loop) this.position = 0;
                else return;
            }
            var pt = this.polypoints[this.position];
            this.moveTo(pt.x, pt.y);
        };
        displayengineImpl.ParticleSystem.prototype.update = function() {
            if (this.isRunning) {
                this.emitter.update(this.stage.getDeltaTime() / 1000);
                if (this.polypoints != null) this.animateParticlesOnPath();
            }
        };
        displayengineImpl.ParticleSystem.prototype.moveTo = function(x, y) {
            this.emitter.updateSpawnPos(x, y);
        };
        displayengineImpl.ParticleSystem.prototype.start = function(stage, path, loop) {
            if (loop == null) loop = true;
            var _g = this;
            this.stage = stage;
            this.stage = stage;
            this.loop = loop;
            if (path != null) this.polypoints = this.makePolyPoints(path);
            this.isRunning = true;
            _hcmn_.haxe_Timer.delay(function() {
                stage.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(_g, _g.update));
            }, 1);
        };
        displayengineImpl.ParticleSystem.prototype.stop = function() {
            this.isRunning = false;
            this.stage.off(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, $bind(this, this.update));
        };
        displayengineImpl.ParticleSystem.prototype.dispose = function() {
            this.stop();
            this.emitter.destroy();
            this.polypoints = null;
            this.bmp = null;
            this.config = null;
            displayengineImpl.DisplayObjectContainer.prototype.dispose.call(this);
        };
        displayengineImpl.ParticleSystem.prototype.__class__ = displayengineImpl.ParticleSystem;
        displayengineImpl.PixiStage = function(def) {
            this.isWebGL = false;
            this.options = {};
            this._mainLoop = [];
            this._allListeners = new _hcmn_.haxe_ds_StringMap();
            this._rendererName = displayEngineApi.RendererName.PIXI;
            this._stage = new PIXI.Container();
            this._stage.isStage = true;
            if (def.canvas != null) this.options.view = def.canvas;
            this.options.antialias = true;
            this.options.resolution = 1;
            this.options.transparent = true;
            this.isWebGL = def.isWebgl;
            if (this.isWebGL) {
                this.options.width = def.dimension.x;
                this.options.height = def.dimension.y;
                if (def.forceWebGL) this._renderer = new PIXI.WebGLRenderer(def.dimension.x, def.dimension.y, this.options);
                else this._renderer = PIXI.autoDetectRenderer(this.options, def.dimension.x, def.dimension.y);
            } else this._renderer = new PIXI.CanvasRenderer(def.dimension.x, def.dimension.y, this.options);
            this._renderer.autoResize = false;
            this._canvas = this._renderer.view;
        };
        displayengineImpl.PixiStage = ck_implements(displayengineImpl.PixiStage, displayEngineApi.IStage);
        displayengineImpl.PixiStage.__interfaces__ = [displayEngineApi.IStage];
        displayengineImpl.PixiStage.__name__ = ["displayengineImpl", "PixiStage"];
        displayengineImpl.PixiStage.prototype._rendererName = null;
        displayengineImpl.PixiStage.prototype._stage = null;
        displayengineImpl.PixiStage.prototype._canvas = null;
        displayengineImpl.PixiStage.prototype._renderer = null;
        displayengineImpl.PixiStage.prototype._allListeners = null;
        displayengineImpl.PixiStage.prototype._mainLoop = null;
        displayengineImpl.PixiStage.prototype._fpsInfo = null;
        displayengineImpl.PixiStage.prototype.options = null;
        displayengineImpl.PixiStage.prototype.isWebGL = null;
        displayengineImpl.PixiStage.prototype.update = function(e) {
            this._renderer.render(this._stage);
        };
        displayengineImpl.PixiStage.prototype.getRendererType = function() {
            if (_hcmn_.js_Boot.__instanceof(this._renderer, PIXI.WebGLRenderer)) return displayEngineApi.RendererType.RENDERER_WEBGL;
            else return displayEngineApi.RendererType.RENDERER_CANVAS;
        };
        displayengineImpl.PixiStage.prototype.removeAllChildren = function() {
            this._stage.removeChildren(0, this._stage.children.length);
        };
        displayengineImpl.PixiStage.prototype.addEventListener = function(type, listener, useCapture) {
            var _g = this;
            if (type == displayEngineApi.DisplayObjectEvents.ENTER_FRAME) this._mainLoop.push(listener);
            else {
                this._stage.interactive = true;
                if (this._allListeners.exists(type)) this._allListeners.get(type).push(listener);
                else {
                    var v = [];
                    this._allListeners.set(type, v);
                    v;
                    this._allListeners.get(type).push(listener);
                }
                if (!Object.prototype.hasOwnProperty.call(this._stage, type)) this._stage[type] = function(evt) {
                    if (_g._allListeners.get(type) != null) {
                        var _g1 = 0;
                        var _g2 = _g._allListeners.get(type);
                        while (_g1 < _g2.length) {
                            var fn = _g2[_g1];
                            ++_g1;
                            fn(evt);
                        }
                    }
                };
            }
        };
        displayengineImpl.PixiStage.prototype.removeEventListener = function(type, listener, useCapture) {
            if (type == displayEngineApi.DisplayObjectEvents.ENTER_FRAME) {
                var x = listener;
                _hcmn_.HxOverrides.remove(this._mainLoop, x);
            } else {
                var $it0 = this._allListeners.keys();
                while ($it0.hasNext()) {
                    var key = $it0.next();
                    if (key == type) {
                        var _this = this._allListeners.get(key);
                        var x1 = listener;
                        _hcmn_.HxOverrides.remove(_this, x1);
                        return;
                    }
                }
            }
        };
        displayengineImpl.PixiStage.prototype.removeAllEventListeners = function() {
            this._mainLoop = [];
            this._allListeners = new _hcmn_.haxe_ds_StringMap();
        };
        displayengineImpl.PixiStage.prototype.dispose = function() {
            this.removeAllEventListeners();
            this._renderer = null;
            this._stage = null;
            this._canvas = null;
            var $it0 = this._allListeners.keys();
            while ($it0.hasNext()) {
                var key = $it0.next(); {
                    this._allListeners.set(key, null);
                    null;
                }
                this._allListeners.remove(key);
            }
            this._allListeners = null;
            this._mainLoop = null;
            this._fpsInfo = null;
        };
        displayengineImpl.PixiStage.prototype.getRenderer = function() {
            return this._rendererName;
        };
        displayengineImpl.PixiStage.prototype.getCanvas = function() {
            return this._canvas;
        };
        displayengineImpl.PixiStage.prototype.getId = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setTimingMode = function(val) {};
        displayengineImpl.PixiStage.prototype.getTimingMode = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setFPS = function(val) {};
        displayengineImpl.PixiStage.prototype.getHeight = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setHeight = function(val) {
            this._canvas.height = val;
            this._stage.height = val;
            this._renderer.resize(this._renderer.width, val);
        };
        displayengineImpl.PixiStage.prototype.getWidth = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setWidth = function(val) {
            this._canvas.width = val;
            this._stage.width = val;
            this._renderer.resize(val, this._renderer.height);
        };
        displayengineImpl.PixiStage.prototype.getScaleX = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setScaleX = function(val) {};
        displayengineImpl.PixiStage.prototype.getScaleY = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setScaleY = function(val) {};
        displayengineImpl.PixiStage.prototype.setSize = function(width, height) {
            if (!this.isWebGL) {
                this._renderer.destroy();
                this._renderer = new PIXI.CanvasRenderer(width, height, this.options);
            } else {
                this._canvas.height = height;
                this._canvas.width = width;
                this._renderer.resize(width, height);
            }
        };
        displayengineImpl.PixiStage.prototype.getAlpha = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setAlpha = function(alpha) {};
        displayengineImpl.PixiStage.prototype.getVisible = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setVisible = function(val) {};
        displayengineImpl.PixiStage.prototype.getMouse = function(event) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.addChild = function(child) {};
        displayengineImpl.PixiStage.prototype.addChildAt = function(child, index) {};
        displayengineImpl.PixiStage.prototype.addChildren = function(_children_) {};
        displayengineImpl.PixiStage.prototype.removeChild = function(child) {};
        displayengineImpl.PixiStage.prototype.removeChildAt = function(index) {};
        displayengineImpl.PixiStage.prototype.getChildIndex = function(child) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.setChildIndex = function(child, index) {};
        displayengineImpl.PixiStage.prototype.getChildAt = function(index) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.getChildByID = function(id) {
            return null;
        };
        displayengineImpl.PixiStage.prototype.getNumChildren = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.getChildren = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.on = function(type, listener, useCapture) {};
        displayengineImpl.PixiStage.prototype.off = function(type, listener, useCapture) {};
        displayengineImpl.PixiStage.prototype.offAll = function() {};
        displayengineImpl.PixiStage.prototype.render = function() {};
        displayengineImpl.PixiStage.prototype.getDeltaTime = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.onWindowTouch = function(handler, fireOnlyOnce) {
            if (fireOnlyOnce == null) fireOnlyOnce = true;
        };
        displayengineImpl.PixiStage.prototype.getFpsInfo = function() {
            return null;
        };
        displayengineImpl.PixiStage.prototype.__class__ = displayengineImpl.PixiStage;
        displayengineImpl.Stage = function(def) {
            this.lastCalledTime = 0;
            this._onPointerDown = null;
            this.lastTap = 0;
            this._deltaTime = 0;
            this._currentTime = 0;
            this.fps = 60;
            this.children = new _hcmn_.haxe_ds_StringMap();
            var _g = this;
            if (def.canvas != null) {
                if (typeof(def.canvas) == "string") def.canvas = window.document.getElementById(def.canvas);
                if (def.canvas != null && def.dimension.x == null && def.dimension.y == null) {
                    var dim = this.getCanvasDimensions(def.canvas);
                    def.dimension = dim;
                }
            }
            displayengineImpl.PixiStage.call(this, def);
            this._id = def.id;
            this._mousePoint = new displayEngineApi.Point(0, 0);
            this._canvas.addEventListener("mousemove", $bind(this, this.updateMousePos), false);
            if (displayengineImpl.DisplayProvider.stages == null) displayengineImpl.DisplayProvider.stages = new _hcmn_.haxe_ds_StringMap();
            if (displayengineImpl.DisplayProvider.stages.get(this._id) != null) this._id = "STAGE_" + displayEngineUtils.Utils.uuid();
            displayengineImpl.DisplayProvider.stages.set(this._id, this);
            this._ticker = new displayengineImpl.Ticker();
            this._ticker.setup(def.timingMode, this._rendererName, def.targetFPS);
            $bind(this, this.update).stage_tick_function = true;
            if (def.timingMode != displayEngineApi.TimingMode.ONCE) this._ticker.onTick($bind(this, this.update));
            this._fpsInfo = {
                fps: 0,
                time: 0
            };
            window.document.body.addEventListener("mousedown", function(e) {
                if (e.button != 0) {
                    e.preventDefault();
                    e.stopPropagation();
                    e.stopImmediatePropagation();
                    return;
                }
            }, true);
            if (!displayengineImpl.Stage.tweenXSet) {
                displayengineImpl.Stage.tweenXSet = true;
                displayEngineUtils.TweenX.set_updateMode(displayEngineUtils.UpdateModeX.MANUAL);
                this.on(displayEngineApi.DisplayObjectEvents.ENTER_FRAME, function(e1) {
                    displayEngineUtils.TweenX.manualUpdate(_g._deltaTime / 1000);
                });
            }
        };
        displayengineImpl.Stage = ck_implements(displayengineImpl.Stage, displayEngineApi.IStage);
        displayengineImpl.Stage.__interfaces__ = [displayEngineApi.IStage];
        displayengineImpl.Stage.__name__ = ["displayengineImpl", "Stage"];
        displayengineImpl.Stage.__super__ = displayengineImpl.PixiStage;
        for (var k in displayengineImpl.PixiStage.prototype) displayengineImpl.Stage.prototype[k] = displayengineImpl.PixiStage.prototype[k];
        displayengineImpl.Stage.prototype._self = null;
        displayengineImpl.Stage.prototype._id = null;
        displayengineImpl.Stage.prototype.parentDOMObject = null;
        displayengineImpl.Stage.prototype.children = null;
        displayengineImpl.Stage.prototype._mousePoint = null;
        displayengineImpl.Stage.prototype._ticker = null;
        displayengineImpl.Stage.prototype.isOffscreen = null;
        displayengineImpl.Stage.prototype.fps = null;
        displayengineImpl.Stage.prototype._currentTime = null;
        displayengineImpl.Stage.prototype._deltaTime = null;
        displayengineImpl.Stage.prototype.timeout = null;
        displayengineImpl.Stage.prototype.lastTap = null;
        displayengineImpl.Stage.prototype.get_isOffscreen = function() {
            if (this._stage.isOffscreen != null) return this._stage.isOffscreen;
            return false;
        };
        displayengineImpl.Stage.prototype.set_isOffscreen = function(val) {
            return this._stage.isOffscreen = val;
        };
        displayengineImpl.Stage.prototype.getCanvasDimensions = function(canvas) {
            var dimension = new displayEngineApi.Point(0, 0);
            if (canvas.width != null) dimension.x = canvas.width;
            if (canvas.height != null) dimension.y = canvas.height;
            return dimension;
        };
        displayengineImpl.Stage.prototype._onPointerDown = null;
        displayengineImpl.Stage.prototype.onWindowTouch = function(handler, fireOnlyOnce) {
            if (fireOnlyOnce == null) fireOnlyOnce = true;
            var _g = this;
            if (this._onPointerDown == null) {
                var touchDevice = 'ontouchstart' in document.documentElement;
                var elm = window.document.body;
                this._onPointerDown = function(_) {
                    handler();
                    if (fireOnlyOnce) {
                        elm.removeEventListener(touchDevice ? "touchstart" : "mousedown", _g._onPointerDown, false);
                        _g._onPointerDown = null;
                    }
                };
                elm.addEventListener(touchDevice ? "touchstart" : "mousedown", this._onPointerDown, false);
            }
        };
        displayengineImpl.Stage.prototype.updateMousePos = function(evt) {
            var rect = this._canvas.getBoundingClientRect();
            var mouseX = evt.clientX - rect.left;
            var mouseY = evt.clientY - rect.top;
            this._mousePoint.x = mouseX;
            this._mousePoint.y = mouseY;
        };
        displayengineImpl.Stage.prototype.update = function(e) {
            var _g = 0;
            var _g1 = this._mainLoop;
            while (_g < _g1.length) {
                var f = _g1[_g];
                ++_g;
                f(e);
            }
            displayengineImpl.PixiStage.prototype.update.call(this, e);
            this.calculateFps();
        };
        displayengineImpl.Stage.prototype.render = function() {
            this.update();
        };
        displayengineImpl.Stage.prototype.getDeltaTime = function() {
            return this._deltaTime;
        };
        displayengineImpl.Stage.prototype.updateChildren = function(child, action) {
            if (action == null) action = "add";
            var _g = 0;
            var _g1 = child.children;
            while (_g < _g1.length) {
                var c = _g1[_g];
                ++_g;
                if (action == "add") c.stageName = this._id;
                else c.stageName = c.stageName;
                if (action == "remove") c.stageName = "";
                else c.stageName = c.stageName;
                if (_hcmn_.js_Boot.__instanceof(c, displayengineImpl.DisplayObjectContainer)) this.updateChildren(c);
            }
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.addChild = function(child) {
            if (child.getParent != null && child.getParent() != null) {
                if (child.getParent().removeChild != null) child.getParent().removeChild(child);
            }
            if (child.getDisplayObject == null) this._stage.addChild(child);
            else {
                this._stage.addChild(child.getDisplayObject());
                var key = child.id;
                var value = child;
                this.children.set(key, value);
                child._parent = this;
            }
            child.stageName = this._id;
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
            if (child.getZIndex != null && child.setZIndex != null) child.setZIndex(child.getZIndex());
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
            if (child._onAddedToStage != null) {
                child._onAddedToStage();
                child._onAddedToStage = null;
            }
        };
        displayengineImpl.Stage.prototype.addChildAt = function(child, index) {
            if (child.getParent != null && child.getParent() != null) {
                if (child.getParent().removeChild != null) child.getParent().removeChild(child);
            }
            if (child.getDisplayObject == null) this._stage.addChildAt(child, index);
            else {
                this._stage.addChildAt(child.getDisplayObject(), index);
                var key = child.id;
                var value = child;
                this.children.set(key, value);
                child._parent = this;
            }
            child.stageName = this._id;
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
            if (child._onAddedToStage != null) {
                child._onAddedToStage();
                child._onAddedToStage = null;
            }
        };
        displayengineImpl.Stage.prototype.addChildren = function(_children_) {
            var _g = 0;
            while (_g < _children_.length) {
                var child = _children_[_g];
                ++_g;
                if (child.getParent != null && child.getParent() != null) {
                    if (child.getParent().removeChild != null) child.getParent().removeChild(child);
                }
                if (child.getDisplayObject == null) this._stage.addChild(child);
                else {
                    this._stage.addChild(child.getDisplayObject());
                    var key = child.id;
                    var value = child;
                    this.children.set(key, value);
                    child._parent = this;
                }
                child.stageName = this._id;
                if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "add");
                if (child._onAddedToStage != null) {
                    child._onAddedToStage();
                    child._onAddedToStage = null;
                }
            }
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.removeChild = function(child) {
            if (child.getDisplayObject == null) this._stage.removeChild(child);
            else {
                var key = child.id;
                this.children.remove(key);
                this._stage.removeChild(child.getDisplayObject());
            }
            child.stageName = "";
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "remove");
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.removeChildAt = function(index) {
            var child = this.getChildAt(index)._owner;
            this.children.remove(child.id);
            child.stageName = "";
            if (_hcmn_.js_Boot.__instanceof(child, displayengineImpl.DisplayObjectContainer)) this.updateChildren(child, "remove");
            this._stage.removeChildAt(index);
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.removeAllChildren = function() {
            displayengineImpl.PixiStage.prototype.removeAllChildren.call(this);
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var childID = $it0.next();
                if (this.children.get(childID) != null && this.children.get(childID).getDisplayObject != null) {
                    this.children.set(childID, null);
                    this.children.remove(childID);
                }
            }
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.getChildren = function() {
            var _children = [];
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                _children.push(this.children.get(key));
            }
            return _children;
        };
        displayengineImpl.Stage.prototype.getChildIndex = function(child) {
            if (child.getDisplayObject == null) return this._stage.getChildIndex(child);
            return this._stage.getChildIndex(child.getDisplayObject());
        };
        displayengineImpl.Stage.prototype.setChildIndex = function(child, index) {
            if (child.getDisplayObject == null) this._stage.setChildIndex(child, index);
            else this._stage.setChildIndex(child.getDisplayObject(), index);
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.getChildAt = function(index) {
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                if (this.children.get(key).getZOrder() == index) return this.children.get(key);
            }
            return null;
        };
        displayengineImpl.Stage.prototype.getChildByID = function(id) {
            return this.children.get(id);
        };
        displayengineImpl.Stage.prototype.on = function(type, listener, useCapture) {
            this.addEventListener(type, listener, useCapture);
        };
        displayengineImpl.Stage.prototype.off = function(type, listener, useCapture) {
            this.removeEventListener(type, listener, useCapture);
        };
        displayengineImpl.Stage.prototype.offAll = function() {
            this.removeAllEventListeners();
            this._ticker.offTickAll();
        };
        displayengineImpl.Stage.prototype.getSelf = function() {
            return this._stage;
        };
        displayengineImpl.Stage.prototype.getId = function() {
            return this._id;
        };
        displayengineImpl.Stage.prototype.getWidth = function() {
            var _w = this._canvas.width;
            var _width;
            try {
                _width = _hcmn_.Std.parseInt(_w);
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
                if (_hcmn_.js_Boot.__instanceof(err, Error)) {
                    _width = window.parseInt(_w);
                } else throw (err);
            }
            return _width;
        };
        displayengineImpl.Stage.prototype.setWidth = function(val) {
            displayengineImpl.PixiStage.prototype.setWidth.call(this, val);
        };
        displayengineImpl.Stage.prototype.getHeight = function() {
            var _h = this._canvas.height;
            var _height;
            try {
                _height = _hcmn_.Std.parseInt(_h);
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
                if (_hcmn_.js_Boot.__instanceof(err, Error)) {
                    _height = window.parseInt(_h);
                } else throw (err);
            }
            return _height;
        };
        displayengineImpl.Stage.prototype.setHeight = function(val) {
            displayengineImpl.PixiStage.prototype.setHeight.call(this, val);
        };
        displayengineImpl.Stage.prototype.getScaleX = function() {
            return this._stage.scale.x;
        };
        displayengineImpl.Stage.prototype.setScaleX = function(val) {
            this._stage.scale.x = val;
        };
        displayengineImpl.Stage.prototype.getScaleY = function() {
            return this._stage.scale.y;
        };
        displayengineImpl.Stage.prototype.setScaleY = function(val) {
            this._stage.scale.y = val;
        };
        displayengineImpl.Stage.prototype.getNumChildren = function() {
            return this._stage.children.length;
        };
        displayengineImpl.Stage.prototype.getVisible = function() {
            if (this._canvas != null) return this._canvas.style.display != "none";
            return false;
        };
        displayengineImpl.Stage.prototype.setVisible = function(val) {
            if (val) this._canvas.style.display = "block";
            else this._canvas.style.display = "none";
        };
        displayengineImpl.Stage.prototype.getAlpha = function() {
            return parseFloat(this._canvas.style.opacity);
        };
        displayengineImpl.Stage.prototype.setAlpha = function(val) {
            this._canvas.style.opacity = val + "";
            if (this._ticker.timingMode == displayEngineApi.TimingMode.ONCE) this.update();
        };
        displayengineImpl.Stage.prototype.getTimingMode = function() {
            return this._ticker.timingMode;
        };
        displayengineImpl.Stage.prototype.setTimingMode = function(val) {
            this._ticker.timingMode = val;
        };
        displayengineImpl.Stage.prototype.getMouse = function(event) {
            if (event != null) {
                this._mousePoint = new displayEngineApi.Point(event.data.originalEvent.clientX, event.data.originalEvent.clientY);
                return this._mousePoint;
            }
            return this._mousePoint;
        };
        displayengineImpl.Stage.prototype.lastCalledTime = null;
        displayengineImpl.Stage.prototype.calculateFps = function() {
            var _time = window.performance.now();
            this._deltaTime = _time - this.lastCalledTime;
            this.lastCalledTime = _time;
            this._fpsInfo.fps = displayengineImpl.Ticker.meter.fps | 0;
        };
        displayengineImpl.Stage.prototype.getFpsInfo = function() {
            return this._fpsInfo;
        };
        displayengineImpl.Stage.prototype.setFPS = function(val) {
            this.setFPS(val);
        };
        displayengineImpl.Stage.prototype.dispose = function() {
            displayengineImpl.DisplayProvider.stages.remove(this._id);
            this._self = null;
            this.parentDOMObject = null;
            var $it0 = this.children.keys();
            while ($it0.hasNext()) {
                var key = $it0.next();
                this.children.get(key).dispose();
            }
            this.children = null;
            this._ticker.reset();
            this._ticker.dispose();
            this._ticker = null;
            displayengineImpl.PixiStage.prototype.dispose.call(this);
        };
        displayengineImpl.Stage.prototype.__class__ = displayengineImpl.Stage;
        displayengineImpl.Stage3D = function(id, width, height, options) {
            this.isRendering = true;
            this._clearColor = new BABYLON.Color4(0, 0, 0, 0);
            var _g = this;
            this.id = id;
            if (options == null) options = {};
            var _this = window.document;
            this.canvas = _this.createElement("canvas");
            this.canvas.id = id;
            this.canvas.setAttribute("__DEStage3D__", "true");
            this.canvas.width = width;
            this.canvas.height = height;
            this.canvas.setAttribute("style", "pointer-events: none; width: " + width + "px; height: " + height + "px; display: none;");
            displayengineImpl.Bitmap.call(this, this.canvas);
            var antialiasing = false;
            if (options.antialias != null) antialiasing = options.antialias;
            var preserveDrawingBuffer = true;
            if (options.preserveDrawingBuffer != null) preserveDrawingBuffer = options.preserveDrawingBuffer;
            this._engine = new BABYLON.Engine(this.canvas, antialiasing, {
                preserveDrawingBuffer: preserveDrawingBuffer
            });
            this._scene = new BABYLON.Scene(this._engine);
            this.setSize(width, height);
            if (this.detectIE()) window.document.body.appendChild(this.canvas);
            this._engine.runRenderLoop(function() {
                if (_g.isRendering) _g._scene.render();
            });
            if (options.IDBStorageEnabled == false) {
                BABYLON.Database.IDBStorageEnabled = false;
            }
            this._loader = BABYLON.SceneLoader._registeredPlugins['.babylon'];
        };
        displayengineImpl.Stage3D = ck_implements(displayengineImpl.Stage3D, displayEngineApi.IStage3D);
        displayengineImpl.Stage3D.__interfaces__ = [displayEngineApi.IStage3D];
        displayengineImpl.Stage3D.__name__ = ["displayengineImpl", "Stage3D"];
        displayengineImpl.Stage3D.__super__ = displayengineImpl.Bitmap;
        for (var k in displayengineImpl.Bitmap.prototype) displayengineImpl.Stage3D.prototype[k] = displayengineImpl.Bitmap.prototype[k];
        displayengineImpl.Stage3D.prototype.canvas = null;
        displayengineImpl.Stage3D.prototype._engine = null;
        displayengineImpl.Stage3D.prototype._scene = null;
        displayengineImpl.Stage3D.prototype._clearColor = null;
        displayengineImpl.Stage3D.prototype._loader = null;
        displayengineImpl.Stage3D.prototype.isRendering = null;
        displayengineImpl.Stage3D.prototype.detectIE = function() {
            var ua = window.navigator.userAgent.toUpperCase();
            var msie = ua.indexOf("MSIE");
            if (msie > 0) return true;
            var trident = ua.indexOf("TRIDENT/");
            if (trident > 0) {
                var rv = ua.indexOf("RV:");
                return rv > 0;
            }
            var edge = ua.indexOf("EDGE/");
            if (edge > 0) return true;
            return false;
        };
        displayengineImpl.Stage3D.prototype.setDisplayType = function() {
            displayengineImpl.Bitmap.prototype.setDisplayType.call(this);
            this.displayType.push(displayEngineApi.DisplayType.STAGE3D);
        };
        displayengineImpl.Stage3D.prototype.getCanvas = function() {
            return this.canvas;
        };
        displayengineImpl.Stage3D.prototype.getScene = function() {
            return this._scene;
        };
        displayengineImpl.Stage3D.prototype.getEngine = function() {
            return this._engine;
        };
        displayengineImpl.Stage3D.prototype.setHardwareScalingLevel = function(level) {
            this._engine.setHardwareScalingLevel(level);
        };
        displayengineImpl.Stage3D.prototype.getHardwareScalingLevel = function() {
            return this._engine.getHardwareScalingLevel();
        };
        displayengineImpl.Stage3D.prototype.setSize = function(width, height) {
            this.canvas.width = width;
            this.canvas.height = height;
            this._engine.setSize(width, height);
            this.update(this.canvas, width, height);
        };
        displayengineImpl.Stage3D.prototype.loadScene = function(fileContent) {
            this._loader.plugin.load(this._scene, fileContent, "", null);
        };
        displayengineImpl.Stage3D.prototype.importMesh = function(meshesNames, fileContent, onLoad) {
            var meshes = [];
            var particleSystems = [];
            var skeletons = [];
            if (this._loader.plugin.importMesh(meshesNames, this._scene, fileContent, "", meshes, particleSystems, skeletons) == false) throw new js._Boot.HaxeError("Unable to import babylon scene!");
            if (onLoad != null) onLoad(meshes, particleSystems, skeletons);
        };
        displayengineImpl.Stage3D.prototype.stopRendering = function() {
            this.isRendering = false;
        };
        displayengineImpl.Stage3D.prototype.resumeRendering = function() {
            this.isRendering = true;
        };
        displayengineImpl.Stage3D.prototype.beginAnimation = function(target, from, to, loop, speedRatio, onAnimationEnd, animatable) {
            if (speedRatio == null) speedRatio = 1.0;
            if (loop == null) loop = false;
            return this._scene.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable);
        };
        displayengineImpl.Stage3D.prototype.stopAnimation = function(target) {
            this._scene.stopAnimation(target);
        };
        displayengineImpl.Stage3D.prototype.getMeshByID = function(meshID) {
            return this._scene.getMeshByID(meshID);
        };
        displayengineImpl.Stage3D.prototype.getMeshByName = function(meshName) {
            return this._scene.getMeshByName(meshName);
        };
        displayengineImpl.Stage3D.prototype.getLastMeshByID = function(id) {
            return this._scene.getLastMeshByID(id);
        };
        displayengineImpl.Stage3D.prototype.isActiveMesh = function(mesh) {
            return this._scene.isActiveMesh(mesh);
        };
        displayengineImpl.Stage3D.prototype.getLightByID = function(lightID) {
            return this._scene.getLightByID(lightID);
        };
        displayengineImpl.Stage3D.prototype.getLightByName = function(name) {
            return this._scene.getLightByName(name);
        };
        displayengineImpl.Stage3D.prototype.getLightByUniqueID = function(uniqueId) {
            return this._scene.getLightByUniqueID(uniqueId);
        };
        displayengineImpl.Stage3D.prototype.getSkeletonByID = function(skelID) {
            return this._scene.getSkeletonByID(skelID);
        };
        displayengineImpl.Stage3D.prototype.getSkeletonByName = function(skelName) {
            return this._scene.getSkeletonByName(skelName);
        };
        displayengineImpl.Stage3D.prototype.getLastSkeletonByID = function(id) {
            return this._scene.getLastSkeletonByID(id);
        };
        displayengineImpl.Stage3D.prototype.getMaterialByID = function(id) {
            return this._scene.getMaterialByID(id);
        };
        displayengineImpl.Stage3D.prototype.getMaterialByName = function(name) {
            return this._scene.getMaterialByName(name);
        };
        displayengineImpl.Stage3D.prototype.getMultiMaterialByID = function(id) {
            return this._scene.getMultiMaterialByID(id);
        };
        displayengineImpl.Stage3D.prototype.getMultiMaterialByName = function(name) {
            return this._scene.getMultiMaterialByName(name);
        };
        displayengineImpl.Stage3D.prototype.getCameraByID = function(id) {
            return this._scene.getCameraByID(id);
        };
        displayengineImpl.Stage3D.prototype.getCameraByUniqueID = function(uniqueId) {
            return this._scene.getCameraByUniqueID(uniqueId);
        };
        displayengineImpl.Stage3D.prototype.getCameraByName = function(name) {
            return this._scene.getCameraByName(name);
        };
        displayengineImpl.Stage3D.prototype.switchActiveCamera = function(newCamera, control) {
            if (control == null) control = true;
            this._scene.switchActiveCamera(newCamera, control);
        };
        displayengineImpl.Stage3D.prototype.getLensFlareSystemByName = function(name) {
            return this._scene.getLensFlareSystemByName(name);
        };
        displayengineImpl.Stage3D.prototype.getLensFlareSystemByID = function(id) {
            return this._scene.getLensFlareSystemByID(id);
        };
        displayengineImpl.Stage3D.prototype.getBoneByID = function(id) {
            return this._scene.getBoneByID(id);
        };
        displayengineImpl.Stage3D.prototype.getBoneByName = function(name) {
            return this._scene.getBoneByName(name);
        };
        displayengineImpl.Stage3D.prototype.getParticleSystemByID = function(id) {
            return this._scene.getParticleSystemByID(id);
        };
        displayengineImpl.Stage3D.prototype.getGeometryByID = function(id) {
            return this._scene.getGeometryByID(id);
        };
        displayengineImpl.Stage3D.prototype.removeMesh = function(toRemove) {
            return this._scene.removeMesh(toRemove);
        };
        displayengineImpl.Stage3D.prototype.removeSkeleton = function(toRemove) {
            return this._scene.removeSkeleton(toRemove);
        };
        displayengineImpl.Stage3D.prototype.removeMorphTargetManager = function(toRemove) {
            return this._scene.removeMorphTargetManager(toRemove);
        };
        displayengineImpl.Stage3D.prototype.removeLight = function(toRemove) {
            return this._scene.removeLight(toRemove);
        };
        displayengineImpl.Stage3D.prototype.removeCamera = function(toRemove) {
            return this._scene.removeCamera(toRemove);
        };
        displayengineImpl.Stage3D.prototype.registerBeforeRender = function(handler) {
            this._scene.registerBeforeRender(handler);
        };
        displayengineImpl.Stage3D.prototype.registerAfterRender = function(handler) {
            this._scene.registerAfterRender(handler);
        };
        displayengineImpl.Stage3D.prototype.unregisterBeforeRender = function(handler) {
            this._scene.unregisterBeforeRender(handler);
        };
        displayengineImpl.Stage3D.prototype.unregisterAfterRender = function(handler) {
            this._scene.unregisterAfterRender(handler);
        };
        displayengineImpl.Stage3D.prototype.__class__ = displayengineImpl.Stage3D;
        displayengineImpl.Ticker = function() {
            this.previousFrameTime = 0;
            this.check = 0;
            this.now = 0;
            this.allTickHandlers = [];
            this.rafFPS = 0;
            this._ms = 0;
            this._fps = 0;
            this._baseTime = window.performance.now();
            this._raf = true;
            this._timerId = null;
            this._lastTime = 0.0;
            this._interval = 50;
            this._pausedTicks = 0;
            this._ticks = 0;
            this._pausedTime = 0.0;
            this._startTime = 0.0;
            this._inited = false;
            this._id = 0;
            this._removeEventListener = null;
            this._addEventListener = null;
            this._listeners = null;
            this.hasEventListener = null;
            this.dispatchEvent = null;
            this.removeAllEventListeners = null;
            this.removeEventListener = null;
            this.paused = false;
            this.maxDelta = 0;
            this.timingMode = displayEngineApi.TimingMode.RAF;
            this.useRAF = false;
            this._id = ++displayengineImpl.Ticker._globalID;
            if (this._id <= 1) displayengineImpl.Ticker.createStats();
        };
        displayengineImpl.Ticker = ck_implements(displayengineImpl.Ticker, displayEngineApi.ITicker);
        displayengineImpl.Ticker.__interfaces__ = [displayEngineApi.ITicker];
        displayengineImpl.Ticker.__name__ = ["displayengineImpl", "Ticker"];
        displayengineImpl.Ticker.prototype.useRAF = null;
        displayengineImpl.Ticker.prototype.timingMode = null;
        displayengineImpl.Ticker.prototype.maxDelta = null;
        displayengineImpl.Ticker.prototype.paused = null;
        displayengineImpl.Ticker.prototype.renderer = null;
        displayengineImpl.Ticker.prototype.removeEventListener = null;
        displayengineImpl.Ticker.prototype.removeAllEventListeners = null;
        displayengineImpl.Ticker.prototype.dispatchEvent = null;
        displayengineImpl.Ticker.prototype.hasEventListener = null;
        displayengineImpl.Ticker.prototype._listeners = null;
        displayengineImpl.Ticker.prototype._addEventListener = null;
        displayengineImpl.Ticker.prototype._removeEventListener = null;
        displayengineImpl.Ticker.prototype._id = null;
        displayengineImpl.Ticker.prototype._inited = null;
        displayengineImpl.Ticker.prototype._startTime = null;
        displayengineImpl.Ticker.prototype._pausedTime = null;
        displayengineImpl.Ticker.prototype._ticks = null;
        displayengineImpl.Ticker.prototype._pausedTicks = null;
        displayengineImpl.Ticker.prototype._interval = null;
        displayengineImpl.Ticker.prototype._lastTime = null;
        displayengineImpl.Ticker.prototype._times = null;
        displayengineImpl.Ticker.prototype._tickTimes = null;
        displayengineImpl.Ticker.prototype._timerId = null;
        displayengineImpl.Ticker.prototype._raf = null;
        displayengineImpl.Ticker.prototype._targetFPS = null;
        displayengineImpl.Ticker.prototype._baseTime = null;
        displayengineImpl.Ticker.prototype._fps = null;
        displayengineImpl.Ticker.prototype._ms = null;
        displayengineImpl.Ticker.prototype.fps = null;
        displayengineImpl.Ticker.prototype.ms = null;
        displayengineImpl.Ticker.prototype.rafFPS = null;
        displayengineImpl.Ticker.prototype.get_fps = function() {
            return this._fps;
        };
        displayengineImpl.Ticker.prototype.get_ms = function() {
            return this._ms.toFixed(2);
        };
        displayengineImpl.Ticker.prototype.allTickHandlers = null;
        displayengineImpl.Ticker.prototype.setup = function(timingMode, renderer, targetFPS, maxDelta) {
            if (targetFPS == null) targetFPS = 60;
            this.maxDelta = maxDelta;
            this.timingMode = timingMode;
            this.renderer = renderer;
            this._targetFPS = targetFPS;
            this._interval = targetFPS;
            this.init();
        };
        displayengineImpl.Ticker.prototype.onTick = function(handler) {
            if ((function($this) {
                    var $r;
                    var x = handler;
                    $r = _hcmn_.HxOverrides.indexOf($this.allTickHandlers, x, 0);
                    return $r;
                }(this)) == -1) {
                this.allTickHandlers.push(handler);
                if (this.renderer == displayEngineApi.RendererName.EASEL) this._addEventListener("tick", handler);
            }
        };
        displayengineImpl.Ticker.prototype.offTick = function(handler) {
            if (this._inited) {
                var x = handler;
                _hcmn_.HxOverrides.remove(this.allTickHandlers, x);
                if (this.renderer == displayEngineApi.RendererName.EASEL) this._removeEventListener("tick", handler);
            }
        };
        displayengineImpl.Ticker.prototype.offTickAll = function() {
            if (this._inited) {
                var _g = 0;
                var _g1 = this.allTickHandlers;
                while (_g < _g1.length) {
                    var handler = _g1[_g];
                    ++_g;
                    if (!Object.prototype.hasOwnProperty.call(handler, "stage_tick_function")) {
                        if (this.renderer == displayEngineApi.RendererName.EASEL) this._removeEventListener("tick", handler);
                        this.allTickHandlers = [];
                    }
                }
            }
        };
        displayengineImpl.Ticker.prototype.setInterval = function(interval) {
            this._interval = interval;
            if (!this._inited) return;
            this._setupTick();
        };
        displayengineImpl.Ticker.prototype.getInterval = function() {
            return this._interval;
        };
        displayengineImpl.Ticker.prototype.setFPS = function(value) {
            if (this.timingMode == displayEngineApi.TimingMode.RAF) this._targetFPS = _hcmn_.Math.floor(value);
            else this.setInterval(1000 / value | 0);
        };
        displayengineImpl.Ticker.prototype.getFPS = function() {
            if (this.timingMode == displayEngineApi.TimingMode.RAF) return this._targetFPS;
            else return 1000 / this._interval;
        };
        displayengineImpl.Ticker.prototype.init = function() {
            if (this.renderer == displayEngineApi.RendererName.EASEL) {
                preloadjs.EventDispatcher.initialize(this);
                this._addEventListener = this.addEventListener;
                this._removeEventListener = this.removeEventListener;
            }
            this._inited = true;
            this._times = [];
            this._tickTimes = [];
            this._startTime = ($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime;
            this._times.push(this._lastTime = 0);
            this.setInterval(this._interval);
            this.allTickHandlers = [];
        };
        displayengineImpl.Ticker.prototype.reset = function() {
            if (this._raf) {
                var f = ($_ = window, $bind($_, $_.cancelAnimationFrame));
                f(this._timerId);
            } else window.clearTimeout(this._timerId);
            this.allTickHandlers = [];
            this._timerId = null;
            this._times = null;
            this._tickTimes = null;
            this._startTime = 0.0;
            this._lastTime = 0.0;
            this._ticks = 0;
            this._inited = false;
        };
        displayengineImpl.Ticker.prototype.getMeasuredTickTime = function(ticks) {
            var ttl = 0.0;
            var times = this._tickTimes;
            if (times == null || times.length < 1) return -1;
            ticks = _hcmn_.Math.min(times.length, ticks != null ? ticks : this.timingMode == displayEngineApi.TimingMode.RAF ? this._targetFPS : 1000 / this._interval);
            var _g = 0;
            while (_g < ticks) {
                var i = _g++;
                ttl += times[i];
            }
            return ttl / ticks;
        };
        displayengineImpl.Ticker.prototype.getMeasuredFPS = function(ticks) {
            var times = this._times;
            if (times == null || times.length < 2) return -1;
            ticks = _hcmn_.Math.min(times.length - 1, ticks != null ? ticks : this.timingMode == displayEngineApi.TimingMode.RAF ? this._targetFPS : 1000 / this._interval);
            return 1000 / ((times[0] - times[ticks]) / ticks);
        };
        displayengineImpl.Ticker.prototype.setPaused = function(value) {
            this.paused = value;
        };
        displayengineImpl.Ticker.prototype.getPaused = function() {
            return this.paused;
        };
        displayengineImpl.Ticker.prototype.getTime = function(runTime) {
            if (this._startTime != null) return (($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime) - (runTime != null ? this._pausedTime : 0);
            else return -1;
        };
        displayengineImpl.Ticker.prototype.getEventTime = function(runTime) {
            if (this._startTime != null) return (this._lastTime != null ? this._lastTime : this._startTime) - (runTime != null ? this._pausedTime : 0);
            else return -1;
        };
        displayengineImpl.Ticker.prototype.getTicks = function(paused) {
            return this._ticks - (paused ? this._pausedTicks : 0);
        };
        displayengineImpl.Ticker.prototype._handleSynch = function() {
            this._timerId = null;
            this._setupTick();
            if ((($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime) - this._lastTime >= (this._interval - 1) * 0.97) this._tick();
        };
        displayengineImpl.Ticker.prototype.now = null;
        displayengineImpl.Ticker.prototype.check = null;
        displayengineImpl.Ticker.prototype.previousFrameTime = null;
        displayengineImpl.Ticker.prototype._handleRAF = function(rafTime) {
            if (this._id == 1) displayengineImpl.Ticker.meter.tickStart();
            this._timerId = null;
            this._setupTick();
            if (this._targetFPS == 60) {
                this._tick();
                if (this._id == 1) displayengineImpl.Ticker.meter.tick();
            } else {
                this.now = window.performance.now();
                this.check = this.now - this._baseTime;
                if (this.check / (1000 / this._targetFPS) >= 1) {
                    this._baseTime = this.now;
                    this._tick();
                    if (this._id == 1) displayengineImpl.Ticker.meter.tick();
                }
            }
        };
        displayengineImpl.Ticker.prototype._handleTimeout = function() {
            if (this._id == 1) displayengineImpl.Ticker.meter.tickStart();
            this._timerId = null;
            this._setupTick();
            this._tick();
            if (this._id == 1) displayengineImpl.Ticker.meter.tick();
        };
        displayengineImpl.Ticker.prototype._setupTick = function() {
            if (this._timerId != null) return;
            var mode = this.timingMode;
            if (mode == displayEngineApi.TimingMode.RAF || mode == displayEngineApi.TimingMode.RAF_SYNCHED) {
                var f = ($_ = window, $bind($_, $_.requestAnimationFrame));
                if (f != null) {
                    this._timerId = f(mode == displayEngineApi.TimingMode.RAF ? $bind(this, this._handleRAF) : $bind(this, this._handleSynch));
                    this._raf = true;
                    return;
                }
            }
            this._raf = false;
            this._timerId = window.setTimeout($bind(this, this._handleTimeout), this._interval);
        };
        displayengineImpl.Ticker.prototype._tick = function() {
            var _g = 0;
            var _g1 = this.allTickHandlers;
            while (_g < _g1.length) {
                var handler = _g1[_g];
                ++_g;
                handler();
            }
        };
        displayengineImpl.Ticker.prototype._getTime = function() {
            return ($_ = window.performance, $bind($_, $_.now)) != null ? window.performance.now() : new _hcmn_.Date().getTime() - this._startTime;
        };
        displayengineImpl.Ticker.prototype.dispose = function() {
            this.timingMode = null;
            this._listeners = null;
            this._addEventListener = null;
            this._removeEventListener = null;
            this._startTime = null;
            this._pausedTime = 0.0;
            this._ticks = null;
            this._interval = null;
            this._lastTime = null;
            this._times = null;
            this._tickTimes = null;
            this._timerId = null;
            this._baseTime = null;
        };
        displayengineImpl.Ticker.statsDiv = null;
        displayengineImpl.Ticker.bmpStatsDiv = null;
        displayengineImpl.Ticker.meter = null;
        displayengineImpl.Ticker.createStats = function() {
            if (displayengineImpl.Ticker.meter == null) {
                var fpsm;
                var _this = window.document;
                fpsm = _this.createElement("script");
                fpsm.innerHTML = displayengineImpl.Ticker.fpsMeter;
                window.document.body.appendChild(fpsm);
                displayengineImpl.Ticker.meter = new FPSMeter({
                    theme: 'dark',
                    zIndex: 999997,
                    left: '10px',
                    top: '10px',
                    graph: 1
                });
                if (window.location.search.indexOf("fps=true") == -1) displayengineImpl.Ticker.meter.hide();
            }
        };
        displayengineImpl.Ticker.prototype.__class__ = displayengineImpl.Ticker;
        displayengineImpl.Camera = function(pos, tar) {
            if (pos != null) this.Position = pos;
            else this.Position = new displayengineImpl.Vector3(0, 0, 11.9);
            if (tar != null) this.Target = tar;
            else this.Target = new displayengineImpl.Vector3(0, 0, 0);
        };
        displayengineImpl.Camera = ck_implements(displayengineImpl.Camera, displayEngineApi.ICamera);
        displayengineImpl.Camera.__interfaces__ = [displayEngineApi.ICamera];
        displayengineImpl.Camera.__name__ = ["displayengineImpl", "Camera"];
        displayengineImpl.Camera.prototype.Position = null;
        displayengineImpl.Camera.prototype.Target = null;
        displayengineImpl.Camera.prototype.__class__ = displayengineImpl.Camera;
        displayengineImpl.Mesh = function(name) {
            this.Vertices = [];
            this.Faces = [];
            this.Rotation = new displayengineImpl.Vector3(0, 0, 0);
            this.Position = new displayengineImpl.Vector3(0, 0, 0);
        };
        displayengineImpl.Mesh.__name__ = ["displayengineImpl", "Mesh"];
        displayengineImpl.Mesh.prototype.name = null;
        displayengineImpl.Mesh.prototype.Position = null;
        displayengineImpl.Mesh.prototype.Rotation = null;
        displayengineImpl.Mesh.prototype.Vertices = null;
        displayengineImpl.Mesh.prototype.Faces = null;
        displayengineImpl.Mesh.prototype.Texture = null;
        displayengineImpl.Mesh.prototype.__class__ = displayengineImpl.Mesh;
        displayengineImpl.Vector3 = function(initialX, initialY, initialZ) {
            if (initialZ == null) initialZ = 0;
            if (initialY == null) initialY = 0;
            if (initialX == null) initialX = 0;
            this.x = initialX;
            this.y = initialY;
            this.z = initialZ;
        };
        displayengineImpl.Vector3 = ck_implements(displayengineImpl.Vector3, displayEngineApi.IVector3);
        displayengineImpl.Vector3.__interfaces__ = [displayEngineApi.IVector3];
        displayengineImpl.Vector3.__name__ = ["displayengineImpl", "Vector3"];
        displayengineImpl.Vector3.prototype.x = null;
        displayengineImpl.Vector3.prototype.y = null;
        displayengineImpl.Vector3.prototype.z = null;
        displayengineImpl.Vector3.prototype.toString = function() {
            return "{X:" + this.x + " Y:" + this.y + " Z:" + this.z + "}";
        };
        displayengineImpl.Vector3.prototype.set = function(initialX, initialY, initialZ) {
            if (initialZ == null) initialZ = 0;
            if (initialY == null) initialY = 0;
            if (initialX == null) initialX = 0;
            this.x = initialX;
            this.y = initialY;
            this.z = initialZ;
        };
        displayengineImpl.Vector3.prototype.add = function(otherVector) {
            return new displayengineImpl.Vector3(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z);
        };
        displayengineImpl.Vector3.prototype.subtract = function(otherVector) {
            return new displayengineImpl.Vector3(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z);
        };
        displayengineImpl.Vector3.prototype.subtractToRef = function(otherVector, ref) {
            ref.set(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z);
        };
        displayengineImpl.Vector3.prototype.negate = function() {
            return new displayengineImpl.Vector3(-this.x, -this.y, -this.z);
        };
        displayengineImpl.Vector3.prototype.scale = function(scale) {
            return new displayengineImpl.Vector3(this.x * scale, this.y * scale, this.z * scale);
        };
        displayengineImpl.Vector3.prototype.equals = function(otherVector) {
            return this.x == otherVector.x && this.y == otherVector.y && this.z == otherVector.z;
        };
        displayengineImpl.Vector3.prototype.multiply = function(otherVector) {
            return new displayengineImpl.Vector3(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z);
        };
        displayengineImpl.Vector3.prototype.divide = function(otherVector) {
            return new displayengineImpl.Vector3(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z);
        };
        displayengineImpl.Vector3.prototype.length = function() {
            return _hcmn_.Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
        };
        displayengineImpl.Vector3.prototype.lengthSquared = function() {
            return this.x * this.x + this.y * this.y + this.z * this.z;
        };
        displayengineImpl.Vector3.prototype.normalize = function() {
            var len = _hcmn_.Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
            if (len == 0) return;
            var num = 1.0 / len;
            this.x *= num;
            this.y *= num;
            this.z *= num;
        };
        displayengineImpl.Vector3.FromArray = function(array, offset) {
            if (offset == null) offset = 0;
            return new displayengineImpl.Vector3(array[offset], array[offset + 1], array[offset + 2]);
        };
        displayengineImpl.Vector3.Zero = function() {
            return new displayengineImpl.Vector3(0, 0, 0);
        };
        displayengineImpl.Vector3.Up = function() {
            return new displayengineImpl.Vector3(0, 1.0, 0);
        };
        displayengineImpl.Vector3.Copy = function(source) {
            return new displayengineImpl.Vector3(source.x, source.y, source.z);
        };
        displayengineImpl.Vector3.TransformCoordinates = function(vector, transformation) {
            var x = vector.x * transformation.m[0] + vector.y * transformation.m[4] + vector.z * transformation.m[8] + transformation.m[12];
            var y = vector.x * transformation.m[1] + vector.y * transformation.m[5] + vector.z * transformation.m[9] + transformation.m[13];
            var z = vector.x * transformation.m[2] + vector.y * transformation.m[6] + vector.z * transformation.m[10] + transformation.m[14];
            var w = vector.x * transformation.m[3] + vector.y * transformation.m[7] + vector.z * transformation.m[11] + transformation.m[15];
            return new displayengineImpl.Vector3(x / w, y / w, z / w);
        };
        displayengineImpl.Vector3.TransformCoordinatesToRef = function(vector, transformation, ref) {
            var x = vector.x * transformation.m[0] + vector.y * transformation.m[4] + vector.z * transformation.m[8] + transformation.m[12];
            var y = vector.x * transformation.m[1] + vector.y * transformation.m[5] + vector.z * transformation.m[9] + transformation.m[13];
            var z = vector.x * transformation.m[2] + vector.y * transformation.m[6] + vector.z * transformation.m[10] + transformation.m[14];
            var w = vector.x * transformation.m[3] + vector.y * transformation.m[7] + vector.z * transformation.m[11] + transformation.m[15];
            ref.set(x / w, y / w, z / w);
        };
        displayengineImpl.Vector3.TransformNormal = function(vector, transformation) {
            var x = vector.x * transformation.m[0] + vector.y * transformation.m[4] + vector.z * transformation.m[8];
            var y = vector.x * transformation.m[1] + vector.y * transformation.m[5] + vector.z * transformation.m[9];
            var z = vector.x * transformation.m[2] + vector.y * transformation.m[6] + vector.z * transformation.m[10];
            return new displayengineImpl.Vector3(x, y, z);
        };
        displayengineImpl.Vector3.Dot = function(left, right) {
            return left.x * right.x + left.y * right.y + left.z * right.z;
        };
        displayengineImpl.Vector3.Cross = function(left, right) {
            var x = left.y * right.z - left.z * right.y;
            var y = left.z * right.x - left.x * right.z;
            var z = left.x * right.y - left.y * right.x;
            return new displayengineImpl.Vector3(x, y, z);
        };
        displayengineImpl.Vector3.CrossToRef = function(left, right, result) {
            result.x = left.y * right.z - left.z * right.y;
            result.y = left.z * right.x - left.x * right.z;
            result.z = left.x * right.y - left.y * right.x;
        };
        displayengineImpl.Vector3.Normalize = function(vector) {
            var newVector = new displayengineImpl.Vector3(vector.x, vector.y, vector.z);
            newVector.normalize();
            return newVector;
        };
        displayengineImpl.Vector3.Distance = function(value1, value2) {
            return _hcmn_.Math.sqrt(displayengineImpl.Vector3.DistanceSquared(value1, value2));
        };
        displayengineImpl.Vector3.DistanceSquared = function(value1, value2) {
            var x = value1.x - value2.x;
            var y = value1.y - value2.y;
            var z = value1.z - value2.z;
            return x * x + y * y + z * z;
        };
        displayengineImpl.Vector3.prototype.__class__ = displayengineImpl.Vector3;
        displayengineImpl.Card = function(name, bmpBack, bmpFront, canvas, faceUp, camera) {
            if (faceUp == null) faceUp = false;
            this.interval = -1;
            this._darken = -1;
            this.flipSpeed = 0.2;
            this.isTurning = false;
            this.faceUp = false;
            this.visible = false;
            this.bottomRight = new displayengineImpl.Vector3();
            this.topLeft = new displayengineImpl.Vector3();
            var _g = this;
            displayengineImpl.Mesh.call(this, name);
            if (displayengineImpl.Card.allCards == null) {
                displayengineImpl.Card.allCards = [];
                window.addEventListener("focus", function(_) {
                    var _g1 = 0;
                    var _g11 = displayengineImpl.Card.allCards;
                    while (_g1 < _g11.length) {
                        var c = _g11[_g1];
                        ++_g1;
                        c.renderNormal();
                    }
                });
                var document = window.document;
                document.addEventListener("visibilitychange", function() {
                    if (document.visibilityState == "hidden") {
                        var _g2 = 0;
                        var _g12 = displayengineImpl.Card.allCards;
                        while (_g2 < _g12.length) {
                            var c1 = _g12[_g2];
                            ++_g2;
                            c1.isTurning = false;
                        }
                    }
                    if (document.visibilityState == "visible") {
                        var _g3 = 0;
                        var _g13 = displayengineImpl.Card.allCards;
                        while (_g3 < _g13.length) {
                            var c2 = _g13[_g3];
                            ++_g3;
                            c2.renderNormal();
                        }
                    }
                });
            }
            this.renderer = new displayengineImpl.Renderer(canvas);
            if (camera != null) this.camera = camera;
            else this.camera = new displayengineImpl.Camera();
            if (displayengineImpl.Card.offS == null) displayengineImpl.Card.offS = new displayengineImpl.OffscreenStage(_hcmn_.Std["int"](bmpBack.getWidth() * 2), _hcmn_.Std["int"](bmpBack.getHeight()), false, displayEngineApi.TimingMode.ONCE, 1);
            else displayengineImpl.Card.offS.getStage().removeAllChildren();
            displayengineImpl.Card.offS.id = "card_" + displayengineImpl.Card.offS.id;
            displayengineImpl.Card.offS.getStage().addChild(bmpBack);
            bmpFront.setX(bmpFront.getWidth());
            displayengineImpl.Card.offS.getStage().addChild(bmpFront);
            this.faceUp = faceUp;
            if (!this.faceUp) this.Rotation.y = _hcmn_.Math.PI + 0.0000001;
            else this.Rotation.y = 0.0000001;
            this.Texture = new displayengineImpl.Texture(displayengineImpl.Card.offS, function() {
                _g.initialDraw();
            });
            displayengineImpl.Card.allCards.push(this);
        };
        displayengineImpl.Card = ck_implements(displayengineImpl.Card, displayEngineApi.ICard);
        displayengineImpl.Card.__interfaces__ = [displayEngineApi.ICard];
        displayengineImpl.Card.__name__ = ["displayengineImpl", "Card"];
        displayengineImpl.Card.__super__ = displayengineImpl.Mesh;
        for (var k in displayengineImpl.Mesh.prototype) displayengineImpl.Card.prototype[k] = displayengineImpl.Mesh.prototype[k];
        displayengineImpl.Card.prototype.topLeft = null;
        displayengineImpl.Card.prototype.bottomRight = null;
        displayengineImpl.Card.prototype.visible = null;
        displayengineImpl.Card.prototype.projTopLeft = null;
        displayengineImpl.Card.prototype.projBottomRight = null;
        displayengineImpl.Card.prototype.faceUp = null;
        displayengineImpl.Card.prototype.isTurning = null;
        displayengineImpl.Card.prototype.flipSpeed = null;
        displayengineImpl.Card.prototype.renderShadow = null;
        displayengineImpl.Card.prototype.shadowColor = null;
        displayengineImpl.Card.prototype.shadowBlur = null;
        displayengineImpl.Card.prototype.shadowOffsetX = null;
        displayengineImpl.Card.prototype.shadowOffsetY = null;
        displayengineImpl.Card.prototype._darken = null;
        displayengineImpl.Card.prototype.darken = null;
        displayengineImpl.Card.prototype.get_darken = function() {
            return this._darken;
        };
        displayengineImpl.Card.prototype.set_darken = function(value) {
            return this._darken = value;
        };
        displayengineImpl.Card.prototype._displayObject = null;
        displayengineImpl.Card.prototype.renderer = null;
        displayengineImpl.Card.prototype.camera = null;
        displayengineImpl.Card.prototype.interval = null;
        displayengineImpl.Card.prototype.display = null;
        displayengineImpl.Card.prototype.get_display = function() {
            return this.renderer.renderCanvas;
        };
        displayengineImpl.Card.prototype.getDrawOffset = function() {
            if (this.projBottomRight != null) return {
                x: this.projBottomRight.x,
                y: this.projBottomRight.y
            };
            return {
                x: (this.renderer.renderCanvas.width - this.Texture.width) / 2,
                y: (this.renderer.renderCanvas.height - this.Texture.height) / 2
            };
        };
        displayengineImpl.Card.prototype.getDisplayObject = function() {
            if (this._displayObject == null) this._displayObject = new displayengineImpl.Bitmap(this.renderer.renderCanvas);
            return this._displayObject;
        };
        displayengineImpl.Card.prototype.initialDraw = function() {
            var _g = this;
            this.renderer.render(this.camera, [this]);
            this.renderNormal();
            _hcmn_.haxe_Timer.delay(function() {
                _g.interval = window.setInterval($bind(_g, _g.drawingLoop), null, 16.6666666666666679);
            }, 10);
        };
        displayengineImpl.Card.prototype.renderNormal = function() {
            var _g = this;
            _hcmn_.haxe_Timer.delay(function() {
                if (_g.projTopLeft == null) {
                    _g.projTopLeft = new displayengineImpl.Vector3();
                    _g.projBottomRight = new displayengineImpl.Vector3();
                    _g.project(_g.topLeft, _g.projTopLeft);
                    _g.project(_g.bottomRight, _g.projBottomRight);
                }
                try {
                    if (_g.renderer.renderShadow) {
                        _g.renderer.renderCtx.shadowColor = _g.renderer.shadowColor;
                        _g.renderer.renderCtx.shadowBlur = _g.renderer.shadowBlur;
                        _g.renderer.renderCtx.shadowOffsetX = _g.renderer.shadowOffsetX;
                        _g.renderer.renderCtx.shadowOffsetY = _g.renderer.shadowOffsetY;
                    }
                    _g.renderer.renderCtx.clearRect(0, 0, _g.renderer.workingWidth, _g.renderer.workingHeight);
                } catch (err) {
                    if (err instanceof js._Boot.HaxeError) err = err.val;
                }
                try {
                    var _tmpWH = _hcmn_.Math.floor(_g.Texture.get_img().width / 2);
                    _g.renderer.renderCtx.drawImage(_g.Texture.get_img(), _g.faceUp ? 0 : _tmpWH, 0, _tmpWH, _g.Texture.get_img().height, _hcmn_.Math.floor(_g.projBottomRight.x), _hcmn_.Math.floor(_g.projBottomRight.y), _hcmn_.Math.floor(_g.projTopLeft.x - _g.projBottomRight.x), _hcmn_.Math.floor(_g.projTopLeft.y - _g.projBottomRight.y));
                } catch (err1) {
                    if (err1 instanceof js._Boot.HaxeError) err1 = err1.val;
                }
                if (_g._darken > 0) {
                    if (_g._darken > 1) _g._darken = 0.5;
                    var imageData = _g.renderer.renderCtx.getImageData(0, 0, _g.renderer.workingWidth, _g.renderer.workingHeight);
                    var pixels = imageData.data;
                    var i = 0;
                    while (i < pixels.length) {
                        pixels[i] = pixels[i] * _g._darken;
                        pixels[i + 1] = pixels[i + 1] * _g._darken;
                        pixels[i + 2] = pixels[i + 2] * _g._darken;
                        i += 4;
                    }
                    _g.renderer.renderCtx.putImageData(imageData, 0, 0);
                }
            }, 50);
        };
        displayengineImpl.Card.prototype.drawingLoop = function() {
            if (this.isTurning) {
                this.renderer.clear();
                this.renderer.render(this.camera, [this]);
                this.renderer.present();
            }
        };
        displayengineImpl.Card.prototype.project = function(vector, target) {
            try {
                displayengineImpl.Vector3.TransformCoordinatesToRef(vector, displayengineImpl.Renderer.transformMatrix, displayengineImpl.Card.point2d);
                var point3DWorld = displayengineImpl.Vector3.TransformCoordinates(vector, displayengineImpl.Renderer.worldMatrix);
                target.x = displayengineImpl.Card.point2d.x * this.renderer.workingWidth + this.renderer.workingWidth / 2.0;
                target.y = -displayengineImpl.Card.point2d.y * this.renderer.workingHeight + this.renderer.workingHeight / 2.0;
            } catch (err) {
                if (err instanceof js._Boot.HaxeError) err = err.val;
            }
        };
        displayengineImpl.Card.prototype.update = function(bmpBack, bmpFront) {
            displayengineImpl.Card.offS.getStage().removeAllChildren();
            displayengineImpl.Card.offS.getStage().addChild(bmpBack);
            bmpFront.setX(bmpBack.getWidth());
            bmpFront.setX(bmpFront.getWidth());
            displayengineImpl.Card.offS.getStage().addChild(bmpFront);
            this.Texture.update(displayengineImpl.Card.offS);
            this.renderNormal();
        };
        displayengineImpl.Card.prototype.prepare = function() {
            var _g = this;
            this.isTurning = true;
            displayEngineUtils.TweenX.parallel([displayEngineUtils.TweenX.to(this.Rotation, {
                y: this.Rotation.y + _hcmn_.Math.PI / 2
            }, null, null, null, null, null, null, null, null, {
                fileName: "Card.hx",
                lineNumber: 248,
                className: "displayengine.impl.displaylist.engine3D.Card",
                methodName: "prepare"
            }).time(0).onFinish(function() {
                displayEngineUtils.TweenX.parallel([displayEngineUtils.TweenX.to(_g.Rotation, {
                    y: _g.Rotation.y + _hcmn_.Math.PI / 2 + 0.0000000001
                }, null, null, null, null, null, null, null, null, {
                    fileName: "Card.hx",
                    lineNumber: 250,
                    className: "displayengine.impl.displaylist.engine3D.Card",
                    methodName: "prepare"
                }).time(0).onFinish(function() {
                    _g.isTurning = false;
                }), displayEngineUtils.TweenX.to(_g.Position, {
                    z: 0
                }, null, null, null, null, null, null, null, null, {
                    fileName: "Card.hx",
                    lineNumber: 253,
                    className: "displayengine.impl.displaylist.engine3D.Card",
                    methodName: "prepare"
                }).time(0)], null, {
                    fileName: "Card.hx",
                    lineNumber: 249,
                    className: "displayengine.impl.displaylist.engine3D.Card",
                    methodName: "prepare"
                });
            }), displayEngineUtils.TweenX.to(this.Position, {
                z: 4
            }, null, null, null, null, null, null, null, null, {
                fileName: "Card.hx",
                lineNumber: 256,
                className: "displayengine.impl.displaylist.engine3D.Card",
                methodName: "prepare"
            }).time(0)], null, {
                fileName: "Card.hx",
                lineNumber: 247,
                className: "displayengine.impl.displaylist.engine3D.Card",
                methodName: "prepare"
            });
        };
        displayengineImpl.Card.prototype.flip = function() {
            var _g = this;
            this.renderer.isFaceUp = false;
            if (this.flipSpeed == 0) {
                this.isTurning = false;
                this.faceUp = !this.faceUp;
                this.renderNormal();
                return;
            }
            this.isTurning = true;
            displayEngineUtils.TweenX.parallel([displayEngineUtils.TweenX.to(this.Rotation, {
                y: this.Rotation.y + _hcmn_.Math.PI / 2
            }, null, null, null, null, null, null, null, null, {
                fileName: "Card.hx",
                lineNumber: 271,
                className: "displayengine.impl.displaylist.engine3D.Card",
                methodName: "flip"
            }).time(this.flipSpeed).onFinish(function() {
                displayEngineUtils.TweenX.parallel([displayEngineUtils.TweenX.to(_g.Rotation, {
                    y: _g.Rotation.y + _hcmn_.Math.PI / 2 + 0.0000000001
                }, null, null, null, null, null, null, null, null, {
                    fileName: "Card.hx",
                    lineNumber: 273,
                    className: "displayengine.impl.displaylist.engine3D.Card",
                    methodName: "flip"
                }).time(_g.flipSpeed).onFinish(function() {
                    _g.isTurning = false;
                    _g.faceUp = !_g.faceUp;
                    _g.renderNormal();
                }), displayEngineUtils.TweenX.to(_g.Position, {
                    z: 0
                }, null, null, null, null, null, null, null, null, {
                    fileName: "Card.hx",
                    lineNumber: 278,
                    className: "displayengine.impl.displaylist.engine3D.Card",
                    methodName: "flip"
                }).time(_g.flipSpeed)], null, {
                    fileName: "Card.hx",
                    lineNumber: 272,
                    className: "displayengine.impl.displaylist.engine3D.Card",
                    methodName: "flip"
                });
            }), displayEngineUtils.TweenX.to(this.Position, {
                z: 4
            }, null, null, null, null, null, null, null, null, {
                fileName: "Card.hx",
                lineNumber: 281,
                className: "displayengine.impl.displaylist.engine3D.Card",
                methodName: "flip"
            }).time(this.flipSpeed)], null, {
                fileName: "Card.hx",
                lineNumber: 270,
                className: "displayengine.impl.displaylist.engine3D.Card",
                methodName: "flip"
            });
        };
        displayengineImpl.Card.prototype.dispose = function() {
            window.clearInterval(this.interval);
            if (this._displayObject != null) this._displayObject.dispose();
            _hcmn_.HxOverrides.remove(displayengineImpl.Card.allCards, this);
            this.topLeft = null;
            this.bottomRight = null;
            this.projBottomRight = null;
            this.projTopLeft = null;
            this.renderer = null;
            this.camera = null;
            this.Texture._img = null;
            this.Texture.internalBuffer = null;
            this.Texture = null;
            this.Position = null;
            this.Rotation = null;
            try {
                this.renderer.backbuffer = null;
                this.renderer.workingCanvas = null;
                this.renderer.renderCanvas = null;
            } catch (e) {
                if (e instanceof js._Boot.HaxeError) e = e.val;
            }
            this.renderer = null;
        };
        displayengineImpl.Card.prototype.get_renderShadow = function() {
            return this.renderer.renderShadow;
        };
        displayengineImpl.Card.prototype.set_renderShadow = function(value) {
            return this.renderer.renderShadow = value;
        };
        displayengineImpl.Card.prototype.get_shadowColor = function() {
            return this.renderer.shadowColor;
        };
        displayengineImpl.Card.prototype.set_shadowColor = function(value) {
            return this.renderer.shadowColor = value;
        };
        displayengineImpl.Card.prototype.get_shadowBlur = function() {
            return this.renderer.shadowBlur;
        };
        displayengineImpl.Card.prototype.set_shadowBlur = function(value) {
            return this.renderer.shadowBlur = value;
        };
        displayengineImpl.Card.prototype.get_shadowOffsetX = function() {
            return this.renderer.shadowOffsetX;
        };
        displayengineImpl.Card.prototype.set_shadowOffsetX = function(value) {
            return this.renderer.shadowOffsetX = value;
        };
        displayengineImpl.Card.prototype.get_shadowOffsetY = function() {
            return this.renderer.shadowOffsetY;
        };
        displayengineImpl.Card.prototype.set_shadowOffsetY = function(value) {
            return this.renderer.shadowOffsetY = value;
        };
        displayengineImpl.Card.bitmapBack = null;
        displayengineImpl.Card.allCards = null;
        displayengineImpl.Card.offS = null;
        displayengineImpl.Card.prototype.__class__ = displayengineImpl.Card;
        displayengineImpl.Color4 = function(initialR, initialG, initialB, initialA) {
            if (initialA == null) initialA = 0;
            if (initialB == null) initialB = 0;
            if (initialG == null) initialG = 0;
            if (initialR == null) initialR = 0;
            this.r = initialR;
            this.g = initialG;
            this.b = initialB;
            this.a = initialA;
        };
        displayengineImpl.Color4 = ck_implements(displayengineImpl.Color4, displayEngineApi.IColor4);
        displayengineImpl.Color4.__interfaces__ = [displayEngineApi.IColor4];
        displayengineImpl.Color4.__name__ = ["displayengineImpl", "Color4"];
        displayengineImpl.Color4.prototype.r = null;
        displayengineImpl.Color4.prototype.g = null;
        displayengineImpl.Color4.prototype.b = null;
        displayengineImpl.Color4.prototype.a = null;
        displayengineImpl.Color4.prototype.toString = function() {
            return "{R:" + this.r + " G:" + this.g + " B:" + this.b + " A:" + this.a + "}";
        };
        displayengineImpl.Color4.prototype.set = function(initialR, initialG, initialB, initialA) {
            if (initialA == null) initialA = 0;
            if (initialB == null) initialB = 0;
            if (initialG == null) initialG = 0;
            if (initialR == null) initialR = 0;
            this.r = initialR;
            this.g = initialG;
            this.b = initialB;
            this.a = initialA;
        };
        displayengineImpl.Color4.prototype.__class__ = displayengineImpl.Color4;
        displayengineImpl.Matrix = function() {
            this.m = new Array(16);
        };
        displayengineImpl.Matrix = ck_implements(displayengineImpl.Matrix, displayEngineApi.IMatrix);
        displayengineImpl.Matrix.__interfaces__ = [displayEngineApi.IMatrix];
        displayengineImpl.Matrix.__name__ = ["displayengineImpl", "Matrix"];
        displayengineImpl.Matrix.prototype.m = null;
        displayengineImpl.Matrix.prototype.isIdentity = function() {
            if (this.m[0] != 1.0 || this.m[5] != 1.0 || this.m[10] != 1.0 || this.m[15] != 1.0) return false;
            if (this.m[12] != 0.0 || this.m[13] != 0.0 || this.m[14] != 0.0 || this.m[4] != 0.0 || this.m[6] != 0.0 || this.m[7] != 0.0 || this.m[8] != 0.0 || this.m[9] != 0.0 || this.m[11] != 0.0 || this.m[12] != 0.0 || this.m[13] != 0.0 || this.m[14] != 0.0) return false;
            return true;
        };
        displayengineImpl.Matrix.prototype.determinant = function() {
            var temp1 = this.m[10] * this.m[15] - this.m[11] * this.m[14];
            var temp2 = this.m[9] * this.m[15] - this.m[11] * this.m[13];
            var temp3 = this.m[9] * this.m[14] - this.m[10] * this.m[13];
            var temp4 = this.m[8] * this.m[15] - this.m[11] * this.m[12];
            var temp5 = this.m[8] * this.m[14] - this.m[10] * this.m[12];
            var temp6 = this.m[8] * this.m[13] - this.m[9] * this.m[12];
            return this.m[0] * (this.m[5] * temp1 - this.m[6] * temp2 + this.m[7] * temp3) - this.m[1] * (this.m[4] * temp1 - this.m[6] * temp4 + this.m[7] * temp5) + this.m[2] * (this.m[4] * temp2 - this.m[5] * temp4 + this.m[7] * temp6) - this.m[3] * (this.m[4] * temp3 - this.m[5] * temp5 + this.m[6] * temp6);
        };
        displayengineImpl.Matrix.prototype.toArray = function() {
            return this.m;
        };
        displayengineImpl.Matrix.prototype.invert = function() {
            var l1 = this.m[0];
            var l2 = this.m[1];
            var l3 = this.m[2];
            var l4 = this.m[3];
            var l5 = this.m[4];
            var l6 = this.m[5];
            var l7 = this.m[6];
            var l8 = this.m[7];
            var l9 = this.m[8];
            var l10 = this.m[9];
            var l11 = this.m[10];
            var l12 = this.m[11];
            var l13 = this.m[12];
            var l14 = this.m[13];
            var l15 = this.m[14];
            var l16 = this.m[15];
            var l17 = l11 * l16 - l12 * l15;
            var l18 = l10 * l16 - l12 * l14;
            var l19 = l10 * l15 - l11 * l14;
            var l20 = l9 * l16 - l12 * l13;
            var l21 = l9 * l15 - l11 * l13;
            var l22 = l9 * l14 - l10 * l13;
            var l23 = l6 * l17 - l7 * l18 + l8 * l19;
            var l24 = -(l5 * l17 - l7 * l20 + l8 * l21);
            var l25 = l5 * l18 - l6 * l20 + l8 * l22;
            var l26 = -(l5 * l19 - l6 * l21 + l7 * l22);
            var l27 = 1.0 / (l1 * l23 + l2 * l24 + l3 * l25 + l4 * l26);
            var l28 = l7 * l16 - l8 * l15;
            var l29 = l6 * l16 - l8 * l14;
            var l30 = l6 * l15 - l7 * l14;
            var l31 = l5 * l16 - l8 * l13;
            var l32 = l5 * l15 - l7 * l13;
            var l33 = l5 * l14 - l6 * l13;
            var l34 = l7 * l12 - l8 * l11;
            var l35 = l6 * l12 - l8 * l10;
            var l36 = l6 * l11 - l7 * l10;
            var l37 = l5 * l12 - l8 * l9;
            var l38 = l5 * l11 - l7 * l9;
            var l39 = l5 * l10 - l6 * l9;
            this.m[0] = l23 * l27;
            this.m[4] = l24 * l27;
            this.m[8] = l25 * l27;
            this.m[12] = l26 * l27;
            this.m[1] = -(l2 * l17 - l3 * l18 + l4 * l19) * l27;
            this.m[5] = (l1 * l17 - l3 * l20 + l4 * l21) * l27;
            this.m[9] = -(l1 * l18 - l2 * l20 + l4 * l22) * l27;
            this.m[13] = (l1 * l19 - l2 * l21 + l3 * l22) * l27;
            this.m[2] = (l2 * l28 - l3 * l29 + l4 * l30) * l27;
            this.m[6] = -(l1 * l28 - l3 * l31 + l4 * l32) * l27;
            this.m[10] = (l1 * l29 - l2 * l31 + l4 * l33) * l27;
            this.m[14] = -(l1 * l30 - l2 * l32 + l3 * l33) * l27;
            this.m[3] = -(l2 * l34 - l3 * l35 + l4 * l36) * l27;
            this.m[7] = (l1 * l34 - l3 * l37 + l4 * l38) * l27;
            this.m[11] = -(l1 * l35 - l2 * l37 + l4 * l39) * l27;
            this.m[15] = (l1 * l36 - l2 * l38 + l3 * l39) * l27;
        };
        displayengineImpl.Matrix.prototype.multiply = function(other) {
            var result = new displayengineImpl.Matrix();
            result.m[0] = this.m[0] * other.m[0] + this.m[1] * other.m[4] + this.m[2] * other.m[8] + this.m[3] * other.m[12];
            result.m[1] = this.m[0] * other.m[1] + this.m[1] * other.m[5] + this.m[2] * other.m[9] + this.m[3] * other.m[13];
            result.m[2] = this.m[0] * other.m[2] + this.m[1] * other.m[6] + this.m[2] * other.m[10] + this.m[3] * other.m[14];
            result.m[3] = this.m[0] * other.m[3] + this.m[1] * other.m[7] + this.m[2] * other.m[11] + this.m[3] * other.m[15];
            result.m[4] = this.m[4] * other.m[0] + this.m[5] * other.m[4] + this.m[6] * other.m[8] + this.m[7] * other.m[12];
            result.m[5] = this.m[4] * other.m[1] + this.m[5] * other.m[5] + this.m[6] * other.m[9] + this.m[7] * other.m[13];
            result.m[6] = this.m[4] * other.m[2] + this.m[5] * other.m[6] + this.m[6] * other.m[10] + this.m[7] * other.m[14];
            result.m[7] = this.m[4] * other.m[3] + this.m[5] * other.m[7] + this.m[6] * other.m[11] + this.m[7] * other.m[15];
            result.m[8] = this.m[8] * other.m[0] + this.m[9] * other.m[4] + this.m[10] * other.m[8] + this.m[11] * other.m[12];
            result.m[9] = this.m[8] * other.m[1] + this.m[9] * other.m[5] + this.m[10] * other.m[9] + this.m[11] * other.m[13];
            result.m[10] = this.m[8] * other.m[2] + this.m[9] * other.m[6] + this.m[10] * other.m[10] + this.m[11] * other.m[14];
            result.m[11] = this.m[8] * other.m[3] + this.m[9] * other.m[7] + this.m[10] * other.m[11] + this.m[11] * other.m[15];
            result.m[12] = this.m[12] * other.m[0] + this.m[13] * other.m[4] + this.m[14] * other.m[8] + this.m[15] * other.m[12];
            result.m[13] = this.m[12] * other.m[1] + this.m[13] * other.m[5] + this.m[14] * other.m[9] + this.m[15] * other.m[13];
            result.m[14] = this.m[12] * other.m[2] + this.m[13] * other.m[6] + this.m[14] * other.m[10] + this.m[15] * other.m[14];
            result.m[15] = this.m[12] * other.m[3] + this.m[13] * other.m[7] + this.m[14] * other.m[11] + this.m[15] * other.m[15];
            return result;
        };
        displayengineImpl.Matrix.prototype.equals = function(value) {
            return this.m[0] == value.m[0] && this.m[1] == value.m[1] && this.m[2] == value.m[2] && this.m[3] == value.m[3] && this.m[4] == value.m[4] && this.m[5] == value.m[5] && this.m[6] == value.m[6] && this.m[7] == value.m[7] && this.m[8] == value.m[8] && this.m[9] == value.m[9] && this.m[10] == value.m[10] && this.m[11] == value.m[11] && this.m[12] == value.m[12] && this.m[13] == value.m[13] && this.m[14] == value.m[14] && this.m[15] == value.m[15];
        };
        displayengineImpl.Matrix.FromValues = function(initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) {
            var result = new displayengineImpl.Matrix();
            result.m[0] = initialM11;
            result.m[1] = initialM12;
            result.m[2] = initialM13;
            result.m[3] = initialM14;
            result.m[4] = initialM21;
            result.m[5] = initialM22;
            result.m[6] = initialM23;
            result.m[7] = initialM24;
            result.m[8] = initialM31;
            result.m[9] = initialM32;
            result.m[10] = initialM33;
            result.m[11] = initialM34;
            result.m[12] = initialM41;
            result.m[13] = initialM42;
            result.m[14] = initialM43;
            result.m[15] = initialM44;
            return result;
        };
        displayengineImpl.Matrix.Identity = function() {
            return displayengineImpl.Matrix.FromValues(1.0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 1.0);
        };
        displayengineImpl.Matrix.Zero = function() {
            return displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        };
        displayengineImpl.Matrix.Copy = function(source) {
            return displayengineImpl.Matrix.FromValues(source.m[0], source.m[1], source.m[2], source.m[3], source.m[4], source.m[5], source.m[6], source.m[7], source.m[8], source.m[9], source.m[10], source.m[11], source.m[12], source.m[13], source.m[14], source.m[15]);
        };
        displayengineImpl.Matrix.RotationX = function(angle) {
            var result = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            var s = _hcmn_.Math.sin(angle);
            var c = _hcmn_.Math.cos(angle);
            result.m[0] = 1.0;
            result.m[15] = 1.0;
            result.m[5] = c;
            result.m[10] = c;
            result.m[9] = -s;
            result.m[6] = s;
            return result;
        };
        displayengineImpl.Matrix.RotationY = function(angle) {
            var result = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            var s = _hcmn_.Math.sin(angle);
            var c = _hcmn_.Math.cos(angle);
            result.m[5] = 1.0;
            result.m[15] = 1.0;
            result.m[0] = c;
            result.m[2] = -s;
            result.m[8] = s;
            result.m[10] = c;
            return result;
        };
        displayengineImpl.Matrix.RotationZ = function(angle) {
            var result = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            var s = _hcmn_.Math.sin(angle);
            var c = _hcmn_.Math.cos(angle);
            result.m[10] = 1.0;
            result.m[15] = 1.0;
            result.m[0] = c;
            result.m[1] = s;
            result.m[4] = -s;
            result.m[5] = c;
            return result;
        };
        displayengineImpl.Matrix.RotationAxis = function(axis, angle) {
            var s = _hcmn_.Math.sin(-angle);
            var c = _hcmn_.Math.cos(-angle);
            var c1 = 1 - c;
            axis.normalize();
            var result = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            result.m[0] = axis.x * axis.x * c1 + c;
            result.m[1] = axis.x * axis.y * c1 - axis.z * s;
            result.m[2] = axis.x * axis.z * c1 + axis.y * s;
            result.m[3] = 0.0;
            result.m[4] = axis.y * axis.x * c1 + axis.z * s;
            result.m[5] = axis.y * axis.y * c1 + c;
            result.m[6] = axis.y * axis.z * c1 - axis.x * s;
            result.m[7] = 0.0;
            result.m[8] = axis.z * axis.x * c1 - axis.y * s;
            result.m[9] = axis.z * axis.y * c1 + axis.x * s;
            result.m[10] = axis.z * axis.z * c1 + c;
            result.m[11] = 0.0;
            result.m[15] = 1.0;
            return result;
        };
        displayengineImpl.Matrix.RotationYawPitchRoll = function(yaw, pitch, roll) {
            return displayengineImpl.Matrix.RotationZ(roll).multiply(displayengineImpl.Matrix.RotationX(pitch)).multiply(displayengineImpl.Matrix.RotationY(yaw));
        };
        displayengineImpl.Matrix.Scaling = function(x, y, z) {
            var result = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            result.m[0] = x;
            result.m[5] = y;
            result.m[10] = z;
            result.m[15] = 1.0;
            return result;
        };
        displayengineImpl.Matrix.Translation = function(x, y, z) {
            var result = displayengineImpl.Matrix.FromValues(1.0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 1.0);
            result.m[12] = x;
            result.m[13] = y;
            result.m[14] = z;
            return result;
        };
        displayengineImpl.Matrix.LookAtLH = function(eye, target, up) {
            var zAxis = target.subtract(eye);
            zAxis.normalize();
            var xAxis = displayengineImpl.Vector3.Cross(up, zAxis);
            xAxis.normalize();
            var yAxis = displayengineImpl.Vector3.Cross(zAxis, xAxis);
            yAxis.normalize();
            var ex = -(xAxis.x * eye.x + xAxis.y * eye.y + xAxis.z * eye.z);
            var ey = -(yAxis.x * eye.x + yAxis.y * eye.y + yAxis.z * eye.z);
            var ez = -(zAxis.x * eye.x + zAxis.y * eye.y + zAxis.z * eye.z);
            return displayengineImpl.Matrix.FromValues(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, ex, ey, ez, 1);
        };
        displayengineImpl.Matrix.PerspectiveLH = function(width, height, znear, zfar) {
            var matrix = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            matrix.m[0] = 2.0 * znear / width;
            matrix.m[1] = matrix.m[2] = matrix.m[3] = 0.0;
            matrix.m[5] = 2.0 * znear / height;
            matrix.m[4] = matrix.m[6] = matrix.m[7] = 0.0;
            matrix.m[10] = -zfar / (znear - zfar);
            matrix.m[8] = matrix.m[9] = 0.0;
            matrix.m[11] = 1.0;
            matrix.m[12] = matrix.m[13] = matrix.m[15] = 0.0;
            matrix.m[14] = znear * zfar / (znear - zfar);
            return matrix;
        };
        displayengineImpl.Matrix.PerspectiveFovLH = function(fov, aspect, znear, zfar) {
            var matrix = displayengineImpl.Matrix.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            var tan = 1.0 / _hcmn_.Math.tan(fov * 0.5);
            matrix.m[0] = tan / aspect;
            matrix.m[1] = matrix.m[2] = matrix.m[3] = 0.0;
            matrix.m[5] = tan;
            matrix.m[4] = matrix.m[6] = matrix.m[7] = 0.0;
            matrix.m[8] = matrix.m[9] = 0.0;
            matrix.m[10] = -zfar / (znear - zfar);
            matrix.m[11] = 1.0;
            matrix.m[12] = matrix.m[13] = matrix.m[15] = 0.0;
            matrix.m[14] = znear * zfar / (znear - zfar);
            return matrix;
        };
        displayengineImpl.Matrix.Transpose = function(matrix) {
            var result = new displayengineImpl.Matrix();
            result.m[0] = matrix.m[0];
            result.m[1] = matrix.m[4];
            result.m[2] = matrix.m[8];
            result.m[3] = matrix.m[12];
            result.m[4] = matrix.m[1];
            result.m[5] = matrix.m[5];
            result.m[6] = matrix.m[9];
            result.m[7] = matrix.m[13];
            result.m[8] = matrix.m[2];
            result.m[9] = matrix.m[6];
            result.m[10] = matrix.m[10];
            result.m[11] = matrix.m[14];
            result.m[12] = matrix.m[3];
            result.m[13] = matrix.m[7];
            result.m[14] = matrix.m[11];
            result.m[15] = matrix.m[15];
            return result;
        };
        displayengineImpl.Matrix.prototype.__class__ = displayengineImpl.Matrix;
        displayengineImpl.MeshBuilder = function() {};
        displayengineImpl.MeshBuilder.__name__ = ["displayengineImpl", "MeshBuilder"];
        displayengineImpl.MeshBuilder.CreatePlane = function(name, options) {
            if (name == null) name = "";
            if (options == null) options = {};
            var mesh = new displayengineImpl.Mesh(name);
            var width;
            if (options.width != null) width = options.width;
            else width = 1;
            var height;
            if (options.height != null) height = options.height;
            else height = 1;
            var halfWidth = width / 2;
            var halfHeight = height / 2;
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(-halfWidth, -halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.0, 0.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(halfWidth, -halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.5, 0.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(halfWidth, halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.5, 1.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(-halfWidth, halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.0, 1.0)
            });
            mesh.Faces.push({
                A: 0,
                B: 1,
                C: 2
            });
            mesh.Faces.push({
                A: 0,
                B: 2,
                C: 3
            });
            return mesh;
        };
        displayengineImpl.MeshBuilder.CreateCard = function(name, bmpBack, bmpFront, options, camera) {
            if (name == null) name = "";
            if (options == null) options = {};
            var width;
            if (options.width != null) width = options.width;
            else width = 1;
            var height;
            if (options.height != null) height = options.height;
            else height = 1;
            var faceUp;
            if (options.faceUp != null) faceUp = options.faceUp;
            else faceUp = false;
            var canvas;
            var _this = window.document;
            canvas = _this.createElement("canvas");
            canvas.width = _hcmn_.Std["int"](bmpBack.getWidth() * 2.8);
            canvas.height = _hcmn_.Std["int"](bmpBack.getHeight() * 3.6);
            var mesh = new displayengineImpl.Card(name, bmpBack, bmpFront, canvas, !faceUp, camera);
            mesh.Vertices = [];
            var halfWidth = width / 2;
            var halfHeight = height / 2;
            mesh.topLeft.set(-halfWidth, -halfHeight, 0);
            mesh.bottomRight.set(halfWidth, halfHeight, 0);
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(-halfWidth, -halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.0, 0.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(halfWidth, -halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.5, 0.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(halfWidth, halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.5, 1.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(-halfWidth, halfHeight, 0),
                Normal: new displayengineImpl.Vector3(0, 0, 1),
                TextureCoordinates: new displayengineImpl.Vector2(0.0, 1.0)
            });
            mesh.Faces.push({
                A: 0,
                B: 1,
                C: 2
            });
            mesh.Faces.push({
                A: 0,
                B: 2,
                C: 3
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(-halfWidth, halfHeight, -0.01),
                Normal: new displayengineImpl.Vector3(0, 0, -1),
                TextureCoordinates: new displayengineImpl.Vector2(0.5, 0.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(halfWidth, halfHeight, -0.01),
                Normal: new displayengineImpl.Vector3(0, 0, -1),
                TextureCoordinates: new displayengineImpl.Vector2(1.0, 0.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(halfWidth, -halfHeight, -0.01),
                Normal: new displayengineImpl.Vector3(0, 0, -1),
                TextureCoordinates: new displayengineImpl.Vector2(1.0, 1.0)
            });
            mesh.Vertices.push({
                Coordinates: new displayengineImpl.Vector3(-halfWidth, -halfHeight, -0.01),
                Normal: new displayengineImpl.Vector3(0, 0, -1),
                TextureCoordinates: new displayengineImpl.Vector2(0.5, 1.0)
            });
            mesh.Faces.push({
                A: 4,
                B: 5,
                C: 6
            });
            mesh.Faces.push({
                A: 4,
                B: 6,
                C: 7
            });
            mesh.initialDraw();
            return mesh;
        };
        displayengineImpl.MeshBuilder.CreateGround = function(name, options) {
            if (options == null) options = {};
            var mesh = new displayengineImpl.Mesh(name);
            mesh.Vertices = [];
            var width;
            if (options.width != null) width = options.width;
            else width = 1;
            var height;
            if (options.height != null) height = options.height;
            else height = 1;
            var subdivisionsX;
            if (options.subdivisionsX != null) subdivisionsX = options.subdivisionsX;
            else if (options.subdivisions != null) subdivisionsX = options.subdivisions;
            else subdivisionsX = 2;
            var subdivisionsY;
            if (options.subdivisionsY != null) subdivisionsY = options.subdivisionsY;
            else if (options.subdivisions != null) subdivisionsY = options.subdivisions;
            else subdivisionsY = 2;
            var _g1 = 0;
            var _g = subdivisionsY + 1;
            while (_g1 < _g) {
                var row = _g1++;
                var _g3 = 0;
                var _g2 = subdivisionsX + 1;
                while (_g3 < _g2) {
                    var col = _g3++;
                    var position_x = col * width / subdivisionsX - width / 2.0;
                    var position_y = 0;
                    var position_z = (subdivisionsY - row) * height / subdivisionsY - height / 2.0;
                    var normal_x = 0;
                    var normal_y = 1.0;
                    var normal_z = 0;
                    mesh.Vertices.push({
                        Coordinates: new displayengineImpl.Vector3(position_x, position_y, position_z),
                        Normal: new displayengineImpl.Vector3(normal_x, normal_y, normal_z),
                        TextureCoordinates: new displayengineImpl.Vector2(col / subdivisionsX, 1.0 - row / subdivisionsX)
                    });
                }
            }
            var _g4 = 0;
            while (_g4 < subdivisionsY) {
                var row1 = _g4++;
                var _g11 = 0;
                while (_g11 < subdivisionsX) {
                    var col1 = _g11++;
                    mesh.Faces.push({
                        A: col1 + 1 + (row1 + 1) * (subdivisionsX + 1),
                        B: col1 + 1 + row1 * (subdivisionsX + 1),
                        C: col1 + row1 * (subdivisionsX + 1)
                    });
                    mesh.Faces.push({
                        A: col1 + (row1 + 1) * (subdivisionsX + 1),
                        B: col1 + 1 + (row1 + 1) * (subdivisionsX + 1),
                        C: col1 + row1 * (subdivisionsX + 1)
                    });
                }
            }
            return mesh;
        };
        displayengineImpl.MeshBuilder.CreateBox = function(name, options) {
            if (options == null) options = {};
            var normalsSource = [new displayengineImpl.Vector3(0, 0, 1), new displayengineImpl.Vector3(0, 0, -1), new displayengineImpl.Vector3(1, 0, 0), new displayengineImpl.Vector3(-1, 0, 0), new displayengineImpl.Vector3(0, 1, 0), new displayengineImpl.Vector3(0, -1, 0)];
            var width;
            if (options.width != null) width = options.width;
            else width = 0.5;
            var height;
            if (options.height != null) height = options.height;
            else height = 0.5;
            var depth;
            if (options.depth != null) depth = options.depth;
            else depth = 0.5;
            var faceUV;
            if (options.faceUV != null) faceUV = options.faceUV;
            else faceUV = [];
            var _g = 0;
            while (_g < 6) {
                var f = _g++;
                if (faceUV[f] == null) faceUV[f] = new displayengineImpl.Vector4(0, 0, 1, 1);
            }
            var scaleVector = new displayengineImpl.Vector3(width / 2, height / 2, depth / 2);
            var mesh = new displayengineImpl.Mesh("");
            var _g1 = 0;
            var _g2 = normalsSource.length;
            while (_g1 < _g2) {
                var index = _g1++;
                var normal = normalsSource[index];
                var side1 = new displayengineImpl.Vector3(normal.y, normal.z, normal.x);
                var side2 = displayengineImpl.Vector3.Cross(normal, side1);
                var verticesLength;
                verticesLength = (mesh.Vertices.length > 0 ? mesh.Vertices.Coordinates.length / 3 : 0) | 0;
                mesh.Faces.push({
                    A: verticesLength,
                    B: verticesLength + 1,
                    C: verticesLength + 2
                });
                mesh.Faces.push({
                    A: verticesLength,
                    B: verticesLength + 1,
                    C: verticesLength + 2
                });
                var vertex = new displayengineImpl.Vector3(normal.x - side1.x, normal.y - side1.y, normal.z - side1.z).subtract(side2).multiply(scaleVector);
                mesh.Vertices.push({
                    Coordinates: new displayengineImpl.Vector3(vertex.x, vertex.y, vertex.z),
                    Normal: new displayengineImpl.Vector3(normal.x, normal.y, normal.z),
                    TextureCoordinates: new displayengineImpl.Vector2(1.0, 1.0)
                });
                vertex = new displayengineImpl.Vector3(normal.x - side1.x, normal.y - side1.y, normal.z - side1.z).add(side2).multiply(scaleVector);
                mesh.Vertices.push({
                    Coordinates: new displayengineImpl.Vector3(vertex.x, vertex.y, vertex.z),
                    Normal: new displayengineImpl.Vector3(normal.x, normal.y, normal.z),
                    TextureCoordinates: new displayengineImpl.Vector2(0.0, 1.0)
                });
                vertex = new displayengineImpl.Vector3(normal.x + side1.x, normal.y + side1.y, normal.z + side1.z).add(side2).multiply(scaleVector);
                mesh.Vertices.push({
                    Coordinates: new displayengineImpl.Vector3(vertex.x, vertex.y, vertex.z),
                    Normal: new displayengineImpl.Vector3(normal.x, normal.y, normal.z),
                    TextureCoordinates: new displayengineImpl.Vector2(0.0, 0.0)
                });
                vertex = new displayengineImpl.Vector3(normal.x + side1.x, normal.y + side1.y, normal.z + side1.z).subtract(side2).multiply(scaleVector);
                mesh.Vertices.push({
                    Coordinates: new displayengineImpl.Vector3(vertex.x, vertex.y, vertex.z),
                    Normal: new displayengineImpl.Vector3(normal.x, normal.y, normal.z),
                    TextureCoordinates: new displayengineImpl.Vector2(1.0, 0.0)
                });
            }
            return mesh;
        };
        displayengineImpl.MeshBuilder.prototype.__class__ = displayengineImpl.MeshBuilder;
        displayengineImpl.Renderer = function(canvas) {
            this.bottomRight = null;
            this.topLeft = null;
            this.data = {};
            this.shadowOffsetY = 5;
            this.shadowOffsetX = 5;
            this.shadowBlur = 15;
            this.shadowColor = "#222";
            this.renderShadow = true;
            this.WSH = 0;
            this.lightPos = new displayengineImpl.Vector3(0, 15, 15);
            this.isFaceUp = false;
            this.renderCanvas = canvas;
            this.renderCtx = canvas.getContext("2d", null);
            var _this = window.document;
            this.workingCanvas = _this.createElement("canvas");
            this.workingCanvas.width = canvas.width;
            this.workingCanvas.height = canvas.height;
            this.workingWidth = canvas.width;
            this.workingHeight = canvas.height;
            this.workingContext = this.workingCanvas.getContext("2d");
            this.workingContext.imageSmoothingEnabled = true;
            this.depthbuffer = [];
            this.WSH = this.workingWidth / this.workingHeight;
            displayengineImpl.Renderer.projectionMatrix = displayengineImpl.Matrix.PerspectiveFovLH(0.78, this.WSH, 0.01, 1.0);
            this.clear();
        };
        displayengineImpl.Renderer.__name__ = ["displayengineImpl", "Renderer"];
        displayengineImpl.Renderer.prototype.backbuffer = null;
        displayengineImpl.Renderer.prototype.workingCanvas = null;
        displayengineImpl.Renderer.prototype.workingContext = null;
        displayengineImpl.Renderer.prototype.workingWidth = null;
        displayengineImpl.Renderer.prototype.workingHeight = null;
        displayengineImpl.Renderer.prototype.isFaceUp = null;
        displayengineImpl.Renderer.prototype.renderCanvas = null;
        displayengineImpl.Renderer.prototype.renderCtx = null;
        displayengineImpl.Renderer.prototype.ctx = null;
        displayengineImpl.Renderer.prototype.get_ctx = function() {
            return this.renderCtx;
        };
        displayengineImpl.Renderer.prototype.backbufferdata = null;
        displayengineImpl.Renderer.prototype.depthbuffer = null;
        displayengineImpl.Renderer.prototype.lightPos = null;
        displayengineImpl.Renderer.prototype.WSH = null;
        displayengineImpl.Renderer.prototype.renderShadow = null;
        displayengineImpl.Renderer.prototype.shadowColor = null;
        displayengineImpl.Renderer.prototype.shadowBlur = null;
        displayengineImpl.Renderer.prototype.shadowOffsetX = null;
        displayengineImpl.Renderer.prototype.shadowOffsetY = null;
        displayengineImpl.Renderer.prototype.dispose = function() {
            this.backbufferdata = null;
            this.depthbuffer = null;
            this.lightPos = null;
            this.renderCanvas = null;
            this.workingCanvas = null;
            this.backbuffer = null;
        };
        displayengineImpl.Renderer.prototype.clear = function() {
            this.workingContext.clearRect(0, 0, this.workingWidth, this.workingHeight);
            this.backbuffer = this.workingContext.getImageData(0, 0, this.workingWidth, this.workingHeight);
            var _g1 = 0;
            var _g = this.depthbuffer.length;
            while (_g1 < _g) {
                var i = _g1++;
                this.depthbuffer[i] = 10000000;
            }
        };
        displayengineImpl.Renderer.prototype.putPixel = function(x, y, z, color) {
            this.backbufferdata = this.backbuffer.data;
            var index = x + y * this.workingWidth;
            var index4 = index * 4;
            if (this.depthbuffer[index] < z) return;
            this.depthbuffer[index] = z;
            this.backbufferdata[index4] = color.r * 255;
            this.backbufferdata[index4 + 1] = color.g * 255;
            this.backbufferdata[index4 + 2] = color.b * 255;
            this.backbufferdata[index4 + 3] = color.a * 255;
        };
        displayengineImpl.Renderer.prototype.drawPoint = function(point, color) {
            if (point.x >= 0 && point.y >= 0 && point.x < this.workingWidth && point.y < this.workingHeight) this.putPixel(point.x, point.y, point.z, color);
        };
        displayengineImpl.Renderer.prototype.present = function() {
            this.workingContext.putImageData(this.backbuffer, 0, 0);
            this.renderCtx.clearRect(0, 0, this.workingWidth, this.workingHeight);
            this.renderCtx.shadowColor = "";
            this.renderCtx.shadowBlur = 0;
            this.renderCtx.shadowOffsetX = 0;
            this.renderCtx.shadowOffsetY = 0;
            this.renderCtx.drawImage(this.workingCanvas, 0, 0, this.workingWidth, this.workingHeight);
        };
        displayengineImpl.Renderer.prototype.clamp = function(value, min, max) {
            if (max == null) max = 1;
            if (min == null) min = 0;
            if (value < min) return min;
            else if (value > max) return max;
            else return value;
        };
        displayengineImpl.Renderer.prototype.interpolate = function(min, max, gradient) {
            return min + (max - min) * (gradient < 0 ? 0 : gradient > 1 ? 1 : gradient);
        };
        displayengineImpl.Renderer.prototype.project = function(vertex, transMat, world) {
            displayengineImpl.Vector3.TransformCoordinatesToRef(vertex.Coordinates, transMat, displayengineImpl.Renderer.point2d);
            var point3DWorld = displayengineImpl.Vector3.TransformCoordinates(vertex.Coordinates, world);
            var normal3DWorld = displayengineImpl.Vector3.TransformCoordinates(vertex.Normal, world);
            var x = displayengineImpl.Renderer.point2d.x * this.workingWidth + this.workingWidth / 2.0;
            var y = -displayengineImpl.Renderer.point2d.y * this.workingHeight + this.workingHeight / 2.0;
            if (!this.isFaceUp) {
                x = -displayengineImpl.Renderer.point2d.x * this.workingWidth + this.workingWidth / 2.0;
                y = displayengineImpl.Renderer.point2d.y * this.workingHeight + this.workingHeight / 2.0;
            }
            return {
                Coordinates: new displayengineImpl.Vector3(x, y, displayengineImpl.Renderer.point2d.z),
                Normal: normal3DWorld,
                WorldCoordinates: point3DWorld,
                TextureCoordinates: vertex.TextureCoordinates
            };
        };
        displayengineImpl.Renderer.prototype.computeNDotL = function(vertex, normal, lightPosition) {
            lightPosition.subtractToRef(vertex, displayengineImpl.Renderer.lightDirection);
            normal.normalize();
            displayengineImpl.Renderer.lightDirection.normalize();
            return _hcmn_.Math.max(0, displayengineImpl.Vector3.Dot(normal, displayengineImpl.Renderer.lightDirection));
        };
        displayengineImpl.Renderer.prototype.processScanLine = function(data, va, vb, vc, vd, color, texture) {
            var pa = va.Coordinates;
            var pb = vb.Coordinates;
            var pc = vc.Coordinates;
            var pd = vd.Coordinates;
            var gradient1;
            if (pa.y != pb.y) gradient1 = (data.currentY - pa.y) / (pb.y - pa.y);
            else gradient1 = 1;
            var gradient2;
            if (pc.y != pd.y) gradient2 = (data.currentY - pc.y) / (pd.y - pc.y);
            else gradient2 = 1;
            var sx = _hcmn_.Std["int"](this.interpolate(pa.x, pb.x, gradient1));
            var ex = _hcmn_.Std["int"](this.interpolate(pc.x, pd.x, gradient2));
            var z1 = this.interpolate(pa.z, pb.z, gradient1);
            var z2 = this.interpolate(pc.z, pd.z, gradient2);
            var snl = this.interpolate(data.ndotla, data.ndotlb, gradient1);
            var enl = this.interpolate(data.ndotlc, data.ndotld, gradient2);
            var su = this.interpolate(data.ua, data.ub, gradient1);
            var eu = this.interpolate(data.uc, data.ud, gradient2);
            var sv = this.interpolate(data.va, data.vb, gradient1);
            var ev = this.interpolate(data.vc, data.vd, gradient2);
            var _g = sx;
            while (_g < ex) {
                var x = _g++;
                var gradient = (x - sx) / (ex - sx);
                var z;
                z = z1 + (z2 - z1) * (gradient < 0 ? 0 : gradient > 1 ? 1 : gradient);
                var ndotl;
                ndotl = snl + (enl - snl) * (gradient < 0 ? 0 : gradient > 1 ? 1 : gradient);
                var u;
                u = su + (eu - su) * (gradient < 0 ? 0 : gradient > 1 ? 1 : gradient);
                var v;
                v = sv + (ev - sv) * (gradient < 0 ? 0 : gradient > 1 ? 1 : gradient);
                if (texture != null) displayengineImpl.Renderer.textureColor = texture.map(u, v);
                displayengineImpl.Renderer.drawPointVector.set(x, data.currentY, z);
                displayengineImpl.Renderer.drawPointColor.set(color.r * ndotl * displayengineImpl.Renderer.textureColor.r, color.g * ndotl * displayengineImpl.Renderer.textureColor.g, color.b * ndotl * displayengineImpl.Renderer.textureColor.b, displayengineImpl.Renderer.textureColor.a);
                this.drawPoint(displayengineImpl.Renderer.drawPointVector, displayengineImpl.Renderer.drawPointColor);
            }
        };
        displayengineImpl.Renderer.prototype.data = null;
        displayengineImpl.Renderer.prototype.drawTriangle = function(v1, v2, v3, color, texture) {
            if (v1.Coordinates.y > v2.Coordinates.y) {
                var temp = v2;
                v2 = v1;
                v1 = temp;
            }
            if (v2.Coordinates.y > v3.Coordinates.y) {
                var temp1 = v2;
                v2 = v3;
                v3 = temp1;
            }
            if (v1.Coordinates.y > v2.Coordinates.y) {
                var temp2 = v2;
                v2 = v1;
                v1 = temp2;
            }
            var p1 = v1.Coordinates;
            var p2 = v2.Coordinates;
            var p3 = v3.Coordinates;
            var nl1 = this.computeNDotL(v1.WorldCoordinates, v1.Normal, this.lightPos);
            var nl2 = this.computeNDotL(v2.WorldCoordinates, v2.Normal, this.lightPos);
            var nl3 = this.computeNDotL(v3.WorldCoordinates, v3.Normal, this.lightPos);
            var dP1P2 = 0;
            var dP1P3 = 0;
            if (p2.y - p1.y > 0) dP1P2 = (p2.x - p1.x) / (p2.y - p1.y);
            else dP1P2 = 0;
            if (p3.y - p1.y > 0) dP1P3 = (p3.x - p1.x) / (p3.y - p1.y);
            else dP1P3 = 0;
            if (dP1P2 > dP1P3) {
                this.isFaceUp = true;
                var _g1 = p1.y | 0;
                var _g = (p3.y | 0) + 1;
                while (_g1 < _g) {
                    var y = _g1++;
                    this.data.currentY = y;
                    if (y < p2.y) {
                        this.data.ndotla = nl1;
                        this.data.ndotlb = nl3;
                        this.data.ndotlc = nl1;
                        this.data.ndotld = nl2;
                        this.data.ua = v1.TextureCoordinates.x;
                        this.data.ub = v3.TextureCoordinates.x;
                        this.data.uc = v1.TextureCoordinates.x;
                        this.data.ud = v2.TextureCoordinates.x;
                        this.data.va = v1.TextureCoordinates.y;
                        this.data.vb = v3.TextureCoordinates.y;
                        this.data.vc = v1.TextureCoordinates.y;
                        this.data.vd = v2.TextureCoordinates.y;
                        this.processScanLine(this.data, v1, v3, v1, v2, color, texture);
                    } else {
                        this.data.ndotla = nl1;
                        this.data.ndotlb = nl3;
                        this.data.ndotlc = nl2;
                        this.data.ndotld = nl3;
                        this.data.ua = v1.TextureCoordinates.x;
                        this.data.ub = v3.TextureCoordinates.x;
                        this.data.uc = v2.TextureCoordinates.x;
                        this.data.ud = v3.TextureCoordinates.x;
                        this.data.va = v1.TextureCoordinates.y;
                        this.data.vb = v3.TextureCoordinates.y;
                        this.data.vc = v2.TextureCoordinates.y;
                        this.data.vd = v3.TextureCoordinates.y;
                        this.processScanLine(this.data, v1, v3, v2, v3, color, texture);
                    }
                }
            } else {
                var _g11 = p1.y | 0;
                var _g2 = (p3.y | 0) + 1;
                while (_g11 < _g2) {
                    var y1 = _g11++;
                    this.data.currentY = y1;
                    if (y1 < p2.y) {
                        this.data.ndotla = nl1;
                        this.data.ndotlb = nl2;
                        this.data.ndotlc = nl1;
                        this.data.ndotld = nl3;
                        this.data.ua = v1.TextureCoordinates.x;
                        this.data.ub = v2.TextureCoordinates.x;
                        this.data.uc = v1.TextureCoordinates.x;
                        this.data.ud = v3.TextureCoordinates.x;
                        this.data.va = v1.TextureCoordinates.y;
                        this.data.vb = v2.TextureCoordinates.y;
                        this.data.vc = v1.TextureCoordinates.y;
                        this.data.vd = v3.TextureCoordinates.y;
                        this.processScanLine(this.data, v1, v2, v1, v3, color, texture);
                    } else {
                        this.data.ndotla = nl2;
                        this.data.ndotlb = nl3;
                        this.data.ndotlc = nl1;
                        this.data.ndotld = nl3;
                        this.data.ua = v2.TextureCoordinates.x;
                        this.data.ub = v3.TextureCoordinates.x;
                        this.data.uc = v1.TextureCoordinates.x;
                        this.data.ud = v3.TextureCoordinates.x;
                        this.data.va = v2.TextureCoordinates.y;
                        this.data.vb = v3.TextureCoordinates.y;
                        this.data.vc = v1.TextureCoordinates.y;
                        this.data.vd = v3.TextureCoordinates.y;
                        this.processScanLine(this.data, v2, v3, v1, v3, color, texture);
                    }
                }
            }
        };
        displayengineImpl.Renderer.prototype.topLeft = null;
        displayengineImpl.Renderer.prototype.bottomRight = null;
        displayengineImpl.Renderer.prototype.render = function(camera, meshes) {
            displayengineImpl.Renderer.viewMatrix = displayengineImpl.Matrix.LookAtLH(camera.Position, camera.Target, displayengineImpl.Vector3._UP);
            var _g1 = 0;
            var _g = meshes.length;
            while (_g1 < _g) {
                var index = _g1++;
                var cMesh = meshes[index];
                if (!this.isFaceUp) displayengineImpl.Renderer.worldMatrix = displayengineImpl.Matrix.RotationZ(cMesh.Rotation.z).multiply(displayengineImpl.Matrix.RotationX(cMesh.Rotation.x)).multiply(displayengineImpl.Matrix.RotationY(-cMesh.Rotation.y)).multiply(displayengineImpl.Matrix.Translation(cMesh.Position.x, cMesh.Position.y, cMesh.Position.z));
                else displayengineImpl.Renderer.worldMatrix = displayengineImpl.Matrix.RotationZ(cMesh.Rotation.z).multiply(displayengineImpl.Matrix.RotationX(cMesh.Rotation.x)).multiply(displayengineImpl.Matrix.RotationY(cMesh.Rotation.y)).multiply(displayengineImpl.Matrix.Translation(cMesh.Position.x, cMesh.Position.y, cMesh.Position.z));
                displayengineImpl.Renderer.transformMatrix = displayengineImpl.Renderer.worldMatrix.multiply(displayengineImpl.Renderer.viewMatrix).multiply(displayengineImpl.Renderer.projectionMatrix);
                var _g3 = 0;
                var _g2 = cMesh.Faces.length;
                while (_g3 < _g2) {
                    var indexFaces = _g3++;
                    displayengineImpl.Renderer.currentFace = cMesh.Faces[indexFaces];
                    displayengineImpl.Renderer.vertexA = cMesh.Vertices[displayengineImpl.Renderer.currentFace.A];
                    displayengineImpl.Renderer.vertexB = cMesh.Vertices[displayengineImpl.Renderer.currentFace.B];
                    displayengineImpl.Renderer.vertexC = cMesh.Vertices[displayengineImpl.Renderer.currentFace.C];
                    displayengineImpl.Renderer.pixelA = this.project(displayengineImpl.Renderer.vertexA, displayengineImpl.Renderer.transformMatrix, displayengineImpl.Renderer.worldMatrix);
                    displayengineImpl.Renderer.pixelB = this.project(displayengineImpl.Renderer.vertexB, displayengineImpl.Renderer.transformMatrix, displayengineImpl.Renderer.worldMatrix);
                    displayengineImpl.Renderer.pixelC = this.project(displayengineImpl.Renderer.vertexC, displayengineImpl.Renderer.transformMatrix, displayengineImpl.Renderer.worldMatrix);
                    this.drawTriangle(displayengineImpl.Renderer.pixelA, displayengineImpl.Renderer.pixelB, displayengineImpl.Renderer.pixelC, new displayengineImpl.Color4(displayengineImpl.Renderer.dtColor.r, displayengineImpl.Renderer.dtColor.g, displayengineImpl.Renderer.dtColor.b, 1), cMesh.Texture);
                }
            }
        };
        displayengineImpl.Renderer.currentFace = null;
        displayengineImpl.Renderer.vertexA = null;
        displayengineImpl.Renderer.vertexB = null;
        displayengineImpl.Renderer.vertexC = null;
        displayengineImpl.Renderer.pixelA = null;
        displayengineImpl.Renderer.pixelB = null;
        displayengineImpl.Renderer.pixelC = null;
        displayengineImpl.Renderer.prototype.__class__ = displayengineImpl.Renderer;
        displayengineImpl.Texture = function(bmp, onLoad) {
            this.mapColor = new displayengineImpl.Color4(1, 1, 1, 1);
            this.init(bmp, onLoad);
        };
        displayengineImpl.Texture = ck_implements(displayengineImpl.Texture, displayEngineApi.ITexture);
        displayengineImpl.Texture.__interfaces__ = [displayEngineApi.ITexture];
        displayengineImpl.Texture.__name__ = ["displayengineImpl", "Texture"];
        displayengineImpl.Texture.prototype.width = null;
        displayengineImpl.Texture.prototype.height = null;
        displayengineImpl.Texture.prototype._img = null;
        displayengineImpl.Texture.prototype.img = null;
        displayengineImpl.Texture.prototype.get_img = function() {
            return this._img;
        };
        displayengineImpl.Texture.prototype.internalBuffer = null;
        displayengineImpl.Texture.prototype.load = function(bmp, onLoad) {
            var _g = this;
            if (bmp._canvas != null) bmp.getStage().update();
            var _this = window.document;
            this._img = _this.createElement("img");
            this._img.onload = function() {
                var internalCanvas;
                var _this1 = window.document;
                internalCanvas = _this1.createElement("canvas");
                internalCanvas.width = _g.width;
                internalCanvas.height = _g.height;
                var internalContext = internalCanvas.getContext("2d");
                internalContext.drawImage(_g._img, 0, 0);
                _g.internalBuffer = internalContext.getImageData(0, 0, _g.width, _g.height);
                internalCanvas = null;
                internalContext = null;
                if (onLoad != null) onLoad();
            };
            if (bmp._canvas != null) this._img.src = bmp._canvas.toDataURL();
            else this._img.src = bmp._image;
        };
        displayengineImpl.Texture.prototype.init = function(bmp, onLoad) {
            this.width = bmp.getWidth();
            this.height = bmp.getHeight();
            this.load(bmp, onLoad);
        };
        displayengineImpl.Texture.prototype.update = function(bmp) {
            this.init(bmp);
        };
        displayengineImpl.Texture.prototype.mapColor = null;
        displayengineImpl.Texture.prototype.map = function(tu, tv) {
            if (this.internalBuffer != null) {
                var u = tu * this.width % this.width | 0;
                var v = tv * this.height % this.height | 0;
                var pos = (u + v * this.width) * 4;
                var r = this.internalBuffer.data[pos];
                var g = this.internalBuffer.data[pos + 1];
                var b = this.internalBuffer.data[pos + 2];
                var a = this.internalBuffer.data[pos + 3];
                this.mapColor.set(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
            }
            return this.mapColor;
        };
        displayengineImpl.Texture.prototype.__class__ = displayengineImpl.Texture;
        displayengineImpl.Vector2 = function(initialX, initialY) {
            if (initialY == null) initialY = 0;
            if (initialX == null) initialX = 0;
            this.x = initialX;
            this.y = initialY;
        };
        displayengineImpl.Vector2 = ck_implements(displayengineImpl.Vector2, displayEngineApi.IVector2);
        displayengineImpl.Vector2.__interfaces__ = [displayEngineApi.IVector2];
        displayengineImpl.Vector2.__name__ = ["displayengineImpl", "Vector2"];
        displayengineImpl.Vector2.prototype.x = null;
        displayengineImpl.Vector2.prototype.y = null;
        displayengineImpl.Vector2.prototype.toString = function() {
            return "{X:" + this.x + " Y:" + this.y + "}";
        };
        displayengineImpl.Vector2.prototype.set = function(initialX, initialY) {
            if (initialY == null) initialY = 0;
            if (initialX == null) initialX = 0;
            this.x = initialX;
            this.y = initialY;
        };
        displayengineImpl.Vector2.prototype.add = function(otherVector) {
            return new displayengineImpl.Vector2(this.x + otherVector.x, this.y + otherVector.y);
        };
        displayengineImpl.Vector2.prototype.subtract = function(otherVector) {
            return new displayengineImpl.Vector2(this.x - otherVector.x, this.y - otherVector.y);
        };
        displayengineImpl.Vector2.prototype.negate = function() {
            return new displayengineImpl.Vector2(-this.x, -this.y);
        };
        displayengineImpl.Vector2.prototype.scale = function(scale) {
            return new displayengineImpl.Vector2(this.x * scale, this.y * scale);
        };
        displayengineImpl.Vector2.prototype.equals = function(otherVector) {
            return this.x == otherVector.x && this.y == otherVector.y;
        };
        displayengineImpl.Vector2.prototype.length = function() {
            return _hcmn_.Math.sqrt(this.x * this.x + this.y * this.y);
        };
        displayengineImpl.Vector2.prototype.lengthSquared = function() {
            return this.x * this.x + this.y * this.y;
        };
        displayengineImpl.Vector2.prototype.normalize = function() {
            var len = _hcmn_.Math.sqrt(this.x * this.x + this.y * this.y);
            if (len == 0) return;
            var num = 1.0 / len;
            this.x *= num;
            this.y *= num;
        };
        displayengineImpl.Vector2.Zero = function() {
            return new displayengineImpl.Vector2(0, 0);
        };
        displayengineImpl.Vector2.Copy = function(source) {
            return new displayengineImpl.Vector2(source.x, source.y);
        };
        displayengineImpl.Vector2.Normalize = function(vector) {
            var newVector = new displayengineImpl.Vector2(vector.x, vector.y);
            newVector.normalize();
            return newVector;
        };
        displayengineImpl.Vector2.Minimize = function(left, right) {
            var x;
            if (left.x < right.x) x = left.x;
            else x = right.x;
            var y;
            if (left.y < right.y) y = left.y;
            else y = right.y;
            return new displayengineImpl.Vector2(x, y);
        };
        displayengineImpl.Vector2.Maximize = function(left, right) {
            var x;
            if (left.x > right.x) x = left.x;
            else x = right.x;
            var y;
            if (left.y > right.y) y = left.y;
            else y = right.y;
            return new displayengineImpl.Vector2(x, y);
        };
        displayengineImpl.Vector2.Transform = function(vector, transformation) {
            var x = vector.x * transformation.m[0] + vector.y * transformation.m[4];
            var y = vector.x * transformation.m[1] + vector.y * transformation.m[5];
            return new displayengineImpl.Vector2(x, y);
        };
        displayengineImpl.Vector2.Distance = function(value1, value2) {
            return _hcmn_.Math.sqrt(displayengineImpl.Vector2.DistanceSquared(value1, value2));
        };
        displayengineImpl.Vector2.DistanceSquared = function(value1, value2) {
            var x = value1.x - value2.x;
            var y = value1.y - value2.y;
            return x * x + y * y;
        };
        displayengineImpl.Vector2.prototype.__class__ = displayengineImpl.Vector2;
        displayengineImpl.Vector4 = function(x, y, z, w) {
            if (w == null) w = 0;
            if (z == null) z = 0;
            if (y == null) y = 0;
            if (x == null) x = 0;
            this.x = x;
            this.y = y;
            this.z = z;
            this.w = w;
        };
        displayengineImpl.Vector4 = ck_implements(displayengineImpl.Vector4, displayEngineApi.IVector4);
        displayengineImpl.Vector4.__interfaces__ = [displayEngineApi.IVector4];
        displayengineImpl.Vector4.__name__ = ["displayengineImpl", "Vector4"];
        displayengineImpl.Vector4.prototype.x = null;
        displayengineImpl.Vector4.prototype.y = null;
        displayengineImpl.Vector4.prototype.z = null;
        displayengineImpl.Vector4.prototype.w = null;
        displayengineImpl.Vector4.prototype.toString = function() {
            return "{X:" + this.x + " Y:" + this.y + " Z:" + this.z + "W:" + this.w + "}";
        };
        displayengineImpl.Vector4.prototype.getClassName = function() {
            return "Vector4";
        };
        displayengineImpl.Vector4.prototype.getHashCode = function() {
            var hash = this.x | 0;
            hash = (hash * 397 | 0) ^ (this.y | 0);
            hash = (hash * 397 | 0) ^ (this.z | 0);
            hash = (hash * 397 | 0) ^ (this.w | 0);
            return hash;
        };
        displayengineImpl.Vector4.prototype.asArray = function() {
            var result = [];
            result[0] = this.x;
            result[1] = this.y;
            result[2] = this.z;
            result[3] = this.w;
            this;
            return result;
        };
        displayengineImpl.Vector4.prototype.set = function(x, y, z, w) {
            if (z == null) z = 0;
            if (y == null) y = 0;
            if (x == null) x = 0;
            this.x = x;
            this.y = y;
            this.z = z;
            if (w != null) this.w = w;
        };
        displayengineImpl.Vector4.prototype.toArray = function(array, index) {
            if (index == null) index = 0;
            array[index] = this.x;
            array[index + 1] = this.y;
            array[index + 2] = this.z;
            array[index + 3] = this.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.addInPlace = function(otherVector) {
            this.x += otherVector.x;
            this.y += otherVector.y;
            this.z += otherVector.z;
            this.w += otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.add = function(otherVector) {
            return new displayengineImpl.Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);
        };
        displayengineImpl.Vector4.prototype.addToRef = function(otherVector, result) {
            result.x = this.x + otherVector.x;
            result.y = this.y + otherVector.y;
            result.z = this.z + otherVector.z;
            result.w = this.w + otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.subtractInPlace = function(otherVector) {
            this.x -= otherVector.x;
            this.y -= otherVector.y;
            this.z -= otherVector.z;
            this.w -= otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.subtract = function(otherVector) {
            return new displayengineImpl.Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);
        };
        displayengineImpl.Vector4.prototype.subtractToRef = function(otherVector, result) {
            result.x = this.x - otherVector.x;
            result.y = this.y - otherVector.y;
            result.z = this.z - otherVector.z;
            result.w = this.w - otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.subtractFromFloats = function(x, y, z, w) {
            return new displayengineImpl.Vector4(this.x - x, this.y - y, this.z - z, this.w - w);
        };
        displayengineImpl.Vector4.prototype.subtractFromFloatsToRef = function(x, y, z, w, result) {
            result.x = this.x - x;
            result.y = this.y - y;
            result.z = this.z - z;
            result.w = this.w - w;
            return this;
        };
        displayengineImpl.Vector4.prototype.negate = function() {
            return new displayengineImpl.Vector4(-this.x, -this.y, -this.z, -this.w);
        };
        displayengineImpl.Vector4.prototype.scaleInPlace = function(scale) {
            this.x *= scale;
            this.y *= scale;
            this.z *= scale;
            this.w *= scale;
            return this;
        };
        displayengineImpl.Vector4.prototype.scale = function(scale) {
            return new displayengineImpl.Vector4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
        };
        displayengineImpl.Vector4.prototype.scaleToRef = function(scale, result) {
            result.x = this.x * scale;
            result.y = this.y * scale;
            result.z = this.z * scale;
            result.w = this.w * scale;
            return this;
        };
        displayengineImpl.Vector4.prototype.equals = function(otherVector) {
            return otherVector != null && this.x == otherVector.x && this.y == otherVector.y && this.z == otherVector.z && this.w == otherVector.w;
        };
        displayengineImpl.Vector4.prototype.equalsToFloats = function(x, y, z, w) {
            return this.x == x && this.y == y && this.z == z && this.w == w;
        };
        displayengineImpl.Vector4.prototype.multiplyInPlace = function(otherVector) {
            this.x *= otherVector.x;
            this.y *= otherVector.y;
            this.z *= otherVector.z;
            this.w *= otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.multiply = function(otherVector) {
            return new displayengineImpl.Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);
        };
        displayengineImpl.Vector4.prototype.multiplyToRef = function(otherVector, result) {
            result.x = this.x * otherVector.x;
            result.y = this.y * otherVector.y;
            result.z = this.z * otherVector.z;
            result.w = this.w * otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.multiplyByFloats = function(x, y, z, w) {
            return new displayengineImpl.Vector4(this.x * x, this.y * y, this.z * z, this.w * w);
        };
        displayengineImpl.Vector4.prototype.divide = function(otherVector) {
            return new displayengineImpl.Vector4(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);
        };
        displayengineImpl.Vector4.prototype.divideToRef = function(otherVector, result) {
            result.x = this.x / otherVector.x;
            result.y = this.y / otherVector.y;
            result.z = this.z / otherVector.z;
            result.w = this.w / otherVector.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.dotProduct = function(a) {
            return this.x * a.x + this.y * a.y + this.z * a.z;
        };
        displayengineImpl.Vector4.prototype.MinimizeInPlace = function(other) {
            if (other.x < this.x) this.x = other.x;
            if (other.y < this.y) this.y = other.y;
            if (other.z < this.z) this.z = other.z;
            if (other.w < this.w) this.w = other.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.MaximizeInPlace = function(other) {
            if (other.x > this.x) this.x = other.x;
            if (other.y > this.y) this.y = other.y;
            if (other.z > this.z) this.z = other.z;
            if (other.w > this.w) this.w = other.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.length = function() {
            return _hcmn_.Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
        };
        displayengineImpl.Vector4.prototype.lengthSquared = function() {
            return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
        };
        displayengineImpl.Vector4.prototype.normalize = function() {
            var len = _hcmn_.Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
            if (len == 0) return this;
            var num = 1.0 / len;
            this.x *= num;
            this.y *= num;
            this.z *= num;
            this.w *= num;
            return this;
        };
        displayengineImpl.Vector4.prototype.toVector3 = function() {
            return new displayengineImpl.Vector3(this.x, this.y, this.z);
        };
        displayengineImpl.Vector4.prototype.clone = function() {
            return new displayengineImpl.Vector4(this.x, this.y, this.z, this.w);
        };
        displayengineImpl.Vector4.prototype.copyFrom = function(source) {
            this.x = source.x;
            this.y = source.y;
            this.z = source.z;
            this.w = source.w;
            return this;
        };
        displayengineImpl.Vector4.prototype.copyFromFloats = function(x, y, z, w) {
            this.x = x;
            this.y = y;
            this.z = z;
            this.w = w;
            return this;
        };
        displayengineImpl.Vector4.FromArray = function(array, offset) {
            if (offset == null) offset = 0;
            return new displayengineImpl.Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);
        };
        displayengineImpl.Vector4.FromArrayToRef = function(array, offset, result) {
            result.x = array[offset];
            result.y = array[offset + 1];
            result.z = array[offset + 2];
            result.w = array[offset + 3];
        };
        displayengineImpl.Vector4.FromFloatsToRef = function(x, y, z, w, result) {
            result.x = x;
            result.y = y;
            result.z = z;
            result.w = w;
        };
        displayengineImpl.Vector4.Zero = function() {
            return new displayengineImpl.Vector4(0, 0, 0, 0);
        };
        displayengineImpl.Vector4.Normalize = function(vector) {
            var result = new displayengineImpl.Vector4(0, 0, 0, 0);
            result.x = vector.x;
            result.y = vector.y;
            result.z = vector.z;
            result.w = vector.w;
            result;
            result.normalize();
            return result;
        };
        displayengineImpl.Vector4.NormalizeToRef = function(vector, result) {
            result.x = vector.x;
            result.y = vector.y;
            result.z = vector.z;
            result.w = vector.w;
            result;
            result.normalize();
        };
        displayengineImpl.Vector4.Minimize = function(left, right) {
            var min = new displayengineImpl.Vector4(left.x, left.y, left.z, left.w);
            if (right.x < min.x) min.x = right.x;
            if (right.y < min.y) min.y = right.y;
            if (right.z < min.z) min.z = right.z;
            if (right.w < min.w) min.w = right.w;
            min;
            return min;
        };
        displayengineImpl.Vector4.Maximize = function(left, right) {
            var max = new displayengineImpl.Vector4(left.x, left.y, left.z, left.w);
            if (right.x > max.x) max.x = right.x;
            if (right.y > max.y) max.y = right.y;
            if (right.z > max.z) max.z = right.z;
            if (right.w > max.w) max.w = right.w;
            max;
            return max;
        };
        displayengineImpl.Vector4.Distance = function(value1, value2) {
            return _hcmn_.Math.sqrt(displayengineImpl.Vector4.DistanceSquared(value1, value2));
        };
        displayengineImpl.Vector4.DistanceSquared = function(value1, value2) {
            var x = value1.x - value2.x;
            var y = value1.y - value2.y;
            var z = value1.z - value2.z;
            var w = value1.w - value2.w;
            return x * x + y * y + z * z + w * w;
        };
        displayengineImpl.Vector4.Center = function(value1, value2) {
            var center = new displayengineImpl.Vector4(value1.x + value2.x, value1.y + value2.y, value1.z + value2.z, value1.w + value2.w);
            center.x *= 0.5;
            center.y *= 0.5;
            center.z *= 0.5;
            center.w *= 0.5;
            center;
            return center;
        };
        displayengineImpl.Vector4.prototype.__class__ = displayengineImpl.Vector4;
        displayengineImpl.DisplayProvider = function() {
            this.displayFactory = new displayengineImpl.Factory();
            displayengineImpl.DisplayProvider.stages = new _hcmn_.haxe_ds_StringMap();
        };
        displayengineImpl.DisplayProvider = ck_implements(displayengineImpl.DisplayProvider, clientkernelModulesApi.IService);
        displayengineImpl.DisplayProvider = ck_implements(displayengineImpl.DisplayProvider, displayEngineApi.IDisplayProvider);
        displayengineImpl.DisplayProvider.__interfaces__ = [clientkernelModulesApi.IService, displayEngineApi.IDisplayProvider];
        displayengineImpl.DisplayProvider.__name__ = ["displayengineImpl", "DisplayProvider"];
        displayengineImpl.DisplayProvider.prototype.displayFactory = null;
        displayengineImpl.DisplayProvider.prototype.getFactory = function() {
            return this.displayFactory;
        };
        displayengineImpl.DisplayProvider.prototype.getStages = function() {
            return displayengineImpl.DisplayProvider.stages;
        };
        displayengineImpl.DisplayProvider.prototype.getDefaultStage = function() {
            return displayengineImpl.DisplayProvider.stages.get(displayEngineApi.DisplayConstants.DEFAULT_STAGE);
        };
        displayengineImpl.DisplayProvider.stages = null;
        displayengineImpl.DisplayProvider.prototype.__class__ = displayengineImpl.DisplayProvider;
        displayengineImpl.Factory = function() {};
        displayengineImpl.Factory = ck_implements(displayengineImpl.Factory, displayEngineApi.IFactory);
        displayengineImpl.Factory.__interfaces__ = [displayEngineApi.IFactory];
        displayengineImpl.Factory.__name__ = ["displayengineImpl", "Factory"];
        displayengineImpl.Factory.prototype.createStage = function(def) {
            if (displayengineImpl.DisplayProvider.stages.get(def.id) != null) return displayengineImpl.DisplayProvider.stages.get(def.id);
            else {
                if (def.id == null) def.id = displayEngineApi.DisplayConstants.DEFAULT_STAGE;
                return new displayengineImpl.Stage(def);
            }
        };
        displayengineImpl.Factory.prototype.createStage3D = function(id, width, height, options) {
            return new displayengineImpl.Stage3D(id, width, height);
        };
        displayengineImpl.Factory.prototype.createOffscreenStage = function(width, height, isWebGL, timingMode, targetFPS) {
            if (isWebGL == null) isWebGL = false;
            return new displayengineImpl.OffscreenStage(width, height, isWebGL, timingMode, targetFPS);
        };
        displayengineImpl.Factory.prototype.createCard3D = function(name, bmpBack, bmpFront, options, camera) {
            return displayengineImpl.MeshBuilder.CreateCard(name, bmpBack, bmpFront, options, camera);
        };
        displayengineImpl.Factory.prototype.createCamera = function(pos, tar) {
            return new displayengineImpl.Camera(pos, tar);
        };
        displayengineImpl.Factory.prototype.createDisplayObjectContainer = function() {
            return new displayengineImpl.DisplayObjectContainer();
        };
        displayengineImpl.Factory.prototype.createMovieClip = function(def) {
            return new displayengineImpl.MovieClip(def);
        };
        displayengineImpl.Factory.prototype.createGraphics = function(cacheCommands) {
            if (cacheCommands == null) cacheCommands = false;
            return new displayengineImpl.Graphics(cacheCommands);
        };
        displayengineImpl.Factory.prototype.createBitmap = function(image, offset) {
            return new displayengineImpl.Bitmap(image, offset);
        };
        displayengineImpl.Factory.prototype.createBitmapText = function(text, options) {
            return new displayengineImpl.BitmapText(text, options);
        };
        displayengineImpl.Factory.prototype.createSprite = function() {
            return new displayengineImpl.Sprite();
        };
        displayengineImpl.Factory.prototype.createParticleSystem = function(img, type, config) {
            return new displayengineImpl.ParticleSystem(img, type, config);
        };
        displayengineImpl.Factory.prototype.cache = function(objects) {
            return displayengineImpl.Cache.cache(objects);
        };
        displayengineImpl.Factory.prototype.uncache = function(objectID) {
            displayengineImpl.Cache.uncache(objectID);
        };
        displayengineImpl.Factory.prototype.createAnimation = function(name, object, animDef) {
            if (name == null) name = "";
            return new displayengineImpl.Animation(name, object, animDef);
        };
        displayengineImpl.Factory.prototype.__class__ = displayengineImpl.Factory;
        if (typeof haxe == 'undefined') {
            var haxe = {};
        };

        haxe.IMap = function() {}
        haxe.IMap.prototype = {

        };
        if (typeof js == 'undefined') {
            var js = {};
        };
        if (!js._Boot) {
            js._Boot = {};
        };
        js._Boot.HaxeError = function(val) {
            Error.call(this);
            this.val = val;
            this.message = String(val);
            if (Error.captureStackTrace) Error.captureStackTrace(this, js._Boot.HaxeError);
        };
        js._Boot.HaxeError.__name__ = ["js", "_Boot", "HaxeError"];
        js._Boot.HaxeError.__super__ = Error;
        for (var k in Error.prototype) js._Boot.HaxeError.prototype[k] = Error.prototype[k];
        js._Boot.HaxeError.prototype.val = null;
        js._Boot.HaxeError.prototype.__class__ = js._Boot.HaxeError;
        if (typeof PIXI == 'undefined') {
            var PIXI = {};
        };

        PIXI.CurrentState = function() {}
        PIXI.CurrentState.prototype = {

        };
        displayengineImpl.Animation.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.DisplayObject.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.PixiBitmap._imageBuffer = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.PixiBitmap._textures = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.PixiBitmap.totalSourceImageCount = [];;
        displayengineImpl.Bitmap.bmpCount = 0;;
        displayengine.impl.displaylist.Perlin.GRAD3 = [new displayengine.impl.displaylist.Gradient(1, 1, 0), new displayengine.impl.displaylist.Gradient(-1, 1, 0), new displayengine.impl.displaylist.Gradient(1, -1, 0), new displayengine.impl.displaylist.Gradient(-1, -1, 0), new displayengine.impl.displaylist.Gradient(1, 0, 1), new displayengine.impl.displaylist.Gradient(-1, 0, 1), new displayengine.impl.displaylist.Gradient(1, 0, -1), new displayengine.impl.displaylist.Gradient(-1, 0, -1), new displayengine.impl.displaylist.Gradient(0, 1, 1), new displayengine.impl.displaylist.Gradient(0, -1, 1), new displayengine.impl.displaylist.Gradient(0, 1, -1), new displayengine.impl.displaylist.Gradient(0, -1, -1)];;
        displayengine.impl.displaylist.Perlin.P = [151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180];;
        displayengineImpl.Cache.cachedObjects = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.DisplayObjectContainer.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.DisplayObjectContainer.docCount = 0;;
        displayengineImpl.Graphics.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.MCVideo.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.Sprite.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.PixiMovieClip.allBitmaps = new _hcmn_.haxe_ds_StringMap();;
        displayengineImpl.MovieClip.__meta__ = {
            obj: {
                globnative: null
            }
        };;
        displayengineImpl.MovieClip.mcCount = 0;;
        displayengineImpl.OffscreenStage.allOffscreenStages = [];;
        displayengineImpl.OffscreenStage.MASK_COMPOSITION_OPERATION = "source-atop";;
        displayengineImpl.Stage.tweenXSet = false;;
        displayengineImpl.Ticker.fpsMeter = "!function(t,n){'use strict';function e(t){return document.createElement(t)}function o(t,n){for(var e in n)try{t.style[e]=n[e]}catch(o){}return t}function a(t){return null==t?String(t):'object'==typeof t||'function'==typeof t?Object.prototype.toString.call(t).match(/\\s([a-z]+)/i)[1].toLowerCase()||'object':typeof t}function i(t,n){if('array'!==a(n))return-1;if(n.indexOf)return n.indexOf(t);for(var e=0,o=n.length;o>e;e++)if(n[e]===t)return e;return-1}function r(){var t=arguments;for(var n in t[1])if(t[1].hasOwnProperty(n))switch(a(t[1][n])){case'object':t[0][n]=r({},t[0][n],t[1][n]);break;case'array':t[0][n]=t[1][n].slice(0);break;default:t[0][n]=t[1][n]}return t.length>2?r.apply(null,[t[0]].concat(Array.prototype.slice.call(t,2))):t[0]}function h(t,n,e){var o,a,i,r,h,s,u,c,p;return r=.5>=e?e*(1+n):e+n-e*n,0===r?'#000':(h=2*e-r,s=(r-h)/r,t=6*t,u=Math.floor(t),c=t-u,p=r*s*c,0===u||6===u?(o=r,a=h+p,i=h):1===u?(o=r-p,a=r,i=h):2===u?(o=h,a=r,i=h+p):3===u?(o=h,a=r-p,i=r):4===u?(o=h+p,a=h,i=r):(o=r,a=h,i=r-p),'#'+l(o)+l(a)+l(i))}function l(t){return t=Math.round(255*t).toString(16),1===t.length?'0'+t:t}function s(t,n,e,o){t.addEventListener?t[o?'removeEventListener':'addEventListener'](n,e,!1):t.attachEvent&&t[o?'detachEvent':'attachEvent']('on'+n,e)}function u(t,l){function x(){for(j=D.history;j--;)K[j]=0===j?q.fps:K[j-1],Q[j]=0===j?q.duration:Q[j-1]}function b(t,n,e,o){return z[0|t][_hcmn_.Math.round(_hcmn_.Math.min((n-e)/(o-e)*B,B))]}function w(){L.legend.fps!==U&&(L.legend.fps=U,L.legend[g]=U?'FPS':'ms'),T=U?q.fps:q.duration,L.count[g]=T>999?'999+':T.toFixed(T>99?0:D.decimals)}function y(){if(A=c(),J<A-D.threshold&&(q.fps-=q.fps/Math.max(1,60*D.smoothing/D.interval),q.duration=1e3/q.fps),x(),w(),D.heat){if(N.length)for(j=N.length;j--;)N[j].el.style[M[N[j].name].heatOn]=U?b(M[N[j].name].heatmap,q.fps,0,D.maxFps):b(M[N[j].name].heatmap,q.duration,D.threshold,0);if(L.graph&&M.column.heatOn)for(j=R.length;j--;)R[j].style[M.column.heatOn]=U?b(M.column.heatmap,K[j],0,D.maxFps):b(M.column.heatmap,Q[j],D.threshold,0)}if(L.graph)for(I=0;I<D.history;I++)R[I].style.height=(U?K[I]?Math.round(H/D.maxFps*Math.min(K[I],D.maxFps)):0:Q[I]?Math.round(H/D.threshold*Math.min(Q[I],D.threshold)):0)+'px'}function v(){D.interval<20?(E=d(v),y()):(E=setTimeout(v,D.interval),P=d(y))}function k(t){t=t||window.event,t.preventDefault?(t.preventDefault(),t.stopPropagation()):(t.returnValue=!1,t.cancelBubble=!0),q.toggle()}function O(){D.toggleOn&&s(L.container,D.toggleOn,k,1),t.removeChild(L.container)}function S(){if(M=u.theme[D.theme],z=M.compiledHeatmaps||[],!z.length&&M.heatmaps.length){for(I=0;I<M.heatmaps.length;I++)for(z[I]=[],j=0;B>=j;j++)z[I][j]=h(.33/B*j,M.heatmaps[I].saturation,M.heatmaps[I].lightness);M.compiledHeatmaps=z}}function F(){L.container&&O(),S(),L.container=o(e('div'),M.container),L.count=L.container.appendChild(o(e('div'),M.count)),L.legend=L.container.appendChild(o(e('div'),M.legend)),L.graph=D.graph?L.container.appendChild(o(e('div'),M.graph)):0,N.length=0;for(var n in L)L[n]&&M[n].heatOn&&N.push({name:n,el:L[n]});if(R.length=0,L.graph)for(L.graph.style.width=D.history*M.column.width+(D.history-1)*M.column.spacing+'px',j=0;j<D.history;j++)R[j]=L.graph.appendChild(o(e('div'),M.column)),R[j].style.position='absolute',R[j].style.bottom=0,R[j].style.right=j*M.column.width+j*M.column.spacing+'px',R[j].style.width=M.column.width+'px',R[j].style.height='0px';C(),w(),t.appendChild(L.container),L.graph&&(H=L.graph.clientHeight),D.toggleOn&&('click'===D.toggleOn&&(L.container.style.cursor='pointer'),s(L.container,D.toggleOn,k))}function C(){o(L.container,D)}'object'===a(t)&&t.nodeType===n&&(l=t,t=document.body),t||(t=document.body);var M,z,A,E,P,H,T,j,I,q=this,D=r({},u.defaults,l||{}),L={},R=[],B=100,N=[],V=0,W=D.threshold,G=0,J=c()-W,K=[],Q=[],U='fps'===D.show;q.options=D,q.fps=0,q.duration=0,q.isPaused=0,q.tickStart=function(){G=c()},q.tick=function(){A=c(),V=A-J,W+=(V-W)/D.smoothing,q.fps=1e3/W,q.duration=J>G?W:A-G,J=A},q.pause=function(){return E&&(q.isPaused=1,clearTimeout(E),p(E),p(P),E=P=0),q},q.resume=function(){return E||(q.isPaused=0,v()),q},q.set=function(t,n){return D[t]=n,U='fps'===D.show,-1!==i(t,f)&&F(),-1!==i(t,m)&&C(),q},q.showDuration=function(){return q.set('show','ms'),q},q.showFps=function(){return q.set('show','fps'),q},q.toggle=function(){return q.set('show',U?'ms':'fps'),q},q.hide=function(){return q.pause(),L.container.style.display='none',q},q.show=function(){return q.resume(),L.container.style.display='block',q},q.destroy=function(){q.pause(),O(),q.tick=q.tickStart=function(){}},function(){F(),v()}()}var c;!function(){var n=t.performance;if(n&&(n.now||n.webkitNow)){var e=n.now?'now':'webkitNow';c=n[e].bind(n)}else c=function(){return+new _hcmn_.Date}}();var p=t.cancelAnimationFrame||t.cancelRequestAnimationFrame,d=t.requestAnimationFrame;!function(){for(var n=['moz','webkit','o'],e=0,o=0,a=n.length;a>o&&!p;++o)p=t[n[o]+'CancelAnimationFrame']||t[n[o]+'CancelRequestAnimationFrame'],d=p&&t[n[o]+'RequestAnimationFrame'];p||(d=function(n){var o=c(),a=Math.max(0,16-(o-e));return e=o+a,t.setTimeout(function(){n(o+a)},a)},p=function(t){clearTimeout(t)})}();var g='string'===a(document.createElement('div').textContent)?'textContent':'innerText';u.extend=r,window.FPSMeter=u,u.defaults={interval:100,smoothing:10,show:'fps',toggleOn:'click',decimals:1,maxFps:60,threshold:100,position:'absolute',zIndex:10,left:'5px',top:'5px',right:'auto',bottom:'auto',margin:'0 0 0 0',theme:'dark',heat:0,graph:0,history:20};var f=['toggleOn','theme','heat','graph','history'],m=['position','zIndex','left','top','right','bottom','margin']}(window),function(t,n,e){'use strict';n.theme={};var o=n.theme.base={heatmaps:[],container:{heatOn:null,heatmap:null,padding:'5px',minWidth:'95px',height:'30px',lineHeight:'30px',textAlign:'right',textShadow:'none'},count:{heatOn:null,heatmap:null,position:'absolute',top:0,right:0,padding:'5px 10px',height:'30px',fontSize:'24px',fontFamily:'Consolas, Andale Mono, monospace',zIndex:2},legend:{heatOn:null,heatmap:null,position:'absolute',top:0,left:0,padding:'5px 10px',height:'30px',fontSize:'12px',lineHeight:'32px',fontFamily:'sans-serif',textAlign:'left',zIndex:2},graph:{heatOn:null,heatmap:null,position:'relative',boxSizing:'padding-box',MozBoxSizing:'padding-box',height:'100%',zIndex:1},column:{width:4,spacing:1,heatOn:null,heatmap:null}};n.theme.dark=n.extend({},o,{heatmaps:[{saturation:.8,lightness:.8}],container:{background:'#222',color:'#fff',border:'1px solid #1a1a1a',textShadow:'1px 1px 0 #222'},count:{heatOn:'color'},column:{background:'#3f3f3f'}}),n.theme.light=n.extend({},o,{heatmaps:[{saturation:.5,lightness:.5}],container:{color:'#666',background:'#fff',textShadow:'1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)',boxShadow:'0 0 0 1px rgba(0,0,0,.1)'},count:{heatOn:'color'},column:{background:'#eaeaea'}}),n.theme.colorful=n.extend({},o,{heatmaps:[{saturation:.5,lightness:.6}],container:{heatOn:'backgroundColor',background:'#888',color:'#fff',textShadow:'1px 1px 0 rgba(0,0,0,.2)',boxShadow:'0 0 0 1px rgba(0,0,0,.1)'},column:{background:'#777',backgroundColor:'rgba(0,0,0,.2)'}}),n.theme.transparent=n.extend({},o,{heatmaps:[{saturation:.8,lightness:.5}],container:{padding:0,color:'#fff',textShadow:'1px 1px 0 rgba(0,0,0,.5)'},count:{padding:'0 5px',height:'40px',lineHeight:'40px'},legend:{padding:'0 5px',height:'40px',lineHeight:'42px'},graph:{height:'40px'},column:{width:5,background:'#999',heatOn:'backgroundColor',opacity:.5}})}(window,FPSMeter);";;
        displayengineImpl.Ticker._globalID = 0;;
        displayengineImpl.Vector3._UP = new displayengineImpl.Vector3(0, 1.0, 0);;
        displayengineImpl.Card.point2d = new displayengineImpl.Vector3();;
        displayengineImpl.Renderer.projectionMatrix = new displayengineImpl.Matrix();;
        displayengineImpl.Renderer.point2d = new displayengineImpl.Vector3();;
        displayengineImpl.Renderer.lightDirection = new displayengineImpl.Vector3();;
        displayengineImpl.Renderer.drawPointVector = new displayengineImpl.Vector3();;
        displayengineImpl.Renderer.drawPointColor = new displayengineImpl.Color4();;
        displayengineImpl.Renderer.textureColor = new displayengineImpl.Color4(1, 1, 1, 1);;
        displayengineImpl.Renderer.viewMatrix = new displayengineImpl.Matrix();;
        displayengineImpl.Renderer.worldMatrix = new displayengineImpl.Matrix();;
        displayengineImpl.Renderer.transformMatrix = new displayengineImpl.Matrix();;
        displayengineImpl.Renderer.dtColor = new displayengineImpl.Color4(1.4, 1.4, 1.4, 1);;
        displayengineImpl.Vector4.Epsilon = 0.01;;
        return {
            exports: displayengineImpl,
            activator: displayengineImpl.Activator
        };
    });
//# sourceURL=displayEngine.js