!1720 修复:矩形灯面板方向按钮错误问题

pull/1752/MERGE
林三 3 years ago committed by ChenX
parent ca7b0be058
commit 04302ec3be

@ -26,6 +26,9 @@ export class DrawRectAreaLight implements Command
light.Height = Math.abs(rectRes.Height);
light.ApplyMatrix(app.Editor.UCSMatrix);
light.Position = midPoint(rectRes.Point1WCS, rectRes.Point2WCS);
let target = light.Position.add(light.Normal.multiplyScalar(1000));
target.applyMatrix4(light.OCSInv).negate().applyMatrix4(light.OCSNoClone);
light.Target = target;
});
let lightStore = LightStore.GetInstance();

@ -110,12 +110,16 @@ export class RectAreaLight extends Light
}
else if (i === 5)
{
let target = pts[0].setFromMatrixPosition(this._Matrix).add(this.Normal.multiplyScalar(TARGET_DISTANCE)).add(vec);
target.applyMatrix4(this.OCSInv).negate().applyMatrix4(this.OCSNoClone);
this._Matrix.lookAt(target, this.Position, YAxis);
this.Update(UpdateDraw.Matrix);
this.Target = this.Target.add(vec);
this.lookAtTarget();
}
}
lookAtTarget()
{
this._Matrix.lookAt(this.Position, this.Target, YAxis);
this.Update(UpdateDraw.Matrix);
}
get Height()
{
return this._Height;

@ -9,6 +9,7 @@ import { Entitys2Data } from "../../../Add-on/ExportData";
import { app } from "../../../ApplicationServices/Application";
import { ResourcesCDN_HOST } from "../../../Common/HostUrl";
import { KeyBoard } from "../../../Common/KeyEnum";
import { UpdateDraw } from "../../../Common/Status";
import { FixedNotZero } from "../../../Common/Utils";
import { DirectionalLight } from "../../../DatabaseServices/Lights/DirectionalLight";
import { Light } from "../../../DatabaseServices/Lights/Light";
@ -80,10 +81,17 @@ export class SpotLightModel extends React.Component<{ store: LightStore; configS
}
if (isDirection)
{
(light as SpotLight | DirectionalLight).Target = ptRes.Point;
app.Editor.UpdateScreen();
this._Target = ptRes.Point.clone().sub(this.props.store.currentSelectEnt.Position).normalize().ceil().toArray().toString();
if (light instanceof SpotLight || light instanceof DirectionalLight)
{
light.Target = ptRes.Point;
this._Target = ptRes.Point.clone().sub(this.props.store.currentSelectEnt.Position).normalize().ceil().toArray().toString();
light.Update(UpdateDraw.Matrix);
}
else if (light instanceof RectAreaLight)
{
light.Target = ptRes.Point;
light.lookAtTarget();
}
if (userConfig.synchronousEnable)
app.WebSocket.Send(JSON.stringify(Entitys2Data([light])));
}

Loading…
Cancel
Save