candlewick 0.1.0
A renderer
Loading...
Searching...
No Matches
candlewick Namespace Reference

Namespaces

namespace  camera_util
 
namespace  constants
 
namespace  detail
 
namespace  effects
 
namespace  frustum_debug
 
namespace  math
 
namespace  media
 
namespace  multibody
 Support for the Pinocchio rigid-body algorithms library and the Coal collision detection library.
 
namespace  rend
 
namespace  ssao
 

Classes

struct  Camera
 The main way of using a camera to render things. More...
 
class  CommandBuffer
 
struct  CylindricalCamera
 
struct  DebugBoundsComponent
 
struct  DebugFrustumComponent
 
struct  DebugMeshComponent
 
class  DebugScene
 Scene for organizing debug entities and render systems. More...
 
struct  DefaultVertex
 
struct  Deg
 Strong type for floating-point variables representing angles (in degrees). More...
 
struct  DepthDebugPass
 
class  DepthPass
 Helper struct for depth or light pre-passes. More...
 
struct  Device
 RAII wrapper for SDL_GPUDevice. More...
 
struct  DirectionalLight
 
struct  Disable
 Tag struct for disabled (invisible) entities. More...
 
struct  EnvironmentTag
 
class  FrustumBoundsDebugSystem
 
struct  GpuMat3
 
class  GuiSystem
 
struct  IDebugSubSystem
 A subsystem for the DebugScene. More...
 
class  Mesh
 Handle class for meshes (vertex buffers and an optional index buffer) on the GPU. More...
 
class  MeshData
 A class to store type-erased vertex data and index data. More...
 
struct  MeshDataBase
 
struct  MeshDataView
 
class  MeshLayout
 This class defines the layout of a mesh's vertices. More...
 
struct  MeshMaterialComponent
 
class  MeshView
 A view into a Mesh object. More...
 
struct  NoInitT
 Tag type for non-initializing constructors (for e.g. RAII classes) More...
 
struct  Opaque
 Tag struct for denoting an entity as opaque, for render pass organization. More...
 
struct  PbrMaterial
 PBR material for metallic-roughness workflow. More...
 
struct  PhongMaterial
 Material parameters for a Blinn-Phong lighting model. More...
 
struct  PosNormalVertex
 
struct  PosOnlyVertex
 
struct  Rad
 Strong type for floating-point variables representing angles (in radians). More...
 
struct  RAIIException
 Wrapper for std::runtime_error, which prints out the filename and code line. More...
 
struct  Renderer
 The Renderer class provides a rendering context for a graphical application. More...
 
struct  Shader
 RAII wrapper around SDL_GPUShader, with loading utilities. More...
 
class  ShadowMapPass
 Helper struct for shadow mapping pass. More...
 
class  strided_view
 A strided view to data, allowing for type-erased data. More...
 
class  Texture
 
struct  TransformComponent
 
struct  TransformUniformData
 
struct  VertexTraits
 
struct  VertexTraits< DefaultVertex >
 
struct  VertexTraits< PosNormalVertex >
 
struct  VertexTraits< PosOnlyVertex >
 
struct  Window
 RAII wrapper for the SDL_Window opaque type. More...
 

Concepts

concept  GpuCompatibleData
 
concept  IsVertexType
 Basic concept checking if type V has the correct layout and alignment requirements to be a vertex element.
 
concept  Scene
 

Typedefs

using ShadowPassConfig = ShadowMapPass::Config
 
using Float2 = Eigen::Vector2f
 
using Float3 = Eigen::Vector3f
 
using Float4 = Eigen::Vector4f
 
using Mat3f = Eigen::Matrix3f
 
using Mat4f = Eigen::Matrix4f
 
using Vec3u8 = Eigen::Matrix<Uint8, 3, 1>
 
using Vec4u8 = Eigen::Matrix<Uint8, 4, 1>
 
using FrustumCornersType = std::array<Float3, 8ul>
 
using GpuVec2 = Eigen::Matrix<float, 2, 1, Eigen::DontAlign>
 
using GpuVec3 = Eigen::Matrix<float, 3, 1, Eigen::DontAlign>
 
