Blender  V2.93
Macros | Functions | Variables
bmo_primitive.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BKE_customdata.h"
#include "DNA_meshdata_types.h"
#include "bmesh.h"
#include "intern/bmesh_operators_private.h"

Go to the source code of this file.

Macros

#define VERT_MARK   1
 
#define EDGE_ORIG   1
 
#define EDGE_MARK   2
 
#define FACE_MARK   1
 
#define FACE_NEW   2
 
#define XY(_x, _y)   ((_x) + ((_y) * (xtot + 1)))
 

Functions

void bmo_create_grid_exec (BMesh *bm, BMOperator *op)
 
void BM_mesh_calc_uvs_grid (BMesh *bm, const uint x_segments, const uint y_segments, const short oflag, const int cd_loop_uv_offset)
 
void bmo_create_uvsphere_exec (BMesh *bm, BMOperator *op)
 
void bmo_create_icosphere_exec (BMesh *bm, BMOperator *op)
 
static void bm_mesh_calc_uvs_sphere_face (BMFace *f, const int cd_loop_uv_offset)
 
void BM_mesh_calc_uvs_sphere (BMesh *bm, const short oflag, const int cd_loop_uv_offset)
 
void bmo_create_monkey_exec (BMesh *bm, BMOperator *op)
 
void bmo_create_circle_exec (BMesh *bm, BMOperator *op)
 
void BM_mesh_calc_uvs_circle (BMesh *bm, float mat[4][4], const float radius, const short oflag, const int cd_loop_uv_offset)
 
void bmo_create_cone_exec (BMesh *bm, BMOperator *op)
 
void BM_mesh_calc_uvs_cone (BMesh *bm, float mat[4][4], const float radius_top, const float radius_bottom, const int segments, const bool cap_ends, const short oflag, const int cd_loop_uv_offset)
 
void bmo_create_cube_exec (BMesh *bm, BMOperator *op)
 
void BM_mesh_calc_uvs_cube (BMesh *bm, const short oflag)
 

Variables

static const float icovert [12][3]
 
static const short icoface [20][3]
 
static const float icouvs [60][2]
 
static const int monkeyo = 4
 
static const int monkeynv = 271
 
static const int monkeynf = 250
 
static const signed char monkeyv [271][3]
 
static signed char monkeyf [250][4]
 
static const float monkeyuvs []
 

Detailed Description

Primitive shapes.

Definition in file bmo_primitive.c.

Macro Definition Documentation

◆ EDGE_MARK

#define EDGE_MARK   2

Definition at line 721 of file bmo_primitive.c.

◆ EDGE_ORIG

#define EDGE_ORIG   1

Definition at line 720 of file bmo_primitive.c.

◆ FACE_MARK

#define FACE_MARK   1

Definition at line 723 of file bmo_primitive.c.

◆ FACE_NEW

#define FACE_NEW   2

Definition at line 724 of file bmo_primitive.c.

◆ VERT_MARK

#define VERT_MARK   1

Definition at line 718 of file bmo_primitive.c.

◆ XY

#define XY (   _x,
  _y 
)    ((_x) + ((_y) * (xtot + 1)))

Function Documentation

◆ BM_mesh_calc_uvs_circle()

void BM_mesh_calc_uvs_circle ( BMesh bm,
float  mat[4][4],
const float  radius,
const short  oflag,
const int  cd_loop_uv_offset 
)

Fills first available UVmap with 2D projected UVs for all faces OpFlag-ged by given flag.

Parameters
bmThe BMesh to operate on.
matThe transform matrix applied to the created circle.
radiusThe size of the circle.
oflagThe flag to check faces with.

Definition at line 1354 of file bmo_primitive.c.

References BLI_assert, bm, BM_ELEM_CD_GET_VOID_P, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, BMO_face_flag_test, BMVert::co, copy_v3_v3(), invert_m4_m4(), l, mul_m4_v3(), oflag, MLoopUV::uv, and BMLoop::v.

Referenced by bmo_create_circle_exec().

◆ BM_mesh_calc_uvs_cone()

void BM_mesh_calc_uvs_cone ( BMesh bm,
float  mat[4][4],
const float  radius_top,
const float  radius_bottom,
const int  segments,
const bool  cap_ends,
const short  oflag,
const int  cd_loop_uv_offset 
)

Fills first available UVmap with cylinder/cone-like UVs for all faces OpFlag-ged by given flag.

Parameters
bmThe BMesh to operate on.
matThe transform matrix applied to the created cone/cylinder.
radius_topThe size of the top end of the cone/cylinder.
radius_bottomThe size of the bottom end of the cone/cylinder.
segmentsThe number of subdivisions in the sides of the cone/cylinder.
cap_endsWhether the ends of the cone/cylinder are filled or not.
oflagThe flag to check faces with.

