mirror of
https://gitee.com/ice-gl/icegl-three-vue-tres.git
synced 2025-04-05 06:22:43 +08:00
使用 GitHub Copilot 优化部分代码
This commit is contained in:
parent
4ae200299f
commit
0d42031a7e
12
.eslintrc.js
12
.eslintrc.js
@ -1,3 +1,11 @@
|
||||
/*
|
||||
* @Description:
|
||||
* @Version: 1.668
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2023-10-16 10:53:09
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-03-05 18:51:52
|
||||
*/
|
||||
module.exports = {
|
||||
extends: ['@webank/eslint-config-webank/vue.js'],
|
||||
overrides: [
|
||||
@ -24,7 +32,9 @@ module.exports = {
|
||||
'prettier/prettier': 'off',
|
||||
"vue/space-unary-ops": "off",
|
||||
"vue/comma-dangle": "off",
|
||||
"no-debugger": "off"
|
||||
"no-debugger": "off",
|
||||
// "semi": "off",
|
||||
// "init-declarations": "off",
|
||||
// "space-unary-ops": "off",
|
||||
// 'import/no-unresolved': [
|
||||
// 2,
|
||||
|
@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
...require("@webank/eslint-config-webank/.prettierrc.js"),
|
||||
...require("@webank/eslint-config-webank/.prettierrc.js")
|
||||
};
|
@ -16,12 +16,12 @@
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tweakpane/core": "^2.0.3",
|
||||
"@types/mapbox__tilebelt": "^1.0.4",
|
||||
"@types/offscreencanvas": "^2019.7.3",
|
||||
"@types/three": "0.161.1",
|
||||
"@webank/eslint-config-webank": "1.3.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"tweakpane": "4.0.3"
|
||||
"cross-env": "^7.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"3d-tiles-renderer": "^0.3.25",
|
||||
@ -56,6 +56,7 @@
|
||||
"three-mesh-bvh": "0.7.1",
|
||||
"three-subdivide": "^1.1.5",
|
||||
"tilebelt-wgs84": "^1.0.4",
|
||||
"tweakpane": "4.0.3",
|
||||
"unocss": "0.58.4",
|
||||
"vanta": "^0.5.24",
|
||||
"vue": "3.4.15"
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2024-01-05 09:23:48
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-01-06 09:14:24
|
||||
* @LastEditTime: 2024-03-05 18:51:05
|
||||
-->
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -16,7 +16,7 @@ import { Pane } from 'tweakpane'
|
||||
|
||||
const tcRef = ref()
|
||||
|
||||
const meshList = []
|
||||
const meshList = [] as number[]
|
||||
for (let index = 1; index < 30; index += 2) {
|
||||
meshList.push(index)
|
||||
}
|
||||
@ -34,7 +34,7 @@ const params = {
|
||||
|
||||
watchEffect(() => {
|
||||
if (tcRef.value) {
|
||||
let renderer = tcRef.value.context.renderer.value
|
||||
const renderer = tcRef.value.context.renderer.value
|
||||
renderer.localClippingEnabled = true
|
||||
}
|
||||
})
|
||||
@ -75,9 +75,9 @@ paneControl.addBinding(clipPlanes[2], 'constant', {
|
||||
<TresMesh v-for="i in meshList " :key="i">
|
||||
<TresSphereGeometry :args="[i / 30, 48, 24]" />
|
||||
<TresMeshLambertMaterial :color="[MathUtils.randInt(0.1, 1), MathUtils.randInt(0, 1), MathUtils.randInt(0, 1)]"
|
||||
:side="DoubleSide" :clippingPlanes="clipPlanes" :clipIntersection="params.clipIntersection" />
|
||||
:side="DoubleSide" :clippingPlanes="clipPlanes" :clipIntersection="params.clipIntersection"
|
||||
/>
|
||||
</TresMesh>
|
||||
</TresGroup>
|
||||
|
||||
</TresCanvas>
|
||||
</template>
|
||||
|
@ -3,8 +3,8 @@
|
||||
* @version:
|
||||
* @Author: Jsonco
|
||||
* @Date: 2023-11-29 20:09:06
|
||||
* @LastEditors: sueRimn
|
||||
* @LastEditTime: 2023-11-30 23:02:23
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-03-05 18:57:47
|
||||
-->
|
||||
<template>
|
||||
<TresMesh ref="MeshRef" :rotation="[Math.PI / 2, 0, 0]">
|
||||
@ -14,12 +14,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { TresCanvas, useRenderLoop, useTresContextProvider, useTresContext, useTexture } from '@tresjs/core';
|
||||
import { OrbitControls } from '@tresjs/cientos';
|
||||
import { AdditiveBlending, DoubleSide, Vector2, LinearFilter, RGBAFormat, WebGLRenderTarget, Color } from 'three';
|
||||
import { ref, watch, defineExpose, watchEffect } from 'vue';
|
||||
import stringVertex from '../shaders/rayMarching.vert?raw';
|
||||
import stringFrag from '../shaders/rayMarching.frag?raw';
|
||||
import { useRenderLoop } from '@tresjs/core'
|
||||
import { DoubleSide, Vector2 } from 'three'
|
||||
import { watchEffect } from 'vue'
|
||||
|
||||
import stringVertex from '../shaders/rayMarching.vert?raw'
|
||||
import stringFrag from '../shaders/rayMarching.frag?raw'
|
||||
const { onLoop, onAfterLoop } = useRenderLoop();
|
||||
const shader = {
|
||||
transparent: true,
|
||||
@ -44,14 +44,14 @@ const windowHalfX = window.innerWidth / 2;
|
||||
const windowHalfY = window.innerHeight / 2;
|
||||
let mouseX = 0;
|
||||
let mouseY = 0;
|
||||
function onMouseMove(e) {
|
||||
function onMouseMove(e: MouseEvent) {
|
||||
mouseX = e.clientX - windowHalfX;
|
||||
mouseY = e.clientY - windowHalfY;
|
||||
}
|
||||
document.addEventListener('mousemove', onMouseMove, false);
|
||||
watchEffect(() => {});
|
||||
onLoop(({ elapsed }) => {
|
||||
shader.uniforms.u_time.value += 0.001;
|
||||
onLoop(() => {
|
||||
shader.uniforms.u_time.value += 0.01;
|
||||
shader.uniforms.u_mouse.value = new Vector2(mouseX, mouseY);
|
||||
});
|
||||
onAfterLoop(() => {});
|
||||
|
@ -11,21 +11,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, onMounted } from 'vue';
|
||||
import { TresCanvas, useRenderLoop, useTexture } from '@tresjs/core';
|
||||
import { OrbitControls } from '@tresjs/cientos';
|
||||
import rayMarchingMaterial from '../components/rayMarchingMaterial.vue';
|
||||
import { Pane } from 'tweakpane';
|
||||
import axios from 'axios';
|
||||
import { TresCanvas } from '@tresjs/core'
|
||||
import { OrbitControls } from '@tresjs/cientos'
|
||||
|
||||
import rayMarchingMaterial from '../components/rayMarchingMaterial.vue'
|
||||
|
||||
const state = {
|
||||
clearColor: '#000000',
|
||||
shadows: true,
|
||||
alpha: false,
|
||||
useLegacyLights: true,
|
||||
};
|
||||
const controlsState = { autoRotate: false, enableDamping: true };
|
||||
const controlsState = { autoRotate: false, enableDamping: true }
|
||||
|
||||
const { onLoop } = useRenderLoop();
|
||||
onLoop(({ delta }) => {});
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
@ -1,3 +1,11 @@
|
||||
<!--
|
||||
* @Description:
|
||||
* @Version: 1.668
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2024-03-05 12:42:04
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-03-05 18:53:47
|
||||
-->
|
||||
<template>
|
||||
<TresCanvas v-bind="state" window-size>
|
||||
<TresPerspectiveCamera :position="[0, 12, 0]" :fov="75" :near="0.1" :far="1000" />
|
||||
@ -7,10 +15,6 @@
|
||||
<TresDirectionalLight :position="[0, 10, -5]" :intensity="0.2" />
|
||||
<TresDirectionalLight :position="[5, 10, 0]" :intensity="0.2" />
|
||||
<TresDirectionalLight :position="[-5, 10, 0]" :intensity="0.2" />
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <TresGridHelper /> -->
|
||||
<Suspense>
|
||||
<jiangSuMapMesh />
|
||||
|
@ -1,7 +1,15 @@
|
||||
<!--
|
||||
* @Description:
|
||||
* @Version: 1.668
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2024-02-29 18:51:13
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-03-05 18:54:09
|
||||
-->
|
||||
|
||||
<template>
|
||||
<TresCanvas v-bind="state" window-size>
|
||||
<TresPerspectiveCamera :position="mapCenter" :fov="60" :near="1" :far="1e8" :up="[0, 0, 1]" />
|
||||
<TresPerspectiveCamera :position="new THREE.Vector3(mapCenter[0], mapCenter[1], mapCenter[2])" :fov="60" :near="1" :far="1e8" :up="[0, 0, 1]" />
|
||||
|
||||
<TresAmbientLight color="#ffffff" />
|
||||
<TresDirectionalLight :position="[100, 100, 0]" :intensity="0.5" color="#ffffff" />
|
||||
|
@ -4,12 +4,11 @@
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2024-02-24 10:03:05
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2024-02-29 11:52:57
|
||||
* @LastEditTime: 2024-03-05 18:03:12
|
||||
-->
|
||||
<template>
|
||||
<TresCanvas v-bind="state" window-size>
|
||||
<TresPerspectiveCamera :position="mapCenter" :fov="60" :near="1" :far="1e8" :look-at="[mapCenter[0], mapCenter[1], 0]"
|
||||
:up="[0, 0, 1]" />
|
||||
<TresPerspectiveCamera :position="new THREE.Vector3(mapCenter[0], mapCenter[1], mapCenter[2])" :fov="60" :near="1" :far="1e8" :look-at="[mapCenter[0], mapCenter[1], 0]" :up="[0, 0, 1]" />
|
||||
<Suspense>
|
||||
<tileMapMesh :bbox="[104.955976, 20.149765, 120.998419, 30.528687]" />
|
||||
</Suspense>
|
||||
|
@ -15,7 +15,7 @@
|
||||
"moduleResolution": "node",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitReturns": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"ignoreDeprecations": "5.0",
|
||||
"noUnusedLocals": true,
|
||||
"allowJs": true,
|
||||
"experimentalDecorators": true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user