@anov/3d 0.0.4-alpha26 → 0.0.4-alpha28
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/dist/anov3d.d.ts +25 -0
- package/dist/anov3d.js +86 -0
- package/dist/anov3d.js.map +1 -0
- package/dist/applicationApi.d.ts +2 -0
- package/dist/applicationApi.js +20 -1
- package/dist/applicationApi.js.map +1 -1
- package/dist/factory/3d.js +2 -0
- package/dist/factory/3d.js.map +1 -1
- package/dist/factory/globalControl.d.ts +7 -0
- package/dist/factory/globalControl.js +22 -0
- package/dist/factory/globalControl.js.map +1 -0
- package/dist/factory/regionData.js +1 -1
- package/dist/factory/regionData.js.map +1 -1
- package/dist/factory/unit/circle.js +7 -0
- package/dist/factory/unit/circle.js.map +1 -1
- package/dist/factory/unit/cylinder.js +14 -0
- package/dist/factory/unit/cylinder.js.map +1 -1
- package/dist/factory/unit/handle.d.ts +7 -0
- package/dist/factory/unit/handle.js +41 -0
- package/dist/factory/unit/handle.js.map +1 -0
- package/dist/module/camera/index.d.ts +7 -3
- package/dist/module/camera/index.js +26 -14
- package/dist/module/camera/index.js.map +1 -1
- package/dist/module/environment/index.d.ts +5 -6
- package/dist/module/environment/index.js +8 -4
- package/dist/module/environment/index.js.map +1 -1
- package/dist/module/scene/index.d.ts +1 -3
- package/dist/module/scene/index.js +3 -4
- package/dist/module/scene/index.js.map +1 -1
- package/dist/sdkEntry.d.ts +3 -34
- package/dist/sdkEntry.js +37 -97
- package/dist/sdkEntry.js.map +1 -1
- package/dist/utils/abstract.d.ts +6 -0
- package/dist/utils/abstract.js +24 -0
- package/dist/utils/abstract.js.map +1 -0
- package/package.json +3 -3
package/dist/sdkEntry.js
CHANGED
|
@@ -1,106 +1,46 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
var _dec, _class;
|
|
5
3
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
4
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
import { HeatMap, Poi } from '@anov/3d-ability';
|
|
16
|
+
import Environment from "./module/environment";
|
|
13
17
|
import Camera from "./module/camera";
|
|
14
|
-
import { EWeatherType } from "./module/environment/weather/type";
|
|
15
|
-
import { object2Vector3 } from "./utils/index";
|
|
16
18
|
import { Scene } from "./module/scene";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
fov: (_camera$fov = camera.fov) !== null && _camera$fov !== void 0 ? _camera$fov : defaultCameraParams.fov,
|
|
41
|
-
near: (_camera$near = camera.near) !== null && _camera$near !== void 0 ? _camera$near : defaultCameraParams.near,
|
|
42
|
-
far: (_camera$far = camera.far) !== null && _camera$far !== void 0 ? _camera$far : defaultCameraParams.far,
|
|
43
|
-
position: camera.position ? new Vector3().fromArray(camera.position) : object2Vector3(defaultCameraParams.position)
|
|
44
|
-
};
|
|
45
|
-
var scene = new SceneControl({
|
|
46
|
-
orbitControls: true,
|
|
47
|
-
defCameraOps: _objectSpread(_objectSpread({
|
|
48
|
-
aspect: ((_opts$size$width = opts === null || opts === void 0 ? void 0 : (_opts$size = opts.size) === null || _opts$size === void 0 ? void 0 : _opts$size.width) !== null && _opts$size$width !== void 0 ? _opts$size$width : opts.container.clientWidth) / ((_opts$size$height = opts === null || opts === void 0 ? void 0 : (_opts$size2 = opts.size) === null || _opts$size2 === void 0 ? void 0 : _opts$size2.height) !== null && _opts$size$height !== void 0 ? _opts$size$height : opts.container.clientHeight)
|
|
49
|
-
}, cameraParams), {}, {
|
|
50
|
-
fov: 60
|
|
51
|
-
}),
|
|
52
|
-
rendererOps: {
|
|
53
|
-
shadowMap: true,
|
|
54
|
-
size: {
|
|
55
|
-
width: (_opts$size$width2 = opts === null || opts === void 0 ? void 0 : (_opts$size3 = opts.size) === null || _opts$size3 === void 0 ? void 0 : _opts$size3.width) !== null && _opts$size$width2 !== void 0 ? _opts$size$width2 : opts.container.clientWidth,
|
|
56
|
-
height: (_opts$size$height2 = opts === null || opts === void 0 ? void 0 : (_opts$size4 = opts.size) === null || _opts$size4 === void 0 ? void 0 : _opts$size4.height) !== null && _opts$size$height2 !== void 0 ? _opts$size$height2 : opts.container.clientHeight
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
reset: true,
|
|
60
|
-
css2DRenderer: true,
|
|
61
|
-
ambientLight: true
|
|
62
|
-
});
|
|
63
|
-
scene.render(opts.container);
|
|
64
|
-
|
|
65
|
-
// temporary solution by LM
|
|
66
|
-
var factory = new Factory3D({
|
|
67
|
-
model: this.opts.model,
|
|
68
|
-
environment: 'quarry_01_1k.hdr'
|
|
69
|
-
});
|
|
70
|
-
factory.renderScene(scene);
|
|
71
|
-
use.useframe(function () {
|
|
72
|
-
scene.renderer.render(scene.scene, scene.camera);
|
|
73
|
-
});
|
|
74
|
-
(_scene$controls = scene.controls) === null || _scene$controls === void 0 ? void 0 : _scene$controls.target.copy((_opts$camera = opts.camera) !== null && _opts$camera !== void 0 && _opts$camera.target ? new Vector3().fromArray(opts.camera.target) : object2Vector3(defaultCameraParams.lookAt));
|
|
75
|
-
utils.emitter.emit('scene-completed', scene);
|
|
76
|
-
|
|
77
|
-
// 不考虑 tree-shaking
|
|
78
|
-
this.sceneControl = scene;
|
|
79
|
-
// this.environment = new Environment(this.changeSceneEnvironment, opts.environment) // temporary solution by LM
|
|
80
|
-
// this.poi = new Poi()
|
|
81
|
-
this.heatMap = new HeatMap();
|
|
82
|
-
this.eventBus = new EventBus();
|
|
83
|
-
this.camera = new Camera(scene.camera, scene.controls);
|
|
84
|
-
this.scene = new Scene(factory);
|
|
85
|
-
this.model = new Model();
|
|
86
|
-
// this.opts.model && (this.model.load(this.opts.model))
|
|
87
|
-
// this.changeSceneEnvironment()
|
|
88
|
-
utils.storeManagement.set('event-bus', this.eventBus);
|
|
19
|
+
import { provide } from "./utils/abstract";
|
|
20
|
+
import Anov3DCore from "./anov3d";
|
|
21
|
+
var App = (_dec = provide([{
|
|
22
|
+
name: 'camera',
|
|
23
|
+
module: Camera
|
|
24
|
+
}, {
|
|
25
|
+
name: 'environment',
|
|
26
|
+
module: Environment
|
|
27
|
+
}, {
|
|
28
|
+
name: 'scene',
|
|
29
|
+
module: Scene
|
|
30
|
+
}, {
|
|
31
|
+
name: 'poi',
|
|
32
|
+
module: Poi
|
|
33
|
+
}, {
|
|
34
|
+
name: 'heatMap',
|
|
35
|
+
module: HeatMap
|
|
36
|
+
}]), _dec(_class = /*#__PURE__*/function (_Anov3DCore) {
|
|
37
|
+
_inherits(App, _Anov3DCore);
|
|
38
|
+
var _super = _createSuper(App);
|
|
39
|
+
function App() {
|
|
40
|
+
_classCallCheck(this, App);
|
|
41
|
+
return _super.apply(this, arguments);
|
|
89
42
|
}
|
|
90
|
-
_createClass(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var openFlag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
94
|
-
var _use$useScene = use.useScene(),
|
|
95
|
-
renderer = _use$useScene.renderer,
|
|
96
|
-
scene = _use$useScene.scene;
|
|
97
|
-
var pmremGenerator = new PMREMGenerator(renderer);
|
|
98
|
-
pmremGenerator.compileEquirectangularShader();
|
|
99
|
-
var roomEnvironment = new RoomEnvironment();
|
|
100
|
-
if (openFlag) scene.environment = pmremGenerator.fromScene(roomEnvironment, 0.04).texture;else scene.environment = null;
|
|
101
|
-
}
|
|
102
|
-
}]);
|
|
103
|
-
return Anov3D;
|
|
104
|
-
}();
|
|
105
|
-
export default Anov3D;
|
|
43
|
+
return _createClass(App);
|
|
44
|
+
}(Anov3DCore)) || _class);
|
|
45
|
+
export default App;
|
|
106
46
|
//# sourceMappingURL=sdkEntry.js.map
|
package/dist/sdkEntry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["HeatMap","Poi","Environment","Camera","Scene","provide","Anov3DCore","App","name","module"],"sources":["../src/sdkEntry.ts"],"sourcesContent":["import { HeatMap, Poi } from '@anov/3d-ability'\nimport Environment from './module/environment'\nimport Camera from './module/camera'\nimport { Scene } from './module/scene'\nimport { provide } from './utils/abstract'\nimport Anov3DCore from './anov3d'\n\nexport type Override<P, S> = Omit<P, keyof S> & S\n\n@provide(\n [\n {\n name: 'camera',\n module: Camera,\n },\n {\n name: 'environment',\n module: Environment,\n },\n {\n name: 'scene',\n module: Scene,\n },\n {\n name: 'poi',\n module: Poi,\n },\n {\n name: 'heatMap',\n module: HeatMap,\n },\n ],\n)\nclass App extends Anov3DCore {}\n\nexport default App\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAASA,OAAO,EAAEC,GAAG,QAAQ,kBAAkB;AAC/C,OAAOC,WAAW;AAClB,OAAOC,MAAM;AACb,SAASC,KAAK;AACd,SAASC,OAAO;AAChB,OAAOC,UAAU;AAAgB,IA4B3BC,GAAG,WAxBRF,OAAO,CACN,CACE;EACEG,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAEN;AACV,CAAC,EACD;EACEK,IAAI,EAAE,aAAa;EACnBC,MAAM,EAAEP;AACV,CAAC,EACD;EACEM,IAAI,EAAE,OAAO;EACbC,MAAM,EAAEL;AACV,CAAC,EACD;EACEI,IAAI,EAAE,KAAK;EACXC,MAAM,EAAER;AACV,CAAC,EACD;EACEO,IAAI,EAAE,SAAS;EACfC,MAAM,EAAET;AACV,CAAC,CACF,CACF;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;AAAA,EACiBM,UAAU;AAE5B,eAAeC,GAAG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
/* eslint-disable new-cap */
|
|
9
|
+
import { utils } from '@anov/3d-core';
|
|
10
|
+
export var provide = function provide(modules) {
|
|
11
|
+
return function (targetClass) {
|
|
12
|
+
utils.emitter.on('instantiation-completed', function (app) {
|
|
13
|
+
modules.forEach(function (module) {
|
|
14
|
+
targetClass.prototype[module.name] = new module.module(app);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export var BaseModule = /*#__PURE__*/_createClass(function BaseModule(app) {
|
|
20
|
+
_classCallCheck(this, BaseModule);
|
|
21
|
+
_defineProperty(this, "app", void 0);
|
|
22
|
+
this.app = app;
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=abstract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["utils","provide","modules","targetClass","emitter","on","app","forEach","module","prototype","name","BaseModule"],"sources":["../../src/utils/abstract.ts"],"sourcesContent":["/* eslint-disable new-cap */\nimport { utils } from '@anov/3d-core'\nimport type Anov3D from '../sdkEntry'\n\nexport const provide = (modules: any): any => {\n return (targetClass: any) => {\n utils.emitter.on('instantiation-completed', (app) => {\n modules.forEach((module: any) => {\n targetClass.prototype[module.name] = new module.module(app)\n })\n })\n }\n}\n\nexport class BaseModule {\n app: Anov3D\n constructor(app: Anov3D) {\n this.app = app\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA,SAASA,KAAK,QAAQ,eAAe;AAGrC,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAO,CAAIC,OAAY,EAAU;EAC5C,OAAO,UAACC,WAAgB,EAAK;IAC3BH,KAAK,CAACI,OAAO,CAACC,EAAE,CAAC,yBAAyB,EAAE,UAACC,GAAG,EAAK;MACnDJ,OAAO,CAACK,OAAO,CAAC,UAACC,MAAW,EAAK;QAC/BL,WAAW,CAACM,SAAS,CAACD,MAAM,CAACE,IAAI,CAAC,GAAG,IAAIF,MAAM,CAACA,MAAM,CAACF,GAAG,CAAC;MAC7D,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,WAAaK,UAAU,6BAErB,oBAAYL,GAAW,EAAE;EAAA;EAAA;EACvB,IAAI,CAACA,GAAG,GAAGA,GAAG;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anov/3d",
|
|
3
|
-
"version": "0.0.4-
|
|
3
|
+
"version": "0.0.4-alpha28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@tweenjs/tween.js": "^21.0.0",
|
|
21
21
|
"localforage": "^1.10.0",
|
|
22
22
|
"uuid": "^9.0.1",
|
|
23
|
-
"@anov/3d-
|
|
24
|
-
"@anov/3d-
|
|
23
|
+
"@anov/3d-core": "^0.0.4-alpha20",
|
|
24
|
+
"@anov/3d-ability": "^0.0.4-alpha10"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/uuid": "^9.0.7"
|