@soonspacejs/plugin-sbmz-loader 2.13.14 → 2.13.16
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/index.esm.js +1 -40
- package/package.json +3 -3
- package/dist/index.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,40 +1 @@
|
|
|
1
|
-
class
|
|
2
|
-
constructor(ssp) {
|
|
3
|
-
this.modelData = [];
|
|
4
|
-
this.modelList = [];
|
|
5
|
-
this.ssp = ssp;
|
|
6
|
-
}
|
|
7
|
-
async load(path) {
|
|
8
|
-
const { fetchFile, } = this.ssp.utils;
|
|
9
|
-
const data = await fetchFile(`${path}/metadata.json`, 'json');
|
|
10
|
-
this.modelData = data.items;
|
|
11
|
-
const groupId = `${path}_group`;
|
|
12
|
-
this.ssp.createGroup({
|
|
13
|
-
id: groupId,
|
|
14
|
-
});
|
|
15
|
-
const group = await this.ssp.addModelForGroup(groupId, this.modelData.map(({ name, position, rotation, scale, path: modelPath, }, index) => ({
|
|
16
|
-
id: `${index}${modelPath}`,
|
|
17
|
-
name,
|
|
18
|
-
url: `${path}/${modelPath}`,
|
|
19
|
-
position: {
|
|
20
|
-
x: position[0],
|
|
21
|
-
y: position[1],
|
|
22
|
-
z: position[2],
|
|
23
|
-
},
|
|
24
|
-
rotation: {
|
|
25
|
-
x: rotation[0],
|
|
26
|
-
y: rotation[1],
|
|
27
|
-
z: rotation[2],
|
|
28
|
-
},
|
|
29
|
-
scale: {
|
|
30
|
-
x: scale[0],
|
|
31
|
-
y: scale[1],
|
|
32
|
-
z: scale[2],
|
|
33
|
-
},
|
|
34
|
-
})));
|
|
35
|
-
this.modelList = group === null || group === void 0 ? void 0 : group.children;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { SbmzLoader as default };
|
|
40
|
-
//# sourceMappingURL=index.esm.js.map
|
|
1
|
+
class t{constructor(t){this.modelData=[],this.modelList=[],this.ssp=t}async load(t){const{fetchFile:s}=this.ssp.utils,a=await s(`${t}/metadata.json`,"json");this.modelData=a.items;const o=`${t}_group`;this.ssp.createGroup({id:o});const i=await this.ssp.addModelForGroup(o,this.modelData.map(({name:s,position:a,rotation:o,scale:i,path:e},l)=>({id:`${l}${e}`,name:s,url:`${t}/${e}`,position:{x:a[0],y:a[1],z:a[2]},rotation:{x:o[0],y:o[1],z:o[2]},scale:{x:i[0],y:i[1],z:i[2]}})));this.modelList=null==i?void 0:i.children}}export{t as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-sbmz-loader",
|
|
3
3
|
"pluginName": "SbmzLoaderPlugin",
|
|
4
|
-
"version": "2.13.
|
|
4
|
+
"version": "2.13.16",
|
|
5
5
|
"description": "Sbmz-loader plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xunwei",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "aaf0c46565c740277fad34bc3a3ba9fa61d48278",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.13.
|
|
18
|
+
"soonspacejs": "2.13.16"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/dist/index.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["import SoonSpace from 'soonspacejs'\nimport type { Model, } from 'soonspacejs'\n\nexport interface SbmzModelData {\n matrix: number[];\n name: string;\n path: string;\n position: [number, number, number];\n rotation: [number, number, number];\n scale: [number, number, number];\n}\n\nexport default class SbmzLoader {\n\n ssp: SoonSpace\n\n modelData: SbmzModelData[] = []\n modelList: Model[] = []\n\n constructor ( ssp: SoonSpace ) {\n\n this.ssp = ssp\n\n }\n\n async load ( path: string ) {\n\n const { fetchFile, } = this.ssp.utils\n const data = await fetchFile( `${path}/metadata.json`, 'json' )\n\n this.modelData = data.items as SbmzModelData[]\n\n const groupId = `${path}_group`\n \n this.ssp.createGroup( {\n id: groupId,\n } )\n\n const group = await this.ssp.addModelForGroup( groupId, this.modelData.map( ( { name, position, rotation, scale, path: modelPath, }, index ) => ( {\n id: `${index}${modelPath}`,\n name,\n url: `${path}/${modelPath}`,\n position: {\n x: position[ 0 ],\n y: position[ 1 ],\n z: position[ 2 ],\n },\n rotation: {\n x: rotation[ 0 ],\n y: rotation[ 1 ],\n z: rotation[ 2 ],\n },\n scale: {\n x: scale[ 0 ],\n y: scale[ 1 ],\n z: scale[ 2 ],\n },\n } ) ) )\n\n this.modelList = group?.children as Model[]\n \n }\n\n}\n"],"names":[],"mappings":"AAYc,MAAO,UAAU,CAAA;AAO7B,IAAA,WAAA,CAAc,GAAc,EAAA;QAH5B,IAAS,CAAA,SAAA,GAAoB,EAAE,CAAA;QAC/B,IAAS,CAAA,SAAA,GAAY,EAAE,CAAA;AAIrB,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;KAEf;IAED,MAAM,IAAI,CAAG,IAAY,EAAA;QAEvB,MAAM,EAAE,SAAS,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAA;QACrC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAE,CAAG,EAAA,IAAI,CAAgB,cAAA,CAAA,EAAE,MAAM,CAAE,CAAA;AAE/D,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAwB,CAAA;AAE9C,QAAA,MAAM,OAAO,GAAG,CAAG,EAAA,IAAI,QAAQ,CAAA;AAE/B,QAAA,IAAI,CAAC,GAAG,CAAC,WAAW,CAAE;AACpB,YAAA,EAAE,EAAE,OAAO;AACZ,SAAA,CAAE,CAAA;AAEH,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,GA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