Scene

group Scene

Defines

GLM_ENABLE_EXPERIMENTAL

Functions

CEREAL_CLASS_VERSION (Coffee::TagComponent, 0)
CEREAL_CLASS_VERSION (Coffee::TransformComponent, 0)
CEREAL_CLASS_VERSION (Coffee::CameraComponent, 0)
CEREAL_CLASS_VERSION (Coffee::AnimatorComponent, 0)
CEREAL_CLASS_VERSION (Coffee::MeshComponent, 0)
CEREAL_CLASS_VERSION (Coffee::MaterialComponent, 1)
CEREAL_CLASS_VERSION (Coffee::LightComponent, 2)
CEREAL_CLASS_VERSION (Coffee::WorldEnvironmentComponent, 2)
CEREAL_CLASS_VERSION (Coffee::AudioSourceComponent, 0)
CEREAL_CLASS_VERSION (Coffee::AudioListenerComponent, 0)
CEREAL_CLASS_VERSION (Coffee::AudioZoneComponent, 0)
CEREAL_CLASS_VERSION (Coffee::ScriptComponent, 0)
CEREAL_CLASS_VERSION (Coffee::RigidbodyComponent, 0)
CEREAL_CLASS_VERSION (Coffee::NavMeshComponent, 0)
CEREAL_CLASS_VERSION (Coffee::NavigationAgentComponent, 0)
CEREAL_CLASS_VERSION (Coffee::ParticlesSystemComponent, 0)
CEREAL_CLASS_VERSION (Coffee::UIComponent, 0)
CEREAL_CLASS_VERSION (Coffee::UIImageComponent, 1)
CEREAL_CLASS_VERSION (Coffee::UITextComponent, 0)
CEREAL_CLASS_VERSION (Coffee::UIToggleComponent, 0)
CEREAL_CLASS_VERSION (Coffee::UIButtonComponent, 0)
CEREAL_CLASS_VERSION (Coffee::UISliderComponent, 1)
void AddModelToTheSceneTree(Scene *scene, Ref<Model> model, AnimatorComponent *animatorComponent = nullptr)

Add a model to the scene tree.

Parameters:
  • scene – The scene.

  • model – The model to add.

struct TagComponent
#include <Components.h>

Component representing a tag.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the TagComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string Tag

The tag string.

struct TransformComponent
#include <Components.h>

Component representing a transform.

Public Functions

inline glm::vec3 &GetLocalPosition()

Gets the local position vector.

Returns:

The local position vector.

inline glm::mat4 GetLocalTransform() const

Gets the local transformation matrix.

Returns:

The local transformation matrix.

inline void SetLocalTransform(const glm::mat4 &transform)

Sets the local transformation matrix.

Parameters:

transform – The transformation matrix to set.

inline const glm::mat4 &GetWorldTransform() const

Gets the world transformation matrix.

Returns:

The world transformation matrix.

inline void SetWorldTransform(const glm::mat4 &transform)

Sets the world transformation matrix.

Parameters:

transform – The transformation matrix to set.

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the TransformComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

struct CameraComponent
#include <Components.h>

Component representing a camera.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the CameraComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

SceneCamera Camera

The scene camera.

struct AnimatorComponent
#include <Components.h>

Component representing an animator.

Public Functions

inline AnimatorComponent(const AnimatorComponent &other)

Copy constructor for AnimatorComponent.

Parameters:

other – The other AnimatorComponent to copy from.

inline AnimatorComponent(Ref<Skeleton> skeleton, Ref<AnimationController> animationController)

Constructs an AnimatorComponent with the given skeleton, animation controller, and animation system.

Parameters:
  • skeleton – The skeleton reference.

  • animationController – The animation controller reference.

inline Ref<Skeleton> GetSkeleton() const

Gets the skeleton reference.

Returns:

The skeleton reference.

inline void SetSkeleton(Ref<Skeleton> skeleton)

Sets the skeleton reference.

Parameters:

skeleton – The skeleton reference to set.

inline Ref<AnimationController> GetAnimationController() const

Gets the animation controller reference.

Returns:

The animation controller reference.

inline void SetAnimationController(Ref<AnimationController> animationController)

Sets the animation controller reference.

Parameters:

animationController – The animation controller reference to set.

inline ozz::animation::SamplingJob::Context &GetContext()

Gets the sampling job context.

Returns:

The sampling job context.

inline ozz::animation::BlendingJob::Layer *GetBlendLayers()

Gets the blend layers.

Returns:

The blend layers.

inline ozz::animation::BlendingJob &GetBlendJob()

Gets the blending job.

Returns:

The blending job.

inline void SetCurrentAnimation(unsigned int index)

Sets the current animation for both upper and lower body layers.

Parameters:

index – The index of the animation to set.

inline void SetUpperAnimation(unsigned int index)

Sets the current animation for the upper body layer.

Parameters:

index – The index of the animation to set.

inline void SetLowerAnimation(unsigned int index)

Sets the current animation for the lower body layer.

Parameters:

index – The index of the animation to set.

template<class Archive>
inline void save(Archive &archive, const std::uint32_t &version) const

Serializes the AnimatorComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive, const std::uint32_t &version)

Deserializes the AnimatorComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

Public Members

bool Loop = true

Indicates if the animation should loop.

float BlendDuration = 0.25f

The duration of the blend.

float AnimationSpeed = 1.0f

The speed of the animation.

std::vector<glm::mat4> JointMatrices

The joint matrices.

UUID modelUUID

The UUID of the model.

UUID animatorUUID

The UUID of the animator.

int UpperBodyRootJoint = 0

Index of the root joint for upper body animations.

std::vector<ozz::math::SoaTransform> PartialBlendOutput

Output transforms for partial blending.

float UpperBodyWeight = 1.0f

Weight for blending upper body animations.

float LowerBodyWeight = 1.0f

Weight for blending lower body animations.

float PartialBlendThreshold = 0.01f

Threshold for partial blending.

Ref<AnimationLayer> UpperAnimation

Animation layer for upper body animations.

Ref<AnimationLayer> LowerAnimation

Animation layer for lower body animations.

bool NeedsUpdate = true

Flag to indicate if the animator needs an update.

struct MeshComponent
#include <Components.h>

Component representing a mesh.

Public Functions

inline const Ref<Mesh> &GetMesh() const

Gets the mesh reference.

Returns:

The mesh reference.

Public Members

Ref<Mesh> mesh

The mesh reference.

bool drawAABB = false

Flag to draw the axis-aligned bounding box (AABB).

AnimatorComponent *animator = nullptr

The animator component.

UUID animatorUUID = 0

The UUID of the animator.

struct MaterialComponent
#include <Components.h>

Component representing a material.

Public Members

Ref<Material> material

The material reference.

struct LightComponent
#include <Components.h>

Component representing a light.

Public Types

enum Type

Enum representing the type of light.

Values:

enumerator DirectionalLight

Directional light.

enumerator PointLight

Point light.

enumerator SpotLight

Spot light.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the LightComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Color = {1.0f, 1.0f, 1.0f}

The color of the light.

glm::vec3 Direction = {0.0f, -1.0f, 0.0f}

The direction of the light.

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position of the light.

float Range = 5.0f

The range of the light.

float Attenuation = 1.0f

The attenuation of the light.

float Intensity = 1.0f

The intensity of the light.

float Angle = 45.0f

The angle of the light.

float ConeAttenuation = 48.0f

The cone attenuation of the light.

int type = static_cast<int>(Type::DirectionalLight)

The type of the light.

class Entity
#include <Entity.h>

Class representing an entity in the scene.

Public Functions

Entity() = default

Default constructor for Entity.

Entity(entt::entity handle, Scene *scene)

Constructor for Entity with handle and scene.

Parameters:
  • handle – The entity handle.

  • scene – The scene the entity belongs to.

Entity(const Entity &other) = default

Copy constructor for Entity.

Parameters:

other – The other entity to copy from.

template<typename T, typename ...Args>
inline T &AddComponent(Args&&... args)

Add a component to the entity.

Template Parameters:
  • T – The component type.

  • Args – The component constructor arguments.

Parameters:

args – The component constructor arguments.

Returns:

Reference to the added component.

template<typename T>
inline T &GetComponent()

Get a component from the entity.

Template Parameters:

T – The component type.

Returns:

Reference to the component.

template<typename T>
inline bool HasComponent()

Check if the entity has a component.

Template Parameters:

T – The component type.

Returns:

True if the entity has the component, false otherwise.

template<typename T>
inline void RemoveComponent()

Remove a component from the entity.

Template Parameters:

T – The component type.

inline operator bool() const

Check if the entity is valid.

Returns:

True if the entity is valid, false otherwise.

inline operator entt::entity() const

Convert the entity to its handle.

Returns:

The entity handle.

inline operator uint32_t() const

Convert the entity to its handle as a uint32_t.

Returns:

The entity handle as a uint32_t.

inline bool operator==(const Entity &other) const

Equality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are equal, false otherwise.

inline bool operator!=(const Entity &other) const

Inequality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are not equal, false otherwise.

inline void SetParent(Entity entity)

Set the parent of the entity.

Parameters:

entity – The parent entity.

class PrimitiveMesh
#include <PrimitiveMesh.h>

Class representing different types of primitive meshes.

Public Static Functions

static Ref<Mesh> CreateQuad()

Creates a quad mesh.

Returns:

A reference to the created quad mesh.

static Ref<Mesh> CreateCube(const glm::vec3 &size = {1.0f, 1.0f, 1.0f}, int subdivideW = 0, int subdidiveH = 0, int subdivideD = 0)

Creates a cube mesh.

Creates a cube mesh.

Parameters:
  • size – The size of the cube.

  • subdivideW – Number of subdivisions along the width.

  • subdivideH – Number of subdivisions along the height.

  • subdivideD – Number of subdivisions along the depth.

  • size – The size of the cube.

  • subdivideW – Subdivision parameter for width (currently not functional).

  • subdivideH – Subdivision parameter for height (currently not functional).

  • subdivideD – Subdivision parameter for depth (currently not functional).

Returns:

A reference to the created cube mesh.

Returns:

Ref<Mesh> A reference to the created cube mesh.

static Ref<Mesh> CreateSphere(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 32, bool isHemiSphere = false)

Creates a sphere mesh.

Parameters:
  • radius – The radius of the sphere.

  • height – The height of the sphere.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • isHemiSphere – Whether the sphere is a hemisphere.

Returns:

A reference to the created sphere mesh.

static Ref<Mesh> CreatePlane(const glm::vec2 &size = {1.0f, 1.0f}, const glm::vec3 &normal = {0.0f, 1.0f, 0.0f})

Creates a plane mesh.

Parameters:
  • size – The size of the plane.

  • normal – The normal vector of the plane.

Returns:

A reference to the created plane mesh.

static Ref<Mesh> CreateCylinder(float topRadius = 0.5f, float bottomRadius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool capTop = true, bool capBottom = true)

Creates a cylinder mesh.

Parameters:
  • topRadius – The radius of the top of the cylinder.

  • bottomRadius – The radius of the bottom of the cylinder.

  • height – The height of the cylinder.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • capTop – Whether to cap the top of the cylinder.

  • capBottom – Whether to cap the bottom of the cylinder.

Returns:

A reference to the created cylinder mesh.

static Ref<Mesh> CreateCone(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool cap = true)

Creates a cone mesh.

Parameters:
  • radius – The radius of the base of the cone.

  • height – The height of the cone.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • cap – Whether to cap the base of the cone.

Returns:

A reference to the created cone mesh.

static Ref<Mesh> CreateTorus(float innerRadius = 0.5f, float outerRadius = 1.0f, int rings = 64, int ringSegments = 32)

Creates a torus mesh.

Parameters:
  • innerRadius – The inner radius of the torus.

  • outerRadius – The outer radius of the torus.

  • rings – Number of rings.

  • ringSegments – Number of ring segments.

Returns:

A reference to the created torus mesh.

static Ref<Mesh> CreateCapsule(float radius = 0.5f, float height = 2.0f, int radialSegments = 64, int rings = 8)

Creates a capsule mesh.

Parameters:
  • radius – The radius of the capsule.

  • height – The height of the capsule.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

Returns:

A reference to the created capsule mesh.

struct SceneDebugFlags
class Scene
#include <Scene.h>

Class representing a scene.

Public Functions

Scene()

Constructor for Scene.

~Scene() = default

Default destructor.

Entity CreateEntity(const std::string &name = std::string())

Create an entity in the scene.

Parameters:

name – The name of the entity.

Returns:

The created entity.

void DestroyEntity(Entity entity)

Destroy an entity in the scene.

Parameters:

entity – The entity to destroy.

void OnInitEditor()

Initialize the scene.

void OnUpdateEditor(EditorCamera &camera, float dt)

Update the scene in editor mode.

Parameters:
  • camera – The editor camera.

  • dt – The delta time.

void OnUpdateRuntime(float dt)

Update the scene in runtime mode.

Parameters:

dt – The delta time.

void OnEvent(Event &e)

Handle an event in the scene.

Parameters:

e – The event.

void OnExitEditor()

Exit the scene.

void UpdateAudioComponentsPositions()

Update the positions of the audio components.

void AssignAnimatorsToMeshes(const std::vector<AnimatorComponent*> animators)

Assigns animators to meshes.

Parameters:

animators – The vector of animator components.

Public Static Functions

static Ref<Scene> Load(const std::filesystem::path &path)

Load a scene from a file.

Parameters:

path – The path to the file.

Returns:

The loaded scene.

static void Save(const std::filesystem::path &path, Ref<Scene> scene)

Save a scene to a file.

Parameters:
  • path – The path to the file.

  • scene – The scene to save.

class SceneCamera : public Coffee::Camera
#include <SceneCamera.h>

Camera class for the scene.

Public Functions

SceneCamera()

Constructor for SceneCamera.

~SceneCamera() = default

Default destructor.

struct HierarchyComponent
#include <SceneTree.h>

Component for managing entity hierarchy.

Public Functions

HierarchyComponent(entt::entity parent)

Constructor with parent entity.

Parameters:

parent – The parent entity.

HierarchyComponent()

Default constructor.

template<class Archive>
inline void save(Archive &archive, std::uint32_t const version) const

Serialize the component.

Template Parameters:

Archive – The archive type.

Parameters:

archive – The archive.

Public Static Functions

static void OnConstruct(Scene *scene, entt::registry &registry, entt::entity entity)

Called when the component is constructed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnDestroy(entt::registry &registry, entt::entity entity)

Called when the component is destroyed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnUpdate(entt::registry &registry, entt::entity entity)

Called when the component is updated.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void Reparent(entt::registry &registry, entt::entity entity, entt::entity parent)

Reparent the entity to a new parent.

Parameters:
  • registry – The entity registry.

  • entity – The entity to reparent.

  • parent – The new parent entity.

static void Reorder(entt::registry &registry, entt::entity entity, entt::entity after, entt::entity before)

Move an entity within the hierarchy. Will reparent if needed.

Parameters:
  • registry – The entity registry

  • entity – The entity to be moved

  • after – The entity after which the entity will be moved to

  • before – The entity before which the entity will be moved to

class SceneTree
#include <SceneTree.h>

Class for managing the scene tree.

Public Functions

SceneTree(Scene *scene)

Constructor for SceneTree.

Parameters:

scene – The scene context.

~SceneTree() = default

Default destructor.

void Update()

Update the scene tree.

void UpdateTransform(entt::entity entity)

Update the transform of an entity.

Parameters:

entity – The entity to update.

namespace Coffee

Typedefs

template<typename T>
using Scope = std::unique_ptr<T>
template<typename T>
using Ref = std::shared_ptr<T>
using ControllerCode = uint32_t
using ButtonCode = int8_t
using AxisCode = int8_t
using InputAction = uint16_t
using MouseCode = uint16_t
using ButtonState = uint8_t

Enums

enum class RebindState

Possible states for rebinding inputs.

Values:

enumerator None
enumerator PosButton
enumerator NegButton
enumerator PosKey
enumerator NegKey
enumerator Axis
enum class ResourceType

Enumeration of different types of resources.

Values:

enumerator Unknown

Unknown resource type.

enumerator Texture

Texture resource type.

enumerator Texture2D

Texture2D resource type.

enumerator Cubemap

Cubemap resource type.

enumerator Model

Model resource type.

enumerator Mesh

Mesh resource type.

enumerator Shader

Shader resource type.

enumerator Material

Material resource type.

enumerator PBRMaterial

PBRMaterial resource type.

enumerator ShaderMaterial

ShaderMaterial resource type.

enumerator AnimationSystem

AnimationSystem resource type.

enumerator Skeleton

