Unravel Engine C++ Reference
Loading...
Searching...
No Matches
debugdraw.cpp File Reference
#include "debugdraw.h"
#include "../bgfx_utils.h"
#include "../packrect.h"
#include <bgfx/bgfx.h>
#include <bgfx/embedded_shader.h>
#include <bx/debug.h>
#include <bx/handlealloc.h>
#include <bx/math.h>
#include <bx/mutex.h>
#include <bx/sort.h>
#include "fs_debugdraw_fill.bin.h"
#include "fs_debugdraw_fill_lit.bin.h"
#include "fs_debugdraw_fill_texture.bin.h"
#include "fs_debugdraw_lines.bin.h"
#include "fs_debugdraw_lines_stipple.bin.h"
#include "vs_debugdraw_fill.bin.h"
#include "vs_debugdraw_fill_lit.bin.h"
#include "vs_debugdraw_fill_lit_mesh.bin.h"
#include "vs_debugdraw_fill_mesh.bin.h"
#include "vs_debugdraw_fill_texture.bin.h"
#include "vs_debugdraw_lines.bin.h"
#include "vs_debugdraw_lines_stipple.bin.h"

Go to the source code of this file.

Classes

struct  DebugVertex
 
struct  DebugUvVertex
 
struct  DebugShapeVertex
 
struct  DebugMeshVertex
 
struct  SpriteT< MaxHandlesT, TextureSizeT >
 
struct  GeometryT< MaxHandlesT >
 
struct  GeometryT< MaxHandlesT >::Geometry
 
struct  Attrib
 
struct  Program
 
struct  DebugMesh
 
struct  DebugDrawShared
 
struct  DebugDrawEncoderImpl
 
struct  DebugDrawEncoderImpl::State
 
struct  DebugDrawEncoderImpl::MatrixStack
 

Macros

#define DEBUG_DRAW_CONFIG_MAX_GEOMETRY   256
 
#define SPRITE_TEXTURE_SIZE   1024
 
#define DEBUG_DRAW_ENCODER(_func)
 

Typedefs

typedef SpriteT< 256, SPRITE_TEXTURE_SIZESprite
 
typedef GeometryT< DEBUG_DRAW_CONFIG_MAX_GEOMETRYGeometry
 

Functions

static uint8_t getCircleLod (uint8_t _lod)
 
static void circle (float *_out, float _angle)
 
static void squircle (float *_out, float _angle)
 
uint32_t genSphere (uint8_t _subdiv0, void *_pos0=NULL, uint16_t _posStride0=0, void *_normals0=NULL, uint16_t _normalStride0=0)
 
bx::Vec3 getPoint (Axis::Enum _axis, float _x, float _y)
 
void ddInit (bx::AllocatorI *_allocator)
 
void ddShutdown ()
 
SpriteHandle ddCreateSprite (uint16_t _width, uint16_t _height, const void *_data)
 
void ddDestroy (SpriteHandle _handle)
 
GeometryHandle ddCreateGeometry (uint32_t _numVertices, const DdVertex *_vertices, uint32_t _numIndices, const void *_indices, bool _index32)
 
void ddDestroy (GeometryHandle _handle)
 

Variables

static DebugShapeVertex s_quadVertices [4]
 
static const uint16_t s_quadIndices [6]
 
static DebugShapeVertex s_cubeVertices [8]
 
static const uint16_t s_cubeIndices [36]
 
static const uint8_t s_circleLod []
 
static const bgfx::EmbeddedShader s_embeddedShaders []
 
static DebugDrawShared s_dds
 
static bool s_initted = false
 
static DebugDrawEncoderImpl s_dde
 

Macro Definition Documentation

◆ DEBUG_DRAW_CONFIG_MAX_GEOMETRY

#define DEBUG_DRAW_CONFIG_MAX_GEOMETRY   256

Definition at line 19 of file debugdraw.cpp.

◆ DEBUG_DRAW_ENCODER

#define DEBUG_DRAW_ENCODER ( _func)
Value:
reinterpret_cast<DebugDrawEncoderImpl*>(this)->_func

Definition at line 2321 of file debugdraw.cpp.

◆ SPRITE_TEXTURE_SIZE

#define SPRITE_TEXTURE_SIZE   1024

Definition at line 330 of file debugdraw.cpp.

Typedef Documentation

◆ Geometry

Definition at line 541 of file debugdraw.cpp.

◆ Sprite

Definition at line 540 of file debugdraw.cpp.

Function Documentation

◆ circle()

static void circle ( float * _out,
float _angle )
static

Definition at line 155 of file debugdraw.cpp.

◆ ddCreateGeometry()

GeometryHandle ddCreateGeometry ( uint32_t _numVertices,
const DdVertex * _vertices,
uint32_t _numIndices,
const void * _indices,
bool _index32 )

Definition at line 2307 of file debugdraw.cpp.

◆ ddCreateSprite()

