|
@@ -433,7 +433,7 @@
|
|
|
let scene = new THREE.Scene();
|
|
|
// 初始化摄像机
|
|
|
let camera = new THREE.PerspectiveCamera(10, mwidth / mheight, 1, 1000000);
|
|
|
- camera.position.set(0, 101120, 101120);
|
|
|
+ camera.position.set(90000, 41120, 81120);
|
|
|
camera.lookAt(new THREE.Vector3(0, 0, 0));
|
|
|
let renderer = new THREE.WebGLRenderer({
|
|
|
canvas: document.getElementById("canvas-model-view"),
|
|
@@ -447,6 +447,8 @@
|
|
|
renderer.setSize(mwidth, mheight);
|
|
|
// 设置渲染编码为 RGB 模式编码
|
|
|
renderer.outputEncoding = THREE.sRGBEncoding;
|
|
|
+ renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
|
+ renderer.toneMappingExposure = 0.6;
|
|
|
|
|
|
// 2D 文字渲染
|
|
|
let css2Renderer = new THREE.CSS2DRenderer();
|
|
@@ -472,7 +474,7 @@
|
|
|
// scene.add(directionalLight3);
|
|
|
|
|
|
// 环境光
|
|
|
- let ambient = new THREE.AmbientLight(0xc7c7c7, .1);
|
|
|
+ let ambient = new THREE.AmbientLight(0xffffff, .1);
|
|
|
scene.add(ambient);
|
|
|
|
|
|
// 加载模型文件
|
|
@@ -487,14 +489,14 @@
|
|
|
console.log(obj);
|
|
|
obj.scene.traverse(function (child) {
|
|
|
if (child.isMesh) {
|
|
|
- console.log(child.name);
|
|
|
// child.material.envMap = undefined;
|
|
|
child.frustumCulled = false;
|
|
|
child.castShadow = true;
|
|
|
child.material.emissive = child.material.color;
|
|
|
child.material.emissiveMap = child.material.map;
|
|
|
child.material.transparent = true;
|
|
|
- // child.material.color.set(0xd2d2d2);
|
|
|
+ // child.material.opacity = 0.8;
|
|
|
+ // child.material.color = 0xd2d2d2;
|
|
|
if (child.name) {
|
|
|
const div = document.createElement('div');
|
|
|
div.id = child.uuid;
|
|
@@ -580,13 +582,13 @@
|
|
|
const div = document.createElement('div');
|
|
|
div.id = child.uuid;
|
|
|
let html = '';
|
|
|
- html += '<div style="font-size: 12px; width: 120px; text-align: center;">';
|
|
|
+ html += '<div style="font-size: 12px; width: 80px; text-align: center;">';
|
|
|
html += '<div class="building-text" style="background: #18A65A; margin-bottom: -2px;">';
|
|
|
html += '<span style="text-align: left;">停车场</span>';
|
|
|
html += '<span style="font-size: 10px; text-align: left;">空余车位:-</span>';
|
|
|
html += '<span style="font-size: 10px; text-align: left;">空余充电桩:-</span>';
|
|
|
html += '</div>';
|
|
|
- html += '<svg width="20" height="20"><polygon id="triangle" points="0,0 20,0 1,20" fill="#18A65A"/></svg>';
|
|
|
+ // html += '<svg width="15" height="15"><polygon id="triangle" points="0,0 15,0 1,15" fill="#18A65A"/></svg>';
|
|
|
html += '</div>';
|
|
|
div.innerHTML = html;
|
|
|
let tag = new THREE.CSS2DObject(div);
|
|
@@ -611,7 +613,7 @@
|
|
|
}, function (xhr) {
|
|
|
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
|
|
|
}, function (error) {
|
|
|
- console.log('load error!' + error.getWebGLErrorMessage());
|
|
|
+ console.log('load error!' + error);
|
|
|
})
|
|
|
|
|
|
function render() {
|