1
This commit is contained in:
@@ -5,41 +5,41 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 计算位置到边上最近的点
|
||||
/// </summary>
|
||||
public class AlgorithmSidePoint : ModuleAlgorithm<DataIntersect> {
|
||||
//public class AlgorithmSidePoint : ModuleAlgorithm<DataIntersect> {
|
||||
|
||||
protected override void Awake() => ModuleCore.AlgorithmSidePoint = this;
|
||||
// protected override void Awake() => ModuleCore.AlgorithmSidePoint = this;
|
||||
|
||||
public override void Compute(DataIntersect data) {
|
||||
Vector3 position = data.position - data.side.plate.designPosition;
|
||||
for (int i = 0; i < data.side.lines.Length; i++) {
|
||||
DataLine line = data.side.lines[i];
|
||||
if (!Compute(line, position, out Vector3 intersectPoint)) { continue; }
|
||||
data.isIntersect = true;
|
||||
data.intersectPoint = intersectPoint + data.side.plate.designPosition;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// public override void Compute(DataIntersect data) {
|
||||
// Vector3 position = data.position - data.side.plate.designPosition;
|
||||
// for (int i = 0; i < data.side.lines.Length; i++) {
|
||||
// DataLine line = data.side.lines[i];
|
||||
// if (!Compute(line, position, out Vector3 intersectPoint)) { continue; }
|
||||
// data.isIntersect = true;
|
||||
// data.intersectPoint = intersectPoint + data.side.plate.designPosition;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private bool Compute(DataLine line, Vector3 position, out Vector3 intersectPoint) {
|
||||
return ProjectDistance(line.a, line.b, position, out intersectPoint);
|
||||
}
|
||||
// /// <summary> 查询匹配的边 </summary>
|
||||
// private bool Compute(DataLine line, Vector3 position, out Vector3 intersectPoint) {
|
||||
// return ProjectDistance(line.a, line.b, position, out intersectPoint);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 向量投影法
|
||||
/// 计算点c到线段ab最近的点
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns>如果不在线段上返回 false</returns>
|
||||
public static bool ProjectDistance(Vector3 a, Vector3 b, Vector3 c, out Vector3 intersectPoint) {
|
||||
Vector3 ab = b - a;
|
||||
Vector3 ac = c - a;
|
||||
Vector3 p = Vector3.Project(ac, ab.normalized);
|
||||
intersectPoint = p + a;
|
||||
if (ab.normalized != p.normalized) { return false; }
|
||||
if (ab.magnitude < p.magnitude) { return false; }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 向量投影法
|
||||
// /// 计算点c到线段ab最近的点
|
||||
// /// </summary>
|
||||
// /// <param name="a"></param>
|
||||
// /// <param name="b"></param>
|
||||
// /// <param name="c"></param>
|
||||
// /// <returns>如果不在线段上返回 false</returns>
|
||||
// public static bool ProjectDistance(Vector3 a, Vector3 b, Vector3 c, out Vector3 intersectPoint) {
|
||||
// Vector3 ab = b - a;
|
||||
// Vector3 ac = c - a;
|
||||
// Vector3 p = Vector3.Project(ac, ab.normalized);
|
||||
// intersectPoint = p + a;
|
||||
// if (ab.normalized != p.normalized) { return false; }
|
||||
// if (ab.magnitude < p.magnitude) { return false; }
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -6,18 +6,18 @@ using UnityEngine;
|
||||
/// 散列点生成简单多边形算法
|
||||
/// </summary>
|
||||
public class AlgorithmSimplePolygon : ModuleAlgorithm<DataPlate> {
|
||||
private UnitAlgorithm<DataPlate> AlgorithmSideSubdivision = new UnitAlgorithmBezier();
|
||||
private UnitAlgorithm<DataPlate> AlgorithmTriangle = new UnitAlgorithmEarCutting();
|
||||
private UnitAlgorithm<DataPlate> AlgorithmMergeTriangle = new UnitAlgorithmMergeTriangle();
|
||||
private UnitAlgorithm<DataPlateDesign> AlgorithmSideSubdivision = new UnitAlgorithmJobsSideSubdivision();
|
||||
private UnitAlgorithm<DataPlateDesign> AlgorithmTriangle = new UnitAlgorithmEarCutting();
|
||||
private UnitAlgorithm<DataPlateDesign> AlgorithmMergeTriangle = new UnitAlgorithmMergeTriangle();
|
||||
|
||||
protected override void Awake() => ModuleCore.AlgorithmSimplePolygon = this;
|
||||
|
||||
public override void Compute(DataPlate data) {
|
||||
public override void Compute(DataPlate plate) {
|
||||
//遍历计算边(DataSide)上的细分点(positions)和线(lines)
|
||||
AlgorithmSideSubdivision.Compute(data);
|
||||
AlgorithmSideSubdivision.Compute(plate.dataDesign);
|
||||
//计算三角面
|
||||
AlgorithmTriangle.Compute(data);
|
||||
AlgorithmTriangle.Compute(plate.dataDesign);
|
||||
//三角面列表转换网格
|
||||
AlgorithmMergeTriangle.Compute(data);
|
||||
AlgorithmMergeTriangle.Compute(plate.dataDesign);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合边算法模块
|
||||
/// </summary>
|
||||
public class AlgorithmSuture : ModuleAlgorithm<DataSuture> {
|
||||
/// <summary> 设计的缝合线 </summary>
|
||||
public UnitAlgorithm<DataSutureSide> SutureDesign = new UnitAlgorithmSutureDesign();
|
||||
/// <summary> 烘焙的缝合线 </summary>
|
||||
public UnitAlgorithm<DataSutureSide> SutureBaking = new UnitAlgorithmSutureBaking();
|
||||
|
||||
protected override void Awake() => ModuleCore.AlgorithmSuture = this;
|
||||
|
||||
public override void Compute(DataSuture suture) {
|
||||
//缝合边长
|
||||
float aLength = suture.a.plateSide.dataDesign.length;
|
||||
float bLength = suture.b.plateSide.dataDesign.length;
|
||||
suture.length = aLength < bLength ? aLength : bLength;
|
||||
//设计缝合顶点
|
||||
SutureDesign.Compute(suture.a);
|
||||
SutureDesign.Compute(suture.b);
|
||||
//烘焙缝合顶点
|
||||
SutureBaking.Compute(suture.a);
|
||||
SutureBaking.Compute(suture.b);
|
||||
//缝合锚点
|
||||
suture.points = new List<DataSuturePoint>();
|
||||
suture.points.AddRange(Compute(suture.a, suture.b));
|
||||
suture.points.AddRange(Compute(suture.b, suture.a));
|
||||
}
|
||||
private List<DataSuturePoint> Compute(DataSutureSide a, DataSutureSide b) {
|
||||
DataSutureSideVertex[] vertexs = a.dataBaking.vertexs;
|
||||
DataSutureSideVertex[] allVertexs = b.dataBaking.allVertexs;
|
||||
List<DataSuturePoint> suturePoints = new List<DataSuturePoint>();
|
||||
for (int i = 0; i < vertexs.Length; i++) {
|
||||
DataSutureSideVertex vertex = vertexs[i];
|
||||
for (int j = 0; j < allVertexs.Length; j++) {
|
||||
DataSutureSideVertex anchor = allVertexs[j];
|
||||
if (anchor.MaxDistance < vertex.origin) { continue; }
|
||||
DataSuturePoint suturePoint = new DataSuturePoint();
|
||||
suturePoint.distance = vertex.origin - anchor.origin;
|
||||
suturePoint.vertex = vertex.a;
|
||||
suturePoint.aAnchor = anchor.a;
|
||||
suturePoint.bAnchor = anchor.b;
|
||||
suturePoints.Add(suturePoint);
|
||||
}
|
||||
}
|
||||
return suturePoints;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc0a831375a5abe418c790ae74a19376
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -6,62 +6,62 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 缝合边算法模块
|
||||
/// </summary>
|
||||
public class AlgorithmSutureSide : ModuleAlgorithm<DataSutureSide> {
|
||||
public class VertexPosition : IComparable<VertexPosition> {
|
||||
public Vector3 designPosition;
|
||||
public Vector3 bakingPosition;
|
||||
public float distance;
|
||||
public int CompareTo(VertexPosition other) {
|
||||
return other.distance >= distance ? 1 : -1;
|
||||
}
|
||||
}
|
||||
//public class AlgorithmSutureSide : ModuleAlgorithm<DataSutureSide> {
|
||||
// public class VertexPosition : IComparable<VertexPosition> {
|
||||
// public Vector3 designPosition;
|
||||
// public Vector3 bakingPosition;
|
||||
// public float distance;
|
||||
// public int CompareTo(VertexPosition other) {
|
||||
// return other.distance >= distance ? 1 : -1;
|
||||
// }
|
||||
// }
|
||||
|
||||
protected override void Awake() => ModuleCore.AlgorithmSutureSide = this;
|
||||
// protected override void Awake() => ModuleCore.AlgorithmSutureSide = this;
|
||||
|
||||
public override void Compute(DataSutureSide data) {
|
||||
//List<VertexPosition> vertexPositions = VertexPositions(data);
|
||||
data.designPositions = VertexToDesignPositions(data).ToArray();
|
||||
data.bakingPositions = VertexToBakingPositions(data).ToArray();
|
||||
}
|
||||
// public override void Compute(DataSutureSide data) {
|
||||
// //List<VertexPosition> vertexPositions = VertexPositions(data);
|
||||
// data.designPositions = VertexToDesignPositions(data).ToArray();
|
||||
// data.bakingPositions = VertexToBakingPositions(data).ToArray();
|
||||
// }
|
||||
|
||||
private List<VertexPosition> VertexPositions(DataSutureSide sutureSide) {
|
||||
List<VertexPosition> vertexPositions = new List<VertexPosition>();
|
||||
for (int i = 0; i < sutureSide.Vertices.Length; i++) {
|
||||
Vector3 design = sutureSide.Vertices[i].design;
|
||||
Quaternion quaternion = Quaternion.Euler(sutureSide.PlateBakingEulerAngles);
|
||||
Vector3 baking = quaternion * sutureSide.Vertices[i].design;
|
||||
VertexPosition vertexPosition = new VertexPosition();
|
||||
vertexPosition.designPosition = design + sutureSide.PlateDesignPosition;
|
||||
vertexPosition.bakingPosition = baking + sutureSide.PlateBakingPosition;
|
||||
vertexPosition.distance = Vector3.Distance(design, sutureSide.side.aPoint.position);
|
||||
vertexPositions.Add(vertexPosition);
|
||||
}
|
||||
//按距离从小到大排序
|
||||
vertexPositions.Sort();
|
||||
//是否颠倒
|
||||
if (sutureSide.isReversal) { vertexPositions.Reverse(); }
|
||||
return vertexPositions;
|
||||
}
|
||||
private List<Vector3> VertexToDesignPositions(DataSutureSide data) {
|
||||
//转换列表
|
||||
List<Vector3> positions = new List<Vector3>();
|
||||
for (int i = 0; i < data.Vertices.Length; i++) {
|
||||
Vector3 position = data.Vertices[i].design + data.PlateDesignPosition;
|
||||
positions.Add(position);
|
||||
}
|
||||
if (data.isReversal) { positions.Reverse(); }
|
||||
return positions;
|
||||
}
|
||||
private List<Vector3> VertexToBakingPositions(DataSutureSide data) {
|
||||
//转换列表
|
||||
List<Vector3> positions = new List<Vector3>();
|
||||
for (int i = 0; i < data.Vertices.Length; i++) {
|
||||
Quaternion quaternion = Quaternion.Euler(data.PlateBakingEulerAngles);
|
||||
Vector3 baking = quaternion * data.Vertices[i].design;
|
||||
Vector3 position = baking + data.PlateBakingPosition;
|
||||
positions.Add(position);
|
||||
}
|
||||
if (data.isReversal) { positions.Reverse(); }
|
||||
return positions;
|
||||
}
|
||||
}
|
||||
// private List<VertexPosition> VertexPositions(DataSutureSide sutureSide) {
|
||||
// List<VertexPosition> vertexPositions = new List<VertexPosition>();
|
||||
// for (int i = 0; i < sutureSide.Vertices.Length; i++) {
|
||||
// Vector3 design = sutureSide.Vertices[i].design;
|
||||
// Quaternion quaternion = Quaternion.Euler(sutureSide.PlateBakingEulerAngles);
|
||||
// Vector3 baking = quaternion * sutureSide.Vertices[i].design;
|
||||
// VertexPosition vertexPosition = new VertexPosition();
|
||||
// vertexPosition.designPosition = design + sutureSide.PlateDesignPosition;
|
||||
// vertexPosition.bakingPosition = baking + sutureSide.PlateBakingPosition;
|
||||
// vertexPosition.distance = Vector3.Distance(design, sutureSide.side.aPoint.position);
|
||||
// vertexPositions.Add(vertexPosition);
|
||||
// }
|
||||
// //按距离从小到大排序
|
||||
// vertexPositions.Sort();
|
||||
// //是否颠倒
|
||||
// if (sutureSide.isReversal) { vertexPositions.Reverse(); }
|
||||
// return vertexPositions;
|
||||
// }
|
||||
// private List<Vector3> VertexToDesignPositions(DataSutureSide data) {
|
||||
// //转换列表
|
||||
// List<Vector3> positions = new List<Vector3>();
|
||||
// for (int i = 0; i < data.Vertices.Length; i++) {
|
||||
// Vector3 position = data.Vertices[i].design + data.PlateDesignPosition;
|
||||
// positions.Add(position);
|
||||
// }
|
||||
// if (data.isReversal) { positions.Reverse(); }
|
||||
// return positions;
|
||||
// }
|
||||
// private List<Vector3> VertexToBakingPositions(DataSutureSide data) {
|
||||
// //转换列表
|
||||
// List<Vector3> positions = new List<Vector3>();
|
||||
// for (int i = 0; i < data.Vertices.Length; i++) {
|
||||
// Quaternion quaternion = Quaternion.Euler(data.PlateBakingEulerAngles);
|
||||
// Vector3 baking = quaternion * data.Vertices[i].design;
|
||||
// Vector3 position = baking + data.PlateBakingPosition;
|
||||
// positions.Add(position);
|
||||
// }
|
||||
// if (data.isReversal) { positions.Reverse(); }
|
||||
// return positions;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ResetBakingPolygon : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f24a4f73b9925a9478f58b089059ef1e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,14 +17,14 @@ public class AssetsPlate : ModuleAssets<DataPlate> {
|
||||
|
||||
protected override void Awake() => ModuleCore.AssetsPlate = this;
|
||||
|
||||
public override void Add(DataPlate data) {
|
||||
if (dataPlates.Contains(data)) { return; }
|
||||
dataPlates.Add(data);
|
||||
public override void Add(DataPlate plate) {
|
||||
if (dataPlates.Contains(plate)) { return; }
|
||||
dataPlates.Add(plate);
|
||||
//初始化参数
|
||||
data.designPosition = ViewCameraDesign.CameraPosition;
|
||||
data.bakingPosition = ViewCameraDesign.CameraPosition;
|
||||
plate.dataDesign.position = ViewCameraDesign.CameraPosition;
|
||||
plate.dataBaking.position = ViewCameraDesign.CameraPosition;
|
||||
//生成可视化内容
|
||||
data.UpdateVisual();
|
||||
plate.UpdateVisual();
|
||||
}
|
||||
public override void Remove(DataPlate data) {
|
||||
if (!dataPlates.Contains(data)) { return; }
|
||||
|
||||
@@ -5,37 +5,37 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 插入点(DataInsertPoint) 转换 点(DataPoint)
|
||||
/// </summary>
|
||||
public class BuilderInsertPointToPoint : ModuleBuilder<DataInsertPoint, DataPoint> {
|
||||
//public class BuilderInsertPointToPoint : ModuleBuilder<DataInsertPoint, DataPoint> {
|
||||
|
||||
protected override void Awake() => ModuleCore.InsertPointToPoint = this;
|
||||
// protected override void Awake() => ModuleCore.InsertPointToPoint = this;
|
||||
|
||||
public override DataPoint To(DataInsertPoint insertPoint) {
|
||||
DataPlate plate = insertPoint.plate;
|
||||
Vector3 position = insertPoint.position;
|
||||
//创建新的点
|
||||
DataPoint point = new DataPoint(insertPoint.plate);
|
||||
point.position = position;
|
||||
//改变关联的边B点,重置贝塞尔曲线
|
||||
insertPoint.side.bPoint = point;
|
||||
insertPoint.side.OneRankBezier();
|
||||
//创建新的边
|
||||
DataSide side = CreateDataSide(plate, point, insertPoint.bPoint);
|
||||
//插入边
|
||||
int sideIndex = plate.sides.IndexOf(insertPoint.side);
|
||||
plate.sides.Insert(sideIndex + 1, side);
|
||||
//插入点
|
||||
int pointIndex = plate.points.IndexOf(insertPoint.aPoint);
|
||||
plate.points.Insert(pointIndex + 1, point);
|
||||
//更新数据
|
||||
plate.UpdateVisual();
|
||||
return point;
|
||||
}
|
||||
// public override DataPoint To(DataInsertPoint insertPoint) {
|
||||
// DataPlate plate = insertPoint.plate;
|
||||
// Vector3 position = insertPoint.position;
|
||||
// //创建新的点
|
||||
// DataPoint point = new DataPoint(insertPoint.plate);
|
||||
// point.position = position;
|
||||
// //改变关联的边B点,重置贝塞尔曲线
|
||||
// insertPoint.side.bPoint = point;
|
||||
// insertPoint.side.OneRankBezier();
|
||||
// //创建新的边
|
||||
// DataSide side = CreateDataSide(plate, point, insertPoint.bPoint);
|
||||
// //插入边
|
||||
// int sideIndex = plate.sides.IndexOf(insertPoint.side);
|
||||
// plate.sides.Insert(sideIndex + 1, side);
|
||||
// //插入点
|
||||
// int pointIndex = plate.points.IndexOf(insertPoint.aPoint);
|
||||
// plate.points.Insert(pointIndex + 1, point);
|
||||
// //更新数据
|
||||
// plate.UpdateVisual();
|
||||
// return point;
|
||||
// }
|
||||
|
||||
private DataSide CreateDataSide(DataPlate plate, DataPoint a, DataPoint b) {
|
||||
DataSide side = new DataSide(plate);
|
||||
side.aPoint = a;
|
||||
side.bPoint = b;
|
||||
side.OneRankBezier();
|
||||
return side;
|
||||
}
|
||||
}
|
||||
// private DataSide CreateDataSide(DataPlate plate, DataPoint a, DataPoint b) {
|
||||
// DataSide side = new DataSide(plate);
|
||||
// side.aPoint = a;
|
||||
// side.bPoint = b;
|
||||
// side.OneRankBezier();
|
||||
// return side;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -11,24 +11,24 @@ public class BuilderPlatePresetsToPlate : ModuleBuilder<DataPlatePresets, DataPl
|
||||
|
||||
public override DataPlate To(DataPlatePresets origin) {
|
||||
DataPlate dataPlate = new DataPlate();
|
||||
dataPlate.points = ToDataPoint(dataPlate, origin.designPoints);
|
||||
dataPlate.sides = ToDataSide(dataPlate, dataPlate.points);
|
||||
dataPlate.platePoints = ToDataPoint(dataPlate, origin.designPoints);
|
||||
dataPlate.plateSides = ToDataSide(dataPlate, dataPlate.platePoints);
|
||||
return dataPlate;
|
||||
}
|
||||
|
||||
private List<DataPoint> ToDataPoint(DataPlate dataPlate, List<Vector3> list) {
|
||||
List<DataPoint> points = new List<DataPoint>();
|
||||
private List<DataPlatePoint> ToDataPoint(DataPlate dataPlate, List<Vector3> list) {
|
||||
List<DataPlatePoint> points = new List<DataPlatePoint>();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
DataPoint point = new DataPoint(dataPlate);
|
||||
DataPlatePoint point = new DataPlatePoint(dataPlate);
|
||||
point.position = list[i];
|
||||
points.Add(point);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
private List<DataSide> ToDataSide(DataPlate dataPlate, List<DataPoint> list) {
|
||||
List<DataSide> sides = new List<DataSide>();
|
||||
private List<DataPlateSide> ToDataSide(DataPlate dataPlate, List<DataPlatePoint> list) {
|
||||
List<DataPlateSide> sides = new List<DataPlateSide>();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
DataSide side = new DataSide(dataPlate);
|
||||
DataPlateSide side = new DataPlateSide(dataPlate);
|
||||
side.aPoint = list.LoopIndex(i + 0);
|
||||
side.bPoint = list.LoopIndex(i + 1);
|
||||
side.OneRankBezier();
|
||||
|
||||
@@ -46,37 +46,37 @@ public class ModuleCore : Module<ModuleCore> {
|
||||
public ModuleBuilder<DataPlatePresets, DataPlate> PlatePresetsToPlate;
|
||||
/// <summary> 板片数据(DataPlate) 转换 多边形数据(DataPolygon) </summary>
|
||||
public ModuleBuilder<DataPlate, DataPolygon> PlateToPolygon;
|
||||
/// <summary> 插入点(DataInsertPoint) 转换 点(DataPoint) </summary>
|
||||
public ModuleBuilder<DataInsertPoint, DataPoint> InsertPointToPoint;
|
||||
#endregion
|
||||
|
||||
#region 可视模块
|
||||
/// <summary> 设计可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataPlate> VisualDesign;
|
||||
/// <summary> 烘焙可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataPlate> VisualBaking;
|
||||
/// <summary> 连接可视化内容生成模块 </summary>
|
||||
/// <summary> 板片设计 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataPlate> VisualPlateDesign;
|
||||
/// <summary> 板片烘焙 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataPlate> VisualPlateBaking;
|
||||
/// <summary> 缝合设计 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataSuture> VisualSutureDesign;
|
||||
/// <summary> 缝合烘焙 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataSuture> VisualSutureBaking;
|
||||
/// <summary> 连接器 可视化内容生成模块 </summary>
|
||||
public ModuleVisual<DataConnector> VisualConnector;
|
||||
#endregion
|
||||
|
||||
#region 查询模块
|
||||
/// <summary> 查询点模块 </summary>
|
||||
public ModuleFind<DataPoint> FindPoint;
|
||||
public ModuleFind<DataPlatePoint> FindPoint;
|
||||
/// <summary> 查询边模块 </summary>
|
||||
public ModuleFind<DataSide> FindSide;
|
||||
public ModuleFind<DataPlateSide> FindSide;
|
||||
/// <summary> 查询贝塞尔点模块 </summary>
|
||||
public ModuleFind<DataBezier> FindBezier;
|
||||
#endregion
|
||||
|
||||
#region 算法模块
|
||||
/// <summary> 计算位置到边上最近的点 </summary>
|
||||
public ModuleAlgorithm<DataIntersect> AlgorithmSidePoint;
|
||||
/// <summary> 简单多边形算法模块 </summary>
|
||||
public ModuleAlgorithm<DataPlate> AlgorithmSimplePolygon;
|
||||
/// <summary> 细分多边形算法模块 </summary>
|
||||
public ModuleAlgorithm<DataPlate> AlgorithmSubdivisionPolygon;
|
||||
/// <summary> 缝合边算法模块 </summary>
|
||||
public ModuleAlgorithm<DataSutureSide> AlgorithmSutureSide;
|
||||
public ModuleAlgorithm<DataSuture> AlgorithmSuture;
|
||||
#endregion
|
||||
|
||||
#region 事件定义
|
||||
|
||||
@@ -15,7 +15,7 @@ public class FindBezier : ModuleFind<DataBezier> {
|
||||
public override bool Find(Vector3 position, out DataBezier bezier) {
|
||||
List<DataPlate> plates = AssetsPlate.Datas;
|
||||
for (int i = 0; i < plates.Count; i++) {
|
||||
Vector3 localPosition = position - plates[i].designPosition;
|
||||
Vector3 localPosition = position - plates[i].dataDesign.position;
|
||||
bezier = Find(plates[i], localPosition);
|
||||
if (bezier != null) { return true; }
|
||||
}
|
||||
@@ -24,14 +24,14 @@ public class FindBezier : ModuleFind<DataBezier> {
|
||||
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataBezier Find(DataPlate plate, Vector3 localPosition) {
|
||||
for (int i = 0; i < plate.sides.Count; i++) {
|
||||
DataBezier bezier = Find(plate.sides[i], localPosition);
|
||||
for (int i = 0; i < plate.plateSides.Count; i++) {
|
||||
DataBezier bezier = Find(plate.plateSides[i], localPosition);
|
||||
if (bezier != null) { return bezier; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataBezier Find(DataSide side, Vector3 localPosition) {
|
||||
private DataBezier Find(DataPlateSide side, Vector3 localPosition) {
|
||||
if (side.bezier == Bezier.一阶) { return null; }
|
||||
float aDis = Vector3.Distance(side.aBezier, localPosition);
|
||||
if (aDis < FindRange) { return new DataBezier() { isA = true, side = side }; }
|
||||
|
||||
@@ -5,17 +5,17 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 查找点
|
||||
/// </summary>
|
||||
public class FindPoint : ModuleFind<DataPoint> {
|
||||
public class FindPoint : ModuleFind<DataPlatePoint> {
|
||||
public readonly float FindRange = 0.01f;
|
||||
/// <summary> 板片资产 </summary>
|
||||
public ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
|
||||
|
||||
protected override void Awake() => ModuleCore.FindPoint = this;
|
||||
|
||||
public override bool Find(Vector3 position, out DataPoint point) {
|
||||
public override bool Find(Vector3 position, out DataPlatePoint point) {
|
||||
List<DataPlate> plates = AssetsPlate.Datas;
|
||||
for (int i = 0; i < plates.Count; i++) {
|
||||
Vector3 localPosition = position - plates[i].designPosition;
|
||||
Vector3 localPosition = position - plates[i].dataDesign.position;
|
||||
point = Find(plates[i], localPosition);
|
||||
if (point != null) { return true; }
|
||||
}
|
||||
@@ -23,8 +23,8 @@ public class FindPoint : ModuleFind<DataPoint> {
|
||||
}
|
||||
|
||||
/// <summary> 查询匹配的点 </summary>
|
||||
private DataPoint Find(DataPlate plate, Vector3 localPosition) {
|
||||
List<DataPoint> points = plate.points;
|
||||
private DataPlatePoint Find(DataPlate plate, Vector3 localPosition) {
|
||||
List<DataPlatePoint> points = plate.platePoints;
|
||||
for (int i = 0; i < points.Count; i++) {
|
||||
float distance = Vector3.Distance(points[i].position, localPosition);
|
||||
if (distance > FindRange) { continue; }
|
||||
|
||||
@@ -5,17 +5,17 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 查找边
|
||||
/// </summary>
|
||||
public class FindSide : ModuleFind<DataSide> {
|
||||
public readonly float FindRange = 0.01f;
|
||||
public class FindSide : ModuleFind<DataPlateSide> {
|
||||
public readonly float FindRange = 0.01f;
|
||||
/// <summary> 板片资产 </summary>
|
||||
public ModuleAssets<DataPlate> AssetsPlate => ModuleCore.AssetsPlate;
|
||||
|
||||
protected override void Awake() => ModuleCore.FindSide = this;
|
||||
|
||||
public override bool Find(Vector3 position, out DataSide side) {
|
||||
public override bool Find(Vector3 position, out DataPlateSide side) {
|
||||
List<DataPlate> plates = AssetsPlate.Datas;
|
||||
for (int i = 0; i < plates.Count; i++) {
|
||||
Vector3 localPosition = position - plates[i].designPosition;
|
||||
Vector3 localPosition = position - plates[i].dataDesign.position;
|
||||
side = Find(plates[i], localPosition);
|
||||
if (side != null) { return true; }
|
||||
}
|
||||
@@ -23,20 +23,20 @@ public class FindSide : ModuleFind<DataSide> {
|
||||
}
|
||||
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataSide Find(DataPlate plate, Vector3 localPosition) {
|
||||
for (int i = 0; i < plate.sides.Count; i++) {
|
||||
DataSide side = Find(plate.sides[i], localPosition);
|
||||
private DataPlateSide Find(DataPlate plate, Vector3 localPosition) {
|
||||
for (int i = 0; i < plate.plateSides.Count; i++) {
|
||||
DataPlateSide side = Find(plate.plateSides[i], localPosition);
|
||||
if (side != null) { return side; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary> 查询匹配的边 </summary>
|
||||
private DataSide Find(DataSide side, Vector3 localPosition) {
|
||||
for (int i = 0; i < side.lines.Length; i++) {
|
||||
Vector3 a = side.lines[i].a;
|
||||
Vector3 b = side.lines[i].b;
|
||||
private DataPlateSide Find(DataPlateSide side, Vector3 localPosition) {
|
||||
DataPlateSideDesign design = side.dataDesign;
|
||||
for (int i = 0; i < design.lines.Length; i++) {
|
||||
Vector3 a = design.lines[i].a;
|
||||
Vector3 b = design.lines[i].b;
|
||||
float distance = ProjectDistance(a, b, localPosition);
|
||||
//Debug.Log($"{a} , {b} , {localPosition}");
|
||||
if (distance < FindRange) { return side; }
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -2,45 +2,45 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VisualBaking : ModuleVisual<DataPlate> {
|
||||
public Transform viewSpace;
|
||||
public Transform platePrefab;//板片
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
//public class VisualBaking : ModuleVisual<DataPlate> {
|
||||
// public Transform viewSpace;
|
||||
// public Transform platePrefab;//板片
|
||||
// public Transform suturePrefab;//缝合
|
||||
// public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualBaking = this;
|
||||
// protected override void Awake() => ModuleCore.VisualBaking = this;
|
||||
|
||||
public override void UpdateVisual(DataPlate plate) {
|
||||
//更新板片
|
||||
Create(ref plate.baking, platePrefab, viewSpace);
|
||||
plate.baking.UpdateVisual(plate);
|
||||
//子数据父对象
|
||||
Transform parent = plate.design.transform;
|
||||
//更新线段
|
||||
plate.sides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
}
|
||||
public override void ReleaseVisual(DataPlate data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
// public override void UpdateVisual(DataPlate plate) {
|
||||
// //更新板片
|
||||
// Create(ref plate.baking, platePrefab, viewSpace);
|
||||
// plate.baking.UpdateVisual(plate);
|
||||
// //子数据父对象
|
||||
// Transform parent = plate.design.transform;
|
||||
// //更新线段
|
||||
// plate.sides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
// }
|
||||
// public override void ReleaseVisual(DataPlate data) {
|
||||
// throw new System.NotImplementedException();
|
||||
// }
|
||||
|
||||
private void UpdateVisual(DataSide side, Transform parent) {
|
||||
//Create(ref side.design, sidePrefab, parent);
|
||||
//side.design.UpdateVisual(side);
|
||||
//更新缝合线
|
||||
if (side.suture == null) { return; }
|
||||
//side.suture.Update();
|
||||
UpdateVisual(side.suture, viewSpace);
|
||||
}
|
||||
/// <summary> 更新缝合数据 </summary>
|
||||
private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
Create(ref suture.baking, suturePrefab, parent);
|
||||
UpdateVisual(suture.a, suture.baking.transform);
|
||||
UpdateVisual(suture.b, suture.baking.transform);
|
||||
suture.baking.UpdateVisual(suture);
|
||||
}
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
sutureSide.baking.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
// private void UpdateVisual(DataSide side, Transform parent) {
|
||||
// //Create(ref side.design, sidePrefab, parent);
|
||||
// //side.design.UpdateVisual(side);
|
||||
// //更新缝合线
|
||||
// if (side.suture == null) { return; }
|
||||
// //side.suture.Update();
|
||||
// UpdateVisual(side.suture, viewSpace);
|
||||
// }
|
||||
// /// <summary> 更新缝合数据 </summary>
|
||||
// private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
// Create(ref suture.baking, suturePrefab, parent);
|
||||
// UpdateVisual(suture.a, suture.baking.transform);
|
||||
// UpdateVisual(suture.b, suture.baking.transform);
|
||||
// suture.baking.UpdateVisual(suture);
|
||||
// }
|
||||
// /// <summary> 更新缝合边 </summary>
|
||||
// private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
// Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
// sutureSide.baking.UpdateVisual(sutureSide);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -5,53 +5,53 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 版片可视化模块
|
||||
/// </summary>
|
||||
public class VisualDesign : ModuleVisual<DataPlate> {
|
||||
public Transform viewSpace;
|
||||
public Transform platePrefab;//板片
|
||||
public Transform pointPrefab;//点
|
||||
public Transform sidePrefab;//边
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
//public class VisualDesign : ModuleVisual<DataPlate> {
|
||||
// public Transform viewSpace;
|
||||
// public Transform platePrefab;//板片
|
||||
// public Transform pointPrefab;//点
|
||||
// public Transform sidePrefab;//边
|
||||
// public Transform suturePrefab;//缝合
|
||||
// public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualDesign = this;
|
||||
// protected override void Awake() => ModuleCore.VisualDesign = this;
|
||||
|
||||
public override void UpdateVisual(DataPlate plate) {
|
||||
//更新板片
|
||||
Create(ref plate.design, platePrefab, viewSpace);
|
||||
plate.design.UpdateVisual(plate);
|
||||
//子数据父对象
|
||||
Transform parent = plate.design.transform;
|
||||
//更新点
|
||||
plate.points.ForEach(obj => UpdateVisual(obj, parent));
|
||||
//更新线段
|
||||
plate.sides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
}
|
||||
public override void ReleaseVisual(DataPlate data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
// public override void UpdateVisual(DataPlate plate) {
|
||||
// //更新板片
|
||||
// Create(ref plate.design, platePrefab, viewSpace);
|
||||
// plate.design.UpdateVisual(plate);
|
||||
// //子数据父对象
|
||||
// Transform parent = plate.design.transform;
|
||||
// //更新点
|
||||
// plate.points.ForEach(obj => UpdateVisual(obj, parent));
|
||||
// //更新线段
|
||||
// plate.sides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
// }
|
||||
// public override void ReleaseVisual(DataPlate data) {
|
||||
// throw new System.NotImplementedException();
|
||||
// }
|
||||
|
||||
private void UpdateVisual(DataPoint point, Transform parent) {
|
||||
Create(ref point.visual, pointPrefab, parent);
|
||||
point.visual.UpdateVisual(point);
|
||||
}
|
||||
private void UpdateVisual(DataSide side, Transform parent) {
|
||||
Create(ref side.design, sidePrefab, parent);
|
||||
side.design.UpdateVisual(side);
|
||||
//更新缝合线
|
||||
if (side.suture == null) { return; }
|
||||
side.suture.Update();
|
||||
UpdateVisual(side.suture, viewSpace);
|
||||
}
|
||||
/// <summary> 更新缝合数据 </summary>
|
||||
private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
Create(ref suture.design, suturePrefab, parent);
|
||||
UpdateVisual(suture.a, suture.design.transform);
|
||||
UpdateVisual(suture.b, suture.design.transform);
|
||||
suture.design.UpdateVisual(suture);
|
||||
}
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.design, sutureSidePrefab, parent);
|
||||
sutureSide.design.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
// private void UpdateVisual(DataPoint point, Transform parent) {
|
||||
// Create(ref point.visual, pointPrefab, parent);
|
||||
// point.visual.UpdateVisual(point);
|
||||
// }
|
||||
// private void UpdateVisual(DataSide side, Transform parent) {
|
||||
// Create(ref side.design, sidePrefab, parent);
|
||||
// side.design.UpdateVisual(side);
|
||||
// //更新缝合线
|
||||
// if (side.suture == null) { return; }
|
||||
// side.suture.Update();
|
||||
// UpdateVisual(side.suture, viewSpace);
|
||||
// }
|
||||
// /// <summary> 更新缝合数据 </summary>
|
||||
// private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
// Create(ref suture.design, suturePrefab, parent);
|
||||
// UpdateVisual(suture.a, suture.design.transform);
|
||||
// UpdateVisual(suture.b, suture.design.transform);
|
||||
// suture.design.UpdateVisual(suture);
|
||||
// }
|
||||
// /// <summary> 更新缝合边 </summary>
|
||||
// private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
// Create(ref sutureSide.design, sutureSidePrefab, parent);
|
||||
// sutureSide.design.UpdateVisual(sutureSide);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VisualPlateBaking : ModuleVisual<DataPlate> {
|
||||
public Transform viewSpace;
|
||||
public Transform platePrefab;//板片
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualPlateBaking = this;
|
||||
|
||||
public override void UpdateVisual(DataPlate plate) {
|
||||
//更新板片
|
||||
Create(ref plate.bakingPrefab, platePrefab, viewSpace);
|
||||
plate.bakingPrefab.UpdateVisual(plate);
|
||||
//子数据父对象
|
||||
Transform parent = plate.designPrefab.transform;
|
||||
//更新线段
|
||||
plate.plateSides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
}
|
||||
public override void ReleaseVisual(DataPlate data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void UpdateVisual(DataPlateSide side, Transform parent) {
|
||||
//Create(ref side.design, sidePrefab, parent);
|
||||
//side.design.UpdateVisual(side);
|
||||
//更新缝合线
|
||||
//if (side.suture == null) { return; }
|
||||
//side.suture.Update();
|
||||
//UpdateVisual(side.suture, viewSpace);
|
||||
}
|
||||
/// <summary> 更新缝合数据 </summary>
|
||||
private void UpdateVisual(DataSuture suture, Transform parent) {
|
||||
Create(ref suture.baking, suturePrefab, parent);
|
||||
UpdateVisual(suture.a, suture.baking.transform);
|
||||
UpdateVisual(suture.b, suture.baking.transform);
|
||||
suture.baking.UpdateVisual(suture);
|
||||
}
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
sutureSide.baking.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef4a839345dfb344382e257d374ca3ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 版片可视化模块
|
||||
/// </summary>
|
||||
public class VisualPlateDesign : ModuleVisual<DataPlate> {
|
||||
public Transform viewSpace;
|
||||
public Transform platePrefab;//板片
|
||||
public Transform pointPrefab;//点
|
||||
public Transform sidePrefab;//边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualPlateDesign = this;
|
||||
|
||||
public override void UpdateVisual(DataPlate plate) {
|
||||
//更新板片
|
||||
Create(ref plate.designPrefab, platePrefab, viewSpace);
|
||||
plate.designPrefab.UpdateVisual(plate);
|
||||
//子数据父对象
|
||||
Transform parent = plate.designPrefab.transform;
|
||||
//更新点
|
||||
plate.platePoints.ForEach(obj => UpdateVisual(obj, parent));
|
||||
//更新线段
|
||||
plate.plateSides.ForEach(obj => UpdateVisual(obj, parent));
|
||||
}
|
||||
public override void ReleaseVisual(DataPlate data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private void UpdateVisual(DataPlatePoint point, Transform parent) {
|
||||
Create(ref point.visual, pointPrefab, parent);
|
||||
point.visual.UpdateVisual(point);
|
||||
}
|
||||
private void UpdateVisual(DataPlateSide side, Transform parent) {
|
||||
Create(ref side.designPrefab, sidePrefab, parent);
|
||||
side.designPrefab.UpdateVisual(side);
|
||||
//更新缝合线
|
||||
if (side.suture != null) { side.suture.UpdateVisual(); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9827f83f79c2af42b2a06bdc3c80719
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合烘焙可视化模块
|
||||
/// </summary>
|
||||
public class VisualSutureBaking : ModuleVisual<DataSuture> {
|
||||
public Transform viewSpace;
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualSutureBaking = this;
|
||||
|
||||
public override void UpdateVisual(DataSuture suture) {
|
||||
Create(ref suture.baking, suturePrefab, viewSpace);
|
||||
suture.baking.UpdateVisual(suture);
|
||||
|
||||
UpdateVisual(suture.a, suture.baking.transform);
|
||||
UpdateVisual(suture.b, suture.baking.transform);
|
||||
}
|
||||
public override void ReleaseVisual(DataSuture data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.baking, sutureSidePrefab, parent);
|
||||
sutureSide.baking.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06ff2a0f351be2d41aa7c8dfc23798e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 缝合设计可视化模块
|
||||
/// </summary>
|
||||
public class VisualSutureDesign : ModuleVisual<DataSuture> {
|
||||
public Transform viewSpace;
|
||||
public Transform suturePrefab;//缝合
|
||||
public Transform sutureSidePrefab;//缝合边
|
||||
|
||||
protected override void Awake() => ModuleCore.VisualSutureDesign = this;
|
||||
|
||||
public override void UpdateVisual(DataSuture suture) {
|
||||
Create(ref suture.design, suturePrefab, viewSpace);
|
||||
suture.design.UpdateVisual(suture);
|
||||
|
||||
UpdateVisual(suture.a, suture.design.transform);
|
||||
UpdateVisual(suture.b, suture.design.transform);
|
||||
}
|
||||
public override void ReleaseVisual(DataSuture data) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary> 更新缝合边 </summary>
|
||||
private void UpdateVisual(DataSutureSide sutureSide, Transform parent) {
|
||||
Create(ref sutureSide.design, sutureSidePrefab, parent);
|
||||
sutureSide.design.UpdateVisual(sutureSide);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a43eabbe6a52df943b5157da8933dd33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user