27 .description(
"Distance from the generated points to the origin");
32 .
description(
"Number of subdivisions on top of the basic icosahedron");
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",
98 params.calc_object_remap =
false;
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"), 10);
126 const float radius =
params.extract_input<
float>(
"Radius");
128 std::optional<std::string> uv_map_id =
params.get_output_anonymous_attribute_id_if_needed(
141 ntype.
ui_description =
"Generate a spherical mesh that consists of equally sized triangles";
void * BKE_id_new_nomain(short type, const char *name)
General operations, lookup, etc. for materials.
void BKE_id_material_eval_ensure_default_slot(ID *id)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const StringRef name)
void BM_uv_map_attr_pin_ensure_for_all_layers(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(const int p, const float gamma_o, const float gamma_t)
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
GAttributeReader lookup(const StringRef attribute_id) const
bool remove(const StringRef attribute_id)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef attribute_id, AttrDomain domain, AttrType data_type)
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)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string 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)