1
This commit is contained in:
@@ -7,18 +7,22 @@ public class DataPlate {
|
||||
/// <summary> 核心模块 </summary>
|
||||
private ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 设计可视化模块 </summary>
|
||||
private ModuleVisual<DataPlate> VisualDesign => ModuleCore.VisualDesign;
|
||||
private ModuleVisual<DataPlate> VisualDesign => ModuleCore.VisualPlateDesign;
|
||||
/// <summary> 烘焙可视化模块 </summary>
|
||||
private ModuleVisual<DataPlate> VisualBaking => ModuleCore.VisualBaking;
|
||||
private ModuleVisual<DataPlate> VisualBaking => ModuleCore.VisualPlateBaking;
|
||||
/// <summary> 简单多边形算法模块 </summary>
|
||||
private ModuleAlgorithm<DataPlate> AlgorithmSimplePolygon => ModuleCore.AlgorithmSimplePolygon;
|
||||
/// <summary> 细分多边形算法模块 </summary>
|
||||
private ModuleAlgorithm<DataPlate> AlgorithmSubdivisionPolygon => ModuleCore.AlgorithmSubdivisionPolygon;
|
||||
|
||||
public DataPlate() {
|
||||
dataDesign = new DataPlateDesign(this);
|
||||
}
|
||||
|
||||
public void UpdateVisual(bool recalculate = true) {
|
||||
if (recalculate) {
|
||||
//简单多边形计算
|
||||
//AlgorithmSimplePolygon.Compute(this);
|
||||
AlgorithmSimplePolygon.Compute(this);
|
||||
//细分多边形计算
|
||||
AlgorithmSubdivisionPolygon.Compute(this);
|
||||
}
|
||||
@@ -29,42 +33,55 @@ public class DataPlate {
|
||||
}
|
||||
|
||||
#region 核心数据
|
||||
/// <summary> 边缘平滑度 </summary>
|
||||
public float smooth = 0.01f;
|
||||
/// <summary> 板片设计视图的位置(本地坐标系) </summary>
|
||||
public Vector3 designPosition;
|
||||
/// <summary> 板片烘焙视图的位置(本地坐标系) </summary>
|
||||
public Vector3 bakingPosition;
|
||||
/// <summary> 板片烘焙视图的旋转(本地坐标系) </summary>
|
||||
public Vector3 bakingEulerAngles;
|
||||
/// <summary> 点 </summary>
|
||||
public List<DataPoint> points = new List<DataPoint>();
|
||||
public List<DataPlatePoint> platePoints = new List<DataPlatePoint>();
|
||||
/// <summary> 边 </summary>
|
||||
public List<DataSide> sides = new List<DataSide>();
|
||||
public List<DataPlateSide> plateSides = new List<DataPlateSide>();
|
||||
#endregion
|
||||
|
||||
#region 次要数据
|
||||
/// <summary> 边界数据 </summary>
|
||||
public DataBorder border;
|
||||
/// <summary> 边缘点 </summary>
|
||||
public List<Vector3> edgePoints;
|
||||
/// <summary> 设计网格 </summary>
|
||||
public Mesh designMesh;
|
||||
|
||||
/// <summary> 三角形数据 </summary>
|
||||
public List<DataTriangle> triangles;
|
||||
|
||||
/// <summary> 顶点网格 </summary>
|
||||
public GridTool<DataVertex> vertexGrid;
|
||||
/// <summary> 设计缓存数据 </summary>
|
||||
public DataPlateDesign dataDesign;
|
||||
/// <summary> 烘焙缓存数据 </summary>
|
||||
public DataPlateBaking dataBaking = new DataPlateBaking();
|
||||
#endregion
|
||||
|
||||
#region 可视化数据
|
||||
/// <summary> 可视化对象 </summary>
|
||||
public ModulePrefab<DataPlate> design;
|
||||
public ModulePrefab<DataPlate> designPrefab;
|
||||
/// <summary> 可视化对象 </summary>
|
||||
public ModulePrefab<DataPlate> baking;
|
||||
public ModulePrefab<DataPlate> bakingPrefab;
|
||||
/// <summary> 安排点 </summary>
|
||||
public FixedArrange arrange;
|
||||
#endregion
|
||||
|
||||
}
|
||||
/// <summary> 设计缓存数据 </summary>
|
||||
public class DataPlateDesign {
|
||||
/// <summary> 板片 </summary>
|
||||
public readonly DataPlate plate;
|
||||
/// <summary> 设计缓存数据 </summary>
|
||||
public DataPlateDesign(DataPlate plate) => this.plate = plate;
|
||||
|
||||
/// <summary> 板片的位置 </summary>
|
||||
public Vector3 position;
|
||||
/// <summary> 网格 </summary>
|
||||
public Mesh mesh;
|
||||
/// <summary> 边缘点 </summary>
|
||||
public Vector3[] points;
|
||||
/// <summary> 三角形数据 </summary>
|
||||
public List<DataTriangle> triangles;
|
||||
}
|
||||
/// <summary> 烘焙缓存数据 </summary>
|
||||
public class DataPlateBaking {
|
||||
/// <summary> 网格 </summary>
|
||||
public Mesh mesh;
|
||||
/// <summary> 板片的位置 </summary>
|
||||
public Vector3 position;
|
||||
/// <summary> 板片的旋转 </summary>
|
||||
public Vector3 eulerAngles;
|
||||
/// <summary> 边界数据 </summary>
|
||||
public DataBorder border;
|
||||
/// <summary> 全部顶点 </summary>
|
||||
public DataPlateVertex[] vertexs;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary> 线段 </summary>
|
||||
public class DataPlateLine {
|
||||
/// <summary> 线段起点a </summary>
|
||||
public Vector3 a;
|
||||
/// <summary> 线段终点b </summary>
|
||||
public Vector3 b;
|
||||
/// <summary> 原始距离 </summary>
|
||||
public float origin;
|
||||
/// <summary> 线段距离 </summary>
|
||||
public float Distance => Vector3.Distance(a, b);
|
||||
/// <summary> 线段方向 </summary>
|
||||
public Vector3 Direction => b - a;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7e8d3e741e703d49b33431b75a3a001
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DataPlatePoint {
|
||||
/// <summary> 绑定的板片 </summary>
|
||||
public readonly DataPlate plate;
|
||||
/// <summary> 初始化 </summary>
|
||||
public DataPlatePoint(DataPlate plate) => this.plate = plate;
|
||||
|
||||
#region 核心数据
|
||||
/// <summary> 设计点位置(本地坐标系) </summary>
|
||||
public Vector3 position;
|
||||
#endregion
|
||||
|
||||
#region 可视化数据
|
||||
/// <summary> 可视化对象 </summary>
|
||||
public ModulePrefab<DataPlatePoint> visual;
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c2af0d32eea37f408900226b81e8e8a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public enum Bezier {
|
||||
一阶 = 0, 二阶 = 1, 三阶 = 2
|
||||
}
|
||||
/// <summary> 边 </summary>
|
||||
public class DataPlateSide {
|
||||
/// <summary> 绑定的板片 </summary>
|
||||
public readonly DataPlate plate;
|
||||
/// <summary> 初始化 </summary>
|
||||
public DataPlateSide(DataPlate plate) => this.plate = plate;
|
||||
|
||||
#region 核心数据
|
||||
/// <summary> 贝塞尔曲线阶数 </summary>
|
||||
public Bezier bezier;
|
||||
/// <summary> 起点 </summary>
|
||||
public DataPlatePoint aPoint;
|
||||
/// <summary> 终点 </summary>
|
||||
public DataPlatePoint bPoint;
|
||||
/// <summary> 贝塞尔曲线前(-) </summary>
|
||||
public Vector3 aBezier;
|
||||
/// <summary> 贝塞尔曲线后(+) </summary>
|
||||
public Vector3 bBezier;
|
||||
#endregion
|
||||
|
||||
#region 次要数据
|
||||
/// <summary> 缝合数据 </summary>
|
||||
public DataSuture suture;
|
||||
/// <summary> 设计缓存数据 </summary>
|
||||
public DataPlateSideDesign dataDesign = new DataPlateSideDesign();
|
||||
/// <summary> 烘焙缓存数据 </summary>
|
||||
public DataPlateSideBaking dataBaking = new DataPlateSideBaking();
|
||||
#endregion
|
||||
|
||||
#region 可视化内容
|
||||
/// <summary> 可视化边缘线 </summary>
|
||||
public ModulePrefab<DataPlateSide> designPrefab;
|
||||
#endregion
|
||||
}
|
||||
/// <summary> 设计缓存数据 </summary>
|
||||
public class DataPlateSideDesign {
|
||||
/// <summary> 总长度 </summary>
|
||||
public float length;
|
||||
/// <summary> 点 </summary>
|
||||
public Vector3[] positions = new Vector3[0];
|
||||
/// <summary> 线 </summary>
|
||||
public DataPlateLine[] lines = new DataPlateLine[0];
|
||||
}
|
||||
/// <summary> 烘焙缓存数据 </summary>
|
||||
public class DataPlateSideBaking {
|
||||
/// <summary> 总长度 </summary>
|
||||
public float length;
|
||||
/// <summary> 点 </summary>
|
||||
public Vector3[] positions = new Vector3[0];
|
||||
/// <summary> 线 </summary>
|
||||
public DataPlateLine[] lines = new DataPlateLine[0];
|
||||
/// <summary> 关联的网格顶点 </summary>
|
||||
public DataPlateVertex[] vertexs = new DataPlateVertex[0];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0a57f0098d07ca4da0ca6e08c25662c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DataPlateVertex {
|
||||
/// <summary> 是否是有效顶点 </summary>
|
||||
public bool isValid;
|
||||
/// <summary> 设计视图中位置 </summary>
|
||||
public Vector3 position;
|
||||
|
||||
/// <summary> 上 </summary>
|
||||
public DataPlateVertex above;
|
||||
/// <summary> 下 </summary>
|
||||
public DataPlateVertex below;
|
||||
/// <summary> 左 </summary>
|
||||
public DataPlateVertex left;
|
||||
/// <summary> 右 </summary>
|
||||
public DataPlateVertex right;
|
||||
|
||||
/// <summary> 左上 </summary>
|
||||
public DataPlateVertex leftAbove;
|
||||
/// <summary> 左下 </summary>
|
||||
public DataPlateVertex leftBelow;
|
||||
/// <summary> 右上 </summary>
|
||||
public DataPlateVertex rightAbove;
|
||||
/// <summary> 右下 </summary>
|
||||
public DataPlateVertex rightBelow;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9842037a7f0169b4bb8a4b70047f7739
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,9 +2,9 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public enum Bezier {
|
||||
一阶 = 0, 二阶 = 1, 三阶 = 2
|
||||
}
|
||||
//public enum Bezier {
|
||||
// 一阶 = 0, 二阶 = 1, 三阶 = 2
|
||||
//}
|
||||
public class DataSide {
|
||||
/// <summary> 绑定的板片 </summary>
|
||||
public readonly DataPlate plate;
|
||||
|
||||
Reference in New Issue
Block a user