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
|
|
@ -0,0 +1,30 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class GPUTrailSplineSample : MonoBehaviour
|
||||
{
|
||||
public int step = 10;
|
||||
public List<Transform> _transforms = new List<Transform>();
|
||||
|
||||
|
||||
public void OnDrawGizmos()
|
||||
{
|
||||
var stepInv = 1f / step;
|
||||
for(var i=2; i<_transforms.Count; ++i)
|
||||
{
|
||||
for(var s=0; s< step; ++s)
|
||||
{
|
||||
var prev = _transforms[i - 2].position;
|
||||
var start = _transforms[i - 1].position;
|
||||
var end = _transforms[i].position;
|
||||
|
||||
var pos = GPUTrailSpline.CatmullRom(stepInv * s, prev, start, end);
|
||||
var posNext = GPUTrailSpline.CatmullRom(stepInv * (s+1), prev, start, end);
|
||||
|
||||
|
||||
Gizmos.DrawLine(pos, posNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue