Compare commits
3 Commits
pierremtb/
...
kurt-2833
Author | SHA1 | Date | |
---|---|---|---|
c691dfd57a | |||
ac05520251 | |||
61afffc634 |
@ -4317,7 +4317,7 @@ test.describe('Sketch tests', () => {
|
|||||||
await expect(page.locator('.cm-content'))
|
await expect(page.locator('.cm-content'))
|
||||||
.toHaveText(`const sketch001 = startSketchOn('XZ')
|
.toHaveText(`const sketch001 = startSketchOn('XZ')
|
||||||
|> startProfileAt([6.44, -12.07], %)
|
|> startProfileAt([6.44, -12.07], %)
|
||||||
|> line([14.72, 2.01], %)
|
|> line([14.72, 1.97], %)
|
||||||
|> tangentialArcTo([24.95, -5.38], %)
|
|> tangentialArcTo([24.95, -5.38], %)
|
||||||
|> line([1.97, 2.06], %)
|
|> line([1.97, 2.06], %)
|
||||||
|> close(%)
|
|> close(%)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 44 KiB |
@ -538,7 +538,7 @@ export class CameraControls {
|
|||||||
return this.camera
|
return this.camera
|
||||||
}
|
}
|
||||||
|
|
||||||
dollyZoom = async (newFov: number, splitEngineCalls = false) => {
|
dollyZoom = async (newFov: number) => {
|
||||||
if (!(this.camera instanceof PerspectiveCamera)) {
|
if (!(this.camera instanceof PerspectiveCamera)) {
|
||||||
console.warn('Dolly zoom is only applicable to perspective cameras.')
|
console.warn('Dolly zoom is only applicable to perspective cameras.')
|
||||||
return
|
return
|
||||||
@ -589,48 +589,21 @@ export class CameraControls {
|
|||||||
this.camera.near = z_near
|
this.camera.near = z_near
|
||||||
this.camera.far = z_far
|
this.camera.far = z_far
|
||||||
|
|
||||||
if (splitEngineCalls) {
|
await this.engineCommandManager.sendSceneCommand({
|
||||||
await this.engineCommandManager.sendSceneCommand({
|
type: 'modeling_cmd_req',
|
||||||
type: 'modeling_cmd_req',
|
cmd_id: uuidv4(),
|
||||||
cmd_id: uuidv4(),
|
cmd: {
|
||||||
cmd: {
|
type: 'default_camera_perspective_settings',
|
||||||
type: 'default_camera_look_at',
|
...convertThreeCamValuesToEngineCam({
|
||||||
...convertThreeCamValuesToEngineCam({
|
isPerspective: true,
|
||||||
isPerspective: true,
|
position: newPosition,
|
||||||
position: newPosition,
|
quaternion: this.camera.quaternion,
|
||||||
quaternion: this.camera.quaternion,
|
zoom: this.camera.zoom,
|
||||||
zoom: this.camera.zoom,
|
target: this.target,
|
||||||
target: this.target,
|
}),
|
||||||
}),
|
fov_y: newFov,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
await this.engineCommandManager.sendSceneCommand({
|
|
||||||
type: 'modeling_cmd_req',
|
|
||||||
cmd_id: uuidv4(),
|
|
||||||
cmd: {
|
|
||||||
type: 'default_camera_set_perspective',
|
|
||||||
parameters: {
|
|
||||||
fov_y: newFov,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
await this.engineCommandManager.sendSceneCommand({
|
|
||||||
type: 'modeling_cmd_req',
|
|
||||||
cmd_id: uuidv4(),
|
|
||||||
cmd: {
|
|
||||||
type: 'default_camera_perspective_settings',
|
|
||||||
...convertThreeCamValuesToEngineCam({
|
|
||||||
isPerspective: true,
|
|
||||||
position: newPosition,
|
|
||||||
quaternion: this.camera.quaternion,
|
|
||||||
zoom: this.camera.zoom,
|
|
||||||
target: this.target,
|
|
||||||
}),
|
|
||||||
fov_y: newFov,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update = (forceUpdate = false) => {
|
update = (forceUpdate = false) => {
|
||||||
@ -1035,29 +1008,6 @@ export class CameraControls {
|
|||||||
.onComplete(onComplete)
|
.onComplete(onComplete)
|
||||||
.start()
|
.start()
|
||||||
})
|
})
|
||||||
snapToPerspectiveBeforeHandingBackControlToEngine = async (
|
|
||||||
targetCamUp = new Vector3(0, 0, 1)
|
|
||||||
) => {
|
|
||||||
if (this.syncDirection === 'engineToClient') {
|
|
||||||
console.warn(
|
|
||||||
'animate To Perspective not design to work with engineToClient syncDirection.'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
this.isFovAnimationInProgress = true
|
|
||||||
const targetFov = this.fovBeforeOrtho // Target FOV for perspective
|
|
||||||
this.lastPerspectiveFov = 4
|
|
||||||
let currentFov = 4
|
|
||||||
const initialCameraUp = this.camera.up.clone()
|
|
||||||
this.usePerspectiveCamera()
|
|
||||||
const tempVec = new Vector3()
|
|
||||||
|
|
||||||
currentFov = this.lastPerspectiveFov + (targetFov - this.lastPerspectiveFov)
|
|
||||||
const currentUp = tempVec.lerpVectors(initialCameraUp, targetCamUp, 1)
|
|
||||||
this.camera.up.copy(currentUp)
|
|
||||||
await this.dollyZoom(currentFov, true)
|
|
||||||
|
|
||||||
this.isFovAnimationInProgress = false
|
|
||||||
}
|
|
||||||
|
|
||||||
get reactCameraProperties(): ReactCameraProperties {
|
get reactCameraProperties(): ReactCameraProperties {
|
||||||
return {
|
return {
|
||||||
|
@ -129,7 +129,16 @@ export const ModelingMachineProvider = ({
|
|||||||
},
|
},
|
||||||
'sketch exit execute': ({ store }) => {
|
'sketch exit execute': ({ store }) => {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
await sceneInfra.camControls.snapToPerspectiveBeforeHandingBackControlToEngine()
|
await engineCommandManager.sendSceneCommand({
|
||||||
|
type: 'modeling_cmd_req',
|
||||||
|
cmd_id: uuidv4(),
|
||||||
|
cmd: {
|
||||||
|
type: 'default_camera_set_perspective',
|
||||||
|
parameters: {
|
||||||
|
fov_y: 45,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
sceneInfra.camControls.syncDirection = 'engineToClient'
|
sceneInfra.camControls.syncDirection = 'engineToClient'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user