|
@@ -4,42 +4,55 @@ |
|
@@ -4,42 +4,55 @@ |
4
|
<setting-item name="颜色">
|
4
|
<setting-item name="颜色">
|
5
|
<n-color-picker size="small" :show-alpha="false" v-model:value="optionData.borderConfig.color"></n-color-picker>
|
5
|
<n-color-picker size="small" :show-alpha="false" v-model:value="optionData.borderConfig.color"></n-color-picker>
|
6
|
</setting-item>
|
6
|
</setting-item>
|
7
|
- <setting-item name="开启">
|
7
|
+ <setting-item name="开启边框">
|
8
|
<n-switch v-model:value="optionData.borderConfig.show" size="small" />
|
8
|
<n-switch v-model:value="optionData.borderConfig.show" size="small" />
|
9
|
</setting-item>
|
9
|
</setting-item>
|
10
|
<setting-item name="大小">
|
10
|
<setting-item name="大小">
|
11
|
<n-input-number :min="0" v-model:value="optionData.borderConfig.size" size="small" />
|
11
|
<n-input-number :min="0" v-model:value="optionData.borderConfig.size" size="small" />
|
12
|
</setting-item>
|
12
|
</setting-item>
|
13
|
</setting-item-box>
|
13
|
</setting-item-box>
|
|
|
14
|
+ <setting-item-box name="上传文件">
|
|
|
15
|
+ <setting-item>
|
|
|
16
|
+ <FileUpload
|
|
|
17
|
+ :max="100"
|
|
|
18
|
+ :fileList="optionData.dataset"
|
|
|
19
|
+ :threeSupportFileFormat="threeSupportFileFormat"
|
|
|
20
|
+ :singleFileType="singleFileTypeNotMtl"
|
|
|
21
|
+ @fileStaticUri="handleFileStaticUri"
|
|
|
22
|
+ />
|
|
|
23
|
+ </setting-item>
|
|
|
24
|
+ </setting-item-box>
|
14
|
<setting-item-box :alone="true">
|
25
|
<setting-item-box :alone="true">
|
15
|
<template #name>
|
26
|
<template #name>
|
16
|
- <n-text>提示</n-text>
|
27
|
+ <n-text>mtl</n-text>
|
17
|
<n-tooltip trigger="hover">
|
28
|
<n-tooltip trigger="hover">
|
18
|
<template #trigger>
|
29
|
<template #trigger>
|
19
|
<n-icon size="21" :depth="3">
|
30
|
<n-icon size="21" :depth="3">
|
20
|
<help-outline-icon></help-outline-icon>
|
31
|
<help-outline-icon></help-outline-icon>
|
21
|
</n-icon>
|
32
|
</n-icon>
|
22
|
</template>
|
33
|
</template>
|
23
|
- <span class="help-span">{{ threeFileHelpMessgae }}</span>
|
34
|
+ <span class="help-span">{{ threeMtlHelpMessgae }}</span>
|
24
|
</n-tooltip>
|
35
|
</n-tooltip>
|
25
|
</template>
|
36
|
</template>
|
26
|
<FileUpload
|
37
|
<FileUpload
|
27
|
- :max="1"
|
|
|
28
|
- :fileList="[optionData.dataset]"
|
|
|
29
|
- :threeSupportFileFormat="threeSupportFileFormat"
|
|
|
30
|
- :singleFileType="singleFileTypeNotMtl"
|
|
|
31
|
- @fileStaticUri="handleFileStaticUri"
|
|
|
32
|
- />
|
|
|
33
|
- </setting-item-box>
|
|
|
34
|
- <setting-item-box name="mtl材质">
|
|
|
35
|
- <FileUpload
|
|
|
36
|
:fileList="optionData.mtlPath"
|
38
|
:fileList="optionData.mtlPath"
|
37
|
:max="100"
|
39
|
:max="100"
|
38
|
:threeSupportFileFormat="supportFileMtl"
|
40
|
:threeSupportFileFormat="supportFileMtl"
|
39
|
@fileStaticUri="handleFileMtlStaticUri"
|
41
|
@fileStaticUri="handleFileMtlStaticUri"
|
40
|
/>
|
42
|
/>
|
41
|
</setting-item-box>
|
43
|
</setting-item-box>
|
42
|
- <setting-item-box name="材质贴图">
|
44
|
+ <setting-item-box :alone="true">
|
|
|
45
|
+ <template #name>
|
|
|
46
|
+ <n-text>贴图</n-text>
|
|
|
47
|
+ <n-tooltip trigger="hover">
|
|
|
48
|
+ <template #trigger>
|
|
|
49
|
+ <n-icon size="21" :depth="3">
|
|
|
50
|
+ <help-outline-icon></help-outline-icon>
|
|
|
51
|
+ </n-icon>
|
|
|
52
|
+ </template>
|
|
|
53
|
+ <span class="help-span">{{ threeTextureHelpMessgae }}</span>
|
|
|
54
|
+ </n-tooltip>
|
|
|
55
|
+ </template>
|
43
|
<FileUpload
|
56
|
<FileUpload
|
44
|
:fileList="optionData.textureImage"
|
57
|
:fileList="optionData.textureImage"
|
45
|
:max="100"
|
58
|
:max="100"
|
|
@@ -47,6 +60,113 @@ |
|
@@ -47,6 +60,113 @@ |
47
|
@fileStaticUri="handleFileTextureImageStaticUri"
|
60
|
@fileStaticUri="handleFileTextureImageStaticUri"
|
48
|
/>
|
61
|
/>
|
49
|
</setting-item-box>
|
62
|
</setting-item-box>
|
|
|
63
|
+ <setting-item-box name="模型位置">
|
|
|
64
|
+ <setting-item name="模型位置坐标(x,y,z)">
|
|
|
65
|
+ <template v-for="(item, index) in optionData.position" :key="index">
|
|
|
66
|
+ <n-input-number v-model:value="item.x" size="small" />
|
|
|
67
|
+ <n-input-number v-model:value="item.y" size="small" />
|
|
|
68
|
+ <n-input-number v-model:value="item.z" size="small" />
|
|
|
69
|
+ </template>
|
|
|
70
|
+ </setting-item>
|
|
|
71
|
+ </setting-item-box>
|
|
|
72
|
+ <setting-item-box name="模型旋转">
|
|
|
73
|
+ <setting-item name="模型旋转坐标(x,y,z)">
|
|
|
74
|
+ <template v-for="(item, index) in optionData.rotation" :key="index">
|
|
|
75
|
+ <n-input-number v-model:value="item.x" size="small" />
|
|
|
76
|
+ <n-input-number v-model:value="item.y" size="small" />
|
|
|
77
|
+ <n-input-number v-model:value="item.z" size="small" />
|
|
|
78
|
+ </template>
|
|
|
79
|
+ </setting-item>
|
|
|
80
|
+ </setting-item-box>
|
|
|
81
|
+ <setting-item-box name="灯光配置">
|
|
|
82
|
+ <setting-item v-for="(item, index) in optionData.lights" :name="item.label" :key="index">
|
|
|
83
|
+ <n-color-picker
|
|
|
84
|
+ v-if="!includeHemisphereLight.includes(item.type)"
|
|
|
85
|
+ size="small"
|
|
|
86
|
+ :show-alpha="false"
|
|
|
87
|
+ v-model:value="item.color"
|
|
|
88
|
+ ></n-color-picker>
|
|
|
89
|
+ <n-color-picker
|
|
|
90
|
+ v-if="includeHemisphereLight.includes(item.type)"
|
|
|
91
|
+ size="small"
|
|
|
92
|
+ :show-alpha="false"
|
|
|
93
|
+ v-model:value="item.skyColor"
|
|
|
94
|
+ ></n-color-picker>
|
|
|
95
|
+ <n-color-picker
|
|
|
96
|
+ v-if="includeHemisphereLight.includes(item.type)"
|
|
|
97
|
+ size="small"
|
|
|
98
|
+ :show-alpha="false"
|
|
|
99
|
+ v-model:value="item.groundColor"
|
|
|
100
|
+ ></n-color-picker>
|
|
|
101
|
+ <template v-if="!includeAmbientLight.includes(item.type)">
|
|
|
102
|
+ <n-input-number v-model:value="item.position.x" size="small" />
|
|
|
103
|
+ <n-input-number v-model:value="item.position.y" size="small" />
|
|
|
104
|
+ <n-input-number v-model:value="item.position.z" size="small" />
|
|
|
105
|
+ </template>
|
|
|
106
|
+ <n-input-number
|
|
|
107
|
+ v-if="includeDirectionalLightAndPointLight.includes(item.type)"
|
|
|
108
|
+ v-model:value="item.intensity"
|
|
|
109
|
+ size="small"
|
|
|
110
|
+ />
|
|
|
111
|
+ </setting-item>
|
|
|
112
|
+ </setting-item-box>
|
|
|
113
|
+ <setting-item-box>
|
|
|
114
|
+ <SettingItem name="启用fps">
|
|
|
115
|
+ <n-switch v-model:value="optionData.showFps" size="small" />
|
|
|
116
|
+ </SettingItem>
|
|
|
117
|
+ </setting-item-box>
|
|
|
118
|
+ <setting-item-box name="label配置">
|
|
|
119
|
+ <setting-item v-for="(item, index) in optionData.labels" :key="index">
|
|
|
120
|
+ <div>
|
|
|
121
|
+ <span>文字</span>
|
|
|
122
|
+ <n-input
|
|
|
123
|
+ type="text"
|
|
|
124
|
+ placeholder="请输入"
|
|
|
125
|
+ size="small"
|
|
|
126
|
+ clearable
|
|
|
127
|
+ show-count
|
|
|
128
|
+ v-model:value="item.text"
|
|
|
129
|
+ ></n-input>
|
|
|
130
|
+ </div>
|
|
|
131
|
+ <div>
|
|
|
132
|
+ <span>位置</span>
|
|
|
133
|
+ <n-input-number v-model:value="item.position.x" size="small" />
|
|
|
134
|
+ <n-input-number v-model:value="item.position.y" size="small" />
|
|
|
135
|
+ <n-input-number v-model:value="item.position.z" size="small" />
|
|
|
136
|
+ </div>
|
|
|
137
|
+ <div>
|
|
|
138
|
+ <span>缩放</span>
|
|
|
139
|
+ <n-input-number v-model:value="item.scale.x" size="small" />
|
|
|
140
|
+ <n-input-number v-model:value="item.scale.y" size="small" />
|
|
|
141
|
+ <n-input-number v-model:value="item.scale.z" size="small" />
|
|
|
142
|
+ </div>
|
|
|
143
|
+ <div>
|
|
|
144
|
+ <span>文字样式</span>
|
|
|
145
|
+ <span>颜色</span>
|
|
|
146
|
+ <n-color-picker size="small" :show-alpha="false" v-model:value="item.textStyle.color"></n-color-picker>
|
|
|
147
|
+ <span>字体</span>
|
|
|
148
|
+ <n-input-number v-model:value="item.textStyle.fontSize" size="small" />
|
|
|
149
|
+ <span>行高</span>
|
|
|
150
|
+ <n-input-number v-model:value="item.textStyle.lineHeight" size="small" />
|
|
|
151
|
+ <span>背景颜色</span>
|
|
|
152
|
+ <n-color-picker
|
|
|
153
|
+ size="small"
|
|
|
154
|
+ :show-alpha="false"
|
|
|
155
|
+ v-model:value="item.textStyle.backgroundColor"
|
|
|
156
|
+ ></n-color-picker>
|
|
|
157
|
+ <span>边框颜色</span>
|
|
|
158
|
+ <n-color-picker size="small" :show-alpha="false" v-model:value="item.textStyle.borderColor"></n-color-picker>
|
|
|
159
|
+ <span>边框大小</span>
|
|
|
160
|
+ <n-input-number v-model:value="item.textStyle.borderWidth" size="small" />
|
|
|
161
|
+ <span>边框圆角</span>
|
|
|
162
|
+ <n-input-number v-model:value="item.textStyle.borderRadius" size="small" />
|
|
|
163
|
+ </div>
|
|
|
164
|
+ <div>
|
|
|
165
|
+ <n-button v-if="optionData.labels.length > 1" @click="optionData.labels.splice(index, 1)"> - </n-button>
|
|
|
166
|
+ </div>
|
|
|
167
|
+ </setting-item>
|
|
|
168
|
+ <n-button v-if="optionData.labels.length < 4" @click="optionData.labels.push(pushItem)"> + </n-button>
|
|
|
169
|
+ </setting-item-box>
|
50
|
<setting-item-box name="属性配置">
|
170
|
<setting-item-box name="属性配置">
|
51
|
<setting-item name="场景色(需要这种格式HEX #000000,否则失效)">
|
171
|
<setting-item name="场景色(需要这种格式HEX #000000,否则失效)">
|
52
|
<n-color-picker size="small" :show-alpha="false" v-model:value="optionData.backgroundColor"></n-color-picker>
|
172
|
<n-color-picker size="small" :show-alpha="false" v-model:value="optionData.backgroundColor"></n-color-picker>
|
|
@@ -91,9 +211,36 @@ const props = defineProps({ |
|
@@ -91,9 +211,36 @@ const props = defineProps({ |
91
|
}
|
211
|
}
|
92
|
})
|
212
|
})
|
93
|
|
213
|
|
|
|
214
|
+const pushItem = {
|
|
|
215
|
+ image: '',
|
|
|
216
|
+ text: '',
|
|
|
217
|
+ textStyle: {
|
|
|
218
|
+ fontFamily: 'Arial',
|
|
|
219
|
+ fontSize: 18,
|
|
|
220
|
+ fontWeight: 'normal',
|
|
|
221
|
+ lineHeight: 1,
|
|
|
222
|
+ color: '#ffffff',
|
|
|
223
|
+ borderWidth: 8,
|
|
|
224
|
+ borderRadius: 4,
|
|
|
225
|
+ borderColor: 'rgba(0,0,0,1)',
|
|
|
226
|
+ backgroundColor: 'rgba(0, 0, 0, 1)'
|
|
|
227
|
+ },
|
|
|
228
|
+ position: { x: 0, y: 0, z: 0 },
|
|
|
229
|
+ scale: { x: 1, y: 1, z: 0 },
|
|
|
230
|
+ sid: null
|
|
|
231
|
+}
|
|
|
232
|
+
|
|
|
233
|
+const includeHemisphereLight = ['HemisphereLight']
|
|
|
234
|
+
|
|
|
235
|
+const includeAmbientLight = ['AmbientLight']
|
|
|
236
|
+
|
|
|
237
|
+const includeDirectionalLightAndPointLight = ['DirectionalLight', 'PointLight']
|
|
|
238
|
+
|
94
|
const singleFileTypeNotMtl = ref('')
|
239
|
const singleFileTypeNotMtl = ref('')
|
95
|
|
240
|
|
96
|
-const threeFileHelpMessgae = ref('如果格式为obj,则上传顺序是,先上传材质贴图(png或jpg)、mtl材质文件,最后是obj')
|
241
|
+const threeMtlHelpMessgae = ref('mtl一般和obj搭配使用')
|
|
|
242
|
+
|
|
|
243
|
+const threeTextureHelpMessgae = ref('贴图目前支持jpg/png格式')
|
97
|
|
244
|
|
98
|
const threeSupportFileFormat = ['fbx', 'obj', 'gltf', 'stl', 'dae', 'glb', 'ply', 'json']
|
245
|
const threeSupportFileFormat = ['fbx', 'obj', 'gltf', 'stl', 'dae', 'glb', 'ply', 'json']
|
99
|
|
246
|
|
|
@@ -101,17 +248,21 @@ const supportFileMtl = ['mtl'] |
|
@@ -101,17 +248,21 @@ const supportFileMtl = ['mtl'] |
101
|
|
248
|
|
102
|
const supportFileTextureImage = ['jpg', 'png']
|
249
|
const supportFileTextureImage = ['jpg', 'png']
|
103
|
|
250
|
|
104
|
-const handleChange = (e: boolean) => {
|
|
|
105
|
- if (e) props.optionData.dataset = ''
|
|
|
106
|
-}
|
|
|
107
|
-
|
|
|
108
|
const encodinghList = [
|
251
|
const encodinghList = [
|
109
|
{ label: 'linear', value: 'linear' },
|
252
|
{ label: 'linear', value: 'linear' },
|
110
|
{ label: 'sRGB ', value: 'sRGB ' }
|
253
|
{ label: 'sRGB ', value: 'sRGB ' }
|
111
|
]
|
254
|
]
|
112
|
|
255
|
|
|
|
256
|
+const handleChange = (e: boolean) => {
|
|
|
257
|
+ if (e) props.optionData.dataset = ['']
|
|
|
258
|
+}
|
|
|
259
|
+
|
113
|
const handleFileStaticUri = (value: UploadFileInfo[]) => {
|
260
|
const handleFileStaticUri = (value: UploadFileInfo[]) => {
|
114
|
- props.optionData.dataset = value[0]?.url as string
|
261
|
+ props.optionData.dataset = value.map(item => item?.url)?.filter(Boolean) as any
|
|
|
262
|
+ if (Array.isArray(props.optionData.dataset) && props.optionData.dataset.length === 0) {
|
|
|
263
|
+ //filePath数组必须有值
|
|
|
264
|
+ props.optionData.dataset = ['demo.obj']
|
|
|
265
|
+ }
|
115
|
}
|
266
|
}
|
116
|
|
267
|
|
117
|
const handleFileMtlStaticUri = (value: UploadFileInfo[]) => {
|
268
|
const handleFileMtlStaticUri = (value: UploadFileInfo[]) => {
|