kitchen-simulator 1.1.1-test.49 → 1.1.1-test.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/@history.js +2 -0
- package/es/AppContext.js +3 -0
- package/es/KitchenConfigurator.js +645 -0
- package/es/KitchenConfiguratorApp.js +480 -0
- package/es/actions/area-actions.js +14 -0
- package/es/actions/export.js +23 -0
- package/es/actions/groups-actions.js +89 -0
- package/es/actions/holes-actions.js +119 -0
- package/es/actions/items-actions.js +313 -0
- package/es/actions/lines-actions.js +81 -0
- package/es/actions/project-actions.js +281 -0
- package/es/actions/scene-actions.js +33 -0
- package/es/actions/vertices-actions.js +27 -0
- package/es/actions/viewer2d-actions.js +58 -0
- package/es/actions/viewer3d-actions.js +23 -0
- package/es/catalog/areas/area/planner-element.js +40 -0
- package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
- package/es/catalog/areas/area/textures/grass.jpg +0 -0
- package/es/catalog/areas/area/textures/parquet.jpg +0 -0
- package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
- package/es/catalog/areas/area/textures/tile1.jpg +0 -0
- package/es/catalog/catalog.js +277 -0
- package/es/catalog/envMap/nx.hdr +0 -0
- package/es/catalog/envMap/ny.hdr +0 -0
- package/es/catalog/envMap/nz.hdr +0 -0
- package/es/catalog/envMap/px.hdr +0 -0
- package/es/catalog/envMap/py.hdr +0 -0
- package/es/catalog/envMap/pz.hdr +0 -0
- package/es/catalog/factories/area-factory-3d.js +181 -0
- package/es/catalog/factories/area-factory.js +81 -0
- package/es/catalog/factories/export.js +7 -0
- package/es/catalog/factories/wall-factory-3d.js +202 -0
- package/es/catalog/factories/wall-factory.js +268 -0
- package/es/catalog/holes/door-closet/planner-element.js +222 -0
- package/es/catalog/holes/door-double/door_double.png +0 -0
- package/es/catalog/holes/door-double/planner-element.js +315 -0
- package/es/catalog/holes/door-exterior/planner-element.js +215 -0
- package/es/catalog/holes/door-interior/planner-element.js +227 -0
- package/es/catalog/holes/door-panic/panicDoor.png +0 -0
- package/es/catalog/holes/door-panic/planner-element.js +503 -0
- package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
- package/es/catalog/holes/door-panic-double/planner-element.js +463 -0
- package/es/catalog/holes/door-sliding/planner-element.js +225 -0
- package/es/catalog/holes/doorway-framed/planner-element.js +145 -0
- package/es/catalog/holes/doorway-frameless/planner-element.js +104 -0
- package/es/catalog/holes/export.js +13 -0
- package/es/catalog/holes/gate/gate.jpg +0 -0
- package/es/catalog/holes/window-clear/planner-element.js +166 -0
- package/es/catalog/holes/window-clear/texture.png +0 -0
- package/es/catalog/holes/window-cross/planner-element.js +165 -0
- package/es/catalog/holes/window-cross/texture.png +0 -0
- package/es/catalog/holes/window-double-hung/planner-element.js +303 -0
- package/es/catalog/holes/window-double-hung/texture.png +0 -0
- package/es/catalog/holes/window-vertical/planner-element.js +276 -0
- package/es/catalog/holes/window-vertical/texture.png +0 -0
- package/es/catalog/lines/wall/planner-element.js +70 -0
- package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/morden.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/painted.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
- package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
- package/es/catalog/lines/wall/wall.png +0 -0
- package/es/catalog/molding/molding-dcm/planner-element.js +28 -0
- package/es/catalog/molding/molding-dcm/texture.png +0 -0
- package/es/catalog/molding/molding-fbm/planner-element.js +28 -0
- package/es/catalog/molding/molding-fbm/texture.png +0 -0
- package/es/catalog/molding/molding-lrm/planner-element.js +28 -0
- package/es/catalog/molding/molding-lrm/texture.png +0 -0
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +116 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +97 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +101 -0
- package/es/catalog/properties/property-length-measure.js +134 -0
- package/es/catalog/properties/property-length-measure_hole.js +101 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/FuseUtils.js +82 -0
- package/es/catalog/utils/exporter.js +148 -0
- package/es/catalog/utils/geom-utils.js +189 -0
- package/es/catalog/utils/item-loader.js +1521 -0
- package/es/catalog/utils/load-obj.js +91 -0
- package/es/catalog/utils/mtl-loader.js +358 -0
- package/es/catalog/utils/obj-loader.js +477 -0
- package/es/class/FuseUtils.js +82 -0
- package/es/class/area.js +145 -0
- package/es/class/export.js +24 -0
- package/es/class/group.js +440 -0
- package/es/class/guide.js +62 -0
- package/es/class/hole.js +929 -0
- package/es/class/item.js +1883 -0
- package/es/class/layer.js +667 -0
- package/es/class/line.js +1180 -0
- package/es/class/project.js +793 -0
- package/es/class/vertex.js +202 -0
- package/es/components/content.js +107 -0
- package/es/components/disclaimer/disclaimer.js +97 -0
- package/es/components/export.js +9 -0
- package/es/components/style/button.js +113 -0
- package/es/components/style/cancel-button.js +22 -0
- package/es/components/style/content-container.js +33 -0
- package/es/components/style/content-title.js +29 -0
- package/es/components/style/delete-button.js +25 -0
- package/es/components/style/export.js +31 -0
- package/es/components/style/form-block.js +24 -0
- package/es/components/style/form-color-input.js +27 -0
- package/es/components/style/form-label.js +26 -0
- package/es/components/style/form-number-input.js +213 -0
- package/es/components/style/form-number-input_2.js +206 -0
- package/es/components/style/form-select.js +68 -0
- package/es/components/style/form-slider.js +61 -0
- package/es/components/style/form-submit-button.js +26 -0
- package/es/components/style/form-text-input.js +95 -0
- package/es/components/viewer2d/area.js +81 -0
- package/es/components/viewer2d/export.js +31 -0
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +37 -0
- package/es/components/viewer2d/grids/grid-streak.js +37 -0
- package/es/components/viewer2d/grids/grid-vertical-streak.js +37 -0
- package/es/components/viewer2d/grids/grids.js +35 -0
- package/es/components/viewer2d/group.js +53 -0
- package/es/components/viewer2d/item.js +513 -0
- package/es/components/viewer2d/layer.js +164 -0
- package/es/components/viewer2d/line.js +882 -0
- package/es/components/viewer2d/ruler.js +100 -0
- package/es/components/viewer2d/rulerDist.js +146 -0
- package/es/components/viewer2d/rulerX.js +151 -0
- package/es/components/viewer2d/rulerY.js +153 -0
- package/es/components/viewer2d/scene.js +140 -0
- package/es/components/viewer2d/snap.js +74 -0
- package/es/components/viewer2d/state.js +78 -0
- package/es/components/viewer2d/utils.js +198 -0
- package/es/components/viewer2d/vertex.js +65 -0
- package/es/components/viewer2d/viewer2d.js +1398 -0
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +2592 -0
- package/es/components/viewer3d/dcm.js +401 -0
- package/es/components/viewer3d/fbm.js +414 -0
- package/es/components/viewer3d/front3D.js +66 -0
- package/es/components/viewer3d/grid-creator.js +25 -0
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +36 -0
- package/es/components/viewer3d/grids/grid-streak.js +27 -0
- package/es/components/viewer3d/grids/grid-vertical-streak.js +36 -0
- package/es/components/viewer3d/libs/first-person-controls.js +67 -0
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1281 -0
- package/es/components/viewer3d/libs/mtl-loader.js +357 -0
- package/es/components/viewer3d/libs/obj-loader.js +462 -0
- package/es/components/viewer3d/libs/orbit-controls.js +699 -0
- package/es/components/viewer3d/libs/pointer-lock-controls.js +46 -0
- package/es/components/viewer3d/lrm.js +305 -0
- package/es/components/viewer3d/model.js +708 -0
- package/es/components/viewer3d/pointer-lock-navigation.js +115 -0
- package/es/components/viewer3d/ruler-utils/itemRect.js +61 -0
- package/es/components/viewer3d/ruler-utils/layer3D.js +495 -0
- package/es/components/viewer3d/ruler-utils/ruler3D.js +227 -0
- package/es/components/viewer3d/ruler-utils/scene3D.js +60 -0
- package/es/components/viewer3d/ruler-utils/state3D.js +18 -0
- package/es/components/viewer3d/scene-creator.js +3608 -0
- package/es/components/viewer3d/three-memory-cleaner.js +51 -0
- package/es/components/viewer3d/viewer3d-first-person.js +315 -0
- package/es/components/viewer3d/viewer3d.js +2527 -0
- package/es/constants.js +636 -0
- package/es/index.js +16 -0
- package/es/models.js +510 -0
- package/es/plugins/SVGLoader.js +1412 -0
- package/es/plugins/autosave.js +33 -0
- package/es/plugins/console-debugger.js +37 -0
- package/es/plugins/export.js +9 -0
- package/es/plugins/keyboard.js +101 -0
- package/es/reducers/areas-reducer.js +12 -0
- package/es/reducers/export.js +25 -0
- package/es/reducers/groups-reducer.js +38 -0
- package/es/reducers/holes-reducer.js +62 -0
- package/es/reducers/items-reducer.js +140 -0
- package/es/reducers/lines-reducer.js +45 -0
- package/es/reducers/project-reducer.js +129 -0
- package/es/reducers/reducer.js +19 -0
- package/es/reducers/scene-reducer.js +28 -0
- package/es/reducers/user-reducer.js +40 -0
- package/es/reducers/vertices-reducer.js +19 -0
- package/es/reducers/viewer2d-reducer.js +75 -0
- package/es/reducers/viewer3d-reducer.js +56 -0
- package/es/shared-style.js +66 -0
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/translator/en.js +104 -0
- package/es/translator/it.js +79 -0
- package/es/translator/ru.js +79 -0
- package/es/translator/translator.js +84 -0
- package/es/utils/browser.js +33 -0
- package/es/utils/email-validator.js +4 -0
- package/es/utils/export.js +25 -0
- package/es/utils/geometry.js +2420 -0
- package/es/utils/get-edges-of-subgraphs.js +27 -0
- package/es/utils/graph-cycles.js +237 -0
- package/es/utils/graph-inner-cycles.js +46 -0
- package/es/utils/graph.js +150 -0
- package/es/utils/helper.js +268 -0
- package/es/utils/history.js +29 -0
- package/es/utils/id-broker.js +19 -0
- package/es/utils/logger.js +8 -0
- package/es/utils/math.js +50 -0
- package/es/utils/molding.js +871 -0
- package/es/utils/name-generator.js +18 -0
- package/es/utils/objects-utils.js +50 -0
- package/es/utils/phone-validator.js +4 -0
- package/es/utils/process-black-list.js +18 -0
- package/es/utils/react-if.js +18 -0
- package/es/utils/snap-scene.js +99 -0
- package/es/utils/snap.js +237 -0
- package/es/utils/summarizeCart.js +24 -0
- package/es/utils/threeCSG.es6.js +498 -0
- package/es/version.js +2 -0
- package/lib/catalog/properties/property-string.js +55 -0
- package/lib/catalog/properties/property-toggle.js +46 -0
- package/lib/catalog/properties/shared-property-style.js +20 -0
- package/lib/catalog/utils/FuseUtils.js +88 -0
- package/lib/catalog/utils/exporter.js +155 -0
- package/lib/catalog/utils/geom-utils.js +205 -0
- package/lib/catalog/utils/item-loader.js +1533 -0
- package/lib/catalog/utils/load-obj.js +99 -0
- package/lib/catalog/utils/mtl-loader.js +363 -0
- package/lib/catalog/utils/obj-loader.js +482 -0
- package/lib/class/FuseUtils.js +88 -0
- package/lib/class/area.js +150 -0
- package/lib/class/export.js +96 -0
- package/lib/class/group.js +445 -0
- package/lib/class/guide.js +67 -0
- package/lib/class/hole.js +934 -0
- package/lib/class/item.js +1889 -0
- package/lib/class/layer.js +672 -0
- package/lib/class/line.js +1186 -0
- package/lib/class/project.js +799 -0
- package/lib/class/vertex.js +207 -0
- package/lib/components/content.js +116 -0
- package/lib/components/disclaimer/disclaimer.js +105 -0
- package/lib/components/export.js +33 -0
- package/lib/components/style/button.js +120 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +40 -0
- package/lib/components/style/content-title.js +37 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +121 -0
- package/lib/components/style/form-block.js +31 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +33 -0
- package/lib/components/style/form-number-input.js +220 -0
- package/lib/components/style/form-number-input_2.js +213 -0
- package/lib/components/style/form-select.js +75 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +101 -0
- package/lib/components/viewer2d/area.js +88 -0
- package/lib/components/viewer2d/export.js +121 -0
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +44 -0
- package/lib/components/viewer2d/grids/grid-streak.js +44 -0
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +44 -0
- package/lib/components/viewer2d/grids/grids.js +44 -0
- package/lib/components/viewer2d/group.js +62 -0
- package/lib/components/viewer2d/item.js +521 -0
- package/lib/components/viewer2d/layer.js +171 -0
- package/lib/components/viewer2d/line.js +892 -0
- package/lib/components/viewer2d/ruler.js +107 -0
- package/lib/components/viewer2d/rulerDist.js +153 -0
- package/lib/components/viewer2d/rulerX.js +158 -0
- package/lib/components/viewer2d/rulerY.js +160 -0
- package/lib/components/viewer2d/scene.js +147 -0
- package/lib/components/viewer2d/snap.js +83 -0
- package/lib/components/viewer2d/state.js +87 -0
- package/lib/components/viewer2d/utils.js +210 -0
- package/lib/components/viewer2d/vertex.js +74 -0
- package/lib/components/viewer2d/viewer2d.js +1405 -0
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +2597 -0
- package/lib/components/viewer3d/dcm.js +407 -0
- package/lib/components/viewer3d/fbm.js +420 -0
- package/lib/components/viewer3d/front3D.js +75 -0
- package/lib/components/viewer3d/grid-creator.js +34 -0
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +44 -0
- package/lib/components/viewer3d/grids/grid-streak.js +35 -0
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +44 -0
- package/lib/components/viewer3d/libs/first-person-controls.js +74 -0
- package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +1287 -0
- package/lib/components/viewer3d/libs/mtl-loader.js +363 -0
- package/lib/components/viewer3d/libs/obj-loader.js +468 -0
- package/lib/components/viewer3d/libs/orbit-controls.js +705 -0
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +52 -0
- package/lib/components/viewer3d/lrm.js +311 -0
- package/lib/components/viewer3d/model.js +714 -0
- package/lib/components/viewer3d/pointer-lock-navigation.js +122 -0
- package/lib/components/viewer3d/ruler-utils/itemRect.js +68 -0
- package/lib/components/viewer3d/ruler-utils/layer3D.js +502 -0
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +234 -0
- package/lib/components/viewer3d/ruler-utils/scene3D.js +68 -0
- package/lib/components/viewer3d/ruler-utils/state3D.js +25 -0
- package/lib/components/viewer3d/scene-creator.js +3642 -0
- package/lib/components/viewer3d/three-memory-cleaner.js +60 -0
- package/lib/components/viewer3d/viewer3d-first-person.js +320 -0
- package/lib/components/viewer3d/viewer3d.js +2532 -0
- package/lib/constants.js +645 -0
- package/lib/index.js +96 -0
- package/lib/models.js +517 -0
- package/lib/plugins/SVGLoader.js +1417 -0
- package/lib/plugins/autosave.js +39 -0
- package/lib/plugins/console-debugger.js +44 -0
- package/lib/plugins/export.js +33 -0
- package/lib/plugins/keyboard.js +107 -0
- package/lib/reducers/areas-reducer.js +18 -0
- package/lib/reducers/export.js +97 -0
- package/lib/reducers/groups-reducer.js +44 -0
- package/lib/reducers/holes-reducer.js +68 -0
- package/lib/reducers/items-reducer.js +146 -0
- package/lib/reducers/lines-reducer.js +51 -0
- package/lib/reducers/project-reducer.js +135 -0
- package/lib/reducers/reducer.js +26 -0
- package/lib/reducers/scene-reducer.js +34 -0
- package/lib/reducers/user-reducer.js +46 -0
- package/lib/reducers/vertices-reducer.js +25 -0
- package/lib/reducers/viewer2d-reducer.js +82 -0
- package/lib/reducers/viewer3d-reducer.js +63 -0
- package/lib/shared-style.js +72 -0
- package/lib/styles/export.js +13 -0
- package/lib/translator/en.js +110 -0
- package/lib/translator/it.js +85 -0
- package/lib/translator/ru.js +85 -0
- package/lib/translator/translator.js +90 -0
- package/lib/utils/browser.js +40 -0
- package/lib/utils/email-validator.js +10 -0
- package/lib/utils/export.js +56 -0
- package/lib/utils/geometry.js +2516 -0
- package/lib/utils/get-edges-of-subgraphs.js +34 -0
- package/lib/utils/graph-cycles.js +240 -0
- package/lib/utils/graph-inner-cycles.js +54 -0
- package/lib/utils/graph.js +157 -0
- package/lib/utils/helper.js +291 -0
- package/lib/utils/history.js +36 -0
- package/lib/utils/id-broker.js +25 -0
- package/lib/utils/logger.js +14 -0
- package/lib/utils/math.js +57 -0
- package/lib/utils/molding.js +895 -0
- package/lib/utils/name-generator.js +23 -0
- package/lib/utils/objects-utils.js +60 -0
- package/lib/utils/phone-validator.js +10 -0
- package/lib/utils/process-black-list.js +24 -0
- package/lib/utils/react-if.js +24 -0
- package/lib/utils/snap-scene.js +105 -0
- package/lib/utils/snap.js +249 -0
- package/lib/utils/summarizeCart.js +30 -0
- package/lib/utils/threeCSG.es6.js +503 -0
- package/lib/version.js +8 -0
- package/package.json +3 -3
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @author mrdoob / http://mrdoob.com/
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var THREE = window.THREE;
|
|
12
|
+
var OBJLoader;
|
|
13
|
+
OBJLoader = function OBJLoader(manager) {
|
|
14
|
+
this.manager = manager !== undefined ? manager : THREE.DefaultLoadingManager;
|
|
15
|
+
this.materials = null;
|
|
16
|
+
this.regexp = {
|
|
17
|
+
// v float float float
|
|
18
|
+
vertex_pattern: /^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,
|
|
19
|
+
// vn float float float
|
|
20
|
+
normal_pattern: /^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,
|
|
21
|
+
// vt float float
|
|
22
|
+
uv_pattern: /^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,
|
|
23
|
+
// f vertex vertex vertex
|
|
24
|
+
face_vertex: /^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,
|
|
25
|
+
// f vertex/uv vertex/uv vertex/uv
|
|
26
|
+
face_vertex_uv: /^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,
|
|
27
|
+
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal
|
|
28
|
+
face_vertex_uv_normal: /^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,
|
|
29
|
+
// f vertex//normal vertex//normal vertex//normal
|
|
30
|
+
face_vertex_normal: /^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,
|
|
31
|
+
// o object_name | g group_name
|
|
32
|
+
object_pattern: /^[og]\s*(.+)?/,
|
|
33
|
+
// s boolean
|
|
34
|
+
smoothing_pattern: /^s\s+(\d+|on|off)/,
|
|
35
|
+
// mtllib file_reference
|
|
36
|
+
material_library_pattern: /^mtllib /,
|
|
37
|
+
// usemtl material_name
|
|
38
|
+
material_use_pattern: /^usemtl /
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
OBJLoader.prototype = {
|
|
42
|
+
constructor: OBJLoader,
|
|
43
|
+
load: function load(url, onLoad, onProgress, onError) {
|
|
44
|
+
var scope = this;
|
|
45
|
+
var loader = new THREE.XHRLoader(scope.manager);
|
|
46
|
+
loader.setPath(this.path);
|
|
47
|
+
loader.load(url, function (text) {
|
|
48
|
+
onLoad(scope.parse(text));
|
|
49
|
+
}, onProgress, onError);
|
|
50
|
+
},
|
|
51
|
+
setPath: function setPath(value) {
|
|
52
|
+
this.path = value;
|
|
53
|
+
},
|
|
54
|
+
setMaterials: function setMaterials(materials) {
|
|
55
|
+
this.materials = materials;
|
|
56
|
+
},
|
|
57
|
+
_createParserState: function _createParserState() {
|
|
58
|
+
var state = {
|
|
59
|
+
objects: [],
|
|
60
|
+
object: {},
|
|
61
|
+
vertices: [],
|
|
62
|
+
normals: [],
|
|
63
|
+
uvs: [],
|
|
64
|
+
materialLibraries: [],
|
|
65
|
+
startObject: function startObject(name, fromDeclaration) {
|
|
66
|
+
// If the current object (initial from reset) is not from a g/o declaration in the parsed
|
|
67
|
+
// file. We need to use it for the first parsed g/o to keep things in sync.
|
|
68
|
+
if (this.object && this.object.fromDeclaration === false) {
|
|
69
|
+
this.object.name = name;
|
|
70
|
+
this.object.fromDeclaration = fromDeclaration !== false;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (this.object && typeof this.object._finalize === 'function') {
|
|
74
|
+
this.object._finalize();
|
|
75
|
+
}
|
|
76
|
+
var previousMaterial = this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined;
|
|
77
|
+
this.object = {
|
|
78
|
+
name: name || '',
|
|
79
|
+
fromDeclaration: fromDeclaration !== false,
|
|
80
|
+
geometry: {
|
|
81
|
+
vertices: [],
|
|
82
|
+
normals: [],
|
|
83
|
+
uvs: []
|
|
84
|
+
},
|
|
85
|
+
materials: [],
|
|
86
|
+
smooth: true,
|
|
87
|
+
startMaterial: function startMaterial(name, libraries) {
|
|
88
|
+
var previous = this._finalize(false);
|
|
89
|
+
|
|
90
|
+
// New usemtl declaration overwrites an inherited material, except if faces were declared
|
|
91
|
+
// after the material, then it must be preserved for proper MultiMaterial continuation.
|
|
92
|
+
if (previous && (previous.inherited || previous.groupCount <= 0)) {
|
|
93
|
+
this.materials.splice(previous.index, 1);
|
|
94
|
+
}
|
|
95
|
+
var material = {
|
|
96
|
+
index: this.materials.length,
|
|
97
|
+
name: name || '',
|
|
98
|
+
mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : '',
|
|
99
|
+
smooth: previous !== undefined ? previous.smooth : this.smooth,
|
|
100
|
+
groupStart: previous !== undefined ? previous.groupEnd : 0,
|
|
101
|
+
groupEnd: -1,
|
|
102
|
+
groupCount: -1,
|
|
103
|
+
inherited: false,
|
|
104
|
+
clone: function clone(index) {
|
|
105
|
+
return {
|
|
106
|
+
index: typeof index === 'number' ? index : this.index,
|
|
107
|
+
name: this.name,
|
|
108
|
+
mtllib: this.mtllib,
|
|
109
|
+
smooth: this.smooth,
|
|
110
|
+
groupStart: this.groupEnd,
|
|
111
|
+
groupEnd: -1,
|
|
112
|
+
groupCount: -1,
|
|
113
|
+
inherited: false
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
this.materials.push(material);
|
|
118
|
+
return material;
|
|
119
|
+
},
|
|
120
|
+
currentMaterial: function currentMaterial() {
|
|
121
|
+
if (this.materials.length > 0) {
|
|
122
|
+
return this.materials[this.materials.length - 1];
|
|
123
|
+
}
|
|
124
|
+
return undefined;
|
|
125
|
+
},
|
|
126
|
+
_finalize: function _finalize(end) {
|
|
127
|
+
var lastMultiMaterial = this.currentMaterial();
|
|
128
|
+
if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {
|
|
129
|
+
lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;
|
|
130
|
+
lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;
|
|
131
|
+
lastMultiMaterial.inherited = false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Guarantee at least one empty material, this makes the creation later more straight forward.
|
|
135
|
+
if (end !== false && this.materials.length === 0) {
|
|
136
|
+
this.materials.push({
|
|
137
|
+
name: '',
|
|
138
|
+
smooth: this.smooth
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return lastMultiMaterial;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Inherit previous objects material.
|
|
146
|
+
// Spec tells us that a declared material must be set to all objects until a new material is declared.
|
|
147
|
+
// If a usemtl declaration is encountered while this new object is being parsed, it will
|
|
148
|
+
// overwrite the inherited material. Exception being that there was already face declarations
|
|
149
|
+
// to the inherited material, then it will be preserved for proper MultiMaterial continuation.
|
|
150
|
+
|
|
151
|
+
if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {
|
|
152
|
+
var declared = previousMaterial.clone(0);
|
|
153
|
+
declared.inherited = true;
|
|
154
|
+
this.object.materials.push(declared);
|
|
155
|
+
}
|
|
156
|
+
this.objects.push(this.object);
|
|
157
|
+
},
|
|
158
|
+
finalize: function finalize() {
|
|
159
|
+
if (this.object && typeof this.object._finalize === 'function') {
|
|
160
|
+
this.object._finalize();
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
parseVertexIndex: function parseVertexIndex(value, len) {
|
|
164
|
+
var index = parseInt(value, 10);
|
|
165
|
+
return (index >= 0 ? index - 1 : index + len / 3) * 3;
|
|
166
|
+
},
|
|
167
|
+
parseNormalIndex: function parseNormalIndex(value, len) {
|
|
168
|
+
var index = parseInt(value, 10);
|
|
169
|
+
return (index >= 0 ? index - 1 : index + len / 3) * 3;
|
|
170
|
+
},
|
|
171
|
+
parseUVIndex: function parseUVIndex(value, len) {
|
|
172
|
+
var index = parseInt(value, 10);
|
|
173
|
+
return (index >= 0 ? index - 1 : index + len / 2) * 2;
|
|
174
|
+
},
|
|
175
|
+
addVertex: function addVertex(a, b, c) {
|
|
176
|
+
var src = this.vertices;
|
|
177
|
+
var dst = this.object.geometry.vertices;
|
|
178
|
+
dst.push(src[a + 0]);
|
|
179
|
+
dst.push(src[a + 1]);
|
|
180
|
+
dst.push(src[a + 2]);
|
|
181
|
+
dst.push(src[b + 0]);
|
|
182
|
+
dst.push(src[b + 1]);
|
|
183
|
+
dst.push(src[b + 2]);
|
|
184
|
+
dst.push(src[c + 0]);
|
|
185
|
+
dst.push(src[c + 1]);
|
|
186
|
+
dst.push(src[c + 2]);
|
|
187
|
+
},
|
|
188
|
+
addVertexLine: function addVertexLine(a) {
|
|
189
|
+
var src = this.vertices;
|
|
190
|
+
var dst = this.object.geometry.vertices;
|
|
191
|
+
dst.push(src[a + 0]);
|
|
192
|
+
dst.push(src[a + 1]);
|
|
193
|
+
dst.push(src[a + 2]);
|
|
194
|
+
},
|
|
195
|
+
addNormal: function addNormal(a, b, c) {
|
|
196
|
+
var src = this.normals;
|
|
197
|
+
var dst = this.object.geometry.normals;
|
|
198
|
+
dst.push(src[a + 0]);
|
|
199
|
+
dst.push(src[a + 1]);
|
|
200
|
+
dst.push(src[a + 2]);
|
|
201
|
+
dst.push(src[b + 0]);
|
|
202
|
+
dst.push(src[b + 1]);
|
|
203
|
+
dst.push(src[b + 2]);
|
|
204
|
+
dst.push(src[c + 0]);
|
|
205
|
+
dst.push(src[c + 1]);
|
|
206
|
+
dst.push(src[c + 2]);
|
|
207
|
+
},
|
|
208
|
+
addUV: function addUV(a, b, c) {
|
|
209
|
+
var src = this.uvs;
|
|
210
|
+
var dst = this.object.geometry.uvs;
|
|
211
|
+
dst.push(src[a + 0]);
|
|
212
|
+
dst.push(src[a + 1]);
|
|
213
|
+
dst.push(src[b + 0]);
|
|
214
|
+
dst.push(src[b + 1]);
|
|
215
|
+
dst.push(src[c + 0]);
|
|
216
|
+
dst.push(src[c + 1]);
|
|
217
|
+
},
|
|
218
|
+
addUVLine: function addUVLine(a) {
|
|
219
|
+
var src = this.uvs;
|
|
220
|
+
var dst = this.object.geometry.uvs;
|
|
221
|
+
dst.push(src[a + 0]);
|
|
222
|
+
dst.push(src[a + 1]);
|
|
223
|
+
},
|
|
224
|
+
addFace: function addFace(a, b, c, d, ua, ub, uc, ud, na, nb, nc, nd) {
|
|
225
|
+
var vLen = this.vertices.length;
|
|
226
|
+
var ia = this.parseVertexIndex(a, vLen);
|
|
227
|
+
var ib = this.parseVertexIndex(b, vLen);
|
|
228
|
+
var ic = this.parseVertexIndex(c, vLen);
|
|
229
|
+
var id;
|
|
230
|
+
if (d === undefined) {
|
|
231
|
+
this.addVertex(ia, ib, ic);
|
|
232
|
+
} else {
|
|
233
|
+
id = this.parseVertexIndex(d, vLen);
|
|
234
|
+
this.addVertex(ia, ib, id);
|
|
235
|
+
this.addVertex(ib, ic, id);
|
|
236
|
+
}
|
|
237
|
+
if (ua !== undefined) {
|
|
238
|
+
var uvLen = this.uvs.length;
|
|
239
|
+
ia = this.parseUVIndex(ua, uvLen);
|
|
240
|
+
ib = this.parseUVIndex(ub, uvLen);
|
|
241
|
+
ic = this.parseUVIndex(uc, uvLen);
|
|
242
|
+
if (d === undefined) {
|
|
243
|
+
this.addUV(ia, ib, ic);
|
|
244
|
+
} else {
|
|
245
|
+
id = this.parseUVIndex(ud, uvLen);
|
|
246
|
+
this.addUV(ia, ib, id);
|
|
247
|
+
this.addUV(ib, ic, id);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (na !== undefined) {
|
|
251
|
+
// Normals are many times the same. If so, skip function call and parseInt.
|
|
252
|
+
var nLen = this.normals.length;
|
|
253
|
+
ia = this.parseNormalIndex(na, nLen);
|
|
254
|
+
ib = na === nb ? ia : this.parseNormalIndex(nb, nLen);
|
|
255
|
+
ic = na === nc ? ia : this.parseNormalIndex(nc, nLen);
|
|
256
|
+
if (d === undefined) {
|
|
257
|
+
this.addNormal(ia, ib, ic);
|
|
258
|
+
} else {
|
|
259
|
+
id = this.parseNormalIndex(nd, nLen);
|
|
260
|
+
this.addNormal(ia, ib, id);
|
|
261
|
+
this.addNormal(ib, ic, id);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
addLineGeometry: function addLineGeometry(vertices, uvs) {
|
|
266
|
+
this.object.geometry.type = 'Line';
|
|
267
|
+
var vLen = this.vertices.length;
|
|
268
|
+
var uvLen = this.uvs.length;
|
|
269
|
+
for (var vi = 0, l = vertices.length; vi < l; vi++) {
|
|
270
|
+
this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen));
|
|
271
|
+
}
|
|
272
|
+
for (var uvi = 0, _l = uvs.length; uvi < _l; uvi++) {
|
|
273
|
+
this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
state.startObject('', false);
|
|
278
|
+
return state;
|
|
279
|
+
},
|
|
280
|
+
parse: function parse(text) {
|
|
281
|
+
var state = this._createParserState();
|
|
282
|
+
if (text.indexOf('\r\n') !== -1) {
|
|
283
|
+
// This is faster than String.split with regex that splits on both
|
|
284
|
+
text = text.replace('\r\n', '\n');
|
|
285
|
+
}
|
|
286
|
+
var lines = text.split('\n');
|
|
287
|
+
var line = '',
|
|
288
|
+
lineFirstChar = '',
|
|
289
|
+
lineSecondChar = '';
|
|
290
|
+
var lineLength = 0;
|
|
291
|
+
var result = [];
|
|
292
|
+
|
|
293
|
+
// Faster to just trim left side of the line. Use if available.
|
|
294
|
+
var trimLeft = typeof ''.trimLeft === 'function';
|
|
295
|
+
for (var i = 0, l = lines.length; i < l; i++) {
|
|
296
|
+
line = lines[i];
|
|
297
|
+
line = trimLeft ? line.trimLeft() : line.trim();
|
|
298
|
+
lineLength = line.length;
|
|
299
|
+
if (lineLength === 0) continue;
|
|
300
|
+
lineFirstChar = line.charAt(0);
|
|
301
|
+
|
|
302
|
+
// @todo invoke passed in handler if any
|
|
303
|
+
if (lineFirstChar === '#') continue;
|
|
304
|
+
if (lineFirstChar === 'v') {
|
|
305
|
+
lineSecondChar = line.charAt(1);
|
|
306
|
+
if (lineSecondChar === ' ' && (result = this.regexp.vertex_pattern.exec(line)) !== null) {
|
|
307
|
+
// 0 1 2 3
|
|
308
|
+
// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
|
|
309
|
+
|
|
310
|
+
state.vertices.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));
|
|
311
|
+
} else if (lineSecondChar === 'n' && (result = this.regexp.normal_pattern.exec(line)) !== null) {
|
|
312
|
+
// 0 1 2 3
|
|
313
|
+
// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
|
|
314
|
+
|
|
315
|
+
state.normals.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));
|
|
316
|
+
} else if (lineSecondChar === 't' && (result = this.regexp.uv_pattern.exec(line)) !== null) {
|
|
317
|
+
// 0 1 2
|
|
318
|
+
// ["vt 0.1 0.2", "0.1", "0.2"]
|
|
319
|
+
|
|
320
|
+
state.uvs.push(parseFloat(result[1]), parseFloat(result[2]));
|
|
321
|
+
} else {
|
|
322
|
+
throw new Error("Unexpected vertex/normal/uv line: '" + line + "'");
|
|
323
|
+
}
|
|
324
|
+
} else if (lineFirstChar === 'f') {
|
|
325
|
+
if ((result = this.regexp.face_vertex_uv_normal.exec(line)) !== null) {
|
|
326
|
+
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal
|
|
327
|
+
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
|
328
|
+
// ["f 1/1/1 2/2/2 3/3/3", "1", "1", "1", "2", "2", "2", "3", "3", "3", undefined, undefined, undefined]
|
|
329
|
+
|
|
330
|
+
state.addFace(result[1], result[4], result[7], result[10], result[2], result[5], result[8], result[11], result[3], result[6], result[9], result[12]);
|
|
331
|
+
} else if ((result = this.regexp.face_vertex_uv.exec(line)) !== null) {
|
|
332
|
+
// f vertex/uv vertex/uv vertex/uv
|
|
333
|
+
// 0 1 2 3 4 5 6 7 8
|
|
334
|
+
// ["f 1/1 2/2 3/3", "1", "1", "2", "2", "3", "3", undefined, undefined]
|
|
335
|
+
|
|
336
|
+
state.addFace(result[1], result[3], result[5], result[7], result[2], result[4], result[6], result[8]);
|
|
337
|
+
} else if ((result = this.regexp.face_vertex_normal.exec(line)) !== null) {
|
|
338
|
+
// f vertex//normal vertex//normal vertex//normal
|
|
339
|
+
// 0 1 2 3 4 5 6 7 8
|
|
340
|
+
// ["f 1//1 2//2 3//3", "1", "1", "2", "2", "3", "3", undefined, undefined]
|
|
341
|
+
|
|
342
|
+
state.addFace(result[1], result[3], result[5], result[7], undefined, undefined, undefined, undefined, result[2], result[4], result[6], result[8]);
|
|
343
|
+
} else if ((result = this.regexp.face_vertex.exec(line)) !== null) {
|
|
344
|
+
// f vertex vertex vertex
|
|
345
|
+
// 0 1 2 3 4
|
|
346
|
+
// ["f 1 2 3", "1", "2", "3", undefined]
|
|
347
|
+
|
|
348
|
+
state.addFace(result[1], result[2], result[3], result[4]);
|
|
349
|
+
} else {
|
|
350
|
+
throw new Error("Unexpected face line: '" + line + "'");
|
|
351
|
+
}
|
|
352
|
+
} else if (lineFirstChar === 'l') {
|
|
353
|
+
var lineParts = line.substring(1).trim().split(' ');
|
|
354
|
+
var lineVertices = [],
|
|
355
|
+
lineUVs = [];
|
|
356
|
+
if (line.indexOf('/') === -1) {
|
|
357
|
+
lineVertices = lineParts;
|
|
358
|
+
} else {
|
|
359
|
+
for (var li = 0, llen = lineParts.length; li < llen; li++) {
|
|
360
|
+
var parts = lineParts[li].split('/');
|
|
361
|
+
if (parts[0] !== '') lineVertices.push(parts[0]);
|
|
362
|
+
if (parts[1] !== '') lineUVs.push(parts[1]);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
state.addLineGeometry(lineVertices, lineUVs);
|
|
366
|
+
} else if ((result = this.regexp.object_pattern.exec(line)) !== null) {
|
|
367
|
+
// o object_name
|
|
368
|
+
// or
|
|
369
|
+
// g group_name
|
|
370
|
+
|
|
371
|
+
var name = result[0].substr(1).trim();
|
|
372
|
+
state.startObject(name);
|
|
373
|
+
} else if (this.regexp.material_use_pattern.test(line)) {
|
|
374
|
+
// material
|
|
375
|
+
|
|
376
|
+
state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);
|
|
377
|
+
} else if (this.regexp.material_library_pattern.test(line)) {
|
|
378
|
+
// mtl file
|
|
379
|
+
|
|
380
|
+
state.materialLibraries.push(line.substring(7).trim());
|
|
381
|
+
} else if ((result = this.regexp.smoothing_pattern.exec(line)) !== null) {
|
|
382
|
+
// smooth shading
|
|
383
|
+
|
|
384
|
+
// @todo Handle files that have varying smooth values for a set of faces inside one geometry,
|
|
385
|
+
// but does not define a usemtl for each face set.
|
|
386
|
+
// This should be detected and a dummy material created (later MultiMaterial and geometry groups).
|
|
387
|
+
// This requires some care to not create extra material on each smooth value for "normal" obj files.
|
|
388
|
+
// where explicit usemtl defines geometry groups.
|
|
389
|
+
// Example asset: examples/models/obj/cerberus/Cerberus.obj
|
|
390
|
+
|
|
391
|
+
var value = result[1].trim().toLowerCase();
|
|
392
|
+
state.object.smooth = value === '1' || value === 'on';
|
|
393
|
+
var material = state.object.currentMaterial();
|
|
394
|
+
if (material) {
|
|
395
|
+
material.smooth = state.object.smooth;
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
// Handle null terminated files without exception
|
|
399
|
+
if (line === '\0') continue;
|
|
400
|
+
throw new Error("Unexpected line: '" + line + "'");
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
state.finalize();
|
|
404
|
+
var container = new THREE.Group();
|
|
405
|
+
container.materialLibraries = [].concat(state.materialLibraries);
|
|
406
|
+
for (var _i = 0, _l2 = state.objects.length; _i < _l2; _i++) {
|
|
407
|
+
var object = state.objects[_i];
|
|
408
|
+
var geometry = object.geometry;
|
|
409
|
+
var materials = object.materials;
|
|
410
|
+
var isLine = geometry.type === 'Line';
|
|
411
|
+
|
|
412
|
+
// Skip o/g line declarations that did not follow with any faces
|
|
413
|
+
if (geometry.vertices.length === 0) continue;
|
|
414
|
+
var buffergeometry = new THREE.BufferGeometry();
|
|
415
|
+
buffergeometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(geometry.vertices), 3));
|
|
416
|
+
if (geometry.normals.length > 0) {
|
|
417
|
+
buffergeometry.addAttribute('normal', new THREE.BufferAttribute(new Float32Array(geometry.normals), 3));
|
|
418
|
+
} else {
|
|
419
|
+
buffergeometry.computeVertexNormals();
|
|
420
|
+
}
|
|
421
|
+
if (geometry.uvs.length > 0) {
|
|
422
|
+
buffergeometry.addAttribute('uv', new THREE.BufferAttribute(new Float32Array(geometry.uvs), 2));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Create materials
|
|
426
|
+
|
|
427
|
+
var createdMaterials = [];
|
|
428
|
+
for (var mi = 0, miLen = materials.length; mi < miLen; mi++) {
|
|
429
|
+
var sourceMaterial = materials[mi];
|
|
430
|
+
var _material = undefined;
|
|
431
|
+
if (this.materials !== null) {
|
|
432
|
+
_material = this.materials.create(sourceMaterial.name);
|
|
433
|
+
|
|
434
|
+
// mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.
|
|
435
|
+
if (isLine && _material && !(_material instanceof THREE.LineBasicMaterial)) {
|
|
436
|
+
var materialLine = new THREE.LineBasicMaterial();
|
|
437
|
+
materialLine.copy(_material);
|
|
438
|
+
_material = materialLine;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (!_material) {
|
|
442
|
+
_material = !isLine ? new THREE.MeshPhongMaterial() : new THREE.LineBasicMaterial();
|
|
443
|
+
_material.name = sourceMaterial.name;
|
|
444
|
+
}
|
|
445
|
+
if (!sourceMaterial.smooth) _material.flatShading = true;
|
|
446
|
+
createdMaterials.push(_material);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Create mesh
|
|
450
|
+
|
|
451
|
+
var mesh = void 0;
|
|
452
|
+
if (createdMaterials.length > 1) {
|
|
453
|
+
for (var _mi = 0, _miLen = materials.length; _mi < _miLen; _mi++) {
|
|
454
|
+
var _sourceMaterial = materials[_mi];
|
|
455
|
+
buffergeometry.addGroup(_sourceMaterial.groupStart, _sourceMaterial.groupCount, _mi);
|
|
456
|
+
}
|
|
457
|
+
var multiMaterial = new THREE.MultiMaterial(createdMaterials);
|
|
458
|
+
mesh = !isLine ? new THREE.Mesh(buffergeometry, multiMaterial) : new THREE.Line(buffergeometry, multiMaterial);
|
|
459
|
+
} else {
|
|
460
|
+
mesh = !isLine ? new THREE.Mesh(buffergeometry, createdMaterials[0]) : new THREE.Line(buffergeometry, createdMaterials[0]);
|
|
461
|
+
}
|
|
462
|
+
mesh.name = object.name;
|
|
463
|
+
container.add(mesh);
|
|
464
|
+
}
|
|
465
|
+
return container;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
var _default = exports["default"] = OBJLoader;
|