@archvisioninc/canvas 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1162,7 +1162,9 @@ export const updateLighting = inboundData => {
|
|
|
1162
1162
|
diffuse,
|
|
1163
1163
|
specular,
|
|
1164
1164
|
radius,
|
|
1165
|
-
intensity
|
|
1165
|
+
intensity,
|
|
1166
|
+
distance,
|
|
1167
|
+
rotation
|
|
1166
1168
|
} = payload;
|
|
1167
1169
|
const light = scene.getLightByName(id);
|
|
1168
1170
|
if (!_.isEmpty(transforms)) {
|
|
@@ -1207,5 +1209,26 @@ export const updateLighting = inboundData => {
|
|
|
1207
1209
|
if (intensity !== undefined) {
|
|
1208
1210
|
light.intensity = intensity;
|
|
1209
1211
|
}
|
|
1212
|
+
if (distance !== undefined) {
|
|
1213
|
+
const rotation = light?.rotation || 0;
|
|
1214
|
+
const angleRad = rotation * Math.PI / 180;
|
|
1215
|
+
light.position = newVector(distance * Math.cos(angleRad), 5, distance * Math.sin(angleRad));
|
|
1216
|
+
light.setDirectionToTarget(newVector(0, 0, 0));
|
|
1217
|
+
light.distance = distance;
|
|
1218
|
+
}
|
|
1219
|
+
if (rotation !== undefined) {
|
|
1220
|
+
const {
|
|
1221
|
+
position
|
|
1222
|
+
} = light;
|
|
1223
|
+
const {
|
|
1224
|
+
x,
|
|
1225
|
+
y,
|
|
1226
|
+
z
|
|
1227
|
+
} = position;
|
|
1228
|
+
const distance = light?.distance || Math.sqrt(Math.pow(Math.abs(x), 2) + Math.pow(Math.abs(y), 2) + Math.pow(Math.abs(z), 2));
|
|
1229
|
+
light.position = newVector(distance * Math.cos(angleRad), 5, distance * Math.sin(angleRad));
|
|
1230
|
+
light.setDirectionToTarget(newVector(0, 0, 0));
|
|
1231
|
+
light.rotation = rotation;
|
|
1232
|
+
}
|
|
1210
1233
|
newMetaDataEntry('lights', buildLightsArray());
|
|
1211
1234
|
};
|
|
@@ -610,7 +610,13 @@ export const buildMaterialsArray = () => {
|
|
|
610
610
|
};
|
|
611
611
|
export const buildLightsArray = () => {
|
|
612
612
|
const lights = scene.lights;
|
|
613
|
-
return lights.map(light =>
|
|
613
|
+
return lights.map(light => {
|
|
614
|
+
return {
|
|
615
|
+
...light.serialize(),
|
|
616
|
+
rotation: light?.rotation ?? 0,
|
|
617
|
+
distance: light?.distance ?? Math.sqrt(Math.pow(Math.abs(x), 2) + Math.pow(Math.abs(y), 2) + Math.pow(Math.abs(z), 2))
|
|
618
|
+
};
|
|
619
|
+
});
|
|
614
620
|
};
|
|
615
621
|
const billboardScreenshot = view => {
|
|
616
622
|
const camera = scene.activeCamera.clone(view);
|
package/package.json
CHANGED
|
@@ -1169,7 +1169,7 @@ export const updatePublish = inboundData => {
|
|
|
1169
1169
|
|
|
1170
1170
|
export const updateLighting = inboundData => {
|
|
1171
1171
|
const { payload } = inboundData;
|
|
1172
|
-
const { id, transforms, target, enable, diffuse, specular, radius, intensity } = payload;
|
|
1172
|
+
const { id, transforms, target, enable, diffuse, specular, radius, intensity, distance, rotation } = payload;
|
|
1173
1173
|
|
|
1174
1174
|
const light = scene.getLightByName(id);
|
|
1175
1175
|
|
|
@@ -1207,5 +1207,22 @@ export const updateLighting = inboundData => {
|
|
|
1207
1207
|
light.intensity = intensity;
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
|
+
if (distance !== undefined) {
|
|
1211
|
+
const rotation = light?.rotation || 0;
|
|
1212
|
+
const angleRad = (rotation * Math.PI) / 180
|
|
1213
|
+
light.position = newVector(distance * Math.cos(angleRad), 5, distance * Math.sin(angleRad));
|
|
1214
|
+
light.setDirectionToTarget(newVector(0, 0, 0));
|
|
1215
|
+
light.distance = distance;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
if (rotation !== undefined) {
|
|
1219
|
+
const { position } = light;
|
|
1220
|
+
const { x, y, z } = position;
|
|
1221
|
+
const distance = light?.distance || Math.sqrt(Math.pow(Math.abs(x), 2) + Math.pow(Math.abs(y), 2) + Math.pow(Math.abs(z), 2));
|
|
1222
|
+
light.position = newVector(distance * Math.cos(angleRad), 5, distance * Math.sin(angleRad));
|
|
1223
|
+
light.setDirectionToTarget(newVector(0, 0, 0));
|
|
1224
|
+
light.rotation = rotation;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1210
1227
|
newMetaDataEntry('lights', buildLightsArray())
|
|
1211
1228
|
};
|
|
@@ -668,7 +668,13 @@ export const buildMaterialsArray = () => {
|
|
|
668
668
|
|
|
669
669
|
export const buildLightsArray = () => {
|
|
670
670
|
const lights = scene.lights;
|
|
671
|
-
return lights.map(light =>
|
|
671
|
+
return lights.map(light => {
|
|
672
|
+
return {
|
|
673
|
+
...light.serialize(),
|
|
674
|
+
rotation: light?.rotation ?? 0,
|
|
675
|
+
distance: light?.distance ?? Math.sqrt(Math.pow(Math.abs(x), 2) + Math.pow(Math.abs(y), 2) + Math.pow(Math.abs(z), 2)),
|
|
676
|
+
};
|
|
677
|
+
});
|
|
672
678
|
};
|
|
673
679
|
|
|
674
680
|
const billboardScreenshot = view => {
|