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
55
Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute
Normal file
55
Assets/Plugins/GPUTrail/Shaders/GPUTrailVariablesCS.compute
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#ifndef GPUTRAIL_VARIABLES_CS_INCLUDED
|
||||
#define GPUTRAIL_VARIABLES_CS_INCLUDED
|
||||
|
||||
#include "GPUTrailInput.cginc"
|
||||
#include "GPUTrailVertex.cginc"
|
||||
|
||||
// #define LERP_TYPE_NONE 0
|
||||
// #define LERP_TYPE_SPLINE 1
|
||||
|
||||
struct Trail
|
||||
{
|
||||
float startTime;
|
||||
uint totalInputNum;
|
||||
};
|
||||
|
||||
struct Node
|
||||
{
|
||||
float3 pos;
|
||||
float time;
|
||||
half4 color;
|
||||
};
|
||||
|
||||
uint _TrailNum;
|
||||
uint _NodeNumPerTrail;
|
||||
uint _InputNodeNum;
|
||||
// uint _LerpType;
|
||||
float _MinNodeDistance;
|
||||
float _Time;
|
||||
float _Life;
|
||||
float3 _ToCameraDir; // for orthographics camera
|
||||
float3 _CameraPos; // for perspective camera
|
||||
float _StartWidth;
|
||||
float _EndWidth;
|
||||
|
||||
|
||||
uint calcTrailIdx(uint nodeIdx)
|
||||
{
|
||||
return nodeIdx / _NodeNumPerTrail;
|
||||
}
|
||||
uint calcNodeIdx(uint trailIdx, uint nodeIdxInTrail)
|
||||
{
|
||||
return (trailIdx * _NodeNumPerTrail) + (nodeIdxInTrail % _NodeNumPerTrail);
|
||||
}
|
||||
|
||||
inline bool useToCameraDir()
|
||||
{
|
||||
return all(_ToCameraDir == 0);
|
||||
}
|
||||
|
||||
inline float3 calcToCameraDir(float3 pos)
|
||||
{
|
||||
return useToCameraDir() ? normalize(_CameraPos - pos) : _ToCameraDir;
|
||||
}
|
||||
|
||||
#endif // GPUTRAIL_VARIABLES_CS_INCLUDED
|
||||
Loading…
Reference in a new issue