|
|
@ -11,6 +11,7 @@ import { CalcSunShadowCameraExtents } from '../../../Common/LightUtils';
|
|
|
|
import { commandMachine } from '../../../Editor/CommandMachine';
|
|
|
|
import { commandMachine } from '../../../Editor/CommandMachine';
|
|
|
|
import { CommandState } from '../../../Editor/CommandState';
|
|
|
|
import { CommandState } from '../../../Editor/CommandState';
|
|
|
|
import { userConfig } from '../../../Editor/UserConfig';
|
|
|
|
import { userConfig } from '../../../Editor/UserConfig';
|
|
|
|
|
|
|
|
import { INumericInput } from '../INumericInput';
|
|
|
|
import { AppToaster } from '../Toaster';
|
|
|
|
import { AppToaster } from '../Toaster';
|
|
|
|
import { DefaultDist } from './ScenePanel';
|
|
|
|
import { DefaultDist } from './ScenePanel';
|
|
|
|
import { SunLightStore } from './SunLightStore';
|
|
|
|
import { SunLightStore } from './SunLightStore';
|
|
|
@ -181,6 +182,35 @@ export default class SunLightGui extends Component
|
|
|
|
this.SyncSunLight();
|
|
|
|
this.SyncSunLight();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetSunLightSourceAngle = async (val: number) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const KEY = '修改太阳光源角度';
|
|
|
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (app.Database.hm.UndoData.CommandName !== KEY)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await app.Editor.ModalManage.EndExecingCmd();
|
|
|
|
|
|
|
|
if (CommandState.CommandIng)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
|
|
|
message: "命令正在执行中!无法修改太阳光源角度!",
|
|
|
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
|
|
|
intent: Intent.DANGER
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
commandMachine.CommandStart(KEY);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
commandMachine.CommandStart(KEY);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
app.Database.SunLight.LightSourceAngle = val;
|
|
|
|
|
|
|
|
this.store.sunLightSourceAngle = val;
|
|
|
|
|
|
|
|
this.SyncSunLight();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SetSunLightPosition = (rotate: number, elevation: number): void =>
|
|
|
|
SetSunLightPosition = (rotate: number, elevation: number): void =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let pos: Vector3;
|
|
|
|
let pos: Vector3;
|
|
|
@ -384,6 +414,67 @@ export default class SunLightGui extends Component
|
|
|
|
</Tooltip>
|
|
|
|
</Tooltip>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</FormGroup>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
|
|
|
|
<div className='sun-light-angle'>
|
|
|
|
|
|
|
|
<Label>源角度:</Label>
|
|
|
|
|
|
|
|
<INumericInput
|
|
|
|
|
|
|
|
style={{ marginLeft: "none" }}
|
|
|
|
|
|
|
|
min={0}
|
|
|
|
|
|
|
|
max={5}
|
|
|
|
|
|
|
|
float={4}
|
|
|
|
|
|
|
|
stepSize={0.0001}
|
|
|
|
|
|
|
|
value={this.store.sunLightSourceAngle}
|
|
|
|
|
|
|
|
onValueChange={async (num) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (num < 0 || num > 5) return;
|
|
|
|
|
|
|
|
this.SetSunLightSourceAngle(num);
|
|
|
|
|
|
|
|
app.Viewer.UpdateRender();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
onBlur={() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const KEY = '修改太阳光源角度';
|
|
|
|
|
|
|
|
if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY)
|
|
|
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Slider
|
|
|
|
|
|
|
|
min={0}
|
|
|
|
|
|
|
|
max={5}
|
|
|
|
|
|
|
|
stepSize={.0001}
|
|
|
|
|
|
|
|
value={this.store.sunLightSourceAngle}
|
|
|
|
|
|
|
|
onChange={async (val) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await this.SetSunLightSourceAngle(val);
|
|
|
|
|
|
|
|
app.Viewer.UpdateRender();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
onRelease={() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
const KEY = '修改太阳光源角度';
|
|
|
|
|
|
|
|
if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY)
|
|
|
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Tooltip content='重置太阳光源角度'
|
|
|
|
|
|
|
|
minimal
|
|
|
|
|
|
|
|
placement='top'
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
style={{ marginLeft: "auto" }}
|
|
|
|
|
|
|
|
minimal small
|
|
|
|
|
|
|
|
intent={Intent.PRIMARY}
|
|
|
|
|
|
|
|
icon='redo'
|
|
|
|
|
|
|
|
onClick={async () =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await this.SetSunLightSourceAngle(0.5357);
|
|
|
|
|
|
|
|
app.Viewer.UpdateRender();
|
|
|
|
|
|
|
|
const KEY = '修改太阳光源角度';
|
|
|
|
|
|
|
|
if (CommandState.CommandIng && app.Database.hm.UndoData.CommandName === KEY)
|
|
|
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
<FormGroup
|
|
|
|
label='颜色:'
|
|
|
|
label='颜色:'
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|