Skip to content

Commit

Permalink
Merge branch 'main' into tint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck committed Nov 14, 2024
2 parents 59d6bbf + 84cdf38 commit 95ed15b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class Camera extends Element {

sceneRadius = 5;

flySpeed = 5;

picker: Picker;

workRenderTarget: RenderTarget;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class PointerController {
const z = keys.ArrowDown - keys.ArrowUp;

if (x || z) {
const factor = deltaTime * camera.distance * camera.sceneRadius * 20;
const factor = deltaTime * camera.flySpeed;
const worldTransform = camera.entity.getWorldTransform();
const xAxis = worldTransform.getX().mulScalar(x * factor);
const zAxis = worldTransform.getZ().mulScalar(z * factor);
Expand Down
10 changes: 10 additions & 0 deletions src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ const registerEditorEvents = (events: Events, editHistory: EditHistory, scene: S
setSplatSize(value);
});

// camera fly speed

const setFlySpeed = (value: number) => {
scene.camera.flySpeed = value;
};

events.on('camera.setFlySpeed', (value: number) => {
setFlySpeed(value);
});

// outline selection

let outlineSelection = false;
Expand Down
6 changes: 6 additions & 0 deletions src/ui/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const localizeInit = () => {
'options.outline-selection': 'Umriss Selektion',
'options.show-grid': 'Raster anzeigen',
'options.show-bound': 'Objektbox anzeigen',
'options.camera-fly-speed': 'Kamera Geschwindigkeit',

// Camera panel
'camera': 'KAMERA POSEN',
Expand Down Expand Up @@ -224,6 +225,7 @@ const localizeInit = () => {
'options.outline-selection': 'Outline Selection',
'options.show-grid': 'Show Grid',
'options.show-bound': 'Show Bound',
'options.camera-fly-speed': 'Fly Speed',

// Camera panel
'camera': 'CAMERA POSES',
Expand Down Expand Up @@ -385,6 +387,7 @@ const localizeInit = () => {
'options.outline-selection': 'Contour de la sélection',
'options.show-grid': 'Afficher la grille',
'options.show-bound': 'Afficher limites',
'options.camera-fly-speed': 'Vitesse de vol',

// Camera panel
'camera': 'POSES DE LA CAMERA',
Expand Down Expand Up @@ -537,6 +540,7 @@ const localizeInit = () => {
'options.outline-selection': '選択のアウトライン',
'options.show-grid': 'グリッド',
'options.show-bound': 'バウンディングボックス',
'options.camera-fly-speed': 'カメラの移動速度',

// Camera panel
'camera': 'カメラポーズ',
Expand Down Expand Up @@ -689,6 +693,7 @@ const localizeInit = () => {
'options.outline-selection': '선택 윤곽선',
'options.show-grid': '그리드 표시',
'options.show-bound': '경계 표시',
'options.camera-fly-speed': '카메라 이동 속도',

// Camera panel
'camera': '카메라 포즈',
Expand Down Expand Up @@ -841,6 +846,7 @@ const localizeInit = () => {
'options.outline-selection': '轮廓选择',
'options.show-grid': '显示网格',
'options.show-bound': '显示边界',
'options.camera-fly-speed': '相机飞行速度',

// Camera panel
'camera': '相机姿势',
Expand Down
33 changes: 33 additions & 0 deletions src/ui/view-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,28 @@ class ViewPanel extends Container {
centersSizeRow.append(centersSizeLabel);
centersSizeRow.append(centersSizeSlider);

// camera fly speed

const cameraFlySpeedRow = new Container({
class: 'view-panel-row'
});

const cameraFlySpeedLabel = new Label({
text: localize('options.camera-fly-speed'),
class: 'view-panel-row-label'
});

const cameraFlySpeedSlider = new SliderInput({
class: 'view-panel-row-slider',
min: 0.1,
max: 30,
precision: 1,
value: 5
});

cameraFlySpeedRow.append(cameraFlySpeedLabel);
cameraFlySpeedRow.append(cameraFlySpeedSlider);

// outline selection

const outlineSelectionRow = new Container({
Expand Down Expand Up @@ -219,6 +241,7 @@ class ViewPanel extends Container {
this.append(outlineSelectionRow);
this.append(showGridRow);
this.append(showBoundRow);
this.append(cameraFlySpeedRow);

// handle panel visibility

Expand Down Expand Up @@ -275,6 +298,16 @@ class ViewPanel extends Container {
events.fire('camera.setMode', 'centers');
});

// camera speed

events.on('camera.flySpeed', (value: number) => {
cameraFlySpeedSlider.value = value;
});

cameraFlySpeedSlider.on('change', (value: number) => {
events.fire('camera.setFlySpeed', value);
});

// outline selection

events.on('view.outlineSelection', (value: boolean) => {
Expand Down

0 comments on commit 95ed15b

Please sign in to comment.