diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-07-20 13:15:54 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-07-20 13:15:54 +0300 |
commit | b044546587f049eaf39dd672217ac701bd828fac (patch) | |
tree | 6ab054a43a073a90b6ce4c397b8d28e2eb3703a8 /source/blender/editors/space_view3d | |
parent | 454cae8361392fea5c241cf89da5f9f2dd2080b5 (diff) |
Node API for generating hair deformation GLSL code.
This is just a stub atm. The BVM system will use nodes to generate
a GLSL function, which can then be inserted into and compiled with
a framework shader. The deformation function itself is just a simple
expression (with autodiff for tangents), so it doesn't need to know
about the topology of index buffers and the like.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/drawstrands.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/drawstrands.c b/source/blender/editors/space_view3d/drawstrands.c index 78ca1137b0c..3dfe049cd8a 100644 --- a/source/blender/editors/space_view3d/drawstrands.c +++ b/source/blender/editors/space_view3d/drawstrands.c @@ -32,6 +32,7 @@ #include "MEM_guardedalloc.h" #include "DNA_modifier_types.h" +#include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -146,6 +147,21 @@ void draw_strands(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d, shader_params.use_geomshader = use_geomshader; shader_params.shader_model = get_shader_model(smd->shader_model); + /* XXX TODO not nice, we can potentially have multiple hair + * subtrees and it's not clear yet how these would be combined. + * For the time being just select the first and expect it to be the only one ... + */ + shader_params.nodes = NULL; + if (ob->nodetree) { + bNode *node; + for (node = ob->nodetree->nodes.first; node; node = node->next) { + if (STREQ(node->idname, "HairNode")) { + shader_params.nodes = (bNodeTree *)node->id; + break; + } + } + } + strands->gpu_shader = GPU_strand_shader_create(&shader_params); } GPUStrandsShader *shader = strands->gpu_shader; |