This commit is contained in:
SoulliesOfficial
2025-06-06 10:14:55 -04:00
parent d4e860fa16
commit db4d131192
1088 changed files with 45704 additions and 2260 deletions

View File

@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Capsule : SplinePrimitive
{
public float radius = 1f;
public float height = 2f;
public override Spline.Type GetSplineType()
{
return Spline.Type.Bezier;
}
protected override void Generate()
{
base.Generate();
closed = true;
CreatePoints(6, SplinePoint.Type.SmoothMirrored);
points[0].position = Vector3.right / 2f * radius + Vector3.up * height * 0.5f;
points[0].SetTangentPosition(points[0].position + Vector3.down * 2 * (Mathf.Sqrt(2f) - 1f) / 3f * radius);
points[1].position = Vector3.up / 2f * radius + Vector3.up * height * 0.5f;
points[1].SetTangentPosition(points[1].position + Vector3.right * 2 * (Mathf.Sqrt(2f) - 1f) / 3f * radius);
points[2].position = Vector3.left / 2f * radius + Vector3.up * height * 0.5f;
points[2].SetTangentPosition(points[2].position + Vector3.up * 2 * (Mathf.Sqrt(2f) - 1f) / 3f * radius);
points[3].position = Vector3.left / 2f * radius + Vector3.down * height * 0.5f;
points[3].SetTangentPosition(points[3].position + Vector3.up * 2 * (Mathf.Sqrt(2f) - 1f) / 3f * radius);
points[4].position = Vector3.down / 2f * radius + Vector3.down * height * 0.5f;
points[4].SetTangentPosition(points[4].position + Vector3.left * 2 * (Mathf.Sqrt(2f) - 1f) / 3f * radius);
points[5].position = Vector3.right / 2f * radius + Vector3.down * height * 0.5f;
points[5].SetTangentPosition(points[5].position + Vector3.down * 2 * (Mathf.Sqrt(2f) - 1f) / 3f * radius);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e39006c982d03b3409b070eab24d0843
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Ellipse : SplinePrimitive
{
public float xRadius = 1f;
public float yRadius = 1f;
public override Spline.Type GetSplineType()
{
return Spline.Type.Bezier;
}
protected override void Generate()
{
base.Generate();
closed = true;
CreatePoints(4, SplinePoint.Type.SmoothMirrored);
points[0].position = Vector3.up * yRadius;
points[0].SetTangentPosition(points[0].position + Vector3.right * 2 * (Mathf.Sqrt(2f) - 1f) / 1.5f * xRadius);
points[1].position = Vector3.left * xRadius;
points[1].SetTangentPosition(points[1].position + Vector3.up * 2 * (Mathf.Sqrt(2f) - 1f) / 1.5f * yRadius);
points[2].position = Vector3.down * yRadius;
points[2].SetTangentPosition(points[2].position + Vector3.left * 2 * (Mathf.Sqrt(2f) - 1f) / 1.5f * xRadius);
points[3].position = Vector3.right * xRadius;
points[3].SetTangentPosition(points[3].position + Vector3.down * 2 * (Mathf.Sqrt(2f) - 1f) / 1.5f * yRadius);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4ff5eb5b93412154ea3ec2e48ca9ca4d
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Line : SplinePrimitive
{
public bool mirror = true;
public float length = 1f;
public int segments = 1;
public override Spline.Type GetSplineType()
{
return Spline.Type.Linear;
}
protected override void Generate()
{
base.Generate();
closed = false;
CreatePoints(segments + 1, SplinePoint.Type.SmoothMirrored);
Vector3 origin = Vector3.zero;
if (mirror) origin = -Vector3.up * length * 0.5f;
for (int i = 0; i < points.Length; i++)
{
points[i].position = origin + Vector3.up * length * ((float)i / (points.Length - 1));
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8c7d365eea2f73048be2306c775e3df4
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Ngon : SplinePrimitive
{
public float radius = 1f;
public int sides = 3;
public override Spline.Type GetSplineType()
{
return Spline.Type.Linear;
}
protected override void Generate()
{
base.Generate();
closed = true;
CreatePoints(sides, SplinePoint.Type.SmoothMirrored);
for (int i = 0; i < sides; i++)
{
float percent = (float)i / sides;
Vector3 pos = Quaternion.AngleAxis(360f * percent, Vector3.forward) * Vector3.up * radius;
points[i].SetPosition(pos);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 79792b94d3f3fc2489022f36d48a41d4
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Rectangle : SplinePrimitive
{
public Vector2 size = Vector2.one;
public override Spline.Type GetSplineType()
{
return Spline.Type.Linear;
}
protected override void Generate()
{
base.Generate();
closed = true;
CreatePoints(4, SplinePoint.Type.SmoothMirrored);
points[0].position = points[0].tangent = Vector3.up / 2f * size.y + Vector3.left / 2f * size.x;
points[1].position = points[1].tangent = Vector3.up / 2f * size.y + Vector3.right / 2f * size.x;
points[2].position = points[2].tangent = Vector3.down / 2f * size.y + Vector3.right / 2f * size.x;
points[3].position = points[3].tangent = Vector3.down / 2f * size.y + Vector3.left / 2f * size.x;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e39c41817ed55504cbef2a470c95599d
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class RoundedRectangle : SplinePrimitive
{
public Vector2 size = Vector2.one;
public float xRadius = 0.25f;
public float yRadius = 0.25f;
public override Spline.Type GetSplineType()
{
return Spline.Type.Bezier;
}
protected override void Generate()
{
base.Generate();
closed = true;
CreatePoints(8, SplinePoint.Type.Broken);
Vector2 edgeSize = size - new Vector2(xRadius, yRadius) * 2f;
points[0].SetPosition(Vector3.up / 2f * edgeSize.y + Vector3.left / 2f * size.x);
points[1].SetPosition(Vector3.up / 2f * size.y + Vector3.left / 2f * edgeSize.x);
points[2].SetPosition(Vector3.up / 2f * size.y + Vector3.right / 2f * edgeSize.x);
points[3].SetPosition(Vector3.up / 2f * edgeSize.y + Vector3.right / 2f * size.x);
points[4].SetPosition(Vector3.down / 2f * edgeSize.y + Vector3.right / 2f * size.x);
points[5].SetPosition(Vector3.down / 2f * size.y + Vector3.right / 2f * edgeSize.x);
points[6].SetPosition(Vector3.down / 2f * size.y + Vector3.left / 2f * edgeSize.x);
points[7].SetPosition(Vector3.down / 2f * edgeSize.y + Vector3.left / 2f * size.x);
float xRad = 2f * (Mathf.Sqrt(2f) - 1f) / 3f * xRadius * 2f;
float yRad = 2f * (Mathf.Sqrt(2f) - 1f) / 3f * yRadius * 2f;
points[0].SetTangent2Position(points[0].position + Vector3.up * yRad);
points[1].SetTangentPosition(points[1].position + Vector3.left * xRad);
points[2].SetTangent2Position(points[2].position + Vector3.right * xRad);
points[3].SetTangentPosition(points[3].position + Vector3.up * yRad);
points[4].SetTangent2Position(points[4].position + Vector3.down * yRad);
points[5].SetTangentPosition(points[5].position + Vector3.right * xRad);
points[6].SetTangent2Position(points[6].position + Vector3.left * xRad);
points[7].SetTangentPosition(points[7].position + Vector3.down * yRad);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a6ad8207cf520e94aa15dea4fae0027d
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Spiral : SplinePrimitive
{
public float startRadius = 1f;
public float endRadius = 1f;
public float stretch = 1f;
public int iterations = 3;
public bool clockwise = true;
public AnimationCurve curve = new AnimationCurve();
public override Spline.Type GetSplineType()
{
return Spline.Type.Bezier;
}
protected override void Generate()
{
base.Generate();
closed = false;
CreatePoints(iterations * 4 + 1, SplinePoint.Type.SmoothMirrored);
float radiusDelta = Mathf.Abs(endRadius - startRadius);
float radiusDeltaPercent = radiusDelta / Mathf.Max(Mathf.Abs(endRadius), Mathf.Abs(startRadius));
float multiplier = 1f;
if (endRadius > startRadius) multiplier = -1;
float angle = 0f;
float str = 0f;
float angleDirection = clockwise ? 1f : -1f;
for (int i = 0; i <= iterations * 4; i++)
{
float percent = curve.Evaluate((float)i / (iterations * 4));
float radius = Mathf.Lerp(startRadius, endRadius, percent);
Quaternion rot = Quaternion.AngleAxis(angle, Vector3.up);
points[i].position = rot * Vector3.forward / 2f * radius + Vector3.up * str;
Quaternion tangentRot = Quaternion.identity;
if (multiplier > 0) tangentRot = Quaternion.AngleAxis(Mathf.Lerp(0f, 90f * 0.16f * angleDirection, radiusDeltaPercent * percent), Vector3.up);
else tangentRot = Quaternion.AngleAxis(Mathf.Lerp(0f, -90f * 0.16f * angleDirection, (1f - percent) * radiusDeltaPercent), Vector3.up);
if (clockwise) points[i].tangent = points[i].position - (tangentRot * rot * Vector3.right * radius + Vector3.up * stretch / 4f) * 2 * (Mathf.Sqrt(2f) - 1f) / 3f;
else points[i].tangent = points[i].position + (tangentRot * rot * Vector3.right * radius - Vector3.up * stretch / 4f) * 2 * (Mathf.Sqrt(2f) - 1f) / 3f;
points[i].tangent2 = points[i].position - (points[i].tangent - points[i].position);
str += stretch / 4f;
angle += 90f * angleDirection;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d4c765265077e6a4d9bc4e5d2cc75f3c
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,110 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives {
public class SplinePrimitive
{
protected bool closed = false;
protected SplinePoint[] points = new SplinePoint[0];
public Vector3 offset = Vector3.zero;
public Vector3 rotation = Vector3.zero;
public bool is2D = false;
public virtual void Calculate()
{
Generate();
ApplyOffset();
}
protected virtual void Generate()
{
}
public Spline CreateSpline()
{
Generate();
ApplyOffset();
Spline spline = new Spline(GetSplineType());
spline.points = points;
if (closed) spline.Close();
return spline;
}
public void UpdateSpline(Spline spline)
{
Generate();
ApplyOffset();
spline.type = GetSplineType();
spline.points = points;
if (closed) spline.Close();
else if (spline.isClosed) spline.Break();
}
public SplineComputer CreateSplineComputer(string name, Vector3 position, Quaternion rotation)
{
Generate();
ApplyOffset();
GameObject go = new GameObject(name);
SplineComputer comp = go.AddComponent<SplineComputer>();
comp.SetPoints(points, SplineComputer.Space.Local);
if (closed) comp.Close();
comp.transform.position = position;
comp.transform.rotation = rotation;
return comp;
}
public void UpdateSplineComputer(SplineComputer comp)
{
Generate();
ApplyOffset();
comp.type = GetSplineType();
comp.SetPoints(points, SplineComputer.Space.Local);
if (closed) comp.Close();
else if (comp.isClosed) comp.Break();
}
public SplinePoint[] GetPoints()
{
return points;
}
public virtual Spline.Type GetSplineType()
{
return Spline.Type.CatmullRom;
}
public bool GetIsClosed()
{
return closed;
}
void ApplyOffset()
{
Quaternion freeRot = Quaternion.Euler(rotation);
if (is2D) freeRot = Quaternion.AngleAxis(-rotation.z, Vector3.forward) * Quaternion.AngleAxis(90f, Vector3.right);
for (int i = 0; i < points.Length; i++)
{
points[i].position = freeRot * points[i].position;
points[i].tangent = freeRot * points[i].tangent;
points[i].tangent2 = freeRot * points[i].tangent2;
points[i].normal = freeRot * points[i].normal;
}
for (int i = 0; i < points.Length; i++) points[i].SetPosition(points[i].position + offset);
}
protected void CreatePoints(int count, SplinePoint.Type type)
{
if (points.Length != count) points = new SplinePoint[count];
for (int i = 0; i < points.Length; i++)
{
points[i].type = type;
points[i].normal = Vector3.up;
points[i].color = Color.white;
points[i].size = 1f;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: acb225539fdaf0d479f2ca1a7694afcc
timeCreated: 1495473185
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Dreamteck.Splines.Primitives
{
public class Star : SplinePrimitive
{
public float radius = 1f;
public float depth = 0.5f;
public int sides = 5;
public override Spline.Type GetSplineType()
{
return Spline.Type.Linear;
}
protected override void Generate()
{
base.Generate();
closed = true;
CreatePoints(sides * 2, SplinePoint.Type.SmoothMirrored);
float innerRadius = radius * depth;
for (int i = 0; i < sides * 2; i++)
{
float percent = (float)i / (float)(sides * 2);
Vector3 pos = Quaternion.AngleAxis(180 + 360f * percent, Vector3.forward) * Vector3.up * ((float)i % 2f == 0 ? radius : innerRadius);
points[i].SetPosition(pos);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 30808d4ccaa42844698780f3f2af4308
timeCreated: 1495474369
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: