27 .description(
"Distance from the generated points to the origin");
32 .
description(
"Number of subdivisions on top of the basic icosahedron");
34 b.add_output<
decl::Vector>(
"UV Map"_ustr).anonymous_attribute_output();
40 const float theta = std::cos(std::atan(0.5f));
41 const float ro = radius * std::sin(
delta_phi);
44 float x_min = -radius;
46 float y_min = -radius;
48 if (subdivisions == 1) {
49 x_max = radius * theta;
54 else if (subdivisions == 2) {
59 const float3 bounds_min(x_min, y_min, -radius);
60 const float3 bounds_max(x_max, y_max, radius);
62 return {bounds_min, bounds_max};
67 const std::optional<std::string> &uv_map_id)
69 if (subdivisions >= 3) {
77 const bool create_uv_map = bool(uv_map_id);
91 "create_icosphere subdivisions=%i radius=%f matrix=%m4 calc_uvs=%b",
110 *uv_map_id, AttrDomain::Corner);
111 uv_map.span.copy_from(orig_uv_map);
114 attributes.
remove(
"UVMap");
125 const int subdivisions = std::min(params.
extract_input<
int>(
"Subdivisions"_ustr), 10);
126 const float radius = params.
extract_input<
float>(
"Radius"_ustr);
141 ntype.
ui_description =
"Generate a spherical mesh that consists of equally sized triangles";
General operations, lookup, etc. for materials.
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define BMO_FLAG_DEFAULTS
ccl_device_inline float delta_phi(const int p, const float gamma_o, const float gamma_t)
GAttributeReader lookup(const StringRef name) const
bool remove(const StringRef name)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
std::optional< std::string > get_output_anonymous_attribute_id_if_needed(const UString output_identifier, const bool force_create=false)
T extract_input(const UString identifier)
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
void debug_randomize_mesh_order(Mesh *mesh)
static Mesh * create_ico_sphere_mesh(const int subdivisions, const float radius, const std::optional< std::string > &uv_map_id)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
static void node_geo_exec(GeoNodeExecParams params)
static Bounds< float3 > calculate_bounds_ico_sphere(const float radius, const int subdivisions)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
void BKE_id_material_eval_ensure_default_slot(ID *id)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
void * BKE_id_new_nomain(short type, const char *name)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const StringRef name)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
void BM_uv_map_attr_pin_ensure_for_all_layers(BMesh *bm)
VecBase< float, 3 > float3
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static MatBase identity()
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
NodeDeclareFunction declare
static GeometrySet from_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)