using GpuVec4 = Eigen::Matrix<float, 4, 1, Eigen::DontAlign>
 
using GpuMat4 = Eigen::Matrix<float, 4, 4, Eigen::ColMajor | Eigen::DontAlign>
 
using Radf = Rad<float>
 
using Degf = Deg<float>
 
using OpaqueCastable = std::tuple<const Mesh &, Mat4f>
 Intermediary argument type for shadow-casting or opaque objects. For use in depth or light pre-passes.
 

Enumerations

enum class  CameraProjection { PERSPECTIVE , ORTHOGRAPHIC }
 
enum class  DebugPipelines { TRIANGLE_FILL , LINE }
 
enum class  VertexAttrib : Uint16 {
  Position , Normal , Tangent , Bitangent ,
  Color0 , Color1 , TexCoord0 , TexCoord1
}
 Fixed vertex attributes. More...
 
enum class  mesh_load_retc : Uint16 { FAILED_TO_LOAD = 1 << 0 , NO_MESHES = 1 << 1 , OK = 1 << 4 }
 Return codes for loadSceneMeshes(). More...
 

Functions

Mat4f toTransformationMatrix (const AABB &aabb)
 
Mat4f toTransformationMatrix (const OBB &obb)
 
bool updateTransparencyClassification (entt::registry &reg, entt::entity entity, const MeshMaterialComponent &mmc)
 Updates (adds or removes) the Opaque tag component for a given entity.
 
void renderDepthDebug (const Renderer &renderer, CommandBuffer &cmdBuf, const DepthDebugPass &pass, const DepthDebugPass::Options &opts)
 
SDL_GPUShaderFormat auto_detect_shader_format_subset (const char *name=nullptr)
 Automatically detect which subset of shader formats (MSL, SPIR-V) are compatible with the device.
 
void unreachable ()
 
template<typename... Ts>
void terminate_with_message (std::source_location location, std::string_view fmt, Ts &&...args)
 
template<typename... Ts>
void terminate_with_message (std::string_view fmt, Ts &&...args)
 
void unreachable_with_message (std::string_view msg, std::source_location location=std::source_location::current())
 
std::string generateMediaFilenameFromTimestamp (const char *prefix="cdw_screenshot", const char *extension=".png", DialogFileType file_type=DialogFileType::IMAGES)
 
constexpr double deg2rad (double t)
 
constexpr float deg2rad (float t)
 
constexpr float rad2deg (float t)
 
template<std::floating_point T>
 Rad (T) -> Rad< T >
 
template<std::floating_point T>
 Deg (T) -> Deg< T >
 
template<std::floating_point T>
constexpr Rad< T > operator* (const Rad< T > &left, const T &right)
 
template<std::floating_point T>
constexpr Rad< T > operator* (const T &left, const Rad< T > &right)
 
constexpr auto operator""_radf (long double t)
 
constexpr auto operator""_rad (long double t)
 
constexpr auto operator""_deg (long double t)
 
constexpr auto operator""_degf (long double t)
 
Vec3u8 hexToRgbi (unsigned long hex)
 
Vec4u8 hexToRgbai (unsigned long hex)
 
Float3 hexToRgbf (unsigned long hex)
 
Float4 hexToRgbaf (unsigned long hex)
 
Float3 operator""_rgbf (unsigned long long hex)
 
Float4 operator""_rgbaf (unsigned long long hex)
 
Eigen::Vector3d operator""_rgb (unsigned long long hex)
 
Eigen::Vector4d operator""_rgba (unsigned long long hex)
 
bool validateMesh (const Mesh &mesh)
 Check that all vertex buffers were set, and consistency in the "indexed/non-indexed" status.
 
bool validateMeshView (const MeshView &view)
 Validation for a MeshView object.
 
constexpr Uint64 vertexElementSize (SDL_GPUVertexElementFormat format)
 
bool validateMeshLayout (const MeshLayout &layout)
 Validation function. Checks if a MeshLayout produces invalid data for a Mesh.
 
template<IsVertexType V>
MeshLayout meshLayoutFor ()
 Shortcut for extracting layout from compile-time struct.
 
void setShadersDirectory (const char *path)
 Set the current (global) directory where shaders are to be found.
 
