<i id='HRirR'><tr id='HRirR'><dt id='HRirR'><q id='HRirR'><span id='HRirR'><b id='HRirR'><form id='HRirR'><ins id='HRirR'></ins><ul id='HRirR'></ul><sub id='HRirR'></sub></form><legend id='HRirR'></legend><bdo id='HRirR'><pre id='HRirR'><center id='HRirR'></center></pre></bdo></b><th id='HRirR'></th></span></q></dt></tr></i><div id='HRirR'><tfoot id='HRirR'></tfoot><dl id='HRirR'><fieldset id='HRirR'></fieldset></dl></div>
    • <bdo id='HRirR'></bdo><ul id='HRirR'></ul>

  • <tfoot id='HRirR'></tfoot>

      <small id='HRirR'></small><noframes id='HRirR'>

      1. <legend id='HRirR'><style id='HRirR'><dir id='HRirR'><q id='HRirR'></q></dir></style></legend>

        如何销毁 THREEJS 场景?

        时间:2023-10-12
          <tbody id='Ex8J5'></tbody>

        <tfoot id='Ex8J5'></tfoot>

          1. <legend id='Ex8J5'><style id='Ex8J5'><dir id='Ex8J5'><q id='Ex8J5'></q></dir></style></legend>

              • <small id='Ex8J5'></small><noframes id='Ex8J5'>

                  <bdo id='Ex8J5'></bdo><ul id='Ex8J5'></ul>
                  <i id='Ex8J5'><tr id='Ex8J5'><dt id='Ex8J5'><q id='Ex8J5'><span id='Ex8J5'><b id='Ex8J5'><form id='Ex8J5'><ins id='Ex8J5'></ins><ul id='Ex8J5'></ul><sub id='Ex8J5'></sub></form><legend id='Ex8J5'></legend><bdo id='Ex8J5'><pre id='Ex8J5'><center id='Ex8J5'></center></pre></bdo></b><th id='Ex8J5'></th></span></q></dt></tr></i><div id='Ex8J5'><tfoot id='Ex8J5'></tfoot><dl id='Ex8J5'><fieldset id='Ex8J5'></fieldset></dl></div>
                  本文介绍了如何销毁 THREEJS 场景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我创建了一个 Threejs 场景,添加了相机、灯光和各种对象.

                  I created a Threejs Scene, adding camera, lights and various objects.

                  问题很简单:如何破坏场景?从场景中移除所有组件?

                  The question is simple: how can I destroy scene? Removing from scene all components?

                  我需要销毁场景,因为我确实想将任务委托给垃圾收集器.

                  I need to destroy scene because and I do not want to delegate the task to the garbage collector.

                  推荐答案

                  我用这个:

                      cancelAnimationFrame(this.id);// Stop the animation
                      this.renderer.domElement.addEventListener('dblclick', null, false); //remove listener to render
                      this.scene = null;
                      this.projector = null;
                      this.camera = null;
                      this.controls = null;
                      empty(this.modelContainer);
                  

                  方法empty是jQuery empty的替代品,可以使用:

                  The method empty is a substitute to jQuery empty, you can use it:

                  function empty(elem) {
                      while (elem.lastChild) elem.removeChild(elem.lastChild);
                  }
                  

                  这篇关于如何销毁 THREEJS 场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Javascript强制GC收集?/强制释放对象? 下一篇:主线程忙时可以进行垃圾收集吗?

                  相关文章

                  最新文章

                  <i id='FJtTN'><tr id='FJtTN'><dt id='FJtTN'><q id='FJtTN'><span id='FJtTN'><b id='FJtTN'><form id='FJtTN'><ins id='FJtTN'></ins><ul id='FJtTN'></ul><sub id='FJtTN'></sub></form><legend id='FJtTN'></legend><bdo id='FJtTN'><pre id='FJtTN'><center id='FJtTN'></center></pre></bdo></b><th id='FJtTN'></th></span></q></dt></tr></i><div id='FJtTN'><tfoot id='FJtTN'></tfoot><dl id='FJtTN'><fieldset id='FJtTN'></fieldset></dl></div>
                  <tfoot id='FJtTN'></tfoot>

                    <small id='FJtTN'></small><noframes id='FJtTN'>

                  1. <legend id='FJtTN'><style id='FJtTN'><dir id='FJtTN'><q id='FJtTN'></q></dir></style></legend>
                        <bdo id='FJtTN'></bdo><ul id='FJtTN'></ul>