Definition at line 1549 of file bmo_primitive.c.

References BLI_assert, bm, BM_ELEM_CD_GET_VOID_P, BM_face_normal_update(), BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_ELEM_INDEX, BM_ITER_MESH, BM_LOOPS_OF_FACE, BMO_face_flag_test, BMVert::co, dot_v3v3(), float(), invert_m4_m4(), l, BMFace::len, mul_mat3_m4_v3(), mul_v3_m4v3(), BMFace::no, normalize_v3(), oflag, MLoopUV::uv, BMLoop::v, x, and y.

Referenced by bmo_create_cone_exec().

◆ BM_mesh_calc_uvs_cube()

void BM_mesh_calc_uvs_cube ( BMesh bm,
const short  oflag 
)

Fills first available UVmap with cube-like UVs for all faces OpFlag-ged by given flag.

Note
Expects tagged faces to be six quads.
Caller must order faces for correct alignment.
Parameters
bmThe BMesh to operate on.
oflagThe flag to check faces with.

Definition at line 1723 of file bmo_primitive.c.

References BLI_assert, bm, BM_ELEM_CD_GET_VOID_P, BM_FACES_OF_MESH, BM_ITER_ELEM_INDEX, BM_ITER_MESH, BM_LOOPS_OF_FACE, BMO_face_flag_test, CD_MLOOPUV, CustomData_get_offset(), l, BMesh::ldata, oflag, MLoopUV::uv, width, x, and y.

Referenced by bmo_create_cube_exec().

◆ BM_mesh_calc_uvs_grid()

void BM_mesh_calc_uvs_grid ( BMesh bm,
const uint  x_segments,
const uint  y_segments,
const short  oflag,
const int  cd_loop_uv_offset 
)

Fills first available UVmap with grid-like UVs for all faces OpFlag-ged by given flag.

Parameters
bmThe BMesh to operate on
x_segmentsThe x-resolution of the grid
y_segmentsThe y-resolution of the grid
oflagThe flag to check faces with.

Definition at line 798 of file bmo_primitive.c.

References BLI_assert, bm, BM_ELEM_CD_GET_VOID_P, BM_FACES_OF_MESH, BM_ITER_ELEM_INDEX, BM_ITER_MESH, BM_LOOPS_OF_FACE, BMO_face_flag_test, float(), l, oflag, MLoopUV::uv, x, and y.

Referenced by bmo_create_grid_exec().

◆ BM_mesh_calc_uvs_sphere()

void BM_mesh_calc_uvs_sphere ( BMesh bm,
const short  oflag,
const int  cd_loop_uv_offset 
)

Fills first available UVmap with spherical projected UVs for all faces OpFlag-ged by given flag.

Parameters
bmThe BMesh to operate on
oflagThe flag to check faces with.

Definition at line 1139 of file bmo_primitive.c.

References BLI_assert, bm, BM_ELEM_CD_GET_VOID_P, BM_FACES_OF_MESH, BM_ITER_ELEM_INDEX, BM_ITER_MESH, BM_LOOPS_OF_FACE, bm_mesh_calc_uvs_sphere_face(), BMO_face_flag_test, l, oflag, and MLoopUV::uv.

Referenced by bmo_create_uvsphere_exec().

◆ bm_mesh_calc_uvs_sphere_face()

static void bm_mesh_calc_uvs_sphere_face ( BMFace f,
const int  cd_loop_uv_offset 
)
static

◆ bmo_create_circle_exec()

void bmo_create_circle_exec ( BMesh bm,
BMOperator op 
)

◆ bmo_create_cone_exec()

void bmo_create_cone_exec ( BMesh bm,
BMOperator op 
)

◆ bmo_create_cube_exec()

void bmo_create_cube_exec ( BMesh bm,
BMOperator op 
)

◆ bmo_create_grid_exec()

void bmo_create_grid_exec ( BMesh bm,
BMOperator op 
)

◆ bmo_create_icosphere_exec()

void bmo_create_icosphere_exec ( BMesh bm,
BMOperator op 
)

◆ bmo_create_monkey_exec()

void bmo_create_monkey_exec ( BMesh bm,
BMOperator op 
)

◆ bmo_create_uvsphere_exec()

void bmo_create_uvsphere_exec ( BMesh bm,
BMOperator op 
)

Variable Documentation

◆ icoface