Skeleton resource type.

enumerator Animation

Animation resource type.

enumerator AnimationController

AnimationController resource type.

enumerator Prefab

Prefab resource type.

enum class ResourceFormat

Enumeration of resource formats.

Values:

enumerator Binary

Binary format.

enumerator JSON

JSON format.

enum class IntersectionType

Values:

enumerator Outside
enumerator Inside
enumerator Intersect
enum class ImageFormat

Values:

enumerator R8
enumerator RG8
enumerator RGB8
enumerator SRGB8
enumerator RGBA8
enumerator SRGBA8
enumerator R16F
enumerator RG16F
enumerator RGB16F
enumerator RGBA16F
enumerator R32F
enumerator RGB32F
enumerator RGBA32F
enumerator DEPTH24STENCIL8
enum class TextureWrap

Values:

enumerator Repeat
enumerator MirroredRepeat
enumerator ClampToEdge
enumerator ClampToBorder
enum class TextureFilter

Values:

enumerator Nearest
enumerator Linear
enumerator NearestMipmapNearest
enumerator LinearMipmapNearest
enumerator NearestMipmapLinear
enumerator LinearMipmapLinear
enum class PrimitiveType

Enum class representing different types of primitive meshes.

Values:

enumerator Quad

A quad mesh.

enumerator Cube

A cube mesh.

enumerator Sphere

A sphere mesh.

enumerator Plane

A plane mesh.

enumerator Cylinder

A cylinder mesh.

enumerator Cone

A cone mesh.

enumerator Torus

A torus mesh.

enumerator Capsule

A capsule mesh.

enumerator None

No mesh.

enum class ExportedVariableType

Values:

enumerator None
enumerator Int
enumerator Float
enumerator String
enumerator Bool
enumerator Vector2
enumerator Vector3
enumerator Vector4
enumerator Matrix3
enumerator Matrix4
enumerator Entity
enumerator Scene
enumerator Material
enumerator Light
enum class ScriptingLanguage

Values:

enumerator Lua
enumerator cSharp
enum class AnchorPresetX

Represents a preset for anchoring UI elements along the X-axis.

Values:

enumerator Left

Anchor to the left side.

enumerator Center

Anchor to the center.

enumerator Right

Anchor to the right side.

enumerator Stretch

Stretch across the X-axis.

enum class AnchorPresetY

Represents a preset for anchoring UI elements along the Y-axis.

Values:

enumerator Top

Anchor to the top side.

enumerator Middle

Anchor to the middle.

enumerator Bottom

Anchor to the bottom side.

enumerator Stretch

Stretch across the Y-axis.

Functions

template<typename T, typename ...Args>
Scope<T> CreateScope(Args&&... args)
template<typename T, typename ...Args>
Ref<T> CreateRef(Args&&... args)
static std::mt19937_64 s_Engine(s_RandomDevice())
inline ResourceType GetResourceTypeFromExtension(const std::filesystem::path &path)
inline std::string ResourceTypeToString(ResourceType type)
inline std::string GetResourceExtension(ResourceType type)
inline ResourceFormat GetResourceSaveFormatFromType(ResourceType type)
template<typename T>
inline ResourceType GetResourceType()
template<typename T, typename S, int N, msdf_atlas::GeneratorFunction<S, N> GenFunc>
static Ref<Texture2D> CreateAndCacheAtlas(const std::string &fontName, float fontSize, const std::vector<msdf_atlas::GlyphGeometry> &glyphs, const msdf_atlas::FontGeometry &fontGeometry, uint32_t width, uint32_t height)
glm::mat4 aiMatrix4x4ToGLMMat4(const aiMatrix4x4 &aiMat)
void OpenGLMessageCallback(unsigned source, unsigned type, unsigned id, unsigned severity, int length, const char *message, const void *userParam)
GLenum ImageFormatToOpenGLInternalFormat(ImageFormat format)
GLenum ImageFormatToOpenGLFormat(ImageFormat format)
int ImageFormatToChannelCount(ImageFormat format)
int TextureWrapToOpenGL(TextureWrap wrap)
int TextureFilterToOpenGL(TextureFilter filter)
static GLenum ShaderDataTypeToOpenGLBaseType(ShaderDataType type)
template<typename T>
static void CopyComponentIfExists(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<ActiveComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<StaticComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<HierarchyComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<AnimatorComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<MeshComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<AudioSourceComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<AudioListenerComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<RigidbodyComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<>
void CopyComponentIfExists<ParticlesSystemComponent>(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
template<typename ...Components>
static void CopyEntity(entt::entity destinyEntity, entt::entity sourceEntity, entt::registry &registry)
void RegisterApplicationBindings(sol::state &luaState)
void RegisterAudioBindings(sol::state &luaState)
void RegisterComponentsBindings(sol::state &luaState)
void RegisterEntityBindings(sol::state &luaState)
void BindKeyCodesToLua(sol::state &lua, sol::table &inputTable)
void BindMouseCodesToLua(sol::state &lua, sol::table &inputTable)
void BindControllerCodesToLua(sol::state &lua, sol::table &inputTable)
void BindAxisCodesToLua(sol::state &lua, sol::table &inputTable)
void BindInputActionsToLua(sol::state &lua, sol::table &inputTable)
void RegisterInputBindings(sol::state &luaState)
void RegisterLogBindings(sol::state &luaState)
void RegisterMathBindings(sol::state &luaState)
void RegisterPhysicsBindings(sol::state &luaState)
void RegisterPrefabBindings(sol::state &luaState)
void RegisterResourcesBindings(sol::state &luaState)
void RegisterResourceLoadingBindings(sol::state &luaState)
void RegisterSceneBindings(sol::state &luaState)
void RegisterTimerBindings(sol::state &luaState)
template<typename T, UIManager::UIComponentType Type>
void AddUIItems(entt::registry &registry, std::vector<UIManager::UIRenderItem> &items)

Variables

CAkFilePackageLowLevelIODeferred *g_lowLevelIO = nullptr
glm::vec3 m_ListenerPosition
AkGameObjectID m_ListenerID = 150
const char *m_CurrentSurface
bool m_IsPlaying
uint64_t m_nextZoneID = 1000
std::unordered_map<uint64_t, AudioZoneComponent*> m_zones
std::unordered_map<uint64_t, glm::vec3> m_registeredObjects
const char *MAPPING_FILE_PATH = "InputMapping.json"
SDL_TimerCallback timerCallback = [](void* param, uint32_t interval, uint32_t elapsed) -> uint32_t{Timer* timer = static_cast<Timer*>(param);if(timer->GetCallback()){timer->GetCallback()();}if(timer->isOneShot()){timer->Stop();return 0;}if(timer->isAutoStart()){timer->Start(timer->getWaitTime());}return 0;}
static std::random_device s_RandomDevice
static std::uniform_int_distribution<uint64_t> s_UniformDistribution
static uint8_t s_SDLWindowCount = 0
float GRAVITY = -9.81f
static Ref<Project> s_ActiveProject
static const uint32_t s_MaxFramebufferSize = 8192
static std::unordered_map<std::string, UUID> s_ModelMeshesUUIDs
static std::unordered_map<std::string, UUID> s_ModelMaterialsUUIDs
static Renderer2DData s_Renderer2DData
static glm::mat4 captureProjection = glm::perspective(glm::radians(90.0f), 1.0f, 0.1f, 10.0f)
static glm::mat4 captureViews[] = {glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)), glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)), glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)), glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)), glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)), glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f))}
struct AABB
#include <BoundingBox.h>

Structure representing an axis-aligned bounding box (AABB).

Public Functions

inline AABB(const glm::vec3 &min, const glm::vec3 &max)

Constructs an AABB with specified minimum and maximum points.

Parameters:
  • min – The minimum point of the AABB.

  • max – The maximum point of the AABB.

Public Members

glm::vec3 min = glm::vec3(0.0f)

The minimum point of the AABB.

glm::vec3 max = glm::vec3(0.0f)

The maximum point of the AABB.

struct ActiveComponent
struct AnchorPreset
#include <UIAnchor.h>

Represents a combination of X and Y anchor presets.

Public Members

AnchorPresetX X

The X-axis anchor preset.

AnchorPresetY Y

The Y-axis anchor preset.

class Animation
#include <Animation.h>

Class representing an animation.

Public Functions

inline const std::string &GetAnimationName() const

Gets the name of the animation.

Returns:

The name of the animation.

inline float GetDuration() const

Gets the duration of the animation.

Returns:

The duration of the animation.

void SetAnimation(ozz::unique_ptr<ozz::animation::Animation> animation)

Sets the animation.

Parameters:

animation – The animation to set.

inline const ozz::animation::Animation *GetAnimation() const

Gets the animation.

Returns:

The animation.

void Save(ozz::io::OArchive &archive) const

Saves the animation to an archive.

Parameters:

archive – The archive to save to.

void Load(ozz::io::IArchive &archive)

Loads the animation from an archive.

Parameters:

archive – The archive to load from.

class AnimationController
#include <Animation.h>

Class representing an animation controller.

Public Functions

void AddAnimation(const std::string &name, ozz::unique_ptr<ozz::animation::Animation> animation)

Adds an animation to the controller.

Parameters:
  • name – The name of the animation.

  • animation – The animation to add.

Animation *GetAnimation(const std::string &name)

Gets an animation by name.

Parameters:

name – The name of the animation.

Returns:

A pointer to the animation.

Animation *GetAnimation(unsigned int index)

Gets an animation by index.

Parameters:

index – The index of the animation.

Returns:

A pointer to the animation.

inline unsigned int GetAnimationCount() const

Gets the number of animations.

Returns:

The number of animations.

inline const std::map<std::string, unsigned int> &GetAnimationMap() const

Gets the animation map.

Returns:

The animation map.

inline const std::vector<Animation> &GetAnimations() const

Gets the animations.

Returns:

The animations.

struct AnimationLayer
#include <Animation.h>

Struct representing a layer of animation blending.

Public Members

bool IsBlending = false

Indicates if blending is currently active.

unsigned int CurrentAnimation = 0

Index of the current animation.

unsigned int NextAnimation = 0

Index of the next animation to blend to.

float BlendTime = 0.0f

Time duration for blending between animations.

float AnimationTime = 0.0f

Current time position in the current animation.

float NextAnimationTime = 0.0f

Current time position in the next animation.

std::vector<ozz::math::SoaTransform> LocalTransforms

Local transforms for the animation joints.

std::vector<ozz::math::SimdFloat4> JointWeights

Weights for blending animation joints.

class AnimationSystem
#include <AnimationSystem.h>

System responsible for handling animations.

Public Static Functions

static void Update(float deltaTime, AnimatorComponent *animator)

Updates the animation system.

Parameters:
  • deltaTime – The time elapsed since the last update.

  • animator – The animator component to update.

static void SetBoneTransformations(const Ref<Shader> &shader, const AnimatorComponent *animator)

Sets the bone transformations for the shader.

Parameters:
  • shader – The shader to set the bone transformations for.

  • animator – The animator component.

static void SetCurrentAnimation(unsigned int index, AnimatorComponent *animator, AnimationLayer *layer)

Sets the current animation for a specific layer.

Parameters:
  • index – The index of the animation to set.

  • animator – The animator component.

  • layer – The animation layer to update.

static void AddAnimator(AnimatorComponent *animatorComponent)

Adds an animator component to the system.

Parameters:

animatorComponent – The animator component to add.

static inline std::vector<AnimatorComponent*> GetAnimators()

Gets the list of animators.

Returns:

A vector of animator components.

static inline void ResetAnimators()

Resets the animators vector.

static void LoadAnimator(AnimatorComponent *animator)

Loads the animator.

Parameters:

animator – The animator component.

static void SetupPartialBlending(unsigned int upperBodyAnimIndex, unsigned int lowerBodyAnimIndex, const std::string &upperBodyJointName, AnimatorComponent *animator)

Sets up partial blending for upper and lower body animations.

Parameters:
  • upperBodyAnimIndex – The index of the upper body animation.

  • lowerBodyAnimIndex – The index of the lower body animation.

  • upperBodyJointName – The name of the upper body root joint.

  • animator – The animator component.

struct AnimatorComponent
#include <Components.h>

Component representing an animator.

Public Functions

inline AnimatorComponent(const AnimatorComponent &other)

Copy constructor for AnimatorComponent.

Parameters:

other – The other AnimatorComponent to copy from.

inline AnimatorComponent(Ref<Skeleton> skeleton, Ref<AnimationController> animationController)

Constructs an AnimatorComponent with the given skeleton, animation controller, and animation system.

Parameters:
  • skeleton – The skeleton reference.

  • animationController – The animation controller reference.

inline Ref<Skeleton> GetSkeleton() const

Gets the skeleton reference.

Returns:

The skeleton reference.

inline void SetSkeleton(Ref<Skeleton> skeleton)

Sets the skeleton reference.

Parameters:

skeleton – The skeleton reference to set.

inline Ref<AnimationController> GetAnimationController() const

Gets the animation controller reference.

Returns:

The animation controller reference.

inline void SetAnimationController(Ref<AnimationController> animationController)

Sets the animation controller reference.

Parameters:

animationController – The animation controller reference to set.

inline ozz::animation::SamplingJob::Context &GetContext()

Gets the sampling job context.

Returns:

The sampling job context.

inline ozz::animation::BlendingJob::Layer *GetBlendLayers()

Gets the blend layers.

Returns:

The blend layers.

inline ozz::animation::BlendingJob &GetBlendJob()

Gets the blending job.

Returns:

The blending job.

inline void SetCurrentAnimation(unsigned int index)

Sets the current animation for both upper and lower body layers.

Parameters:

index – The index of the animation to set.

inline void SetUpperAnimation(unsigned int index)

Sets the current animation for the upper body layer.

Parameters:

index – The index of the animation to set.

inline void SetLowerAnimation(unsigned int index)

Sets the current animation for the lower body layer.

Parameters:

index – The index of the animation to set.

template<class Archive>
inline void save(Archive &archive, const std::uint32_t &version) const

Serializes the AnimatorComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

template<class Archive>
inline void load(Archive &archive, const std::uint32_t &version)

Deserializes the AnimatorComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to deserialize from.

Public Members

bool Loop = true

Indicates if the animation should loop.

float BlendDuration = 0.25f

The duration of the blend.

float AnimationSpeed = 1.0f

The speed of the animation.

std::vector<glm::mat4> JointMatrices

The joint matrices.

UUID modelUUID

The UUID of the model.

UUID animatorUUID

The UUID of the animator.

int UpperBodyRootJoint = 0

Index of the root joint for upper body animations.

std::vector<ozz::math::SoaTransform> PartialBlendOutput

Output transforms for partial blending.

float UpperBodyWeight = 1.0f

Weight for blending upper body animations.

float LowerBodyWeight = 1.0f

Weight for blending lower body animations.

float PartialBlendThreshold = 0.01f

Threshold for partial blending.

Ref<AnimationLayer> UpperAnimation

Animation layer for upper body animations.

Ref<AnimationLayer> LowerAnimation

Animation layer for lower body animations.

bool NeedsUpdate = true

Flag to indicate if the animator needs an update.

class Application
#include <Application.h>

The Application class is responsible for managing the main application loop, handling events, and managing layers and overlays.

Public Types

using EventCallbackFn = std::function<void(Event&)>

Type definition for event callback function.

Public Functions

Application()

Constructs the Application object.

virtual ~Application()

Destroys the Application object.

void Run()

Starts the main application loop.

void OnEvent(Event &e)

Handles incoming events.

Parameters:

e – The event to handle.

void PushLayer(Layer *layer)

Pushes a layer onto the layer stack.

Parameters:

layer – The layer to push.

void PushOverlay(Layer *layer)

Pushes an overlay onto the layer stack.

Parameters:

layer – The overlay to push.

inline Window &GetWindow()

Gets the main application window.

Returns:

A reference to the main application window.

inline void SetEventCallback(const EventCallbackFn &callback)

Sets the event callback function.

Parameters:

callback – The event callback function.

void Close()

Closes the application.

inline ImGuiLayer *GetImGuiLayer()

Gets the ImGui layer.

Returns:

A pointer to the ImGui layer.

Public Static Functions

static inline Application &Get()

Gets the singleton instance of the Application.

Returns:

A reference to the singleton instance.

class AppRenderEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application render.

class AppTickEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application tick.

class AppUpdateEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for application update.

class Audio
#include <Audio.h>

Manages audio systems including memory, sound, music, and spatial audio.

Public Static Functions

static void Init()

Initializes the audio system.

static void Shutdown()

Shuts down the audio system.

static void ProcessAudio()

