1
43
Assets/Dreamteck/Splines/Components/BlankUser.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
//This is a blank SplineUser-derived class which you can use to build your custom SplineUser
|
||||
//You can safely delete any functions that you won't use
|
||||
//DO NOT ADD Update, LateUpdate or FixedUpdate, use Run, it is automatically called through one of these methods
|
||||
public class BlankUser : SplineUser
|
||||
{
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
//Awake is also called in the editor
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
//Write initialization code here
|
||||
}
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
base.LateRun();
|
||||
//Code to run every Update/FixedUpdate/LateUpdate
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
//Build is called after the spline has been sampled.
|
||||
//Use it for calculations (example: generate mesh geometry, calculate object positions)
|
||||
}
|
||||
|
||||
protected override void PostBuild()
|
||||
{
|
||||
base.PostBuild();
|
||||
//Called on the main thread after Build has finished
|
||||
//Use it to apply the calculations from Build to GameObjects, Transforms, Meshes, etc.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/BlankUser.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 740f49ddb7ee0984b83bd6ab7514b564
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 9bbaac8eb7021d44b9864113856c00fa, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
156
Assets/Dreamteck/Splines/Components/BoxColliderGenerator.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class BoxColliderGenerator : SplineUser, ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField] private Vector2 _boxSize = Vector2.one;
|
||||
[SerializeField] private bool _debugDraw = false;
|
||||
[SerializeField] private Color _debugDrawColor = Color.white;
|
||||
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
public ColliderObject[] _colliders = new ColliderObject[0];
|
||||
|
||||
|
||||
public Vector2 boxSize
|
||||
{
|
||||
get { return _boxSize; }
|
||||
set
|
||||
{
|
||||
if (value != _boxSize)
|
||||
{
|
||||
_boxSize = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyCollider(ColliderObject collider)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Destroy(collider.transform.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyImmediate(collider.transform.gameObject);
|
||||
}
|
||||
#else
|
||||
Destroy(collider.transform.gameObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
|
||||
if (sampleCount == 0)
|
||||
{
|
||||
for (int i = 0; i < _colliders.Length; i++)
|
||||
{
|
||||
DestroyCollider(_colliders[i]);
|
||||
}
|
||||
_colliders = new ColliderObject[0];
|
||||
return;
|
||||
}
|
||||
|
||||
int objectCount = sampleCount - 1;
|
||||
if (objectCount != _colliders.Length)
|
||||
{
|
||||
ColliderObject[] newColliders = new ColliderObject[objectCount];
|
||||
for (int i = 0; i < newColliders.Length; i++)
|
||||
{
|
||||
if (i < _colliders.Length)
|
||||
{
|
||||
newColliders[i] = _colliders[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject newObject = new GameObject("Collider " + i);
|
||||
newObject.layer = gameObject.layer;
|
||||
newObject.transform.parent = trs;
|
||||
newColliders[i] = new ColliderObject(newObject.transform, newObject.AddComponent<BoxCollider>());
|
||||
}
|
||||
}
|
||||
if (newColliders.Length < _colliders.Length)
|
||||
{
|
||||
for (int i = newColliders.Length; i < _colliders.Length; i++)
|
||||
{
|
||||
DestroyCollider(_colliders[i]);
|
||||
}
|
||||
}
|
||||
_colliders = newColliders;
|
||||
}
|
||||
|
||||
SplineSample current = new SplineSample();
|
||||
SplineSample next = new SplineSample();
|
||||
Evaluate(0.0, ref current);
|
||||
|
||||
for (int i = 0; i < objectCount; i++)
|
||||
{
|
||||
double nextPercent = (double)(i + 1) / (sampleCount - 1);
|
||||
Evaluate(nextPercent, ref next);
|
||||
_colliders[i].transform.position = Vector3.Lerp(current.position, next.position, 0.5f);
|
||||
_colliders[i].transform.rotation = Quaternion.LookRotation(next.position - current.position, Vector3.Slerp(current.up, next.up, 0.5f));
|
||||
float size = Mathf.Lerp(current.size, next.size, 0.5f);
|
||||
_colliders[i].collider.size = new Vector3(_boxSize.x * size, _boxSize.y * size, Vector3.Distance(current.position, next.position));
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnBeforeSerialize()
|
||||
{
|
||||
base.OnBeforeSerialize();
|
||||
Build();
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (_debugDraw)
|
||||
{
|
||||
for (int i = 0; i < _colliders.Length; i++)
|
||||
{
|
||||
Gizmos.matrix = _colliders[i].transform.localToWorldMatrix;
|
||||
Gizmos.color = _debugDrawColor;
|
||||
Gizmos.DrawCube(Vector3.zero, _colliders[i].collider.size);
|
||||
}
|
||||
Gizmos.matrix = Matrix4x4.identity;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
for (int i = 0; i < _colliders.Length; i++)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
DestroyImmediate(_colliders[i].transform.gameObject);
|
||||
} else
|
||||
{
|
||||
Destroy(_colliders[i].transform.gameObject);
|
||||
}
|
||||
#else
|
||||
Destroy(_colliders[i].transform.gameObject);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ColliderObject
|
||||
{
|
||||
public Transform transform;
|
||||
public BoxCollider collider;
|
||||
|
||||
public ColliderObject(Transform transform, BoxCollider collider)
|
||||
{
|
||||
this.transform = transform;
|
||||
this.collider = collider;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ca405288a4bb374aa05101b41667f31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: cb20b67de46b9e74c9f89a19e206de06, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
213
Assets/Dreamteck/Splines/Components/CapsuleColliderGenerator.cs
Normal file
@@ -0,0 +1,213 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class CapsuleColliderGenerator : SplineUser, ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField, HideInInspector, Min(0f)] private float _radius = 1f;
|
||||
[SerializeField, HideInInspector, Min(0f)] private float _height = 1f;
|
||||
[SerializeField, HideInInspector] private bool _overlapCaps = true;
|
||||
[SerializeField, HideInInspector] private CapsuleColliderZDirection _direction = CapsuleColliderZDirection.Z;
|
||||
[SerializeField, HideInInspector] private ColliderObject[] _colliders = new ColliderObject[0];
|
||||
|
||||
public float radius
|
||||
{
|
||||
get { return _radius; }
|
||||
set
|
||||
{
|
||||
if (value != _radius)
|
||||
{
|
||||
_radius = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float height
|
||||
{
|
||||
get { return _height; }
|
||||
set
|
||||
{
|
||||
if (value != _height)
|
||||
{
|
||||
_height = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool overlapCaps
|
||||
{
|
||||
get { return _overlapCaps; }
|
||||
set
|
||||
{
|
||||
if (value != _overlapCaps)
|
||||
{
|
||||
_overlapCaps = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CapsuleColliderZDirection direction
|
||||
{
|
||||
get { return _direction; }
|
||||
set
|
||||
{
|
||||
if (value != _direction)
|
||||
{
|
||||
_direction = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyCollider(ColliderObject collider)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Destroy(collider.transform.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyImmediate(collider.transform.gameObject);
|
||||
}
|
||||
#else
|
||||
Destroy(collider.transform.gameObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
|
||||
if (sampleCount == 0)
|
||||
{
|
||||
for (int i = 0; i < _colliders.Length; i++)
|
||||
{
|
||||
DestroyCollider(_colliders[i]);
|
||||
}
|
||||
_colliders = new ColliderObject[0];
|
||||
return;
|
||||
}
|
||||
|
||||
int objectCount = sampleCount - 1;
|
||||
if (objectCount != _colliders.Length)
|
||||
{
|
||||
GenerateColliders(objectCount);
|
||||
}
|
||||
|
||||
SplineSample current = new SplineSample();
|
||||
SplineSample next = new SplineSample();
|
||||
Evaluate(0.0, ref current);
|
||||
|
||||
bool controlHeight = _direction == CapsuleColliderZDirection.Z;
|
||||
|
||||
for (int i = 0; i < objectCount; i++)
|
||||
{
|
||||
double nextPercent = (double)(i + 1) / (sampleCount - 1);
|
||||
Evaluate(nextPercent, ref next);
|
||||
_colliders[i].transform.position = Vector3.Lerp(current.position, next.position, 0.5f);
|
||||
_colliders[i].transform.rotation = Quaternion.LookRotation(next.position - current.position, Vector3.Slerp(current.up, next.up, 0.5f));
|
||||
|
||||
_colliders[i].collider.radius = _radius;
|
||||
_colliders[i].collider.direction = (int)_direction;
|
||||
|
||||
var distance = Vector3.Distance(current.position, next.position);
|
||||
|
||||
if (controlHeight)
|
||||
{
|
||||
if (_overlapCaps)
|
||||
{
|
||||
_colliders[i].collider.height = distance + _radius * 2f;
|
||||
} else
|
||||
{
|
||||
_colliders[i].collider.height = distance;
|
||||
}
|
||||
_colliders[i].collider.radius = _radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
_colliders[i].collider.height = _height;
|
||||
_colliders[i].collider.radius = distance * 0.5f;
|
||||
}
|
||||
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateColliders(int count)
|
||||
{
|
||||
ColliderObject[] newColliders = new ColliderObject[count];
|
||||
for (int i = 0; i < newColliders.Length; i++)
|
||||
{
|
||||
if (i < _colliders.Length)
|
||||
{
|
||||
newColliders[i] = _colliders[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
GameObject newObject = new GameObject("Collider " + i);
|
||||
newObject.layer = gameObject.layer;
|
||||
newObject.transform.parent = trs;
|
||||
newColliders[i] = new ColliderObject(newObject.transform, newObject.AddComponent<CapsuleCollider>(), _direction, _height);
|
||||
}
|
||||
}
|
||||
if (newColliders.Length < _colliders.Length)
|
||||
{
|
||||
for (int i = newColliders.Length; i < _colliders.Length; i++)
|
||||
{
|
||||
DestroyCollider(_colliders[i]);
|
||||
}
|
||||
}
|
||||
_colliders = newColliders;
|
||||
}
|
||||
|
||||
public override void OnBeforeSerialize()
|
||||
{
|
||||
base.OnBeforeSerialize();
|
||||
Build();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
for (int i = 0; i < _colliders.Length; i++)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
DestroyImmediate(_colliders[i].transform.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(_colliders[i].transform.gameObject);
|
||||
}
|
||||
#else
|
||||
Destroy(_colliders[i].transform.gameObject);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ColliderObject
|
||||
{
|
||||
public Transform transform;
|
||||
public CapsuleCollider collider;
|
||||
|
||||
public ColliderObject(Transform transform, CapsuleCollider collider, CapsuleColliderZDirection direction, float height)
|
||||
{
|
||||
this.transform = transform;
|
||||
this.collider = collider;
|
||||
this.collider.direction = (int)direction;
|
||||
this.collider.height = height;
|
||||
}
|
||||
}
|
||||
|
||||
public enum CapsuleColliderZDirection
|
||||
{
|
||||
X = 0, Y = 1, Z = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56dd191f9d7c9cd4d9c21559487036d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b733442d053b9f64192ad260ecd30193, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
347
Assets/Dreamteck/Splines/Components/ComplexSurfaceGenerator.cs
Normal file
@@ -0,0 +1,347 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
[AddComponentMenu("Dreamteck/Splines/Complex Surface Generator")]
|
||||
public class ComplexSurfaceGenerator : MeshGenerator
|
||||
{
|
||||
public enum UVWrapMode { Clamp, UniformX, UniformY, Uniform }
|
||||
public enum SubdivisionMode { CatmullRom, BSpline, Linear }
|
||||
public UVWrapMode uvWrapMode
|
||||
{
|
||||
get { return _uvWrapMode; }
|
||||
set
|
||||
{
|
||||
if (value != _uvWrapMode)
|
||||
{
|
||||
_uvWrapMode = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int subdivisions
|
||||
{
|
||||
get { return _subdivisions; }
|
||||
set
|
||||
{
|
||||
if (value != _subdivisions)
|
||||
{
|
||||
_subdivisions = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SubdivisionMode subdivisionMode
|
||||
{
|
||||
get { return _subdivisionMode; }
|
||||
set
|
||||
{
|
||||
if (value != _subdivisionMode)
|
||||
{
|
||||
_subdivisionMode = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool automaticNormals
|
||||
{
|
||||
get { return _automaticNormals; }
|
||||
set
|
||||
{
|
||||
if (value != _automaticNormals)
|
||||
{
|
||||
_automaticNormals = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool separateMaterialIDs
|
||||
{
|
||||
get { return _separateMaterialIDs; }
|
||||
set
|
||||
{
|
||||
if (value != _separateMaterialIDs)
|
||||
{
|
||||
_separateMaterialIDs = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SplineComputer[] otherComputers
|
||||
{
|
||||
get { return _otherComputers; }
|
||||
set
|
||||
{
|
||||
bool rebuild = false;
|
||||
if (value.Length != _otherComputers.Length)
|
||||
{
|
||||
rebuild = true;
|
||||
for (int i = 0; i < _otherComputers.Length; i++)
|
||||
{
|
||||
if (_otherComputers[i] != null)
|
||||
{
|
||||
_otherComputers[i].Unsubscribe(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
if (_otherComputers[i] != null)
|
||||
{
|
||||
_otherComputers[i].Unsubscribe(this);
|
||||
}
|
||||
if (value[i] != _otherComputers[i])
|
||||
{
|
||||
rebuild = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rebuild)
|
||||
{
|
||||
_otherComputers = value;
|
||||
for (int i = 0; i < _otherComputers.Length; i++)
|
||||
{
|
||||
if (_otherComputers[i] != null)
|
||||
{
|
||||
if (_otherComputers[i].subscriberCount == 0)
|
||||
{
|
||||
_otherComputers[i].name = "Surface Spline " + (i + 1);
|
||||
}
|
||||
_otherComputers[i].Subscribe(this);
|
||||
}
|
||||
}
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private UVWrapMode _uvWrapMode = UVWrapMode.Clamp;
|
||||
[SerializeField, HideInInspector, Min(1)]
|
||||
private int _subdivisions = 3;
|
||||
[SerializeField, HideInInspector]
|
||||
private SubdivisionMode _subdivisionMode;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _automaticNormals = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _separateMaterialIDs = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private SplineComputer[] _otherComputers = new SplineComputer[0];
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Spline[] _splines = new Spline[0];
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
//private bool _initializedInEditor = false;
|
||||
//不把这些warning消掉就难受
|
||||
private int iterations => _subdivisions * _otherComputers.Length;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_mesh.name = "multispline_surface";
|
||||
for (int i = 0; i < _otherComputers.Length; i++)
|
||||
{
|
||||
_otherComputers[i].onRebuild -= OnOtherRebuild;
|
||||
_otherComputers[i].onRebuild += OnOtherRebuild;
|
||||
}
|
||||
}
|
||||
|
||||
void OnOtherRebuild()
|
||||
{
|
||||
RebuildImmediate();
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
private Spline.Type ModeToSplineType(SubdivisionMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case SubdivisionMode.BSpline: return Spline.Type.BSpline;
|
||||
case SubdivisionMode.Linear: return Spline.Type.Linear;
|
||||
default: return Spline.Type.CatmullRom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void BuildMesh()
|
||||
{
|
||||
if (sampleCount == 0 || _otherComputers.Length == 0)
|
||||
{
|
||||
AllocateMesh(0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_splines.Length != sampleCount)
|
||||
{
|
||||
_splines = new Spline[sampleCount];
|
||||
for (int i = 0; i < _splines.Length; i++)
|
||||
{
|
||||
_splines[i] = new Spline(ModeToSplineType(_subdivisionMode));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < _splines.Length; i++)
|
||||
{
|
||||
_splines[i].type = ModeToSplineType(_subdivisionMode);
|
||||
}
|
||||
}
|
||||
|
||||
base.BuildMesh();
|
||||
AllocateMesh(sampleCount * (iterations + 1), iterations * (sampleCount - 1) * 6);
|
||||
_tsMesh.triangles = MeshUtility.GeneratePlaneTriangles(sampleCount - 1, iterations + 1, false);
|
||||
GenerateVertices();
|
||||
_tsMesh.subMeshes.Clear();
|
||||
|
||||
if (_separateMaterialIDs)
|
||||
{
|
||||
for (int i = 0; i < _otherComputers.Length; i++)
|
||||
{
|
||||
int[] newTris = MeshUtility.GeneratePlaneTriangles(sampleCount - 1, subdivisions + 1, false);
|
||||
_tsMesh.subMeshes.Add(newTris);
|
||||
for (int n = 0; n < _tsMesh.subMeshes[i].Length; n++)
|
||||
{
|
||||
_tsMesh.subMeshes[i][n] += i * (_subdivisions * sampleCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenerateVertices()
|
||||
{
|
||||
if (_otherComputers.Length == 0) return;
|
||||
|
||||
ResetUVDistance();
|
||||
|
||||
SplineSample sample = default;
|
||||
SplineSample sample2 = default;
|
||||
|
||||
for (int i = 0; i < _otherComputers.Length + 1; i++)
|
||||
{
|
||||
SplineComputer splineComp = spline;
|
||||
if (i > 0)
|
||||
{
|
||||
splineComp = _otherComputers[i - 1];
|
||||
}
|
||||
|
||||
for (int j = 0; j < sampleCount; j++)
|
||||
{
|
||||
if (_splines[j].points.Length != _otherComputers.Length + 1)
|
||||
{
|
||||
_splines[j].points = new SplinePoint[_otherComputers.Length + 1];
|
||||
}
|
||||
|
||||
double xPercent = DMath.Lerp(clipFrom, clipTo, (double)j / (sampleCount - 1));
|
||||
if (i > 0)
|
||||
{
|
||||
splineComp.Evaluate(xPercent, ref sample);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSample(j, ref sample);
|
||||
}
|
||||
|
||||
_splines[j].points[i].position = sample.position;
|
||||
_splines[j].points[i].normal = sample.up;
|
||||
_splines[j].points[i].color = sample.color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int x = 0; x < _splines.Length; x++)
|
||||
{
|
||||
if (uvMode == UVMode.UniformClamp || uvMode == UVMode.UniformClip)
|
||||
{
|
||||
AddUVDistance(x);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSample(x, ref sample2);
|
||||
}
|
||||
Vector3 lastPos = sample.position;
|
||||
float ydist = 0f;
|
||||
float xPercent = Mathf.Lerp((float)clipFrom, (float)clipTo, (float)x / (_splines.Length - 1));
|
||||
for (int y = 0; y < iterations + 1; y++)
|
||||
{
|
||||
float yPercent = (float)y / iterations;
|
||||
int index = x + y * _splines.Length;
|
||||
_splines[x].Evaluate(yPercent, ref sample);
|
||||
if (y > 0)
|
||||
{
|
||||
ydist += Vector3.Distance(lastPos, sample.position);
|
||||
}
|
||||
lastPos = sample.position;
|
||||
if (uvMode == UVMode.UniformClamp)
|
||||
{
|
||||
__uvs.x = CalculateUVUniformClamp(_vDist);
|
||||
__uvs.y = CalculateUVUniformClamp(ydist);
|
||||
}
|
||||
else if (uvMode == UVMode.UniformClip)
|
||||
{
|
||||
__uvs.x = CalculateUVUniformClip(_vDist);
|
||||
__uvs.y = CalculateUVUniformClip(ydist);
|
||||
}
|
||||
else
|
||||
{
|
||||
CalculateUVs(xPercent, yPercent);
|
||||
}
|
||||
|
||||
_tsMesh.vertices[index] = sample.position;
|
||||
_tsMesh.normals[index] = sample.up;
|
||||
_tsMesh.colors[index] = sample.color;
|
||||
_tsMesh.uv[index] = Vector2.one * 0.5f + (Vector2)(Quaternion.AngleAxis(uvRotation + 180f, Vector3.forward) * (Vector2.one * 0.5f - __uvs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void WriteMesh()
|
||||
{
|
||||
base.WriteMesh();
|
||||
if (_automaticNormals)
|
||||
{
|
||||
_mesh.RecalculateNormals();
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawSpline(Spline spline, Color color, double from = 0.0, double to = 1.0)
|
||||
{
|
||||
double add = spline.moveStep;
|
||||
int iterations = spline.iterations;
|
||||
if (iterations <= 0) return;
|
||||
|
||||
Vector3 prevPoint = spline.EvaluatePosition(from);
|
||||
for (int i = 1; i < iterations; i++)
|
||||
{
|
||||
double p = DMath.Lerp(from, to, (double)i / (iterations - 1));
|
||||
Debug.DrawLine(prevPoint, spline.EvaluatePosition(p), color, 1f);
|
||||
prevPoint = spline.EvaluatePosition(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23c67ca6f2dc03d45be9d985a114a897
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 35e3772429ad8a449bd5bc523a053798, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
120
Assets/Dreamteck/Splines/Components/EdgeColliderGenerator.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Edge Collider Generator")]
|
||||
[RequireComponent(typeof(EdgeCollider2D))]
|
||||
public class EdgeColliderGenerator : SplineUser
|
||||
{
|
||||
public float offset
|
||||
{
|
||||
get { return _offset; }
|
||||
set
|
||||
{
|
||||
if (value != _offset)
|
||||
{
|
||||
_offset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _offset = 0f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
protected EdgeCollider2D edgeCollider;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
protected Vector2[] vertices = new Vector2[0];
|
||||
|
||||
[HideInInspector]
|
||||
public float updateRate = 0.1f;
|
||||
protected float lastUpdateTime = 0f;
|
||||
|
||||
private bool updateCollider = false;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
edgeCollider = GetComponent<EdgeCollider2D>();
|
||||
}
|
||||
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
base.LateRun();
|
||||
if (updateCollider)
|
||||
{
|
||||
if (edgeCollider != null)
|
||||
{
|
||||
if (Time.time - lastUpdateTime >= updateRate)
|
||||
{
|
||||
lastUpdateTime = Time.time;
|
||||
updateCollider = false;
|
||||
edgeCollider.points = vertices;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
if (vertices.Length != sampleCount) vertices = new Vector2[sampleCount];
|
||||
bool hasOffset = offset != 0f;
|
||||
for (int i = 0; i < sampleCount; i++)
|
||||
{
|
||||
GetSample(i, ref evalResult);
|
||||
vertices[i] = evalResult.position;
|
||||
if (hasOffset)
|
||||
{
|
||||
Vector2 right = new Vector2(-evalResult.forward.y, evalResult.forward.x).normalized * evalResult.size;
|
||||
vertices[i] += right * offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PostBuild()
|
||||
{
|
||||
base.PostBuild();
|
||||
if (edgeCollider == null) return;
|
||||
for(int i = 0; i < vertices.Length; i++) vertices[i] = transform.InverseTransformPoint(vertices[i]);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying || updateRate <= 0f)
|
||||
{
|
||||
edgeCollider.points = vertices;
|
||||
} else updateCollider = true;
|
||||
#else
|
||||
if(updateRate == 0f) edgeCollider.points = vertices;
|
||||
else updateCollider = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d28d465ca9ef341488ba836962159676
|
||||
timeCreated: 1523272688
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 7417baf45051d9e4b974d45e69811efd, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/Dreamteck/Splines/Components/ISampleModifier.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
public interface ISampleModifier
|
||||
{
|
||||
public void ApplySampleModifiers(ref SplineSample sample);
|
||||
|
||||
public Vector3 GetModifiedSamplePosition(ref SplineSample sample);
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/ISampleModifier.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f878af9c27e51e4b9b42aee2e444837
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Dreamteck/Splines/Components/Icons.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8f7791e2385f7946a593cd84b580025
|
||||
folderAsset: yes
|
||||
timeCreated: 1457811249
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 9.5 KiB |
@@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb20b67de46b9e74c9f89a19e206de06
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b733442d053b9f64192ad260ecd30193
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7417baf45051d9e4b974d45e69811efd
|
||||
timeCreated: 1523272668
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/LengthCalculator.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4b069b14ffccf146b40c7aae7c4818f
|
||||
timeCreated: 1497441467
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 9.6 KiB |
@@ -0,0 +1,135 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35e3772429ad8a449bd5bc523a053798
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/NodeIcon.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
107
Assets/Dreamteck/Splines/Components/Icons/NodeIcon.png.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09a5be8542799294ab31f6b97c88471b
|
||||
timeCreated: 1459172591
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/ObjectBender.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
107
Assets/Dreamteck/Splines/Components/Icons/ObjectBender.png.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71feaa5f5395f3640a94b1ba649bc941
|
||||
timeCreated: 1472464036
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/ObjectController.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 809d29b9ca1b74947aca02225d2ec233
|
||||
timeCreated: 1497441486
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,132 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 956119420e783ba4e8c22ab8c32ed5e8
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/ParticleController.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c78150f2237d29247b0f01c770f06979
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/PathGenerator.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
107
Assets/Dreamteck/Splines/Components/Icons/PathGenerator.png.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71dadc4e471c37945ba62bf068cf1468
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 8.6 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fad78752ebca1541a3321d08d1cd041
|
||||
timeCreated: 1497441504
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineComputer.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,117 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c4c2926f013fcf498c19b14b90050c5
|
||||
timeCreated: 1484825827
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineFollower.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14d9ee407d8622249bb457e71b4400d1
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineMesh.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
107
Assets/Dreamteck/Splines/Components/Icons/SplineMesh.png.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 832e3a79eca687941a031a046045c8cc
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineMorph.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
112
Assets/Dreamteck/Splines/Components/Icons/SplineMorph.png.meta
Normal file
@@ -0,0 +1,112 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a7f65ad6116cff448644595264d0ae4
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplinePositioner.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7445cc27708caa049a4b4ef14d9a5eef
|
||||
timeCreated: 1467623533
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineProjector.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9dbfb387ba852e34299827107f06d528
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineRenderer.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02f78a9ec76d40f49bfac78c64a754d1
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SplineUser.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
107
Assets/Dreamteck/Splines/Components/Icons/SplineUser.png.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bbaac8eb7021d44b9864113856c00fa
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/SurfaceGenerator.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf90d545cbe8b2a4197b471709a5e579
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/TubeGenerator.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
107
Assets/Dreamteck/Splines/Components/Icons/TubeGenerator.png.meta
Normal file
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4e3f1d75c0b07f4890e7acab6fd1a15
|
||||
timeCreated: 1457811264
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Dreamteck/Splines/Components/Icons/WaveformGenerator.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1,107 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 608905f522fa0644398876606b832e68
|
||||
timeCreated: 1497441532
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
89
Assets/Dreamteck/Splines/Components/LengthCalculator.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Length Calculator")]
|
||||
public class LengthCalculator : SplineUser
|
||||
{
|
||||
[System.Serializable]
|
||||
public class LengthEvent
|
||||
{
|
||||
public bool enabled = true;
|
||||
public float targetLength = 0f;
|
||||
public UnityEvent onChange = new UnityEvent();
|
||||
public enum Type { Growing, Shrinking, Both}
|
||||
public Type type = Type.Both;
|
||||
|
||||
public LengthEvent()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LengthEvent(Type t)
|
||||
{
|
||||
type = t;
|
||||
}
|
||||
|
||||
public void Check(float fromLength, float toLength)
|
||||
{
|
||||
if (!enabled) return;
|
||||
bool condition = false;
|
||||
switch (type)
|
||||
{
|
||||
case Type.Growing: condition = toLength >= targetLength && fromLength < targetLength; break;
|
||||
case Type.Shrinking: condition = toLength <= targetLength && fromLength > targetLength; break;
|
||||
case Type.Both: condition = toLength >= targetLength && fromLength < targetLength || toLength <= targetLength && fromLength > targetLength; break;
|
||||
}
|
||||
if (condition) onChange.Invoke();
|
||||
}
|
||||
}
|
||||
[HideInInspector]
|
||||
public LengthEvent[] lengthEvents = new LengthEvent[0];
|
||||
[HideInInspector]
|
||||
public float idealLength = 1f;
|
||||
private float _length = 0f;
|
||||
private float lastLength = 0f;
|
||||
public float length
|
||||
{
|
||||
get {
|
||||
return _length;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
_length = CalculateLength();
|
||||
lastLength = _length;
|
||||
for (int i = 0; i < lengthEvents.Length; i++)
|
||||
{
|
||||
if (lengthEvents[i].targetLength == _length) lengthEvents[i].onChange.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
_length = CalculateLength();
|
||||
if (lastLength != _length)
|
||||
{
|
||||
for (int i = 0; i < lengthEvents.Length; i++)
|
||||
{
|
||||
lengthEvents[i].Check(lastLength, _length);
|
||||
}
|
||||
lastLength = _length;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddEvent(LengthEvent lengthEvent)
|
||||
{
|
||||
LengthEvent[] newEvents = new LengthEvent[lengthEvents.Length + 1];
|
||||
lengthEvents.CopyTo(newEvents, 0);
|
||||
newEvents[newEvents.Length - 1] = lengthEvent;
|
||||
lengthEvents = newEvents;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/LengthCalculator.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 995701723b428a94c9305a2abf319ad6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b4b069b14ffccf146b40c7aae7c4818f, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
639
Assets/Dreamteck/Splines/Components/MeshGenerator.cs
Normal file
@@ -0,0 +1,639 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
public class MeshGenerator : SplineUser
|
||||
{
|
||||
protected const int UNITY_16_VERTEX_LIMIT = 65535;
|
||||
|
||||
public float size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
{
|
||||
if (value != _size)
|
||||
{
|
||||
_size = value;
|
||||
Rebuild();
|
||||
}
|
||||
else _size = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
if (value != _color)
|
||||
{
|
||||
_color = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 offset
|
||||
{
|
||||
get { return _offset; }
|
||||
set
|
||||
{
|
||||
if (value != _offset)
|
||||
{
|
||||
_offset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NormalMethod normalMethod
|
||||
{
|
||||
get { return _normalMethod; }
|
||||
set
|
||||
{
|
||||
if (value != _normalMethod)
|
||||
{
|
||||
_normalMethod = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool useSplineSize
|
||||
{
|
||||
get { return _useSplineSize; }
|
||||
set
|
||||
{
|
||||
if (value != _useSplineSize)
|
||||
{
|
||||
_useSplineSize = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool useSplineColor
|
||||
{
|
||||
get { return _useSplineColor; }
|
||||
set
|
||||
{
|
||||
if (value != _useSplineColor)
|
||||
{
|
||||
_useSplineColor = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool calculateTangents
|
||||
{
|
||||
get { return _calculateTangents; }
|
||||
set
|
||||
{
|
||||
if (value != _calculateTangents)
|
||||
{
|
||||
_calculateTangents = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float rotation
|
||||
{
|
||||
get { return _rotation; }
|
||||
set
|
||||
{
|
||||
if (value != _rotation)
|
||||
{
|
||||
_rotation = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool flipFaces
|
||||
{
|
||||
get { return _flipFaces; }
|
||||
set
|
||||
{
|
||||
if (value != _flipFaces)
|
||||
{
|
||||
_flipFaces = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool doubleSided
|
||||
{
|
||||
get { return _doubleSided; }
|
||||
set
|
||||
{
|
||||
if (value != _doubleSided)
|
||||
{
|
||||
_doubleSided = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UVMode uvMode
|
||||
{
|
||||
get { return _uvMode; }
|
||||
set
|
||||
{
|
||||
if (value != _uvMode)
|
||||
{
|
||||
_uvMode = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 uvScale
|
||||
{
|
||||
get { return _uvScale; }
|
||||
set
|
||||
{
|
||||
if (value != _uvScale)
|
||||
{
|
||||
_uvScale = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 uvOffset
|
||||
{
|
||||
get { return _uvOffset; }
|
||||
set
|
||||
{
|
||||
if (value != _uvOffset)
|
||||
{
|
||||
_uvOffset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float uvRotation
|
||||
{
|
||||
get { return _uvRotation; }
|
||||
set
|
||||
{
|
||||
if (value != _uvRotation)
|
||||
{
|
||||
_uvRotation = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UnityEngine.Rendering.IndexFormat meshIndexFormat
|
||||
{
|
||||
get { return _meshIndexFormat; }
|
||||
set
|
||||
{
|
||||
if (value != _meshIndexFormat)
|
||||
{
|
||||
_meshIndexFormat = value;
|
||||
RefreshMesh();
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool baked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _baked;
|
||||
}
|
||||
}
|
||||
|
||||
public bool markDynamic
|
||||
{
|
||||
get { return _markDynamic; }
|
||||
set
|
||||
{
|
||||
if (value != _markDynamic)
|
||||
{
|
||||
_markDynamic = value;
|
||||
RefreshMesh();
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum UVMode { Clip, UniformClip, Clamp, UniformClamp }
|
||||
public enum NormalMethod { Recalculate, SplineNormals }
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _baked = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _markDynamic = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _size = 1f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Color _color = Color.white;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _offset = Vector3.zero;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private NormalMethod _normalMethod = NormalMethod.SplineNormals;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _calculateTangents = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _useSplineSize = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _useSplineColor = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
[Range(-360f, 360f)]
|
||||
private float _rotation = 0f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _flipFaces = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _doubleSided = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private UVMode _uvMode = UVMode.Clip;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector2 _uvScale = Vector2.one;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector2 _uvOffset = Vector2.zero;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _uvRotation = 0f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private UnityEngine.Rendering.IndexFormat _meshIndexFormat = UnityEngine.Rendering.IndexFormat.UInt16;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Mesh _bakedMesh;
|
||||
|
||||
[HideInInspector]
|
||||
public float colliderUpdateRate = 0.2f;
|
||||
protected bool _updateCollider = false;
|
||||
protected float _lastUpdateTime = 0f;
|
||||
|
||||
protected float _vDist = 0f;
|
||||
protected static Vector2 __uvs = Vector2.zero;
|
||||
|
||||
protected virtual string meshName => "Mesh";
|
||||
protected TS_Mesh _tsMesh { get; private set; }
|
||||
protected Mesh _mesh;
|
||||
|
||||
protected MeshFilter filter;
|
||||
protected MeshRenderer meshRenderer;
|
||||
protected MeshCollider meshCollider;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
public void Bake(bool makeStatic, bool lightmapUV)
|
||||
{
|
||||
if (_mesh == null) return;
|
||||
gameObject.isStatic = false;
|
||||
UnityEditor.MeshUtility.Optimize(_mesh);
|
||||
if (spline != null)
|
||||
{
|
||||
spline.Unsubscribe(this);
|
||||
}
|
||||
filter = GetComponent<MeshFilter>();
|
||||
meshRenderer = GetComponent<MeshRenderer>();
|
||||
filter.hideFlags = meshRenderer.hideFlags = HideFlags.None;
|
||||
_bakedMesh = Instantiate(_mesh);
|
||||
_bakedMesh.name = meshName + " - Baked";
|
||||
if (lightmapUV)
|
||||
{
|
||||
Unwrapping.GenerateSecondaryUVSet(_bakedMesh);
|
||||
}
|
||||
filter.sharedMesh = _bakedMesh;
|
||||
_mesh = null;
|
||||
gameObject.isStatic = makeStatic;
|
||||
_baked = true;
|
||||
}
|
||||
|
||||
public void Unbake()
|
||||
{
|
||||
gameObject.isStatic = false;
|
||||
_baked = false;
|
||||
DestroyImmediate(_bakedMesh);
|
||||
_bakedMesh = null;
|
||||
CreateMesh();
|
||||
spline.Subscribe(this);
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
public override void EditorAwake()
|
||||
{
|
||||
GetComponents();
|
||||
base.EditorAwake();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
GetComponents();
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
GetComponents();
|
||||
#if UNITY_EDITOR
|
||||
bool materialFound = false;
|
||||
for (int i = 0; i < meshRenderer.sharedMaterials.Length; i++)
|
||||
{
|
||||
if (meshRenderer.sharedMaterials[i] != null)
|
||||
{
|
||||
materialFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!materialFound) meshRenderer.sharedMaterial = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat");
|
||||
#endif
|
||||
}
|
||||
|
||||
private void GetComponents()
|
||||
{
|
||||
filter = GetComponent<MeshFilter>();
|
||||
meshRenderer = GetComponent<MeshRenderer>();
|
||||
meshCollider = GetComponent<MeshCollider>();
|
||||
}
|
||||
|
||||
public override void Rebuild()
|
||||
{
|
||||
if (_baked) return;
|
||||
base.Rebuild();
|
||||
}
|
||||
|
||||
public override void RebuildImmediate()
|
||||
{
|
||||
if (_baked) return;
|
||||
base.RebuildImmediate();
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
MeshFilter filter = GetComponent<MeshFilter>();
|
||||
MeshRenderer rend = GetComponent<MeshRenderer>();
|
||||
if (filter != null) filter.hideFlags = HideFlags.None;
|
||||
if (rend != null) rend.hideFlags = HideFlags.None;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateCollider()
|
||||
{
|
||||
meshCollider = GetComponent<MeshCollider>();
|
||||
if (meshCollider == null) meshCollider = gameObject.AddComponent<MeshCollider>();
|
||||
meshCollider.sharedMesh = filter.sharedMesh;
|
||||
}
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
if (_baked) return;
|
||||
base.LateRun();
|
||||
if (_updateCollider)
|
||||
{
|
||||
if (meshCollider != null)
|
||||
{
|
||||
if (Time.time - _lastUpdateTime >= colliderUpdateRate)
|
||||
{
|
||||
_lastUpdateTime = Time.time;
|
||||
_updateCollider = false;
|
||||
meshCollider.sharedMesh = filter.sharedMesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
if (_tsMesh == null || _mesh == null)
|
||||
{
|
||||
CreateMesh();
|
||||
}
|
||||
|
||||
if (sampleCount > 1)
|
||||
{
|
||||
BuildMesh();
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearMesh();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PostBuild()
|
||||
{
|
||||
base.PostBuild();
|
||||
WriteMesh();
|
||||
}
|
||||
|
||||
protected virtual void ClearMesh()
|
||||
{
|
||||
_tsMesh.Clear();
|
||||
_mesh.Clear();
|
||||
}
|
||||
|
||||
protected virtual void BuildMesh()
|
||||
{
|
||||
//Logic for mesh generation, automatically called in the Build method
|
||||
}
|
||||
|
||||
protected virtual void WriteMesh()
|
||||
{
|
||||
MeshUtility.TransformMesh(_tsMesh, trs.worldToLocalMatrix);
|
||||
if (_doubleSided)
|
||||
{
|
||||
MeshUtility.MakeDoublesidedHalf(_tsMesh);
|
||||
}
|
||||
else if (_flipFaces)
|
||||
{
|
||||
MeshUtility.FlipFaces(_tsMesh);
|
||||
}
|
||||
|
||||
if (_calculateTangents)
|
||||
{
|
||||
MeshUtility.CalculateTangents(_tsMesh);
|
||||
}
|
||||
|
||||
if (_meshIndexFormat == UnityEngine.Rendering.IndexFormat.UInt16 && _tsMesh.vertexCount > UNITY_16_VERTEX_LIMIT)
|
||||
{
|
||||
Debug.LogError("WARNING: The generated mesh for " + name + " exceeds the maximum vertex count for standard meshes in Unity (" + UNITY_16_VERTEX_LIMIT + "). To create bigger meshes, set the Index Format inside the Vertices foldout to 32.");
|
||||
}
|
||||
|
||||
_tsMesh.indexFormat = _meshIndexFormat;
|
||||
|
||||
_tsMesh.WriteMesh(ref _mesh);
|
||||
|
||||
if (_markDynamic)
|
||||
{
|
||||
_mesh.MarkDynamic();
|
||||
}
|
||||
|
||||
if (_normalMethod == 0)
|
||||
{
|
||||
_mesh.RecalculateNormals();
|
||||
}
|
||||
|
||||
if (filter != null)
|
||||
{
|
||||
filter.sharedMesh = _mesh;
|
||||
}
|
||||
_updateCollider = true;
|
||||
}
|
||||
|
||||
protected virtual void AllocateMesh(int vertexCount, int trisCount)
|
||||
{
|
||||
if (trisCount < 0)
|
||||
{
|
||||
trisCount = 0;
|
||||
}
|
||||
if (vertexCount < 0)
|
||||
{
|
||||
vertexCount = 0;
|
||||
}
|
||||
if (_doubleSided)
|
||||
{
|
||||
vertexCount *= 2;
|
||||
trisCount *= 2;
|
||||
}
|
||||
if (_tsMesh.vertexCount != vertexCount)
|
||||
{
|
||||
_tsMesh.vertices = new Vector3[vertexCount];
|
||||
_tsMesh.normals = new Vector3[vertexCount];
|
||||
_tsMesh.tangents = new Vector4[vertexCount];
|
||||
_tsMesh.colors = new Color[vertexCount];
|
||||
_tsMesh.uv = new Vector2[vertexCount];
|
||||
}
|
||||
if (_tsMesh.triangles.Length != trisCount)
|
||||
{
|
||||
_tsMesh.triangles = new int[trisCount];
|
||||
}
|
||||
}
|
||||
|
||||
protected void ResetUVDistance()
|
||||
{
|
||||
_vDist = 0f;
|
||||
if (uvMode == UVMode.UniformClip)
|
||||
{
|
||||
_vDist = spline.CalculateLength(0.0, GetSamplePercent(0));
|
||||
}
|
||||
}
|
||||
|
||||
protected void AddUVDistance(int sampleIndex)
|
||||
{
|
||||
if (sampleIndex == 0) return;
|
||||
SplineSample current = new SplineSample();
|
||||
SplineSample last = new SplineSample();
|
||||
GetSampleRaw(sampleIndex, ref current);
|
||||
GetSampleRaw(sampleIndex - 1, ref last);
|
||||
_vDist += Vector3.Distance(current.position, last.position);
|
||||
}
|
||||
|
||||
protected void CalculateUVs(double percent, float u)
|
||||
{
|
||||
__uvs.x = u * _uvScale.x - _uvOffset.x;
|
||||
switch (uvMode)
|
||||
{
|
||||
case UVMode.Clip: __uvs.y = CalculateUVClip(percent); break;
|
||||
case UVMode.Clamp: __uvs.y = CalculateUVClamp(percent); break;
|
||||
case UVMode.UniformClamp: __uvs.y = CalculateUVUniformClamp(_vDist); break;
|
||||
default: __uvs.y = CalculateUVUniformClip(_vDist); break;
|
||||
}
|
||||
}
|
||||
|
||||
protected float CalculateUVUniformClamp(float distance)
|
||||
{
|
||||
return distance * _uvScale.y / (float)span - _uvOffset.y;
|
||||
}
|
||||
|
||||
protected float CalculateUVUniformClip(float distance)
|
||||
{
|
||||
return distance * _uvScale.y - _uvOffset.y;
|
||||
}
|
||||
|
||||
protected float CalculateUVClip(double percent)
|
||||
{
|
||||
return (float)percent * _uvScale.y - _uvOffset.y;
|
||||
}
|
||||
|
||||
protected float CalculateUVClamp(double percent)
|
||||
{
|
||||
return (float)DMath.InverseLerp(clipFrom, clipTo, percent) * _uvScale.y - _uvOffset.y;
|
||||
}
|
||||
|
||||
protected float GetBaseSize(SplineSample sample)
|
||||
{
|
||||
return _useSplineSize ? sample.size : 1f;
|
||||
}
|
||||
|
||||
protected Color GetBaseColor(SplineSample sample)
|
||||
{
|
||||
return _useSplineColor ? sample.color : Color.white;
|
||||
}
|
||||
|
||||
protected virtual void CreateMesh()
|
||||
{
|
||||
_tsMesh = new TS_Mesh();
|
||||
_mesh = new Mesh();
|
||||
_mesh.name = meshName;
|
||||
_mesh.indexFormat = _meshIndexFormat;
|
||||
_tsMesh.indexFormat = _meshIndexFormat;
|
||||
if (_markDynamic)
|
||||
{
|
||||
_mesh.MarkDynamic();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshMesh()
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
DestroyImmediate(_mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(_mesh);
|
||||
}
|
||||
_mesh = null;
|
||||
_tsMesh.Clear();
|
||||
_tsMesh = null;
|
||||
CreateMesh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/MeshGenerator.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49c9228d9868e1747b4763bc4cb1d86f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -10
|
||||
icon: {fileID: 2800000, guid: 9bbaac8eb7021d44b9864113856c00fa, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
412
Assets/Dreamteck/Splines/Components/Node.cs
Normal file
@@ -0,0 +1,412 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Dreamteck/Splines/Node Connector")]
|
||||
public class Node : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public class Connection
|
||||
{
|
||||
public SplineComputer spline
|
||||
{
|
||||
get { return _computer; }
|
||||
}
|
||||
|
||||
public int pointIndex
|
||||
{
|
||||
get { return _pointIndex; }
|
||||
}
|
||||
|
||||
public bool invertTangents = false;
|
||||
|
||||
[SerializeField]
|
||||
private int _pointIndex = 0;
|
||||
[SerializeField]
|
||||
private SplineComputer _computer = null;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
internal SplinePoint point;
|
||||
|
||||
internal bool isValid
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_computer == null) return false;
|
||||
if (_pointIndex >= _computer.pointCount) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
internal Connection(SplineComputer comp, int index, SplinePoint inputPoint)
|
||||
{
|
||||
_pointIndex = index;
|
||||
_computer = comp;
|
||||
point = inputPoint;
|
||||
}
|
||||
}
|
||||
public enum Type { Smooth, Free }
|
||||
[HideInInspector]
|
||||
public Type type = Type.Smooth;
|
||||
|
||||
public bool transformNormals
|
||||
{
|
||||
get { return _transformNormals; }
|
||||
set
|
||||
{
|
||||
if (value != _transformNormals)
|
||||
{
|
||||
_transformNormals = value;
|
||||
UpdatePoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool transformSize
|
||||
{
|
||||
get { return _transformSize; }
|
||||
set
|
||||
{
|
||||
if (value != _transformSize)
|
||||
{
|
||||
_transformSize = value;
|
||||
UpdatePoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool transformTangents
|
||||
{
|
||||
get { return _transformTangents; }
|
||||
set
|
||||
{
|
||||
if (value != _transformTangents)
|
||||
{
|
||||
_transformTangents = value;
|
||||
UpdatePoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
protected Connection[] connections = new Connection[0];
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _transformSize = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _transformNormals = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _transformTangents = true;
|
||||
|
||||
private Vector3 _lastPosition, _lastScale;
|
||||
private Quaternion _lastRotation;
|
||||
private Transform _trs;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_trs = transform;
|
||||
SampleTransform();
|
||||
}
|
||||
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
bool TransformChanged()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if(_trs == null) return _lastPosition != transform.position || _lastRotation != transform.rotation || _lastScale != transform.lossyScale;
|
||||
#endif
|
||||
return _lastPosition != _trs.position || _lastRotation != _trs.rotation || _lastScale != _trs.lossyScale;
|
||||
}
|
||||
|
||||
void SampleTransform() {
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
_lastPosition = transform.position;
|
||||
_lastScale = transform.lossyScale;
|
||||
_lastRotation = transform.rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastPosition = _trs.position;
|
||||
_lastScale = _trs.lossyScale;
|
||||
_lastRotation = _trs.rotation;
|
||||
}
|
||||
return;
|
||||
#else
|
||||
_lastPosition = _trs.position;
|
||||
_lastScale = _trs.lossyScale;
|
||||
_lastRotation = _trs.rotation;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Run()
|
||||
{
|
||||
if (TransformChanged())
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
for (int i = 0; i < connections.Length; i++)
|
||||
{
|
||||
UnityEditor.EditorUtility.SetDirty(connections[i].spline);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
UpdateConnectedComputers();
|
||||
SampleTransform();
|
||||
}
|
||||
}
|
||||
|
||||
public SplinePoint GetPoint(int connectionIndex, bool swapTangents)
|
||||
{
|
||||
SplinePoint point = PointToWorld(connections[connectionIndex].point);
|
||||
if (connections[connectionIndex].invertTangents && swapTangents)
|
||||
{
|
||||
Vector3 tempTan = point.tangent;
|
||||
point.tangent = point.tangent2;
|
||||
point.tangent2 = tempTan;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
public void SetPoint(int connectionIndex, SplinePoint worldPoint, bool swappedTangents)
|
||||
{
|
||||
Connection connection = connections[connectionIndex];
|
||||
connection.point = PointToLocal(worldPoint);
|
||||
if (connection.invertTangents && swappedTangents)
|
||||
{
|
||||
Vector3 tempTan = connection.point.tangent;
|
||||
connection.point.tangent = connection.point.tangent2;
|
||||
connection.point.tangent2 = tempTan;
|
||||
}
|
||||
if (type == Type.Smooth)
|
||||
{
|
||||
if (connection.point.type == SplinePoint.Type.SmoothFree)
|
||||
{
|
||||
for (int i = 0; i < connections.Length; i++)
|
||||
{
|
||||
if (i == connectionIndex) continue;
|
||||
Vector3 tanDir = (connection.point.tangent - connection.point.position).normalized;
|
||||
if (tanDir == Vector3.zero) tanDir = -(connection.point.tangent2 - connection.point.position).normalized;
|
||||
float tan1Length = (connections[i].point.tangent - connections[i].point.position).magnitude;
|
||||
float tan2Length = (connections[i].point.tangent2 - connections[i].point.position).magnitude;
|
||||
connections[i].point = connection.point;
|
||||
connections[i].point.tangent = connections[i].point.position + tanDir * tan1Length;
|
||||
connections[i].point.tangent2 = connections[i].point.position - tanDir * tan2Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < connections.Length; i++)
|
||||
{
|
||||
if (i == connectionIndex) continue;
|
||||
connections[i].point = connection.point;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
ClearConnections();
|
||||
}
|
||||
|
||||
public void ClearConnections()
|
||||
{
|
||||
for (int i = connections.Length-1; i >= 0; i--)
|
||||
{
|
||||
if (connections[i].spline != null) connections[i].spline.DisconnectNode(connections[i].pointIndex);
|
||||
}
|
||||
connections = new Connection[0];
|
||||
}
|
||||
|
||||
public void UpdateConnectedComputers(SplineComputer excludeComputer = null)
|
||||
{
|
||||
for (int i = connections.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (!connections[i].isValid)
|
||||
{
|
||||
RemoveConnection(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (connections[i].spline == excludeComputer) continue;
|
||||
|
||||
if (type == Type.Smooth && i != 0)
|
||||
{
|
||||
SetPoint(i, GetPoint(0, false), false);
|
||||
}
|
||||
SplinePoint point = GetPoint(i, true);
|
||||
if (!transformNormals)
|
||||
{
|
||||
point.normal = connections[i].spline.GetPointNormal(connections[i].pointIndex);
|
||||
}
|
||||
if (!transformTangents)
|
||||
{
|
||||
point.tangent = connections[i].spline.GetPointTangent(connections[i].pointIndex);
|
||||
point.tangent2 = connections[i].spline.GetPointTangent2(connections[i].pointIndex);
|
||||
}
|
||||
if (!transformSize)
|
||||
{
|
||||
point.size = connections[i].spline.GetPointSize(connections[i].pointIndex);
|
||||
}
|
||||
connections[i].spline.SetPoint(connections[i].pointIndex, point);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePoint(SplineComputer computer, int pointIndex, SplinePoint point, bool updatePosition = true)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
transform.position = point.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
_trs.position = point.position;
|
||||
}
|
||||
#else
|
||||
_trs.position = point.position;
|
||||
#endif
|
||||
for (int i = 0; i < connections.Length; i++)
|
||||
{
|
||||
if (connections[i].spline == computer && connections[i].pointIndex == pointIndex)
|
||||
{
|
||||
SetPoint(i, point, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePoints()
|
||||
{
|
||||
for (int i = connections.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (!connections[i].isValid)
|
||||
{
|
||||
RemoveConnection(i);
|
||||
continue;
|
||||
}
|
||||
SplinePoint point = connections[i].spline.GetPoint(connections[i].pointIndex);
|
||||
point.SetPosition(transform.position);
|
||||
SetPoint(i, point, true);
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
//Use this to maintain the connections between computers in the editor
|
||||
public void EditorMaintainConnections()
|
||||
{
|
||||
RemoveInvalidConnections();
|
||||
}
|
||||
#endif
|
||||
//Remove invalid connections
|
||||
protected void RemoveInvalidConnections()
|
||||
{
|
||||
for (int i = connections.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (connections[i] == null || !connections[i].isValid) RemoveConnection(i);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void AddConnection(SplineComputer computer, int pointIndex)
|
||||
{
|
||||
RemoveInvalidConnections();
|
||||
Node connected = computer.GetNode(pointIndex);
|
||||
if (connected != null)
|
||||
{
|
||||
Debug.LogError(computer.name + " is already connected to node " + connected.name + " at point " + pointIndex);
|
||||
return;
|
||||
}
|
||||
SplinePoint point = computer.GetPoint(pointIndex);
|
||||
point.SetPosition(transform.position);
|
||||
ArrayUtility.Add(ref connections, new Connection(computer, pointIndex, PointToLocal(point)));
|
||||
if(connections.Length == 1) SetPoint(connections.Length - 1, point, true);
|
||||
UpdateConnectedComputers();
|
||||
}
|
||||
|
||||
protected SplinePoint PointToLocal(SplinePoint worldPoint)
|
||||
{
|
||||
worldPoint.position = Vector3.zero;
|
||||
worldPoint.tangent = transform.InverseTransformPoint(worldPoint.tangent);
|
||||
worldPoint.tangent2 = transform.InverseTransformPoint(worldPoint.tangent2);
|
||||
worldPoint.normal = transform.InverseTransformDirection(worldPoint.normal);
|
||||
worldPoint.size /= (transform.localScale.x + transform.localScale.y + transform.localScale.z)/ 3f;
|
||||
return worldPoint;
|
||||
}
|
||||
|
||||
protected SplinePoint PointToWorld(SplinePoint localPoint)
|
||||
{
|
||||
localPoint.position = transform.position;
|
||||
localPoint.tangent = transform.TransformPoint(localPoint.tangent);
|
||||
localPoint.tangent2 = transform.TransformPoint(localPoint.tangent2);
|
||||
localPoint.normal = transform.TransformDirection(localPoint.normal);
|
||||
localPoint.size *= (transform.localScale.x + transform.localScale.y + transform.localScale.z) / 3f;
|
||||
return localPoint;
|
||||
}
|
||||
|
||||
public virtual void RemoveConnection(SplineComputer computer, int pointIndex)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < connections.Length; i++)
|
||||
{
|
||||
if (connections[i].pointIndex == pointIndex && connections[i].spline == computer)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index < 0) return;
|
||||
RemoveConnection(index);
|
||||
}
|
||||
|
||||
private void RemoveConnection(int index)
|
||||
{
|
||||
Connection[] newConnections = new Connection[connections.Length - 1];
|
||||
SplineComputer spline = connections[index].spline;
|
||||
int pointIndex = connections[index].pointIndex;
|
||||
for (int i = 0; i < connections.Length; i++)
|
||||
{
|
||||
if (i < index) newConnections[i] = connections[i];
|
||||
else if (i == index) continue;
|
||||
else newConnections[i - 1] = connections[i];
|
||||
}
|
||||
connections = newConnections;
|
||||
}
|
||||
|
||||
public virtual bool HasConnection(SplineComputer computer, int pointIndex)
|
||||
{
|
||||
for (int i = connections.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (!connections[i].isValid)
|
||||
{
|
||||
RemoveConnection(i);
|
||||
continue;
|
||||
}
|
||||
if (connections[i].spline == computer && connections[i].pointIndex == pointIndex) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Connection[] GetConnections()
|
||||
{
|
||||
return connections;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/Node.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a212c074803b6824cae48ffa7abb84cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -40
|
||||
icon: {fileID: 2800000, guid: 09a5be8542799294ab31f6b97c88471b, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
812
Assets/Dreamteck/Splines/Components/ObjectBender.cs
Normal file
@@ -0,0 +1,812 @@
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Object Bender")]
|
||||
public class ObjectBender : SplineUser
|
||||
{
|
||||
public enum Axis { X, Y, Z }
|
||||
public enum NormalMode { Spline, Auto, Custom }
|
||||
public enum ForwardMode { Spline, Custom }
|
||||
public bool bend
|
||||
{
|
||||
get { return _bend; }
|
||||
set
|
||||
{
|
||||
if(_bend != value)
|
||||
{
|
||||
_bend = value;
|
||||
if (value)
|
||||
{
|
||||
UpdateReferences();
|
||||
Rebuild();
|
||||
} else Revert();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _bend = false;
|
||||
public Axis axis
|
||||
{
|
||||
get { return _axis; }
|
||||
set
|
||||
{
|
||||
if (spline != null && value != _axis)
|
||||
{
|
||||
_axis = value;
|
||||
UpdateReferences();
|
||||
Rebuild();
|
||||
}
|
||||
else _axis = value;
|
||||
}
|
||||
}
|
||||
|
||||
public NormalMode upMode
|
||||
{
|
||||
get { return _normalMode; }
|
||||
set
|
||||
{
|
||||
if (spline != null && value != _normalMode)
|
||||
{
|
||||
_normalMode = value;
|
||||
Rebuild();
|
||||
} else _normalMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 customNormal
|
||||
{
|
||||
get { return _customNormal; }
|
||||
set
|
||||
{
|
||||
if (spline != null && value != _customNormal)
|
||||
{
|
||||
_customNormal = value;
|
||||
Rebuild();
|
||||
}
|
||||
else _customNormal = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ForwardMode forwardMode
|
||||
{
|
||||
get { return _forwardMode; }
|
||||
set
|
||||
{
|
||||
if (spline != null && value != _forwardMode)
|
||||
{
|
||||
_forwardMode = value;
|
||||
Rebuild();
|
||||
} else _forwardMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 customForward
|
||||
{
|
||||
get { return _customForward; }
|
||||
set
|
||||
{
|
||||
if (spline != null && value != _customForward)
|
||||
{
|
||||
_customForward = value;
|
||||
Rebuild();
|
||||
}
|
||||
else _customForward = value;
|
||||
}
|
||||
}
|
||||
[HideInInspector]
|
||||
public BendProperty[] bendProperties = new BendProperty[0];
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _parentIsTheSpline = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private TS_Bounds bounds = null;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Axis _axis = Axis.Z;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private NormalMode _normalMode = NormalMode.Auto;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ForwardMode _forwardMode = ForwardMode.Spline;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
[UnityEngine.Serialization.FormerlySerializedAs("_upVector")]
|
||||
private Vector3 _customNormal = Vector3.up;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _customForward = Vector3.forward;
|
||||
Matrix4x4 normalMatrix = new Matrix4x4();
|
||||
Quaternion bendRotation = Quaternion.identity;
|
||||
|
||||
private void GetTransformsRecursively(Transform current, ref List<Transform> transformList)
|
||||
{
|
||||
transformList.Add(current);
|
||||
foreach (Transform child in current)
|
||||
{
|
||||
GetTransformsRecursively(child, ref transformList);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetObjects()
|
||||
{
|
||||
List<Transform> found = new List<Transform>();
|
||||
GetTransformsRecursively(transform, ref found);
|
||||
BendProperty[] newProperties = new BendProperty[found.Count];
|
||||
for (int i = 0; i < found.Count; i++)
|
||||
{
|
||||
CreateProperty(ref newProperties[i], found[i]);
|
||||
}
|
||||
bendProperties = newProperties;
|
||||
SplineComputer splineComponent = GetComponent<SplineComputer>();
|
||||
_parentIsTheSpline = splineComponent == spline;
|
||||
}
|
||||
|
||||
public TS_Bounds GetBounds()
|
||||
{
|
||||
return new TS_Bounds(bounds.min, bounds.max, bounds.center);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public void EditorGenerateLightmapUVs()
|
||||
{
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
if (bendProperties[i].bendMesh)
|
||||
{
|
||||
if (bendProperties[i].filter == null) continue;
|
||||
if (bendProperties[i].filter.sharedMesh == null) continue;
|
||||
EditorUtility.DisplayProgressBar("Generating Lightmap UVS", bendProperties[i].filter.sharedMesh.name, (float)i / (bendProperties.Length - 1));
|
||||
Unwrapping.GenerateSecondaryUVSet(bendProperties[i].filter.sharedMesh);
|
||||
}
|
||||
}
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void CreateProperty(ref BendProperty property, Transform t)
|
||||
{
|
||||
property = new BendProperty(t, t == transform); //Create a new bend property for each child
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
//Search for properties that have the same trasform and copy their settings
|
||||
if (bendProperties[i].transform.transform == t)
|
||||
{
|
||||
property.enabled = bendProperties[i].enabled;
|
||||
property.applyRotation = bendProperties[i].applyRotation;
|
||||
property.applyScale = bendProperties[i].applyScale;
|
||||
property.bendMesh = bendProperties[i].bendMesh;
|
||||
property.bendCollider = bendProperties[i].bendCollider;
|
||||
property.generateLightmapUVs = bendProperties[i].generateLightmapUVs;
|
||||
property.colliderUpdateRate = bendProperties[i].colliderUpdateRate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (t.transform != trs)
|
||||
{
|
||||
property.originalPosition = trs.InverseTransformPoint(t.position);
|
||||
property.originalRotation = Quaternion.Inverse(trs.rotation) * t.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateBounds()
|
||||
{
|
||||
if (bounds == null) bounds = new TS_Bounds(Vector3.zero, Vector3.zero);
|
||||
bounds.min = bounds.max = Vector3.zero;
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
CalculatePropertyBounds(ref bendProperties[i]);
|
||||
}
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
CalculatePercents(bendProperties[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculatePropertyBounds(ref BendProperty property)
|
||||
{
|
||||
if (!property.enabled) return;
|
||||
if (property.isParent && _parentIsTheSpline) return;
|
||||
if (property.transform.transform == trs)
|
||||
{
|
||||
if (0f < bounds.min.x) bounds.min.x = 0f;
|
||||
if (0f < bounds.min.y) bounds.min.y = 0f;
|
||||
if (0f < bounds.min.z) bounds.min.z = 0f;
|
||||
if (0f > bounds.max.x) bounds.max.x = 0f;
|
||||
if (0f > bounds.max.y) bounds.max.y = 0f;
|
||||
if (0f > bounds.max.z) bounds.max.z = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (property.originalPosition.x < bounds.min.x) bounds.min.x = property.originalPosition.x;
|
||||
if (property.originalPosition.y < bounds.min.y) bounds.min.y = property.originalPosition.y;
|
||||
if (property.originalPosition.z < bounds.min.z) bounds.min.z = property.originalPosition.z;
|
||||
if (property.originalPosition.x > bounds.max.x) bounds.max.x = property.originalPosition.x;
|
||||
if (property.originalPosition.y > bounds.max.y) bounds.max.y = property.originalPosition.y;
|
||||
if (property.originalPosition.z > bounds.max.z) bounds.max.z = property.originalPosition.z;
|
||||
}
|
||||
if (property.editMesh != null)
|
||||
{
|
||||
for (int n = 0; n < property.editMesh.vertices.Length; n++)
|
||||
{
|
||||
Vector3 localPos = property.transform.TransformPoint(property.editMesh.vertices[n]);
|
||||
localPos = trs.InverseTransformPoint(localPos);
|
||||
if (localPos.x < bounds.min.x) bounds.min.x = localPos.x;
|
||||
if (localPos.y < bounds.min.y) bounds.min.y = localPos.y;
|
||||
if (localPos.z < bounds.min.z) bounds.min.z = localPos.z;
|
||||
if (localPos.x > bounds.max.x) bounds.max.x = localPos.x;
|
||||
if (localPos.y > bounds.max.y) bounds.max.y = localPos.y;
|
||||
if (localPos.z > bounds.max.z) bounds.max.z = localPos.z;
|
||||
}
|
||||
}
|
||||
|
||||
if (property.editColliderMesh != null)
|
||||
{
|
||||
for (int n = 0; n < property.editColliderMesh.vertices.Length; n++)
|
||||
{
|
||||
Vector3 localPos = property.transform.TransformPoint(property.editColliderMesh.vertices[n]);
|
||||
localPos = trs.InverseTransformPoint(localPos);
|
||||
if (localPos.x < bounds.min.x) bounds.min.x = localPos.x;
|
||||
if (localPos.y < bounds.min.y) bounds.min.y = localPos.y;
|
||||
if (localPos.z < bounds.min.z) bounds.min.z = localPos.z;
|
||||
if (localPos.x > bounds.max.x) bounds.max.x = localPos.x;
|
||||
if (localPos.y > bounds.max.y) bounds.max.y = localPos.y;
|
||||
if (localPos.z > bounds.max.z) bounds.max.z = localPos.z;
|
||||
}
|
||||
}
|
||||
|
||||
if (property.originalSpline != null)
|
||||
{
|
||||
for (int n = 0; n < property.originalSpline.points.Length; n++)
|
||||
{
|
||||
Vector3 localPos = trs.InverseTransformPoint(property.originalSpline.points[n].position);
|
||||
if (localPos.x < bounds.min.x) bounds.min.x = localPos.x;
|
||||
if (localPos.y < bounds.min.y) bounds.min.y = localPos.y;
|
||||
if (localPos.z < bounds.min.z) bounds.min.z = localPos.z;
|
||||
if (localPos.x > bounds.max.x) bounds.max.x = localPos.x;
|
||||
if (localPos.y > bounds.max.y) bounds.max.y = localPos.y;
|
||||
if (localPos.z > bounds.max.z) bounds.max.z = localPos.z;
|
||||
}
|
||||
}
|
||||
bounds.CreateFromMinMax(bounds.min, bounds.max);
|
||||
}
|
||||
|
||||
public void CalculatePercents(BendProperty property)
|
||||
{
|
||||
if (property.transform.transform != trs) property.positionPercent = GetPercentage(trs.InverseTransformPoint(property.transform.position));
|
||||
else property.positionPercent = GetPercentage(Vector3.zero);
|
||||
if (property.editMesh != null)
|
||||
{
|
||||
if (property.vertexPercents.Length != property.editMesh.vertexCount) property.vertexPercents = new Vector3[property.editMesh.vertexCount];
|
||||
if (property.editColliderMesh != null)
|
||||
{
|
||||
if (property.colliderVertexPercents.Length != property.editMesh.vertexCount) property.colliderVertexPercents = new Vector3[property.editColliderMesh.vertexCount];
|
||||
}
|
||||
for (int i = 0; i < property.editMesh.vertexCount; i++)
|
||||
{
|
||||
Vector3 localVertex = property.transform.TransformPoint(property.editMesh.vertices[i]);
|
||||
localVertex = trs.InverseTransformPoint(localVertex);
|
||||
property.vertexPercents[i] = GetPercentage(localVertex);
|
||||
}
|
||||
if (property.editColliderMesh != null)
|
||||
{
|
||||
for (int i = 0; i < property.editColliderMesh.vertexCount; i++)
|
||||
{
|
||||
Vector3 localVertex = property.transform.TransformPoint(property.editColliderMesh.vertices[i]);
|
||||
localVertex = trs.InverseTransformPoint(localVertex);
|
||||
property.colliderVertexPercents[i] = GetPercentage(localVertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (property.splineComputer != null)
|
||||
{
|
||||
SplinePoint[] points = property.splineComputer.GetPoints();
|
||||
property.splinePointPercents = new Vector3[points.Length];
|
||||
property.primaryTangentPercents = new Vector3[points.Length];
|
||||
property.secondaryTangentPercents = new Vector3[points.Length];
|
||||
for (int i = 0; i < points.Length; i++)
|
||||
{
|
||||
property.splinePointPercents[i] = GetPercentage(trs.InverseTransformPoint(points[i].position));
|
||||
property.primaryTangentPercents[i] = GetPercentage(trs.InverseTransformPoint(points[i].tangent));
|
||||
property.secondaryTangentPercents[i] = GetPercentage(trs.InverseTransformPoint(points[i].tangent2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Revert()
|
||||
{
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
bendProperties[i].Revert();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UpdateReferences()
|
||||
{
|
||||
if (!hasTransform)
|
||||
{
|
||||
CacheTransform();
|
||||
}
|
||||
if (_bend)
|
||||
{
|
||||
for (int i = 0; i < bendProperties.Length; i++) bendProperties[i].Revert();
|
||||
}
|
||||
GetObjects();
|
||||
CalculateBounds();
|
||||
if (_bend)
|
||||
{
|
||||
Bend();
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
bendProperties[i].Apply(i > 0 || trs != spline.transform);
|
||||
bendProperties[i].Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetevalResult(Vector3 percentage)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case Axis.X: Evaluate(percentage.x, ref evalResult); break;
|
||||
case Axis.Y: Evaluate(percentage.y, ref evalResult); break;
|
||||
case Axis.Z: Evaluate(percentage.z, ref evalResult); break;
|
||||
}
|
||||
switch (_normalMode)
|
||||
{
|
||||
case NormalMode.Auto: evalResult.up = Vector3.Cross(evalResult.forward, evalResult.right); break;
|
||||
case NormalMode.Custom: evalResult.up = _customNormal; break;
|
||||
}
|
||||
if (_forwardMode == ForwardMode.Custom) evalResult.forward = customForward;
|
||||
Vector3 right = evalResult.right;
|
||||
|
||||
Quaternion axisRotation = Quaternion.identity;
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case Axis.Z:
|
||||
evalResult.position += right * Mathf.Lerp(bounds.min.x, bounds.max.x, percentage.x) * evalResult.size;
|
||||
evalResult.position += evalResult.up * Mathf.Lerp(bounds.min.y, bounds.max.y, percentage.y) * evalResult.size;
|
||||
break;
|
||||
case Axis.X:
|
||||
axisRotation = Quaternion.Euler(0f, -90f, 0f);
|
||||
evalResult.position += right * Mathf.Lerp(bounds.max.z, bounds.min.z, percentage.z) * evalResult.size;
|
||||
evalResult.position += evalResult.up * Mathf.Lerp(bounds.min.y, bounds.max.y, percentage.y) * evalResult.size;
|
||||
break;
|
||||
case Axis.Y:
|
||||
axisRotation = Quaternion.Euler(90f, 0f, 0f);
|
||||
evalResult.position += right * Mathf.Lerp(bounds.min.x, bounds.max.x, percentage.x) * evalResult.size;
|
||||
evalResult.position += evalResult.up * Mathf.Lerp(bounds.min.z, bounds.max.z, percentage.z) * evalResult.size;
|
||||
break;
|
||||
}
|
||||
|
||||
bendRotation = evalResult.rotation * axisRotation;
|
||||
normalMatrix = Matrix4x4.TRS(evalResult.position, bendRotation, Vector3.one * evalResult.size).inverse.transpose;
|
||||
}
|
||||
|
||||
private Vector3 GetPercentage(Vector3 point)
|
||||
{
|
||||
point.x = Mathf.InverseLerp(bounds.min.x, bounds.max.x, point.x);
|
||||
point.y = Mathf.InverseLerp(bounds.min.y, bounds.max.y, point.y);
|
||||
point.z = Mathf.InverseLerp(bounds.min.z, bounds.max.z, point.z);
|
||||
return point;
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
if (_bend) Bend();
|
||||
}
|
||||
|
||||
private void Bend()
|
||||
{
|
||||
if (sampleCount <= 1) return;
|
||||
if (bendProperties.Length == 0) return;
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
BendObject(bendProperties[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void BendObject(BendProperty p)
|
||||
{
|
||||
if (!p.enabled) return;
|
||||
if (p.isParent && _parentIsTheSpline) return;
|
||||
GetevalResult(p.positionPercent);
|
||||
p.transform.position = evalResult.position;
|
||||
if (p.applyRotation)
|
||||
{
|
||||
//p.transform.rotation = evalResult.rotation * axisRotation * p.originalRotation;
|
||||
p.transform.rotation = bendRotation * (Quaternion.Inverse(p.parentRotation) * p.originalRotation);
|
||||
} else p.transform.rotation = p.originalRotation;
|
||||
if (p.applyScale) p.transform.scale = p.originalScale * evalResult.size;
|
||||
|
||||
Matrix4x4 toLocalMatrix = Matrix4x4.TRS(p.transform.position, p.transform.rotation, p.transform.scale).inverse;
|
||||
if (p.editMesh != null)
|
||||
{
|
||||
BendMesh(p.vertexPercents, p.normals, p.editMesh, toLocalMatrix);
|
||||
p.editMesh.hasUpdate = true;
|
||||
}
|
||||
|
||||
if (p._editColliderMesh != null)
|
||||
{
|
||||
BendMesh(p.colliderVertexPercents, p.colliderNormals, p.editColliderMesh, toLocalMatrix);
|
||||
p.editColliderMesh.hasUpdate = true;
|
||||
}
|
||||
|
||||
if (p.originalSpline != null && !p.isParent)
|
||||
{
|
||||
for (int n = 0; n < p.splinePointPercents.Length; n++)
|
||||
{
|
||||
SplinePoint point = p.originalSpline.points[n];
|
||||
GetevalResult(p.splinePointPercents[n]);
|
||||
point.position = evalResult.position;
|
||||
GetevalResult(p.primaryTangentPercents[n]);
|
||||
point.tangent = evalResult.position;
|
||||
GetevalResult(p.secondaryTangentPercents[n]);
|
||||
point.tangent2 = evalResult.position;
|
||||
switch (axis)
|
||||
{
|
||||
case Axis.X: point.normal = Quaternion.LookRotation(evalResult.forward, evalResult.up) * Quaternion.FromToRotation(Vector3.up, evalResult.up) * point.normal; break;
|
||||
case Axis.Y: point.normal = Quaternion.LookRotation(evalResult.forward, evalResult.up) * Quaternion.FromToRotation(Vector3.up, evalResult.up) * point.normal; break;
|
||||
case Axis.Z: point.normal = Quaternion.LookRotation(evalResult.forward, evalResult.up) * point.normal; break;
|
||||
}
|
||||
p.destinationSpline.points[n] = point;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BendMesh(Vector3[] vertexPercents, Vector3[] originalNormals, TS_Mesh mesh, Matrix4x4 worldToLocalMatrix)
|
||||
{
|
||||
if(mesh.vertexCount != vertexPercents.Length)
|
||||
{
|
||||
Debug.LogError("Vertex count mismatch");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < mesh.vertexCount; i++)
|
||||
{
|
||||
Vector3 percent = vertexPercents[i];
|
||||
if (axis == Axis.Y) percent.z = 1f - percent.z;
|
||||
GetevalResult(percent);
|
||||
mesh.vertices[i] = worldToLocalMatrix.MultiplyPoint3x4(evalResult.position);
|
||||
mesh.normals[i] = worldToLocalMatrix.MultiplyVector(normalMatrix.MultiplyVector(originalNormals[i]));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PostBuild()
|
||||
{
|
||||
base.PostBuild();
|
||||
if (!_bend) return;
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
bendProperties[i].Apply(i > 0 || trs != spline.transform);
|
||||
bendProperties[i].Update();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
base.LateRun();
|
||||
for (int i = 0; i < bendProperties.Length; i++)
|
||||
{
|
||||
bendProperties[i].Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class BendProperty
|
||||
{
|
||||
public bool enabled = true;
|
||||
public bool isValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return transform != null && transform.transform != null;
|
||||
}
|
||||
}
|
||||
public TS_Transform transform;
|
||||
public bool applyRotation = true;
|
||||
public bool applyScale = true;
|
||||
public bool bendMesh
|
||||
{
|
||||
get { return _bendMesh; }
|
||||
set
|
||||
{
|
||||
if (value != _bendMesh)
|
||||
{
|
||||
_bendMesh = value;
|
||||
if (value)
|
||||
{
|
||||
if (filter != null && filter.sharedMesh != null)
|
||||
{
|
||||
normals = originalMesh.normals;
|
||||
for (int i = 0; i < normals.Length; i++) normals[i] = transform.transform.TransformDirection(normals[i]);
|
||||
}
|
||||
} else RevertMesh();
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool generateLightmapUVs = false;
|
||||
public bool bendCollider
|
||||
{
|
||||
get { return _bendCollider; }
|
||||
set
|
||||
{
|
||||
if (value != _bendCollider)
|
||||
{
|
||||
_bendCollider = value;
|
||||
if (value)
|
||||
{
|
||||
if (collider != null && collider.sharedMesh != null && collider.sharedMesh != originalMesh) colliderNormals = originalColliderMesh.normals;
|
||||
}
|
||||
else RevertCollider();
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool bendSpline
|
||||
{
|
||||
get { return _bendSpline; }
|
||||
set
|
||||
{
|
||||
_bendSpline = value;
|
||||
if (value)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _bendMesh = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _bendSpline = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _bendCollider = true;
|
||||
|
||||
private float colliderUpdateDue = 0f;
|
||||
public float colliderUpdateRate = 0.2f;
|
||||
private bool updateCollider = false;
|
||||
|
||||
public Vector3 originalPosition = Vector3.zero;
|
||||
public Vector3 originalScale = Vector3.one;
|
||||
public Quaternion originalRotation = Quaternion.identity;
|
||||
public Quaternion parentRotation = Quaternion.identity;
|
||||
public Vector3 positionPercent;
|
||||
|
||||
public Vector3[] vertexPercents = new Vector3[0];
|
||||
public Vector3[] normals = new Vector3[0];
|
||||
public Vector3[] colliderVertexPercents = new Vector3[0];
|
||||
public Vector3[] colliderNormals = new Vector3[0];
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Mesh originalMesh = null;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Mesh originalColliderMesh = null;
|
||||
private Spline _originalSpline;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Mesh destinationMesh = null;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Mesh destinationColliderMesh = null;
|
||||
public Spline destinationSpline;
|
||||
|
||||
public TS_Mesh editMesh
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!bendMesh || originalMesh == null) _editMesh = null;
|
||||
else if (_editMesh == null && originalMesh != null) _editMesh = new TS_Mesh(originalMesh);
|
||||
return _editMesh;
|
||||
}
|
||||
}
|
||||
public TS_Mesh editColliderMesh
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!bendCollider || originalColliderMesh == null) _editColliderMesh = null;
|
||||
else if (_editColliderMesh == null && originalColliderMesh != null && originalColliderMesh != originalMesh) _editColliderMesh = new TS_Mesh(originalColliderMesh);
|
||||
return _editColliderMesh;
|
||||
}
|
||||
}
|
||||
public Spline originalSpline
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!bendSpline || splineComputer == null) _originalSpline = null;
|
||||
else if (_originalSpline == null && splineComputer != null) {
|
||||
_originalSpline = new Spline(splineComputer.type);
|
||||
_originalSpline.points = splineComputer.GetPoints();
|
||||
}
|
||||
return _originalSpline;
|
||||
}
|
||||
}
|
||||
|
||||
public TS_Mesh _editMesh = null;
|
||||
public TS_Mesh _editColliderMesh = null;
|
||||
|
||||
public MeshFilter filter = null;
|
||||
public MeshCollider collider = null;
|
||||
public SplineComputer splineComputer = null;
|
||||
|
||||
public Vector3[] splinePointPercents = new Vector3[0];
|
||||
public Vector3[] primaryTangentPercents = new Vector3[0];
|
||||
public Vector3[] secondaryTangentPercents = new Vector3[0];
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool parent = false;
|
||||
|
||||
public bool isParent {
|
||||
get { return parent; }
|
||||
}
|
||||
|
||||
|
||||
public BendProperty(Transform t, bool parent = false)
|
||||
{
|
||||
this.parent = parent;
|
||||
transform = new TS_Transform(t);
|
||||
originalPosition = t.localPosition;
|
||||
originalScale = t.localScale;
|
||||
originalRotation = t.localRotation;
|
||||
parentRotation = t.transform.rotation;
|
||||
if (t.transform.parent != null) parentRotation = t.transform.parent.rotation;
|
||||
filter = t.GetComponent<MeshFilter>();
|
||||
collider = t.GetComponent<MeshCollider>();
|
||||
if (filter != null && filter.sharedMesh != null)
|
||||
{
|
||||
originalMesh = filter.sharedMesh;
|
||||
normals = originalMesh.normals;
|
||||
for (int i = 0; i < normals.Length; i++) normals[i] = transform.transform.TransformDirection(normals[i]).normalized;
|
||||
}
|
||||
|
||||
if (collider != null && collider.sharedMesh != null)
|
||||
{
|
||||
originalColliderMesh = collider.sharedMesh;
|
||||
colliderNormals = originalColliderMesh.normals;
|
||||
for (int i = 0; i < colliderNormals.Length; i++) colliderNormals[i] = transform.transform.TransformDirection(colliderNormals[i]);
|
||||
}
|
||||
if (!parent) splineComputer = t.GetComponent<SplineComputer>();
|
||||
if (splineComputer != null)
|
||||
{
|
||||
if (splineComputer.isClosed) originalSpline.Close();
|
||||
destinationSpline = new Spline(originalSpline.type);
|
||||
destinationSpline.points = new SplinePoint[originalSpline.points.Length];
|
||||
destinationSpline.points = splineComputer.GetPoints();
|
||||
if (splineComputer.isClosed) destinationSpline.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Revert()
|
||||
{
|
||||
if (!isValid) return;
|
||||
RevertTransform();
|
||||
RevertCollider();
|
||||
RevertMesh();
|
||||
if (splineComputer != null) splineComputer.SetPoints(_originalSpline.points);
|
||||
}
|
||||
|
||||
private void RevertMesh()
|
||||
{
|
||||
if (filter != null) filter.sharedMesh = originalMesh;
|
||||
destinationMesh = null;
|
||||
}
|
||||
|
||||
private void RevertTransform()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
transform.transform.localPosition = originalPosition;
|
||||
transform.transform.localRotation = originalRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localPosition = originalPosition;
|
||||
transform.localRotation = originalRotation;
|
||||
transform.Update();
|
||||
}
|
||||
#else
|
||||
transform.localPosition = originalPosition;
|
||||
transform.localRotation = originalRotation;
|
||||
transform.Update();
|
||||
#endif
|
||||
transform.scale = originalScale;
|
||||
transform.Update();
|
||||
}
|
||||
|
||||
private void RevertCollider()
|
||||
{
|
||||
if (collider != null) collider.sharedMesh = originalColliderMesh;
|
||||
destinationColliderMesh = null;
|
||||
}
|
||||
|
||||
public void Apply(bool applyTransform)
|
||||
{
|
||||
if (!enabled) return;
|
||||
if (!isValid) return;
|
||||
if(applyTransform) transform.Update();
|
||||
if (editMesh != null && editMesh.hasUpdate) ApplyMesh();
|
||||
if (bendCollider && collider != null)
|
||||
{
|
||||
if (!updateCollider)
|
||||
{
|
||||
if((editColliderMesh == null && editMesh != null) || editColliderMesh != null)
|
||||
{
|
||||
updateCollider = true;
|
||||
if(Application.isPlaying) colliderUpdateDue = Time.time + colliderUpdateRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (splineComputer != null) ApplySpline();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Time.time >= colliderUpdateDue && updateCollider)
|
||||
{
|
||||
updateCollider = false;
|
||||
ApplyCollider();
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyMesh()
|
||||
{
|
||||
if (filter == null) return;
|
||||
MeshUtility.CalculateTangents(editMesh);
|
||||
if (destinationMesh == null)
|
||||
{
|
||||
destinationMesh = new Mesh();
|
||||
destinationMesh.name = originalMesh.name;
|
||||
}
|
||||
|
||||
editMesh.WriteMesh(ref destinationMesh);
|
||||
destinationMesh.RecalculateBounds();
|
||||
filter.sharedMesh = destinationMesh;
|
||||
}
|
||||
|
||||
private void ApplyCollider()
|
||||
{
|
||||
if (collider == null) return;
|
||||
if (originalColliderMesh == originalMesh) collider.sharedMesh = filter.sharedMesh; //if the collider has the same mesh as the filter - just copy it
|
||||
else
|
||||
{
|
||||
MeshUtility.CalculateTangents(editColliderMesh);
|
||||
if (destinationColliderMesh == null)
|
||||
{
|
||||
destinationColliderMesh = new Mesh();
|
||||
destinationColliderMesh.name = originalColliderMesh.name;
|
||||
}
|
||||
editColliderMesh.WriteMesh(ref destinationColliderMesh);
|
||||
destinationColliderMesh.RecalculateBounds();
|
||||
collider.sharedMesh = destinationColliderMesh;
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplySpline()
|
||||
{
|
||||
if (destinationSpline == null) return;
|
||||
splineComputer.SetPoints(destinationSpline.points);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/ObjectBender.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f64d070be79692d449ab6f792ee7fb57
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 71feaa5f5395f3640a94b1ba649bc941, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c903173b5a8b59048af726e4f6b61569
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 083219ce96b0d6e4093a1654fac83459
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class ObjectControllerCustomRuleBase : ScriptableObject
|
||||
{
|
||||
protected ObjectController currentController;
|
||||
protected SplineSample currentSample;
|
||||
protected int currentObjectIndex;
|
||||
protected int totalObjects;
|
||||
protected float currentObjectPercent
|
||||
{
|
||||
get { return (float)currentObjectIndex / (totalObjects - 1); }
|
||||
}
|
||||
|
||||
public void SetContext(ObjectController context, SplineSample sample, int currentObject, int totalObjects)
|
||||
{
|
||||
currentController = context;
|
||||
currentSample = sample;
|
||||
this.currentObjectIndex = currentObject;
|
||||
this.totalObjects = totalObjects;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this method to create custom positioning behaviors. The returned offset should be in local coordinates.
|
||||
/// </summary>
|
||||
/// <returns>Vector3 offset in local coordinates</returns>
|
||||
public virtual Vector3 GetOffset()
|
||||
{
|
||||
return currentSample.position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this method to create custom rotation behaviors. The returned rotation is in world space
|
||||
/// </summary>
|
||||
/// <returns>Quaternion rotation in world coordinates</returns>
|
||||
public virtual Quaternion GetRotation()
|
||||
{
|
||||
return currentSample.rotation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement this method to create custom scaling behaviors.
|
||||
/// </summary>
|
||||
/// <returns>Vector3 scale</returns>
|
||||
public virtual Vector3 GetScale()
|
||||
{
|
||||
return Vector3.one * currentSample.size;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a81cd2dca8dd58a46a1ff2451e09a21e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 956119420e783ba4e8c22ab8c32ed5e8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
//Use the CreateAssetMenu attribute to add the object to the Create Asset context menu
|
||||
//After that, go to Assets/Create/Dreamteck/Splines/... and create the scriptable object
|
||||
[CreateAssetMenu(menuName = "Dreamteck/Splines/Object Controller Rules/Sine Rule")]
|
||||
public class ObjectControllerSineRule : ObjectControllerCustomRuleBase
|
||||
{
|
||||
[SerializeField] private bool _useSplinePercent = false;
|
||||
[SerializeField] private float _frequency = 1f;
|
||||
[SerializeField] private float _amplitude = 1f;
|
||||
[SerializeField] private float _angle = 0f;
|
||||
[SerializeField] private float _minScale = 1f;
|
||||
[SerializeField] private float _maxScale = 1f;
|
||||
[SerializeField] [Range(0f, 1f)] private float _offset = 0f;
|
||||
|
||||
public bool useSplinePercent
|
||||
{
|
||||
get { return _useSplinePercent; }
|
||||
set { _useSplinePercent = value; }
|
||||
}
|
||||
|
||||
public float frequency
|
||||
{
|
||||
get { return _frequency; }
|
||||
set { _frequency = value; }
|
||||
}
|
||||
|
||||
public float amplitude
|
||||
{
|
||||
get { return _amplitude; }
|
||||
set { _amplitude = value; }
|
||||
}
|
||||
|
||||
public float angle
|
||||
{
|
||||
get { return _angle; }
|
||||
set { _angle = value; }
|
||||
}
|
||||
|
||||
public float minScale
|
||||
{
|
||||
get { return _minScale; }
|
||||
set { _minScale = value; }
|
||||
}
|
||||
|
||||
public float maxScale
|
||||
{
|
||||
get { return _maxScale; }
|
||||
set { _maxScale = value; }
|
||||
}
|
||||
|
||||
public float offset
|
||||
{
|
||||
get { return _offset; }
|
||||
set {
|
||||
_offset = value;
|
||||
if(_offset > 1)
|
||||
{
|
||||
_offset -= Mathf.FloorToInt(_offset);
|
||||
}
|
||||
if(_offset < 0)
|
||||
{
|
||||
_offset += Mathf.FloorToInt(-_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Override GetOffset, GetRotation and GetScale to implement custom behaviors
|
||||
//Use the information from currentSample, currentObjectIndex, totalObjects and currentObjectPercent
|
||||
|
||||
public override Vector3 GetOffset()
|
||||
{
|
||||
float sin = GetSine();
|
||||
return Quaternion.AngleAxis(_angle, Vector3.forward) * Vector3.up * sin * _amplitude;
|
||||
}
|
||||
|
||||
public override Vector3 GetScale()
|
||||
{
|
||||
return Vector3.Lerp(Vector3.one * _minScale, Vector3.one * _maxScale, GetSine());
|
||||
}
|
||||
|
||||
private float GetSine()
|
||||
{
|
||||
float objectPercent = _useSplinePercent ? (float)currentSample.percent : currentObjectPercent;
|
||||
return Mathf.Sin((Mathf.PI * _offset) + objectPercent * Mathf.PI * _frequency);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34dc4bc87da1557438d48f8b38533bd8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 956119420e783ba4e8c22ab8c32ed5e8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,87 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
//Use the CreateAssetMenu attribute to add the object to the Create Asset context menu
|
||||
//After that, go to Assets/Create/Dreamteck/Splines/... and create the scriptable object
|
||||
[CreateAssetMenu(menuName = "Dreamteck/Splines/Object Controller Rules/Spiral Rule")]
|
||||
public class ObjectControllerSpiralRule : ObjectControllerCustomRuleBase
|
||||
{
|
||||
[SerializeField] private bool _useSplinePercent = false;
|
||||
[SerializeField] private float _revolve = 360f;
|
||||
[SerializeField] private Vector2 _startSize = Vector2.one;
|
||||
[SerializeField] private Vector2 _endSize = Vector2.one;
|
||||
[SerializeField] [Range(0f, 1f)] private float _offset = 0f;
|
||||
|
||||
public bool useSplinePercent
|
||||
{
|
||||
get { return _useSplinePercent; }
|
||||
set { _useSplinePercent = value; }
|
||||
}
|
||||
|
||||
public float revolve
|
||||
{
|
||||
get { return _revolve; }
|
||||
set { _revolve = value; }
|
||||
}
|
||||
|
||||
public Vector2 startSize
|
||||
{
|
||||
get { return _startSize; }
|
||||
set { _startSize = value; }
|
||||
}
|
||||
|
||||
public Vector2 endSize
|
||||
{
|
||||
get { return _endSize; }
|
||||
set { _endSize = value; }
|
||||
}
|
||||
|
||||
public float offset
|
||||
{
|
||||
get { return _offset; }
|
||||
set {
|
||||
_offset = value;
|
||||
if(_offset > 1)
|
||||
{
|
||||
_offset -= Mathf.FloorToInt(_offset);
|
||||
}
|
||||
if(_offset < 0)
|
||||
{
|
||||
_offset += Mathf.FloorToInt(-_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Override GetOffset, GetRotation and GetScale to implement custom behaviors
|
||||
//Use the information from currentSample, currentObjectIndex, totalObjects and currentObjectPercent
|
||||
|
||||
public override Vector3 GetOffset()
|
||||
{
|
||||
Vector3 offset = Quaternion.AngleAxis(_revolve * GetPercent(), Vector3.forward) * Vector3.up;
|
||||
Vector2 scale = Vector2.Lerp(_startSize, _endSize, GetPercent());
|
||||
offset.x *= scale.x;
|
||||
offset.y *= scale.y;
|
||||
return offset;
|
||||
}
|
||||
|
||||
public override Quaternion GetRotation()
|
||||
{
|
||||
return currentSample.rotation * Quaternion.AngleAxis(_revolve * -GetPercent(), Vector3.forward);
|
||||
}
|
||||
|
||||
private float GetPercent()
|
||||
{
|
||||
float percent = _useSplinePercent ? (float)currentSample.percent : currentObjectPercent + _offset;
|
||||
if (percent > 1)
|
||||
{
|
||||
percent -= Mathf.FloorToInt(percent);
|
||||
}
|
||||
if (percent < 0)
|
||||
{
|
||||
percent += Mathf.FloorToInt(-percent);
|
||||
}
|
||||
return percent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: daebc70828e501444b23046e124e96f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 956119420e783ba4e8c22ab8c32ed5e8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 34dc4bc87da1557438d48f8b38533bd8, type: 3}
|
||||
m_Name: Sine Rule
|
||||
m_EditorClassIdentifier:
|
||||
_useSplinePercent: 0
|
||||
_frequency: 10
|
||||
_amplitude: 2
|
||||
_angle: 0
|
||||
_minScale: 1
|
||||
_maxScale: 1
|
||||
_offset: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 557016a7bc8c3d54b9eaa910dd4483e0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: daebc70828e501444b23046e124e96f4, type: 3}
|
||||
m_Name: Spiral Rule
|
||||
m_EditorClassIdentifier:
|
||||
_useSplinePercent: 0
|
||||
_revolve: 1080
|
||||
_startSize: {x: 2, y: 2}
|
||||
_endSize: {x: 2, y: 2}
|
||||
_offset: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cc6a0bc50b20b44a925efc90a98fa81
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
909
Assets/Dreamteck/Splines/Components/ObjectController.cs
Normal file
@@ -0,0 +1,909 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Object Controller")]
|
||||
public class ObjectController : SplineUser
|
||||
{
|
||||
[System.Serializable]
|
||||
internal class ObjectControl
|
||||
{
|
||||
public bool isNull
|
||||
{
|
||||
get
|
||||
{
|
||||
return gameObject == null;
|
||||
}
|
||||
}
|
||||
public Transform transform
|
||||
{
|
||||
get {
|
||||
if (gameObject == null) return null;
|
||||
return gameObject.transform;
|
||||
}
|
||||
}
|
||||
public GameObject gameObject;
|
||||
public Vector3 position = Vector3.zero;
|
||||
public Quaternion rotation = Quaternion.identity;
|
||||
public Vector3 scale = Vector3.one;
|
||||
public bool active = true;
|
||||
|
||||
public Vector3 baseScale = Vector3.one;
|
||||
|
||||
public ObjectControl(GameObject input)
|
||||
{
|
||||
gameObject = input;
|
||||
baseScale = gameObject.transform.localScale;
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
if (gameObject == null) return;
|
||||
GameObject.Destroy(gameObject);
|
||||
}
|
||||
|
||||
public void DestroyImmediate()
|
||||
{
|
||||
if (gameObject == null) return;
|
||||
GameObject.DestroyImmediate(gameObject);
|
||||
}
|
||||
|
||||
public void Apply()
|
||||
{
|
||||
if (gameObject == null) return;
|
||||
transform.position = position;
|
||||
transform.rotation = rotation;
|
||||
transform.localScale = scale;
|
||||
gameObject.SetActive(active);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum SpawnMethod { Count, Points }
|
||||
public enum ObjectMethod { Instantiate, GetChildren }
|
||||
public enum Positioning { Stretch, Clip }
|
||||
public enum Iteration { Ordered, Random }
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
public GameObject[] objects = new GameObject[0];
|
||||
|
||||
public ObjectMethod objectMethod
|
||||
{
|
||||
get { return _objectMethod; }
|
||||
set
|
||||
{
|
||||
if (value != _objectMethod)
|
||||
{
|
||||
if (value == ObjectMethod.GetChildren)
|
||||
{
|
||||
_objectMethod = value;
|
||||
Spawn();
|
||||
}
|
||||
else _objectMethod = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SpawnMethod spawnMethod
|
||||
{
|
||||
get { return _spawnMethod; }
|
||||
set
|
||||
{
|
||||
if (value != _spawnMethod)
|
||||
{
|
||||
_spawnMethod = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int spawnCount
|
||||
{
|
||||
get { return _spawnCount; }
|
||||
set
|
||||
{
|
||||
if (value != _spawnCount)
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (_objectMethod == ObjectMethod.Instantiate)
|
||||
{
|
||||
if (value < _spawnCount)
|
||||
{
|
||||
_spawnCount = value;
|
||||
Remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
_spawnCount = value;
|
||||
Spawn();
|
||||
}
|
||||
}
|
||||
else _spawnCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Positioning objectPositioning
|
||||
{
|
||||
get { return _objectPositioning; }
|
||||
set
|
||||
{
|
||||
if (value != _objectPositioning)
|
||||
{
|
||||
_objectPositioning = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Iteration iteration
|
||||
{
|
||||
get { return _iteration; }
|
||||
set
|
||||
{
|
||||
if (value != _iteration)
|
||||
{
|
||||
_iteration = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public bool retainPrefabInstancesInEditor
|
||||
{
|
||||
get { return _retainPrefabInstancesInEditor; }
|
||||
set
|
||||
{
|
||||
if (value != _retainPrefabInstancesInEditor)
|
||||
{
|
||||
_retainPrefabInstancesInEditor = value;
|
||||
Clear();
|
||||
Spawn();
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public int randomSeed
|
||||
{
|
||||
get { return _randomSeed; }
|
||||
set
|
||||
{
|
||||
if (value != _randomSeed)
|
||||
{
|
||||
_randomSeed = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 minOffset
|
||||
{
|
||||
get { return _minOffset; }
|
||||
set
|
||||
{
|
||||
if (value != _minOffset)
|
||||
{
|
||||
_minOffset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 maxOffset
|
||||
{
|
||||
get { return _maxOffset; }
|
||||
set
|
||||
{
|
||||
if (value != _maxOffset)
|
||||
{
|
||||
_maxOffset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool offsetUseWorldCoords
|
||||
{
|
||||
get { return _offsetUseWorldCoords; }
|
||||
set
|
||||
{
|
||||
if (value != _offsetUseWorldCoords)
|
||||
{
|
||||
_offsetUseWorldCoords = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 minRotation
|
||||
{
|
||||
get { return _minRotation; }
|
||||
set
|
||||
{
|
||||
if (value != _minRotation)
|
||||
{
|
||||
_minRotation = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 maxRotation
|
||||
{
|
||||
get { return _maxRotation; }
|
||||
set
|
||||
{
|
||||
if (value != _maxRotation)
|
||||
{
|
||||
_maxRotation = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 rotationOffset
|
||||
{
|
||||
get { return (_maxRotation+_minRotation)/2f; }
|
||||
set
|
||||
{
|
||||
if (value != _minRotation || value != _maxRotation)
|
||||
{
|
||||
_minRotation = _maxRotation = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 minScaleMultiplier
|
||||
{
|
||||
get { return _minScaleMultiplier; }
|
||||
set
|
||||
{
|
||||
if (value != _minScaleMultiplier)
|
||||
{
|
||||
_minScaleMultiplier = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 maxScaleMultiplier
|
||||
{
|
||||
get { return _maxScaleMultiplier; }
|
||||
set
|
||||
{
|
||||
if (value != _maxScaleMultiplier)
|
||||
{
|
||||
_maxScaleMultiplier = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool uniformScaleLerp
|
||||
{
|
||||
get { return _uniformScaleLerp; }
|
||||
set
|
||||
{
|
||||
if(value != _uniformScaleLerp)
|
||||
{
|
||||
_uniformScaleLerp = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool shellOffset
|
||||
{
|
||||
get { return _shellOffset; }
|
||||
set
|
||||
{
|
||||
if (value != _shellOffset)
|
||||
{
|
||||
_shellOffset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool applyRotation
|
||||
{
|
||||
get { return _applyRotation; }
|
||||
set
|
||||
{
|
||||
if (value != _applyRotation)
|
||||
{
|
||||
_applyRotation = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool rotateByOffset
|
||||
{
|
||||
get { return _rotateByOffset; }
|
||||
set
|
||||
{
|
||||
if (value != _rotateByOffset)
|
||||
{
|
||||
_rotateByOffset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool applyScale
|
||||
{
|
||||
get { return _applyScale; }
|
||||
set
|
||||
{
|
||||
if (value != _applyScale)
|
||||
{
|
||||
_applyScale = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float evaluateOffset
|
||||
{
|
||||
get { return _evaluateOffset; }
|
||||
set
|
||||
{
|
||||
if (value != _evaluateOffset)
|
||||
{
|
||||
_evaluateOffset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float minObjectDistance
|
||||
{
|
||||
get { return _minObjectDistance; }
|
||||
set
|
||||
{
|
||||
if (value != _minObjectDistance)
|
||||
{
|
||||
_minObjectDistance = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float maxObjectDistance
|
||||
{
|
||||
get { return _maxObjectDistance; }
|
||||
set
|
||||
{
|
||||
if (value != _maxObjectDistance)
|
||||
{
|
||||
_maxObjectDistance = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ObjectControllerCustomRuleBase customOffsetRule
|
||||
{
|
||||
get { return _customOffsetRule; }
|
||||
set
|
||||
{
|
||||
if (value != _customOffsetRule)
|
||||
{
|
||||
_customOffsetRule = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ObjectControllerCustomRuleBase customRotationRule
|
||||
{
|
||||
get { return _customRotationRule; }
|
||||
set
|
||||
{
|
||||
if (value != _customRotationRule)
|
||||
{
|
||||
_customRotationRule = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ObjectControllerCustomRuleBase customScaleRule
|
||||
{
|
||||
get { return _customScaleRule; }
|
||||
set
|
||||
{
|
||||
if (value != _customScaleRule)
|
||||
{
|
||||
_customScaleRule = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _evaluateOffset = 0f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private SpawnMethod _spawnMethod = SpawnMethod.Count;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private int _spawnCount = 0;
|
||||
#if UNITY_EDITOR
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _retainPrefabInstancesInEditor = true;
|
||||
#endif
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Positioning _objectPositioning = Positioning.Stretch;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Iteration _iteration = Iteration.Ordered;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private int _randomSeed = 1;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _minOffset = Vector3.zero;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _maxOffset = Vector3.zero;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _offsetUseWorldCoords = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _minRotation = Vector3.zero;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _maxRotation = Vector3.zero;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _uniformScaleLerp = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _minScaleMultiplier = Vector3.one;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Vector3 _maxScaleMultiplier = Vector3.one;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _shellOffset = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _applyRotation = true;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _rotateByOffset = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _applyScale = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ObjectMethod _objectMethod = ObjectMethod.Instantiate;
|
||||
[HideInInspector]
|
||||
public bool delayedSpawn = false;
|
||||
[HideInInspector]
|
||||
public float spawnDelay = 0.1f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private int lastChildCount = 0;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float lastPointCount = 0;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ObjectControl[] spawned = new ObjectControl[0];
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _useCustomObjectDistance = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _minObjectDistance = 0f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _maxObjectDistance = 0f;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ObjectControllerCustomRuleBase _customOffsetRule;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ObjectControllerCustomRuleBase _customRotationRule;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ObjectControllerCustomRuleBase _customScaleRule;
|
||||
|
||||
System.Random offsetRandomizer, shellRandomizer, rotationRandomizer, scaleRandomizer, distanceRandomizer;
|
||||
|
||||
private int GetTargetCount()
|
||||
{
|
||||
switch (_spawnMethod)
|
||||
{
|
||||
case SpawnMethod.Points:
|
||||
return spline.pointCount;
|
||||
case SpawnMethod.Count:
|
||||
default:
|
||||
return spawnCount;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
for (int i = 0; i < spawned.Length; i++)
|
||||
{
|
||||
if (spawned[i] == null || spawned[i].transform == null) continue;
|
||||
spawned[i].transform.localScale = spawned[i].baseScale;
|
||||
if (_objectMethod == ObjectMethod.GetChildren) spawned[i].gameObject.SetActive(false);
|
||||
else
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying) spawned[i].DestroyImmediate();
|
||||
else spawned[i].Destroy();
|
||||
#else
|
||||
spawned[i].Destroy();
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
spawned = new ObjectControl[0];
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (_spawnCount < 0) _spawnCount = 0;
|
||||
}
|
||||
|
||||
private void Remove()
|
||||
{
|
||||
int targetCount = GetTargetCount();
|
||||
if (targetCount >= spawned.Length) return;
|
||||
for (int i = spawned.Length - 1; i >= targetCount; i--)
|
||||
{
|
||||
if (i >= spawned.Length) break;
|
||||
if (spawned[i] == null) continue;
|
||||
spawned[i].transform.localScale = spawned[i].baseScale;
|
||||
if (_objectMethod == ObjectMethod.GetChildren) spawned[i].gameObject.SetActive(false);
|
||||
else
|
||||
{
|
||||
if (Application.isEditor) spawned[i].DestroyImmediate();
|
||||
else spawned[i].Destroy();
|
||||
|
||||
}
|
||||
}
|
||||
ObjectControl[] newSpawned = new ObjectControl[targetCount];
|
||||
for (int i = 0; i < newSpawned.Length; i++)
|
||||
{
|
||||
newSpawned[i] = spawned[i];
|
||||
}
|
||||
spawned = newSpawned;
|
||||
// For consistency, I rebuild immediately here too. That way,
|
||||
// the ObjectController behaves without glitching in all cases.
|
||||
RebuildImmediate();
|
||||
}
|
||||
|
||||
public void GetAll()
|
||||
{
|
||||
ObjectControl[] newSpawned = new ObjectControl[transform.childCount];
|
||||
int index = 0;
|
||||
foreach (Transform child in transform)
|
||||
{
|
||||
if (newSpawned[index] == null)
|
||||
{
|
||||
newSpawned[index++] = new ObjectControl(child.gameObject);
|
||||
continue;
|
||||
}
|
||||
bool found = false;
|
||||
for (int i = 0; i < spawned.Length; i++)
|
||||
{
|
||||
if (spawned[i].gameObject == child.gameObject)
|
||||
{
|
||||
newSpawned[index++] = spawned[i];
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) newSpawned[index++] = new ObjectControl(child.gameObject);
|
||||
}
|
||||
spawned = newSpawned;
|
||||
}
|
||||
|
||||
public void Spawn()
|
||||
{
|
||||
if (_objectMethod == ObjectMethod.Instantiate)
|
||||
{
|
||||
if (delayedSpawn && Application.isPlaying)
|
||||
{
|
||||
StopCoroutine("InstantiateAllWithDelay");
|
||||
StartCoroutine(InstantiateAllWithDelay());
|
||||
}
|
||||
else InstantiateAll();
|
||||
}
|
||||
else GetAll();
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
base.LateRun();
|
||||
if (_spawnMethod == SpawnMethod.Points && spline && lastPointCount != spline.pointCount)
|
||||
{
|
||||
if (_objectMethod != ObjectMethod.GetChildren) Remove();
|
||||
Spawn();
|
||||
lastPointCount = spline.pointCount;
|
||||
}
|
||||
if (_objectMethod == ObjectMethod.GetChildren && lastChildCount != transform.childCount)
|
||||
{
|
||||
Spawn();
|
||||
lastChildCount = transform.childCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IEnumerator InstantiateAllWithDelay()
|
||||
{
|
||||
if (spline == null) yield break;
|
||||
if (objects.Length == 0) yield break;
|
||||
|
||||
int targetCount = GetTargetCount();
|
||||
for (int i = spawned.Length; i < targetCount; i++)
|
||||
{
|
||||
InstantiateSingle();
|
||||
// Visual artifacts occur if not rebuilding immediately. Normally this can be solved
|
||||
// by calling RebuildImmediate on the spline after modifying it,
|
||||
// however, with delay this becomes difficult to control.
|
||||
// The first object would position correctly, but the rest would
|
||||
// have the wrong position for one frame, and the user would have to jump through
|
||||
// some hoops to rebuild the user in sync with spawning.
|
||||
RebuildImmediate();
|
||||
yield return new WaitForSeconds(spawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
private void InstantiateAll()
|
||||
{
|
||||
if (spline == null) return;
|
||||
if (objects.Length == 0) return;
|
||||
|
||||
int targetCount = GetTargetCount();
|
||||
for (int i = spawned.Length; i < targetCount; i++) InstantiateSingle();
|
||||
// For consistency, I rebuild immediately here too. That way, there is no need for the user
|
||||
// to figure out if the ObjectController has delay or not and keeps the usage simple.
|
||||
RebuildImmediate();
|
||||
}
|
||||
|
||||
private void InstantiateSingle()
|
||||
{
|
||||
if (objects.Length == 0) return;
|
||||
int index = 0;
|
||||
if (_iteration == Iteration.Ordered)
|
||||
{
|
||||
index = spawned.Length - Mathf.FloorToInt(spawned.Length / objects.Length) * objects.Length;
|
||||
}
|
||||
else index = Random.Range(0, objects.Length);
|
||||
if (objects[index] == null) return;
|
||||
|
||||
ObjectControl[] newSpawned = new ObjectControl[spawned.Length + 1];
|
||||
spawned.CopyTo(newSpawned, 0);
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying && retainPrefabInstancesInEditor)
|
||||
{
|
||||
GameObject go = (GameObject)UnityEditor.PrefabUtility.InstantiatePrefab(objects[index]);
|
||||
go.transform.position = transform.position;
|
||||
go.transform.rotation = transform.rotation;
|
||||
newSpawned[newSpawned.Length - 1] = new ObjectControl(go);
|
||||
} else
|
||||
{
|
||||
newSpawned[newSpawned.Length - 1] = new ObjectControl((GameObject)Instantiate(objects[index], transform.position, transform.rotation));
|
||||
}
|
||||
#else
|
||||
newSpawned[newSpawned.Length - 1] = new ObjectControl((GameObject)Instantiate(objects[index], transform.position, transform.rotation));
|
||||
#endif
|
||||
newSpawned[newSpawned.Length - 1].transform.parent = transform;
|
||||
spawned = newSpawned;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// For prefabs, it is important that the spawned array gets marked as overridden.
|
||||
// Otherwise, the Object Controller will lose references to objects that were spawned
|
||||
// after prefab instantiation but before editor play/pause, causing it to leave behind
|
||||
// objects and instantiating extra ones.
|
||||
EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
offsetRandomizer = new System.Random(_randomSeed);
|
||||
if(_shellOffset) shellRandomizer = new System.Random(_randomSeed + 1);
|
||||
rotationRandomizer = new System.Random(_randomSeed + 2);
|
||||
scaleRandomizer = new System.Random(_randomSeed + 3);
|
||||
distanceRandomizer = new System.Random(_randomSeed + 4);
|
||||
|
||||
bool hasCustomOffset = _customOffsetRule != null;
|
||||
bool hasCustomRotation = _customRotationRule != null;
|
||||
bool hasCustomScale = _customScaleRule != null;
|
||||
|
||||
bool randomScaleMultiplier = _minScaleMultiplier != _maxScaleMultiplier;
|
||||
double distancePercentAccum = 0.0;
|
||||
for (int i = 0; i < spawned.Length; i++)
|
||||
{
|
||||
if (spawned[i] == null)
|
||||
{
|
||||
Clear();
|
||||
Spawn();
|
||||
break;
|
||||
}
|
||||
float percent = 0f;
|
||||
if (spawned.Length > 1)
|
||||
{
|
||||
if(!_useCustomObjectDistance)
|
||||
{
|
||||
if (spline.isClosed)
|
||||
{
|
||||
percent = (float)i / spawned.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
percent = (float)i / (spawned.Length - 1);
|
||||
}
|
||||
} else
|
||||
{
|
||||
percent = (float)distancePercentAccum;
|
||||
}
|
||||
}
|
||||
|
||||
percent += _evaluateOffset;
|
||||
if (percent > 1f)
|
||||
{
|
||||
percent -= 1f;
|
||||
}
|
||||
else if (percent < 0f)
|
||||
{
|
||||
percent += 1f;
|
||||
}
|
||||
|
||||
if (objectPositioning == Positioning.Clip)
|
||||
{
|
||||
spline.Evaluate(percent, ref evalResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
Evaluate(percent, ref evalResult);
|
||||
}
|
||||
|
||||
spawned[i].position = evalResult.position;
|
||||
|
||||
if (_applyScale)
|
||||
{
|
||||
if (hasCustomScale)
|
||||
{
|
||||
_customScaleRule.SetContext(this, evalResult, i, spawned.Length);
|
||||
spawned[i].scale = _customOffsetRule.GetScale();
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3 scale = spawned[i].baseScale * evalResult.size;
|
||||
Vector3 multiplier = _minScaleMultiplier;
|
||||
|
||||
if (randomScaleMultiplier)
|
||||
{
|
||||
|
||||
if (_uniformScaleLerp)
|
||||
{
|
||||
multiplier = Vector3.Lerp(new Vector3(_minScaleMultiplier.x, _minScaleMultiplier.y, _minScaleMultiplier.z), new Vector3(_maxScaleMultiplier.x, _maxScaleMultiplier.y, _maxScaleMultiplier.z), (float)scaleRandomizer.NextDouble());
|
||||
}
|
||||
else
|
||||
{
|
||||
multiplier.x = Mathf.Lerp(_minScaleMultiplier.x, _maxScaleMultiplier.x, (float)scaleRandomizer.NextDouble());
|
||||
multiplier.y = Mathf.Lerp(_minScaleMultiplier.y, _maxScaleMultiplier.y, (float)scaleRandomizer.NextDouble());
|
||||
multiplier.z = Mathf.Lerp(_minScaleMultiplier.z, _maxScaleMultiplier.z, (float)scaleRandomizer.NextDouble());
|
||||
}
|
||||
}
|
||||
scale.x *= multiplier.x;
|
||||
scale.y *= multiplier.y;
|
||||
scale.z *= multiplier.z;
|
||||
spawned[i].scale = scale;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spawned[i].scale = spawned[i].baseScale;
|
||||
}
|
||||
|
||||
Vector3 right = Vector3.Cross(evalResult.forward, evalResult.up).normalized;
|
||||
|
||||
Vector3 posOffset = _minOffset;
|
||||
if (hasCustomOffset)
|
||||
{
|
||||
_customOffsetRule.SetContext(this, evalResult, i, spawned.Length);
|
||||
posOffset = _customOffsetRule.GetOffset();
|
||||
}
|
||||
else if (_minOffset != _maxOffset)
|
||||
{
|
||||
if(_shellOffset)
|
||||
{
|
||||
float x = _maxOffset.x - _minOffset.x;
|
||||
float y = _maxOffset.y - _minOffset.y;
|
||||
float angleInRadians = (float)shellRandomizer.NextDouble() * 360f * Mathf.Deg2Rad;
|
||||
posOffset = new Vector2(0.5f * Mathf.Cos(angleInRadians), 0.5f * Mathf.Sin(angleInRadians));
|
||||
posOffset.x *= x;
|
||||
posOffset.y *= y;
|
||||
} else
|
||||
{
|
||||
float rnd = (float)offsetRandomizer.NextDouble();
|
||||
posOffset.x = Mathf.Lerp(_minOffset.x, _maxOffset.x, rnd);
|
||||
rnd = (float)offsetRandomizer.NextDouble();
|
||||
posOffset.y = Mathf.Lerp(_minOffset.y, _maxOffset.y, rnd);
|
||||
rnd = (float)offsetRandomizer.NextDouble();
|
||||
posOffset.z = Mathf.Lerp(_minOffset.z, _maxOffset.z, rnd);
|
||||
}
|
||||
}
|
||||
|
||||
if (_offsetUseWorldCoords)
|
||||
{
|
||||
spawned[i].position += posOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawned[i].position += right * posOffset.x * evalResult.size + evalResult.up * posOffset.y * evalResult.size;
|
||||
}
|
||||
|
||||
if (_applyRotation)
|
||||
{
|
||||
if (hasCustomRotation)
|
||||
{
|
||||
_customRotationRule.SetContext(this, evalResult, i, spawned.Length);
|
||||
spawned[i].rotation = _customRotationRule.GetRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
Quaternion offsetRot = Quaternion.Euler(Mathf.Lerp(_minRotation.x, _maxRotation.x, (float)rotationRandomizer.NextDouble()), Mathf.Lerp(_minRotation.y, _maxRotation.y, (float)rotationRandomizer.NextDouble()), Mathf.Lerp(_minRotation.z, _maxRotation.z, (float)rotationRandomizer.NextDouble()));
|
||||
if (_rotateByOffset) spawned[i].rotation = Quaternion.LookRotation(evalResult.forward, spawned[i].position - evalResult.position) * offsetRot;
|
||||
else spawned[i].rotation = evalResult.rotation * offsetRot;
|
||||
}
|
||||
}
|
||||
|
||||
if (_objectPositioning == Positioning.Clip)
|
||||
{
|
||||
if (percent < clipFrom || percent > clipTo) spawned[i].active = false;
|
||||
else spawned[i].active = true;
|
||||
}
|
||||
if (_useCustomObjectDistance)
|
||||
{
|
||||
if (objectPositioning == Positioning.Clip)
|
||||
{
|
||||
distancePercentAccum = spline.Travel(distancePercentAccum, Mathf.Lerp(_minObjectDistance, _maxObjectDistance, (float)distanceRandomizer.NextDouble()));
|
||||
}
|
||||
else
|
||||
{
|
||||
distancePercentAccum = Travel(distancePercentAccum, Mathf.Lerp(_minObjectDistance, _maxObjectDistance, (float)distanceRandomizer.NextDouble()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PostBuild()
|
||||
{
|
||||
base.PostBuild();
|
||||
for (int i = 0; i < spawned.Length; i++)
|
||||
{
|
||||
spawned[i].Apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/ObjectController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acb0592a986cebb4287d41702ab6ea22
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 809d29b9ca1b74947aca02225d2ec233, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
265
Assets/Dreamteck/Splines/Components/ParticleController.cs
Normal file
@@ -0,0 +1,265 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Particle Controller")]
|
||||
public class ParticleController : SplineUser
|
||||
{
|
||||
public ParticleSystem particleSystemComponent
|
||||
{
|
||||
get { return _particleSystem; }
|
||||
set {
|
||||
_particleSystem = value;
|
||||
_renderer = _particleSystem.GetComponent<ParticleSystemRenderer>();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private ParticleSystem _particleSystem;
|
||||
private ParticleSystemRenderer _renderer;
|
||||
public enum EmitPoint { Beginning, Ending, Random, Ordered }
|
||||
public enum MotionType { None, UseParticleSystem, FollowForward, FollowBackward, ByNormal, ByNormalRandomized }
|
||||
public enum Wrap { Default, Loop }
|
||||
|
||||
[HideInInspector]
|
||||
public bool pauseWhenNotVisible = false;
|
||||
[HideInInspector]
|
||||
public Vector2 offset = Vector2.zero;
|
||||
[HideInInspector]
|
||||
public bool volumetric = false;
|
||||
[HideInInspector]
|
||||
public bool emitFromShell = false;
|
||||
[HideInInspector]
|
||||
public bool apply3DRotation = false;
|
||||
[HideInInspector]
|
||||
public Vector2 scale = Vector2.one;
|
||||
[HideInInspector]
|
||||
public EmitPoint emitPoint = EmitPoint.Beginning;
|
||||
[HideInInspector]
|
||||
public MotionType motionType = MotionType.UseParticleSystem;
|
||||
[HideInInspector]
|
||||
public Wrap wrapMode = Wrap.Default;
|
||||
[HideInInspector]
|
||||
public float minCycles = 1f;
|
||||
[HideInInspector]
|
||||
public float maxCycles = 1f;
|
||||
|
||||
private ParticleSystem.Particle[] _particles = new ParticleSystem.Particle[0];
|
||||
private Particle[] _controllers = new Particle[0];
|
||||
private int _particleCount = 0;
|
||||
private int _birthIndex = 0;
|
||||
private List<Vector4> _customParticleData = new List<Vector4>();
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
if (_particleSystem == null) return;
|
||||
if (pauseWhenNotVisible)
|
||||
{
|
||||
if (_renderer == null)
|
||||
{
|
||||
_renderer = _particleSystem.GetComponent<ParticleSystemRenderer>();
|
||||
}
|
||||
if (!_renderer.isVisible) return;
|
||||
}
|
||||
|
||||
int maxParticles = _particleSystem.main.maxParticles;
|
||||
if (_particles.Length != maxParticles)
|
||||
{
|
||||
_particles = new ParticleSystem.Particle[maxParticles];
|
||||
_customParticleData = new List<Vector4>(maxParticles);
|
||||
Particle[] newControllers = new Particle[maxParticles];
|
||||
for (int i = 0; i < newControllers.Length; i++)
|
||||
{
|
||||
if (i >= _controllers.Length) break;
|
||||
newControllers[i] = _controllers[i];
|
||||
}
|
||||
_controllers = newControllers;
|
||||
}
|
||||
_particleCount = _particleSystem.GetParticles(_particles);
|
||||
_particleSystem.GetCustomParticleData(_customParticleData, ParticleSystemCustomData.Custom1);
|
||||
|
||||
bool isLocal = _particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.Local;
|
||||
|
||||
Transform particleSystemTransform = _particleSystem.transform;
|
||||
|
||||
for (int i = 0; i < _particleCount; i++)
|
||||
{
|
||||
if (_controllers[i] == null)
|
||||
{
|
||||
_controllers[i] = new Particle();
|
||||
}
|
||||
if (isLocal)
|
||||
{
|
||||
TransformParticle(ref _particles[i], particleSystemTransform);
|
||||
}
|
||||
if (_customParticleData[i].w < 1f)
|
||||
{
|
||||
OnParticleBorn(i);
|
||||
}
|
||||
HandleParticle(i);
|
||||
if (isLocal)
|
||||
{
|
||||
InverseTransformParticle(ref _particles[i], particleSystemTransform);
|
||||
}
|
||||
}
|
||||
|
||||
_particleSystem.SetCustomParticleData(_customParticleData, ParticleSystemCustomData.Custom1);
|
||||
_particleSystem.SetParticles(_particles, _particleCount);
|
||||
}
|
||||
|
||||
void TransformParticle(ref ParticleSystem.Particle particle, Transform trs)
|
||||
{
|
||||
particle.position = trs.TransformPoint(particle.position);
|
||||
if (apply3DRotation)
|
||||
{
|
||||
|
||||
}
|
||||
particle.velocity = trs.TransformDirection(particle.velocity);
|
||||
}
|
||||
|
||||
void InverseTransformParticle(ref ParticleSystem.Particle particle, Transform trs)
|
||||
{
|
||||
particle.position = trs.InverseTransformPoint(particle.position);
|
||||
particle.velocity = trs.InverseTransformDirection(particle.velocity);
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
updateMethod = UpdateMethod.LateUpdate;
|
||||
if (_particleSystem == null) _particleSystem = GetComponent<ParticleSystem>();
|
||||
}
|
||||
|
||||
void HandleParticle(int index)
|
||||
{
|
||||
float lifePercent = _particles[index].remainingLifetime / _particles[index].startLifetime;
|
||||
if (motionType == MotionType.FollowBackward || motionType == MotionType.FollowForward || motionType == MotionType.None)
|
||||
{
|
||||
Evaluate(_controllers[index].GetSplinePercent(wrapMode, _particles[index], motionType), ref evalResult);
|
||||
Vector3 resultRight = evalResult.right;
|
||||
_particles[index].position = evalResult.position;
|
||||
if (apply3DRotation)
|
||||
{
|
||||
_particles[index].rotation3D = evalResult.rotation.eulerAngles;
|
||||
}
|
||||
Vector2 finalOffset = offset;
|
||||
if (volumetric)
|
||||
{
|
||||
if (motionType != MotionType.None)
|
||||
{
|
||||
finalOffset += Vector2.Lerp(_controllers[index].startOffset, _controllers[index].endOffset, 1f - lifePercent);
|
||||
finalOffset.x *= scale.x;
|
||||
finalOffset.y *= scale.y;
|
||||
} else
|
||||
{
|
||||
finalOffset += _controllers[index].startOffset;
|
||||
}
|
||||
}
|
||||
_particles[index].position += resultRight * (finalOffset.x * evalResult.size) + evalResult.up * (finalOffset.y * evalResult.size);
|
||||
_particles[index].velocity = evalResult.forward;
|
||||
_particles[index].startColor = _controllers[index].startColor * evalResult.color;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnParticleBorn(int index)
|
||||
{
|
||||
Vector4 custom = _customParticleData[index];
|
||||
custom.w = 1;
|
||||
_customParticleData[index] = custom;
|
||||
double percent = 0.0;
|
||||
float emissionRate = Mathf.Lerp(_particleSystem.emission.rateOverTime.constantMin, _particleSystem.emission.rateOverTime.constantMax, 0.5f);
|
||||
float expectedParticleCount = emissionRate * _particleSystem.main.startLifetime.constantMax;
|
||||
_birthIndex++;
|
||||
if (_birthIndex > expectedParticleCount)
|
||||
{
|
||||
_birthIndex = 0;
|
||||
}
|
||||
|
||||
switch (emitPoint)
|
||||
{
|
||||
case EmitPoint.Beginning: percent = 0f; break;
|
||||
case EmitPoint.Ending: percent = 1f; break;
|
||||
case EmitPoint.Random: percent = Random.Range(0f, 1f); break;
|
||||
case EmitPoint.Ordered: percent = expectedParticleCount > 0 ? (float)_birthIndex / expectedParticleCount : 0f; break;
|
||||
}
|
||||
Evaluate(percent, ref evalResult);
|
||||
_controllers[index].startColor = _particles[index].startColor;
|
||||
_controllers[index].startPercent = percent;
|
||||
|
||||
_controllers[index].cycleSpeed = Random.Range(minCycles, maxCycles);
|
||||
Vector2 circle = Vector2.zero;
|
||||
if (volumetric)
|
||||
{
|
||||
if (emitFromShell) circle = Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.forward) * Vector2.right;
|
||||
else circle = Random.insideUnitCircle;
|
||||
}
|
||||
_controllers[index].startOffset = circle * 0.5f;
|
||||
_controllers[index].endOffset = Random.insideUnitCircle * 0.5f;
|
||||
|
||||
|
||||
Vector3 right = Vector3.Cross(evalResult.forward, evalResult.up);
|
||||
_particles[index].position = evalResult.position + right * _controllers[index].startOffset.x * evalResult.size * scale.x + evalResult.up * _controllers[index].startOffset.y * evalResult.size * scale.y;
|
||||
|
||||
float forceX = _particleSystem.forceOverLifetime.x.constantMax;
|
||||
float forceY = _particleSystem.forceOverLifetime.y.constantMax;
|
||||
float forceZ = _particleSystem.forceOverLifetime.z.constantMax;
|
||||
if (_particleSystem.forceOverLifetime.randomized)
|
||||
{
|
||||
forceX = Random.Range(_particleSystem.forceOverLifetime.x.constantMin, _particleSystem.forceOverLifetime.x.constantMax);
|
||||
forceY = Random.Range(_particleSystem.forceOverLifetime.y.constantMin, _particleSystem.forceOverLifetime.y.constantMax);
|
||||
forceZ = Random.Range(_particleSystem.forceOverLifetime.z.constantMin, _particleSystem.forceOverLifetime.z.constantMax);
|
||||
}
|
||||
|
||||
float time = _particles[index].startLifetime - _particles[index].remainingLifetime;
|
||||
Vector3 forceDistance = new Vector3(forceX, forceY, forceZ) * 0.5f * (time * time);
|
||||
|
||||
float startSpeed = _particleSystem.main.startSpeed.constantMax;
|
||||
|
||||
if (motionType == MotionType.ByNormal)
|
||||
{
|
||||
_particles[index].position += evalResult.up * startSpeed * (_particles[index].startLifetime - _particles[index].remainingLifetime);
|
||||
_particles[index].position += forceDistance;
|
||||
_particles[index].velocity = evalResult.up * startSpeed + new Vector3(forceX, forceY, forceZ) * time;
|
||||
}
|
||||
else if (motionType == MotionType.ByNormalRandomized)
|
||||
{
|
||||
Vector3 normal = Quaternion.AngleAxis(Random.Range(0f, 360f), evalResult.forward) * evalResult.up;
|
||||
_particles[index].position += normal * startSpeed * (_particles[index].startLifetime - _particles[index].remainingLifetime);
|
||||
_particles[index].position += forceDistance;
|
||||
_particles[index].velocity = normal * startSpeed + new Vector3(forceX, forceY, forceZ) * time;
|
||||
}
|
||||
HandleParticle(index);
|
||||
}
|
||||
|
||||
public class Particle
|
||||
{
|
||||
internal Vector2 startOffset = Vector2.zero;
|
||||
internal Vector2 endOffset = Vector2.zero;
|
||||
internal float cycleSpeed = 0f;
|
||||
internal Color startColor = Color.white;
|
||||
internal double startPercent = 0.0;
|
||||
|
||||
internal double GetSplinePercent(Wrap wrap, ParticleSystem.Particle particle, MotionType motionType)
|
||||
{
|
||||
float lifePercent = particle.remainingLifetime / particle.startLifetime;
|
||||
if(motionType == MotionType.FollowBackward)
|
||||
{
|
||||
lifePercent = 1f - lifePercent;
|
||||
}
|
||||
switch (wrap)
|
||||
{
|
||||
case Wrap.Default: return DMath.Clamp01(startPercent + (1f - lifePercent) * cycleSpeed);
|
||||
case Wrap.Loop:
|
||||
double loopPoint = startPercent + (1.0 - lifePercent) * cycleSpeed;
|
||||
if(loopPoint > 1.0) loopPoint -= Mathf.FloorToInt((float)loopPoint);
|
||||
return loopPoint;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33cb05eb65206594b9076db71362bf8c
|
||||
timeCreated: 1464514925
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 600
|
||||
icon: {fileID: 2800000, guid: c78150f2237d29247b0f01c770f06979, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
212
Assets/Dreamteck/Splines/Components/PathGenerator.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Path Generator")]
|
||||
public class PathGenerator : MeshGenerator
|
||||
{
|
||||
public int slices
|
||||
{
|
||||
get { return _slices; }
|
||||
set
|
||||
{
|
||||
if (value != _slices)
|
||||
{
|
||||
if (value < 1) value = 1;
|
||||
_slices = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool useShapeCurve
|
||||
{
|
||||
get { return _useShapeCurve; }
|
||||
set
|
||||
{
|
||||
if (value != _useShapeCurve)
|
||||
{
|
||||
_useShapeCurve = value;
|
||||
if (_useShapeCurve)
|
||||
{
|
||||
_shape = new AnimationCurve();
|
||||
_shape.AddKey(new Keyframe(0, 0));
|
||||
_shape.AddKey(new Keyframe(1, 0));
|
||||
} else _shape = null;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool compensateCorners
|
||||
{
|
||||
get { return _compensateCorners; }
|
||||
set
|
||||
{
|
||||
if (value != _compensateCorners)
|
||||
{
|
||||
_compensateCorners = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float shapeExposure
|
||||
{
|
||||
get { return _shapeExposure; }
|
||||
set
|
||||
{
|
||||
if (spline != null && value != _shapeExposure)
|
||||
{
|
||||
_shapeExposure = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AnimationCurve shape
|
||||
{
|
||||
get { return _shape; }
|
||||
set
|
||||
{
|
||||
if(_lastShape == null) _lastShape = new AnimationCurve();
|
||||
bool keyChange = false;
|
||||
if (value.keys.Length != _lastShape.keys.Length) keyChange = true;
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < value.keys.Length; i++)
|
||||
{
|
||||
if (value.keys[i].inTangent != _lastShape.keys[i].inTangent || value.keys[i].outTangent != _lastShape.keys[i].outTangent || value.keys[i].time != _lastShape.keys[i].time || value.keys[i].value != value.keys[i].value)
|
||||
{
|
||||
keyChange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (keyChange) Rebuild();
|
||||
_lastShape.keys = new Keyframe[value.keys.Length];
|
||||
value.keys.CopyTo(_lastShape.keys, 0);
|
||||
_lastShape.preWrapMode = value.preWrapMode;
|
||||
_lastShape.postWrapMode = value.postWrapMode;
|
||||
_shape = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override string meshName => "Path";
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private int _slices = 1;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
[Tooltip("This will inflate sample sizes based on the angle between two samples in order to preserve geometry width")]
|
||||
private bool _compensateCorners = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private bool _useShapeCurve = false;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private AnimationCurve _shape;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private AnimationCurve _lastShape;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _shapeExposure = 1f;
|
||||
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
|
||||
protected override void BuildMesh()
|
||||
{
|
||||
base.BuildMesh();
|
||||
GenerateVertices();
|
||||
MeshUtility.GeneratePlaneTriangles(ref _tsMesh.triangles, _slices, sampleCount, false);
|
||||
}
|
||||
|
||||
|
||||
void GenerateVertices()
|
||||
{
|
||||
int vertexCount = (_slices + 1) * sampleCount;
|
||||
AllocateMesh(vertexCount, _slices * (sampleCount-1) * 6);
|
||||
int vertexIndex = 0;
|
||||
|
||||
ResetUVDistance();
|
||||
|
||||
bool hasOffset = offset != Vector3.zero;
|
||||
for (int i = 0; i < sampleCount; i++)
|
||||
{
|
||||
if (_compensateCorners)
|
||||
{
|
||||
GetSampleWithAngleCompensation(i, ref evalResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSample(i, ref evalResult);
|
||||
}
|
||||
|
||||
Vector3 center = Vector3.zero;
|
||||
try
|
||||
{
|
||||
center = evalResult.position;
|
||||
} catch (System.Exception ex) { Debug.Log(ex.Message + " for i = " + i); return; }
|
||||
Vector3 right = evalResult.right;
|
||||
float resultSize = GetBaseSize(evalResult);
|
||||
if (hasOffset)
|
||||
{
|
||||
center += (offset.x * resultSize) * right + (offset.y * resultSize) * evalResult.up + (offset.z * resultSize) * evalResult.forward;
|
||||
}
|
||||
float fullSize = size * resultSize;
|
||||
Vector3 lastVertPos = Vector3.zero;
|
||||
Quaternion rot = Quaternion.AngleAxis(rotation, evalResult.forward);
|
||||
if (uvMode == UVMode.UniformClamp || uvMode == UVMode.UniformClip) AddUVDistance(i);
|
||||
Color vertexColor = GetBaseColor(evalResult) * color;
|
||||
for (int n = 0; n < _slices + 1; n++)
|
||||
{
|
||||
float slicePercent = ((float)n / _slices);
|
||||
float shapeEval = 0f;
|
||||
if (_useShapeCurve) shapeEval = _shape.Evaluate(slicePercent);
|
||||
_tsMesh.vertices[vertexIndex] = center + rot * right * (fullSize * 0.5f) - rot * right * (fullSize * slicePercent) + rot * evalResult.up * (shapeEval * _shapeExposure);
|
||||
CalculateUVs(evalResult.percent, 1f - slicePercent);
|
||||
_tsMesh.uv[vertexIndex] = Vector2.one * 0.5f + (Vector2)(Quaternion.AngleAxis(uvRotation + 180f, Vector3.forward) * (Vector2.one * 0.5f - __uvs));
|
||||
if (_slices > 1)
|
||||
{
|
||||
if (n < _slices)
|
||||
{
|
||||
float forwardPercent = ((float)(n + 1) / _slices);
|
||||
shapeEval = 0f;
|
||||
if (_useShapeCurve) shapeEval = _shape.Evaluate(forwardPercent);
|
||||
Vector3 nextVertPos = center + rot * right * fullSize * 0.5f - rot * right * fullSize * forwardPercent + rot * evalResult.up * shapeEval * _shapeExposure;
|
||||
Vector3 cross1 = -Vector3.Cross(evalResult.forward, nextVertPos - _tsMesh.vertices[vertexIndex]).normalized;
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
Vector3 cross2 = -Vector3.Cross(evalResult.forward, _tsMesh.vertices[vertexIndex] - lastVertPos).normalized;
|
||||
_tsMesh.normals[vertexIndex] = Vector3.Slerp(cross1, cross2, 0.5f);
|
||||
} else _tsMesh.normals[vertexIndex] = cross1;
|
||||
}
|
||||
else _tsMesh.normals[vertexIndex] = -Vector3.Cross(evalResult.forward, _tsMesh.vertices[vertexIndex] - lastVertPos).normalized;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tsMesh.normals[vertexIndex] = evalResult.up;
|
||||
if (rotation != 0f) _tsMesh.normals[vertexIndex] = rot * _tsMesh.normals[vertexIndex];
|
||||
}
|
||||
_tsMesh.colors[vertexIndex] = vertexColor;
|
||||
lastVertPos = _tsMesh.vertices[vertexIndex];
|
||||
vertexIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Dreamteck/Splines/Components/PathGenerator.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e1690bb01d509a439fc991a10f8278f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 71dadc4e471c37945ba62bf068cf1468, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
178
Assets/Dreamteck/Splines/Components/PolygonColliderGenerator.cs
Normal file
@@ -0,0 +1,178 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[AddComponentMenu("Dreamteck/Splines/Users/Polygon Collider Generator")]
|
||||
[RequireComponent(typeof(PolygonCollider2D))]
|
||||
public class PolygonColliderGenerator : SplineUser
|
||||
{
|
||||
public enum Type { Path, Shape }
|
||||
public Type type
|
||||
{
|
||||
get
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != _type)
|
||||
{
|
||||
_type = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
{
|
||||
if (value != _size)
|
||||
{
|
||||
_size = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float offset
|
||||
{
|
||||
get { return _offset; }
|
||||
set
|
||||
{
|
||||
if (value != _offset)
|
||||
{
|
||||
_offset = value;
|
||||
Rebuild();
|
||||
}
|
||||
}
|
||||
}
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Type _type = Type.Path;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _size = 1f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private float _offset = 0f;
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
protected PolygonCollider2D polygonCollider;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
protected Vector2[] vertices = new Vector2[0];
|
||||
|
||||
[HideInInspector]
|
||||
public float updateRate = 0.1f;
|
||||
protected float lastUpdateTime = 0f;
|
||||
|
||||
private bool updateCollider = false;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
polygonCollider = GetComponent<PolygonCollider2D>();
|
||||
}
|
||||
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
protected override void LateRun()
|
||||
{
|
||||
base.LateRun();
|
||||
if (updateCollider)
|
||||
{
|
||||
if (polygonCollider != null)
|
||||
{
|
||||
if (Time.time - lastUpdateTime >= updateRate)
|
||||
{
|
||||
lastUpdateTime = Time.time;
|
||||
updateCollider = false;
|
||||
polygonCollider.SetPath(0, vertices);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Build()
|
||||
{
|
||||
base.Build();
|
||||
switch(type){
|
||||
case Type.Path:
|
||||
GeneratePath();
|
||||
break;
|
||||
case Type.Shape: GenerateShape(); break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void PostBuild()
|
||||
{
|
||||
base.PostBuild();
|
||||
if (polygonCollider == null) return;
|
||||
for(int i = 0; i < vertices.Length; i++)
|
||||
{
|
||||
vertices[i] = transform.InverseTransformPoint(vertices[i]);
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying || updateRate <= 0f) polygonCollider.SetPath(0, vertices);
|
||||
else updateCollider = true;
|
||||
#else
|
||||
if(updateRate == 0f) polygonCollider.SetPath(0, vertices);
|
||||
else updateCollider = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private void GeneratePath()
|
||||
{
|
||||
int vertexCount = sampleCount * 2;
|
||||
if (vertices.Length != vertexCount) vertices = new Vector2[vertexCount];
|
||||
for (int i = 0; i < sampleCount; i++)
|
||||
{
|
||||
GetSample(i, ref evalResult);
|
||||
Vector2 right = new Vector2(-evalResult.forward.y, evalResult.forward.x).normalized * evalResult.size;
|
||||
vertices[i] = new Vector2(evalResult.position.x, evalResult.position.y) + right * size * 0.5f + right * offset;
|
||||
vertices[sampleCount + (sampleCount - 1) - i] = new Vector2(evalResult.position.x, evalResult.position.y) - right * size * 0.5f + right * offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateShape()
|
||||
{
|
||||
if (vertices.Length != sampleCount) vertices = new Vector2[sampleCount];
|
||||
for (int i = 0; i < sampleCount; i++)
|
||||
{
|
||||
GetSample(i, ref evalResult);
|
||||
vertices[i] = evalResult.position;
|
||||
if (offset != 0f)
|
||||
{
|
||||
Vector2 right = new Vector2(-evalResult.forward.y, evalResult.forward.x).normalized * evalResult.size;
|
||||
vertices[i] += right * offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4c6eacf526b59e41ad6bb0134d023f7
|
||||
timeCreated: 1466596564
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 5fad78752ebca1541a3321d08d1cd041, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3816a17c616f574f9ae199061ae9824
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class ColorModifier : SplineSampleModifier
|
||||
{
|
||||
[System.Serializable]
|
||||
public class ColorKey : Key
|
||||
{
|
||||
public enum BlendMode { Lerp, Multiply, Add, Subtract }
|
||||
public Color color = Color.white;
|
||||
public BlendMode blendMode = BlendMode.Lerp;
|
||||
|
||||
public ColorKey(double f, double t) : base(f, t)
|
||||
{
|
||||
}
|
||||
|
||||
public Color Blend(Color input, float percent)
|
||||
{
|
||||
switch (blendMode)
|
||||
{
|
||||
case BlendMode.Lerp: return Color.Lerp(input, color, blend * percent);
|
||||
case BlendMode.Add: return input + color * blend * percent;
|
||||
case BlendMode.Subtract: return input - color * blend * percent;
|
||||
case BlendMode.Multiply: return Color.Lerp(input, input * color, blend * percent);
|
||||
default: return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool hasKeys => keys.Length > 0;
|
||||
public ColorKey[] keys = new ColorKey[0];
|
||||
|
||||
public ColorModifier()
|
||||
{
|
||||
keys = new ColorKey[0];
|
||||
}
|
||||
|
||||
public override List<Key> GetKeys()
|
||||
{
|
||||
return new List<Key>(keys);
|
||||
}
|
||||
|
||||
public override void SetKeys(List<Key> input)
|
||||
{
|
||||
keys = new ColorKey[input.Count];
|
||||
for (int i = 0; i < input.Count; i++)
|
||||
{
|
||||
keys[i] = (ColorKey)input[i];
|
||||
}
|
||||
base.SetKeys(input);
|
||||
}
|
||||
|
||||
public void AddKey(double f, double t)
|
||||
{
|
||||
ArrayUtility.Add(ref keys, new ColorKey(f, t));
|
||||
}
|
||||
|
||||
public override void Apply(ref SplineSample result)
|
||||
{
|
||||
if (keys.Length == 0) return;
|
||||
base.Apply(ref result);
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
result.color = keys[i].Blend(result.color, keys[i].Evaluate(result.percent) * blend);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07c5bf379e882994f9828b66623ef12f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,75 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class FollowerSpeedModifier : SplineSampleModifier
|
||||
{
|
||||
[System.Serializable]
|
||||
public class SpeedKey : Key
|
||||
{
|
||||
public enum Mode { Add, Multiply }
|
||||
public float speed = 0f;
|
||||
public Mode mode = Mode.Add;
|
||||
|
||||
public SpeedKey(double f, double t) : base(f, t)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override bool hasKeys => keys.Count > 0;
|
||||
public List<SpeedKey> keys = new List<SpeedKey>();
|
||||
|
||||
public FollowerSpeedModifier()
|
||||
{
|
||||
keys = new List<SpeedKey>();
|
||||
}
|
||||
|
||||
public override List<Key> GetKeys()
|
||||
{
|
||||
List<Key> output = new List<Key>();
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
output.Add(keys[i]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public override void SetKeys(List<Key> input)
|
||||
{
|
||||
keys = new List<SpeedKey>();
|
||||
for (int i = 0; i < input.Count; i++)
|
||||
{
|
||||
//input[i]._modifier = this;
|
||||
keys.Add((SpeedKey)input[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddKey(double f, double t)
|
||||
{
|
||||
keys.Add(new SpeedKey(f, t));
|
||||
}
|
||||
|
||||
public override void Apply(ref SplineSample result)
|
||||
{
|
||||
}
|
||||
|
||||
public float GetSpeed(float input, double percent)
|
||||
{
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
float lerp = keys[i].Evaluate(percent);
|
||||
if(keys[i].mode == SpeedKey.Mode.Add)
|
||||
{
|
||||
input += keys[i].speed * lerp;
|
||||
} else
|
||||
{
|
||||
input *= Mathf.Lerp(1f, keys[i].speed, lerp);
|
||||
}
|
||||
}
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ef79d2db1fdbb54588b21a1643fabd2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class MeshScaleModifier : SplineSampleModifier
|
||||
{
|
||||
[System.Serializable]
|
||||
public class ScaleKey : Key
|
||||
{
|
||||
public Vector3 scale = Vector3.one;
|
||||
|
||||
public ScaleKey(double f, double t) : base(f, t)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override bool hasKeys => keys.Count > 0;
|
||||
public List<ScaleKey> keys = new List<ScaleKey>();
|
||||
|
||||
public MeshScaleModifier()
|
||||
{
|
||||
keys = new List<ScaleKey>();
|
||||
}
|
||||
|
||||
public override List<Key> GetKeys()
|
||||
{
|
||||
List<Key> output = new List<Key>();
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
output.Add(keys[i]);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public override void SetKeys(List<Key> input)
|
||||
{
|
||||
keys = new List<ScaleKey>();
|
||||
for (int i = 0; i < input.Count; i++)
|
||||
{
|
||||
keys.Add((ScaleKey)input[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddKey(double f, double t)
|
||||
{
|
||||
keys.Add(new ScaleKey(f, t));
|
||||
}
|
||||
|
||||
public override void Apply(ref SplineSample result)
|
||||
{
|
||||
if (keys.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
result.size += keys[i].Evaluate(result.percent) * keys[i].scale.magnitude * blend;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetScale(SplineSample sample)
|
||||
{
|
||||
Vector3 scale = Vector3.one;
|
||||
for (int i = 0; i < keys.Count; i++)
|
||||
{
|
||||
float lerp = keys[i].Evaluate(sample.percent);
|
||||
Vector3 scaleMultiplier = Vector3.Lerp(Vector3.one, keys[i].scale, lerp);
|
||||
scale.x *= scaleMultiplier.x;
|
||||
scale.y *= scaleMultiplier.y;
|
||||
scale.z *= scaleMultiplier.z;
|
||||
}
|
||||
return Vector3.Lerp(Vector3.one, scale, blend);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7be735bc80e43dc43984bdce01839e2e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class OffsetModifier : SplineSampleModifier
|
||||
{
|
||||
[System.Serializable]
|
||||
public class OffsetKey : Key
|
||||
{
|
||||
public Vector2 offset = Vector2.zero;
|
||||
public OffsetKey(Vector2 o, double f, double t) : base(f, t)
|
||||
{
|
||||
offset = o;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool hasKeys => keys.Length > 0;
|
||||
public OffsetKey[] keys = new OffsetKey[0];
|
||||
|
||||
public OffsetModifier()
|
||||
{
|
||||
keys = new OffsetKey[0];
|
||||
}
|
||||
|
||||
public override List<Key> GetKeys()
|
||||
{
|
||||
return new List<Key>(keys);
|
||||
}
|
||||
|
||||
public override void SetKeys(List<Key> input)
|
||||
{
|
||||
keys = new OffsetKey[input.Count];
|
||||
for (int i = 0; i < input.Count; i++)
|
||||
{
|
||||
keys[i] = (OffsetKey)input[i];
|
||||
}
|
||||
base.SetKeys(input);
|
||||
}
|
||||
|
||||
public void AddKey(Vector2 offset, double f, double t)
|
||||
{
|
||||
ArrayUtility.Add(ref keys, new OffsetKey(offset, f, t));
|
||||
}
|
||||
|
||||
public override void Apply(ref SplineSample result)
|
||||
{
|
||||
if (keys.Length == 0) return;
|
||||
base.Apply(ref result);
|
||||
Vector2 offset = Evaluate(result.percent);
|
||||
result.position += result.right * offset.x + result.up * offset.y;
|
||||
}
|
||||
|
||||
public Vector2 Evaluate(double time)
|
||||
{
|
||||
if (keys.Length == 0) return Vector2.zero;
|
||||
Vector2 offset = Vector2.zero;
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
offset += keys[i].offset * keys[i].Evaluate(time);
|
||||
}
|
||||
return offset * blend;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d0cc7c794f1e3148acddeb3d008c597
|
||||
timeCreated: 1482692196
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
[System.Serializable]
|
||||
public class RotationModifier : SplineSampleModifier
|
||||
{
|
||||
[System.Serializable]
|
||||
public class RotationKey : Key
|
||||
{
|
||||
public bool useLookTarget = false;
|
||||
public Transform target = null;
|
||||
public Vector3 rotation = Vector3.zero;
|
||||
|
||||
public RotationKey(Vector3 rotation, double f, double t) : base(f, t)
|
||||
{
|
||||
this.rotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool hasKeys => keys.Length > 0;
|
||||
public RotationKey[] keys = new RotationKey[0];
|
||||
|
||||
public RotationModifier()
|
||||
{
|
||||
keys = new RotationKey[0];
|
||||
}
|
||||
|
||||
public override List<Key> GetKeys()
|
||||
{
|
||||
return new List<Key>(keys);
|
||||
}
|
||||
|
||||
public override void SetKeys(List<Key> input)
|
||||
{
|
||||
keys = new RotationKey[input.Count];
|
||||
for (int i = 0; i < input.Count; i++)
|
||||
{
|
||||
keys[i] = (RotationKey)input[i];
|
||||
}
|
||||
base.SetKeys(input);
|
||||
}
|
||||
|
||||
public void AddKey(Vector3 rotation, double f, double t)
|
||||
{
|
||||
ArrayUtility.Add(ref keys, new RotationKey(rotation, f, t));
|
||||
}
|
||||
|
||||
public override void Apply(ref SplineSample result)
|
||||
{
|
||||
if (keys.Length == 0) return;
|
||||
base.Apply(ref result);
|
||||
|
||||
Quaternion offset = Quaternion.identity, look = result.rotation;
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
if (keys[i].useLookTarget && keys[i].target != null)
|
||||
{
|
||||
Quaternion lookDir = Quaternion.LookRotation(keys[i].target.position - result.position);
|
||||
look = Quaternion.Slerp(look, lookDir, keys[i].Evaluate(result.percent) * blend);
|
||||
}
|
||||
else
|
||||
{
|
||||
Quaternion euler = Quaternion.Euler(keys[i].rotation.x, keys[i].rotation.y, keys[i].rotation.z);
|
||||
offset = Quaternion.Slerp(offset, offset * euler, keys[i].Evaluate(result.percent) * blend);
|
||||
}
|
||||
}
|
||||
Quaternion rotation = look * offset;
|
||||
Vector3 invertedNormal = Quaternion.Inverse(result.rotation) * result.up;
|
||||
result.forward = rotation * Vector3.forward;
|
||||
result.up = rotation * invertedNormal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0049066920c0f4549af72ec0044c71c6
|
||||
timeCreated: 1482692196
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,58 @@
|
||||
namespace Dreamteck.Splines
|
||||
{
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class SizeModifier : SplineSampleModifier
|
||||
{
|
||||
[System.Serializable]
|
||||
public class SizeKey : Key
|
||||
{
|
||||
public float size = 0f;
|
||||
|
||||
public SizeKey(double f, double t) : base(f, t)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override bool hasKeys => keys.Length > 0;
|
||||
public SizeKey[] keys = new SizeKey[0];
|
||||
|
||||
public SizeModifier()
|
||||
{
|
||||
keys = new SizeKey[0];
|
||||
}
|
||||
|
||||
public override List<Key> GetKeys()
|
||||
{
|
||||
return new List<Key>(keys);
|
||||
}
|
||||
|
||||
public override void SetKeys(List<Key> input)
|
||||
{
|
||||
keys = new SizeKey[input.Count];
|
||||
for (int i = 0; i < input.Count; i++)
|
||||
{
|
||||
keys[i] = (SizeKey)input[i];
|
||||
}
|
||||
base.SetKeys(input);
|
||||
}
|
||||
|
||||
public void AddKey(double f, double t)
|
||||
{
|
||||
ArrayUtility.Add(ref keys, new SizeKey(f, t));
|
||||
}
|
||||
|
||||
public override void Apply(ref SplineSample result)
|
||||
{
|
||||
if (keys.Length == 0) return;
|
||||
base.Apply(ref result);
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
result.size += keys[i].Evaluate(result.percent) * keys[i].size * blend;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 896008ffd57dfab499f9f0745f7dbb4f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||