1、着色器的文件引用

2、依赖库版本升级
This commit is contained in:
hawk86104 2023-11-17 09:25:00 +08:00
parent 01921d3295
commit 0d207c4306
7 changed files with 512 additions and 383 deletions

View File

@ -4,7 +4,7 @@
* @Autor: 地虎降天龙
* @Date: 2023-10-16 10:53:09
* @LastEditors: 地虎降天龙
* @LastEditTime: 2023-11-16 09:46:17
* @LastEditTime: 2023-11-17 09:11:22
*/
// import { resolve } from 'path';
import { join } from 'path';
@ -35,7 +35,7 @@ export default defineBuildConfig({
...templateCompilerOptions,
},
viteOption: {
base: "./", // /icegl-three-vue-tres/
base: "./",
plugins: [
UnoCSS({
/* options */

View File

@ -46,11 +46,9 @@ ThreeJS大名鼎鼎的基于浏览器渲染JavaScript语言的3D库。
<a href="https://www.npmjs.com/package/@fesjs/fes">
<img src="https://img.shields.io/npm/v/%40fesjs%2Ffes?label=%40fesjs%2Ffes">
</a><br/>
集成封装项目落地的常用库图标、多语言、API接口调用、Vuex/Pinia、model数据封装、页面layout/权限access、路由管理等。
- 🌠 像写Vue3.x一样写三维可视化项目[点击详情](https://tresjs.org/guide)
- 🌠 像写Vue3.x一样写三维可视化项目[点击详情](https://tresjs.org/guide)<br/>
全功能版本追溯保持threeJS最新版本 * TresJS
最新Vue3.x的语法糖写法TS/JS通吃让你以最新最爽快的方式构建三维可视化项目
@ -74,8 +72,7 @@ ThreeJS大名鼎鼎的基于浏览器渲染JavaScript语言的3D库。
})
</script>
```
- 🧩 丰富的插件应用市场
- 🧩 丰富的插件应用市场<br/>
插件中心包含各式各样的项目场景和功能。插件是ICE社区生态中重要的一环在应用市场中完整应用和普通插件统一称为插件。
### 我们将会逐一把落地的项目以插件的形式加入到此开源框中...

View File

@ -20,23 +20,23 @@
},
"dependencies": {
"@fesjs/builder-vite": "^3.0.3",
"@fesjs/fes": "^3.0.0",
"@fesjs/fes": "^3.1.5",
"@fesjs/fes-design": "^0.8.10",
"@fesjs/plugin-access": "^3.0.0",
"@fesjs/plugin-enums": "^3.0.0",
"@fesjs/plugin-layout": "^5.0.0",
"@fesjs/plugin-model": "^3.0.0",
"@tresjs/cientos": "^3.6.0",
"@tresjs/core": "^3.4.1",
"@tresjs/core": "^3.5.0",
"cannon-es": "^0.20.0",
"core-js": "^3.29.1",
"gsap": "^3.12.2",
"heatmap.js-fix": "^1.0.0",
"three": "^0.157.0",
"three": "^0.158.0",
"unocss": "^0.56.5",
"vanta": "^0.5.24",
"vite-plugin-glsl": "^1.1.2",
"vue": "^3.2.47"
},
"private": true
}
}

View File

@ -4,7 +4,7 @@
* @Autor: 地虎降天龙
* @Date: 2023-11-14 10:06:40
* @LastEditors: 地虎降天龙
* @LastEditTime: 2023-11-14 16:30:45
* @LastEditTime: 2023-11-17 08:35:33
-->
<template>
<TresMesh ref="TresMeshRef">
@ -16,8 +16,8 @@
<script setup lang="ts">
import * as THREE from 'three'
import { useTexture, useRenderLoop, useTresContext } from '@tresjs/core'
// import xRayVertex from '../shaders/xRay.vert';
// import xRayFrag from '../shaders/xRay.frag';
import xRayVertex from '../shaders/xRay.vert?raw';
import xRayFrag from '../shaders/xRay.frag?raw';
import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js';
import { ref, watchEffect } from 'vue';
@ -30,37 +30,6 @@ const props = withDefaults(defineProps<{
opacity: 1.0,
})
const xRayVertex = `
uniform float c;
uniform float p;
uniform float uTime;
varying float intensity;
varying vec2 vUv;
void main(){
vUv = uv;
vec3 vNormal = normalize( normalMatrix * normal );
intensity = pow(c - abs(dot(vNormal, vec3(0, 0, 1))), p);
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
`
const xRayFrag = `
uniform vec3 glowColor;
uniform sampler2D lightningTexture;
varying float intensity;
varying vec2 vUv;
uniform float offsetY;
uniform float uTime;
uniform float uOpacity;
void main(){
vec2 uv=vUv;
uv.y+=offsetY;
vec3 glow=glowColor*intensity;
vec3 color=vec3(step(.1,uv.y)-step(.2,uv.y))-vec3(texture2D(lightningTexture,uv));
float alpha=clamp(cos(uTime*3.),.5,1.);
gl_FragColor=vec4(glow+color,alpha*uOpacity);
}
`
const TresMeshRef = ref()
const brainBufferGeometries = [] as Array<THREE.BufferGeometry>
props.model.traverse((child) => {

View File

@ -4,6 +4,7 @@ varying float intensity;
varying vec2 vUv;
uniform float offsetY;
uniform float uTime;
uniform float uOpacity;
void main(){
vec2 uv=vUv;
@ -11,5 +12,5 @@ void main(){
vec3 glow=glowColor*intensity;
vec3 color=vec3(step(.1,uv.y)-step(.2,uv.y))-vec3(texture2D(lightningTexture,uv));
float alpha=clamp(cos(uTime*3.),.5,1.);
gl_FragColor=vec4(glow+color,alpha);
gl_FragColor=vec4(glow+color,alpha*uOpacity);
}

View File

@ -1,14 +1,11 @@
uniform vec3 viewVector;
uniform float c;
uniform float p;
uniform float uTime;
varying float intensity;
varying vec2 vUv;
void main(){
vUv=uv;
vec3 vNormal=normalize(normalMatrix*normal);
vec3 vNormel=normalize(normalMatrix*viewVector);
intensity=pow(c-abs(dot(vNormal,vec3(0,0,1))),p);
gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);
}

833
yarn.lock

File diff suppressed because it is too large Load Diff