Processes audio.

static void PlayEvent(AudioSourceComponent &audioSourceComponent)

Plays an event.

Parameters:

audioSourceComponent – The audio source component.

static void StopEvent(AudioSourceComponent &audioSourceComponent)

Stops an event.

Parameters:

audioSourceComponent – The audio source component.

static void PauseEvent(AudioSourceComponent &audioSourceComponent)

Pauses an event.

Parameters:

audioSourceComponent – The audio source component.

static void ResumeEvent(AudioSourceComponent &audioSourceComponent)

Resumes an event.

Parameters:

audioSourceComponent – The audio source component.

static void SetSwitch(const char *switchGroup, const char *switchState, uint64_t gameObjectID)

Sets a switch.

Parameters:
  • switchGroup – The name of the switch group.

  • switchState – The name of the switch state.

  • gameObjectID – The game object ID.

static void Set3DPosition(uint64_t gameObjectID, glm::vec3 pos, glm::vec3 forward, glm::vec3 up)

Sets the position of a game object.

Parameters:
  • gameObjectID – The game object ID.

  • pos – Position.

  • forward – Forward.

  • up – Up.

static void RegisterGameObject(uint64_t gameObjectID)

Register a game object.

Parameters:

gameObjectID – The game object ID.

static void UnregisterGameObject(uint64_t gameObjectID)

Unregister a game object.

Parameters:

gameObjectID – The game object ID.

static void UnregisterAllGameObjects()

Unregister all game objects.

static void SetVolume(uint64_t gameObjectID, float newVolume)

Set the volume of a game object.

Parameters:
  • gameObjectID – The game object ID.

  • newVolume – The new volume.

static void RegisterAudioSourceComponent(AudioSourceComponent &audioSourceComponent)

Register an audio source component.

Parameters:

audioSourceComponent – The audio source component.

static void UnregisterAudioSourceComponent(AudioSourceComponent &audioSourceComponent)

Unregister an audio source component.

Parameters:

audioSourceComponent – The audio source component.

static void RegisterAudioListenerComponent(AudioListenerComponent &audioListenerComponent)

Register an audio listener component.

Parameters:

audioListenerComponent – The audio listener component.

static void UnregisterAudioListenerComponent(AudioListenerComponent &audioListenerComponent)

Unregister an audio listener component.

Parameters:

audioListenerComponent – The audio listener component.

static void PlayInitialAudios()

Play the audio sources chosen to play on awake.

static void StopAllEvents()

Stop all audio events.

static void SetBusVolume(const char *busName, float volume)

Sets the volume of an audio bus.

Parameters:
  • busName – The name of the bus.

  • volume – The volume value (0.0 to 1.0).

Public Static Attributes

static std::vector<Ref<AudioBank>> audioBanks

Audio banks.

static std::vector<AudioSourceComponent*> audioSources

Audio source components.

static std::vector<AudioListenerComponent*> audioListeners

Audio listener components.

struct AudioBank
#include <Audio.h>

Audio bank.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the AudioBank.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string name

The name of the bank.

std::vector<std::string> events

The events of the bank.

class AudioFootsteps

Public Static Functions

static bool IsKeyPressed(int key)

Constructor for AudioFootsteps.

Parameters:

listenerID – The Wwise Game Object ID to represent the audio listener.

static void Initialize()

Initializes and registers the audio listener.

static void Update()

Updates the listener’s position and plays the corresponding sound.

static void StartLoopingSound()

Starts looping sound based on the current surface.

static void StopLoopingSound()

Stops the currently playing sound.

struct AudioListenerComponent

Public Members

uint64_t gameObjectID = 0

The object ID.

glm::mat4 transform

The transform of the audio listener.

struct AudioSourceComponent

Public Members

uint64_t gameObjectID = 0

The object ID.

Ref<Audio::AudioBank> audioBank

The audio bank.

std::string audioBankName

The name of the audio bank.

std::string eventName

The name of the event.

float volume = 1.f

The volume of the audio source.

bool mute = false

True if the audio source is muted.

bool playOnAwake = false

True if the audio source should play automatically.

glm::mat4 transform

The transform of the audio source.

bool isPlaying = false

True if the audio source is playing.

bool isPaused = false

True if the audio source is paused.

class AudioZone

Public Static Functions

static void Shutdown()

Shuts down the audio zone.

static void CreateZone(AudioZoneComponent &audioZone)

Creates a zone.

Parameters:

audioZone – The audio zone component.

static void UpdateReverbZone(const AudioZoneComponent &audioZoneComponent)

Updates a reverb zone.

Parameters:

audioZoneComponent – The audio zone component.

static void RemoveReverbZone(const AudioZoneComponent &audioZoneComponent)

Removes a reverb zone.

Parameters:

audioZoneComponent – The audio zone component.

static void RemoveAllReverbZones()

Removes all reverb zones.

static void RegisterObject(const uint64_t objectID, const glm::vec3 &position)

Registers an object.

Parameters:
  • objectID – The object ID.

  • position – The position.

static void UnregisterObject(const uint64_t objectID)

Unregisters an object.

Parameters:

objectID – The object ID.

static void UpdateObjectPosition(const uint64_t objectID, const glm::vec3 &position)

Updates an object’s position.

Parameters:
  • objectID – The object ID.

  • position – The position.

static void Update()

Updates the audio zone.

static bool SearchAvailableBusChannels()

Searches for available bus channels.

Returns:

True if successful, false otherwise.

Public Static Attributes

static std::vector<std::string> busNames

Available bus channels.

struct AudioZoneComponent

Public Members

uint64_t zoneID = -1

The zone ID.

std::string audioBusName

The name of the audio bus.

glm::vec3 position = {0.f, 0.f, 0.f}

The position of the audio zone.

float radius = 1.f

The radius of the audio zone.

class AxisMoveEvent : public Coffee::Event
#include <ControllerEvent.h>

Axis event Ignore the controller code to accept axis input from all controllers

struct Batch
class BoxCollider : public Coffee::Collider
struct BufferAttribute
#include <Buffer.h>

Structure representing a buffer attribute.

Public Functions

BufferAttribute() = default

Default constructor for BufferAttribute.

inline BufferAttribute(ShaderDataType type, const std::string &name, bool normalized = false)

Constructs a BufferAttribute with the specified parameters.

Parameters:
  • type – The type of the attribute.

  • name – The name of the attribute.

  • normalized – Whether the attribute is normalized.

inline uint32_t GetComponentCount() const

Returns the number of components in the attribute.

Returns:

The number of components.

Public Members

std::string Name

The name of the attribute.

ShaderDataType Type

The type of the attribute.

uint32_t Size

The size of the attribute.

size_t Offset

The offset of the attribute.

bool Normalized

Whether the attribute is normalized.

class BufferLayout
#include <Buffer.h>

Class representing a buffer layout.

Public Functions

inline BufferLayout()

Default constructor for BufferLayout.

inline BufferLayout(std::initializer_list<BufferAttribute> elements)

Constructs a BufferLayout with the specified attributes.

Parameters:

elements – The list of buffer attributes.

inline uint32_t GetStride() const

Returns the stride of the buffer layout.

Returns:

The stride in bytes.

inline const std::vector<BufferAttribute> &GetElements() const

Returns the list of buffer attributes.

Returns:

The list of buffer attributes.

inline std::vector<BufferAttribute>::iterator begin()

Returns an iterator to the beginning of the buffer attributes.

Returns:

An iterator to the beginning.

inline std::vector<BufferAttribute>::iterator end()

Returns an iterator to the end of the buffer attributes.

Returns:

An iterator to the end.

inline std::vector<BufferAttribute>::const_iterator begin() const

Returns a constant iterator to the beginning of the buffer attributes.

Returns:

A constant iterator to the beginning.

inline std::vector<BufferAttribute>::const_iterator end() const

Returns a constant iterator to the end of the buffer attributes.

Returns:

A constant iterator to the end.

struct BurstParticleEmitter
class ButtonPressEvent : public Coffee::Event
#include <ControllerEvent.h>

Button press event Ignore the controller code to accept axis input from all controllers

class ButtonReleaseEvent : public Coffee::Event
#include <ControllerEvent.h>

Button release event Ignore the controller code to accept axis input from all controllers

class CacheManager
#include <CacheManager.h>

Manages cache-related operations for the CoffeeEngine.

Public Static Functions

static inline void SetCachePath(const std::filesystem::path &path)

Sets the cache path.

Parameters:

path – The path to set as the cache directory.

static inline const std::filesystem::path &GetCachePath()

Gets the current cache path.

Returns:

The current cache path.

static inline void CreateCacheDirectory()

Creates the cache directory.

static inline void ClearCache()

Clears the cache by removing all files in the cache directory.

static inline std::filesystem::path GetCachedFilePath(const std::string &filename)

Gets the file path for a cached file.

Parameters:

filename – The name of the file to be cached.

Returns:

The full path to the cached file.

class Camera
#include <Camera.h>

The Camera class is responsible for managing the camera’s projection matrix.

Subclassed by Coffee::EditorCamera, Coffee::SceneCamera

Public Types

enum class ProjectionType

Enum class representing the type of projection.

Values:

enumerator PERSPECTIVE

Perspective projection.

enumerator ORTHOGRAPHIC

Orthographic projection.

Public Functions

Camera() = default

Default constructor for the Camera class.

inline Camera(const glm::mat4 &projection)

Constructs a Camera object with the specified projection matrix.

Parameters:

projection – The projection matrix.

virtual ~Camera() = default

Virtual destructor for the Camera class.

inline float GetFOV() const

Gets the field of view of the camera.

Returns:

The field of view.

inline void SetFOV(float fov)

Sets the field of view of the camera.

Parameters:

fov – The field of view.

inline float GetAspectRatio() const

Gets the aspect ratio of the camera.

Returns:

The aspect ratio.

inline void SetAspectRatio(float aspectRatio)

Sets the aspect ratio of the camera.

Parameters:

aspectRatio – The aspect ratio.

inline float GetNearClip() const

Gets the near clipping plane distance of the camera.

Returns:

The near clipping plane distance.

inline void SetNearClip(float nearClip)

Sets the near clipping plane distance of the camera.

Parameters:

nearClip – The near clipping plane distance.

inline float GetFarClip() const

Gets the far clipping plane distance of the camera.

Returns:

The far clipping plane distance.

inline void SetFarClip(float farClip)

Sets the far clipping plane distance of the camera.

Parameters:

farClip – The far clipping plane distance.

inline const glm::mat4 &GetProjection() const

Gets the projection matrix of the camera.

Returns:

The projection matrix.

inline ProjectionType GetProjectionType() const

Gets the projection type of the camera.

Returns:

The projection type.

inline void SetProjectionType(ProjectionType projectionType)

Sets the projection type of the camera.

Parameters:

projectionType – The projection type.

inline void SetViewportSize(float width, float height)

Sets the size of the viewport and updates the projection matrix.

Parameters:
  • width – The width of the viewport.

  • height – The height of the viewport.

inline glm::mat4 ProjectionTypeToMat4(ProjectionType projection)

Converts the projection type to a projection matrix.

Parameters:

projection – The type of projection.

Returns:

The projection matrix.

inline void UpdateProjection()

Updates the projection matrix based on the current viewport dimensions and projection type.

struct CameraComponent
#include <Components.h>

Component representing a camera.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the CameraComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

SceneCamera Camera

The scene camera.

struct CameraData

Public Members

glm::mat4 projection = glm::mat4(1.0f)

The projection matrix.

glm::mat4 view = glm::mat4(1.0f)

The view matrix.

glm::vec3 position = {0.0, 0.0, 0.0}

The position of the camera.

class CapsuleCollider : public Coffee::Collider
class Collider

Subclassed by Coffee::BoxCollider, Coffee::CapsuleCollider, Coffee::ConeCollider, Coffee::CylinderCollider, Coffee::SphereCollider

class CollisionCallback
struct CollisionInfo
class CollisionSystem
class ConeCollider : public Coffee::Collider
class ControllerAddEvent : public Coffee::Event
#include <ControllerEvent.h>

Controller detected event Dispatched when a new controller is detected or the mapping for an existing controller is changed

class ControllerRemoveEvent : public Coffee::Event
#include <ControllerEvent.h>

Controller disconnection event Dispatched when a controller is disconnected

class CSharpBackend
class Cubemap : public Coffee::Texture
struct CubemapImportData : public Coffee::ImportData
class CylinderCollider : public Coffee::Collider
class EditorCamera : public Coffee::Camera
#include <EditorCamera.h>

The EditorCamera class is responsible for managing the editor camera’s view and projection matrices.

Public Types

enum class CameraState

Enum class representing the state of the camera.

Values:

enumerator NONE

No camera state.

enumerator ORBIT

Camera is in orbit mode.

enumerator FLY

Camera is in fly mode.

Public Functions

EditorCamera() = default

Default constructor for the EditorCamera class.

EditorCamera(float fov, ProjectionType projection = ProjectionType::PERSPECTIVE, float aspectRatio = 1.778, float nearClip = 0.1f, float farClip = 1000.0f)

Constructs an EditorCamera object with the specified parameters.

Parameters:
  • fov – The field of view for the perspective projection.

  • projection – The type of projection (perspective or orthographic).

  • aspectRatio – The aspect ratio of the viewport.

  • nearClip – The near clipping plane distance.

  • farClip – The far clipping plane distance.

void OnUpdate(float dt)

Updates the camera’s view matrix.

void OnEvent(Event &event)

Handles events for the camera.

Parameters:

event – The event to handle.

inline void SetFocusPoint(glm::vec3 focusPoint)

Sets the focal point of the camera.

Parameters:

focusPoint – The focal point.

inline const glm::mat4 GetViewMatrix() const

Gets the view matrix of the camera.

Returns:

The view matrix.

glm::vec3 GetUpDirection() const

Gets the up direction of the camera.

Returns:

The up direction.

glm::vec3 GetRightDirection() const

Gets the right direction of the camera.

Returns:

The right direction.

glm::vec3 GetForwardDirection() const

Gets the forward direction of the camera.

Returns:

The forward direction.

inline const glm::vec3 &GetPosition() const

Gets the position of the camera.

Returns:

The position.

glm::quat GetOrientation() const

Gets the orientation of the camera.

Returns:

The orientation.

inline const CameraState &GetState() const

Gets the current state of the camera.

Returns:

The current state of the camera.

class Entity
#include <Entity.h>

Class representing an entity in the scene.

Public Functions

Entity() = default

Default constructor for Entity.

Entity(entt::entity handle, Scene *scene)

Constructor for Entity with handle and scene.

Parameters:
  • handle – The entity handle.

  • scene – The scene the entity belongs to.

Entity(const Entity &other) = default

Copy constructor for Entity.

Parameters:

other – The other entity to copy from.

template<typename T, typename ...Args>
inline T &AddComponent(Args&&... args)

Add a component to the entity.

Template Parameters:
  • T – The component type.

  • Args – The component constructor arguments.

Parameters:

args – The component constructor arguments.

Returns:

Reference to the added component.

template<typename T>
inline T &GetComponent()

Get a component from the entity.

Template Parameters:

T – The component type.

Returns:

Reference to the component.

template<typename T>
inline bool HasComponent()

Check if the entity has a component.

Template Parameters:

T – The component type.

Returns:

True if the entity has the component, false otherwise.

template<typename T>
inline void RemoveComponent()

Remove a component from the entity.

Template Parameters:

T – The component type.

inline operator bool() const

Check if the entity is valid.

Returns:

True if the entity is valid, false otherwise.

inline operator entt::entity() const

Convert the entity to its handle.

Returns:

The entity handle.

inline operator uint32_t() const

Convert the entity to its handle as a uint32_t.

Returns:

The entity handle as a uint32_t.

inline bool operator==(const Entity &other) const

Equality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are equal, false otherwise.

inline bool operator!=(const Entity &other) const

Inequality operator.

Parameters:

other – The other entity to compare with.

Returns:

True if the entities are not equal, false otherwise.

inline void SetParent(Entity entity)

Set the parent of the entity.

Parameters:

entity – The parent entity.

class Event
#include <Event.h>

Base class for all events.

Subclassed by Coffee::AppRenderEvent, Coffee::AppTickEvent, Coffee::AppUpdateEvent, Coffee::AxisMoveEvent, Coffee::ButtonPressEvent, Coffee::ButtonReleaseEvent, Coffee::ControllerAddEvent, Coffee::ControllerRemoveEvent, Coffee::FileDropEvent, Coffee::KeyEvent, Coffee::MouseButtonEvent, Coffee::MouseMovedEvent, Coffee::MouseScrolledEvent, Coffee::WindowCloseEvent, Coffee::WindowResizeEvent