const char * currentShaderDirectory ()
 Get the current (global) directory where shaders are found.
 
SDL_GPUShaderStage detect_shader_stage (const char *filename)
 
const char * shader_format_name (SDL_GPUShaderFormat shader_format)
 
Shader::Config loadShaderMetadata (const char *shader_name)
 Load shader config from metadata. Metadata filename (in JSON format) is inferred from the shader name.
 
template<typename T>
decltype(auto) castCoalGeom (const coal::CollisionGeometry &geometry)
 
MeshData loadCoalPrimitive (const coal::ShapeBase &geometry)
 Load primitive given a coal::CollisionGeometry.
 
MeshData loadCoalConvex (const coal::ConvexBase &geom)
 
MeshData loadCoalHeightField (const coal::HeightField< coal::AABB > &collGeom)
 
MeshData loadCoalHeightField (const coal::HeightField< coal::OBBRSS > &collGeom)
 
template<typename T>
requires std::is_enum_v<T>
void invalid_enum (const char *msg, T type, std::source_location location=std::source_location::current())
 Terminate the application after encountering an invalid enum value.
 
MeshData loadArrowSolid (bool include_normals=false, float shaft_length=0.4f, float shaft_radius=0.01f, float head_length=0.1f, float head_radius=0.02f, Uint32 segments=32)
 Load a solid 3D arrow.
 
std::array< MeshData, 3 > loadTriadSolid (float shaft_length=0.4f, float shaft_radius=0.01f, float head_length=0.1f, float head_radius=0.02f, Uint32 segments=32)
 Create a 3D triad.
 
MeshData loadCapsuleSolid (Uint32 hemisphereRings, Uint32 segments, float length)
 Load a capsule primitive.
 
MeshData loadConeSolid (Uint32 segments, float radius, float length)
 Load a 3D solid cone.
 
MeshDataView loadCubeSolid ()
 Load MeshDataView for a cube.
 
MeshData loadCylinderSolid (Uint32 rings, Uint32 segments, float radius, float height)
 Load a solid 3D cylinder.
 
MeshData loadGrid (Uint32 xyHalfSize, float scale=0.5f)
 Load a line grid.
 
MeshData loadHeightfield (const Eigen::Ref< const Eigen::MatrixXf > &heights, const Eigen::Ref< const Eigen::VectorXf > &xgrid, const Eigen::Ref< const Eigen::VectorXf > &ygrid)
 Load a heightfield, as line geometry.
 
MeshDataView loadPlane ()
 
MeshData loadPlaneTiled (float scale, Uint32 xrepeat, Uint32 yrepeat, bool centered=true)
 
MeshData loadUvSphereSolid (Uint32 rings, Uint32 segments)
 Load a sphere primitive organized in bottom-up rings and left-right segments.
 
PbrMaterial loadFromAssimpMaterial (aiMaterial *material)
 Load our PBR material data from an assimp material.
 
mesh_load_retc loadSceneMeshes (const char *path, std::vector< MeshData > &meshData)
 Load the meshes from the given path. This is implemented using the assimp library.
 
Mesh createMesh (const Device &device, const MeshData &meshData, bool upload=false)
 Convert MeshData to a GPU Mesh object. This creates the required vertex buffer and index buffer (if required).
 
Mesh createMesh (const Device &device, const MeshData &meshData, SDL_GPUBuffer *vertexBuffer, SDL_GPUBuffer *indexBuffer)
 Create a Mesh object from given mesh data, as a view into existing vertex and index buffers.
 
Mesh createMeshFromBatch (const Device &device, std::span< const MeshData > meshDatas, bool upload)
 Create a Mesh from a batch of MeshData.
 
void uploadMeshToDevice (const Device &device, const MeshView &meshView, const MeshData &meshData)
 Upload the contents of a single, individual mesh to the GPU device.
 
void uploadMeshToDevice (const Device &device, const Mesh &mesh, const MeshData &meshData)
 Upload the contents of a single, individual mesh to the GPU device.
 
std::vector< PbrMaterialextractMaterials (std::span< const MeshData > meshDatas)
 
