summaryrefslogtreecommitdiffstats
path: root/vertex.cginc
diff options
context:
space:
mode:
Diffstat (limited to 'vertex.cginc')
-rw-r--r--vertex.cginc23
1 files changed, 23 insertions, 0 deletions
diff --git a/vertex.cginc b/vertex.cginc
index ac2c6aa..e59813c 100644
--- a/vertex.cginc
+++ b/vertex.cginc
@@ -13,6 +13,7 @@
#define OPCODE_SEAL 6
#define OPCODE_SINE_WAVES 7
#define OPCODE_FBM 8
+#define OPCODE_PLANE_TO_HEMI_OCTAHEDRON 9
#if defined(_VERTEX_DEFORMATION)
@@ -148,6 +149,22 @@ void apply_fbm_normal(inout float3 objPos, inout float3 objNorm, inout float3 ob
fbm_normal(objPos, objNorm, objTan, st, amplitude, gain, lacunarity, period, octaves, velocity);
}
+void apply_plane_to_hemi_octahedron(inout float3 objPos, float4 v0, float4 v1, float4 v2, float f0) {
+ float3 p = v0.xyz;
+ float3 r = v1.xyz;
+ float3 s = v2.xyz;
+ float t = f0;
+ objPos = plane_to_hemi_octahedron(objPos, p, r, s, t);
+}
+
+void apply_plane_to_hemi_octahedron_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTan, float4 v0, float4 v1, float4 v2, float f0) {
+ float3 p = v0.xyz;
+ float3 r = v1.xyz;
+ float3 s = v2.xyz;
+ float t = f0;
+ plane_to_hemi_octahedron_normal(objPos, objNorm, objTan, p, r, s, t);
+}
+
void deform(inout float3 objPos) {
const float t = getTime();
@@ -380,6 +397,9 @@ void deform(inout float3 objPos) {
case OPCODE_FBM:
apply_fbm(objPos, v0, v1, v2, f0, f1, f2, t);
break;
+ case OPCODE_PLANE_TO_HEMI_OCTAHEDRON:
+ apply_plane_to_hemi_octahedron(objPos, v0, v1, v2, f0);
+ break;
}
}
}
@@ -619,6 +639,9 @@ void deform_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTa
case OPCODE_FBM:
apply_fbm_normal(objPos, objNorm, objTan, v0, v1, v2, f0, f1, f2, t);
break;
+ case OPCODE_PLANE_TO_HEMI_OCTAHEDRON:
+ apply_plane_to_hemi_octahedron_normal(objPos, objNorm, objTan, v0, v1, v2, f0);
+ break;
}
}
}