Public Functions

virtual EventType GetEventType() const = 0

Get the type of the event.

Returns:

The event type.

virtual const char *GetName() const = 0

Get the name of the event.

Returns:

The event name.

virtual int GetCategoryFlags() const = 0

Get the category flags of the event.

Returns:

The category flags.

inline virtual std::string ToString() const

Convert the event to a string representation.

Returns:

A string representation of the event.

inline bool IsInCategory(EventCategory category)

Check if the event is in a specific category.

Parameters:

category – The category to check.

Returns:

True if the event is in the category, false otherwise.

class EventDispatcher
#include <Event.h>

Event dispatcher to handle events.

Public Functions

template<typename T, typename F>
inline bool Dispatch(const F &func)

Dispatches the event if it matches the type.

Template Parameters:
  • T – The event type.

  • F – The function type.

Parameters:

func – The function to call if the event matches the type.

Returns:

True if the event was dispatched, false otherwise.

struct ExportedVariable
class FileDialog
#include <FileDialog.h>

Class for handling file dialogs.

Public Static Functions

static const std::filesystem::path OpenFile(const FileDialogArgs &args = {})

Opens a file dialog to select a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

static const std::filesystem::path SaveFile(const FileDialogArgs &args = {})

Opens a file dialog to save a file.

Parameters:

args – Arguments for the file dialog.

Returns:

The selected file path.

static const std::filesystem::path PickFolder(const FileDialogArgs &args = {})

Opens a file dialog to select a directory.

Note that the only arguments used is DefaultPath

Returns:

The selected directory path

struct FileDialogArgs
#include <FileDialog.h>

Arguments for the file dialog.

Public Members

std::vector<Filter> Filters = {}

List of filters.

std::string DefaultPath = ""

Default path for the file dialog.

std::string DefaultName = ""

Default name for the file dialog.

struct Filter
#include <FileDialog.h>

Filter for file types.

Public Members

const char *Name

Name of the filter.

const char *Extension

Extension of the filter.

class FileDropEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for Dropping a file.

Public Functions

inline uint64_t GetTimestamp() const

Get the timestamp of the event.

Returns:

The timestamp of the event.

inline uint32_t GetWindowID() const

Get the window ID of the event.

Returns:

The window ID of the event.

inline float GetX() const

Get the x position of the event.

Returns:

The x position of the event.

inline float GetY() const

Get the y position of the event.

Returns:

The y position of the event.

inline const std::string &GetSource() const

Get the source of the event.

Returns:

The source of the event.

inline const std::string &GetFile() const

Get the file of the event.

Returns:

The file of the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Font
class Framebuffer
#include <Framebuffer.h>

Class representing a framebuffer.

Public Functions

Framebuffer(uint32_t width, uint32_t height)

Constructs a Framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

~Framebuffer()

Destroys the Framebuffer.

void Invalidate()

Invalidates the framebuffer, forcing it to be recreated.

void Bind()

Binds the framebuffer.

void UnBind()

Unbinds the framebuffer.

void SetDrawBuffers(std::initializer_list<uint32_t> indices)

Sets the draw buffers for the framebuffer.

Parameters:

colorAttachments – The list of color attachment indices.

void Resize(uint32_t width, uint32_t height)

Resizes the framebuffer.

Parameters:
  • width – The new width of the framebuffer.

  • height – The new height of the framebuffer.

inline const uint32_t GetWidth() const

Gets the width of the framebuffer.

Returns:

The width of the framebuffer.

inline const uint32_t GetHeight() const

Gets the height of the framebuffer.

Returns:

The height of the framebuffer.

inline const Ref<Texture2D> &GetDepthTexture() const

Gets the depth texture.

Returns:

A reference to the depth texture.

Public Static Functions

static Ref<Framebuffer> Create(uint32_t width, uint32_t height)

Creates a framebuffer with the specified width, height, and attachments.

Parameters:
  • width – The width of the framebuffer.

  • height – The height of the framebuffer.

  • attachments – The list of image formats for the attachments.

Returns:

A reference to the created framebuffer.

class Frustum
class Gamepad
#include <Gamepad.h>

Wrapper for SDL controllers

class GameSaver
#include <GameSaver.h>

Class responsible for saving and loading game variables.

Public Types

using SaveValue = std::variant<int, float, bool>

Alias for the type of values that can be saved.

Public Functions

void SaveVariable(const std::string &key, const SaveValue &value)

Saves a variable with a given key and value.

Parameters:
  • key – The key associated with the variable.

  • value – The value to save.

SaveValue LoadVariable(const std::string &key, const SaveValue &defaultValue = 0)

Loads a variable by its key.

Parameters:
  • key – The key associated with the variable.

  • defaultValue – The default value to return if the key is not found.

Returns:

The loaded value or the default value if the key is not found.

void SaveToFile()

Saves all variables to a file.

void LoadFromFile()

Loads all variables from a file.

Public Static Functions

static GameSaver &GetInstance()

Gets the singleton instance of the GameSaver.

Returns:

Reference to the GameSaver instance.

class GraphicsContext
#include <GraphicsContext.h>

Class representing the graphics context.

Public Functions

GraphicsContext(SDL_Window *windowHandle)

Constructs a GraphicsContext with the specified window handle.

Parameters:

windowHandle – The handle to the SDL window.

virtual ~GraphicsContext()

Virtual destructor for the GraphicsContext class.

void Init()

Initializes the graphics context.

void SwapBuffers()

Swaps the front and back buffers.

Public Static Functions

static Scope<GraphicsContext> Create(SDL_Window *window)

Creates a graphics context for the specified window.

Parameters:

window – The handle to the SDL window.

Returns:

A scope pointer to the created graphics context.

struct HierarchyComponent
#include <SceneTree.h>

Component for managing entity hierarchy.

Public Functions

HierarchyComponent(entt::entity parent)

Constructor with parent entity.

Parameters:

parent – The parent entity.

HierarchyComponent()

Default constructor.

template<class Archive>
inline void save(Archive &archive, std::uint32_t const version) const

Serialize the component.

Template Parameters:

Archive – The archive type.

Parameters:

archive – The archive.

Public Static Functions

static void OnConstruct(Scene *scene, entt::registry &registry, entt::entity entity)

Called when the component is constructed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnDestroy(entt::registry &registry, entt::entity entity)

Called when the component is destroyed.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void OnUpdate(entt::registry &registry, entt::entity entity)

Called when the component is updated.

Parameters:
  • registry – The entity registry.

  • entity – The entity.

static void Reparent(entt::registry &registry, entt::entity entity, entt::entity parent)

Reparent the entity to a new parent.

Parameters:
  • registry – The entity registry.

  • entity – The entity to reparent.

  • parent – The new parent entity.

static void Reorder(entt::registry &registry, entt::entity entity, entt::entity after, entt::entity before)

Move an entity within the hierarchy. Will reparent if needed.

Parameters:
  • registry – The entity registry

  • entity – The entity to be moved

  • after – The entity after which the entity will be moved to

  • before – The entity before which the entity will be moved to

class ImGuiLayer : public Coffee::Layer
#include <ImGuiLayer.h>

The ImGuiLayer class is responsible for managing the ImGui layer in the application.

Public Functions

ImGuiLayer()

Constructs the ImGuiLayer object.

~ImGuiLayer()

Destroys the ImGuiLayer object.

virtual void OnAttach() override

Attaches the ImGui layer to the application.

virtual void OnDetach() override

Detaches the ImGui layer from the application.

virtual void OnEvent(Event &e) override

Handles events for the ImGui layer.

Parameters:

e – The event to handle.

void Begin()

Begins a new ImGui frame.

void End()

Ends the current ImGui frame.

virtual void OnImGuiRender() override

Renders ImGui elements.

inline void BlockEvents(bool block)

Blocks or unblocks events from being handled by the ImGui layer.

Parameters:

block – True to block events, false to unblock.

void SetTeaColorStyle()

Sets the Coffee color style for ImGui.

void SetGodotColorStyle()

Sets the Godot color style for ImGui.

void SetCoffeeColorStyle()

Sets the Coffee color style for ImGui.

struct ImportData

Subclassed by Coffee::CubemapImportData, Coffee::MeshImportData, Coffee::ModelImportData, Coffee::PBRMaterialImportData, Coffee::ShaderImportData, Coffee::Texture2DImportData

class IndexBuffer
#include <Buffer.h>

Class representing an index buffer.

Public Functions

IndexBuffer(uint32_t *indices, uint32_t count)

Constructs an IndexBuffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

virtual ~IndexBuffer()

Destroys the IndexBuffer.

void Bind()

Binds the index buffer.

void Unbind()

Unbinds the index buffer.

inline uint32_t GetCount() const

Returns the number of indices in the buffer.

Returns:

The number of indices.

Public Static Functions

static Ref<IndexBuffer> Create(uint32_t *indices, uint32_t count)

Creates an index buffer with the specified indices and count.

Parameters:
  • indices – The index data.

  • count – The number of indices.

Returns:

A reference to the created index buffer.

class Input

Public Static Functions

static void Init()

Initializes the module

static bool IsKeyPressed(const KeyCode key)

Checks if a specific key is currently being pressed.

Parameters:

key – The key code of the key to check.

Returns:

True if the key is currently being pressed, false otherwise.

static bool IsMouseButtonPressed(const MouseCode button)

Checks if a mouse button is currently pressed.

Parameters:

button – The mouse button to check.

Returns:

True if the mouse button is pressed, false otherwise.

static void SetMouseGrabbed(bool grabbed)

Sets the mouse cursor to be grabbed or ungrabbed. When grabbed, the mouse cursor is confined to the window and hidden. When ungrabbed, the mouse cursor is free to move outside the window.

Parameters:

grabbed – True to grab the mouse cursor, false to ungrab it.

static const glm::vec2 &GetMousePosition()

Retrieves the current position of the mouse.

Returns:

The current position of the mouse as a 2D vector.

static const float GetMouseX()

Retrieves the current x-coordinate of the mouse cursor.

Returns:

The x-coordinate of the mouse cursor.

static const float GetMouseY()

Retrieves the current y-coordinate of the mouse cursor.

Returns:

The y-coordinate of the mouse cursor.

static bool GetButtonRaw(ButtonCode button)

Checks if a specific button is currently pressed on a given controller.

Parameters:

button – The button code to check.

Returns:

True if the button is pressed, false otherwise.

static float GetAxisRaw(AxisCode axis)

Retrieves the current value of an axis on a given controller.

Parameters:

axis – The axis code to check.

Returns:

The axis value, usually between -1 and 1. Returns 0 if the controller is invalid.

static InputBinding &GetBinding(const std::string &actionName)

Gets the InputBinding object for the given action

Parameters:

actionName – The action to retrieve an InputBinding for

Returns:

The InputBinding containing the bounds keys, buttons and axis for the provided action

static void SendRumble(uint16_t lowFreqPower, uint16_t highFreqPower, uint32_t duration)
Parameters:
  • lowFreqPower – Strength of the left (low frequency) motor

  • highFreqPower – Strength of the right (high frequency) motor

  • duration – Vibration duration

class InputBinding

Public Functions

float AsAxis(bool digital) const

Retrieves an input value from the action as a controller axis. It doesn’t need to be an actual axis to retrieve a value.

Parameters:

digital – whether the output should be rounded to an integer or not. Useful to use like directional buttons

Returns:

A value between -1 and 1

bool AsBool()

Returns the value of the action as a boolean. For axes it returns true if axisVal != 0.

Returns:

True if any of the bound keys or buttons are pressed, or if the axis is not at 0

ButtonState AsButton()

Retrieves an input value from the action as a controller button. Can be used on axis and will return DOWN or REPEAT if its value surpasses the defined deadzone.

Returns:

The current state of the action as a button

class IScriptingBackend

Subclassed by Coffee::LuaBackend

Public Functions

virtual ~IScriptingBackend() = default

Virtual destructor for the IScriptingBackend interface.

virtual void Initialize() = 0

Initializes the scripting backend.

struct Joint
#include <Skeleton.h>

Struct representing a joint.

Public Members

std::string name

The name of the joint.

int parentIndex

The index of the parent joint.

ozz::math::Transform localTransform

The local transform of the joint.

glm::mat4 invBindPose

The inverse bind pose matrix of the joint.

class KeyEvent : public Coffee::Event
#include <KeyEvent.h>

Base class for key events.

Subclassed by Coffee::KeyPressedEvent, Coffee::KeyReleasedEvent, Coffee::KeyTypedEvent

Public Functions

inline KeyCode GetKeyCode() const

Get the key code associated with the event.

Returns:

The key code.

class KeyPressedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key press.

Public Functions

inline KeyPressedEvent(const KeyCode keycode, bool isRepeat = false)

Constructor for KeyPressedEvent.

Parameters:
  • keycode – The key code associated with the event.

  • isRepeat – Whether the key press is a repeat.

inline bool IsRepeat() const

Check if the key press is a repeat.

Returns:

True if the key press is a repeat, false otherwise.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyReleasedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key release.

Public Functions

inline KeyReleasedEvent(const KeyCode keycode)

Constructor for KeyReleasedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class KeyTypedEvent : public Coffee::KeyEvent
#include <KeyEvent.h>

Event for key typing.

Public Functions

inline KeyTypedEvent(const KeyCode keycode)

Constructor for KeyTypedEvent.

Parameters:

keycode – The key code associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class Layer

Subclassed by Coffee::ImGuiLayer

Public Functions

inline Layer(const std::string &name = "Layer")

Constructor for the Layer class.

Parameters:

name – The name of the layer, default is “Layer”.

virtual ~Layer() = default

Virtual destructor for the Layer class.

inline virtual void OnAttach()

Called when the layer is attached.

inline virtual void OnDetach()

Called when the layer is detached.

inline virtual void OnUpdate(float dt)

Called every frame to update the layer.

Parameters:

dt – Delta time since the last frame.

inline virtual void OnImGuiRender()

Called to render ImGui elements.

inline virtual void OnEvent(Event &event)

Called when an event occurs.

Parameters:

event – The event that occurred.

inline const std::string &GetName() const

Gets the name of the layer.

Returns:

The name of the layer.

class LayerStack
#include <LayerStack.h>

Manages a stack of layers and overlays.

Public Functions

LayerStack() = default

Default constructor.

~LayerStack()

Destructor.

void PushLayer(Layer *layer)

Adds a layer to the stack.

Parameters:

layer – Pointer to the layer to be added.

void PushOverlay(Layer *overlay)

Adds an overlay to the stack.

Parameters:

overlay – Pointer to the overlay to be added.

void PopLayer(Layer *layer)

Removes a layer from the stack.

Parameters:

layer – Pointer to the layer to be removed.

void PopOverlay(Layer *overlay)

Removes an overlay from the stack.

Parameters:

overlay – Pointer to the overlay to be removed.

inline std::vector<Layer*>::iterator begin()

Returns an iterator to the beginning of the layer stack.

Returns:

Iterator to the beginning of the layer stack.

inline std::vector<Layer*>::iterator end()

Returns an iterator to the end of the layer stack.

Returns:

Iterator to the end of the layer stack.

inline std::vector<Layer*>::reverse_iterator rbegin()

Returns a reverse iterator to the beginning of the layer stack.

Returns:

Reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::reverse_iterator rend()

Returns a reverse iterator to the end of the layer stack.

Returns:

Reverse iterator to the end of the layer stack.

inline std::vector<Layer*>::const_iterator begin() const

Returns a constant iterator to the beginning of the layer stack.

Returns:

Constant iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_iterator end() const

Returns a constant iterator to the end of the layer stack.

Returns:

Constant iterator to the end of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rbegin() const

Returns a constant reverse iterator to the beginning of the layer stack.

Returns:

Constant reverse iterator to the beginning of the layer stack.

inline std::vector<Layer*>::const_reverse_iterator rend() const

Returns a constant reverse iterator to the end of the layer stack.

Returns:

Constant reverse iterator to the end of the layer stack.

struct LightComponent
#include <Components.h>

Component representing a light.

Public Types

enum Type

Enum representing the type of light.

Values:

enumerator DirectionalLight

Directional light.

enumerator PointLight

Point light.

enumerator SpotLight

Spot light.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the LightComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

glm::vec3 Color = {1.0f, 1.0f, 1.0f}

The color of the light.

glm::vec3 Direction = {0.0f, -1.0f, 0.0f}

The direction of the light.

glm::vec3 Position = {0.0f, 0.0f, 0.0f}

The position of the light.

float Range = 5.0f

The range of the light.

float Attenuation = 1.0f

The attenuation of the light.

float Intensity = 1.0f

The intensity of the light.

float Angle = 45.0f