const short icoface[20][3]
static
Initial value:
= {
{0, 1, 2}, {1, 0, 5}, {0, 2, 3}, {0, 3, 4}, {0, 4, 5}, {1, 5, 10}, {2, 1, 6},
{3, 2, 7}, {4, 3, 8}, {5, 4, 9}, {1, 10, 6}, {2, 6, 7}, {3, 7, 8}, {4, 8, 9},
{5, 9, 10}, {6, 10, 11}, {7, 6, 11}, {8, 7, 11}, {9, 8, 11}, {10, 9, 11},
}

Definition at line 51 of file bmo_primitive.c.

Referenced by bmo_create_icosphere_exec().

◆ icouvs

const float icouvs[60][2]
static
Initial value:
= {
{0.181819f, 0.000000f}, {0.272728f, 0.157461f}, {0.090910f, 0.157461f}, {0.272728f, 0.157461f},
{0.363637f, 0.000000f}, {0.454546f, 0.157461f}, {0.909091f, 0.000000f}, {1.000000f, 0.157461f},
{0.818182f, 0.157461f}, {0.727273f, 0.000000f}, {0.818182f, 0.157461f}, {0.636364f, 0.157461f},
{0.545455f, 0.000000f}, {0.636364f, 0.157461f}, {0.454546f, 0.157461f}, {0.272728f, 0.157461f},
{0.454546f, 0.157461f}, {0.363637f, 0.314921f}, {0.090910f, 0.157461f}, {0.272728f, 0.157461f},
{0.181819f, 0.314921f}, {0.818182f, 0.157461f}, {1.000000f, 0.157461f}, {0.909091f, 0.314921f},
{0.636364f, 0.157461f}, {0.818182f, 0.157461f}, {0.727273f, 0.314921f}, {0.454546f, 0.157461f},
{0.636364f, 0.157461f}, {0.545455f, 0.314921f}, {0.272728f, 0.157461f}, {0.363637f, 0.314921f},
{0.181819f, 0.314921f}, {0.090910f, 0.157461f}, {0.181819f, 0.314921f}, {0.000000f, 0.314921f},
{0.818182f, 0.157461f}, {0.909091f, 0.314921f}, {0.727273f, 0.314921f}, {0.636364f, 0.157461f},
{0.727273f, 0.314921f}, {0.545455f, 0.314921f}, {0.454546f, 0.157461f}, {0.545455f, 0.314921f},
{0.363637f, 0.314921f}, {0.181819f, 0.314921f}, {0.363637f, 0.314921f}, {0.272728f, 0.472382f},
{0.000000f, 0.314921f}, {0.181819f, 0.314921f}, {0.090910f, 0.472382f}, {0.727273f, 0.314921f},
{0.909091f, 0.314921f}, {0.818182f, 0.472382f}, {0.545455f, 0.314921f}, {0.727273f, 0.314921f},
{0.636364f, 0.472382f}, {0.363637f, 0.314921f}, {0.545455f, 0.314921f}, {0.454546f, 0.472382f},
}

Definition at line 57 of file bmo_primitive.c.

Referenced by bmo_create_icosphere_exec().

◆ icovert

const float icovert[12][3]
static
Initial value:
= {
{0.0f, 0.0f, -200.0f},
{144.72f, -105.144f, -89.443f},
{-55.277f, -170.128, -89.443f},
{-178.885f, 0.0f, -89.443f},
{-55.277f, 170.128f, -89.443f},
{144.72f, 105.144f, -89.443f},
{55.277f, -170.128f, 89.443f},
{-144.72f, -105.144f, 89.443f},
{-144.72f, 105.144f, 89.443f},
{55.277f, 170.128f, 89.443f},
{178.885f, 0.0f, 89.443f},
{0.0f, 0.0f, 200.0f},
}

Definition at line 36 of file bmo_primitive.c.

Referenced by bmo_create_icosphere_exec().

◆ monkeyf

signed char monkeyf[250][4]
static

Definition at line 136 of file bmo_primitive.c.

Referenced by bmo_create_monkey_exec().

◆ monkeynf

const int monkeynf = 250
static

Definition at line 77 of file bmo_primitive.c.

Referenced by bmo_create_monkey_exec().

◆ monkeynv

const int monkeynv = 271
static

Definition at line 76 of file bmo_primitive.c.

Referenced by bmo_create_monkey_exec().

◆ monkeyo

const int monkeyo = 4
static

Definition at line 75 of file bmo_primitive.c.

Referenced by bmo_create_monkey_exec().

◆ monkeyuvs

const float monkeyuvs[]
static

Definition at line 223 of file bmo_primitive.c.

Referenced by bmo_create_monkey_exec().

◆ monkeyv

const signed char monkeyv[271][3]
static

Definition at line 78 of file bmo_primitive.c.

Referenced by bmo_create_monkey_exec().