void apply3DTransformInPlace (MeshData &meshData, const Eigen::Affine3f &tr)
 Apply an Eigen::Affine3f 3D transform to a mesh in-place, transforming its vertices.
 
void triangleStripGenerateIndices (Uint32 vertexCount, std::vector< Uint32 > &indices)
 Generate indices for a triangle strip geometry, given the vertex count.
 
MeshData generateIndices (const MeshData &meshData)
 Convert MeshData object to an indexed mesh.
 
MeshData mergeMeshes (std::span< const MeshData > meshes)
 Merge meshes down to a single mesh with consistent indexing.
 
MeshData mergeMeshes (std::vector< MeshData > &&meshes)
 Merge meshes down to a single mesh with consistent indexing.
 
void bgraToRgbaConvert (Uint32 *bgraPixels, Uint32 pixelCount)
 In-place conversion from 8-bit BGRA to 8-bit RGBA.
 
template<typename T>
 strided_view (T *first, size_t, size_t) -> strided_view< T >
 
template<typename T, size_t extent>
 strided_view (std::span< T, extent >, size_t) -> strided_view< T >
 
template<typename T, size_t arr_extent>
 strided_view (T(&)[arr_extent]) -> strided_view< T >
 
Camera view-projection utilities.

These functions should be used to construct Camera objects.

Mat4f lookAt (const Float3 &eye, const Float3 &center, const Float3 &up=Float3::UnitZ())
 
Mat4f perspectiveMatrix (float left, float right, float bottom, float top, float near, float far)
 Compute perspective projection matrix, from clipping plane parameters (left, right, bottom, top, near, far).
 
Mat4f perspectiveFromFov (Radf fovY, float aspectRatio, float nearZ, float farZ)
 Get perspective projection matrix given fov, aspect ratio, and clipping planes.
 
Mat4f orthographicMatrix (const Float2 &sizes, float nearZ, float farZ)
 Compute a centered orthographic projection matrix.
 
Mat4f orthographicMatrix (float left, float right, float bottom, float top, float near, float far)
 Compute an off-center orthographic projection matrix.
 
float orthoProjNear (const Mat4f &proj)
 
float orthoProjFar (const Mat4f &proj)
 
float perspectiveProjNear (const Mat4f &proj)
 
float perspectiveProjFar (const Mat4f &proj)
 
FrustumCornersType frustumFromCameraProjection (const Mat4f &camProj)
 Extract the array of frustum corners, given a camera projection matrix.
 
FrustumCornersType frustumFromCamera (const Camera &camera)
 Get the corners of a Camera's view frustum, in world space.
 
std::pair< Float3, float > frustumBoundingSphereCenterRadius (const FrustumCornersType &worldSpaceCorners)
 
void renderShadowPassFromAABB (CommandBuffer &cmdBuf, ShadowMapPass &passInfo, const DirectionalLight &dirLight, std::span< const OpaqueCastable > castables, const AABB &worldSceneBounds)
 Render shadow pass, using provided scene bounds.
 
void renderShadowPassFromFrustum (CommandBuffer &cmdBuf, ShadowMapPass &passInfo, const DirectionalLight &dirLight, std::span< const OpaqueCastable > castables, const FrustumCornersType &worldSpaceCorners)
 Render shadow pass, using a provided world-space frustum.
 
Mat4f shadowOrthographicMatrix (const Float2 &sizes, float zMin, float zMax)
 Orthographic matrix which maps to the negative-Z half-volume of the NDC cube, for depth-testing/shadow mapping purposes.
 

Variables

constexpr const char * g_default_shader_dir = CANDLEWICK_SHADER_BIN_DIR
 
constexpr NoInitT NoInit {}
 
enum class  DialogFileType { IMAGES , VIDEOS }
 
void showCandlewickAboutWindow (bool *p_open=NULL, float wrap_width=400.f)
 Show an about window providing information about Candlewick.
 
void guiAddLightControls (DirectionalLight &light)
 Adds a set of ImGui elements to control a DirectionalLight.
 
void guiAddDisableCheckbox (const char *label, entt::registry &reg, entt::entity id, bool &flag)
 Adds an ImGui::Checkbox which toggles the Disable component on the entity.
 
