mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
Prettified Code!
This commit is contained in:
1 parent
fa9c775fe6
commit
01793f1b2c
2 files changed
+50
-38
No files matched your search
@@ -20,7 +20,13 @@ import Tooltip from '@mui/material/Tooltip';
|
|||||||
import VisibilityIcon from '@mui/icons-material/Visibility';
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
||||||
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer';
|
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer';
|
||||||
import { Stack } from '@mui/system';
|
import { Stack } from '@mui/system';
|
||||||
import { AllInclusiveOutlined, ChangeHistory, GestureOutlined, RadioButtonUnchecked, Replay } from '@mui/icons-material';
|
import {
|
||||||
|
AllInclusiveOutlined,
|
||||||
|
ChangeHistory,
|
||||||
|
GestureOutlined,
|
||||||
|
RadioButtonUnchecked,
|
||||||
|
Replay,
|
||||||
|
} from '@mui/icons-material';
|
||||||
import { CameraHelper } from './CameraHelper';
|
import { CameraHelper } from './CameraHelper';
|
||||||
import { get_curve_object_from_cameras, get_transform_matrix } from './curve';
|
import { get_curve_object_from_cameras, get_transform_matrix } from './curve';
|
||||||
import { WebSocketContext } from '../../WebSocket/WebSocket';
|
import { WebSocketContext } from '../../WebSocket/WebSocket';
|
||||||
@@ -303,7 +309,11 @@ export default function CameraPanel(props) {
|
|||||||
}, [cameras, render_width, render_height]);
|
}, [cameras, render_width, render_height]);
|
||||||
|
|
||||||
// update the camera curve
|
// update the camera curve
|
||||||
const curve_object = get_curve_object_from_cameras(cameras, is_cycle, smoothness_value);
|
const curve_object = get_curve_object_from_cameras(
|
||||||
|
cameras,
|
||||||
|
is_cycle,
|
||||||
|
smoothness_value,
|
||||||
|
);
|
||||||
|
|
||||||
if (cameras.length > 1) {
|
if (cameras.length > 1) {
|
||||||
const num_points = fps * seconds;
|
const num_points = fps * seconds;
|
||||||
@@ -373,7 +383,6 @@ export default function CameraPanel(props) {
|
|||||||
}
|
}
|
||||||
}, [slider_value]);
|
}, [slider_value]);
|
||||||
|
|
||||||
|
|
||||||
const get_camera_path = () => {
|
const get_camera_path = () => {
|
||||||
// NOTE: currently assuming these are ints
|
// NOTE: currently assuming these are ints
|
||||||
const num_points = fps * seconds;
|
const num_points = fps * seconds;
|
||||||
@@ -489,25 +498,25 @@ export default function CameraPanel(props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="CameraPanel-top-button">
|
<div className="CameraPanel-top-button">
|
||||||
<Tooltip title="Close/open camera curve">
|
<Tooltip title="Close/open camera curve">
|
||||||
{!is_cycle ? (
|
{!is_cycle ? (
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsCycle(true);
|
setIsCycle(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<GestureOutlined />
|
<GestureOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsCycle(false);
|
setIsCycle(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<AllInclusiveOutlined />
|
<AllInclusiveOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div className="CameraPanel-top-button">
|
<div className="CameraPanel-top-button">
|
||||||
@@ -518,9 +527,8 @@ export default function CameraPanel(props) {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div className="CameraPanel-slider-container">
|
<div className="CameraPanel-slider-container">
|
||||||
|
|
||||||
<Stack spacing={2} direction="row" sx={{ mb: 1 }} alignItems="center">
|
<Stack spacing={2} direction="row" sx={{ mb: 1 }} alignItems="center">
|
||||||
<p style={{ fontSize: "smaller", color: "#999999"}}>Smoothness</p>
|
<p style={{ fontSize: 'smaller', color: '#999999' }}>Smoothness</p>
|
||||||
<ChangeHistory />
|
<ChangeHistory />
|
||||||
<Slider
|
<Slider
|
||||||
value={smoothness_value}
|
value={smoothness_value}
|
||||||
@@ -576,26 +584,26 @@ export default function CameraPanel(props) {
|
|||||||
>
|
>
|
||||||
<Replay />
|
<Replay />
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : !is_playing ? (
|
||||||
!is_playing ? (
|
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (cameras.length > 1) {
|
if (cameras.length > 1) {
|
||||||
setIsPlaying(true);
|
setIsPlaying(true);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PlayArrowIcon />
|
<PlayArrowIcon />
|
||||||
</Button> ) :
|
</Button>
|
||||||
(<Button
|
) : (
|
||||||
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsPlaying(false);
|
setIsPlaying(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PauseIcon />
|
<PauseIcon />
|
||||||
</Button> )
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ function get_curve(list_of_3d_vectors, is_cycle, smoothness_value) {
|
|||||||
return curve;
|
return curve;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function get_curve_object_from_cameras(cameras, is_cycle, smoothness_value) {
|
export function get_curve_object_from_cameras(
|
||||||
|
cameras,
|
||||||
|
is_cycle,
|
||||||
|
smoothness_value,
|
||||||
|
) {
|
||||||
// interpolate positions, lookat directions, and ups
|
// interpolate positions, lookat directions, and ups
|
||||||
// similar to
|
// similar to
|
||||||
// https://github.com/google-research/multinerf/blob/1c8b1c552133cdb2de1c1f3c871b2813f6662265/internal/camera_utils.py#L281
|
// https://github.com/google-research/multinerf/blob/1c8b1c552133cdb2de1c1f3c871b2813f6662265/internal/camera_utils.py#L281
|
||||||
|
|||||||
Reference in new issue
Block a user