28 {
SOCK_INT,
N_(
"Vertices"), 32, 0.0f, 0.0f, 0.0f, 3, 4096},
46 uiItemR(layout,
ptr,
"fill_type", 0,
nullptr, ICON_NONE);
56 node->storage = node_storage;
63 const bool top_is_point,
64 const bool bottom_is_point)
76 if (!bottom_is_point) {
91 const bool top_is_point,
92 const bool bottom_is_point)
94 if (top_is_point && bottom_is_point) {
108 if (!bottom_is_point) {
120 const bool top_is_point,
121 const bool bottom_is_point)
123 if (top_is_point && bottom_is_point) {
137 if (!top_is_point && !bottom_is_point) {
144 if (!bottom_is_point) {
158 const bool top_is_point,
159 const bool bottom_is_point)
161 if (top_is_point && bottom_is_point) {
177 if (!bottom_is_point) {
190 const bool top_is_point,
191 const bool bottom_is_point,
203 const float angle_delta = 2.0f *
M_PI /
static_cast<float>(verts_num);
207 angle += angle_delta;
214 uvs[loop_index++] = circle[i];
219 uvs[loop_index++] = circle[i];
220 uvs[loop_index++] = circle[(i + 1) % verts_num];
221 uvs[loop_index++] =
float2(0.25f, 0.25f);
227 if (!top_is_point && !bottom_is_point) {
231 const float vert =
static_cast<float>(i);
233 uvs[loop_index++] =
float2(vert / verts_num, 1.0f);
234 uvs[loop_index++] =
float2((vert + 1.0f) / verts_num, 1.0f);
235 uvs[loop_index++] =
float2((vert + 1.0f) / verts_num,
bottom);
242 uvs[loop_index++] = circle[i] +
float2(0.5f, 0.0f);
243 uvs[loop_index++] =
float2(0.75f, 0.25f);
244 uvs[loop_index++] = circle[(i + 1) % verts_num] +
float2(0.5f, 0.0f);
250 uvs[loop_index++] = circle[i];
251 uvs[loop_index++] = circle[(i + 1) % verts_num];
252 uvs[loop_index++] =
float2(0.25f, 0.25f);
258 if (!bottom_is_point) {
262 uvs[loop_index++] = circle[verts_num - 1 - i] +
float2(0.5f, 0.0f);
267 uvs[loop_index++] = circle[i] +
float2(0.5f, 0.0f);
268 uvs[loop_index++] =
float2(0.75f, 0.25f);
269 uvs[loop_index++] = circle[(i + 1) % verts_num] +
float2(0.5f, 0.0f);
278 const float radius_bottom,
283 const bool top_is_point = radius_top == 0.0f;
284 const bool bottom_is_point = radius_bottom == 0.0f;
285 const float height = depth * 0.5f;
288 if (top_is_point && bottom_is_point) {
289 const bool single_vertex =
height == 0.0f;
293 const short up[3] = {0, 0, SHRT_MAX};
306 vert_total(fill_type, verts_num, top_is_point, bottom_is_point),
307 edge_total(fill_type, verts_num, top_is_point, bottom_is_point),
309 corner_total(fill_type, verts_num, top_is_point, bottom_is_point),
310 face_total(fill_type, verts_num, top_is_point, bottom_is_point));
317 const int top_verts_start = 0;
318 const int bottom_verts_start = top_verts_start + (!top_is_point ? verts_num : 1);
320 const float angle_delta = 2.0f *
M_PI /
static_cast<float>(verts_num);
327 if (!bottom_is_point) {
331 angle += angle_delta;
336 if (bottom_is_point) {
341 const int top_center_vert_index = bottom_verts_start + (bottom_is_point ? 1 : verts_num);
342 const int bottom_center_vert_index = top_center_vert_index + (top_is_point ? 0 : 1);
347 if (!bottom_is_point) {
353 const int top_edges_start = 0;
354 const int top_fan_edges_start = (!top_is_point &&
356 top_edges_start + verts_num :
360 MEdge &edge = edges[top_edges_start + i];
361 edge.
v1 = top_verts_start + i;
362 edge.
v2 = top_verts_start + (i + 1) % verts_num;
367 MEdge &edge = edges[top_fan_edges_start + i];
368 edge.
v1 = top_center_vert_index;
369 edge.
v2 = top_verts_start + i;
376 const int connecting_edges_start = top_fan_edges_start + (!top_is_point ? verts_num : 0);
378 MEdge &edge = edges[connecting_edges_start + i];
379 edge.
v1 = top_verts_start + (!top_is_point ? i : 0);
380 edge.
v2 = bottom_verts_start + (!bottom_is_point ? i : 0);
385 const int bottom_edges_start = connecting_edges_start + verts_num;
386 const int bottom_fan_edges_start = (!bottom_is_point &&
388 bottom_edges_start + verts_num :
390 if (!bottom_is_point) {
392 MEdge &edge = edges[bottom_edges_start + i];
393 edge.
v1 = bottom_verts_start + i;
394 edge.
v2 = bottom_verts_start + (i + 1) % verts_num;
399 MEdge &edge = edges[bottom_fan_edges_start + i];
400 edge.
v1 = bottom_center_vert_index;
401 edge.
v2 = bottom_verts_start + i;
412 MPoly &poly = polys[poly_index++];
417 MLoop &loop = loops[loop_index++];
418 loop.
v = top_verts_start + i;
419 loop.
e = top_edges_start + i;
424 MPoly &poly = polys[poly_index++];
428 MLoop &loop_a = loops[loop_index++];
429 loop_a.
v = top_verts_start + i;
430 loop_a.
e = top_edges_start + i;
431 MLoop &loop_b = loops[loop_index++];
432 loop_b.
v = top_verts_start + (i + 1) % verts_num;
433 loop_b.
e = top_fan_edges_start + (i + 1) % verts_num;
434 MLoop &loop_c = loops[loop_index++];
435 loop_c.
v = top_center_vert_index;
436 loop_c.e = top_fan_edges_start + i;
442 if (!top_is_point && !bottom_is_point) {
445 MPoly &poly = polys[poly_index++];
449 MLoop &loop_a = loops[loop_index++];
450 loop_a.
v = top_verts_start + i;
451 loop_a.
e = connecting_edges_start + i;
452 MLoop &loop_b = loops[loop_index++];
453 loop_b.
v = bottom_verts_start + i;
454 loop_b.
e = bottom_edges_start + i;
455 MLoop &loop_c = loops[loop_index++];
456 loop_c.
v = bottom_verts_start + (i + 1) % verts_num;
457 loop_c.
e = connecting_edges_start + (i + 1) % verts_num;
458 MLoop &loop_d = loops[loop_index++];
459 loop_d.
v = top_verts_start + (i + 1) % verts_num;
460 loop_d.e = top_edges_start + i;
467 MPoly &poly = polys[poly_index++];
471 MLoop &loop_a = loops[loop_index++];
472 loop_a.
v = top_verts_start + i;
473 loop_a.
e = connecting_edges_start + i;
474 MLoop &loop_b = loops[loop_index++];
475 loop_b.
v = bottom_verts_start;
476 loop_b.
e = connecting_edges_start + (i + 1) % verts_num;
477 MLoop &loop_c = loops[loop_index++];
478 loop_c.
v = top_verts_start + (i + 1) % verts_num;
479 loop_c.e = top_edges_start + i;
485 MPoly &poly = polys[poly_index++];
489 MLoop &loop_a = loops[loop_index++];
490 loop_a.
v = bottom_verts_start + i;
491 loop_a.
e = bottom_edges_start + i;
492 MLoop &loop_b = loops[loop_index++];
493 loop_b.
v = bottom_verts_start + (i + 1) % verts_num;
494 loop_b.
e = connecting_edges_start + (i + 1) % verts_num;
495 MLoop &loop_c = loops[loop_index++];
496 loop_c.
v = top_verts_start;
497 loop_c.e = connecting_edges_start + i;
503 if (!bottom_is_point) {
505 MPoly &poly = polys[poly_index++];
511 MLoop &loop = loops[loop_index++];
512 loop.
v = bottom_verts_start + verts_num - 1 - i;
513 loop.
e = bottom_edges_start + verts_num - 1 - (i + 1) % verts_num;
518 MPoly &poly = polys[poly_index++];
522 MLoop &loop_a = loops[loop_index++];
523 loop_a.
v = bottom_verts_start + i;
524 loop_a.
e = bottom_fan_edges_start + i;
525 MLoop &loop_b = loops[loop_index++];
526 loop_b.
v = bottom_center_vert_index;
527 loop_b.
e = bottom_fan_edges_start + (i + 1) % verts_num;
528 MLoop &loop_c = loops[loop_index++];
529 loop_c.
v = bottom_verts_start + (i + 1) % verts_num;
530 loop_c.e = bottom_edges_start + i;
552 const int verts_num =
params.extract_input<
int>(
"Vertices");
558 const float radius_top =
params.extract_input<
float>(
"Radius Top");
559 const float radius_bottom =
params.extract_input<
float>(
"Radius Bottom");
560 const float depth =
params.extract_input<
float>(
"Depth");
563 radius_top, radius_bottom, depth, verts_num, fill_type);
bool BKE_mesh_is_valid(struct Mesh *me)
struct Mesh * BKE_mesh_new_nomain(int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
void BKE_mesh_calc_normals(struct Mesh *me)
void BKE_mesh_translate(struct Mesh *me, const float offset[3], const bool do_keys)
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
#define NODE_CLASS_GEOMETRY
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
void nodeRegisterType(struct bNodeType *ntype)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_v3_short(short r[3], const short a[3])
GeometryNodeMeshCircleFillType
@ GEO_NODE_MESH_CIRCLE_FILL_NGON
@ GEO_NODE_MESH_CIRCLE_FILL_TRIANGLE_FAN
@ GEO_NODE_MESH_CIRCLE_FILL_NONE
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble bottom
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie Ellipse Bokeh View Corner Anti Mix RGB Hue Separate TEX_NODE_PROC TEX_NODE_PROC TEX_NODE_PROC TEX_NODE_PROC TEX_NODE_PROC Boolean Random Edge Subdivision Point Object Attribute Attribute Attribute Color Attribute Attribute Vector Point Attribute Sample Collection Attribute Attribute Combine Attribute GEO_NODE_MESH_PRIMITIVE_CONE
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
OutputAttributePtr attribute_try_get_for_output(const blender::StringRef attribute_name, const AttributeDomain domain, const CustomDataType data_type, const void *default_value=nullptr)
void replace(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void apply_span_and_save()
fn::GMutableSpan get_span_for_write_only()
void *(* MEM_callocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
Mesh * create_cylinder_or_cone_mesh(const float radius_top, const float radius_bottom, const float depth, const int verts_num, const GeometryNodeMeshCircleFillType fill_type)
static int edge_total(const GeometryNodeMeshCircleFillType fill_type, const int verts_num, const bool top_is_point, const bool bottom_is_point)
static void calculate_uvs(Mesh *mesh, const bool top_is_point, const bool bottom_is_point, const int verts_num, const GeometryNodeMeshCircleFillType fill_type)
static int corner_total(const GeometryNodeMeshCircleFillType fill_type, const int verts_num, const bool top_is_point, const bool bottom_is_point)
static int vert_total(const GeometryNodeMeshCircleFillType fill_type, const int verts_num, const bool top_is_point, const bool bottom_is_point)
static int face_total(const GeometryNodeMeshCircleFillType fill_type, const int verts_num, const bool top_is_point, const bool bottom_is_point)
static void geo_node_mesh_primitive_cone_exec(GeoNodeExecParams params)
static bNodeSocketTemplate geo_node_mesh_primitive_cone_in[]
static void geo_node_mesh_primitive_cone_init(bNodeTree *UNUSED(ntree), bNode *node)
void register_node_type_geo_mesh_primitive_cone()
static bNodeSocketTemplate geo_node_mesh_primitive_cone_out[]
static void geo_node_mesh_primitive_cone_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
static GeometrySet create_with_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Compact definition of a node socket.
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)