main
wangqiujuan0808 2023-12-15 11:11:54 +08:00
parent cd8fe06628
commit 0271ed9129
2 changed files with 141330 additions and 240166 deletions

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { onMounted, ref,watch } from 'vue'; import { onMounted, ref, watch } from 'vue';
import * as THREE from 'three'; import * as THREE from 'three';
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js"; import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
@ -39,6 +39,12 @@ onMounted(() => {
renderScene(); renderScene();
// //
document.addEventListener('click', onMouseDown); document.addEventListener('click', onMouseDown);
//
window.addEventListener('contextmenu', function (e) {
if (e.button === 2) {
console.log("点击了鼠标右键");
}
});
// document.addEventListener("mousemove", onMouseMove); // document.addEventListener("mousemove", onMouseMove);
}); });
let scene, renderer, camera, controls, pointsArr = true; let scene, renderer, camera, controls, pointsArr = true;
@ -50,7 +56,7 @@ const data = reactive({
isAddLabel: true, isAddLabel: true,
isRemoveBottom: true isRemoveBottom: true
}); });
const { isAddLabel,isRemoveBottom } = toRefs(data); const { isAddLabel, isRemoveBottom } = toRefs(data);
// //
Bus.on('clickBuild', (isParent) => { Bus.on('clickBuild', (isParent) => {
// Todo // Todo
@ -92,7 +98,7 @@ watch(() => bimStore().activateMenu, value => {
// //
scene.background = new THREE.Color(value.background); scene.background = new THREE.Color(value.background);
toHomeView(); toHomeView();
},{ deep: true }); }, { deep: true });
const init = () => { const init = () => {
// //
@ -117,7 +123,7 @@ const loadSence = () => {
const dracoLoader = new DRACOLoader(); const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath('/draco/gltf/')// dracoLoader.setDecoderPath('/draco/gltf/')//
gltfLoader.setDRACOLoader(dracoLoader) gltfLoader.setDRACOLoader(dracoLoader)
gltfLoader.load('/jzc/scene3.gltf', (gltf) => { gltfLoader.load('/jzc/scene.gltf', (gltf) => {
var model = gltf.scene; var model = gltf.scene;
roamdObjects = model.children[0].children; roamdObjects = model.children[0].children;
scene.add(model); scene.add(model);
@ -386,9 +392,9 @@ const removeLabel = () => {
// //
const setBottom = () => { const setBottom = () => {
var target = scene.getObjectByName('set1'); var target = scene.getObjectByName('floor2F');
console.log(target);
if (isRemoveBottom.value) { if (isRemoveBottom.value) {
var target = scene.getObjectByName('set1');
target.visible = false; target.visible = false;
} else { } else {
target.visible = true; target.visible = true;