25 b.add_input<
decl::Geometry>(
"Mesh").supported_type(GeometryComponent::Type::Mesh);
27 auto &voxel_size =
b.add_input<
decl::Float>(
"Voxel Size")
39 .description(
"Width of the gradient inside of the mesh");
42 const bNode *node =
b.node_or_null();
43 if (node !=
nullptr) {
71 const float density =
params.get_input<
float>(
"Density");
72 const float interior_band_width =
params.get_input<
float>(
"Interior Band Width");
77 resolution.settings.voxel_amount =
params.get_input<
float>(
"Voxel Amount");
78 if (resolution.settings.voxel_amount <= 0.0f) {
83 resolution.settings.voxel_size =
params.get_input<
float>(
"Voxel Size");
84 if (resolution.settings.voxel_size <= 0.0f) {
89 if (mesh.verts_num == 0 || mesh.faces_num == 0) {
95 const float voxel_size = geometry::volume_compute_voxel_size(
97 [&]() { return *mesh.bounds_min_max(); },
100 mesh_to_volume_space_transform);
105 geometry::fog_volume_grid_add_from_mesh(volume,
107 mesh.vert_positions(),
110 mesh_to_volume_space_transform,
131 params.set_output(
"Volume", std::move(geometry_set));
145 "Desired number of voxels along one axis"},
150 "Desired voxel side length"},
151 {0,
nullptr, 0,
nullptr,
nullptr},
157 "How the voxel size is specified",
158 resolution_mode_items,
168 ntype.
ui_name =
"Mesh to Volume";
169 ntype.
ui_description =
"Create a fog volume with the shape of the input mesh's surface";
void * BKE_id_new_nomain(short type, const char *name)
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_MESH_TO_VOLUME
#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)
BMesh const char void * data
std::optional< std::string > translation_context
void * MEM_callocN(size_t len, const char *str)
void node_type_size(bNodeType &ntype, int width, int minwidth, int maxwidth)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
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, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
static MatBase identity()
void replace_volume(Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void keep_only_during_modify(Span< GeometryComponent::Type > component_types)
const Mesh * get_mesh() const
void modify_geometry_sets(ForeachSubGeometryCallback callback)
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
MeshToVolumeModifierResolutionMode mode
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)