|
|
@ -1,6 +1,6 @@
|
|
|
|
import { Button, Card, Classes, Intent } from '@blueprintjs/core';
|
|
|
|
import { Button, Card, Classes, Intent } from '@blueprintjs/core';
|
|
|
|
import * as React from 'react';
|
|
|
|
import * as React from 'react';
|
|
|
|
import { Vector3 } from 'three';
|
|
|
|
import { MathUtils, Vector3 } from 'three';
|
|
|
|
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter';
|
|
|
|
import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter';
|
|
|
|
import { begin } from 'xaop';
|
|
|
|
import { begin } from 'xaop';
|
|
|
|
import { app } from "../ApplicationServices/Application";
|
|
|
|
import { app } from "../ApplicationServices/Application";
|
|
|
@ -23,6 +23,11 @@ import { Polyline } from "../DatabaseServices/Entity/Polyline";
|
|
|
|
import { Region } from "../DatabaseServices/Entity/Region";
|
|
|
|
import { Region } from "../DatabaseServices/Entity/Region";
|
|
|
|
import { HardwareCompositeEntity } from '../DatabaseServices/Hardware/HardwareCompositeEntity';
|
|
|
|
import { HardwareCompositeEntity } from '../DatabaseServices/Hardware/HardwareCompositeEntity';
|
|
|
|
import { HardwareTopline } from '../DatabaseServices/Hardware/HardwareTopline';
|
|
|
|
import { HardwareTopline } from '../DatabaseServices/Hardware/HardwareTopline';
|
|
|
|
|
|
|
|
import { DirectionalLight } from "../DatabaseServices/Lights/DirectionalLight";
|
|
|
|
|
|
|
|
import { HemisphereLight } from '../DatabaseServices/Lights/HemisphereLight';
|
|
|
|
|
|
|
|
import { PointLight } from '../DatabaseServices/Lights/PointLight';
|
|
|
|
|
|
|
|
import { RectAreaLight } from '../DatabaseServices/Lights/RectAreaLight';
|
|
|
|
|
|
|
|
import { SpotLight } from '../DatabaseServices/Lights/SpotLight';
|
|
|
|
import { PhysicalMaterialRecord } from "../DatabaseServices/PhysicalMaterialRecord";
|
|
|
|
import { PhysicalMaterialRecord } from "../DatabaseServices/PhysicalMaterialRecord";
|
|
|
|
import { Shape } from "../DatabaseServices/Shape";
|
|
|
|
import { Shape } from "../DatabaseServices/Shape";
|
|
|
|
import { TextureTableRecord } from "../DatabaseServices/Texture";
|
|
|
|
import { TextureTableRecord } from "../DatabaseServices/Texture";
|
|
|
@ -35,6 +40,7 @@ import { ModalPosition } from '../UI/Components/Modal/ModalInterface';
|
|
|
|
import { TopPanelStore } from '../UI/Store/TopPanelStore';
|
|
|
|
import { TopPanelStore } from '../UI/Store/TopPanelStore';
|
|
|
|
import { Hole } from './../DatabaseServices/3DSolid/Hole';
|
|
|
|
import { Hole } from './../DatabaseServices/3DSolid/Hole';
|
|
|
|
import { CompositeEntity } from './../DatabaseServices/Entity/CompositeEntity';
|
|
|
|
import { CompositeEntity } from './../DatabaseServices/Entity/CompositeEntity';
|
|
|
|
|
|
|
|
|
|
|
|
export class ExportDataModal extends React.Component<{ msg: string; }, {}>{
|
|
|
|
export class ExportDataModal extends React.Component<{ msg: string; }, {}>{
|
|
|
|
private removeFuncs: Function[] = []; //移除注入
|
|
|
|
private removeFuncs: Function[] = []; //移除注入
|
|
|
|
private Close()
|
|
|
|
private Close()
|
|
|
@ -131,6 +137,16 @@ export function Entitys2Data(ents: Entity[]): Data
|
|
|
|
d.Entitys.push(ConvertRevolve2Data(e));
|
|
|
|
d.Entitys.push(ConvertRevolve2Data(e));
|
|
|
|
else if (e instanceof EntityRef)
|
|
|
|
else if (e instanceof EntityRef)
|
|
|
|
d.Entitys.push(ConveEntityRef2Data(e));
|
|
|
|
d.Entitys.push(ConveEntityRef2Data(e));
|
|
|
|
|
|
|
|
else if (e instanceof DirectionalLight)
|
|
|
|
|
|
|
|
d.Entitys.push(ConverDirectionalLight2Data(e));
|
|
|
|
|
|
|
|
else if (e instanceof PointLight)
|
|
|
|
|
|
|
|
d.Entitys.push(ConverPointLight2Data(e));
|
|
|
|
|
|
|
|
else if (e instanceof SpotLight)
|
|
|
|
|
|
|
|
d.Entitys.push(ConverSpotLight2Data(e));
|
|
|
|
|
|
|
|
else if (e instanceof RectAreaLight)
|
|
|
|
|
|
|
|
d.Entitys.push(ConverRectAreaLight2Data(e));
|
|
|
|
|
|
|
|
else if (e instanceof HemisphereLight)
|
|
|
|
|
|
|
|
d.Entitys.push(ConverHemisphereLight2Data(e));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
@ -334,6 +350,126 @@ function CompositeEntity2Data(comp: CompositeEntity)
|
|
|
|
return data;
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ConverDirectionalLight2Data(light: DirectionalLight)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let ed: any = {};
|
|
|
|
|
|
|
|
ed.Id = light.Id?.Index ?? 0;
|
|
|
|
|
|
|
|
ed.Type = "DirectionalLight";
|
|
|
|
|
|
|
|
ed.LightSourceAngle = light.LightSourceAngle;
|
|
|
|
|
|
|
|
ed.LightSourceSoftAngle = light.LightSourceSoftAngle;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.Color = light.Color.toArray();
|
|
|
|
|
|
|
|
ed.Intensity = light.Intensity;
|
|
|
|
|
|
|
|
ed.Temperature = light.Temperature;
|
|
|
|
|
|
|
|
ed.IndirectLightingIntensity = light.IndirectLightingIntensity;
|
|
|
|
|
|
|
|
ed.CaseShadow = light.CaseShadow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ed.SpecularScale = light.SpecularScale; 默认为0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//阳光照射方向
|
|
|
|
|
|
|
|
let rotateV = light.Position.sub(light.Target).normalize();
|
|
|
|
|
|
|
|
ed.theta = Math.atan2(rotateV.y, rotateV.x) * MathUtils.RAD2DEG;
|
|
|
|
|
|
|
|
ed.phi = Math.asin(rotateV.z) * MathUtils.RAD2DEG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ConverPointLight2Data(light: PointLight)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let ed: any = {};
|
|
|
|
|
|
|
|
ed.Id = light.Id?.Index ?? 0;
|
|
|
|
|
|
|
|
ed.Type = "PointLight";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.Color = light.Color.toArray();
|
|
|
|
|
|
|
|
ed.Intensity = light.Intensity;
|
|
|
|
|
|
|
|
ed.Temperature = light.Temperature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.SourceRadius = light.SourceRadius;
|
|
|
|
|
|
|
|
ed.SoftSourceRadius = light.SoftSourceRadius;
|
|
|
|
|
|
|
|
ed.SourceLength = light.SourceLength;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.AttenuationRadius = light.AttenuationRadius;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.IndirectLightingIntensity = light.IndirectLightingIntensity;
|
|
|
|
|
|
|
|
ed.CaseShadow = light.CaseShadow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.SpecularScale = light.SpecularScale;
|
|
|
|
|
|
|
|
return ed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ConverSpotLight2Data(light: SpotLight)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let ed: any = {};
|
|
|
|
|
|
|
|
ed.Id = light.Id?.Index ?? 0;
|
|
|
|
|
|
|
|
ed.Type = "SpotLight";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.Color = light.Color.toArray();
|
|
|
|
|
|
|
|
ed.Intensity = light.Intensity;
|
|
|
|
|
|
|
|
ed.Temperature = light.Temperature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.SourceRadius = light.SourceRadius;
|
|
|
|
|
|
|
|
ed.SoftSourceRadius = light.SoftSourceRadius;
|
|
|
|
|
|
|
|
ed.SourceLength = light.SourceLength;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.AttenuationRadius = light.AttenuationRadius;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.InnerConeAngle = light.InnerConeAngle;
|
|
|
|
|
|
|
|
ed.OuterConeAngle = light.OuterConeAngle;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.IndirectLightingIntensity = light.IndirectLightingIntensity;
|
|
|
|
|
|
|
|
ed.CaseShadow = light.CaseShadow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.SpecularScale = light.SpecularScale;
|
|
|
|
|
|
|
|
return ed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ConverRectAreaLight2Data(light: RectAreaLight)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let ed: any = {};
|
|
|
|
|
|
|
|
ed.Id = light.Id?.Index ?? 0;
|
|
|
|
|
|
|
|
ed.Type = "RectAreaLight";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.Color = light.Color.toArray();
|
|
|
|
|
|
|
|
ed.Intensity = light.Intensity;
|
|
|
|
|
|
|
|
ed.Temperature = light.Temperature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.AttenuationRadius = light.AttenuationRadius;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.BarnDoorAngle = light.BarnDoorAngle;
|
|
|
|
|
|
|
|
ed.BarnDoorLength = light.BarnDoorLength;
|
|
|
|
|
|
|
|
ed.SourceTexture = light.SourceTexture;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.IndirectLightingIntensity = light.IndirectLightingIntensity;
|
|
|
|
|
|
|
|
ed.CaseShadow = light.CaseShadow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.SpecularScale = light.SpecularScale;
|
|
|
|
|
|
|
|
return ed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ConverHemisphereLight2Data(light: HemisphereLight)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let ed: any = {};
|
|
|
|
|
|
|
|
ed.Id = light.Id?.Index ?? 0;
|
|
|
|
|
|
|
|
ed.Type = "HemisphereLight";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//立方体贴图 默认 不变
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ed.Color = light.Color.toArray();
|
|
|
|
|
|
|
|
ed.Intensity = light.Intensity;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// light.GroundColor 底色(默认黑色)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ed.Temperature = light.Temperature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ed.IndirectLightingIntensity = light.IndirectLightingIntensity;
|
|
|
|
|
|
|
|
// ed.CaseShadow = light.CaseShadow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ed.SpecularScale = light.SpecularScale;
|
|
|
|
|
|
|
|
return ed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//OBJ文件
|
|
|
|
//OBJ文件
|
|
|
|
const objExport = new OBJExporter;
|
|
|
|
const objExport = new OBJExporter;
|
|
|
|
function GetOBJFileData(en: Entity): string
|
|
|
|
function GetOBJFileData(en: Entity): string
|
|
|
|