diff options
Diffstat (limited to 'vertex.cginc')
| -rwxr-xr-x | vertex.cginc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vertex.cginc b/vertex.cginc index 2e0c1dd..7c448ab 100755 --- a/vertex.cginc +++ b/vertex.cginc @@ -16,6 +16,7 @@ #define OPCODE_PLANE_TO_HEMI_OCTAHEDRON 9 #define OPCODE_HEMI_OCTAHEDRON_TO_PLANE 10 #define OPCODE_SCALE 11 +#define OPCODE_TRANSLATE 12 #if defined(_VERTEX_DEFORMATION) @@ -196,6 +197,19 @@ void apply_scale_normal(inout float3 objPos, inout float3 objNorm, scale_normal(objPos, objNorm, objTan, k, t); } +void apply_translate(inout float3 objPos, float4 v0, float f0) { + float3 offset = v0.xyz; + float t = f0; + objPos = translate(objPos, offset, t); +} + +void apply_translate_normal(inout float3 objPos, inout float3 objNorm, + inout float3 objTan, float4 v0, float f0) { + float3 offset = v0.xyz; + float t = f0; + translate_normal(objPos, objNorm, objTan, offset, t); +} + void deform(inout float3 objPos) { const float t = getTime(); @@ -437,6 +451,9 @@ void deform(inout float3 objPos) { case OPCODE_SCALE: apply_scale(objPos, v0, f0); break; + case OPCODE_TRANSLATE: + apply_translate(objPos, v0, f0); + break; } } } @@ -685,6 +702,9 @@ void deform_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTa case OPCODE_SCALE: apply_scale_normal(objPos, objNorm, objTan, v0, f0); break; + case OPCODE_TRANSLATE: + apply_translate_normal(objPos, objNorm, objTan, v0, f0); + break; } } } |
