39 const float angle_end = -(
DEG2RADF(sweep) - angle_start);
41 for (
int i = 0; i < nsegments + 1; i++) {
42 const float angle =
interpf(angle_start, angle_end, (
float(i) /
float(nsegments)));
45 immVertex2f(pos,
x + radius.x * angle_cos,
y + radius.y * angle_sin);
62 const float angle_end = -(
DEG2RADF(sweep) - angle_start);
64 for (
int i = 0; i < nsegments + 1; i++) {
65 const float angle =
interpf(angle_start, angle_end, (
float(i) /
float(nsegments)));
68 immVertex3f(pos,
x + radius.x * angle_cos,
y + radius.y * angle_sin,
z);
101 const float2 corner_radius,
104 BLI_assert(corner_radius.x >= 0.0f && corner_radius.x <= radius.x);
105 BLI_assert(corner_radius.y >= 0.0f && corner_radius.y <= radius.y);
107 const float x_min =
x - radius.x;
108 const float x_max =
x + radius.x;
109 const float y_min =
y - radius.y;
110 const float y_max =
y + radius.y;
111 const float x_corner_min =
x - radius.x + corner_radius.x;
112 const float x_corner_max =
x + radius.x - corner_radius.x;
113 const float y_corner_min =
y - radius.y + corner_radius.y;
114 const float y_corner_max =
y + radius.y - corner_radius.y;
116 if (corner_radius.x == 0.0f && corner_radius.y == 0.0f) {
121 if (corner_radius == radius) {
128 pos, x_corner_min, y_corner_min, corner_radius, nsegments, 180.0f, 90.0f);
130 pos, x_corner_max, y_corner_max, corner_radius, nsegments, 0, 90.0f);
132 pos, x_corner_max, y_corner_min, corner_radius, nsegments, 90.0f, 90.0f);
134 pos, x_corner_min, y_corner_max, corner_radius, nsegments, -90.0f, 90.0f);
156 const float2 corner_radius,
159 BLI_assert(corner_radius.x >= 0.0f && corner_radius.x <= radius.x);
160 BLI_assert(corner_radius.y >= 0.0f && corner_radius.y <= radius.y);
163 const float x_min =
x - radius.x;
164 const float x_max =
x + radius.x;
166 const float x_corner_min =
x - radius.x + corner_radius.x;
167 const float x_corner_max =
x + radius.x - corner_radius.x;
169 if (corner_radius.x == 0.0f && corner_radius.y == 0.0f) {
174 if (corner_radius == radius) {
182 y - radius.y + corner_radius.y,
190 y + radius.y - corner_radius.y,
198 y - radius.y + corner_radius.y,
206 y + radius.y - corner_radius.y,
215 immVertex3f(pos, x_min,
y - radius.y + corner_radius.y, 0.0f);
216 immVertex3f(pos, x_min,
y + radius.y - corner_radius.y, 0.0f);
218 immVertex3f(pos, x_max,
y + radius.y - corner_radius.y, 0.0f);
219 immVertex3f(pos, x_max,
y - radius.y + corner_radius.y, 0.0f);
296 uint pos,
uint col,
float x1,
float y1,
float x2,
float y2,
const float color[4])
314 uint pos,
uint col,
int x1,
int y1,
int x2,
int y2,
const float color[4])
349void immRecti_complete(
int x1,
int y1,
int x2,
int y2,
const float color[4])
352 uint pos = add_attr(format,
"pos", gpu::VertAttrType::SFLOAT_32_32);
378 for (
int i = 1; i < nsegments; i++) {
388 for (
int i = 0; i < nsegments; i++) {
407 uint shdr_pos,
float x,
float y,
float radius_x,
float radius_y,
int nsegments)
413 uint shdr_pos,
float x,
float y,
float radius_x,
float radius_y,
int nsegments)
429 const float angle_end = -(
DEG2RADF(sweep) - angle_start);
432 for (
int i = 0; i < nsegments; i++) {
433 const float angle =
interpf(angle_start, angle_end, (
float(i) /
float(nsegments - 1)));
436 immVertex2f(pos,
x + radius * angle_cos,
y + radius * angle_sin);
453 const float angle_end = -(
DEG2RADF(sweep) - angle_start);
456 for (
int i = 0; i < nsegments; i++) {
457 const float angle =
interpf(angle_start, angle_end, (
float(i) /
float(nsegments - 1)));
466 uint pos,
float x,
float y,
float radius,
int nsegments,
float start,
float sweep)
472 uint pos,
float x,
float y,
float z,
float radius,
int nsegments,
float start,
float sweep)
488 const float max_angle = 3 * 360;
489 CLAMP(sweep, -max_angle, max_angle);
493 const float angle_end = -(
DEG2RADF(sweep) - angle_start);
496 for (
int i = 0; i < nsegments; i++) {
497 const float angle =
interpf(angle_start, angle_end, (
float(i) /
float(nsegments - 1)));
500 immVertex2f(pos,
x + rad_inner * angle_cos,
y + rad_inner * angle_sin);
501 immVertex2f(pos,
x + rad_outer * angle_cos,
y + rad_outer * angle_sin);
518 const float max_angle = 3 * 360;
519 CLAMP(sweep, -max_angle, max_angle);
523 const float angle_end = -(
DEG2RADF(sweep) - angle_start);
526 for (
int i = 0; i < nsegments; i++) {
527 const float angle =
interpf(angle_start, angle_end, (
float(i) /
float(nsegments - 1)));
530 immVertex3f(pos,
x + rad_inner * angle_cos,
y + rad_inner * angle_sin,
z);
531 immVertex3f(pos,
x + rad_outer * angle_cos,
y + rad_outer * angle_sin,
z);
582 for (
int i = 0; i < nsegments; i++) {
588 const float xnext = alpha * xr - xprev;
590 const float ynext = alpha * yr - yprev;
601 for (
int i = 0; i < nsegments; i++) {
615 uint pos,
float x,
float y,
float radius_x,
float radius_y,
int nsegments)
631 uint pos,
float x,
float y,
float radius_x,
float radius_y,
int nsegments)
677 const float color_primary[4],
678 const float color_secondary[4],
695 float checker_primary[4];
696 float checker_secondary[4];
699 checker_primary[3] = clear_alpha ? 0.0 : checker_primary[3];
700 checker_secondary[3] = clear_alpha ? 0.0 : checker_secondary[3];
743 const float center[3],
744 const float aspect[3],
773 uint pos,
uint nor,
float base,
float top,
float height,
int slices,
int stacks)
776 for (
int i = 0; i < slices; i++) {
779 const float cos1 =
cosf(angle1);
780 const float sin1 =
sinf(angle1);
781 const float cos2 =
cosf(angle2);
782 const float sin2 =
sinf(angle2);
784 for (
int j = 0; j < stacks; j++) {
787 float r1 = base * (1.0f - fac1) + top * fac1;
788 float r2 = base * (1.0f - fac2) + top * fac2;
789 float h1 = height * (
float(j) /
float(stacks));
790 float h2 = height * (
float(j + 1) /
float(stacks));
792 const float v1[3] = {r1 * cos2, r1 * sin2, h1};
793 const float v2[3] = {r2 * cos2, r2 * sin2, h2};
794 const float v3[3] = {r2 * cos1, r2 * sin1, h2};
795 const float v4[3] = {r1 * cos1, r1 * sin1, h1};
829 uint pos,
float base,
float top,
float height,
int slices,
int stacks)
832 for (
int i = 0; i < slices; i++) {
835 const float cos1 =
cosf(angle1);
836 const float sin1 =
sinf(angle1);
837 const float cos2 =
cosf(angle2);
838 const float sin2 =
sinf(angle2);
840 for (
int j = 0; j < stacks; j++) {
843 float r1 = base * (1.0f - fac1) + top * fac1;
844 float r2 = base * (1.0f - fac2) + top * fac2;
845 float h1 = height * (
float(j) /
float(stacks));
846 float h2 = height * (
float(j + 1) /
float(stacks));
848 const float v1[3] = {r1 * cos2, r1 * sin2, h1};
849 const float v2[3] = {r2 * cos2, r2 * sin2, h2};
850 const float v3[3] = {r2 * cos1, r2 * sin1, h2};
851 const float v4[3] = {r1 * cos1, r1 * sin1, h1};
867 uint pos,
float base,
float top,
float height,
int slices,
int stacks)
870 for (
int i = 0; i < slices; i++) {
873 const float cos1 =
cosf(angle1);
874 const float sin1 =
sinf(angle1);
875 const float cos2 =
cosf(angle2);
876 const float sin2 =
sinf(angle2);
878 for (
int j = 0; j < stacks; j++) {
881 float r1 = base * (1.0f - fac1) + top * fac1;
882 float r2 = base * (1.0f - fac2) + top * fac2;
883 float h1 = height * (
float(j) /
float(stacks));
884 float h2 = height * (
float(j + 1) /
float(stacks));
886 const float v1[3] = {r1 * cos2, r1 * sin2, h1};
887 const float v2[3] = {r2 * cos2, r2 * sin2, h2};
888 const float v3[3] = {r2 * cos1, r2 * sin1, h2};
889 const float v4[3] = {r1 * cos1, r1 * sin1, h1};
911 const float tmat[4][4])
915 0.00000000, 0.20129852, 0.39435585, 0.57126821, 0.72479278, 0.84864425, 0.93775213,
916 0.98846832, 0.99871650, 0.96807711, 0.89780453, 0.79077573, 0.65137248, 0.48530196,
917 0.29936312, 0.10116832, -0.10116832, -0.29936312, -0.48530196, -0.65137248, -0.79077573,
918 -0.89780453, -0.96807711, -0.99871650, -0.98846832, -0.93775213, -0.84864425, -0.72479278,
919 -0.57126821, -0.39435585, -0.20129852, 0.00000000,
924 1.00000000, 0.97952994, 0.91895781, 0.82076344, 0.68896691, 0.52896401, 0.34730525,
925 0.15142777, -0.05064916, -0.25065253, -0.44039415, -0.61210598, -0.75875812, -0.87434661,
926 -0.95413925, -0.99486932, -0.99486932, -0.95413925, -0.87434661, -0.75875812, -0.61210598,
927 -0.44039415, -0.25065253, -0.05064916, 0.15142777, 0.34730525, 0.52896401, 0.68896691,
928 0.82076344, 0.91895781, 0.97952994, 1.00000000,
932 float *viter = (
float *)verts;
938 viter[0] = cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
939 viter[1] = cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
940 viter[2] = cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void imm_draw_rounded_box_wire_2d(uint pos, float x, float y, float2 radius, float2 corner_radius, int nsegments)
void imm_draw_circle_partial_wire_aspect_3d(uint pos, float x, float y, float z, float2 radius, int nsegments, float start, float sweep)
void imm_draw_circle_partial_wire_aspect_2d(uint pos, float x, float y, float2 radius, int nsegments, float start, float sweep)
static void imm_draw_circle_partial_aspect_3d(const GPUPrimType prim_type, const uint pos, const float x, const float y, const float z, const float2 radius, const int nsegments, const float start, const float sweep)
void imm_draw_rounded_box_wire_3d(uint pos, float x, float y, float2 radius, float2 corner_radius, int nsegments)
static void imm_draw_circle_partial_aspect(const GPUPrimType prim_type, const uint pos, const float x, const float y, const float2 radius, const int nsegments, const float start, const float sweep)
void get_color_4fv(int colorid, float col[4])
int get_value(int colorid)
void imm_draw_cylinder_wire_3d(uint pos, float base, float top, float height, int slices, int stacks)
static void imm_draw_circle(GPUPrimType prim_type, const uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void imm_draw_cylinder_fill_normal_3d(uint pos, uint nor, float base, float top, float height, int slices, int stacks)
static void imm_draw_circle_partial_3d(GPUPrimType prim_type, uint pos, float x, float y, float z, float rad, int nsegments, float start, float sweep)
static void imm_draw_circle_3D(GPUPrimType prim_type, uint pos, float x, float y, float radius_x, float radius_y, int nsegments)
void imm_draw_circle_dashed_3d(uint pos, float x, float y, float radius, int nsegments)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void imm_draw_cylinder_fill_3d(uint pos, float base, float top, float height, int slices, int stacks)
void imm_draw_circle_wire_aspect_3d(uint pos, float x, float y, float radius_x, float radius_y, int nsegments)
void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2, bool clear_alpha=false)
GPUVertFormat * immVertexFormat()
void immRectf_fast_with_color(uint pos, uint col, float x1, float y1, float x2, float y2, const float color[4])
void immBegin(GPUPrimType, uint vertex_len)
void imm_draw_box_checker_2d_ex(float x1, float y1, float x2, float y2, const float color_primary[4], const float color_secondary[4], int checker_size)
void immRecti(uint pos, int x1, int y1, int x2, int y2)
@ TH_TRANSPARENT_CHECKER_SIZE
@ TH_TRANSPARENT_CHECKER_SECONDARY
@ TH_TRANSPARENT_CHECKER_PRIMARY
void immUniformColor4fv(const float rgba[4])
static const int cube_quad_index[6][4]
void imm_drawcircball(const float cent[3], float radius, const float tmat[4][4], uint pos)
void imm_draw_cube_wire_3d(uint pos, const float center[3], const float aspect[3])
void immAttr2f(uint attr_id, float x, float y)
void imm_draw_circle_partial_wire_2d(uint pos, float x, float y, float radius, int nsegments, float start, float sweep)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void sub_v3_v3(float r[3], const float a[3])
void immAttr3fv(uint attr_id, const float data[3])
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
VecBase< float, 2 > float2
void imm_draw_disk_partial_fill_3d(uint pos, float x, float y, float z, float rad_inner, float rad_outer, int nsegments, float start, float sweep)
static void imm_draw_disk_partial(GPUPrimType prim_type, uint pos, float x, float y, float rad_inner, float rad_outer, int nsegments, float start, float sweep)
void immVertex2f(uint attr_id, float x, float y)
void immVertex2i(uint attr_id, int x, int y)
static void circball_array_fill(const float verts[CIRCLE_RESOL][3], const float cent[3], const float radius, const float tmat[4][4])
void immAttr4fv(uint attr_id, const float data[4])
@ GPU_SHADER_3D_UNIFORM_COLOR
void immUniform4fv(const char *name, const float data[4])
void imm_draw_cube_corners_3d(uint pos, const float center[3], const float aspect[3], float factor)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
static void imm_draw_disk_partial_3d(GPUPrimType prim_type, uint pos, float x, float y, float z, float rad_inner, float rad_outer, int nsegments, float start, float sweep)
void immRectf_with_texco(uint pos, uint tex_coord, const rctf &p, const rctf &uv)
void imm_draw_box_wire_3d(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_circle_fill_3d(uint pos, float x, float y, float radius, int nsegments)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
void imm_draw_circle_partial_wire_3d(uint pos, float x, float y, float z, float radius, int nsegments, float start, float sweep)
void imm_draw_circle_fill_aspect_3d(uint pos, float x, float y, float radius_x, float radius_y, int nsegments)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float n[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void immVertex3fv(uint attr_id, const float data[3])
void imm_draw_circle_wire_aspect_2d(uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
void imm_draw_circle_fill_aspect_2d(uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void immRecti_fast_with_color(uint pos, uint col, int x1, int y1, int x2, int y2, const float color[4])
void immRectf_fast(uint pos, float x1, float y1, float x2, float y2)
MINLINE float interpf(float target, float origin, float t)
void immVertex3f(uint attr_id, float x, float y, float z)
static const float cube_coords[8][3]
void immUniform1i(const char *name, int x)
void imm_draw_disk_partial_fill_2d(uint pos, float x, float y, float rad_inner, float rad_outer, int nsegments, float start, float sweep)
static void imm_draw_circle_partial(GPUPrimType prim_type, uint pos, float x, float y, float radius, int nsegments, float start, float sweep)
void imm_draw_circle_wire_3d(uint pos, float x, float y, float radius, int nsegments)
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
static const int cube_line_index[12][2]
void imm_draw_cube_fill_3d(uint pos, const float center[3], const float aspect[3])
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float