30 {
SOCK_INT,
N_(
"Vertices X"), 3, 0.0f, 0.0f, 0.0f, 2, 1000},
31 {
SOCK_INT,
N_(
"Vertices Y"), 3, 0.0f, 0.0f, 0.0f, 2, 1000},
51 const float dx = (size_x == 0.0f) ? 0.0f : 1.0f / size_x;
52 const float dy = (size_y == 0.0f) ? 0.0f : 1.0f / size_y;
55 uvs[i].x = (co.
x + size_x * 0.5f) * dx;
56 uvs[i].y = (co.
y + size_y * 0.5f) * dy;
68 const int edges_x = verts_x - 1;
69 const int edges_y = verts_y - 1;
71 edges_x * verts_y + edges_y * verts_x,
73 edges_x * edges_y * 4,
81 const float dx = size_x / edges_x;
82 const float dy = size_y / edges_y;
83 float x = -size_x * 0.5;
84 for (
const int x_index :
IndexRange(verts_x)) {
85 float y = -size_y * 0.5;
86 for (
const int y_index :
IndexRange(verts_y)) {
87 const int vert_index = x_index * verts_y + y_index;
88 verts[vert_index].co[0] =
x;
89 verts[vert_index].co[1] =
y;
90 verts[vert_index].co[2] = 0.0f;
98 const short up_normal[3] = {0, 0, SHRT_MAX};
104 const int y_edges_start = 0;
108 const int vert_index =
x * verts_y +
y;
109 MEdge &edge = edges[edge_index++];
110 edge.
v1 = vert_index;
111 edge.
v2 = vert_index + 1;
117 const int x_edges_start = edge_index;
120 const int vert_index =
x * verts_y +
y;
121 MEdge &edge = edges[edge_index++];
122 edge.
v1 = vert_index;
123 edge.
v2 = vert_index + verts_y;
132 MPoly &poly = polys[poly_index++];
135 const int vert_index =
x * verts_y +
y;
137 MLoop &loop_a = loops[loop_index++];
138 loop_a.
v = vert_index;
139 loop_a.
e = x_edges_start + edges_x *
y +
x;
140 MLoop &loop_b = loops[loop_index++];
141 loop_b.
v = vert_index + verts_y;
142 loop_b.
e = y_edges_start + edges_y * (
x + 1) +
y;
143 MLoop &loop_c = loops[loop_index++];
144 loop_c.
v = vert_index + verts_y + 1;
145 loop_c.e = x_edges_start + edges_x * (
y + 1) +
x;
146 MLoop &loop_d = loops[loop_index++];
147 loop_d.
v = vert_index + 1;
148 loop_d.e = y_edges_start + edges_y *
x +
y;
159 const float size_x =
params.extract_input<
float>(
"Size X");
160 const float size_y =
params.extract_input<
float>(
"Size Y");
161 const int verts_x =
params.extract_input<
int>(
"Vertices X");
162 const int verts_y =
params.extract_input<
int>(
"Vertices Y");
163 if (verts_x < 2 || verts_y < 2) {
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 node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
#define NODE_CLASS_GEOMETRY
void nodeRegisterType(struct bNodeType *ntype)
MINLINE void copy_v3_v3_short(short r[3], const short a[3])
_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
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_GRID
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()
constexpr IndexRange index_range() const
fn::GMutableSpan get_span_for_write_only()
static void geo_node_mesh_primitive_grid_exec(GeoNodeExecParams params)
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 Mesh * create_grid_mesh(const int verts_x, const int verts_y, const float size_x, const float size_y)
static bNodeSocketTemplate geo_node_mesh_primitive_grid_out[]
void register_node_type_geo_mesh_primitive_grid()
static bNodeSocketTemplate geo_node_mesh_primitive_grid_in[]
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
static GeometrySet create_with_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Compact definition of a node socket.
NodeGeometryExecFunction geometry_node_execute