The angle of the light.

float ConeAttenuation = 48.0f

The cone attenuation of the light.

int type = static_cast<int>(Type::DirectionalLight)

The type of the light.

struct LineVertex
class LinuxSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

class Log
#include <Log.h>

The Log class is responsible for initializing and providing access to the core and client loggers.

Public Static Functions

static void Init()

Initializes the logging system.

static inline std::shared_ptr<spdlog::logger> &GetCoreLogger()

Gets the core logger.

Returns:

A shared pointer to the core logger.

static inline std::shared_ptr<spdlog::logger> &GetClientLogger()

Gets the client logger.

Returns:

A shared pointer to the client logger.

class LuaBackend : public Coffee::IScriptingBackend

Public Functions

virtual void Initialize() override

Initializes the scripting backend.

class LuaScript : public Coffee::Script
class Material : public Coffee::Resource

Subclassed by Coffee::PBRMaterial, Coffee::ShaderMaterial

struct MaterialComponent
#include <Components.h>

Component representing a material.

Public Members

Ref<Material> material

The material reference.

struct MaterialRenderSettings

Public Members

enum Coffee::MaterialRenderSettings::TransparencyMode transparencyMode = TransparencyMode::Disabled

The transparency mode.

float alphaCutoff = 0.5f

The alpha cutoff value for the transparency mode.

enum Coffee::MaterialRenderSettings::BlendMode blendMode = BlendMode::Mix

The blend mode for the transparency.

enum Coffee::MaterialRenderSettings::CullMode cullMode = CullMode::Back

The culling mode for the PBRMaterial.

bool depthTest = true

Whether to enable depth testing.

bool wireframe = false

Whether to render the PBRMaterial in wireframe mode.

class Mesh : public Coffee::Resource
#include <Mesh.h>

Class representing a mesh.

Public Functions

Mesh(const std::vector<Vertex> &vertices, const std::vector<uint32_t> &indices)

Constructs a Mesh with the specified indices and vertices.

Parameters:
  • indices – The indices of the mesh.

  • vertices – The vertices of the mesh.

inline const Ref<VertexArray> &GetVertexArray() const

Gets the vertex array of the mesh.

Returns:

A reference to the vertex array.

inline const Ref<VertexBuffer> &GetVertexBuffer() const

Gets the vertex buffer of the mesh.

Returns:

A reference to the vertex buffer.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the mesh.

Returns:

A reference to the index buffer.

inline void SetMaterial(Ref<Material> &material)

Sets the material of the mesh.

Parameters:

material – A reference to the material.

inline void SetAABB(const AABB aabb)

Sets the axis-aligned bounding box (AABB) of the mesh.

Parameters:

aabb – The axis-aligned bounding box to set.

inline const AABB &GetAABB()

Gets the axis-aligned bounding box (AABB) of the mesh.

Returns:

A reference to the AABB.

inline OBB GetOBB(const glm::mat4 &transform)

Gets the oriented bounding box (OBB) of the mesh.

Parameters:

transform – The transformation matrix.

Returns:

The OBB.

inline const Ref<Material> &GetMaterial() const

Gets the material of the mesh.

Returns:

A reference to the material.

inline const std::vector<Vertex> &GetVertices() const

Gets the vertices of the mesh.

Returns:

A reference to the vector of vertices.

inline const std::vector<uint32_t> &GetIndices() const

Gets the indices of the mesh.

Returns:

A reference to the vector of indices.

struct MeshComponent
#include <Components.h>

Component representing a mesh.

Public Functions

inline const Ref<Mesh> &GetMesh() const

Gets the mesh reference.

Returns:

The mesh reference.

Public Members

Ref<Mesh> mesh

The mesh reference.

bool drawAABB = false

Flag to draw the axis-aligned bounding box (AABB).

AnimatorComponent *animator = nullptr

The animator component.

UUID animatorUUID = 0

The UUID of the animator.

struct MeshImportData : public Coffee::ImportData
class Model : public Coffee::Resource, public std::enable_shared_from_this<Model>
#include <Model.h>

Class representing a 3D model.

Public Functions

inline Model()

Default constructor for the Model class.

Model(const std::filesystem::path &path)

Constructs a Model from a file path.

Parameters:

filePath – The file path to the model.

inline const std::vector<Ref<Mesh>> &GetMeshes() const

Gets the meshes of the model.

Returns:

A reference to the vector of meshes.

inline void AddMesh(const Ref<Mesh> mesh)

Adds a mesh to the model.

Parameters:

mesh – A reference to the mesh to add.

inline const std::string &GetNodeName()

Gets the name of the node.

Returns:

The name of the node.

inline const std::weak_ptr<Model> GetParent() const

Gets the parent model.

Returns:

A pointer to the parent model.

inline const std::vector<Ref<Model>> GetChildren() const

Gets the children models.

Returns:

A reference to the vector of children models.

inline const glm::mat4 GetTransform() const

Gets the transformation matrix of the model.

Returns:

The transformation matrix.

inline bool HasAnimations() const

Checks if the model has animations.

Returns:

True if the model has animations, false otherwise.

inline const Ref<Skeleton> &GetSkeleton() const

Gets the skeleton of the model.

Returns:

A reference to the skeleton.

inline const Ref<AnimationController> &GetAnimationController() const

Gets the animation controller of the model.

Returns:

A reference to the animation controller.

void SaveAnimations(const UUID uuid) const

Saves the animations of the model.

Parameters:

uuid – The UUID of the model.

void ImportAnimations(const UUID uuid)

Imports animations for the model.

Parameters:

uuid – The UUID of the model.

Public Static Functions

static Ref<Model> Load(const std::filesystem::path &path)

Loads a model from the specified file path.

Parameters:

path – The path to the model file.

Returns:

A reference to the loaded model.

struct ModelImportData : public Coffee::ImportData
class MouseButtonEvent : public Coffee::Event
#include <MouseEvent.h>

Base class for mouse button events.

Subclassed by Coffee::MouseButtonPressedEvent, Coffee::MouseButtonReleasedEvent

Public Functions

inline MouseCode GetMouseButton() const

Get the mouse button associated with the event.

Returns:

The mouse button.

class MouseButtonPressedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button press.

Public Functions

inline MouseButtonPressedEvent(const MouseCode button)

Constructor for MouseButtonPressedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseButtonReleasedEvent : public Coffee::MouseButtonEvent
#include <MouseEvent.h>

Event for mouse button release.

Public Functions

inline MouseButtonReleasedEvent(const MouseCode button)

Constructor for MouseButtonReleasedEvent.

Parameters:

button – The mouse button associated with the event.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseMovedEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse movement.

Public Functions

inline MouseMovedEvent(const float x, const float y)

Constructor for MouseMovedEvent.

Parameters:
  • x – The x-coordinate of the mouse.

  • y – The y-coordinate of the mouse.

inline float GetX() const

Get the x-coordinate of the mouse.

Returns:

The x-coordinate.

inline float GetY() const

Get the y-coordinate of the mouse.

Returns:

The y-coordinate.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class MouseScrolledEvent : public Coffee::Event
#include <MouseEvent.h>

Event for mouse scrolling.

Public Functions

inline MouseScrolledEvent(const float xOffset, const float yOffset)

Constructor for MouseScrolledEvent.

Parameters:
  • xOffset – The scroll offset along the x-axis.

  • yOffset – The scroll offset along the y-axis.

inline float GetXOffset() const

Get the scroll offset along the x-axis.

Returns:

The x-axis scroll offset.

inline float GetYOffset() const

Get the scroll offset along the y-axis.

Returns:

The y-axis scroll offset.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

struct MSDFData
struct NavigationAgentComponent

Public Functions

inline std::vector<glm::vec3> FindPath(const glm::vec3 start, const glm::vec3 end) const

Finds a path from the start to the end.

Parameters:
  • start – The start position.

  • end – The end position.

Returns:

The path.

inline Ref<NavMeshPathfinding> GetPathFinder() const

Gets the pathfinder.

Returns:

The pathfinder.

inline void SetPathFinder(const Ref<NavMeshPathfinding> &pathFinder)

Sets the pathfinder.

Parameters:

pathFinder – The pathfinder to set.

inline Ref<NavMeshComponent> GetNavMeshComponent() const

Gets the navigation mesh component.

Returns:

The navigation mesh component.

inline void SetNavMeshComponent(const Ref<NavMeshComponent> &navMeshComponent)

Sets the navigation mesh component.

Parameters:

navMeshComponent – The navigation mesh component to set.

Public Members

std::vector<glm::vec3> Path

The path to follow.

bool ShowDebug = false

Flag to show the navigation agent debug.

class NavMesh
#include <NavMesh.h>

Class representing a navigation mesh.

Public Functions

inline NavMesh()

Constructor.

inline ~NavMesh()

Destructor.

bool CalculateWalkableAreas(const std::shared_ptr<Mesh> &mesh, const glm::mat4 &worldTransform)

Calculates walkable areas from the given mesh and world transform.

Parameters:
  • mesh – The mesh to process.

  • worldTransform – The world transform of the mesh.

Returns:

True if the walkable areas were successfully calculated, false otherwise.

void RenderWalkableAreas() const

Renders the walkable areas for debugging purposes.

void Clear()

Clears the navigation mesh data.

inline const std::vector<NavMeshTriangle> &GetTriangles() const

Returns the triangles in the navigation mesh.

Returns:

A reference to the vector of triangles.

inline bool IsCalculated() const

Checks if the navigation mesh has been calculated.

Returns:

True if the navigation mesh has been calculated, false otherwise.

Public Members

float WalkableSlopeAngle

Maximum walkable slope angle.

struct NavMeshComponent

Public Functions

inline Ref<NavMesh> GetNavMesh() const

Gets the navigation mesh.

Returns:

The navigation mesh.

inline void SetNavMesh(const Ref<NavMesh> &navMesh)

Sets the navigation mesh.

Parameters:

navMesh – The navigation mesh to set.

inline UUID GetNavMeshUUID() const

Gets the UUID of the navigation mesh.

Returns:

The UUID of the navigation mesh.

inline void SetNavMeshUUID(const UUID &navMeshUUID)

Sets the UUID of the navigation mesh.

Parameters:

navMeshUUID – The UUID of the navigation mesh to set.

Public Members

bool ShowDebug = false

Flag to show the navigation mesh debug.

class NavMeshPathfinding
#include <NavMeshPathfinding.h>

Class for pathfinding on a navigation mesh.

Public Functions

inline NavMeshPathfinding(const Ref<NavMesh> &navMesh)

Constructor.

Parameters:

navMesh – The navigation mesh to use for pathfinding.

std::vector<glm::vec3> FindPath(const glm::vec3 &start, const glm::vec3 &end) const

Finds a path from the start point to the end point.

Parameters:
  • start – The starting point of the path.

  • end – The ending point of the path.

Returns:

A vector of points representing the path.

void RenderPath(const std::vector<glm::vec3> &path) const

Renders the path for debugging purposes.

Parameters:

path – The path to render.

struct NavMeshPortal
#include <NavMeshPathfinding.h>

Structure representing a portal between two triangles in the navigation mesh.

Public Members

glm::vec3 left

Left vertex of the portal.

glm::vec3 right

Right vertex of the portal.

struct OBB
#include <BoundingBox.h>

Structure representing an oriented bounding box (OBB).

Public Functions

inline OBB(const std::array<glm::vec3, 8> &corners)

Constructs an OBB with specified corners.

Parameters:

corners – The corners of the OBB.

inline OBB(const glm::mat4 &transform, const AABB &aabb)

Constructs an OBB from a transformation matrix and an AABB.

Parameters:
  • transform – The transformation matrix.

  • aabb – The axis-aligned bounding box.

Public Members

std::array<glm::vec3, 8> corners

The corners of the OBB.

template<typename T>
struct ObjectContainer
template<typename T>
class Octree
template<typename T>
class OctreeNode
struct PairHash
struct Particle
#include <ParticleManager.h>

Represents a particle in the particle system.

Public Functions

Particle()

Default constructor for Particle.

glm::mat4 GetWorldTransform() const

Gets the world transformation matrix of the particle.

Returns:

The transformation matrix.

void SetPosition(const glm::vec3 &position)

Sets the position of the particle.

Parameters:

position – The new position of the particle.

void SetRotation(const glm::vec3 &rotation)

Sets the rotation of the particle.

Parameters:

rotation – The new rotation of the particle.

void SetSize(const glm::vec3 &size)

Sets the size (scale) of the particle.

Parameters:

size – The new size of the particle.

void UpdateTransform()

Update the transform matrix of the particle.

glm::vec3 GetPosition() const

Gets the position of the particle.

Returns:

The position of the particle.

glm::vec3 GetRotation() const

Gets the rotation of the particle.

Returns:

The rotation of the particle.

glm::vec3 GetSize() const

Gets the size (scale) of the particle.

Returns:

The size of the particle.

class ParticleEmitter
#include <ParticleManager.h>

Represents a particle emitter in the particle system.

Public Types

enum class SimulationSpace

Enum for simulation space types.

Values:

enumerator Local
enumerator World
enumerator Custom
enum class ShapeType

Enum for shape types.

Values:

enumerator Circle
enumerator Cone
enumerator Box
enum class RenderAligment

Enum for render alignment types.

Values:

enumerator Billboard
enumerator Custom

Public Functions

ParticleEmitter()

Default constructor for ParticleEmitter.

void InitParticle(const Ref<Particle> &particle)

Initializes a particle with random values based on emitter settings.

Parameters:

particle – The particle to initialize.

void Update(float deltaTime)

Updates the particle emitter and its particles.

Parameters:

deltaTime – The time elapsed since the last frame.

void UpdateParticle(const Ref<Particle> &particle, float deltaTime)

Updates a single particle.

Parameters:
  • particle – The particle to update.

  • deltaTime – The time elapsed since the last frame.

void DrawParticles() const

Draw all particles.

void DrawDebug()

Draws debug information for the particle emitter.

void Emit(int quantity)

Emits a specified number of particles.

Parameters:

quantity – The number of particles to emit.

glm::mat4 CalculateBillboardTransform(const glm::mat4 &particleTransform) const

Calculates the billboard transform for a particle.

Parameters:

particleTransform – The particle’s current transform.

Returns:

The billboard transform matrix.

inline void InvalidateCurves()

Invalidates the generated curves, forcing them to be regenerated.

template<class Archive>
inline void save(Archive &archive, std::uint32_t const version) const

Serializes the ParticleEmitter object.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Static Functions

static void DrawParticles(const Ref<Particle> &particle)

Draw a single particle.

struct ParticlesSystemComponent

Public Members

bool NeedsUpdate = true

Flag to indicate if the animator needs an update.

class PBRMaterial : public Coffee::Material
#include <Material.h>

Class representing a PBRMaterial.

Public Functions

~PBRMaterial() = default

Default destructor for the PBRMaterial class.

PBRMaterial(const std::string &name)

Default constructor for the PBRPBRMaterial class.

PBRMaterial(const std::string &name, Ref<Shader> shader)

Constructs a PBRMaterial with the specified shader.

Parameters:

shader – The shader to be used with the PBRMaterial.

PBRMaterial(const std::string &name, PBRMaterialTextures &PBRMaterialTextures)

Constructs a PBRMaterial with the specified textures.

Parameters:

PBRMaterialTextures – The textures to be used with the PBRMaterial.

struct PBRMaterialImportData : public Coffee::ImportData
struct PBRMaterialProperties
#include <Material.h>

Structure representing the properties of a PBRMaterial.

Public Members

glm::vec4 color = glm::vec4(1.0f)

The color of the PBRMaterial.

float metallic = 0.0f

The metallic value of the PBRMaterial.

float roughness = 1.0f

The roughness value of the PBRMaterial.

float ao = 1.0f

The ambient occlusion value of the PBRMaterial.

glm::vec3 emissive = glm::vec3(0.0f)

The emissive value of the PBRMaterial.

struct PBRMaterialTextureFlags

Public Members

bool hasAlbedo = false

Whether the PBRMaterial has an albedo texture.

bool hasNormal = false

Whether the PBRMaterial has a normal map texture.

bool hasMetallic = false

Whether the PBRMaterial has a metallic texture.

bool hasRoughness = false

Whether the PBRMaterial has a roughness texture.

bool hasAO = false

Whether the PBRMaterial has an ambient occlusion texture.

bool hasEmissive = false

Whether the PBRMaterial has an emissive texture.

struct PBRMaterialTextures
#include <Material.h>

Structure representing the textures used in a PBRMaterial.

Public Members

Ref<Texture2D> albedo

The albedo texture.

Ref<Texture2D> normal

The normal map texture.

