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:
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_particle_info.c')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
index 05f7301776f..6cc8de322af 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
@@ -26,6 +26,7 @@
*/
#include "../node_shader_util.h"
+#include "RE_shader_ext.h"
static bNodeSocketTemplate outputs[] = {
{ SOCK_FLOAT, 0, "Index" },
@@ -40,6 +41,22 @@ static bNodeSocketTemplate outputs[] = {
{ SOCK_VECTOR, 0, "Angular Velocity" },
{ -1, 0, "" }
};
+static void node_shader_exec_particle_info(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out)
+{
+ ShadeInput *shi = ((ShaderCallData *)data)->shi;
+
+ RE_instance_get_particle_info(shi->obi, out[0]->vec, out[1]->vec, out[2]->vec, out[3]->vec, out[4]->vec, out[5]->vec, out[6]->vec);
+}
+
+static int gpu_shader_particle_info(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+
+ return GPU_stack_link(mat, "particle_info", in, out,
+ GPU_builtin(GPU_PARTICLE_SCALAR_PROPS),
+ GPU_builtin(GPU_PARTICLE_LOCATION),
+ GPU_builtin(GPU_PARTICLE_VELOCITY),
+ GPU_builtin(GPU_PARTICLE_ANG_VELOCITY));
+}
/* node type definition */
void register_node_type_sh_particle_info(void)
@@ -47,8 +64,10 @@ void register_node_type_sh_particle_info(void)
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0);
- node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING | NODE_OLD_SHADING);
node_type_socket_templates(&ntype, NULL, outputs);
+ node_type_exec(&ntype, NULL, NULL, node_shader_exec_particle_info);
+ node_type_gpu(&ntype, gpu_shader_particle_info);
nodeRegisterType(&ntype);
}