diff --git a/.env b/.env index 431ad27f..99e6cbd3 100644 --- a/.env +++ b/.env @@ -2,4 +2,4 @@ FES_APP_PLUGINS=false # 自动替换默认目录为插件的preview.vue -FES_APP_PREINDEX=false \ No newline at end of file +FES_APP_PREINDEX=false diff --git a/.env.predev b/.env.predev index 67836a8a..1cc4acd4 100644 --- a/.env.predev +++ b/.env.predev @@ -2,4 +2,4 @@ FES_APP_PLUGINS=true # 自动替换默认目录为插件的preview.vue -FES_APP_PREINDEX=true \ No newline at end of file +FES_APP_PREINDEX=true diff --git a/.eslintrc.js b/.eslintrc.js index d9949c07..35f29902 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,7 @@ * @Autor: 地虎降天龙 * @Date: 2023-10-16 10:53:09 * @LastEditors: 地虎降天龙 - * @LastEditTime: 2024-03-05 18:51:52 + * @LastEditTime: 2024-03-07 10:07:04 */ module.exports = { extends: ['@webank/eslint-config-webank/vue.js'], @@ -36,11 +36,11 @@ module.exports = { // "semi": "off", // "init-declarations": "off", // "space-unary-ops": "off", - // 'import/no-unresolved': [ - // 2, - // { - // ignore: ['^@/', 'PLS'], // 设置的路径别名 - // }, - // ], + 'import/no-unresolved': [ + 2, + { + ignore: ['^@/', 'PLS'], // 设置的路径别名 + }, + ], }, }; diff --git a/.fes.js b/.fes.js index 031d1a7e..6fe13068 100644 --- a/.fes.js +++ b/.fes.js @@ -4,14 +4,14 @@ * @Autor: 地虎降天龙 * @Date: 2023-10-16 10:53:09 * @LastEditors: 地虎降天龙 - * @LastEditTime: 2024-01-04 10:35:21 + * @LastEditTime: 2024-03-07 10:19:54 */ // import { resolve } from 'path'; import { join } from 'path'; -import { defineBuildConfig, someApi, plugin, ApplyPluginsType } from '@fesjs/fes'; -import { templateCompilerOptions } from '@tresjs/core'; -import UnoCSS from 'unocss/vite'; -// import glsl from 'vite-plugin-glsl'; +import { defineBuildConfig } from '@fesjs/fes' +import { templateCompilerOptions } from '@tresjs/core' +import UnoCSS from 'unocss/vite' +import glsl from 'vite-plugin-glsl' export default defineBuildConfig({ title: 'TvT.js', @@ -41,7 +41,7 @@ export default defineBuildConfig({ UnoCSS({ /* options */ }), - // glsl(), + glsl() ], server: { host: "0.0.0.0" diff --git a/index.html b/index.html index 34868378..0dc1c7b4 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,11 @@ + diff --git a/package.json b/package.json index 0ceb571f..d164afe9 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "@types/offscreencanvas": "^2019.7.3", "@types/three": "0.161.1", "@webank/eslint-config-webank": "1.3.1", - "cross-env": "^7.0.3" + "cross-env": "^7.0.3", + "vite-plugin-glsl": "0.2.2" }, "dependencies": { "3d-tiles-renderer": "^0.3.25", diff --git a/src/common/vite-plugin-glsl-ext.d.ts b/src/common/vite-plugin-glsl-ext.d.ts new file mode 100644 index 00000000..5e5f5a7c --- /dev/null +++ b/src/common/vite-plugin-glsl-ext.d.ts @@ -0,0 +1,73 @@ +/* + * @Description: + * @Version: 1.668 + * @Autor: 地虎降天龙 + * @Date: 2024-03-07 10:27:42 + * @LastEditors: 地虎降天龙 + * @LastEditTime: 2024-03-07 10:27:53 + */ +/** + * @const + * @readonly + * @kind module + * @description Generic shaders + */ +declare module '*.glsl' { + const shader: string; + export default shader; +} + +/** + * @const + * @readonly + * @kind module + * @description WebGPU shaders + */ +declare module '*.wgsl' { + const shader: string; + export default shader; +} + +/** + * @const + * @readonly + * @kind module + * @description Vertex shaders + */ +declare module '*.vert' { + const shader: string; + export default shader; +} + +/** + * @const + * @readonly + * @kind module + * @description Fragment shaders + */ +declare module '*.frag' { + const shader: string; + export default shader; +} + +/** + * @const + * @readonly + * @kind module + * @description Vertex shaders + */ +declare module '*.vs' { + const shader: string; + export default shader; +} + +/** + * @const + * @readonly + * @kind module + * @description Fragment shaders + */ +declare module '*.fs' { + const shader: string; + export default shader; +} \ No newline at end of file diff --git a/src/plugins/digitalCity/components/buildings/buildingsModelCustomShader.vue b/src/plugins/digitalCity/components/buildings/buildingsModelCustomShader.vue index 1be28726..806975d2 100644 --- a/src/plugins/digitalCity/components/buildings/buildingsModelCustomShader.vue +++ b/src/plugins/digitalCity/components/buildings/buildingsModelCustomShader.vue @@ -4,8 +4,8 @@ import { useRenderLoop } from '@tresjs/core' // import { CustomShaderMaterial } from '@tresjs/cientos' import CustomShaderMaterial from 'three-custom-shader-material/vanilla' import { ref, watchEffect, watch } from 'vue'; -import vertexShader from '../../shaders/buildingsCustomShaderMaterial.vert?raw' -import fragmentShader from '../../shaders/buildingsCustomShaderMaterial.frag?raw' +import vertexShader from '../../shaders/buildingsCustomShaderMaterial.vert' +import fragmentShader from '../../shaders/buildingsCustomShaderMaterial.frag' import * as THREE from 'three' const props = withDefaults(defineProps<{ model: any @@ -34,7 +34,7 @@ const setColorMaterial = (type: any, param: string) => { } else if (type === 'land') { // 设置城市地面(mesh物体),材质基本颜色 materials = Array.isArray(LANDMASS.material) ? LANDMASS.material : [LANDMASS.material] - materials.forEach((material) => { + materials.forEach((material:any) => { material[param].setStyle(props.landColor); material.side = THREE.DoubleSide //双面渲染 }) @@ -77,7 +77,6 @@ const setEffectMaterial = () => { value: props.gradient } }, - depthWrite: true, depthTest: true, transparent: true, //如果材质透明,那么楼宇就被渲染到后面了 diff --git a/src/plugins/floor/pages/reflectorDiffuse.vue b/src/plugins/floor/pages/reflectorDiffuse.vue index 45d67499..f40ff5da 100644 --- a/src/plugins/floor/pages/reflectorDiffuse.vue +++ b/src/plugins/floor/pages/reflectorDiffuse.vue @@ -4,7 +4,7 @@ * @Autor: 地虎降天龙 * @Date: 2023-12-22 08:09:35 * @LastEditors: 地虎降天龙 - * @LastEditTime: 2023-12-25 11:31:18 + * @LastEditTime: 2024-03-07 10:12:27 -->