Ref<Texture2D> metallic

The metallic texture.

Ref<Texture2D> roughness

The roughness texture.

Ref<Texture2D> ao

The ambient occlusion texture.

Ref<Texture2D> emissive

The emissive texture.

class PhysicsWorld
class Prefab : public Coffee::Resource
class PrimitiveMesh
#include <PrimitiveMesh.h>

Class representing different types of primitive meshes.

Public Static Functions

static Ref<Mesh> CreateQuad()

Creates a quad mesh.

Returns:

A reference to the created quad mesh.

static Ref<Mesh> CreateCube(const glm::vec3 &size = {1.0f, 1.0f, 1.0f}, int subdivideW = 0, int subdidiveH = 0, int subdivideD = 0)

Creates a cube mesh.

Creates a cube mesh.

Parameters:
  • size – The size of the cube.

  • subdivideW – Number of subdivisions along the width.

  • subdivideH – Number of subdivisions along the height.

  • subdivideD – Number of subdivisions along the depth.

  • size – The size of the cube.

  • subdivideW – Subdivision parameter for width (currently not functional).

  • subdivideH – Subdivision parameter for height (currently not functional).

  • subdivideD – Subdivision parameter for depth (currently not functional).

Returns:

A reference to the created cube mesh.

Returns:

Ref<Mesh> A reference to the created cube mesh.

static Ref<Mesh> CreateSphere(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 32, bool isHemiSphere = false)

Creates a sphere mesh.

Parameters:
  • radius – The radius of the sphere.

  • height – The height of the sphere.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • isHemiSphere – Whether the sphere is a hemisphere.

Returns:

A reference to the created sphere mesh.

static Ref<Mesh> CreatePlane(const glm::vec2 &size = {1.0f, 1.0f}, const glm::vec3 &normal = {0.0f, 1.0f, 0.0f})

Creates a plane mesh.

Parameters:
  • size – The size of the plane.

  • normal – The normal vector of the plane.

Returns:

A reference to the created plane mesh.

static Ref<Mesh> CreateCylinder(float topRadius = 0.5f, float bottomRadius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool capTop = true, bool capBottom = true)

Creates a cylinder mesh.

Parameters:
  • topRadius – The radius of the top of the cylinder.

  • bottomRadius – The radius of the bottom of the cylinder.

  • height – The height of the cylinder.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • capTop – Whether to cap the top of the cylinder.

  • capBottom – Whether to cap the bottom of the cylinder.

Returns:

A reference to the created cylinder mesh.

static Ref<Mesh> CreateCone(float radius = 0.5f, float height = 1.0f, int radialSegments = 64, int rings = 1, bool cap = true)

Creates a cone mesh.

Parameters:
  • radius – The radius of the base of the cone.

  • height – The height of the cone.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

  • cap – Whether to cap the base of the cone.

Returns:

A reference to the created cone mesh.

static Ref<Mesh> CreateTorus(float innerRadius = 0.5f, float outerRadius = 1.0f, int rings = 64, int ringSegments = 32)

Creates a torus mesh.

Parameters:
  • innerRadius – The inner radius of the torus.

  • outerRadius – The outer radius of the torus.

  • rings – Number of rings.

  • ringSegments – Number of ring segments.

Returns:

A reference to the created torus mesh.

static Ref<Mesh> CreateCapsule(float radius = 0.5f, float height = 2.0f, int radialSegments = 64, int rings = 8)

Creates a capsule mesh.

Parameters:
  • radius – The radius of the capsule.

  • height – The height of the capsule.

  • radialSegments – Number of radial segments.

  • rings – Number of rings.

Returns:

A reference to the created capsule mesh.

class Project
#include <Project.h>

The Project class is responsible for managing project data such as name, directory, and start scene path.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the project data.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Static Functions

static Ref<Project> New(const std::filesystem::path &path)

Creates a new project.

Returns:

A reference to the newly created project.

static Ref<Project> Load(const std::filesystem::path &path)

Loads a project from the specified path.

Parameters:

path – The path to the project file.

Returns:

A reference to the loaded project.

static void SaveActive()

Saves the active project to the specified path.

Parameters:

path – The path to save the project file.

static inline Ref<Project> GetActive()

Gets the active project.

Returns:

A reference to the active project.

static inline const std::filesystem::path &GetProjectDirectory()

Gets the directory of the active project.

Returns:

The path to the project directory.

static inline const std::string &GetProjectName()

Gets the name of the active project.

Returns:

The name of the project.

static inline std::filesystem::path GetCacheDirectory()

Retrieves the cache directory path of the active project.

This static method returns a constant reference to the cache directory path associated with the currently active project.

Returns:

const std::filesystem::path& Reference to the cache directory path.

static inline std::filesystem::path GetAudioDirectory()

Retrieves de audio directory path of the active project.

This static method returns a reference to the audio directory absolute path associated with the currently active project If no audio directory has been defined, it returns the project’s directory path instead

Returns:

audio directory absolute path

static inline std::filesystem::path GetRelativeAudioDirectory()

Retrieves the audio directory relative path of the active object.

This static method returns a reference to the audio directory relative path associated with the currently active project. If no audio directory has been defined, it returns an empty path instead

Returns:

The audio directory relative path

static inline void SetRelativeAudioDirectory(const std::filesystem::path &path)

Sets the project’s audio directory to the path specified.

Parameters:

path – The relative path to the audio directory

struct QuadVertex
struct RaycastHit
struct RectAnchor
#include <UIAnchor.h>

Represents the anchor and offset properties for a UI element.

Public Functions

void SetAnchorPreset(AnchorPreset preset, const glm::vec4 &currentRect, const glm::vec2 &parentSize, bool preservePosition)

Sets the anchor preset for the RectAnchor.

Parameters:
  • preset – The anchor preset to apply.

  • currentRect – The current rectangle dimensions.

  • parentSize – The size of the parent element.

  • preservePosition – Whether to preserve the current position.

glm::vec4 CalculateRect(const glm::vec2 &parentSize) const

Calculates the rectangle dimensions based on the parent size.

Parameters:

parentSize – The size of the parent element.

Returns:

The calculated rectangle dimensions.

void CalculateTransformData(const glm::vec2 &parentSize, glm::vec2 &position, glm::vec2 &size) const

Calculates the transform data (position and size) based on the parent size.

Parameters:
  • parentSize – The size of the parent element.

  • position – The calculated position.

  • size – The calculated size.

glm::vec4 GetPositionAndSize(const glm::vec2 &parentSize) const

Gets the position and size of the RectAnchor based on the parent size.

Parameters:

parentSize – The size of the parent element.

Returns:

The position and size as a glm::vec4.

glm::vec2 GetAnchoredPosition(const glm::vec2 &parentSize) const

Gets the anchored position based on the parent size.

Parameters:

parentSize – The size of the parent element.

Returns:

The anchored position as a glm::vec2.

void SetAnchoredPosition(const glm::vec2 &position, const glm::vec2 &parentSize)

Sets the anchored position based on the parent size.

Parameters:
  • position – The new position to set.

  • parentSize – The size of the parent element.

glm::vec2 GetSize() const

Gets the size of the RectAnchor.

Returns:

The size as a glm::vec2.

void SetSize(const glm::vec2 &size, const glm::vec2 &parentSize)

Sets the size of the RectAnchor.

Parameters:
  • size – The new size to set.

  • parentSize – The size of the parent element.

Public Members

glm::vec2 AnchorMin = {0.5f, 0.5f}

Minimum anchor point.

glm::vec2 AnchorMax = {0.5f, 0.5f}

Maximum anchor point.

glm::vec2 OffsetMin = {-50.0f, -50.0f}

Minimum offset from the anchor.

glm::vec2 OffsetMax = {50.0f, 50.0f}

Maximum offset from the anchor.

struct RenderCommand
class Renderer
class Renderer2D
struct TextParams
struct Renderer2DData
class Renderer3D
#include <Renderer3D.h>

Class representing the 3D renderer.

Public Static Functions

static void Init()

Initializes the renderer.

static void Shutdown()

Shuts down the renderer.

static void Submit(const LightComponent &light)

Submits a light component.

Parameters:

light – The light component.

static inline const Renderer3DData &GetData()

Gets the renderer data.

Returns:

A reference to the renderer data.

static inline const Renderer3DStats &GetStats()

Gets the renderer statistics.

Returns:

A reference to the renderer statistics.

static inline Renderer3DSettings &GetRenderSettings()

Gets the render settings.

Returns:

A reference to the render settings.

struct Renderer3DData
#include <Renderer3D.h>

Structure containing renderer data.

Public Members

SceneRenderData RenderData

Render data.

Ref<UniformBuffer> SceneRenderDataUniformBuffer

Uniform buffer for render data.

Ref<Material> DefaultMaterial

Default material.

Ref<Mesh> MissingMesh

Missing mesh.

Ref<Cubemap> DefaultSkybox

Default skybox.

Ref<Texture2D> BRDFLUT

BRDF LUT texture.

std::vector<RenderCommand> opaqueRenderQueue

Opaque render queue.

std::vector<RenderCommand> transparentRenderQueue

Transparent render queue.

Public Static Attributes

static int MAX_DIRECTIONAL_SHADOWS = 4

Structure containing render data.

struct SceneRenderData

Public Members

LightComponent lights[MAX_LIGHTS]

Array of light components.

int lightCount = 0

Number of lights.

float padding[3]

Padding to align to 16 bytes.

glm::mat4 LightSpaceMatrices[MAX_DIRECTIONAL_SHADOWS]

Light space matrices for shadow mapping.

struct Renderer3DSettings
#include <Renderer3D.h>

Structure containing render settings.

Public Members

bool SSAO = false

Enable or disable SSAO.

bool DepthFog = false

Enable or disable depth fog.

glm::vec3 FogColor = {0.5f, 0.5f, 0.5f}

Fog color.

float FogDensity = 0.1f

Fog density.

float FogHeight = 0.0f

Fog height.

float FogHeightDensity = 0.0f

Fog height density.

bool Bloom = false

Enable or disable bloom.

float BloomIntensity = 0.1f

Bloom intensity.

float BloomRadius = 1.0f

Bloom radius.

int BloomMaxMipLevels = 5

Maximum number of mip levels for bloom.

bool FXAA = true

Enable or disable FXAA.

float Exposure = 1.0f

Exposure value.

float EnvironmentExposure = 1.0f

Environment exposure value.

struct Renderer3DStats
#include <Renderer3D.h>

Structure containing renderer statistics.

Public Members

uint32_t DrawCalls = 0

Number of draw calls.

uint32_t VertexCount = 0

Number of vertices.

uint32_t IndexCount = 0

Number of indices.

class RendererAPI
#include <RendererAPI.h>

Class representing the Renderer API.

Public Static Functions

static void Init()

Initializes the Renderer API.

static void SetClearColor(const glm::vec4 &color)

Sets the clear color for the renderer.

Parameters:

color – The clear color as a glm::vec4.

static void Clear(uint32_t clearFlags = (uint32_t)ClearFlags::Color | (uint32_t)ClearFlags::Depth)

Clears the current buffer.

static void SetDepthMask(bool enabled)

Enables or disables the depth mask.

Parameters:

enabled – True to enable the depth mask, false to disable it.

static void DrawIndexed(const Ref<VertexArray> &vertexArray, uint32_t indexCount = 0)

Draws the indexed vertices from the specified vertex array.

Parameters:

vertexArray – The vertex array containing the vertices to draw.

static void DrawLines(const Ref<VertexArray> &vertexArray, uint32_t vertexCount, float lineWidth = 1.0f)

Draws lines from the specified vertex array.

Parameters:
  • vertexArray – The vertex array containing the vertices to draw.

  • vertexCount – The number of vertices to draw.

  • lineWidth – The width of the lines.

static Scope<RendererAPI> Create()

Creates a new Renderer API instance.

Returns:

A scope pointer to the created Renderer API instance.

struct RendererData

Public Members

Ref<UniformBuffer> CameraUniformBuffer

Uniform buffer for camera data.

CameraData cameraData

Camera data.

struct RendererSettings

Public Members

bool PostProcessing = true

Enable or disable post-processing.

struct RendererStats
class RenderTarget
class Resource
#include <Resource.h>

Base class for different types of resources in the CoffeeEngine.

Subclassed by Coffee::Material, Coffee::Mesh, Coffee::Model, Coffee::Prefab, Coffee::Shader, Coffee::Texture

Public Functions

inline Resource(ResourceType type = ResourceType::Unknown)

Constructor that initializes the resource with a type.

Parameters:

type – The type of the resource.

virtual ~Resource() = default

Virtual destructor.

inline const std::string &GetName() const

Gets the name of the resource.

Returns:

The name of the resource.

inline const std::filesystem::path &GetPath()

Gets the file path of the resource.

Returns:

The file path of the resource.

inline void SetName(const std::string &name)

Sets the name of the mesh.

Parameters:

name – The name of the mesh.

inline ResourceType GetType() const

Gets the type of the resource.

Returns:

The type of the resource.

inline void SetUUID(UUID uuid)

Sets the UUID of the resource.

Parameters:

uuid – The UUID to set.

inline UUID GetUUID() const

Gets the UUID of the resource.

Returns:

The UUID of the resource.

inline void SetEmbedded(bool isEmbedded)

Sets the embedded status of the resource.

Parameters:

isEmbedded – The embedded status to set.

inline bool IsEmbedded() const

Checks if the resource is embedded.

Returns:

True if the resource is embedded, false otherwise.

class ResourceImporter
#include <ResourceImporter.h>

Handles the import of resources such as textures.

class ResourceLoader
#include <ResourceLoader.h>

Loads resources such as textures and models for the CoffeeEngine.

Public Static Functions

static void LoadDirectory(const std::filesystem::path &directory)

Loads all resources from a directory.

Parameters:

directory – The directory to load resources from.

static void LoadFile(const std::filesystem::path &path)

Loads a single resource file.

Parameters:

path – The file path of the resource to load.

class ResourceRegistry
#include <ResourceRegistry.h>

Manages the registration and retrieval of resources.

Public Static Functions

static inline void Add(UUID uuid, Ref<Resource> resource)

Adds a resource to the registry.

Parameters:
  • name – The name of the resource.

  • resource – A reference to the resource to add.

template<typename T>
static inline Ref<T> Get(UUID uuid)

Retrieves a resource from the registry.

Template Parameters:

T – The type of the resource.

Parameters:

name – The name of the resource.

Returns:

A reference to the resource, or nullptr if not found.

template<typename T>
static inline Ref<T> Get(const std::string &name)

Retrieves a resource from the registry.

Parameters:

name – The name of the resource.

Returns:

A reference to the resource, or nullptr if not found.

static inline bool Exists(UUID uuid)

Checks if a resource exists in the registry.

Parameters:

name – The name of the resource.

Returns:

True if the resource exists, false otherwise.

static inline bool Exists(const std::string &name)

Checks if a resource exists in the registry.

Parameters:

name – The name of the resource.

Returns:

True if the resource exists, false otherwise.

static inline void Clear()

Clears all resources from the registry.

static inline const std::unordered_map<UUID, Ref<Resource>> &GetResourceRegistry()

Gets the entire resource registry.

Returns:

A constant reference to the resource registry.

class ResourceSaver
#include <ResourceSaver.h>

Handles saving resources to disk and cache.

Public Static Functions

template<typename T>
static inline void Save(const std::filesystem::path &path, const Ref<T> &resource)

Saves a resource to a specified path on disk.

Parameters:
  • path – The file path where the resource will be saved.

  • resource – A reference to the resource to save.

template<typename T>
static inline void SaveToCache(const std::string &filename, const Ref<T> &resource)

Saves a resource to the project cache.

Parameters:

resource – A reference to the resource to save to cache.

template<typename T>
static inline void SaveToCache(UUID uuid, const Ref<T> &resource)

Saves a resource to the project cache.

Parameters:

resource – A reference to the resource to save to cache.

class RigidBody
struct Properties
struct RigidbodyComponent
class Scene
#include <Scene.h>

Class representing a scene.

Public Functions

Scene()

Constructor for Scene.

~Scene() = default

Default destructor.

Entity CreateEntity(const std::string &name = std::string())

Create an entity in the scene.

Parameters:

name – The name of the entity.

Returns:

The created entity.

void DestroyEntity(Entity entity)

Destroy an entity in the scene.

Parameters:

entity – The entity to destroy.

void OnInitEditor()

Initialize the scene.

void OnUpdateEditor(EditorCamera &camera, float dt)

Update the scene in editor mode.

Parameters:
  • camera – The editor camera.

  • dt – The delta time.

void OnUpdateRuntime(float dt)

Update the scene in runtime mode.

