@anov/3d 0.0.41 → 0.0.43
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.js +2 -4
- package/dist/anov3d.js.map +1 -1
- package/package.json +1 -1
package/dist/anov3d.js
CHANGED
|
@@ -37,11 +37,9 @@ var Anov3D = /*#__PURE__*/function () {
|
|
|
37
37
|
orbitControls: opts.controls || {
|
|
38
38
|
use: true
|
|
39
39
|
},
|
|
40
|
-
defCameraOps: _objectSpread(
|
|
40
|
+
defCameraOps: _objectSpread({
|
|
41
41
|
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)
|
|
42
|
-
}, cameraParams),
|
|
43
|
-
fov: 60
|
|
44
|
-
}),
|
|
42
|
+
}, cameraParams),
|
|
45
43
|
rendererOps: {
|
|
46
44
|
shadowMap: true,
|
|
47
45
|
size: {
|
package/dist/anov3d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PMREMGenerator","SceneControl","Vector3","lib","use","utils","EventBus","EWeatherType","object2Vector3","Model","defaultCameraParams","RoomEnvironment","Anov3D","opts","camera","cameraParams","fov","near","far","position","fromArray","scene","orbitControls","controls","defCameraOps","aspect","size","width","container","clientWidth","height","clientHeight","rendererOps","shadowMap","reset","css2DRenderer","ambientLight","render","target","copy","lookAt","emitter","emit","sceneControl","eventBus","model","load","changeSceneEnvironment","storeManagement","set","openFlag","useScene","renderer","pmremGenerator","compileEquirectangularShader","roomEnvironment"],"sources":["../src/anov3d.ts"],"sourcesContent":["import { PMREMGenerator, SceneControl, Vector3, lib, use, utils } from '@anov/3d-core'\nimport EventBus from './module/eventBus'\nimport { EWeatherType } from './module/environment/weather/type'\nimport type { InitOptions } from './applicationApi'\nimport { object2Vector3 } from './utils/index'\nimport Model from './module/model'\nimport { defaultCameraParams } from './index'\n\ntype Anov3DOptions = {\n container: HTMLElement\n size?: {\n width: number\n height: number\n }\n camera?: InitOptions['camera']\n environment?: InitOptions['environment']\n model?: InitOptions['model']\n controls?: InitOptions['controls']\n}\n\nconst { RoomEnvironment } = lib\n\nclass Anov3D {\n opts: Anov3DOptions\n sceneControl: SceneControl\n eventBus: EventBus\n EWeatherType: typeof EWeatherType = EWeatherType\n model: Model\n\n constructor(opts: Anov3DOptions) {\n this.opts = opts\n const { camera = {} } = opts || {}\n\n const cameraParams = {\n fov: camera.fov ?? defaultCameraParams.fov,\n near: camera.near ?? defaultCameraParams.near,\n far: camera.far ?? defaultCameraParams.far,\n position: camera.position ? new Vector3().fromArray(camera.position) : object2Vector3(defaultCameraParams.position),\n }\n\n const scene = new SceneControl({\n orbitControls: opts.controls || { use: true },\n defCameraOps: {\n aspect: (opts?.size?.width ?? opts.container.clientWidth) / (opts?.size?.height ?? opts.container.clientHeight),\n ...cameraParams,\n
|
|
1
|
+
{"version":3,"names":["PMREMGenerator","SceneControl","Vector3","lib","use","utils","EventBus","EWeatherType","object2Vector3","Model","defaultCameraParams","RoomEnvironment","Anov3D","opts","camera","cameraParams","fov","near","far","position","fromArray","scene","orbitControls","controls","defCameraOps","aspect","size","width","container","clientWidth","height","clientHeight","rendererOps","shadowMap","reset","css2DRenderer","ambientLight","render","target","copy","lookAt","emitter","emit","sceneControl","eventBus","model","load","changeSceneEnvironment","storeManagement","set","openFlag","useScene","renderer","pmremGenerator","compileEquirectangularShader","roomEnvironment"],"sources":["../src/anov3d.ts"],"sourcesContent":["import { PMREMGenerator, SceneControl, Vector3, lib, use, utils } from '@anov/3d-core'\nimport EventBus from './module/eventBus'\nimport { EWeatherType } from './module/environment/weather/type'\nimport type { InitOptions } from './applicationApi'\nimport { object2Vector3 } from './utils/index'\nimport Model from './module/model'\nimport { defaultCameraParams } from './index'\n\ntype Anov3DOptions = {\n container: HTMLElement\n size?: {\n width: number\n height: number\n }\n camera?: InitOptions['camera']\n environment?: InitOptions['environment']\n model?: InitOptions['model']\n controls?: InitOptions['controls']\n}\n\nconst { RoomEnvironment } = lib\n\nclass Anov3D {\n opts: Anov3DOptions\n sceneControl: SceneControl\n eventBus: EventBus\n EWeatherType: typeof EWeatherType = EWeatherType\n model: Model\n\n constructor(opts: Anov3DOptions) {\n this.opts = opts\n const { camera = {} } = opts || {}\n\n const cameraParams = {\n fov: camera.fov ?? defaultCameraParams.fov,\n near: camera.near ?? defaultCameraParams.near,\n far: camera.far ?? defaultCameraParams.far,\n position: camera.position ? new Vector3().fromArray(camera.position) : object2Vector3(defaultCameraParams.position),\n }\n\n const scene = new SceneControl({\n orbitControls: opts.controls || { use: true },\n defCameraOps: {\n aspect: (opts?.size?.width ?? opts.container.clientWidth) / (opts?.size?.height ?? opts.container.clientHeight),\n ...cameraParams,\n },\n rendererOps: {\n shadowMap: true,\n size: {\n width: opts?.size?.width ?? opts.container.clientWidth,\n height: opts?.size?.height ?? opts.container.clientHeight,\n },\n },\n reset: true,\n css2DRenderer: true,\n ambientLight: true,\n })\n\n scene.render(opts.container)\n\n scene.controls?.target.copy(opts.camera?.target ? new Vector3().fromArray(opts.camera.target) : object2Vector3(defaultCameraParams.lookAt))\n\n utils.emitter.emit('scene-completed', scene)\n\n // 不考虑 tree-shaking\n this.sceneControl = scene\n\n this.eventBus = new EventBus()\n this.model = new Model()\n this.opts.model && (this.model.load(this.opts.model))\n this.changeSceneEnvironment()\n utils.storeManagement.set('event-bus', this.eventBus)\n\n utils.emitter.emit('instantiation-completed', this)\n }\n\n changeSceneEnvironment(openFlag = true) {\n const { renderer, scene } = use.useScene()\n const pmremGenerator = new PMREMGenerator(renderer!)\n pmremGenerator.compileEquirectangularShader()\n const roomEnvironment = new (RoomEnvironment as any)()\n\n // if (openFlag)\n // // scene!.environment = pmremGenerator.fromScene(roomEnvironment, 0.04).texture\n\n // else\n // scene!.environment = null\n }\n}\n\nexport default Anov3D"],"mappings":";;;;;;;;;AAAA,SAASA,cAAc,EAAEC,YAAY,EAAEC,OAAO,EAAEC,GAAG,EAAEC,GAAG,EAAEC,KAAK,QAAQ,eAAe;AACtF,OAAOC,QAAQ;AACf,SAASC,YAAY;AAErB,SAASC,cAAc;AACvB,OAAOC,KAAK;AACZ,SAASC,mBAAmB;AAc5B,IAAQC,eAAe,GAAKR,GAAG,CAAvBQ,eAAe;AAAQ,IAEzBC,MAAM;EAOV,gBAAYC,IAAmB,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,sCAHGN,YAAY;IAAA;IAI9C,IAAI,CAACM,IAAI,GAAGA,IAAI;IAChB,WAAwBA,IAAI,IAAI,CAAC,CAAC;MAAA,mBAA1BC,MAAM;MAANA,MAAM,4BAAG,CAAC,CAAC;IAEnB,IAAMC,YAAY,GAAG;MACnBC,GAAG,iBAAEF,MAAM,CAACE,GAAG,qDAAIN,mBAAmB,CAACM,GAAG;MAC1CC,IAAI,kBAAEH,MAAM,CAACG,IAAI,uDAAIP,mBAAmB,CAACO,IAAI;MAC7CC,GAAG,iBAAEJ,MAAM,CAACI,GAAG,qDAAIR,mBAAmB,CAACQ,GAAG;MAC1CC,QAAQ,EAAEL,MAAM,CAACK,QAAQ,GAAG,IAAIjB,OAAO,EAAE,CAACkB,SAAS,CAACN,MAAM,CAACK,QAAQ,CAAC,GAAGX,cAAc,CAACE,mBAAmB,CAACS,QAAQ;IACpH,CAAC;IAED,IAAME,KAAK,GAAG,IAAIpB,YAAY,CAAC;MAC7BqB,aAAa,EAAET,IAAI,CAACU,QAAQ,IAAI;QAAEnB,GAAG,EAAE;MAAK,CAAC;MAC7CoB,YAAY;QACVC,MAAM,EAAE,qBAACZ,IAAI,aAAJA,IAAI,qCAAJA,IAAI,CAAEa,IAAI,+CAAV,WAAYC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