Blender V4.3
blender::draw::DebugDraw Class Reference

#include <draw_debug.hh>

Public Member Functions

 ~DebugDraw ()
 
template<typename... Ts>
void print (StringRefNull str, Ts... args)
 
template<typename T >
void print (const T &value)
 
template<typename T >
void print_hex (const T &value)
 
template<typename T >
void print_binary (const T &value)
 
void print_no_endl (std::string arg)
 
void print_no_endl (StringRef arg)
 
void print_no_endl (StringRefNull arg)
 
void print_no_endl (char const *arg)
 
template<typename T >
void print_no_endl (T arg)
 
template<typename T , typename... Ts>
void print_no_endl (T arg, Ts... args)
 
Init and state
 DebugDraw ()
 
void init ()
 
void modelmat_reset ()
 
void modelmat_set (const float modelmat[4][4])
 
GPUStorageBuf * gpu_draw_buf_get ()
 
GPUStorageBuf * gpu_print_buf_get ()
 
Draw functions
void draw_line (float3 v1, float3 v2, float4 color={1, 0, 0, 1})
 
void draw_polygon (Span< float3 > face_verts, float4 color={1, 0, 0, 1})
 
void draw_bbox (const BoundBox &bbox, const float4 color={1, 0, 0, 1})
 
void draw_sphere (const float3 center, float radius, const float4 color={1, 0, 0, 1})
 
void draw_point (const float3 center, float radius=0.01f, const float4 color={1, 0, 0, 1})
 
void draw_matrix (const float4x4 &m4)
 
void draw_matrix_as_bbox (const float4x4 &mat, const float4 color={1, 0, 0, 1})
 

Display

void display_to_view ()
 

Detailed Description

Definition at line 43 of file draw_debug.hh.

Constructor & Destructor Documentation

◆ DebugDraw()

blender::draw::DebugDraw::DebugDraw ( )

Definition at line 40 of file draw_debug.cc.

References cosf, float, M_PI, and sinf.

◆ ~DebugDraw()

blender::draw::DebugDraw::~DebugDraw ( )
inline

Definition at line 67 of file draw_debug.hh.

Member Function Documentation

◆ display_to_view()

void blender::draw::DebugDraw::display_to_view ( )

Will draw all debug shapes and text cached up until now to the current view / frame-buffer. Draw buffers will be emptied and ready for new debug data.

Definition at line 580 of file draw_debug.cc.

References GPU_debug_group_begin(), GPU_debug_group_end(), and init().

◆ draw_bbox()

void blender::draw::DebugDraw::draw_bbox ( const BoundBox & bbox,
const float4 color = {1, 0, 0, 1} )

Definition at line 166 of file draw_debug.cc.

References col, draw_line(), and BoundBox::vec.

Referenced by draw_matrix_as_bbox().

◆ draw_line()

void blender::draw::DebugDraw::draw_line ( float3 v1,
float3 v2,
float4 color = {1, 0, 0, 1} )

Drawing functions that will draw wire-frames with the given color.

Definition at line 131 of file draw_debug.cc.

References draw_line(), and v2.

Referenced by draw_bbox(), draw_line(), draw_matrix(), draw_point(), draw_polygon(), and draw_sphere().

◆ draw_matrix()

void blender::draw::DebugDraw::draw_matrix ( const float4x4 & m4)

Draw a matrix transformation as 3 colored axes.

Definition at line 149 of file draw_debug.cc.

References draw_line(), mul_project_m4_v3(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), and v2.

◆ draw_matrix_as_bbox()

void blender::draw::DebugDraw::draw_matrix_as_bbox ( const float4x4 & mat,
const float4 color = {1, 0, 0, 1} )

Draw a matrix as a 2 units length bounding box, centered on origin.

Definition at line 185 of file draw_debug.cc.

References BKE_boundbox_init_from_minmax(), draw_bbox(), min, mul_project_m4_v3(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), and BoundBox::vec.

◆ draw_point()

void blender::draw::DebugDraw::draw_point ( const float3 center,
float radius = 0.01f,
const float4 color = {1, 0, 0, 1} )