void guiAddFileDialog (SDL_Window *window, DialogFileType dialog_file_type, std::string &filename)
 Add a GUI button-text pair to select a file to save something to.
 

Typedef Documentation

◆ Float2

using candlewick::Float2 = Eigen::Vector2f

◆ Float3

using candlewick::Float3 = Eigen::Vector3f

◆ Float4

using candlewick::Float4 = Eigen::Vector4f

◆ FrustumCornersType

using candlewick::FrustumCornersType = std::array<Float3, 8ul>

◆ GpuMat4

using candlewick::GpuMat4 = Eigen::Matrix<float, 4, 4, Eigen::ColMajor | Eigen::DontAlign>

◆ GpuVec2

using candlewick::GpuVec2 = Eigen::Matrix<float, 2, 1, Eigen::DontAlign>

◆ GpuVec3

using candlewick::GpuVec3 = Eigen::Matrix<float, 3, 1, Eigen::DontAlign>

◆ GpuVec4

using candlewick::GpuVec4 = Eigen::Matrix<float, 4, 1, Eigen::DontAlign>

◆ Mat3f

using candlewick::Mat3f = Eigen::Matrix3f

◆ Mat4f

using candlewick::Mat4f = Eigen::Matrix4f

◆ OpaqueCastable

using candlewick::OpaqueCastable = std::tuple<const Mesh &, Mat4f>

Intermediary argument type for shadow-casting or opaque objects. For use in depth or light pre-passes.

◆ ShadowPassConfig

◆ Vec3u8

using candlewick::Vec3u8 = Eigen::Matrix<Uint8, 3, 1>

◆ Vec4u8

using candlewick::Vec4u8 = Eigen::Matrix<Uint8, 4, 1>

Enumeration Type Documentation

◆ CameraProjection

enum class candlewick::CameraProjection
strong
Enumerator
PERSPECTIVE 
ORTHOGRAPHIC 

◆ DebugPipelines

enum class candlewick::DebugPipelines
strong
Enumerator
TRIANGLE_FILL 
LINE 

◆ DialogFileType

enum class candlewick::DialogFileType
strong
Enumerator
IMAGES 
VIDEOS 

◆ mesh_load_retc

enum class candlewick::mesh_load_retc : Uint16
strong

Return codes for loadSceneMeshes().

Enumerator
FAILED_TO_LOAD 
NO_MESHES 
OK 

◆ VertexAttrib

enum class candlewick::VertexAttrib : Uint16
strong

Fixed vertex attributes.

Each value of this enum maps to a specific input location in the shaders. This defined an implicit contract between the engine and the shaders.

Enumerator
Position 
Normal 
Tangent 
Bitangent 
Color0 
Color1 
TexCoord0 
TexCoord1 

Function Documentation

◆ apply3DTransformInPlace()

void candlewick::apply3DTransformInPlace ( MeshData & meshData,
const Eigen::Affine3f & tr )

Apply an Eigen::Affine3f 3D transform to a mesh in-place, transforming its vertices.

◆ auto_detect_shader_format_subset()

SDL_GPUShaderFormat candlewick::auto_detect_shader_format_subset ( const char * name = nullptr)

Automatically detect which subset of shader formats (MSL, SPIR-V) are compatible with the device.

Parameters
nameDevice name. Pass nullptr (default) to auto-detect the best device.

◆ bgraToRgbaConvert()

void candlewick::bgraToRgbaConvert ( Uint32 * bgraPixels,
Uint32 pixelCount )

In-place conversion from 8-bit BGRA to 8-bit RGBA.

Parameters
bgraPixelsPointer to input BGRA image.
pixelCountNumber of pixels in the BGRA image.

◆ castCoalGeom()

template<typename T>
decltype(auto) candlewick::castCoalGeom ( const coal::CollisionGeometry & geometry)

◆ createMesh() [1/2]

Mesh candlewick::createMesh ( const Device & device,
const MeshData & meshData,
bool upload = false )
nodiscard

Convert MeshData to a GPU Mesh object. This creates the required vertex buffer and index buffer (if required).

