25 auto &voxel_size =
b.add_input<
decl::Float>(
"Voxel Size")
37 .description(
"Width of the gradient inside of the mesh");
40 const bNode *node =
b.node_or_null();
41 if (node !=
nullptr) {
69 const float density =
params.get_input<
float>(
"Density");
70 const float interior_band_width =
params.get_input<
float>(
"Interior Band Width");
75 resolution.settings.voxel_amount =
params.get_input<
float>(
"Voxel Amount");
76 if (resolution.settings.voxel_amount <= 0.0f) {
81 resolution.settings.voxel_size =
params.get_input<
float>(
"Voxel Size");
82 if (resolution.settings.voxel_size <= 0.0f) {
87 if (mesh.verts_num == 0 || mesh.faces_num == 0) {
93 const float voxel_size = geometry::volume_compute_voxel_size(
95 [&]() { return *mesh.bounds_min_max(); },
98 mesh_to_volume_space_transform);
103 geometry::fog_volume_grid_add_from_mesh(volume,
105 mesh.vert_positions(),
108 mesh_to_volume_space_transform,
124 Volume *volume = create_volume_from_mesh(*geometry_set.get_mesh(), params);
125 geometry_set.replace_volume(volume);
126 geometry_set.keep_only_during_modify({GeometryComponent::Type::Volume});
129 params.set_output(
"Volume", std::move(geometry_set));
143 "Desired number of voxels along one axis"},
148 "Desired voxel side length"},
149 {0,
nullptr, 0,
nullptr,
nullptr},
155 "How the voxel size is specified",
156 resolution_mode_items,
167 bke::node_type_size(&ntype, 200, 120, 700);
void * BKE_id_new_nomain(short type, const char *name)
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define BLT_I18NCONTEXT_ID_ID
MeshToVolumeModifierResolutionMode
@ MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_SIZE
@ MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
local_group_size(16, 16) .push_constant(Type b
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
static void node_init(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_register()
static void node_rna(StructRNA *srna)
static void node_geo_exec(GeoNodeExecParams params)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
void node_geo_exec_with_missing_openvdb(GeoNodeExecParams ¶ms)
MatBase< float, 4, 4 > float4x4
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
static MatBase identity()
void modify_geometry_sets(ForeachSubGeometryCallback callback)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
MeshToVolumeModifierResolutionMode mode