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:
authorAaron Carlisle <Blendify>2022-01-03 07:34:56 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2022-01-03 07:35:20 +0300
commit367fc69dc1c5ebb6e30ef74488a041502ea8a370 (patch)
treedc730e38ebcaed70e402f69b9542f7dda5b62c5f /source/blender/nodes/shader/nodes/node_shader_particle_info.cc
parent8be217ada5754b065723dc85c250cf2b60f14e2e (diff)
Nodes: Convert several shader nodes to c++
Also add file namespace This is needed to use new node APIs Differential Revision: https://developer.blender.org/D13690
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_particle_info.cc')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.cc82
1 files changed, 82 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
new file mode 100644
index 00000000000..8a054b19c71
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
@@ -0,0 +1,82 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ */
+
+#include "../node_shader_util.h"
+
+#include "RE_texture.h"
+
+namespace blender::nodes::node_shader_particle_info_cc {
+
+static bNodeSocketTemplate outputs[] = {
+ {SOCK_FLOAT, "Index"},
+ {SOCK_FLOAT, "Random"},
+ {SOCK_FLOAT, "Age"},
+ {SOCK_FLOAT, "Lifetime"},
+ {SOCK_VECTOR, "Location"},
+#if 0 /* quaternion sockets not yet supported */
+ {SOCK_QUATERNION, "Rotation"},
+#endif
+ {SOCK_FLOAT, "Size"},
+ {SOCK_VECTOR, "Velocity"},
+ {SOCK_VECTOR, "Angular Velocity"},
+ {-1, ""},
+};
+static void node_shader_exec_particle_info(void *UNUSED(data),
+ int UNUSED(thread),
+ bNode *UNUSED(node),
+ bNodeExecData *UNUSED(execdata),
+ bNodeStack **UNUSED(in),
+ bNodeStack **UNUSED(out))
+{
+}
+
+static int gpu_shader_particle_info(GPUMaterial *mat,
+ bNode *node,
+ bNodeExecData *UNUSED(execdata),
+ GPUNodeStack *in,
+ GPUNodeStack *out)
+{
+
+ return GPU_stack_link(mat,
+ node,
+ "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));
+}
+
+} // namespace blender::nodes::node_shader_particle_info_cc
+
+/* node type definition */
+void register_node_type_sh_particle_info()
+{
+ namespace file_ns = blender::nodes::node_shader_particle_info_cc;
+
+ static bNodeType ntype;
+
+ sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0);
+ node_type_socket_templates(&ntype, nullptr, file_ns::outputs);
+ node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_particle_info);
+ node_type_gpu(&ntype, file_ns::gpu_shader_particle_info);
+
+ nodeRegisterType(&ntype);
+}