Warning
This does not upload the mesh data to the vertex and index buffers.
See also
uploadMeshToDevice()

◆ createMesh() [2/2]

Mesh candlewick::createMesh ( const Device & device,
const MeshData & meshData,
SDL_GPUBuffer * vertexBuffer,
SDL_GPUBuffer * indexBuffer )
nodiscard

Create a Mesh object from given mesh data, as a view into existing vertex and index buffers.

Warning
The constructed Mesh will take ownership of the buffers.

◆ createMeshFromBatch()

Mesh candlewick::createMeshFromBatch ( const Device & device,
std::span< const MeshData > meshDatas,
bool upload )
nodiscard

Create a Mesh from a batch of MeshData.

Parameters
[in]deviceGPU device
[in]meshDatasBatch of meshes
[in]uploadWhether to upload the resulting Mesh to the device.
See also
createMesh()
uploadMeshToDevice()

◆ currentShaderDirectory()

const char * candlewick::currentShaderDirectory ( )

Get the current (global) directory where shaders are found.

◆ deg2rad() [1/2]

double candlewick::deg2rad ( double t)
inlineconstexpr

◆ deg2rad() [2/2]

float candlewick::deg2rad ( float t)
inlineconstexpr

◆ detect_shader_stage()

SDL_GPUShaderStage candlewick::detect_shader_stage ( const char * filename)

◆ extractMaterials()

std::vector< PbrMaterial > candlewick::extractMaterials ( std::span< const MeshData > meshDatas)
inlinenodiscard

◆ frustumBoundingSphereCenterRadius()

std::pair< Float3, float > candlewick::frustumBoundingSphereCenterRadius ( const FrustumCornersType & worldSpaceCorners)
inline

◆ frustumFromCamera()

FrustumCornersType candlewick::frustumFromCamera ( const Camera & camera)
inline

Get the corners of a Camera's view frustum, in world space.

◆ frustumFromCameraProjection()

FrustumCornersType candlewick::frustumFromCameraProjection ( const Mat4f & camProj)
inline

Extract the array of frustum corners, given a camera projection matrix.

◆ generateIndices()

MeshData candlewick::generateIndices ( const MeshData & meshData)

Convert MeshData object to an indexed mesh.

Parameters
meshDatathe input un-indexed MeshData object to be transformed.
Warning
For now, only supports SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP.
See also
triangleStripGenerateIndices

◆ generateMediaFilenameFromTimestamp()

std::string candlewick::generateMediaFilenameFromTimestamp ( const char * prefix = "cdw_screenshot",
const char * extension = ".png",
DialogFileType file_type = DialogFileType::IMAGES )

◆ guiAddDisableCheckbox()

void candlewick::guiAddDisableCheckbox ( const char * label,
entt::registry & reg,
entt::entity id,
bool & flag )

Adds an ImGui::Checkbox which toggles the Disable component on the entity.

◆ guiAddFileDialog()

void candlewick::guiAddFileDialog ( SDL_Window * window,
DialogFileType dialog_file_type,
std::string & filename )

Add a GUI button-text pair to select a file to save something to.

This function can only be called from the main thread.

◆ guiAddLightControls()

void candlewick::guiAddLightControls ( DirectionalLight & light)

Adds a set of ImGui elements to control a DirectionalLight.

◆ hexToRgbaf()

Float4 candlewick::hexToRgbaf ( unsigned long hex)
inline

◆ hexToRgbai()

Vec4u8 candlewick::hexToRgbai ( unsigned long hex)

◆ hexToRgbf()

Float3 candlewick::hexToRgbf ( unsigned long hex)
inline

◆ hexToRgbi()

Vec3u8 candlewick::hexToRgbi ( unsigned long hex)

◆ invalid_enum()

template<typename T>
requires std::is_enum_v<T>
void candlewick::invalid_enum ( const char * msg,
T type,
std::source_location location = std::source_location::current() )

Terminate the application after encountering an invalid enum value.

◆ loadCoalConvex()

MeshData candlewick::loadCoalConvex ( const coal::ConvexBase & geom)

◆ loadCoalHeightField() [1/2]

MeshData candlewick::loadCoalHeightField ( const coal::HeightField< coal::AABB > & collGeom)

