Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 2D auxiliary lines and point cloud RGB support #218

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/pc-tool/src/components/ImgView/Image2DMax.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
if (dom.value) {
view = new Image2DRenderView(dom.value, pc, {
name: state.config.singleViewPrefix,
actions: ['select', 'render-2d-shape', 'create-obj', 'edit-2d', 'transform-2d'],
actions: ['select', 'render-2d-shape', 'create-obj', 'edit-2d', 'transform-2d', 'render-2d-track'],
});
pc.addRenderView(view);
// view.lineWidth = 2;
Expand Down
2 changes: 0 additions & 2 deletions frontend/pc-tool/src/components/MainView/setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@
const heightRange = config.heightRange;
if (isNaN(heightRange[0]) || isNaN(heightRange[1])) return;
let points = editor.pc.groupPoints.children[0] as THREE.Points;
let positions = points.geometry.getAttribute('position') as THREE.BufferAttribute;
let material = points.material as PointsMaterial;
let option = {} as any;
option.heightRange = new THREE.Vector2().fromArray(heightRange);
material.setUniforms(option);
config.pointInfo.vCount = utils.filterPosition(positions, heightRange).length;
editor.pc.render();
}, 300);
</script>
Expand Down
171 changes: 72 additions & 99 deletions frontend/pc-tool/src/components/Tool/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,135 +84,109 @@
style="width: 200px; margin: 0px; margin-top: 5px"
v-model:value="config.pointSize"
:tip-formatter="formatter"
:min="1"
:max="10"
:step="0.1"
@change="() => update('pointSize')"
/>
<div class="title3"
>{{ $$('setting_brightness')
}}<a-button
type="dashed"
class="reset"
size="small"
@click="onResetBrightness"
>{{ $$('setting_pointreset') }}</a-button
>
</div>
<a-slider
style="width: 200px; margin: 0px; margin-top: 5px"
v-model:value="config.brightness"
:tip-formatter="formatter"
:min="0.1"
:max="2"
:step="0.1"
@change="() => update('brightness')"
/>
</div>
<div class="wrap">
<div class="title3"
>{{ $$('setting_pointcolor') }}
<br />
<a-radio-group
v-model:value="config.pointColorMode"
size="small"
style="width: 200px; font-size: 12px; margin-top: 5px"
style="font-size: 12px; margin-top: 5px"
>
<a-radio-button style="width: 100px; text-align: center" value="height">
<a-radio-button
style="width: 80px; text-align: center"
:value="ColorModeEnum.PURE"
>
{{ $$('setting_colorsingle') }}
</a-radio-button>
<a-radio-button
style="width: 80px; text-align: center"
:value="ColorModeEnum.HEIGHT"
>
{{ $$('setting_colorheight') }}
</a-radio-button>

<a-radio-button
v-if="config.pointInfo.hasIntensity"
v-if="config.pointInfo.hasRGB"
style="width: 100px; text-align: center"
value="intensity"
:value="ColorModeEnum.RGB"
>
{{ $$('setting_colorintensity') }}
{{ 'RGB' }}
</a-radio-button>
</a-radio-group>
</div>
</div>
<div
class="wrap"
v-show="config.pointColorMode === 'intensity' && config.pointInfo.hasIntensity"
>
<div class="title3" style="padding-top: 10px"
<ColorSlider />
<div class="wrap" v-if="config.pointInfo.hasIntensity">
<div class="title3"
>{{ $$('setting_colorintensity') }}
<a-button
:title="$$('setting_pointreset')"
<a-switch
size="small"
style="border: none; float: right"
@click="onResetIntensity"
>
<template #icon>
<RetweetOutlined />
</template>
</a-button>
style="margin-top: 5px; float: right"
v-model:checked="state.config.openIntensity"
/>
</div>
<div class="title3" style="padding-top: 10px">
<a-input-number
v-model:value="config.pointIntensity[1]"
v-model:value="config.pointIntensity[0]"
size="small"
:min="0"
:max="255"
style="width: 60px; float: right"
style="width: 80px"
></a-input-number>
<a-input-number
v-model:value="config.pointIntensity[0]"
v-model:value="config.pointIntensity[1]"
size="small"
:min="0"
:max="255"
style="width: 60px; float: right"
style="width: 80px"
></a-input-number>
</div>
<div style="margin-top: 5px" class="title3">
<a-slider
range
style="width: 180px; margin: 5px 0 0 5px"
v-model:value="config.pointIntensity"
:min="0"
:max="255"
:step="1"
/>
</div>
</div>
<!-- <div class="wrap" v-show="config.pointColorMode !== 'intensity'">
<div class="title3" style="margin-top: 5px"
>{{ $$('setting_ground') }}
<a-button
:title="$$('setting_pointreset')"
size="small"
style="border: none; float: right"
@click="onResetGround"
style="border: none"
@click="onResetIntensity"
>
<template #icon>
<RetweetOutlined />
</template>
</a-button>
<a-input-number
v-model:value="config.groundValue"
size="small"
:min="config.pointInfo.min.z"
:max="config.pointInfo.max.z"
style="width: 80px; float: right"
:step="0.1"
></a-input-number>
</div>
<div class="title3" style="margin-top: 5px">
<div style="margin: 5px 0 0 5px; margin-top: 5px; width: 180px" class="title3">
<a-slider
style="width: 200px; margin: 0px; margin-top: 5px"
v-model:value="config.groundValue"
:tip-formatter="formatter"
:min="config.pointInfo.min.z"
:max="config.pointInfo.max.z"
range
v-model:value="config.pointIntensity"
:min="0"
:max="255"
:step="0.1"
/>
</div>
</div> -->
<div class="wrap">
<!-- <div
:style="{
'margin-top': '6px',
height: '10px',
background: iState.colorCodeBg,
}"
ref="colorCodeRef"
></div> -->
<ColorSlider />
</div>
<!-- <div class="title2">
<span style="vertical-align: middle; margin-right: 10px">{{
$$('setting_resultview')
}}</span>
</div>
<div class="wrap">
<div class="title3"
>{{ $$('setting_showlabel') }}
<a-switch
size="small"
style="float: right; margin-top: 5px"
v-model:checked="state.config.showLabel"
/>
</div>
<slot name="object"></slot>
</div> -->

