25 .description(
"Distance from the generated points to the origin");
30 .
description(
"Number of subdivisions on top of the basic icosahedron");
38 const float theta = std::cos(std::atan(0.5f));
39 const float ro = radius * std::sin(
delta_phi);
42 float x_min = -radius;
44 float y_min = -radius;
46 if (subdivisions == 1) {
47 x_max = radius * theta;
52 else if (subdivisions == 2) {
57 const float3 bounds_min(x_min, y_min, -radius);
58 const float3 bounds_max(x_max, y_max, radius);
60 return {bounds_min, bounds_max};
65 const std::optional<std::string> &uv_map_id)
67 if (subdivisions >= 3) {
75 const bool create_uv_map = bool(uv_map_id);
89 "create_icosphere subdivisions=%i radius=%f matrix=%m4 calc_uvs=%b",
96 params.calc_object_remap =
false;
108 *uv_map_id, AttrDomain::Corner);
109 uv_map.span.copy_from(orig_uv_map);
112 attributes.remove(
"UVMap");
123 const int subdivisions = std::min(
params.extract_input<
int>(
"Subdivisions"), 10);
124 const float radius =
params.extract_input<
float>(
"Radius");
126 std::optional<std::string> uv_map_id =
params.get_output_anonymous_attribute_id_if_needed(
void * BKE_id_new_nomain(short type, const char *name)
General operations, lookup, etc. for materials.
void BKE_id_material_eval_ensure_default_slot(struct ID *id)
#define NODE_CLASS_GEOMETRY
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
void BM_uv_map_ensure_select_and_pin_attrs(BMesh *bm)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
#define BMO_FLAG_DEFAULTS
ccl_device_inline float delta_phi(int p, float gamma_o, float gamma_t)
local_group_size(16, 16) .push_constant(Type b
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 geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
static MatBase identity()
static GeometrySet from_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare