summaryrefslogtreecommitdiffstats
path: root/vertex.cginc
blob: 2f5b5f5e54db129b8d0daafc7dcd56facc9a0cfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __VERTEX_INC
#define __VERTEX_INC

#include "custom31.hlsl"

void deform(inout float3 objPos) {
#if defined(_CUSTOM31_XZ_TUBE)
  {
    float t = _Custom31_XZ_Tube_t;
    objPos = plane_to_tube(objPos.xyz, t);
  }
#endif  // _CUSTOM31_XZ_TUBE
#if defined(_CUSTOM31_YZ_TUBE)
  {
    float t = _Custom31_YZ_Tube_t;
    objPos = plane_to_tube(objPos.yxz, t);
    objPos = objPos.yxz;
  }
#endif  // _CUSTOM31_YZ_TUBE
#if defined(_CUSTOM31_XY_TUBE)
  {
    float t = _Custom31_XY_Tube_t;
    objPos = plane_to_tube(objPos.xzy, t);
    objPos = objPos.xzy;
  }
#endif  // _CUSTOM31_XY_TUBE
}

void deform_normal(float3 objPos, inout float3 objNorm, inout float3 objTan) {
#if defined(_CUSTOM31_XZ_TUBE)
  {
    float t = _Custom31_XZ_Tube_t;
    plane_to_tube_normal(objPos, objNorm, objTan, t);
  }
#endif  // _CUSTOM31_XZ_TUBE
#if defined(_CUSTOM31_YZ_TUBE)
  {
    float t = _Custom31_YZ_Tube_t;
    plane_to_tube_normal(objPos.yxz, objNorm.yxz, objTan.yxz, t);
  }
#endif  // _CUSTOM31_YZ_TUBE
#if defined(_CUSTOM31_XY_TUBE)
  {
    float t = _Custom31_XY_Tube_t;
    plane_to_tube_normal(objPos.xzy, objNorm.xzy, objTan.xzy, t);
  }
#endif  // _CUSTOM31_XY_TUBE
}

void propagateObjPos(inout v2f i) {
  i.worldPos = mul(unity_ObjectToWorld, float4(i.objPos, 1));
  i.pos = UnityObjectToClipPos(i.objPos);
  i.eyeVec.xyz = i.worldPos - _WorldSpaceCameraPos;
}

#endif  // __VERTEX_INC