Sha256: e9329798811382db9848f3a2e63ba1b6c39e63330a20cc33be7c847c20dcef42

Contents?: true

Size: 1.9 KB

Versions: 4

Compression:

Stored size: 1.9 KB

Contents

(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports", "three"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports, require("three"));
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports, global.three);
    global.SceneUtils = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.attach = attach;
  _exports.createMeshesFromInstancedMesh = createMeshesFromInstancedMesh;
  _exports.createMultiMaterialObject = createMultiMaterialObject;
  _exports.detach = detach;

  function createMeshesFromInstancedMesh(instancedMesh) {
    var group = new _three.Group();
    var count = instancedMesh.count;
    var geometry = instancedMesh.geometry;
    var material = instancedMesh.material;

    for (var i = 0; i < count; i++) {
      var mesh = new _three.Mesh(geometry, material);
      instancedMesh.getMatrixAt(i, mesh.matrix);
      mesh.matrix.decompose(mesh.position, mesh.quaternion, mesh.scale);
      group.add(mesh);
    }

    group.copy(instancedMesh);
    group.updateMatrixWorld(); // ensure correct world matrices of meshes

    return group;
  }

  function createMultiMaterialObject(geometry, materials) {
    var group = new _three.Group();

    for (var i = 0, l = materials.length; i < l; i++) {
      group.add(new _three.Mesh(geometry, materials[i]));
    }

    return group;
  }

  function detach(child, parent, scene) {
    console.warn('THREE.SceneUtils: detach() has been deprecated. Use scene.attach( child ) instead.');
    scene.attach(child);
  }

  function attach(child, scene, parent) {
    console.warn('THREE.SceneUtils: attach() has been deprecated. Use parent.attach( child ) instead.');
    parent.attach(child);
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opal-js_wrap-three-0.1.5 lib-opal/js_wrap/three/utils/SceneUtils.js
opal-js_wrap-three-0.1.4 lib-opal/js_wrap/three/utils/SceneUtils.js
opal-js_wrap-three-0.1.3 lib-opal/js_wrap/three/utils/SceneUtils.js
opal-js_wrap-three-0.1.2 lib-opal/js_wrap/three/utils/SceneUtils.js