<div class="title2" v-if="!_config.noUtility">
<span style="vertical-align: middle; margin-right: 10px">{{ $$('utility') }}</span>
<!-- <div class="divider"></div> -->
Expand Down Expand Up @@ -266,15 +240,15 @@
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue';
// import { getColorRange } from '../../utils';
import * as _ from 'lodash';
import { useInjectEditor } from '../../state';
import { useInjectState } from '../../state';
import { useInjectState, useInjectEditor } from '../../state';
// import useRenderConfig from '../hook/useRenderConfig';
import { RetweetOutlined } from '@ant-design/icons-vue';
import { PointsMaterial, Event, Image2DRenderView } from 'pc-render';
// import useLang from '../../hook/useLang';
import * as locale from './lang';
import { IConfig } from './useTool';
import ColorSlider from './colorSlider.vue';
import { ColorModeEnum } from 'pc-editor';
let editor = useInjectEditor();
let $$ = editor.bindLocale(locale);
let pc = editor.pc;
Expand Down Expand Up @@ -352,11 +326,14 @@
case 'pointSize':
options.pointSize = config.pointSize * 10;
break;
case 'type':
// options.trimType = config.type === 'range-only' ? 1 : 2;
case 'colorType':
options.colorMode = config.pointColorMode || 0;
break;
case 'colorModel':
options.colorMode = config.pointColorMode === 'height' ? -1.0 : 1.0;
case 'intensity':
options.openIntensity = config.openIntensity ? 1.0 : -1.0;
break;
case 'brightness':
options.brightness = config.brightness;
break;
case 'intensityRange':
options.intensityRange = new THREE.Vector2(
Expand All @@ -379,11 +356,14 @@
function onResetIntensity() {
config.pointIntensity = [0, 255];
}

function onResetBrightness() {
config.brightness = 1;
update('brightness');
}
watch(
() => config.pointColorMode,
() => {
update('colorModel');
update('colorType');
},
);

Expand All @@ -395,19 +375,12 @@
);

watch(
() => config.pointSize,
() => config.openIntensity,
() => {
update('pointSize');
update('intensity');
},
);

// watch(
// () => [config.showAnnotation, config.showLabel],
// () => {
// pc.render();
// },
// );

watch(
() => [
config.renderBox,
Expand Down
22 changes: 19 additions & 3 deletions frontend/pc-tool/src/components/Tool/base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
</span>
</a-tooltip>

<a-tooltip placement="rightBottom" trigger="click" overlayClassName="tool-info-tooltip">
<a-tooltip
v-model:visible="iState.infoVisible"
:onVisibleChange="onVisibleChange"
placement="rightBottom"
trigger="click"
overlayClassName="tool-info-tooltip"
>
<template #title>
<Info />
</template>
Expand All @@ -32,12 +38,22 @@
import Setting from './Setting.vue';
import useTool, { IConfig } from './useTool';
import * as locale from './lang';
import { reactive } from 'vue';
const props = defineProps<{
config?: IConfig;
}>();
let editor = useInjectEditor();
let state = useInjectState();
const editor = useInjectEditor();
const state = useInjectState();
const iState = reactive({
infoVisible: false,
});

let $$ = editor.bindLocale(locale);
async function onVisibleChange(value: any) {
if (value) {
await editor.configManager.countVisiblePointN();
}
}
</script>

<style lang="less">
Expand Down
Loading
Loading