Parameters:

dt – The delta time.

void OnEvent(Event &e)

Handle an event in the scene.

Parameters:

e – The event.

void OnExitEditor()

Exit the scene.

void UpdateAudioComponentsPositions()

Update the positions of the audio components.

void AssignAnimatorsToMeshes(const std::vector<AnimatorComponent*> animators)

Assigns animators to meshes.

Parameters:

animators – The vector of animator components.

Public Static Functions

static Ref<Scene> Load(const std::filesystem::path &path)

Load a scene from a file.

Parameters:

path – The path to the file.

Returns:

The loaded scene.

static void Save(const std::filesystem::path &path, Ref<Scene> scene)

Save a scene to a file.

Parameters:
  • path – The path to the file.

  • scene – The scene to save.

class SceneCamera : public Coffee::Camera
#include <SceneCamera.h>

Camera class for the scene.

Public Functions

SceneCamera()

Constructor for SceneCamera.

~SceneCamera() = default

Default destructor.

struct SceneDebugFlags
class SceneManager
class SceneTree
#include <SceneTree.h>

Class for managing the scene tree.

Public Functions

SceneTree(Scene *scene)

Constructor for SceneTree.

Parameters:

scene – The scene context.

~SceneTree() = default

Default destructor.

void Update()

Update the scene tree.

void UpdateTransform(entt::entity entity)

Update the transform of an entity.

Parameters:

entity – The entity to update.

class Script

Subclassed by Coffee::LuaScript

struct ScriptComponent

Public Functions

template<class Archive>
inline void save(Archive &archive, std::uint32_t const version) const

Serializes the ScriptComponent.

This function serializes the ScriptComponent by storing the script path and language. Note: Currently, this system only supports Lua scripting language.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

class ScriptManager
class Shader : public Coffee::Resource
#include <Shader.h>

Class representing a shader program.

Public Functions

Shader(const std::filesystem::path &shaderPath)

Constructs a Shader with the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

virtual ~Shader()

Destructor for the Shader class.

void Bind()

Binds the shader program for use.

void Unbind()

Unbinds the shader program.

void setBool(const std::string &name, bool value) const

Sets a boolean uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The boolean value to set.

void setInt(const std::string &name, int value) const

Sets an integer uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The integer value to set.

void setFloat(const std::string &name, float value) const

Sets a float uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The float value to set.

void setVec2(const std::string &name, const glm::vec2 &value) const

Sets a vec2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec2 value to set.

void setVec3(const std::string &name, const glm::vec3 &value) const

Sets a vec3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec3 value to set.

void setVec4(const std::string &name, const glm::vec4 &value) const

Sets a vec4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • value – The vec4 value to set.

void setMat2(const std::string &name, const glm::mat2 &mat) const

Sets a mat2 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat2 value to set.

void setMat3(const std::string &name, const glm::mat3 &mat) const

Sets a mat3 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat3 value to set.

void setMat4(const std::string &name, const glm::mat4 &mat) const

Sets a mat4 uniform in the shader.

Parameters:
  • name – The name of the uniform.

  • mat – The mat4 value to set.

void checkCompileErrors(GLuint shader, std::string type)

Checks for compile errors in the shader.

Parameters:
  • shader – The shader ID.

  • type – The type of the shader.

Public Static Functions

static Ref<Shader> Create(const std::filesystem::path &shaderPath)

Creates a shader from the specified vertex and fragment shader paths.

Parameters:
  • vertexPath – The file path to the vertex shader.

  • fragmentPath – The file path to the fragment shader.

Returns:

A reference to the created shader.

struct ShaderImportData : public Coffee::ImportData
class ShaderMaterial : public Coffee::Material
class Skeleton
#include <Skeleton.h>

Class representing a skeleton.

Public Functions

void SetSkeleton(ozz::unique_ptr<ozz::animation::Skeleton> skeleton)

Sets the skeleton.

Parameters:

skeleton – The skeleton to set.

inline const ozz::animation::Skeleton *GetSkeleton() const

Gets the skeleton.

Returns:

The skeleton.

void SetJoints(const std::vector<Joint> &joints)

Sets the joints.

Parameters:

joints – The joints to set.

inline const std::vector<Joint> &GetJoints() const

Gets the joints.

Returns:

The joints.

inline unsigned int GetNumJoints() const

Gets the number of joints.

Returns:

The number of joints.

inline const std::vector<glm::mat4> &GetJointMatrices() const

Gets the joint matrices.

Returns:

The joint matrices.

void Save(ozz::io::OArchive &archive) const

Saves the skeleton to an archive.

Parameters:

archive – The archive to save to.

void Load(ozz::io::IArchive &archive, std::vector<Joint> &joints)

Loads the skeleton from an archive.

Parameters:
  • archive – The archive to load from.

  • joints – The joints to load.

class SphereCollider : public Coffee::Collider
struct SpriteComponent

Public Members

Ref<Texture2D> texture

The zone ID.

struct StaticComponent
class Stopwatch
#include <Stopwatch.h>

A class to measure elapsed time.

The Stopwatch class provides functionality to start, stop, reset, and retrieve the elapsed time. It supports both regular and high-precision timing.

Public Functions

Stopwatch()

Constructs a new Stopwatch object.

void Start()

Starts the stopwatch.

If the stopwatch is already running, this method has no effect.

void Stop()

Stops the stopwatch.

If the stopwatch is not running, this method has no effect.

void Reset()

Resets the stopwatch.

This method stops the stopwatch and resets the elapsed time to zero.

float GetElapsedTime() const

Gets the elapsed time in seconds.

Returns:

The elapsed time in seconds.

double GetPreciseElapsedTime() const

Gets the precise elapsed time in seconds.

This method uses SDL_GetPerformanceCounter for higher precision.

Returns:

The precise elapsed time in seconds.

class SystemInfo

Subclassed by Coffee::LinuxSystemInfo, Coffee::WindowsSystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const = 0

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const = 0

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const = 0

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const = 0

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

Public Static Functions

static uint32_t GetLogicalProcessorCount()

Gets the number of logical processors.

static uint32_t GetPhysicalProcessorCount()

Gets the number of physical processors.

static uint64_t GetTotalMemory()

Gets the total memory in the system.

static uint64_t GetAvailableMemory()

Gets the available memory in the system.

static uint64_t GetUsedMemory()

Gets the used memory in the system.

static uint64_t GetProcessMemoryUsage()

Gets the memory used by the process.

struct TagComponent
#include <Components.h>

Component representing a tag.

Public Functions

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the TagComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

Public Members

std::string Tag

The tag string.

class Texture : public Coffee::Resource

Subclassed by Coffee::Cubemap, Coffee::Texture2D

class Texture2D : public Coffee::Texture
struct Texture2DImportData : public Coffee::ImportData
struct TextureProperties
struct TextVertex
class Timer
#include <Timer.h>

A class that represents a timer with various functionalities.

Public Functions

inline Timer()

Default constructor.

Timer(double waitTime, bool autoStart, bool oneShot, TimerCallback callback)

Parameterized constructor.

Parameters:
  • waitTime – The time to wait before the timer triggers.

  • autoStart – Whether the timer should start automatically.

  • oneShot – Whether the timer should trigger only once.

  • callback – The callback function to be called when the timer triggers.

void Start(double waitTime)

Starts the timer with a specified wait time.

Parameters:

waitTime – The time to wait before the timer triggers.

void Stop()

Stops the timer.

void setWaitTime(double waitTime)

Sets the wait time for the timer.

Parameters:

waitTime – The time to wait before the timer triggers.

inline double getWaitTime() const

Gets the wait time of the timer.

Returns:

The time to wait before the timer triggers.

inline void setOneShot(bool oneShot)

Sets whether the timer should trigger only once.

Parameters:

oneShot – Whether the timer should trigger only once.

inline bool isOneShot() const

Checks if the timer is set to trigger only once.

Returns:

True if the timer is set to trigger only once, false otherwise.

inline void setAutoStart(bool autoStart)

Sets whether the timer should start automatically.

Parameters:

autoStart – Whether the timer should start automatically.

inline bool isAutoStart() const

Checks if the timer is set to start automatically.

Returns:

True if the timer is set to start automatically, false otherwise.

void setPaused(bool paused)

Sets whether the timer is paused.

Parameters:

paused – Whether the timer is paused.

inline bool isPaused() const

Checks if the timer is paused.

Returns:

True if the timer is paused, false otherwise.

void isStopped()

Checks if the timer is stopped.

inline double GetTimeLeft() const

Gets the remaining time before the timer triggers.

Returns:

The remaining time before the timer triggers.

inline void SetCallback(TimerCallback callback)

Sets the callback function to be called when the timer triggers.

Parameters:

callback – The callback function.

inline TimerCallback GetCallback() const

Gets the callback function to be called when the timer triggers.

Returns:

The callback function.

struct TransformComponent
#include <Components.h>

Component representing a transform.

Public Functions

inline glm::vec3 &GetLocalPosition()

Gets the local position vector.

Returns:

The local position vector.

inline glm::mat4 GetLocalTransform() const

Gets the local transformation matrix.

Returns:

The local transformation matrix.

inline void SetLocalTransform(const glm::mat4 &transform)

Sets the local transformation matrix.

Parameters:

transform – The transformation matrix to set.

inline const glm::mat4 &GetWorldTransform() const

Gets the world transformation matrix.

Returns:

The world transformation matrix.

inline void SetWorldTransform(const glm::mat4 &transform)

Sets the world transformation matrix.

Parameters:

transform – The transformation matrix to set.

template<class Archive>
inline void serialize(Archive &archive, std::uint32_t const version)

Serializes the TransformComponent.

Template Parameters:

Archive – The type of the archive.

Parameters:

archive – The archive to serialize to.

struct UIButtonComponent : public Coffee::UIComponent

Public Members

State CurrentState = State::Normal

The current state of the button.

bool Interactable = true

Flag to indicate if the button is interactable.

Ref<Texture2D> NormalTexture

The texture when the button is normal.

Ref<Texture2D> HoverTexture

The texture when the button is hovered.

Ref<Texture2D> PressedTexture

The texture when the button is pressed.

Ref<Texture2D> DisabledTexture

The texture when the button is disabled.

glm::vec4 NormalColor = {1.0f}

The color when the button is normal.

glm::vec4 HoverColor = {1.0f}

The color when the button is hovered.

glm::vec4 PressedColor = {1.0f}

The color when the button is pressed.

glm::vec4 DisabledColor = {1.0f}

The color when the button is disabled.

struct UIComponent

Subclassed by Coffee::UIButtonComponent, Coffee::UIImageComponent, Coffee::UISliderComponent, Coffee::UITextComponent, Coffee::UIToggleComponent

Public Members

RectAnchor Anchor

The anchor of the UI component.

int Layer = 0

The layer of the UI component.

struct UIImageComponent : public Coffee::UIComponent

Public Members

Ref<Texture2D> Texture

The texture of the image.

glm::vec4 Color = {1.0f, 1.0f, 1.0f, 1.0f}

The color.

glm::vec4 UVRect = {0.0f, 0.0f, 1.0f, 1.0f}

The UV rectangle.

class UIManager

Public Static Functions

static void UpdateUI(entt::registry &registry)

Updates the UI elements in the registry.

Parameters:

registry – The entity registry containing UI elements.

static inline void MarkForSorting()

Marks the UI elements for sorting.

static AnchorPreset GetAnchorPreset(int row, int column)

Gets an anchor preset based on row and column indices.

Parameters:
  • row – The row index (0=top, 1=middle, 2=bottom, 3=stretch).

  • column – The column index (0=left, 1=center, 2=right, 3=stretch).

Returns:

The corresponding AnchorPreset.

static glm::vec2 GetParentSize(entt::registry &registry, UIRenderItem &item)

Gets the size of the parent element for a given entity.

Parameters:

registry – The entity registry.

Returns:

The size of the parent element as a glm::vec2.

static void SetReferenceCanvasSize(const glm::vec2 &referenceSize)

Sets the reference canvas size that the UI was designed for.

Parameters:

referenceSize – The reference size the UI was designed for.

static void CalculateUIScaleFactor()

Calculates the UI scale factor based on current window size and reference size.

static glm::vec2 ScaleSize(const glm::vec2 &size)

Converts a size from the reference canvas space to the current window space.

Parameters:

size – Size in reference space.

Returns:

Size in current window space.

static glm::vec2 ScalePosition(const glm::vec2 &position)

Converts a position from the reference canvas space to the current window space.

Parameters:

position – Position in reference space.

Returns:

Position in current window space.

static UIRenderItem &GetUIRenderItem(entt::entity entity)

Gets the UIRenderItem associated with a given entity.

Parameters:

entity – The entity to get the UIRenderItem for.

Returns:

A reference to the UIRenderItem associated with the entity.

static void MarkDirty(entt::entity entity)

Marks a UI element as dirty, indicating that it needs to be updated.

Parameters:

entity – The entity to mark as dirty.

static inline void MarkToTransform(entt::entity entity, const glm::vec2 &scale)

Queues a scale transformation to be applied during the next update.

Parameters:
  • entity – The entity to scale.

  • scale – The scale factor to apply.

static inline void MarkToTransform(entt::entity entity, const glm::vec2 &offset, bool isMove)

Queues a move transformation to be applied during the next update.

Parameters:
  • entity – The entity to move.

  • offset – The amount to move the entity by.

  • isMove – Parameter to differentiate from the scale overload (should always be true).

static inline void MarkToTransform(entt::entity entity, float angle, bool absolute = false)

Queues a rotation transformation to be applied during the next update.

Parameters:
  • entity – The entity to rotate.

  • angle – The rotation angle in degrees.

  • absolute – If true, sets the absolute rotation; if false, adds to the current rotation.

struct AnchoredTransform
#include <UIManager.h>

Represents the anchored transform of a UI element.

Public Members

glm::vec2 Position

The position of the UI element.

glm::vec2 Size

The size of the UI element.

struct TransformOperation
struct UIRenderItem
#include <UIManager.h>

Represents a renderable UI item.

Public Members

entt::entity Entity

The entity associated with the UI item.

int Layer

The rendering layer of the UI item.

UIComponentType ComponentType

The type of UI component.

entt::entity Parent

The parent entity in the hierarchy.

entt::entity Next

The next sibling entity in the hierarchy.

glm::mat4 WorldTransform

Cached world transform matrix.

bool TransformDirty = true

Flag to indicate if transform needs updating.

glm::vec2 ParentSize

Cached size of the parent element.

bool ParentSizeDirty = true

Flag to indicate if parent size needs updating.

struct UISliderComponent : public Coffee::UIComponent

Public Members

float Value = 0.0f

The value of the slider.

float MinValue = 0.0f

The minimum value of the slider.

float MaxValue = 100.0f

The maximum value of the slider.

glm::vec2 HandleScale

The scale of the handle.

Ref<Texture2D> BackgroundTexture

The texture of the background.

Ref<Texture2D> HandleTexture

The texture of the handle.

Ref<Texture2D> DisabledHandleTexture

The texture of the disabled handle.

bool Selected = false

Flag to indicate if the slider is selected.

struct UITextComponent : public Coffee::UIComponent

Public Members

std::string Text

The text.

Ref<Font> UIFont

The font.

std::filesystem::path FontPath

The font path.

glm::vec4 Color = {1.0f, 1.0f, 1.0f, 1.0f}

The color.

float Kerning = 0.0f

The kerning.

float LineSpacing = 0.0f

The line spacing.

float FontSize = 16.0f

The font size.

Renderer2D::TextAlignment Alignment = Renderer2D::TextAlignment::Left

The text alignment.

struct UIToggleComponent : public Coffee::UIComponent

Public Members

bool Value = false

The value of the toggle.

Ref<Texture2D> OnTexture

The texture when the toggle is on.

Ref<Texture2D> OffTexture

The texture when the toggle is off.

class UniformBuffer
#include <UniformBuffer.h>

Class representing a uniform buffer.

Public Functions

UniformBuffer(uint32_t size, uint32_t binding)

Constructs a UniformBuffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

virtual ~UniformBuffer()

Destructor for the UniformBuffer class.

void SetData(const void *data, uint32_t size, uint32_t offset = 0)

Sets the data of the uniform buffer.

Parameters:
  • data – A pointer to the data to set.

  • size – The size of the data.

  • offset – The offset in the buffer to set the data.

Public Static Functions

static Ref<UniformBuffer> Create(uint32_t size, uint32_t binding)

Creates a uniform buffer with the specified size and binding.

Parameters:
  • size – The size of the buffer.

  • binding – The binding point of the buffer.

Returns:

A reference to the created uniform buffer.

