Upload project files

This commit is contained in:
Misaki
2024-09-16 00:08:10 +09:00
commit 0a4745662a
218 changed files with 13387 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 107650ad99360724989708b1799990a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
namespace Misaki.ArtTool
{
public abstract class EffectorBase : MonoBehaviour
{
public float strength = 1.0f;
public List<FieldData> fieldDataList = new();
public EventHandler propertyChanged;
protected float4x4 effectorMatrix;
private void OnEnable()
{
foreach (var item in fieldDataList)
{
if (item == null)
{
return;
}
item.field.propertyChanged += OnPropertyChanged;
}
}
private void OnDisable()
{
foreach (var item in fieldDataList)
{
if (item == null)
{
return;
}
item.field.propertyChanged -= OnPropertyChanged;
}
}
private void OnPropertyChanged(object sender, EventArgs e)
{
propertyChanged?.Invoke(sender, e);
}
public virtual void Initialize()
{
for (var i = 0; i < fieldDataList.Count; i++)
{
fieldDataList[i].field.Initialize();
}
effectorMatrix = transform.localToWorldMatrix;
}
public virtual void Operate(int index, float4x4 nodeWorldMatrix, ReadOnlySpan<PointData> points, ref float4x4 pointWorldMatrix, ref bool isValid)
{
}
protected float CalculateFieldsWeight(float3 worldPosition)
{
var weight = 1.0f;
var fieldCount = fieldDataList.Count;
for (var i = 0; i < fieldCount; i++)
{
var fieldData = fieldDataList[i];
if (!fieldData.enable || fieldData.opacity <= 0.0f)
{
continue;
}
weight = math.lerp(weight, fieldData.field.Operate(worldPosition), fieldData.opacity);
}
weight *= strength;
return weight;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e7ccd97731dd96b4fa2c848321321710

View File

@@ -0,0 +1,6 @@
namespace Misaki.ArtTool
{
public class IterateEffectorBase : EffectorBase
{
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5144695703dc3434c93bc038017a3ac3

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b8ea1a2aeb0489a4babf1d34f2ff07c2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,42 @@
using System;
using Unity.Mathematics;
using UnityEngine;
namespace Misaki.ArtTool
{
public abstract class FieldBase : MonoBehaviour
{
public RemappingSetting remappingSetting = new();
public EventHandler propertyChanged;
public virtual void Initialize()
{
}
public abstract float Operate(float3 position);
protected float Remapping(float weight)
{
if (!remappingSetting.enable)
{
return weight;
}
weight = math.saturate(weight / (1.0f - remappingSetting.innerOffset));
weight = math.lerp(remappingSetting.min, remappingSetting.max, weight);
weight = remappingSetting.invert ? 1.0f - weight : weight;
weight *= remappingSetting.strength;
return weight;
}
private void Update()
{
if (transform.hasChanged)
{
propertyChanged.Invoke(this, null);
transform.hasChanged = false;
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c07d37f0b7524644aab721afc849c508