Definition at line 206 of file draw_debug.cc.

References col, and draw_line().

◆ draw_polygon()

void blender::draw::DebugDraw::draw_polygon ( Span< float3 > face_verts,
float4 color = {1, 0, 0, 1} )

◆ draw_sphere()

void blender::draw::DebugDraw::draw_sphere ( const float3 center,
float radius,
const float4 color = {1, 0, 0, 1} )

Definition at line 196 of file draw_debug.cc.

References col, and draw_line().

◆ gpu_draw_buf_get()

GPUStorageBuf * blender::draw::DebugDraw::gpu_draw_buf_get ( )

Not to be called by user. Should become private.

Definition at line 107 of file draw_debug.cc.

References blender::draw::detail::StorageCommon< T, len, device_only >::push_update().

◆ gpu_print_buf_get()

GPUStorageBuf * blender::draw::DebugDraw::gpu_print_buf_get ( )

◆ init()

void blender::draw::DebugDraw::init ( )

Resets all buffers and reset model matrix state. Not to be called by user.

Definition at line 67 of file draw_debug.cc.

References DRWDebugDrawBuffer::command, DRWDebugPrintBuffer::command, DrawCommand::instance_first_array, DrawCommand::instance_len, modelmat_reset(), DrawCommand::vertex_first, and DrawCommand::vertex_len.

Referenced by display_to_view().

◆ modelmat_reset()

void blender::draw::DebugDraw::modelmat_reset ( )

Resets model matrix state to identity.

Definition at line 97 of file draw_debug.cc.

References blender::MatBase< float, 4, 4 >::identity().

Referenced by init().

◆ modelmat_set()

void blender::draw::DebugDraw::modelmat_set ( const float modelmat[4][4])

Sets model matrix transform to apply to any vertex passed to drawing functions.

Definition at line 102 of file draw_debug.cc.

◆ print() [1/2]

template<typename T >
void blender::draw::DebugDraw::print ( const T & value)
inline

Definition at line 117 of file draw_debug.hh.

◆ print() [2/2]

template<typename... Ts>
void blender::draw::DebugDraw::print ( StringRefNull str,
Ts... args )
inline

Log variable or strings inside the viewport. Using a unique non string argument will print the variable name with it. Concatenate by using multiple arguments. i.e: print("Looped ", n, "times.").

Definition at line 112 of file draw_debug.hh.

References print_no_endl(), and str.

◆ print_binary()

template<typename T >
void blender::draw::DebugDraw::print_binary ( const T & value)
inline

Definition at line 127 of file draw_debug.hh.

◆ print_hex()

template<typename T >
void blender::draw::DebugDraw::print_hex ( const T & value)
inline

Definition at line 122 of file draw_debug.hh.

◆ print_no_endl() [1/6]

void blender::draw::DebugDraw::print_no_endl ( char const * arg)
inline

Definition at line 148 of file draw_debug.hh.

◆ print_no_endl() [2/6]

void blender::draw::DebugDraw::print_no_endl ( std::string arg)
inline

Same as print() but does not finish the line.

Definition at line 136 of file draw_debug.hh.

Referenced by print(), and print_no_endl().

◆ print_no_endl() [3/6]

void blender::draw::DebugDraw::print_no_endl ( StringRef arg)
inline

Definition at line 140 of file draw_debug.hh.

◆ print_no_endl() [4/6]

void blender::draw::DebugDraw::print_no_endl ( StringRefNull arg)
inline

Definition at line 144 of file draw_debug.hh.

◆ print_no_endl() [5/6]

template<typename T >
void blender::draw::DebugDraw::print_no_endl ( T arg)
inline

Definition at line 152 of file draw_debug.hh.

◆ print_no_endl() [6/6]

template<typename T , typename... Ts>
void blender::draw::DebugDraw::print_no_endl ( T arg,
Ts... args )
inline

Definition at line 156 of file draw_debug.hh.

References print_no_endl().


The documentation for this class was generated from the following files: