diff options
| author | yum <yum.food.vr@gmail.com> | 2026-02-16 16:55:50 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-02-16 16:55:50 -0800 |
| commit | 0783345c23701149b807d2063410e329ba1fbed6 (patch) | |
| tree | d1ee5739255fa137af0dea647ef5c79325a0816d /vertex.cginc | |
| parent | 864c2ba12dc864d9cb55cb797ba8919bee5b5913 (diff) | |
Fold: add translate node
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; } } } |