SpriteHandle ddCreateSprite ( uint16_t _width,
uint16_t _height,
const void * _data )

Definition at line 2297 of file debugdraw.cpp.

◆ ddDestroy() [1/2]

void ddDestroy ( GeometryHandle _handle)

Definition at line 2316 of file debugdraw.cpp.

◆ ddDestroy() [2/2]

void ddDestroy ( SpriteHandle _handle)

Definition at line 2302 of file debugdraw.cpp.

◆ ddInit()

void ddInit ( bx::AllocatorI * _allocator)

Definition at line 2281 of file debugdraw.cpp.

◆ ddShutdown()

void ddShutdown ( )

Definition at line 2288 of file debugdraw.cpp.

◆ genSphere()

uint32_t genSphere ( uint8_t _subdiv0,
void * _pos0 = NULL,
uint16_t _posStride0 = 0,
void * _normals0 = NULL,
uint16_t _normalStride0 = 0 )

Definition at line 171 of file debugdraw.cpp.

◆ getCircleLod()

static uint8_t getCircleLod ( uint8_t _lod)
static

Definition at line 149 of file debugdraw.cpp.

◆ getPoint()

bx::Vec3 getPoint ( Axis::Enum _axis,
float _x,
float _y )

Definition at line 287 of file debugdraw.cpp.

◆ squircle()

static void squircle ( float * _out,
float _angle )
static

Definition at line 163 of file debugdraw.cpp.

Variable Documentation

◆ s_circleLod

const uint8_t s_circleLod[]
static
Initial value:
= {
37,
29,
23,
17,
11,
}

Definition at line 141 of file debugdraw.cpp.

◆ s_cubeIndices

const uint16_t s_cubeIndices[36]
static
Initial value:
= {
0, 1, 2,
1, 3, 2, 4, 6, 5,
5, 6, 7, 0, 2, 4,
4, 2, 6, 1, 5, 3,
5, 7, 3, 0, 4, 1,
4, 5, 1, 2, 3, 6,
6, 3, 7,
}

Definition at line 131 of file debugdraw.cpp.

◆ s_cubeVertices

DebugShapeVertex s_cubeVertices[8]
static
Initial value:
= {
{-1.0f, 1.0f, 1.0f, {0, 0, 0, 0}},
{1.0f, 1.0f, 1.0f, {0, 0, 0, 0}},
{-1.0f, -1.0f, 1.0f, {0, 0, 0, 0}},
{1.0f, -1.0f, 1.0f, {0, 0, 0, 0}},
{-1.0f, 1.0f, -1.0f, {0, 0, 0, 0}},
{1.0f, 1.0f, -1.0f, {0, 0, 0, 0}},
{-1.0f, -1.0f, -1.0f, {0, 0, 0, 0}},
{1.0f, -1.0f, -1.0f, {0, 0, 0, 0}},
}

Definition at line 120 of file debugdraw.cpp.

◆ s_dde

DebugDrawEncoderImpl s_dde
static

Definition at line 2278 of file debugdraw.cpp.

◆ s_dds

DebugDrawShared s_dds
static

Definition at line 974 of file debugdraw.cpp.

◆ s_embeddedShaders

const bgfx::EmbeddedShader s_embeddedShaders[]
static
Initial value:
= {BGFX_EMBEDDED_SHADER(vs_debugdraw_lines),
BGFX_EMBEDDED_SHADER(fs_debugdraw_lines),
BGFX_EMBEDDED_SHADER(vs_debugdraw_lines_stipple),
BGFX_EMBEDDED_SHADER(fs_debugdraw_lines_stipple),
BGFX_EMBEDDED_SHADER(vs_debugdraw_fill),
BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_mesh),
BGFX_EMBEDDED_SHADER(fs_debugdraw_fill),
BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_lit),
BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_lit_mesh),
BGFX_EMBEDDED_SHADER(fs_debugdraw_fill_lit),
BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_texture),
BGFX_EMBEDDED_SHADER(fs_debugdraw_fill_texture),
BGFX_EMBEDDED_SHADER_END()}

Definition at line 315 of file debugdraw.cpp.

◆ s_initted

bool s_initted = false
static

Definition at line 2277 of file debugdraw.cpp.

◆ s_quadIndices

const uint16_t s_quadIndices[6]
static
Initial value:
= {
0,
1,
2,
1,
3,
2,
}

Definition at line 111 of file debugdraw.cpp.

◆ s_quadVertices

DebugShapeVertex s_quadVertices[4]
static
Initial value:
= {
{-1.0f, 0.0f, 1.0f, {0, 0, 0, 0}},
{1.0f, 0.0f, 1.0f, {0, 0, 0, 0}},
{-1.0f, 0.0f, -1.0f, {0, 0, 0, 0}},
{1.0f, 0.0f, -1.0f, {0, 0, 0, 0}},
}

Definition at line 103 of file debugdraw.cpp.