◆ loadCoalHeightField() [2/2]

MeshData candlewick::loadCoalHeightField ( const coal::HeightField< coal::OBBRSS > & collGeom)

◆ loadCoalPrimitive()

MeshData candlewick::loadCoalPrimitive ( const coal::ShapeBase & geometry)

Load primitive given a coal::CollisionGeometry.

See the documentation on the available primitives.

See also
Primitives

◆ loadFromAssimpMaterial()

PbrMaterial candlewick::loadFromAssimpMaterial ( aiMaterial * material)

Load our PBR material data from an assimp material.

If the aiMaterial contains, in fact, a Phong material (PhongMaterial), then a PBR material will be approximated.

◆ loadSceneMeshes()

mesh_load_retc candlewick::loadSceneMeshes ( const char * path,
std::vector< MeshData > & meshData )

Load the meshes from the given path. This is implemented using the assimp library.

◆ loadShaderMetadata()

Shader::Config candlewick::loadShaderMetadata ( const char * shader_name)

Load shader config from metadata. Metadata filename (in JSON format) is inferred from the shader name.

◆ lookAt()

Mat4f candlewick::lookAt ( const Float3 & eye,
const Float3 & center,
const Float3 & up = Float3::UnitZ() )

Compute view matrix looking at center from eye, with the camera pointing up towards up.

◆ mergeMeshes() [1/2]

MeshData candlewick::mergeMeshes ( std::span< const MeshData > meshes)

Merge meshes down to a single mesh with consistent indexing.

◆ mergeMeshes() [2/2]

MeshData candlewick::mergeMeshes ( std::vector< MeshData > && meshes)

Merge meshes down to a single mesh with consistent indexing.

◆ meshLayoutFor()

template<IsVertexType V>
MeshLayout candlewick::meshLayoutFor ( )

Shortcut for extracting layout from compile-time struct.

◆ operator""_rgb()

Eigen::Vector3d candlewick::operator""_rgb ( unsigned long long hex)
inline

◆ operator""_rgba()

Eigen::Vector4d candlewick::operator""_rgba ( unsigned long long hex)
inline

◆ operator""_rgbaf()

Float4 candlewick::operator""_rgbaf ( unsigned long long hex)
inline

◆ operator""_rgbf()

Float3 candlewick::operator""_rgbf ( unsigned long long hex)
inline

◆ orthographicMatrix() [1/2]

Mat4f candlewick::orthographicMatrix ( const Float2 & sizes,
float nearZ,
float farZ )

Compute a centered orthographic projection matrix.

Parameters
sizexy-plane view sizes
nearZNear clipping plane. This is where the rendering starts on the Z-axis (the positive direction of which points up towards you).
farZFar clipping plane, where rendering ends. A value of \(0\) stops the rendered volume at the camera (only things in front of camera will be rendered).

◆ orthographicMatrix() [2/2]

Mat4f candlewick::orthographicMatrix ( float left,
float right,
float bottom,
float top,
float near,
float far )

Compute an off-center orthographic projection matrix.

◆ orthoProjFar()

float candlewick::orthoProjFar ( const Mat4f & proj)
inline

◆ orthoProjNear()

float candlewick::orthoProjNear ( const Mat4f & proj)
inline

◆ perspectiveFromFov()

Mat4f candlewick::perspectiveFromFov ( Radf fovY,
float aspectRatio,
float nearZ,
float farZ )

Get perspective projection matrix given fov, aspect ratio, and clipping planes.

Parameters
fovYVertical field of view in radians
aspectRatioWidth / Height
nearZNear clipping plane
farZFar clipping plane
Warning
This function uses the vertical field of view.

◆ perspectiveMatrix()

Mat4f candlewick::perspectiveMatrix ( float left,
float right,
float bottom,
float top,
float near,
float far )

Compute perspective projection matrix, from clipping plane parameters (left, right, bottom, top, near, far).

◆ perspectiveProjFar()

float candlewick::perspectiveProjFar ( const Mat4f & proj)
inline

◆ perspectiveProjNear()

float candlewick::perspectiveProjNear ( const Mat4f & proj)
inline

