Switch points generation from managed thread to unmanaged thread; Change Spline to NativeSpline; Add converter for DistributionMode and update cloner editor ui; Add MeshData type for object distribution calculation; Add ObjectDistributionSetting and ObjectDistributionCalculation(Vertex and Edge Mode);
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Misaki.ArtTool
|
||||
{
|
||||
var random = Random.CreateFromIndex((uint)index);
|
||||
|
||||
var localPosition = GetCubePosition(index, setting.count) * setting.spacing;
|
||||
var localPosition = ShapeHelper.GetCubePosition(index, setting.count) * setting.spacing;
|
||||
|
||||
switch (setting.shape)
|
||||
{
|
||||
@@ -17,13 +17,13 @@ namespace Misaki.ArtTool
|
||||
break;
|
||||
|
||||
case GridShape.Sphere:
|
||||
var isInsideSphere = ShapeHelper.IsInsideSphere(localPosition, 0.0f, setting.count * setting.spacing);
|
||||
var isInsideSphere = ShapeHelper.IsPointInsideSphere(localPosition, 0.0f, setting.count * setting.spacing);
|
||||
|
||||
isValid = isInsideSphere;
|
||||
break;
|
||||
|
||||
case GridShape.Cylinder:
|
||||
var isInsideCylinder = ShapeHelper.IsInsideCylinder(localPosition, 0.0f, setting.count * setting.spacing);
|
||||
var isInsideCylinder = ShapeHelper.IsPointInsideCylinder(localPosition, 0.0f, setting.count * setting.spacing);
|
||||
isValid = isInsideCylinder;
|
||||
break;
|
||||
default:
|
||||
@@ -38,18 +38,5 @@ namespace Misaki.ArtTool
|
||||
|
||||
localMatrix = float4x4.TRS(localPosition, quaternion.identity, new float3(1.0f));
|
||||
}
|
||||
|
||||
private static float3 GetCubePosition(int index, int3 size)
|
||||
{
|
||||
float3 localPosition;
|
||||
var yIndex = index / (size.x * size.z);
|
||||
var remain = index % (size.x * size.z);
|
||||
var zIndex = remain / size.x;
|
||||
var xIndex = remain % size.x;
|
||||
|
||||
localPosition = new float3(xIndex, yIndex, zIndex);
|
||||
localPosition -= (float3)(size - 1) * 0.5f;
|
||||
return localPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Runtime/Cloner/Distribution/ObjectDistribution.cs
Normal file
13
Runtime/Cloner/Distribution/ObjectDistribution.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace Misaki.ArtTool
|
||||
{
|
||||
public static partial class Distribution
|
||||
{
|
||||
public static void ObjectDistribution(int index, ObjectDistributionSetting setting, out float4x4 localMatrix, out bool isValid)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Runtime/Cloner/Distribution/ObjectDistribution.cs.meta
Normal file
2
Runtime/Cloner/Distribution/ObjectDistribution.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bed43825cb2cca49b6b7adfe693a5e2
|
||||
@@ -17,7 +17,6 @@ namespace Misaki.ArtTool
|
||||
return;
|
||||
}
|
||||
|
||||
var spline = setting.spline;
|
||||
float t;
|
||||
|
||||
if (setting.isSpacingMode)
|
||||
@@ -29,7 +28,7 @@ namespace Misaki.ArtTool
|
||||
t = pointIndex / (float)(pointSize - 1);
|
||||
}
|
||||
|
||||
if (SplineUtility.Evaluate(spline.Spline, t, out var position, out var normal, out var upVector))
|
||||
if (SplineUtility.Evaluate(setting.nativeSpline, t, out var position, out var normal, out var upVector))
|
||||
{
|
||||
var localRotation = quaternion.LookRotationSafe(normal, upVector);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user