Blender V4.3
draw_debug.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "BKE_object.hh"
12#include "BLI_link_utils.h"
13#include "BLI_math_matrix.hh"
14#include "GPU_batch.hh"
15#include "GPU_capabilities.hh"
16#include "GPU_debug.hh"
17
18#include "draw_debug.hh"
19#include "draw_debug_c.hh"
20#include "draw_manager_c.hh"
21#include "draw_shader.hh"
22#include "draw_shader_shared.hh"
23
24#include <iomanip>
25#include <sstream>
26
27#if defined(_DEBUG) || defined(WITH_DRAW_DEBUG)
28# define DRAW_DEBUG
29#else
30/* Uncomment to forcibly enable debug draw in release mode. */
31// #define DRAW_DEBUG
32#endif
33
34namespace blender::draw {
35
36/* -------------------------------------------------------------------- */
39
41{
42 constexpr int circle_resolution = 16;
43 for (auto axis : IndexRange(3)) {
44 for (auto edge : IndexRange(circle_resolution)) {
45 for (auto vert : IndexRange(2)) {
46 const float angle = (2 * M_PI) * (edge + vert) / float(circle_resolution);
47 const float point[3] = {cosf(angle), sinf(angle), 0.0f};
48 sphere_verts_.append(
49 float3(point[(0 + axis) % 3], point[(1 + axis) % 3], point[(2 + axis) % 3]));
50 }
51 }
52 }
53
54 constexpr int point_resolution = 4;
55 for (auto axis : IndexRange(3)) {
56 for (auto edge : IndexRange(point_resolution)) {
57 for (auto vert : IndexRange(2)) {
58 const float angle = (2 * M_PI) * (edge + vert) / float(point_resolution);
59 const float point[3] = {cosf(angle), sinf(angle), 0.0f};
60 point_verts_.append(
61 float3(point[(0 + axis) % 3], point[(1 + axis) % 3], point[(2 + axis) % 3]));
62 }
63 }
64 }
65};
66
68{
69 cpu_print_buf_.command.vertex_len = 0;
70 cpu_print_buf_.command.vertex_first = 0;
71 cpu_print_buf_.command.instance_len = 1;
72 cpu_print_buf_.command.instance_first_array = 0;
73
74 cpu_draw_buf_.command.vertex_len = 0;
75 cpu_draw_buf_.command.vertex_first = 0;
76 cpu_draw_buf_.command.instance_len = 1;
77 cpu_draw_buf_.command.instance_first_array = 0;
78
79 gpu_print_buf_.command.vertex_len = 0;
80 gpu_print_buf_.command.vertex_first = 0;
81 gpu_print_buf_.command.instance_len = 1;
82 gpu_print_buf_.command.instance_first_array = 0;
83 gpu_print_buf_used = false;
84
85 gpu_draw_buf_.command.vertex_len = 0;
86 gpu_draw_buf_.command.vertex_first = 0;
87 gpu_draw_buf_.command.instance_len = 1;
88 gpu_draw_buf_.command.instance_first_array = 0;
89 gpu_draw_buf_used = false;
90
91 print_col_ = 0;
92 print_row_ = 0;
93
95}
96
98{
99 model_mat_ = float4x4::identity();
100}
101
102void DebugDraw::modelmat_set(const float modelmat[4][4])
103{
104 model_mat_ = float4x4_view(modelmat);
105}
106
108{
109 if (!gpu_draw_buf_used) {
110 gpu_draw_buf_used = true;
111 gpu_draw_buf_.push_update();
112 }
113 return gpu_draw_buf_;
114}
115
117{
118 if (!gpu_print_buf_used) {
119 gpu_print_buf_used = true;
120 gpu_print_buf_.push_update();
121 }
122 return gpu_print_buf_;
123}
124
126
127/* -------------------------------------------------------------------- */
130
132{
133 draw_line(v1, v2, color_pack(color));
134}
135
137{
138 BLI_assert(!face_verts.is_empty());
139
140 uint col = color_pack(color);
141 float3 v0 = math::transform_point(model_mat_, face_verts.last());
142 for (auto vert : face_verts) {
143 float3 v1 = math::transform_point(model_mat_, vert);
144 draw_line(v0, v1, col);
145 v0 = v1;
146 }
147}
148
150{
151 float3 v0 = float3(0.0f, 0.0f, 0.0f);
152 float3 v1 = float3(1.0f, 0.0f, 0.0f);
153 float3 v2 = float3(0.0f, 1.0f, 0.0f);
154 float3 v3 = float3(0.0f, 0.0f, 1.0f);
155
156 mul_project_m4_v3(m4.ptr(), v0);
157 mul_project_m4_v3(m4.ptr(), v1);
158 mul_project_m4_v3(m4.ptr(), v2);
159 mul_project_m4_v3(m4.ptr(), v3);
160
161 draw_line(v0, v1, float4(1.0f, 0.0f, 0.0f, 1.0f));
162 draw_line(v0, v2, float4(0.0f, 1.0f, 0.0f, 1.0f));
163 draw_line(v0, v3, float4(0.0f, 0.0f, 1.0f, 1.0f));
164}
165
167{
168 uint col = color_pack(color);
169 draw_line(bbox.vec[0], bbox.vec[1], col);
170 draw_line(bbox.vec[1], bbox.vec[2], col);
171 draw_line(bbox.vec[2], bbox.vec[3], col);
172 draw_line(bbox.vec[3], bbox.vec[0], col);
173
174 draw_line(bbox.vec[4], bbox.vec[5], col);
175 draw_line(bbox.vec[5], bbox.vec[6], col);
176 draw_line(bbox.vec[6], bbox.vec[7], col);
177 draw_line(bbox.vec[7], bbox.vec[4], col);
178
179 draw_line(bbox.vec[0], bbox.vec[4], col);
180 draw_line(bbox.vec[1], bbox.vec[5], col);
181 draw_line(bbox.vec[2], bbox.vec[6], col);
182 draw_line(bbox.vec[3], bbox.vec[7], col);
183}
184
186{
187 BoundBox bb;
188 const float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {1.0f, 1.0f, 1.0f};
190 for (auto i : IndexRange(8)) {
191 mul_project_m4_v3(mat.ptr(), bb.vec[i]);
192 }
193 draw_bbox(bb, color);
194}
195
196void DebugDraw::draw_sphere(const float3 center, float radius, const float4 color)
197{
198 uint col = color_pack(color);
199 for (auto i : IndexRange(sphere_verts_.size() / 2)) {
200 float3 v0 = sphere_verts_[i * 2] * radius + center;
201 float3 v1 = sphere_verts_[i * 2 + 1] * radius + center;
202 draw_line(v0, v1, col);
203 }
204}
205
206void DebugDraw::draw_point(const float3 center, float radius, const float4 color)
207{
208 uint col = color_pack(color);
209 for (auto i : IndexRange(point_verts_.size() / 2)) {
210 float3 v0 = point_verts_[i * 2] * radius + center;
211 float3 v1 = point_verts_[i * 2 + 1] * radius + center;
212 draw_line(v0, v1, col);
213 }
214}
215
217
218/* -------------------------------------------------------------------- */
221
222template<> void DebugDraw::print_value<uint>(const uint &value)
223{
224 print_value_uint(value, false, false, true);
225}
226template<> void DebugDraw::print_value<int>(const int &value)
227{
228 print_value_uint(uint(abs(value)), false, (value < 0), false);
229}
230template<> void DebugDraw::print_value<bool>(const bool &value)
231{
232 print_string(value ? "true " : "false");
233}
234template<> void DebugDraw::print_value<float>(const float &val)
235{
236 std::stringstream ss;
237 ss << std::setw(12) << std::to_string(val);
238 print_string(ss.str());
239}
240template<> void DebugDraw::print_value<double>(const double &val)
241{
242 print_value(float(val));
243}
244
245template<> void DebugDraw::print_value_hex<uint>(const uint &value)
246{
247 print_value_uint(value, true, false, false);
248}
249template<> void DebugDraw::print_value_hex<int>(const int &value)
250{
251 print_value_uint(uint(value), true, false, false);
252}
253template<> void DebugDraw::print_value_hex<float>(const float &value)
254{
255 print_value_uint(*reinterpret_cast<const uint *>(&value), true, false, false);
256}
257template<> void DebugDraw::print_value_hex<double>(const double &val)
258{
259 print_value_hex(float(val));
260}
261
262template<> void DebugDraw::print_value_binary<uint>(const uint &value)
263{
264 print_value_binary(value);
265}
266template<> void DebugDraw::print_value_binary<int>(const int &value)
267{
268 print_value_binary(uint(value));
269}
270template<> void DebugDraw::print_value_binary<float>(const float &value)
271{
272 print_value_binary(*reinterpret_cast<const uint *>(&value));
273}
274template<> void DebugDraw::print_value_binary<double>(const double &val)
275{
276 print_value_binary(float(val));
277}
278
279template<> void DebugDraw::print_value<float2>(const float2 &value)
280{
281 print_no_endl("float2(", value[0], ", ", value[1], ")");
282}
283template<> void DebugDraw::print_value<float3>(const float3 &value)
284{
285 print_no_endl("float3(", value[0], ", ", value[1], ", ", value[1], ")");
286}
287template<> void DebugDraw::print_value<float4>(const float4 &value)
288{
289 print_no_endl("float4(", value[0], ", ", value[1], ", ", value[2], ", ", value[3], ")");
290}
291
292template<> void DebugDraw::print_value<int2>(const int2 &value)
293{
294 print_no_endl("int2(", value[0], ", ", value[1], ")");
295}
296template<> void DebugDraw::print_value<int3>(const int3 &value)
297{
298 print_no_endl("int3(", value[0], ", ", value[1], ", ", value[1], ")");
299}
300template<> void DebugDraw::print_value<int4>(const int4 &value)
301{
302 print_no_endl("int4(", value[0], ", ", value[1], ", ", value[2], ", ", value[3], ")");
303}
304
305template<> void DebugDraw::print_value<uint2>(const uint2 &value)
306{
307 print_no_endl("uint2(", value[0], ", ", value[1], ")");
308}
309template<> void DebugDraw::print_value<uint3>(const uint3 &value)
310{
311 print_no_endl("uint3(", value[0], ", ", value[1], ", ", value[1], ")");
312}
313template<> void DebugDraw::print_value<uint4>(const uint4 &value)
314{
315 print_no_endl("uint4(", value[0], ", ", value[1], ", ", value[2], ", ", value[3], ")");
316}
317
319
320/* -------------------------------------------------------------------- */
326
328{
329 DebugDrawBuf &buf = cpu_draw_buf_;
330 uint index = buf.command.vertex_len;
331 if (index + 2 < DRW_DEBUG_DRAW_VERT_MAX) {
332 buf.verts[index + 0] = vert_pack(math::transform_point(model_mat_, v1), color);
333 buf.verts[index + 1] = vert_pack(math::transform_point(model_mat_, v2), color);
334 buf.command.vertex_len += 2;
335 }
336}
337
338uint DebugDraw::color_pack(float4 color)
339{
340 /* NOTE: keep in sync with #drw_debug_color_pack(). */
341
342 color = math::clamp(color, 0.0f, 1.0f);
343 uint result = 0;
344 result |= uint(color.x * 255.0f) << 0u;
345 result |= uint(color.y * 255.0f) << 8u;
346 result |= uint(color.z * 255.0f) << 16u;
347 result |= uint(color.w * 255.0f) << 24u;
348 return result;
349}
350
351DRWDebugVert DebugDraw::vert_pack(float3 pos, uint color)
352{
353 DRWDebugVert vert;
354 vert.pos0 = *reinterpret_cast<uint32_t *>(&pos.x);
355 vert.pos1 = *reinterpret_cast<uint32_t *>(&pos.y);
356 vert.pos2 = *reinterpret_cast<uint32_t *>(&pos.z);
357 vert.vert_color = color;
358 return vert;
359}
360
361void DebugDraw::print_newline()
362{
363 print_col_ = 0u;
364 print_row_ = ++cpu_print_buf_.command.instance_first_array;
365}
366
367void DebugDraw::print_string_start(uint len)
368{
369 /* Break before word. */
370 if (print_col_ + len > DRW_DEBUG_PRINT_WORD_WRAP_COLUMN) {
371 print_newline();
372 }
373}
374
375/* Copied from gpu_shader_dependency. */
376void DebugDraw::print_string(std::string str)
377{
378 size_t len_before_pad = str.length();
379 /* Pad string to uint size to avoid out of bound reads. */
380 while (str.length() % 4 != 0) {
381 str += " ";
382 }
383
384 print_string_start(len_before_pad);
385 for (size_t i = 0; i < len_before_pad; i += 4) {
386 union {
387 uint8_t chars[4];
388 uint32_t word;
389 };
390
391 chars[0] = *(reinterpret_cast<const uint8_t *>(str.c_str()) + i + 0);
392 chars[1] = *(reinterpret_cast<const uint8_t *>(str.c_str()) + i + 1);
393 chars[2] = *(reinterpret_cast<const uint8_t *>(str.c_str()) + i + 2);
394 chars[3] = *(reinterpret_cast<const uint8_t *>(str.c_str()) + i + 3);
395
396 if (i + 4 > len_before_pad) {
397 chars[len_before_pad - i] = '\0';
398 }
399 print_char4(word);
400 }
401}
402
403/* Keep in sync with shader. */
404void DebugDraw::print_char4(uint data)
405{
406 /* Convert into char stream. */
407 for (; data != 0u; data >>= 8u) {
408 uint char1 = data & 0xFFu;
409 /* Check for null terminator. */
410 if (char1 == 0x00) {
411 break;
412 }
413 /* NOTE: Do not skip the header manually like in GPU. */
414 uint cursor = cpu_print_buf_.command.vertex_len++;
415 if (cursor < DRW_DEBUG_PRINT_MAX) {
416 /* For future usage. (i.e: Color) */
417 uint flags = 0u;
418 uint col = print_col_++;
419 uint print_header = (flags << 24u) | (print_row_ << 16u) | (col << 8u);
420 cpu_print_buf_.char_array[cursor] = print_header | char1;
421 /* Break word. */
422 if (print_col_ > DRW_DEBUG_PRINT_WORD_WRAP_COLUMN) {
423 print_newline();
424 }
425 }
426 }
427}
428
429void DebugDraw::print_append_char(uint char1, uint &char4)
430{
431 char4 = (char4 << 8u) | char1;
432}
433
434void DebugDraw::print_append_digit(uint digit, uint &char4)
435{
436 const uint char_A = 0x41u;
437 const uint char_0 = 0x30u;
438 bool is_hexadecimal = digit > 9u;
439 char4 = (char4 << 8u) | (is_hexadecimal ? (char_A + digit - 10u) : (char_0 + digit));
440}
441
442void DebugDraw::print_append_space(uint &char4)
443{
444 char4 = (char4 << 8u) | 0x20u;
445}
446
447void DebugDraw::print_value_binary(uint value)
448{
449 print_string("0b");
450 print_string_start(10u * 4u);
451 uint digits[10] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u};
452 uint digit = 0u;
453 for (uint i = 0u; i < 32u; i++) {
454 print_append_digit(((value >> i) & 1u), digits[digit / 4u]);
455 digit++;
456 if ((i % 4u) == 3u) {
457 print_append_space(digits[digit / 4u]);
458 digit++;
459 }
460 }
461 /* Numbers are written from right to left. So we need to reverse the order. */
462 for (int j = 9; j >= 0; j--) {
463 print_char4(digits[j]);
464 }
465}
466
467void DebugDraw::print_value_uint(uint value,
468 const bool hex,
469 bool is_negative,
470 const bool is_unsigned)
471{
472 print_string_start(3u * 4u);
473 const uint blank_value = hex ? 0x30303030u : 0x20202020u;
474 const uint prefix = hex ? 0x78302020u : 0x20202020u;
475 uint digits[3] = {blank_value, blank_value, prefix};
476 const uint base = hex ? 16u : 10u;
477 uint digit = 0u;
478 /* Add `u` suffix. */
479 if (is_unsigned) {
480 print_append_char('u', digits[digit / 4u]);
481 digit++;
482 }
483 /* Number's digits. */
484 for (; value != 0u || digit == uint(is_unsigned); value /= base) {
485 print_append_digit(value % base, digits[digit / 4u]);
486 digit++;
487 }
488 /* Add negative sign. */
489 if (is_negative) {
490 print_append_char('-', digits[digit / 4u]);
491 digit++;
492 }
493 /* Need to pad to uint alignment because we are issuing chars in "reverse". */
494 for (uint i = digit % 4u; i < 4u && i > 0u; i++) {
495 print_append_space(digits[digit / 4u]);
496 digit++;
497 }
498 /* Numbers are written from right to left. So we need to reverse the order. */
499 for (int j = 2; j >= 0; j--) {
500 print_char4(digits[j]);
501 }
502}
503
505
506/* -------------------------------------------------------------------- */
509
510void DebugDraw::display_lines()
511{
512 if (cpu_draw_buf_.command.vertex_len == 0 && gpu_draw_buf_used == false) {
513 return;
514 }
515 GPU_debug_group_begin("Lines");
516 cpu_draw_buf_.push_update();
517
518 float4x4 persmat;
520 DRW_view_persmat_get(view, persmat.ptr(), false);
521
523
527 GPU_shader_uniform_mat4(shader, "persmat", persmat.ptr());
528
529 if (gpu_draw_buf_used) {
532 GPU_batch_draw_indirect(batch, gpu_draw_buf_, 0);
533 GPU_storagebuf_unbind(gpu_draw_buf_);
535 }
536
539 GPU_batch_draw_indirect(batch, cpu_draw_buf_, 0);
540 GPU_storagebuf_unbind(cpu_draw_buf_);
542
544}
545
546void DebugDraw::display_prints()
547{
548 if (cpu_print_buf_.command.vertex_len == 0 && gpu_print_buf_used == false) {
549 return;
550 }
551 GPU_debug_group_begin("Prints");
552 cpu_print_buf_.push_update();
553
555
559 float f_viewport[4];
560 GPU_viewport_size_get_f(f_viewport);
561 GPU_shader_uniform_2fv(shader, "viewport_size", &f_viewport[2]);
562
563 if (gpu_print_buf_used) {
566 GPU_batch_draw_indirect(batch, gpu_print_buf_, 0);
567 GPU_storagebuf_unbind(gpu_print_buf_);
569 }
570
573 GPU_batch_draw_indirect(batch, cpu_print_buf_, 0);
574 GPU_storagebuf_unbind(cpu_print_buf_);
576
578}
579
581{
582 GPU_debug_group_begin("DebugDraw");
583
584 display_lines();
585 /* Print 3D shapes before text to avoid overlaps. */
586 display_prints();
587 /* Init again so we don't draw the same thing twice. */
588 init();
589
591}
592
594
595} // namespace blender::draw
596
597/* -------------------------------------------------------------------- */
600
602{
603 return reinterpret_cast<blender::draw::DebugDraw *>(DST.debug);
604}
605
607
608/* -------------------------------------------------------------------- */
611
613{
614#ifdef DRAW_DEBUG
615 if (DST.debug == nullptr) {
616 return;
617 }
618 /* TODO(@fclem): Convenience for now. Will have to move to #DRWManager. */
619 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->display_to_view();
620#endif
621}
622
624{
625 /* NOTE: Init is once per draw manager cycle. */
626
627 /* Module should not be used in release builds. */
628 /* TODO(@fclem): Hide the functions declarations without using `ifdefs` everywhere. */
629#ifdef DRAW_DEBUG
630 /* TODO(@fclem): Convenience for now. Will have to move to #DRWManager. */
631 if (DST.debug == nullptr) {
632 DST.debug = reinterpret_cast<DRWDebugModule *>(new blender::draw::DebugDraw());
633 }
634 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->init();
635#endif
636}
637
638void drw_debug_module_free(DRWDebugModule *module)
639{
640 if (module != nullptr) {
641 delete reinterpret_cast<blender::draw::DebugDraw *>(module);
642 }
643}
644
646{
647 return reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->gpu_draw_buf_get();
648}
649
651{
652 return reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->gpu_print_buf_get();
653}
654
656
657/* -------------------------------------------------------------------- */
660
662{
663 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->modelmat_reset();
664}
665
666void DRW_debug_modelmat(const float modelmat[4][4])
667{
668#ifdef DRAW_DEBUG
669 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->modelmat_set(modelmat);
670#else
671 UNUSED_VARS(modelmat);
672#endif
673}
674
675void DRW_debug_line_v3v3(const float v1[3], const float v2[3], const float color[4])
676{
677 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->draw_line(v1, v2, color);
678}
679
680void DRW_debug_polygon_v3(const float (*v)[3], int vert_len, const float color[4])
681{
682 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->draw_polygon(
683 blender::Span<float3>((float3 *)v, vert_len), color);
684}
685
686void DRW_debug_m4(const float m[4][4])
687{
688 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->draw_matrix(float4x4(m));
689}
690
691void DRW_debug_m4_as_bbox(const float m[4][4], bool invert, const float color[4])
692{
693 blender::float4x4 m4(m);
694 if (invert) {
695 m4 = blender::math::invert(m4);
696 }
697 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->draw_matrix_as_bbox(m4, color);
698}
699
700void DRW_debug_bbox(const BoundBox *bbox, const float color[4])
701{
702#ifdef DRAW_DEBUG
703 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->draw_bbox(*bbox, color);
704#else
705 UNUSED_VARS(bbox, color);
706#endif
707}
708
709void DRW_debug_sphere(const float center[3], float radius, const float color[4])
710{
711 reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->draw_sphere(center, radius, color);
712}
713
General operations, lookup, etc. for blender objects.
void BKE_boundbox_init_from_minmax(BoundBox *bb, const float min[3], const float max[3])
#define BLI_assert(a)
Definition BLI_assert.h:50
#define M_PI
void mul_project_m4_v3(const float mat[4][4], float vec[3])
unsigned int uint
#define UNUSED_VARS(...)
struct DRWView DRWView
Definition DRW_render.hh:89
static AppView * view
void GPU_batch_draw_indirect(blender::gpu::Batch *batch, GPUStorageBuf *indirect_buf, intptr_t offset)
void GPU_batch_set_shader(blender::gpu::Batch *batch, GPUShader *shader)
void GPU_debug_group_end()
Definition gpu_debug.cc:33
void GPU_debug_group_begin(const char *name)
Definition gpu_debug.cc:22
void GPU_shader_uniform_2fv(GPUShader *sh, const char *name, const float data[2])
void GPU_shader_uniform_mat4(GPUShader *sh, const char *name, const float data[4][4])
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:262
void GPU_storagebuf_bind(GPUStorageBuf *ssbo, int slot)
void GPU_storagebuf_unbind(GPUStorageBuf *ssbo)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:125
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
struct GPUShader GPUShader
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
void init()
constexpr const T & last(const int64_t n=0) const
Definition BLI_span.hh:326
constexpr bool is_empty() const
Definition BLI_span.hh:261
void modelmat_set(const float modelmat[4][4])
void print_no_endl(std::string arg)
void draw_matrix(const float4x4 &m4)
void draw_polygon(Span< float3 > face_verts, float4 color={1, 0, 0, 1})
void draw_matrix_as_bbox(const float4x4 &mat, const float4 color={1, 0, 0, 1})
void draw_sphere(const float3 center, float radius, const float4 color={1, 0, 0, 1})
void draw_bbox(const BoundBox &bbox, const float4 color={1, 0, 0, 1})
GPUStorageBuf * gpu_print_buf_get()
GPUStorageBuf * gpu_draw_buf_get()
void draw_line(float3 v1, float3 v2, float4 color={1, 0, 0, 1})
void draw_point(const float3 center, float radius=0.01f, const float4 color={1, 0, 0, 1})
#define sinf(x)
#define cosf(x)
blender::gpu::Batch * drw_cache_procedural_lines_get()
blender::gpu::Batch * drw_cache_procedural_points_get()
void drw_debug_init()
GPUStorageBuf * drw_debug_gpu_print_buf_get()
void DRW_debug_modelmat(const float modelmat[4][4])
blender::draw::DebugDraw * DRW_debug_get()
void DRW_debug_sphere(const float center[3], float radius, const float color[4])
void DRW_debug_m4(const float m[4][4])
void drw_debug_module_free(DRWDebugModule *module)
void DRW_debug_line_v3v3(const float v1[3], const float v2[3], const float color[4])
void drw_debug_draw()
void DRW_debug_modelmat_reset()
void DRW_debug_bbox(const BoundBox *bbox, const float color[4])
GPUStorageBuf * drw_debug_gpu_draw_buf_get()
void DRW_debug_polygon_v3(const float(*v)[3], int vert_len, const float color[4])
void DRW_debug_m4_as_bbox(const float m[4][4], bool invert, const float color[4])
Simple API to draw debug shapes and log in the viewport.
Simple API to draw debug shapes in the viewport. IMPORTANT: This is the legacy API for C....
#define DRW_DEBUG_DRAW_SLOT
#define DRW_DEBUG_PRINT_SLOT
DRWManager DST
int len
void drw_state_set(DRWState state)
void DRW_view_persmat_get(const DRWView *view, float mat[4][4], bool inverse)
const DRWView * DRW_view_get_active()
GPUShader * DRW_shader_debug_draw_display_get()
GPUShader * DRW_shader_debug_print_display_get()
#define DRW_DEBUG_PRINT_WORD_WRAP_COLUMN
#define DRW_DEBUG_PRINT_MAX
#define DRW_DEBUG_DRAW_VERT_MAX
@ DRW_STATE_DEPTH_LESS
Definition draw_state.hh:37
@ DRW_STATE_PROGRAM_POINT_SIZE
Definition draw_state.hh:72
@ DRW_STATE_WRITE_DEPTH
Definition draw_state.hh:29
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
draw_view in_light_buf[] float
#define str(s)
uint col
struct @157336070235062372277311340362362342103123126032::@262166344314164341202215145112231240022370055142 batch
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition invert.h:9
T clamp(const T &a, const T &min, const T &max)
bool is_negative(const MatBase< T, Size, Size > &mat)
T min(const T &a, const T &b)
CartesianBasis invert(const CartesianBasis &basis)
T max(const T &a, const T &b)
T abs(const T &a)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void index(const bNode &, void *r_value)
VecBase< uint32_t, 2 > uint2
VecBase< int32_t, 4 > int4
VecBase< uint32_t, 4 > uint4
VecBase< uint32_t, 3 > uint3
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
blender::VecBase< int8_t, 4 > char4
MatView< float, 4, 4, 4, 4, 0, 0, alignof(float)> float4x4_view
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
static struct PyModuleDef module
Definition python.cpp:991
unsigned int uint32_t
Definition stdint.h:80
unsigned char uint8_t
Definition stdint.h:78
float vec[8][3]
const c_style_mat & ptr() const
static const char hex[17]
Definition thumbs.cc:159