|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import { Box3, Face3, Geometry, Matrix4, Mesh, MeshNormalMaterial, Object3D, ShapeUtils, Vector2, Vector3 } from "three";
|
|
|
|
|
import { Box3, BufferGeometry, Face3, Geometry, Matrix4, Mesh, MeshNormalMaterial, Object3D, ShapeUtils, Vector2, Vector3 } from "three";
|
|
|
|
|
import { ColorMaterial } from "../../Common/ColorPalette";
|
|
|
|
|
import { Object3DRemoveAll } from "../../Common/Dispose";
|
|
|
|
|
import { FixIndex, clamp } from "../../Common/Utils";
|
|
|
|
|
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
|
|
|
|
|
import { AsVector2, YAxis, ZeroVec, angle, equaln, equalv3, isParallelTo } from "../../Geometry/GeUtils";
|
|
|
|
|
import { AsVector3, YAxis, ZeroVec, angle, equaln, equalv3, isParallelTo } from "../../Geometry/GeUtils";
|
|
|
|
|
import { Matrix2 } from "../../Geometry/Matrix2";
|
|
|
|
|
import { Orbit } from "../../Geometry/Orbit";
|
|
|
|
|
import { RenderType } from "../../GraphicsSystem/RenderType";
|
|
|
|
@ -145,7 +145,10 @@ export class RevolveSolid extends Entity
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private _MeshGeometry: Geometry;
|
|
|
|
|
//del_exp_start
|
|
|
|
|
private _MeshGeometry: BufferGeometry;
|
|
|
|
|
//del_exp_end
|
|
|
|
|
//del_exp_start//del_exp_end private _MeshGeometry: Geometry;
|
|
|
|
|
|
|
|
|
|
get BoundingBox()
|
|
|
|
|
{
|
|
|
|
@ -187,22 +190,15 @@ export class RevolveSolid extends Entity
|
|
|
|
|
|
|
|
|
|
if (this._CacheContourPoints === undefined)
|
|
|
|
|
{
|
|
|
|
|
this._CacheContourPoints3D = [];
|
|
|
|
|
let ocsInv = this._Contour.OCSInv;
|
|
|
|
|
for (let i = 0; i < this._Contour.EndParam; i++)
|
|
|
|
|
this._CacheContourPoints = [];
|
|
|
|
|
for (let p of this._Contour.Shape.getPoints(6))
|
|
|
|
|
{
|
|
|
|
|
let c = this._Contour.GetCurveAtIndex(i);
|
|
|
|
|
this._CacheContourPoints3D.push(c.StartPoint);
|
|
|
|
|
if (c instanceof Arc)
|
|
|
|
|
{
|
|
|
|
|
let minCount = Math.max(2, Math.ceil((c.AllAngle) / Math.PI) * 3);
|
|
|
|
|
let count = clamp(c.Length / 20, minCount, 30);
|
|
|
|
|
for (let j = 0; j < count; j++)
|
|
|
|
|
this._CacheContourPoints3D.push(c.GetPointAtParam((j + 1) / (count + 1)));
|
|
|
|
|
}
|
|
|
|
|
this._CacheContourPoints3D.push(c.EndPoint);
|
|
|
|
|
this._CacheContourPoints.push(p);
|
|
|
|
|
if (p["_mask_"])
|
|
|
|
|
this._CacheContourPoints.push(p);
|
|
|
|
|
}
|
|
|
|
|
this._CacheContourPoints = this._CacheContourPoints3D.map(p => AsVector2(p.clone().applyMatrix4(ocsInv)));
|
|
|
|
|
|
|
|
|
|
this._CacheContourPoints3D = this._CacheContourPoints.map(p => AsVector3(p).applyMatrix4(this._Contour.OCSNoClone));
|
|
|
|
|
|
|
|
|
|
this._CacheContourFaces = ShapeUtils.triangulateShape(this._CacheContourPoints, []) as [number, number, number][];
|
|
|
|
|
|
|
|
|
@ -284,8 +280,11 @@ export class RevolveSolid extends Entity
|
|
|
|
|
RevolveLine(geo, this._CacheContourPoints3DQ, this._CacheContourPoints3DQ2, this._StartAngle, allAngle, us);
|
|
|
|
|
geo.computeFaceNormals();
|
|
|
|
|
geo.computeVertexNormals();
|
|
|
|
|
this._MeshGeometry = geo;
|
|
|
|
|
return geo;
|
|
|
|
|
|
|
|
|
|
//del_exp_start 因为UE不需要BufferGeometry 直接提供Geom就好了
|
|
|
|
|
this._MeshGeometry = new BufferGeometry().fromGeometry(geo);
|
|
|
|
|
//del_exp_end
|
|
|
|
|
return this._MeshGeometry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#region Draw
|
|
|
|
|