Skip to content

Commit 82354ed

Browse files
ExcodiburExcodibur
authored andcommitted
chore: release v0.0.7
Fixed lighting behaviour (switchable lights)
1 parent e43ce21 commit 82354ed

File tree

7 files changed

+30
-6
lines changed

7 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
Placeholder for the next version (add instead of version-number-headline below):
44
## __WORK IN PROGRESS__
55
-->
6+
## 0.0.7 (2021-02-21)
7+
* Fixed lighting behaviour (switchable lights)
8+
69
## 0.0.6 (2021-02-19)
710
* Added 3d-axis in edit-mode to ease model positioning
811

doc/usage/widget.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ image:media/3dmodel_widget_vis_settings_switchable_lights.png[Widget settings -
8383
Regarding _light intensity_ being measured in lumens, it is questionable if real-life values are sensible to be used here. Although not fully verified, how bright a light-source will appear in the rendered object also depends on the dimensions of your model. E.g. a house model might look fine while rendered, but if it not also does match real-life metrics (e.g. wall height of rooms), a normal lumen-intensity will not provide enough light for the whole room.
8484
--
8585

86-
TODO: Light behaviour in connection with ioBroker state
86+
The `monitored state` can either have a number, or boolean value. If a number is set as value, it must not be greater than `state max value` and the light will be dimmed according to the state-change. If boolean is used, the light will either be turned off (_false_), or turned on (_true_), meaning set to `state max value`.
8787
--
8888

8989
== Clickable Objects

io-package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
{
22
"common": {
33
"name": "vis-3dmodel",
4-
"version": "0.0.6",
4+
"version": "0.0.7",
55
"news": {
6+
"0.0.7": {
7+
"en": "Fixed lighting behaviour (switchable lights)",
8+
"de": "Festes Beleuchtungsverhalten (schaltbare Lichter)",
9+
"ru": "Исправлено поведение освещения (переключаемый свет)",
10+
"pt": "Comportamento de iluminação fixo (luzes comutáveis)",
11+
"nl": "Vast lichtgedrag (schakelbare lampen)",
12+
"fr": "Comportement d'éclairage fixe (lumières commutables)",
13+
"it": "Comportamento di illuminazione fisso (luci commutabili)",
14+
"es": "Comportamiento de iluminación fijo (luces conmutables)",
15+
"pl": "Naprawiono zachowanie oświetlenia (przełączane światła)",
16+
"zh-cn": "固定的照明行为(可切换灯)"
17+
},
618
"0.0.6": {
719
"en": "Added 3d-axis in edit-mode to ease model positioning",
820
"de": "3D-Achse im Bearbeitungsmodus hinzugefügt, um die Modellpositionierung zu vereinfachen",

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iobroker.vis-3dmodel",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Import 3D GLTF images into Blender",
55
"author": {
66
"name": "Excodibur",

widgets/vis-3dmodel/js/3dmodel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ vis.binds["3dmodel"] = {
173173

174174
if (monitoredStateLightMap[oid]) {
175175
monitoredStateLightMap[oid].forEach(light => {
176-
model.updateLightByState(light, newVal);
176+
model.updateLightByState(light, newVal, lightAttributes[light].maxValue, lightAttributes[light].maxPower);
177177
});
178178
}
179179
// $div.find('.template-value').html(newVal);

widgets/vis-3dmodel/js/threejs-model.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class ThreeJSModel {
6060
this.arrowScene.add(new THREE.ArrowHelper(new THREE.Vector3(0, 0, 1), arrowPos, arrowLegth, 0x20207F, 20, 10));
6161
}
6262

63+
// this.container.addEventListener('mousemove', (event) => {console.log(event);console.log(this)}, false);
64+
// this.container.addEventListener('mousemove', (that) => this._onMouseMove());
6365
this.container.addEventListener("mousemove", this._onMouseMove.bind(this), false);
6466
this.container.addEventListener("click", this._onMouseClick.bind(this), false);
6567

@@ -330,7 +332,14 @@ class ThreeJSModel {
330332
if (!lightObject) return;
331333

332334
const oldPower = lightObject.power;
333-
const targetPower = value / maxValue * light.maxPower;
335+
let targetPower;
336+
if (typeof value === "boolean")
337+
targetPower = (value) ? light.maxPower : 0;
338+
else if (typeof value === "number")
339+
targetPower = value / maxValue * light.maxPower;
340+
else
341+
return;
342+
// const targetPower = value / maxValue * light.maxPower;
334343
if (light.smoothTransition) {
335344
if (targetPower > oldPower) {
336345
const intr = setInterval(function () {

0 commit comments

Comments
 (0)