1
0
mirror of https://github.com/beestat/app.git synced 2025-06-04 22:27:27 -04:00

Fixed visualize rooms with no sensor showing up black before texture is loaded

This commit is contained in:
Jon Ziebell 2022-09-12 07:53:31 -04:00
parent f4c414d436
commit d91d6a9daf

View File

@ -550,20 +550,21 @@ beestat.component.scene.prototype.add_room_ = function(layer, group, room) {
extrude_settings extrude_settings
); );
let material; const material = new THREE.MeshPhongMaterial({
'color': color
});
if (room.sensor_id === undefined) { if (room.sensor_id === undefined) {
const texture = new THREE.TextureLoader().load('img/visualize/stripe.png'); const loader = new THREE.TextureLoader();
loader.load(
'img/visualize/stripe.png',
function(texture) {
texture.wrapS = THREE.RepeatWrapping; texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(0.005, 0.005); texture.repeat.set(0.005, 0.005);
material.map = texture;
material = new THREE.MeshPhongMaterial({ material.needsUpdate = true;
'map': texture }
}); );
} else {
material = new THREE.MeshPhongMaterial({
'color': color
});
} }
const mesh = new THREE.Mesh(geometry, material); const mesh = new THREE.Mesh(geometry, material);