Commit 9b8fb20a authored by 王晓旭's avatar 王晓旭

修改模型代码,代理修改

parent 1d2dc919
# Draco 3D Data Compression
Draco is an open-source library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
[Website](https://google.github.io/draco/) | [GitHub](https://github.com/google/draco)
## Contents
This folder contains three utilities:
* `draco_decoder.js` — Emscripten-compiled decoder, compatible with any modern browser.
* `draco_decoder.wasm` — WebAssembly decoder, compatible with newer browsers and devices.
* `draco_wasm_wrapper.js` — JavaScript wrapper for the WASM decoder.
Each file is provided in two variations:
* **Default:** Latest stable builds, tracking the project's [master branch](https://github.com/google/draco).
* **glTF:** Builds targeted by the [glTF mesh compression extension](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression), tracking the [corresponding Draco branch](https://github.com/google/draco/tree/gltf_2.0_draco_extension).
Either variation may be used with `THREE.DRACOLoader`:
```js
var dracoLoader = new THREE.DRACOLoader();
dracoLoader.setDecoderPath('path/to/decoders/');
dracoLoader.setDecoderConfig({type: 'js'}); // (Optional) Override detection of WASM support.
```
Further [documentation on GitHub](https://github.com/google/draco/tree/master/javascript/example#static-loading-javascript-decoder).
## License
[Apache License 2.0](https://github.com/google/draco/blob/master/LICENSE)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -285,7 +285,7 @@ export default {
}).then(
(res)=>{
this.floorArr = res.data.floorArr
console.log('resres',this.floorArr);
// console.log('resres',this.floorArr);
}
)
},
......@@ -298,7 +298,7 @@ export default {
const { code, data } = res;
if (code == 1 && data.data.length > 0) {
this.centerTop = data.data[0];
console.log(this.centerTop);
// console.log(this.centerTop);
}
});
},
......@@ -386,6 +386,29 @@ export default {
(res) => {
const { code, data } = res;
if (code == 1) {
// data[].device.deviceCode = 'C0-FB-F9-CD-3B-BD'
// data.push({
// alarmTime:1719883720000,
// alarmTypeStr:'离线',
// device:{
// deviceCode:'C8-A2-CE-00-92-5C',
// deviceMac:'C8-A2-CE-00-92-5C',
// hallName:'税务综合大厅',
// deviceName:'1B12'
// },
// position:{x: -16.522071838378906, y: -0.702695369720459, z: -8.177206993103027}
// })
// data.push({
// alarmTime:1719883720000,
// alarmTypeStr:'离线',
// device:{
// deviceCode:'C0-F5-35-49-EA-1A',
// deviceMac:'C0-F5-35-49-EA-1A',
// hallName:'测试综合大厅',
// deviceName:'2B12'
// },
// position:{x: 18.33188819885254, y: 0.9361647963523865, z: -2.5282468795776367}
// })
this.Statlist = data || [];
if (data.length) {
let arr = data.map((v) => {
......
......@@ -68,6 +68,7 @@ import {
CSS2DRenderer,
CSS2DObject,
} from "three/examples/jsm/renderers/CSS2DRenderer";
import {DRACOLoader} from 'three/examples/jsm/loaders/DRACOLoader.js'
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
......@@ -157,6 +158,7 @@ export default {
// console.log(keyobj,winName,keyobj[winName])
if (keyobj[winName]) {
const { x, y, z } = keyobj[winName].positions;
console.log(x,y,z);
Tips.position.set(x, y, z); //文字地址
Tips.visible = true;
// camera.position.x = x*0.5;
......@@ -337,7 +339,7 @@ export default {
// alert(this.$el.offsetHeight)
let screenW = this.$el.offsetWidth;
let screenH = this.$el.offsetHeight;
camera = new THREE.PerspectiveCamera(25, screenW / screenH, 0.01, 20000);
camera = new THREE.PerspectiveCamera(4, screenW / screenH, 0.01, 20000);
this._initCamera();
camera.lookAt(scene.position);
......@@ -409,7 +411,7 @@ export default {
counter.appendChild(renderer.domElement);
},
_Light() {
ambientLight = new THREE.AmbientLight(0xffffff, 1);
ambientLight = new THREE.AmbientLight(0xffffff, 0.2);
ambientLight.position.set(0, 0, 0);
scene.add(ambientLight);
directionalLight = new THREE.DirectionalLight(0xffffff, 1);
......@@ -423,6 +425,8 @@ export default {
},
_3Dloder() {
let _this = this;
let dracoLoader=new DRACOLoader();
dracoLoader.setDecoderPath('/draco/gltf/');
let MTLLoaders = new MTLLoader();
let OBJLoaders = new OBJLoader();
let GLTFLoaders = new GLTFLoader();
......@@ -455,27 +459,32 @@ export default {
});
});
} else if (obj.search(/.gltf/i) >= 0) {
GLTFLoaders.setDRACOLoader(dracoLoader);
GLTFLoaders.load(obj, function(obj) {
// console.log(obj,'@@@@@@@');
const children = obj.scene.children[0].children;
const positionY = (iterator - 1.7) * 200;
// const children = obj.scene.children[0].children;
const children = obj.scene.children;
// const positionY = (iterator - 1.7) * 200;
const positionY = (iterator - 1.7) * 50;
children.forEach((element) => {
let objname = element.name;
console.log('objname',objname,iterator);
// mac地址模型
if (objname.length > 12) {
// console.log(objname,"#######",iterator);
try {
// console.log(objname,"#######");
// 获取外部模型具体点击位置 obj模型没有位置
element.geometry.computeBoundingSphere();
// element.geometry.computeBoundingSphere();
// 球体中心点
let realPosition = element.geometry.boundingSphere.center;
// let realPosition = element.geometry.boundingSphere.center;
element["positions"] = JSON.parse(
JSON.stringify(realPosition)
// JSON.stringify(realPosition)
JSON.stringify(element.position)
);
element["positions"].y = positionY;
element["positions"].y = positionY+element["positions"].y+2;
keyobj[objname] = element;
// console.log(keyobj);
} catch (error) {}
}
});
......
......@@ -16,7 +16,7 @@ module.exports = {
port: 8085,
hot: true, //自动保存
proxy: {
"/m": {
"/m/": {
target: "http://192.168.0.98:11078",
//target: 'http://127.0.0.1:18222',
changeOrigin: true,
......@@ -27,13 +27,13 @@ module.exports = {
//target: 'http://127.0.0.1:18222',
changeOrigin: true,
},
// "/module": {
// target: "http://192.168.0.98:11091",
// changeOrigin: true,
// // pathRewrite:{
// // '^/dd': ''
// // }
// },
"/module/": {
target: "http://192.168.0.98:11091",
changeOrigin: true,
// pathRewrite:{
// '/lc': ''
// }
},
},
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment