diff --git a/.inscode b/.inscode
index 9fec9576d482baaf90d2f47230ce9133cfce99d4..661e4aad005ca91e1bcc2f8e07d5c8293d0d1744 100644
--- a/.inscode
+++ b/.inscode
@@ -11,4 +11,4 @@ XDG_CONFIG_HOME = "/root/.config"
npm_config_prefix = "/root/${PROJECT_DIR}/.config/npm/node_global"
[debugger]
-program = "main.js"
+program = "npm run preview"
diff --git a/package.json b/package.json
index 97f16e6e753b70448dc32306c7ec5f294e2d5aff..f1e7954d0ee7207e1a1ead583c9b5e31813f5c77 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"dependencies": {
"guess": "^1.0.2",
"three": "^0.157.0",
+ "view-ui-plus": "^1.3.14",
"vue": "^3.2.37"
},
"devDependencies": {
diff --git a/src/assets/base.css b/src/assets/base.css
index 71dc55a3cb5a72589496743a327c738ead3e1c83..ab87f3b57cb06bc0eecdbac0ab3314f9fb09e496 100644
--- a/src/assets/base.css
+++ b/src/assets/base.css
@@ -60,7 +60,6 @@
}
body {
- min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
diff --git a/src/assets/main.css b/src/assets/main.css
index 393b94234655048b373f2e5d41aae737207b5e63..7c224453879e20060852f1f4721b36cd790d2509 100644
--- a/src/assets/main.css
+++ b/src/assets/main.css
@@ -1,9 +1,19 @@
@import "./base.css";
-
+html {
+ width: 100%;
+ height: 100vh;
+}
+body {
+ display: flex;
+ place-items: center;
+ width: 100%;
+ height: 100%;
+}
#app {
- max-width: 1280px;
margin: 0 auto;
font-weight: normal;
+ width: 100%;
+ height: 100%;
}
a,
@@ -23,11 +33,32 @@ a,
body {
display: flex;
place-items: center;
+ width: 100%;
+ height: 100%;
}
#app {
display: grid;
- grid-template-columns: 1fr 1fr;
- padding: 0 2rem;
+ /* grid-template-columns: 1fr 1fr; */
+ width: 100%;
+ height: 100%;
}
}
+
+.flex-row {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+}
+.flex-col {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+.flex-1 {
+ flex: 1;
+}
+
+::-webkit-scrollbar {
+ display: none;
+}
diff --git a/src/main.js b/src/main.js
index 90e6400b4d8ad8aba0c1caa53874eb4b81380648..492900d78f1a206f06c805ae37cd4cad9c9ad519 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,6 +1,9 @@
import { createApp } from 'vue'
import App from './App.vue'
-
+import ViewUIPlus from 'view-ui-plus'
+import 'view-ui-plus/dist/styles/viewuiplus.css'
import './assets/main.css'
-createApp(App).mount('#app')
+createApp(App)
+ .use(ViewUIPlus)
+ .mount('#app')
diff --git a/src/threejs-tools.js b/src/threejs-tools.js
index 7d30d969ee7f4798eaf565180e16d9730806cd3e..24dcdd14d1de0965b2942a2e51f9e2024b1c92af 100644
--- a/src/threejs-tools.js
+++ b/src/threejs-tools.js
@@ -6,15 +6,11 @@ export class ThreejsDefault {
constructor(container) {
// init scene camera
this.scene = new THREE.Scene()
- this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000)
- this.camera.position.z = 5
-
+ this.scene.add(new THREE.GridHelper(100, 100, 0x660000, 0x004400))
+
// init renderer
this.renderer = new THREE.WebGLRenderer()
- this.renderer.setSize(window.innerWidth, window.innerHeight)
- // init controls
- this.controls = new OrbitControls(this.camera, this.renderer.domElement);
this.animateFuncs = []
const animate = () => {
@@ -25,6 +21,12 @@ export class ThreejsDefault {
onMounted(() => {
container.value.appendChild(this.renderer.domElement)
+ this.renderer.setSize(container.value.clientWidth, container.value.clientHeight)
+
+ this.camera = new THREE.PerspectiveCamera(60, container.value.clientWidth / container.value.clientHeight, 0.1, 1000)
+ this.camera.position.set(0, 10, 10)
+ this.controls = new OrbitControls(this.camera, this.renderer.domElement);
+
animate()
})
}
@@ -34,3 +36,16 @@ export class ThreejsDefault {
this.animateFuncs.push(animFunc)
}
}
+
+export function createPlane(w = 10, h = 10, position = [0, .1, 0], rotation = [90, 0, 0]) {
+ const material = new THREE.MeshLambertMaterial({
+ color: 0x88888888,
+ side: THREE.DoubleSide,
+ // wireframe: true,
+ })
+ const geometry = new THREE.PlaneGeometry(w, h)
+ const mesh = new THREE.Mesh(geometry, material)
+ mesh.position.set(...position)
+ mesh.rotation.set(...rotation.map(deg => deg / 180 * Math.PI))
+ return mesh
+}
diff --git a/src/views/basic.vue b/src/views/basic.vue
index 8139b7c533abfb3753d2e7ff382c464bc0db25aa..e9a91318c75c23bd3f0f5711ad2f1b9f0dab6f15 100644
--- a/src/views/basic.vue
+++ b/src/views/basic.vue
@@ -1,9 +1,29 @@
-
+
+
+
+ 环境光
+
+
+
+ 平行光
+
+
+
+ 点光源
+
+
+
+ 聚光灯
+
+
+
+
+