diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-08 23:50:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-08 23:50:17 +0300 |
commit | b43ce7908fbb4be7ed2d230579c836aa7045d2c7 (patch) | |
tree | 23cc4d49217b516a254289eac8e3180904d816ba /source/blender/gpu/intern | |
parent | 4f114419137e76acde2d60d256d470c5a7a4232b (diff) |
Eevee: Fix broken Vector Transform node
The Camera to Object space matrix was not implemented in gpu_codegen.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 2f5aad71664..952886bafed 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -715,6 +715,10 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final BLI_dynstr_append(ds, "viewmat"); else if (input->builtin == GPU_CAMERA_TEXCO_FACTORS) BLI_dynstr_append(ds, "camtexfac"); + else if (input->builtin == GPU_LOC_TO_VIEW_MATRIX) + BLI_dynstr_append(ds, "localtoviewmat"); + else if (input->builtin == GPU_INVERSE_LOC_TO_VIEW_MATRIX) + BLI_dynstr_append(ds, "invlocaltoviewmat"); else if (input->builtin == GPU_BARYCENTRIC_DIST) BLI_dynstr_append(ds, "barycentricDist"); else if (input->builtin == GPU_BARYCENTRIC_TEXCO) @@ -792,19 +796,23 @@ static char *code_generate_fragment(GPUMaterial *material, ListBase *nodes, GPUO } /* TODO(fclem) get rid of that. */ if (builtins & GPU_VIEW_MATRIX) - BLI_dynstr_append(ds, "\tmat4 viewmat = ViewMatrix;\n"); + BLI_dynstr_append(ds, "\t#define viewmat ViewMatrix\n"); if (builtins & GPU_CAMERA_TEXCO_FACTORS) - BLI_dynstr_append(ds, "\tvec4 camtexfac = CameraTexCoFactors;\n"); + BLI_dynstr_append(ds, "\t#define camtexfac CameraTexCoFactors\n"); if (builtins & GPU_OBJECT_MATRIX) - BLI_dynstr_append(ds, "\tmat4 objmat = ModelMatrix;\n"); + BLI_dynstr_append(ds, "\t#define objmat ModelMatrix\n"); if (builtins & GPU_INVERSE_OBJECT_MATRIX) - BLI_dynstr_append(ds, "\tmat4 objinv = ModelMatrixInverse;\n"); + BLI_dynstr_append(ds, "\t#define objinv ModelMatrixInverse\n"); if (builtins & GPU_INVERSE_VIEW_MATRIX) - BLI_dynstr_append(ds, "\tmat4 viewinv = ViewMatrixInverse;\n"); + BLI_dynstr_append(ds, "\t#define viewinv ViewMatrixInverse\n"); + if (builtins & GPU_LOC_TO_VIEW_MATRIX) + BLI_dynstr_append(ds, "\t#define localtoviewmat ModelViewMatrix\n"); + if (builtins & GPU_INVERSE_LOC_TO_VIEW_MATRIX) + BLI_dynstr_append(ds, "\t#define invlocaltoviewmat ModelViewMatrixInverse\n"); if (builtins & GPU_VIEW_NORMAL) BLI_dynstr_append(ds, "\tvec3 facingnormal = gl_FrontFacing? viewNormal: -viewNormal;\n"); if (builtins & GPU_VIEW_POSITION) - BLI_dynstr_append(ds, "\tvec3 viewposition = viewPosition;\n"); + BLI_dynstr_append(ds, "\t#define viewposition viewPosition\n"); codegen_declare_tmps(ds, nodes); codegen_call_functions(ds, nodes, output); |