|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { autorun, observable } from "mobx";
|
|
|
|
|
import { Light as TLight, Mesh, MeshPhysicalMaterial, Vector3 } from 'three';
|
|
|
|
|
import { Light as TLight, Mesh, MeshPhysicalMaterial } from 'three';
|
|
|
|
|
import { end } from "xaop";
|
|
|
|
|
import { app } from "../../../ApplicationServices/Application";
|
|
|
|
|
import { HostApplicationServices } from "../../../ApplicationServices/HostApplicationServices";
|
|
|
|
@ -9,6 +9,7 @@ import { AmbientLight } from "../../../DatabaseServices/Lights/AmbientLight";
|
|
|
|
|
import { DirectionalLight } from "../../../DatabaseServices/Lights/DirectionalLight";
|
|
|
|
|
import { HemisphereLight } from "../../../DatabaseServices/Lights/HemisphereLight";
|
|
|
|
|
import { Light } from "../../../DatabaseServices/Lights/Light";
|
|
|
|
|
import { commandMachine } from "../../../Editor/CommandMachine";
|
|
|
|
|
|
|
|
|
|
export interface LightModalState
|
|
|
|
|
{
|
|
|
|
@ -43,10 +44,13 @@ export class LightStore
|
|
|
|
|
@observable isShowShadow = false;
|
|
|
|
|
constructor()
|
|
|
|
|
{
|
|
|
|
|
commandMachine.CommandStart("初始化灯光");
|
|
|
|
|
autorun(() => this.TriggerLight(this.m_AmbientLight, this.m_ShowAmbientLight));
|
|
|
|
|
autorun(() => this.TriggerLight(this.m_DirectionalLight, this.m_ShowDirLight));
|
|
|
|
|
autorun(() => this.TriggerLight(this.m_HemisphereLight, this.m_ShowHemiLight));
|
|
|
|
|
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
|
|
|
|
|
this.WatchLightEvent();
|
|
|
|
|
}
|
|
|
|
|
private TriggerLight(lg: Light, isShow: boolean)
|
|
|
|
@ -77,6 +81,7 @@ export class LightStore
|
|
|
|
|
}
|
|
|
|
|
InitScene()
|
|
|
|
|
{
|
|
|
|
|
commandMachine.CommandStart("初始化灯光");
|
|
|
|
|
this.m_ShowAmbientLight = true;
|
|
|
|
|
this.m_AmbientLight = new AmbientLight();
|
|
|
|
|
this.m_ShowDirLight = false;
|
|
|
|
@ -109,6 +114,8 @@ export class LightStore
|
|
|
|
|
{
|
|
|
|
|
app.Database.ModelSpace.Append(this.m_AmbientLight);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandMachine.CommandEnd();
|
|
|
|
|
}
|
|
|
|
|
ShowShadowObject(isShow: boolean)
|
|
|
|
|
{
|
|
|
|
@ -161,7 +168,7 @@ export class LightStore
|
|
|
|
|
end(app.Database.ModelSpace, app.Database.ModelSpace.AppendEvent, function (ent: Entity)
|
|
|
|
|
{
|
|
|
|
|
lgStore.WatchLight(ent, false);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private WatchLight(lg: Entity, IsErase: boolean)
|
|
|
|
|
{
|
|
|
|
|