◆ rad2deg()

float candlewick::rad2deg ( float t)
inlineconstexpr

◆ renderDepthDebug()

void candlewick::renderDepthDebug ( const Renderer & renderer,
CommandBuffer & cmdBuf,
const DepthDebugPass & pass,
const DepthDebugPass::Options & opts )

◆ setShadersDirectory()

void candlewick::setShadersDirectory ( const char * path)

Set the current (global) directory where shaders are to be found.

See also
currentShaderDirectory()

◆ shader_format_name()

const char * candlewick::shader_format_name ( SDL_GPUShaderFormat shader_format)

◆ strided_view() [1/3]

template<typename T, size_t extent>
candlewick::strided_view ( std::span< T, extent > ,
size_t  ) -> strided_view< T >

◆ strided_view() [2/3]

template<typename T>
candlewick::strided_view ( T * first,
size_t ,
size_t  ) -> strided_view< T >

◆ strided_view() [3/3]

template<typename T, size_t arr_extent>
candlewick::strided_view ( T(&) [arr_extent]) -> strided_view< T >

◆ terminate_with_message() [1/2]

template<typename... Ts>
void candlewick::terminate_with_message ( std::source_location location,
std::string_view fmt,
Ts &&... args )

◆ terminate_with_message() [2/2]

template<typename... Ts>
void candlewick::terminate_with_message ( std::string_view fmt,
Ts &&... args )

◆ toTransformationMatrix() [1/2]

Mat4f candlewick::toTransformationMatrix ( const AABB & aabb)
inline

◆ toTransformationMatrix() [2/2]

Mat4f candlewick::toTransformationMatrix ( const OBB & obb)
inline

◆ triangleStripGenerateIndices()

void candlewick::triangleStripGenerateIndices ( Uint32 vertexCount,
std::vector< Uint32 > & indices )

Generate indices for a triangle strip geometry, given the vertex count.

◆ unreachable()

void candlewick::unreachable ( )
inline

◆ unreachable_with_message()

void candlewick::unreachable_with_message ( std::string_view msg,
std::source_location location = std::source_location::current() )
inline

◆ updateTransparencyClassification()

bool candlewick::updateTransparencyClassification ( entt::registry & reg,
entt::entity entity,
const MeshMaterialComponent & mmc )

Updates (adds or removes) the Opaque tag component for a given entity.

Parameters
regThe entity registry
entityThe entity
mmcThe mesh-material element to inspect for existence of any transparent subobjects.
Returns
whether the entity is transparent.

◆ uploadMeshToDevice() [1/2]

void candlewick::uploadMeshToDevice ( const Device & device,
const Mesh & mesh,
const MeshData & meshData )

Upload the contents of a single, individual mesh to the GPU device.

◆ uploadMeshToDevice() [2/2]

void candlewick::uploadMeshToDevice ( const Device & device,
const MeshView & meshView,
const MeshData & meshData )

Upload the contents of a single, individual mesh to the GPU device.

This will upload the mesh data through a MeshView.

◆ validateMesh()

bool candlewick::validateMesh ( const Mesh & mesh)
inlinenodiscard

Check that all vertex buffers were set, and consistency in the "indexed/non-indexed" status.

See also
validateMeshView()

◆ validateMeshLayout()

bool candlewick::validateMeshLayout ( const MeshLayout & layout)
inline

Validation function. Checks if a MeshLayout produces invalid data for a Mesh.

◆ validateMeshView()

bool candlewick::validateMeshView ( const MeshView & view)
inlinenodiscard

Validation for a MeshView object.

Check that all vertex buffer handles are non-null, check that vertex count is nonzero, check consistency of indexing status (that index buffer is non-null iff the index count of this view is nonzero).

Parameters
viewInput view to validate.
See also
validateMesh()

◆ vertexElementSize()

Uint64 candlewick::vertexElementSize ( SDL_GPUVertexElementFormat format)
constexpr

Variable Documentation

◆ g_default_shader_dir

const char* candlewick::g_default_shader_dir = CANDLEWICK_SHADER_BIN_DIR
constexpr

◆ NoInit

NoInitT candlewick::NoInit {}
constexpr