1
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using BITKit;
|
||||
using BITKit.StateMachine;
|
||||
using PaintIn3D;
|
||||
using Unity.Collections.LowLevel.Unsafe;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
@@ -174,5 +175,69 @@ namespace BITFactory.Cutting
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 填充笔刷,用于填充应该被裁剪的区域,类似油漆桶
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public sealed class CuttingFillBrush : CuttingToolBrush
|
||||
{
|
||||
[SerializeField] private Transform transform;
|
||||
public override string Name => "填充切削";
|
||||
public override string Description => "仅在该程序中使用,用于预览被裁剪的区域";
|
||||
|
||||
[Export(name:"自动填充")]
|
||||
private void AutoFill()
|
||||
{
|
||||
var p3dTexture = transform.GetComponentInChildren<P3dPaintableTexture>();
|
||||
|
||||
var texture = p3dTexture.Current.ToTexture2D();
|
||||
|
||||
var colors = texture.GetPixels();
|
||||
|
||||
var size = new float2(texture.width, texture.height);
|
||||
//洪水填充
|
||||
|
||||
throw new InGameException("暂未实现,算法有些复杂");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 印花笔刷,用于在表面上印花
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public sealed class DecalBrush : CuttingToolBrush
|
||||
{
|
||||
public override string Name => "印花笔刷";
|
||||
public override string Description => "在表面上印花,例如预览打印文字或者Logo,图案等";
|
||||
|
||||
[Inject]
|
||||
private IDecalTool _decalTool;
|
||||
|
||||
private ITransform _previewTransform;
|
||||
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
_previewTransform = _decalTool.Create(string.Empty);
|
||||
}
|
||||
public override void OnStateExit(IState old, IState newState)
|
||||
{
|
||||
base.OnStateExit(old, newState);
|
||||
_previewTransform.Dispose();
|
||||
}
|
||||
public override void HandlePoint(bool isPreview, float3 normal, float3 point)
|
||||
{
|
||||
if (isPreview is false) return;
|
||||
_previewTransform.Position = point+(float3)Vector3.up*0.1f;
|
||||
|
||||
|
||||
_previewTransform.Rotation = Quaternion.LookRotation(normal);
|
||||
}
|
||||
|
||||
[Export(name:"选择图片")]
|
||||
private void SelectImage()
|
||||
{
|
||||
throw new InGameException("暂未实现",new NotImplementedException("需要一些小小的base64转换才能储存,暂未实现"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user