This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/intern/shaders/common_debug_shape_lib.glsl
Clément Foucault 1226f5848d DRW: Add intersection and shape libraries for GLSL
These are meant to provide easy shape and AABB operation for culling.

They are currently incomplete but can be extended as one see fits.

The `common_debug_shape_lib.glsl` contains helper to draw thoses shapes.
2022-08-14 20:40:04 +02:00

58 lines
1.9 KiB
GLSL

/**
* Debug drawing of shapes.
*/
#pragma BLENDER_REQUIRE(common_debug_draw_lib.glsl)
#pragma BLENDER_REQUIRE(common_shape_lib.glsl)
void drw_debug(Box shape, vec4 color)
{
drw_debug_quad(shape.corners[0], shape.corners[1], shape.corners[2], shape.corners[3], color);
drw_debug_line(shape.corners[0], shape.corners[4], color);
drw_debug_line(shape.corners[1], shape.corners[5], color);
drw_debug_line(shape.corners[2], shape.corners[6], color);
drw_debug_line(shape.corners[3], shape.corners[7], color);
drw_debug_quad(shape.corners[4], shape.corners[5], shape.corners[6], shape.corners[7], color);
}
void drw_debug(Box shape)
{
drw_debug(shape, drw_debug_default_color);
}
void drw_debug(Frustum shape, vec4 color)
{
drw_debug_quad(shape.corners[0], shape.corners[1], shape.corners[2], shape.corners[3], color);
drw_debug_line(shape.corners[0], shape.corners[4], color);
drw_debug_line(shape.corners[1], shape.corners[5], color);
drw_debug_line(shape.corners[2], shape.corners[6], color);
drw_debug_line(shape.corners[3], shape.corners[7], color);
drw_debug_quad(shape.corners[4], shape.corners[5], shape.corners[6], shape.corners[7], color);
}
void drw_debug(Frustum shape)
{
drw_debug(shape, drw_debug_default_color);
}
void drw_debug(Pyramid shape, vec4 color)
{
drw_debug_line(shape.corners[0], shape.corners[1], color);
drw_debug_line(shape.corners[0], shape.corners[2], color);
drw_debug_line(shape.corners[0], shape.corners[3], color);
drw_debug_line(shape.corners[0], shape.corners[4], color);
drw_debug_quad(shape.corners[1], shape.corners[2], shape.corners[3], shape.corners[4], color);
}
void drw_debug(Pyramid shape)
{
drw_debug(shape, drw_debug_default_color);
}
void drw_debug(Sphere shape, vec4 color)
{
drw_debug_sphere(shape.center, shape.radius, color);
}
void drw_debug(Sphere shape)
{
drw_debug(shape, drw_debug_default_color);
}