mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-26 19:10:06 +08:00
Adding colormap customization on viewer (#272)
* set up logic for colormap defined by user on viewer * ooops typo * nit * done with defaults * lint
This commit is contained in:
1 parent
26a37e750a
commit
2d3452e5a2
6 files changed
+153
-31
No files matched your search
@@ -22,6 +22,12 @@ export function RenderControls() {
|
||||
const outputChoice = useSelector(
|
||||
(state) => state.renderingState.output_choice,
|
||||
);
|
||||
const colormapOptions = useSelector(
|
||||
(state) => state.renderingState.colormap_options,
|
||||
);
|
||||
const colormapChoice = useSelector(
|
||||
(state) => state.renderingState.colormap_choice,
|
||||
);
|
||||
const min_resolution = useSelector(
|
||||
(state) => state.renderingState.minResolution,
|
||||
);
|
||||
@@ -96,6 +102,25 @@ export function RenderControls() {
|
||||
}
|
||||
};
|
||||
|
||||
const set_colormap_choice = (value) => {
|
||||
if (websocket.readyState === WebSocket.OPEN) {
|
||||
dispatch({
|
||||
type: 'write',
|
||||
path: 'renderingState/colormap_choice',
|
||||
data: value,
|
||||
});
|
||||
const cmd = 'write';
|
||||
const path = 'renderingState/colormap_choice';
|
||||
const data = {
|
||||
type: cmd,
|
||||
path,
|
||||
data: value,
|
||||
};
|
||||
const message = msgpack.encode(data);
|
||||
websocket.send(message);
|
||||
}
|
||||
};
|
||||
|
||||
const set_fov = (value) => {
|
||||
if (websocket.readyState === WebSocket.OPEN) {
|
||||
dispatch({
|
||||
@@ -174,6 +199,16 @@ export function RenderControls() {
|
||||
set_output_choice(v);
|
||||
},
|
||||
},
|
||||
// colormap_options
|
||||
colormap_options: {
|
||||
label: 'Colormap',
|
||||
options: colormapOptions,
|
||||
value: colormapChoice,
|
||||
onChange: (v) => {
|
||||
set_colormap_choice(v);
|
||||
},
|
||||
disabled: colormapOptions.length === 1
|
||||
},
|
||||
// resolution
|
||||
min_resolution: {
|
||||
label: 'Min Res.',
|
||||
@@ -225,6 +260,8 @@ export function RenderControls() {
|
||||
isTraining,
|
||||
outputOptions,
|
||||
outputChoice,
|
||||
colormapOptions,
|
||||
colormapChoice,
|
||||
min_resolution,
|
||||
max_resolution,
|
||||
field_of_view,
|
||||
@@ -273,12 +310,15 @@ export function RenderControls() {
|
||||
setControls({ min_resolution });
|
||||
setControls({ max_resolution });
|
||||
setControls({ output_options: outputChoice });
|
||||
setControls({ colormap_options: colormapChoice });
|
||||
setControls({ 'Camera FoV': field_of_view });
|
||||
}, [
|
||||
setControls,
|
||||
isTraining,
|
||||
outputOptions,
|
||||
outputChoice,
|
||||
colormapOptions,
|
||||
colormapChoice,
|
||||
min_resolution,
|
||||
max_resolution,
|
||||
field_of_view,
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
export const selectTrainingState = (state) =>
|
||||
state.shared.rendering.training_state;
|
||||
export const selectOutputOptions = (state) => state.shared.output_options;
|
||||
export const selectColormapOptions = (state) => state.shared.colormap_options;
|
||||
Reference in new issue
Block a user