class UUID
struct Vertex
#include <Mesh.h>

Structure representing a vertex in a mesh.

Public Members

glm::vec3 Position = glm::vec3(0.0f)

The position of the vertex.

glm::vec2 TexCoords = glm::vec2(0.0f)

The texture coordinates of the vertex.

glm::vec3 Normals = glm::vec3(0.0f)

The normal vector of the vertex.

glm::vec3 Tangent = glm::vec3(0.0f)

The tangent vector of the vertex.

glm::vec3 Bitangent = glm::vec3(0.0f)

The bitangent vector of the vertex.

glm::ivec4 BoneIDs = glm::ivec4(-1)

The bone IDs of the vertex.

glm::vec4 BoneWeights = glm::vec4(0.0f)

The bone weights of the vertex.

class VertexArray
#include <VertexArray.h>

Class representing a vertex array.

Public Functions

VertexArray()

Constructs a VertexArray.

virtual ~VertexArray()

Destructor for the VertexArray class.

void Bind()

Binds the vertex array.

void Unbind()

Unbinds the vertex array.

void AddVertexBuffer(const Ref<VertexBuffer> &vertexBuffer)

Adds a vertex buffer to the vertex array.

Parameters:

vertexBuffer – A reference to the vertex buffer to add.

void SetIndexBuffer(const Ref<IndexBuffer> &indexBuffer)

Sets the index buffer for the vertex array.

Parameters:

indexBuffer – A reference to the index buffer to set.

inline const std::vector<Ref<VertexBuffer>> &GetVertexBuffers() const

Gets the vertex buffers of the vertex array.

Returns:

A constant reference to the vector of vertex buffers.

inline const Ref<IndexBuffer> &GetIndexBuffer() const

Gets the index buffer of the vertex array.

Returns:

A constant reference to the index buffer.

Public Static Functions

static Ref<VertexArray> Create()

Creates a vertex array.

Returns:

A reference to the created vertex array.

class VertexBuffer
#include <Buffer.h>

Class representing a vertex buffer.

Public Functions

VertexBuffer(uint32_t size)

Constructs a VertexBuffer with the specified size.

Parameters:

size – The size of the buffer.

VertexBuffer(float *vertices, uint32_t size)

Constructs a VertexBuffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

virtual ~VertexBuffer()

Destroys the VertexBuffer.

void Bind()

Binds the vertex buffer.

void Unbind()

Unbinds the vertex buffer.

void SetData(void *data, uint32_t size)

Sets the data of the vertex buffer.

Parameters:
  • data – The data to set.

  • size – The size of the data.

inline const BufferLayout &GetLayout() const

Returns the layout of the vertex buffer.

Returns:

The buffer layout.

inline void SetLayout(const BufferLayout &layout)

Sets the layout of the vertex buffer.

Parameters:

layout – The buffer layout.

Public Static Functions

static Ref<VertexBuffer> Create(uint32_t size)

Creates a vertex buffer with the specified size.

Parameters:

size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

static Ref<VertexBuffer> Create(float *vertices, uint32_t size)

Creates a vertex buffer with the specified vertices and size.

Parameters:
  • vertices – The vertex data.

  • size – The size of the buffer.

Returns:

A reference to the created vertex buffer.

class Window
#include <Window.h>

The Window class is responsible for managing the window and its properties.

Public Functions

Window(const WindowProps &props)

Constructs a Window object with the specified properties.

Parameters:

props – The properties of the window.

virtual ~Window()

Destroys the Window object.

void OnUpdate()

Updates the window.

inline unsigned int GetWidth() const

Gets the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Gets the height of the window.

Returns:

The height of the window.

void SetVSync(bool enabled)

Enables or disables VSync.

Parameters:

enabled – True to enable VSync, false to disable.

bool IsVSync() const

Checks if VSync is enabled.

Returns:

True if VSync is enabled, false otherwise.

void SetTitle(const std::string &title)

Sets the title of the window.

Parameters:

title – The new title of the window.

inline const std::string &GetTitle() const

Gets the title of the window.

Returns:

The title of the window.

void SetIcon(const std::string &path)

Sets the icon of the window.

Parameters:

path – The path to the icon file.

void SetWindowMode(WindowMode mode)

Sets the window mode (windowed, fullscreen).

Parameters:

mode – The desired window mode.

WindowMode GetWindowMode() const

Gets the current window mode.

Returns:

The current window mode.

inline virtual void *GetNativeWindow() const

Gets the native window handle.

Returns:

A pointer to the native window.

Public Static Functions

static inline Scope<Window> Create(const WindowProps &props = WindowProps())

Creates a window with the specified properties.

Parameters:

props – The properties of the window.

Returns:

A scoped pointer to the created window.

class WindowCloseEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window close.

struct WindowProps
#include <Window.h>

Structure to hold window properties such as title, width, and height.

Public Functions

inline WindowProps(const std::string &title = "Coffee Engine", uint32_t width = 1600, uint32_t height = 900)

Constructs WindowProps with default or specified values.

Parameters:
  • title – The title of the window.

  • width – The width of the window.

  • height – The height of the window.

Public Members

std::string Title

The title of the window.

uint32_t Width

The width of the window.

uint32_t Height

The height of the window.

class WindowResizeEvent : public Coffee::Event
#include <ApplicationEvent.h>

Event for window resize.

Public Functions

inline unsigned int GetWidth() const

Get the width of the window.

Returns:

The width of the window.

inline unsigned int GetHeight() const

Get the height of the window.

Returns:

The height of the window.

inline virtual std::string ToString() const override

Convert the event to a string representation.

Returns:

A string representation of the event.

class WindowsSystemInfo : public Coffee::SystemInfo

Public Functions

virtual uint32_t GetPhysicalProcessorCountImpl() const override

Gets the number of physical processors.

Returns:

The number of physical processors.

virtual uint64_t GetAvailableMemoryImpl() const override

Gets the amount of available memory in the system.

Returns:

The amount of available memory in the system.

virtual uint64_t GetUsedMemoryImpl() const override

Gets the amount of memory used in the system.

Returns:

The amount of memory used in the system.

virtual uint64_t GetProcessMemoryUsageImpl() const override

Gets the amount of memory used by the process.

Returns:

The amount of memory used by the process.

struct WorldEnvironmentComponent

Public Members

Ref<Cubemap> Skybox

The skybox reference.

float SkyboxIntensity = 1.0f

The exposure of the skybox.

float TonemappingExposure = 1.0f

The exposure for tonemapping.

bool Fog = false

Flag to enable fog.

glm::vec3 FogColor = {0.5f, 0.5f, 0.5f}

The color of the fog.

float FogDensity = 0.1f

The density of the fog.

float FogHeight = 0.0f

Fog height.

float FogHeightDensity = 0.1f

Fog height density.///< The end distance of the fog.

bool SSAO = false

Flag to enable screen space ambient occlusion.

float SSAORadius = 0.5f

The radius of the SSAO.

float SSAOStrength = 1.0f

The strength of the SSAO.

float SSAOIntensity = 1.0f

The intensity of the SSAO.

float SSAOScale = 1.0f

The scale of the SSAO.

float SSAOBias = 0.1f

The bias of the SSAO.

bool Bloom = false

Flag to enable bloom.

int BloomMaxMipLevels = 5

The maximum number of mip levels for bloom.

float BloomIntensity = 1.0f

The intensity of the bloom.

float BloomRadius = 1.0f

The radius of the bloom.

namespace ActionsEnum

List of possible actions in ActionMap v0.1.

Enums

Values:

enumerator UiMoveHorizontal
enumerator UiMoveVertical
enumerator Confirm
enumerator Cancel
enumerator MoveHorizontal
enumerator MoveVertical
enumerator AimHorizontal
enumerator AimVertical
enumerator Shoot
enumerator Melee
enumerator Interact
enumerator Dash
enumerator Cover
enumerator Skill1
enumerator Skill2
enumerator Skill3
enumerator Injector
enumerator Grenade
enumerator Map
enumerator Pause
enumerator ActionCount
namespace Axis

Enums

Values:

enumerator Invalid
enumerator LeftX
enumerator LeftY
enumerator RightX
enumerator RightY
enumerator LeftTrigger
enumerator RightTrigger
enumerator Count
namespace Button

Enums

Values:

enumerator Invalid
enumerator South

Bottom face button (e.g. Xbox A button)

enumerator East

Right face button (e.g. Xbox B button)

enumerator West

Left face button (e.g. Xbox X button)

enumerator North

Top face button (e.g. Xbox Y button)

enumerator Back
enumerator Guide
enumerator Start
enumerator LeftStick
enumerator RightStick
enumerator LeftShoulder
enumerator RightShoulder
enumerator DpadUp
enumerator DpadDown
enumerator DpadLeft
enumerator DpadRight
enumerator Misc1

Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button)

enumerator RightPaddle1

Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)

enumerator LeftPaddle1

Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)

enumerator RightPaddle2

Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)

enumerator Leftpaddle2

Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)

enumerator Touchpad

PS4/PS5 touchpad button

enumerator Misc2

Additional button

enumerator Misc3

Additional button

enumerator Misc4

Additional button

enumerator Misc5

Additional button

enumerator Misc6

Additional button

enumerator Count
namespace ButtonStates

Enums

Values:

enumerator IDLE
enumerator UP
enumerator DOWN
enumerator REPEAT
namespace ImportDataUtils

Functions

void SaveImportData(Scope<ImportData> &importData)
Scope<ImportData> LoadImportData(const std::filesystem::path &path)
bool HasImportFile(const std::filesystem::path &path)
Scope<ImportData> CreateImportData(ResourceType type)
template<typename T>
Scope<ImportData> CreateImportData()
namespace Key

Enums

Values:

enumerator Unknown
enumerator A
enumerator B
enumerator C
enumerator D
enumerator E
enumerator F
enumerator G
enumerator H
enumerator I
enumerator J
enumerator K
enumerator L
enumerator M
enumerator N
enumerator O
enumerator P
enumerator Q
enumerator R
enumerator S
enumerator T
enumerator U
enumerator V
enumerator W
enumerator X
enumerator Y
enumerator Z
enumerator D1
enumerator D2
enumerator D3
enumerator D4
enumerator D5
enumerator D6
enumerator D7
enumerator D8
enumerator D9
enumerator D0
enumerator Return
enumerator Escape
enumerator Backspace
enumerator Tab
enumerator Space
enumerator Minus
enumerator Equals
enumerator LeftBracket
enumerator RightBracket
enumerator Backslash

Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout.

enumerator NonUsHash

ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I’ve seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards.

enumerator Semicolon
enumerator Apostrophe
enumerator Grave

Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards.

enumerator Comma
enumerator Period
enumerator Slash
enumerator CapsLock
enumerator F1
enumerator F2
enumerator F3
enumerator F4
enumerator F5
enumerator F6
enumerator F7
enumerator F8
enumerator F9
enumerator F10
enumerator F11
enumerator F12
enumerator PrintScreen
enumerator ScrollLock
enumerator Pause
enumerator Insert

insert on PC, help on some Mac keyboards (but does send code 73, not 117)

enumerator Home
enumerator PageUp
enumerator Delete
enumerator End
enumerator PageDown
enumerator Right
enumerator Left
enumerator Down
enumerator Up
enumerator NumLockClear

num lock on PC, clear on Mac keyboards

enumerator KpDivide
enumerator KpMultiply
enumerator KpMinus
enumerator KpPlus
enumerator KpEnter
enumerator Kp1
enumerator Kp2
enumerator Kp3
enumerator Kp4
enumerator Kp5
enumerator Kp6
enumerator Kp7
enumerator Kp8
enumerator Kp9
enumerator Kp0
enumerator KpPeriod
enumerator NonUsBackslash

This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout.

enumerator Application

windows contextual menu, compose

enumerator Power

The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.

enumerator KpEquals
enumerator F13
enumerator F14
enumerator F15
enumerator F16
enumerator F17
enumerator F18
enumerator F19
enumerator F20
enumerator F21
enumerator F22
enumerator F23
enumerator F24
enumerator Execute
enumerator Help

AL Integrated Help Center

enumerator Menu

Menu (show menu)

enumerator Select
enumerator Stop

AC Stop

enumerator Again

AC Redo/Repeat

enumerator Undo

AC Undo

enumerator Cut

AC Cut

enumerator Copy

AC Copy

enumerator Paste

AC Paste

enumerator Find

AC Find

enumerator Mute
enumerator VolumeUp
enumerator VolumeDown
enumerator KpComma
enumerator KpEqualsAs400
enumerator International1

used on Asian keyboards, see footnotes in USB doc

enumerator International2
enumerator International3

Yen

enumerator International4
enumerator International5
enumerator International6
enumerator International7
enumerator International8
enumerator International9
enumerator Lang1

Hangul/English toggle

enumerator Lang2

Hanja conversion

enumerator Lang3

Katakana

enumerator Lang4

Hiragana

enumerator Lang5

Zenkaku/Hankaku

enumerator Lang6

reserved

enumerator Lang7

reserved

enumerator Lang8

reserved

enumerator Lang9

reserved

enumerator AltErase

Erase-Eaze

enumerator SysReq
enumerator Cancel

AC Cancel

enumerator Clear
enumerator Prior
enumerator Return2
enumerator Separator
enumerator Out
enumerator Oper
enumerator ClearAgain
enumerator CrSel
enumerator ExSel
enumerator Kp00
enumerator Kp000
enumerator ThousandsSeparator
enumerator DecimalSeparator
enumerator CurrencyUnit
enumerator CurrencySubUnit
enumerator KpLeftParen
enumerator KpRightParen
enumerator KpLeftBrace
enumerator KpRightBrace
enumerator KpTab
enumerator KpBackspace
enumerator KpA
enumerator KpB
enumerator KpC
enumerator KpD
enumerator KpE
enumerator KpF
enumerator KpXor
enumerator KpPower
enumerator KpPercent
enumerator KpLess
enumerator KpGreater
enumerator KpAmpersand
enumerator KpDblAmpersand
enumerator KpVerticalBar
enumerator KpDblVerticalBar
enumerator KpColon
enumerator KpHash
enumerator KpSpace
enumerator KpAt
enumerator KpExclam
enumerator KpMemStore
enumerator KpMemRecall
enumerator KpMemClear
enumerator KpMemAdd
enumerator KpMemSubtract
enumerator KpMemMultiply
enumerator KpMemDivide
enumerator KpPlusMinus
enumerator KpClear
enumerator KpClearEntry
enumerator KpBinary
enumerator KpOctal
enumerator KpDecimal
enumerator KpHexadecimal
enumerator LCtrl
enumerator LShift
enumerator LAlt

alt, option

enumerator LGui

windows, command (apple), meta

enumerator RCtrl
enumerator RShift
enumerator RAlt

alt gr, option

enumerator RGui

windows, command (apple), meta

enumerator Mode

I’m not sure if this is really not covered by any of the above, but since there’s a special SDL_KMOD_MODE for it I’m adding it here

enumerator Sleep

Sleep

enumerator Wake

Wake

enumerator ChannelIncrement

Channel Increment

enumerator ChannelDecrement

Channel Decrement

enumerator MediaPlay

Play

enumerator MediaPause

Pause

enumerator MediaRecord

Record

enumerator MediaFastForward

Fast Forward

enumerator MediaRewind

Rewind

enumerator MediaNextTrack

Next Track

enumerator MediaPreviousTrack

Previous Track

enumerator MediaStop

Stop

enumerator MediaEject

Eject

enumerator MediaPlayPause

Play / Pause

enumerator MediaSelect
enumerator AcNew

AC New

enumerator AcOpen

AC Open

enumerator AcClose

AC Close

enumerator AcExit

AC Exit

enumerator AcSave

AC Save

enumerator AcPrint

AC Print

enumerator AcProperties

AC Properties

enumerator AcSearch

AC Search

enumerator AcHome

AC Home

enumerator AcBack

AC Back

enumerator AcForward

AC Forward

enumerator AcStop

AC Stop

enumerator AcRefresh

AC Refresh

enumerator AcBookmarks

AC Bookmarks

enumerator SoftLeft

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display.

enumerator SoftRight

Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display.

enumerator Call

Used for accepting phone calls.

enumerator EndCall

Used for rejecting phone calls.

enumerator Reserved

400-500 reserved for dynamic keycodes

enumerator Count

not a key, just marks the number of scancodes for array bounds

namespace Mouse

Enums

Values:

enumerator Invalid
enumerator ButtonLeft

Left mouse button.

enumerator ButtonMiddle

Middle mouse button.

enumerator ButtonRight

Right mouse button.

enumerator ButtonX1

Extra mouse button 1.

enumerator ButtonX2

Extra mouse button 2.