示例#1
0
        /// <summary>
        /// </summary>
        public virtual void _checkDelayState()
        {
            var that  = this;
            var scene = this.getScene();

            if (this._geometry != null)
            {
                this._geometry.load(scene);
            }
            else if (that.delayLoadState == Engine.DELAYLOADSTATE_NOTLOADED)
            {
                that.delayLoadState = Engine.DELAYLOADSTATE_LOADING;
                scene._addPendingData(that);
                Tools.LoadFile(
                    this.delayLoadingFile,
                    (data) =>
                {
                    // TODO: finish it
                    this._delayLoadingFunction(JsmnParser.Parse(data), this);
                    this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
                    scene._removePendingData(this);
                },
                    (max, pos) => { },
                    scene.database);
            }
        }
示例#2
0
        /// <summary>
        /// </summary>
        /// <param name="scene">
        /// </param>
        /// <param name="onLoaded">
        /// </param>
        public virtual void load(Scene scene, System.Action onLoaded = null)
        {
            if (this.delayLoadState == Engine.DELAYLOADSTATE_LOADING)
            {
                return;
            }

            if (this.isReady())
            {
                if (onLoaded != null)
                {
                    onLoaded();
                }

                return;
            }

            this.delayLoadState = Engine.DELAYLOADSTATE_LOADING;
            scene._addPendingData(this);
            Tools.LoadFile(
                this.delayLoadingFile,
                (string data) =>
            {
                this._delayLoadingFunction(JsmnParser.Parse(data), this);
                this.delayLoadState = Engine.DELAYLOADSTATE_LOADED;
                this._delayInfo     = new Array <VertexBufferKind>();
                scene._removePendingData(this);
                var meshes      = this._meshes;
                var numOfMeshes = meshes.Length;
                for (var index = 0; index < numOfMeshes; index++)
                {
                    this._applyToMesh(meshes[index]);
                }

                if (onLoaded != null)
                {
                    onLoaded();
                }
            },
                (max, pos) => { },
                scene.database);
        }