summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--globals.cginc6
-rw-r--r--vertex.cginc10
-rw-r--r--vertex_deformation.slang9
3 files changed, 13 insertions, 12 deletions
diff --git a/globals.cginc b/globals.cginc
index 2a4410f..75030ac 100644
--- a/globals.cginc
+++ b/globals.cginc
@@ -75,10 +75,10 @@ float _Vertex_Deformation_Seal_t;
#endif // _VERTEX_DEFORMATION_SEAL
#if defined(_VERTEX_DEFORMATION_SINE_WAVES)
-float4 _Vertex_Deformation_Sine_Waves_Amplitude;
+float3 _Vertex_Deformation_Sine_Waves_Amplitude;
float3 _Vertex_Deformation_Sine_Waves_Direction;
-float4 _Vertex_Deformation_Sine_Waves_k;
-float4 _Vertex_Deformation_Sine_Waves_omega;
+float3 _Vertex_Deformation_Sine_Waves_k;
+float3 _Vertex_Deformation_Sine_Waves_omega;
#endif // _VERTEX_DEFORMATION_SINE_WAVES
#if defined(_UV_SCROLL)
diff --git a/vertex.cginc b/vertex.cginc
index a18215a..84185c6 100644
--- a/vertex.cginc
+++ b/vertex.cginc
@@ -39,8 +39,8 @@ void deform(inout float3 objPos) {
float t = _Time[3];
float3 amplitude = _Vertex_Deformation_Sine_Waves_Amplitude;
float3 direction = _Vertex_Deformation_Sine_Waves_Direction;
- float4 k = _Vertex_Deformation_Sine_Waves_k;
- float4 omega = _Vertex_Deformation_Sine_Waves_omega;
+ float3 k = _Vertex_Deformation_Sine_Waves_k;
+ float3 omega = _Vertex_Deformation_Sine_Waves_omega;
objPos = sine_wave(objPos.xyz, amplitude, direction, k, omega, t);
}
#endif // _VERTEX_DEFORMATION_SINE_WAVES
@@ -76,10 +76,10 @@ void deform_normal(float3 objPos, inout float3 objNorm, inout float3 objTan) {
#if defined(_VERTEX_DEFORMATION_SINE_WAVES)
{
float t = _Time[3];
- float4 amplitude = _Vertex_Deformation_Sine_Waves_Amplitude;
+ float3 amplitude = _Vertex_Deformation_Sine_Waves_Amplitude;
float3 direction = _Vertex_Deformation_Sine_Waves_Direction;
- float4 k = _Vertex_Deformation_Sine_Waves_k;
- float4 omega = _Vertex_Deformation_Sine_Waves_omega;
+ float3 k = _Vertex_Deformation_Sine_Waves_k;
+ float3 omega = _Vertex_Deformation_Sine_Waves_omega;
sine_wave_normal(objPos, objNorm, objTan, amplitude, direction, k, omega, t);
}
#endif // _VERTEX_DEFORMATION_SINE_WAVES
diff --git a/vertex_deformation.slang b/vertex_deformation.slang
index f4d4132..354290c 100644
--- a/vertex_deformation.slang
+++ b/vertex_deformation.slang
@@ -39,7 +39,8 @@
#define R3R3_NORMALS(xyz, normal, tangent, fun, ...) \
R3R3_DECLARE_BASIS_VECTORS(xyz); \
R3R3_AUTODIFF_BASIS_VECTORS(fun, __VA_ARGS__); \
- R3R3_DEFORM_NORMAL_AND_TANGENT(normal, tangent)
+ R3R3_DEFORM_NORMAL_AND_TANGENT(normal, tangent); \
+ xyz = fun(xyz, __VA_ARGS__)
float3x3 inverse(float3x3 m, float det) {
det = max(1e-6 * abs(det), abs(det)) * sign(det);
@@ -78,7 +79,7 @@ public float3 plane_to_tube(float3 xyz, no_diff float t) {
return float3(x, y0, z);
}
-public void plane_to_tube_normal(float3 xyz, inout float3 normal,
+public void plane_to_tube_normal(inout float3 xyz, inout float3 normal,
inout float3 tangent, float t) {
R3R3_NORMALS(xyz, normal, tangent, plane_to_tube, t);
}
@@ -104,7 +105,7 @@ public float3 seal(float3 xyz, no_diff float A, no_diff float k, no_diff float t
);
}
-public void seal_normal(float3 xyz, inout float3 normal,
+public void seal_normal(inout float3 xyz, inout float3 normal,
inout float3 tangent, float A, float k, float t) {
R3R3_NORMALS(xyz, normal, tangent, seal, A, k, t);
}
@@ -120,7 +121,7 @@ public float3 sine_wave(float3 xyz,
return xyz;
}
-public void sine_wave_normal(float3 xyz, inout float3 normal, inout float3 tangent,
+public void sine_wave_normal(inout float3 xyz, inout float3 normal, inout float3 tangent,
float3 amplitude, float3 direction, float3 k, float3 omega, float t) {
R3R3_NORMALS(xyz, normal, tangent, sine_wave, amplitude, direction, k, omega, t);
}