@archvisioninc/canvas 3.1.6 → 3.1.8
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.
- package/dist/helpers/canvasUpdateHelpers.js +3 -3
- package/dist/helpers/initHelpers.js +1 -1
- package/dist/helpers/utilityHelpers.js +1 -0
- package/dist/helpers/viewportHelpers.js +3 -0
- package/package.json +1 -1
- package/src/package/helpers/canvasUpdateHelpers.js +3 -3
- package/src/package/helpers/gizmoHelpers.js +1 -0
- package/src/package/helpers/initHelpers.js +1 -1
- package/src/package/helpers/utilityHelpers.js +1 -0
- package/src/package/helpers/viewportHelpers.js +3 -0
- package/src/scenes/App/App.js +1 -1
|
@@ -200,7 +200,7 @@ const loadImage = async file => {
|
|
|
200
200
|
reader.readAsDataURL(file);
|
|
201
201
|
});
|
|
202
202
|
};
|
|
203
|
-
const
|
|
203
|
+
const metallicTextureToImage = texture => {
|
|
204
204
|
return new Promise(resolve => {
|
|
205
205
|
if (!texture.readPixels()) {
|
|
206
206
|
resolve(null);
|
|
@@ -391,7 +391,7 @@ export const updateMaterial = inboundData => {
|
|
|
391
391
|
currentTexture = material.metallicTexture;
|
|
392
392
|
}
|
|
393
393
|
const metallicBlob = dataUrlToBlob(texture.url);
|
|
394
|
-
Promise.all([loadImage(metallicBlob),
|
|
394
|
+
Promise.all([loadImage(metallicBlob), metallicTextureToImage(currentTexture)]).then(data => {
|
|
395
395
|
const [metallicImage, currentImage] = data;
|
|
396
396
|
const combinedTexture = updateTextureChannel(currentImage, metallicImage, 'B');
|
|
397
397
|
currentTexture.updateURL(combinedTexture);
|
|
@@ -434,7 +434,7 @@ export const updateMaterial = inboundData => {
|
|
|
434
434
|
currentTexture = material.metallicTexture;
|
|
435
435
|
}
|
|
436
436
|
const roughnessBlob = dataUrlToBlob(texture.url);
|
|
437
|
-
Promise.all([loadImage(roughnessBlob),
|
|
437
|
+
Promise.all([loadImage(roughnessBlob), metallicTextureToImage(currentTexture)]).then(data => {
|
|
438
438
|
const [roughnessImage, metallicImage] = data;
|
|
439
439
|
const combinedTexture = updateTextureChannel(metallicImage, roughnessImage, 'G');
|
|
440
440
|
currentTexture.updateURL(combinedTexture);
|
|
@@ -42,7 +42,7 @@ const resizeEngine = () => engine?.resize();
|
|
|
42
42
|
export const initSceneObjects = () => {
|
|
43
43
|
initCamera();
|
|
44
44
|
initLights();
|
|
45
|
-
initHighlightManagers();
|
|
45
|
+
if (!props.previewMode) initHighlightManagers();
|
|
46
46
|
if (!props.previewMode) initGridGround();
|
|
47
47
|
initMirrorGround();
|
|
48
48
|
initGizmos();
|
|
@@ -92,6 +92,7 @@ const removeSelectedMesh = selectedMesh => {
|
|
|
92
92
|
};
|
|
93
93
|
const addHoverMesh = pickedMesh => {
|
|
94
94
|
if (props.integration?.meshHighlighting === false) return;
|
|
95
|
+
if (props.previewMode) return;
|
|
95
96
|
const isSelected = selectedMeshes.includes(pickedMesh);
|
|
96
97
|
removeHoverMesh();
|
|
97
98
|
if (isSelected) {
|
|
@@ -107,6 +108,7 @@ const addHoverMesh = pickedMesh => {
|
|
|
107
108
|
};
|
|
108
109
|
const removeHoverMesh = () => {
|
|
109
110
|
if (props.integration?.meshHighlighting === false) return;
|
|
111
|
+
if (props.previewMode) return;
|
|
110
112
|
hoverHighlightManager.removeAllMeshes();
|
|
111
113
|
if (tempMesh) {
|
|
112
114
|
highlightManager.addMesh(tempMesh, highlightColor());
|
|
@@ -268,6 +270,7 @@ const handleMousePointerPick = e => {
|
|
|
268
270
|
selectedMeshes.includes(selectedMesh) ? removeSelectedMesh(selectedMesh) : addNewMesh(selectedMesh);
|
|
269
271
|
};
|
|
270
272
|
const handleMousePointerMove = () => {
|
|
273
|
+
if (props.previewMode) return;
|
|
271
274
|
const ray = scene.createPickingRay(scene.pointerX, scene.pointerY, BABYLON.Matrix.Identity(), scene.activeCamera);
|
|
272
275
|
const {
|
|
273
276
|
hit,
|
package/package.json
CHANGED
|
@@ -251,7 +251,7 @@ const loadImage = async file => {
|
|
|
251
251
|
});
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
const
|
|
254
|
+
const metallicTextureToImage = texture => {
|
|
255
255
|
return new Promise(resolve => {
|
|
256
256
|
if (!texture.readPixels()) {
|
|
257
257
|
resolve(null);
|
|
@@ -447,7 +447,7 @@ export const updateMaterial = inboundData => {
|
|
|
447
447
|
|
|
448
448
|
Promise.all([
|
|
449
449
|
loadImage(metallicBlob),
|
|
450
|
-
|
|
450
|
+
metallicTextureToImage(currentTexture),
|
|
451
451
|
])
|
|
452
452
|
.then(data => {
|
|
453
453
|
const [ metallicImage, currentImage ] = data;
|
|
@@ -490,7 +490,7 @@ export const updateMaterial = inboundData => {
|
|
|
490
490
|
|
|
491
491
|
const roughnessBlob = dataUrlToBlob(texture.url);
|
|
492
492
|
|
|
493
|
-
Promise.all([ loadImage(roughnessBlob),
|
|
493
|
+
Promise.all([ loadImage(roughnessBlob), metallicTextureToImage(currentTexture) ])
|
|
494
494
|
.then(data => {
|
|
495
495
|
const [ roughnessImage, metallicImage ] = data;
|
|
496
496
|
const combinedTexture = updateTextureChannel(metallicImage, roughnessImage, 'G');
|
|
@@ -86,7 +86,7 @@ const resizeEngine = () => engine?.resize();
|
|
|
86
86
|
export const initSceneObjects = () => {
|
|
87
87
|
initCamera();
|
|
88
88
|
initLights();
|
|
89
|
-
initHighlightManagers();
|
|
89
|
+
if (!props.previewMode) initHighlightManagers();
|
|
90
90
|
if (!props.previewMode) initGridGround();
|
|
91
91
|
initMirrorGround();
|
|
92
92
|
initGizmos();
|
|
@@ -135,6 +135,7 @@ const removeSelectedMesh = selectedMesh => {
|
|
|
135
135
|
|
|
136
136
|
const addHoverMesh = pickedMesh => {
|
|
137
137
|
if (props.integration?.meshHighlighting === false) return;
|
|
138
|
+
if (props.previewMode) return;
|
|
138
139
|
|
|
139
140
|
const isSelected = selectedMeshes.includes(pickedMesh);
|
|
140
141
|
|
|
@@ -156,6 +157,7 @@ const addHoverMesh = pickedMesh => {
|
|
|
156
157
|
|
|
157
158
|
const removeHoverMesh = () => {
|
|
158
159
|
if (props.integration?.meshHighlighting === false) return;
|
|
160
|
+
if (props.previewMode) return;
|
|
159
161
|
|
|
160
162
|
hoverHighlightManager.removeAllMeshes();
|
|
161
163
|
|
|
@@ -344,6 +346,7 @@ const handleMousePointerPick = e => {
|
|
|
344
346
|
};
|
|
345
347
|
|
|
346
348
|
const handleMousePointerMove = () => {
|
|
349
|
+
if (props.previewMode) return;
|
|
347
350
|
const ray = scene.createPickingRay(scene.pointerX, scene.pointerY, BABYLON.Matrix.Identity(), scene.activeCamera);
|
|
348
351
|
const { hit, pickedMesh } = scene.pickWithRay(ray);
|
|
349
352
|
|
package/src/scenes/App/App.js
CHANGED
|
@@ -10,7 +10,7 @@ import Canvas from 'package/Canvas';
|
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
|
|
12
12
|
const materialMode = false;
|
|
13
|
-
const previewMode =
|
|
13
|
+
const previewMode = true;
|
|
14
14
|
const demoScene = false;
|
|
15
15
|
const shaderballGuid = '21-791A-0D8D-F8A0-63F7-5086-471F-69A7-7AB0-00';
|
|
16
16
|
|