Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-09-20 18:41:07 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-09-20 18:53:47 +0300
commit667add5fc5b743a324b508e3c5cedfde1df218c0 (patch)
treee3f3d9f7b4f46d0ce6e351959ba669f13382e650 /source/blender/nodes/shader
parent5c20161f81c75a4139cb3c865955f53a9880f627 (diff)
Eevee: Implement Wireframe Node
This implementation is a bit hacky but match cycles pretty close. If pixel size is not enabled, it will use the geom shader to compute distances between vertices. This will have a cost. Implementation is a bit hacky in gpu_codegen to make the geom shader works in an optional manner.
Diffstat (limited to 'source/blender/nodes/shader')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_wireframe.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.c b/source/blender/nodes/shader/nodes/node_shader_wireframe.c
index 11d889def31..3592f98d81d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_wireframe.c
+++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.c
@@ -38,6 +38,17 @@ static bNodeSocketTemplate sh_node_wireframe_out[] = {
{ -1, 0, "" }
};
+static int node_shader_gpu_wireframe(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+ /* node->custom1 is use_pixel_size */
+ if (node->custom1) {
+ return GPU_stack_link(mat, node, "node_wireframe_screenspace", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO));
+ }
+ else {
+ return GPU_stack_link(mat, node, "node_wireframe", in, out, GPU_builtin(GPU_BARYCENTRIC_TEXCO), GPU_builtin(GPU_BARYCENTRIC_DIST));
+ }
+}
+
/* node type definition */
void register_node_type_sh_wireframe(void)
{
@@ -47,6 +58,7 @@ void register_node_type_sh_wireframe(void)
node_type_socket_templates(&ntype, sh_node_wireframe_in, sh_node_wireframe_out);
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
+ node_type_gpu(&ntype, node_shader_gpu_wireframe);
nodeRegisterType(&ntype);
}