Lightning
Created Lightning Gun effect (Uses LineRenderer, very slow) Created GPU Lightning renderer (very fast, still needs integration)
This commit is contained in:
parent
3a9ee2ccf7
commit
bb297bf84c
100 changed files with 7105 additions and 13 deletions
26
Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs
Normal file
26
Assets/Plugins/GPUTrail/Scripts/GPUTrailSpline.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class GPUTrailSpline : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// start~end をつなぐ曲線上の点をtに応じて求める
|
||||
/// http://t-pot.com/program/2_3rdcurve/index.html
|
||||
/// </summary>
|
||||
/// <param name="t">0f~1f</param>
|
||||
/// <param name="prev"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <returns></returns>
|
||||
public static Vector3 CatmullRom(float t, Vector3 prev, Vector3 start, Vector3 end)
|
||||
{
|
||||
var t2 = t * t;
|
||||
|
||||
return
|
||||
0.5f * (
|
||||
t2 * (prev - 2f * start + end)
|
||||
+ t * (-prev + end)
|
||||
)
|
||||
+ start;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue