VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
vex Namespace Reference

Namespaces

namespace  PS1Effects
 PS1Effects namespace for easier setting of them in push constant.

Classes

struct  asset_path
 Base wrapper for generic assets. Currently doesnt add any functionality. Its used mainly for custom functionality in editor. More...
struct  mesh_asset_path
 Specific wrapper for Meshes. More...
struct  texture_asset_path
 Specific wrapper for Textures. More...
struct  audio_asset_path
 Specific wrapper for Audio. More...
class  AudioSystem
 System responsible for managing audio playback, mixing, and spatialization. More...
struct  rgb
 Represents an RGB color value. Used mainly for fancy rendering in editor. More...
struct  rgba
 Represents an RGBA color value. Used mainly for fancy rendering in editor. More...
class  DebugConsole
class  ComponentStorage
 Template-based storage container for components of a specific type. More...
class  ComponentType
 Manages unique type IDs for component types in the ECS system. More...
class  Registry
 Central registry for managing entities and their components in the ECS system. More...
class  IComponentStorage
 Abstract base class for component storage implementations. More...
class  View
 Provides iteration over entities that have all specified component types. More...
struct  environment
 This struct is used to hold all environment settings. eg. shading details or lighting setup. More...
struct  AudioClip
struct  AudioSourceComponent
struct  TransformComponent
 Struct containing transform data and methods. More...
struct  MeshComponent
 Struct containing raw meshData, mesh id, texture paths and material properties. It just template and data for rendering backend to load/convert this data to its acceptible format. This is made weirdly cause its made in mind for multiple backends. IDK i hate this system but i have no better idea. More...
struct  LightComponent
 Struct containing light properties. More...
struct  FogComponent
 Struct containing fog properties. More...
struct  NameComponent
 Struct that simply contains name of the entity. It is used to identify entity and needs to be unique. More...
struct  CameraComponent
 Struct that contains camera properties. Used by build in CameraObject, but needed for any custom one for engine to recognise object as valid CameraObject. More...
struct  BillboardComponent
 A component for rendering a 2D quad that always faces the camera. More...
struct  CharacterComponent
 Character component for player or NPC characters. More...
class  ComponentRegistry
 Class registering GameComponents mainly used to load them in SceneManager. More...
struct  EditorBillboardComponent
 A component for rendering a 2D quad that always faces the camera. More...
struct  PersistentTag
 Tag for entities that should persist across scene changes. Like editor camera. More...
struct  InputBinding
 Struct representing an input binding. SDL_Scancode, state and std::function containing the action to be performed. More...
struct  MouseAxisBinding
 Struct representing an axis binding. Axis and std::function containing the action to be performed. More...
struct  GamepadButtonBinding
 Struct for Gamepad Button bindings. More...
struct  GamepadAxisBinding
 Struct for Gamepad Axis bindings (Joysticks/Triggers). More...
struct  InputComponent
 Component you add to your GameObject to handle input, eg. add input bindings and mouse axis bindings. More...
struct  ParticleGPUData
 Structure passed to the GPU containing per-particle rendering data. More...
struct  Particle
 CPU-side representation of a single particle during its lifetime. More...
struct  ParticleEmitterComponent
 Component that emits and manages a system of particles. More...
struct  UiComponent
 Struct containing VexUI class. More...
struct  LifetimeComponent
 Destroys the entity after a set amount of time. Useful for temporary effects. More...
struct  OscillatorComponent
 Moves an entity back and forth using a sine wave without physics overhead. More...
struct  TweenComponent
 Smoothly interpolates an entity's local position over time. More...
struct  GameInfo
 this struct contains information about the game. like project name and version. More...
class  CameraObject
 Basic camera object class. it only contains transform and camera components. More...
class  FogObject
 premade FogObject class. More...
class  GameObject
 Its base class for all game objects, eg. Player, Enemy, Weapon. Your Class needs to inherit from it. More...
class  GameObjectFactory
 Class responsible for registering and then creating GameObjects eg. Player, CameraObject. It is needed to load GameObjects from scene files but not all GameObjects can be registered. It requires your GameObject to not change constructor parameters. More...
class  LightObject
 premade LightObject class. More...
class  ModelObject
 ModelObject class represents a model object in the engine. Thanks to engine separation from the backend, its constructor takes more parameters than its allowed by GameObjectFactory, thus it can only be created by Model Creators methods. More...
struct  VulkanFeatures
 Holds the status of various Vulkan features. More...
class  HardwareInfo
 Utility class for retrieving and storing hardware and driver information. More...
class  ImGUIWrapper
 This class provides an interface template for ImGui Implementation. Every backend should implement this class. More...
class  InputSystem
 Input system class responsible for handling input events and updating input components. More...
struct  Vertex
 Vertex structure for mesh data. More...
struct  Submesh
 Submesh structure for mesh data, its made like this cause some file formats hold multiple meshes in one file, but engine supports only one mesh per file. More...
struct  MeshData
 Mesh data structure for loading and managing mesh data. More...
struct  BodyIDHasher
 Hasher for JPH::BodyID. More...
class  BPLayerInterfaceImpl
 Implementation of JPH::BroadPhaseLayerInterface for the default layer. More...
class  ObjectVsBroadPhaseLayerFilterImpl
 Implementation of JPH::ObjectVsBroadPhaseLayerFilter for the default layer. More...
class  ObjectLayerPairFilterImpl
 Implementation of JPH::ObjectLayerPairFilter for the default layer. More...
class  MyActivationListener
 Implementation of JPH::BodyActivationListener for the default layer. More...
struct  CollisionHit
 Structure representing a collision hit. More...
struct  RaycastHit
 Structure representing a raycast hit. More...
struct  PhysicsComponent
 Structure representing a physics component. More...
class  PhysicsSystem
 Class representing a physics system. More...
class  MyContactListener
class  DebugDrawFilter
 Implementation of JPH::BodyDrawFilter for debugging physics bodies. More...
class  ResolutionManager
 Class responsible for managing resolution settings, calculating render resolution based on selected mode. More...
class  Scene
 Scene class implements scene functionality like loading and holding game objects. More...
class  SceneManager
 SceneManager class implements scene management functionality like loading and unloading scenes, holding game objects. More...
class  ThreadPool
struct  FlexValue
 Lightweight struct to hold parsed sizes safely away from VexUI dependencies. More...
struct  LayoutNode
 Layout node representing a single UI element in the layout tree. More...
struct  UIVertex
 Represents a vertex for a UI element. More...
struct  UIPushConstants
 Push constants for UI rendering. More...
struct  UIUnitValue
 Struct storing unit value logic natively. More...
struct  UIUnitVec2
 2D representation of UIUnitValue to replace glm::vec2 size safely. More...
struct  FontAtlas
 Font atlas structure. More...
struct  UIStyle
 Basic UI styling component. More...
struct  UIQuad
 Quad component needed for rendering. More...
struct  Widget
 Struct defining widget component, it has a lot of redundancy and probably will need cleanup before expanding on a feature. More...
class  VexUI
 Class defining VexUI, it initializes the UI system, loads, renders, converts ui data, essentially managing ui from file to reneering. More...
class  VirtualFileSystem
 This class provides abstraction of file system needed for loading packed and unpacked assets. More...
struct  SkipInit
class  Engine
 Class for interaction with engine systems. More...
struct  VulkanContext
 Struct holding all vulkan data, like device, surface, swapchain, images, views, and more. More...
struct  Plane
 Represents a plane in 3D space. More...
struct  Frustum
 Represents a frustum in 3D space. More...
class  Interface
 Interface Class for vulkan backend. More...
class  MeshManager
struct  DebugVertex
 Represents a vertex used for debugging purposes. More...
class  VulkanPipeline
 A class managing creating vulkan pipelines. Both form meshes and UI elements. More...
struct  FrustumSoA
struct  RenderItem
 Struct to hold information about a render item. More...
struct  BillboardItem
 Struct to hold information about a billboard render item. More...
struct  EditorBillboardItem
struct  BillboardPushData
 Struct to hold push data for billboard rendering. More...
struct  SceneRenderData
 Data structure to pass state between render stages. More...
class  Renderer
 Class responsible for rendering the scene using Vulkan backend. More...
struct  BatchedTextureData
 Helper struct for batching texture loading. More...
class  VulkanResources
 This class manages resources like textures, descriptor sets, and uniform buffers. More...
class  VulkanSwapchainManager
 Manages Vulkan swapchain resources. More...
struct  SceneUBO
 Scene uniform buffer object. Holds data that is bind once per scene. More...
struct  Light
 Light struct for shader. More...
struct  SceneLightsUBO
 Scene lights uniform buffer object. More...
struct  PushConstants
 Push constants, holds model information. More...
class  VulkanImGUIWrapper
 Class with Imgui for vulkan backend definition, inheriting from ImGUIWrapper. More...
class  VulkanMesh
 Class defining mesh object with vulkan specific data and methods. More...
struct  TransparentTriangle
 struct used to held transparent triangles data for sorting and special rendering More...
struct  LogEntry
class  VPKAssimpStream
class  VPKAssimpIOSystem
class  IgnoreSensorFilter
class  Window
 This class esentially abstracts SDL_Window. More...
class  BasicCamera
class  DialogWindow
 A specialized Engine class for creating and managing modal dialog windows. More...
class  Editor
 The main Editor class, inheriting from Engine and providing editor-specific functionality and UI. More...
struct  ICommand
 Base Command Interface. More...
class  TransformCommand
 Gizmo Movement Command. More...
struct  SerializedObject
 Serialized object data for recreation on undo. More...
class  DeleteCommand
 Saves Delete action command. More...
 Metadata structure for a recently used project. More...
class  ProjectSelector
 Specialized Engine class for the initial project selection screen. More...
struct  BrowserIcons
 Structure holding texture IDs for various asset types displayed in the browser. More...
class  AssetBrowser
 Class responsible for displaying and navigating project assets within an ImGUI window. More...

Typedefs

using Entity = uint32_t
 Type alias representing a unique entity identifier in the ECS system.
typedef void(* LogCallbackFn) (LogLevel level, const char *message)
 Defines the callback signature.
template<class Key, class T, class Compare = std::less<Key>>
using vex_map = std::map<Key, T, Compare>

Enumerations

enum class  LogLevel { INFO , WARNING , ERROR , CRITICAL }
 Enum class for log levels. More...
enum class  AudioState { STOPPED , PLAYING , PAUSED }
enum class  RenderType { OPAQUE , TRANSPARENT , MASKED , CUSTOM }
 Enum class for different types of rendering. It internally switches used pipeline. More...
enum class  InputActionState { Pressed , Released , Held }
 Enum representing the state of an input action. More...
enum class  MouseAxis { X , Y }
 Enum representing the axis of a mouse. More...
enum class  InputMode { Game , UI , GameAndUI }
 Enum representing different input modes. More...
enum class  ShapeType {
  BOX , ROUNDED_BOX , SPHERE , CAPSULE ,
  CYLINDER , CONVEX_HULL , MESH
}
 Enumeration of available shape types for physics components. More...
enum class  BodyType { STATIC , DYNAMIC , KINEMATIC , SENSOR }
 Enumeration of available body types for physics components. More...
enum class  ResolutionMode { NATIVE , RES_240P , RES_480P , PS1_SHARP }
 Enumeration representing different resolution modes. More...
enum class  FlexDirection { Row , Column }
enum class  PositionType { Relative , Absolute }
enum class  Justify { FlexStart , Center , FlexEnd , SpaceBetween }
enum class  Align {
  Auto , FlexStart , Center , FlexEnd ,
  Stretch , Baseline
}
enum class  FlexWrap { NoWrap , Wrap , WrapReverse }
enum class  UIUnitType {
  Auto , Px , Psp , Vw ,
  Vh , Percent
}
 Supported responsive UI unit types. More...
enum class  TextAlign { Left , Center , Right }
 Allows for text aligment. More...
enum class  WidgetType { Container , Label , Image , Button }
 Enum specifying possible types of widgets. More...

Functions

void RegisterEngineCommands (Engine *engine)
void VEX_EXPORT AddLogCallback (LogCallbackFn callback)
 Adds a callback function to be called when a log message is generated.
void VEX_EXPORT InitCrashHandler ()
 Initializes the low-level crash handler.
void VEX_EXPORT throw_error (const std::string &msg)
 Throws an error or terminates the application.
void VEX_EXPORT log (const char *fmt,...)
 Logs a formatted message.
void VEX_EXPORT log (LogLevel level, const char *fmt,...)
 Logs a formatted message with a specific severity level.
void VEX_EXPORT handle_exception (const std::exception &e)
 Handles an exception based on build configuration.
void VEX_EXPORT handle_critical_exception (const std::exception &e)
 Handles a critical exception, forcing termination.
template<typename T>
void GenericComponentInspector (GameObject &obj)
ModelObjectcreateModelFromComponents (const std::string &name, MeshComponent meshComponent, TransformComponent transformComponent, Engine &engine, vex::Entity parent=vex::NULL_ENTITY)
 Creates model object From mesh and tranform components.
MeshComponent createMeshFromPath (const std::string &path, Engine &engine)
 Just creates meshcomponent from file. Copies meshData and texture paths for later backend specific processing.
ModelObjectcreateModelFromPath (const std::string &path, const std::string &name, Engine &engine, vex::Entity parent=vex::NULL_ENTITY)
 Creates model object from file. Esentially just runs two other functions just with empty transform component.
void VEX_EXPORT SetAssetRoot (const std::string &projectPath)
 Overrides the default asset root directory.
void VEX_EXPORT SetUserDataDir (const std::string &userDataDir)
 Sets the current user data directory.
std::string VEX_EXPORT GetAssetDir ()
 Gets the current asset directory override.
std::string VEX_EXPORT GetUserDataDir ()
 Gets the current user data directory.
std::string VEX_EXPORT GetAssetPath (const std::string &relativePath)
 Resolves the absolute path of an asset based on the current build configuration.
std::string VEX_EXPORT GetUserDataPath (const std::string &relativePath)
 Resolves the absolute path of a user data file based on the current user data directory.
std::filesystem::path VEX_EXPORT GetExecutableDir ()
 Retrieves the directory containing the current executable.
std::filesystem::path VEX_EXPORT GetLogDir ()
 Gets the directory where logs and crash dumps are stored.
ThreadPoolGetThreadPool ()
void calculateLayout (LayoutNode *node, float parentWidth, float parentHeight, bool isRoot=false, const VexUI *ui=nullptr, float forcedW=NAN, float forcedH=NAN)
 Calculate the layout of a node tree using flex layout algorithm.
glm::vec3 extractCameraPosition (const glm::mat4 &view)
bool validateVectorBounds (uint32_t index, size_t size, const char *name)
 Validates that an index is within bounds of a vector.
bool validateVectorBounds (size_t index, size_t size, const char *name)
 Validates that an index is within bounds of a vector.
bool validateFrameIndex (uint32_t frameIndex, uint32_t maxFrames)
 Validates that a frame index is valid.
bool validateImageIndex (uint32_t imageIndex, size_t imageCount)
 Validates that an image index is valid.
template<typename T>
safeVectorAccess (const std::vector< T > &vec, size_t index, const char *name, T defaultValue)
 Safely accesses a vector element with bounds checking.
template<typename T>
T * safeVectorAccessPtr (std::vector< T > &vec, size_t index, const char *name)
 Safely accesses a vector element with bounds checking (mutable version).
template<typename T>
bool validateVectorSize (const std::vector< T > &vec, size_t expectedSize, const char *name)
 Validates that a vector is properly sized.
template<typename T>
bool validateVectorMinSize (const std::vector< T > &vec, size_t minSize, const char *name)
 Validates that a vector has minimum required size.
bool validateFrameVectorConsistency (size_t size1, const char *name1, size_t size2, const char *name2, size_t size3, const char *name3)
 Validates that multiple frame-dependent vectors have consistent sizes.
template<typename T>
bool validateNonNullHandles (const std::vector< T > &vec, const char *name)
 Validates that all pointers in a vector are non-null.
void assertSyncObjectConsistency (size_t imageAvailSize, size_t renderFinishedSize, size_t fencesSize, size_t poolsSize, size_t buffersSize, uint32_t expectedSize)
 Asserts that all frame-dependent sync object vectors are properly sized.
void posixSignalHandler (int sig, siginfo_t *info, void *context)
void fastSyncTransform (const glm::vec3 &pos, const glm::quat &rot, JPH::BodyInterface &bi, const JPH::BodyID &id)
JPH::Quat glmToJph (const glm::quat &q)
void to_json (nlohmann::json &j, const TransformComponent &t)
void from_json (const nlohmann::json &j, TransformComponent &t)
void to_json (nlohmann::json &j, const MeshComponent &m)
void from_json (const nlohmann::json &j, MeshComponent &m)
 REGISTER_GAME_OBJECT (CameraObject)
 REGISTER_GAME_OBJECT (GameObject)
 REGISTER_GAME_OBJECT (LightObject)
 REGISTER_GAME_OBJECT (FogObject)
 REGISTER_GAME_OBJECT (ModelObject)
 __attribute__ ((target("avx2"))) static void rotateQuadAvX2(float *outVerts
 _mm256_storeu_ps (outVerts, vResult)
void ProcessParticles (vex::Registry &registry, float deltaTime)
 Processes CPU-side particle simulation and prepares GPU data.
void ProcessUtilityComponents (vex::Registry &registry, float deltaTime, Engine &engine)
 REGISTER_GAME_OBJECT (BasicCamera)
void DrawWorldSettings (Engine &engine)
 Draws the world settings menu, allowing modification of environment parameters like shading, lighting, and retro effects.

Variables

constexpr Entity NULL_ENTITY = static_cast<Entity>(-1)
 Special entity value indicating an invalid or null entity.
float pivotX
float float pivotY
float float float sinA
float float float float cosA
float float float float float x0
float float float float float float y0
float float float float float float float x1
float float float float float float float float y1
__m256 vPivot = _mm256_setr_ps(pivotX, pivotY, pivotX, pivotY, pivotX, pivotY, pivotX, pivotY)
__m256 vDelta = _mm256_sub_ps(vPos, vPivot)
__m256 vCos = _mm256_set1_ps(cosA)
__m256 vSin = _mm256_set1_ps(sinA)
__m256 vDeltaSwapped = _mm256_permute_ps(vDelta, 0xB1)
__m256 t1 = _mm256_mul_ps(vDelta, vCos)
__m256 t2 = _mm256_mul_ps(vDeltaSwapped, vSin)
__m256 vResult = _mm256_addsub_ps(t1, t2)

Detailed Description

Todo
Add chunking and multithreading support for compression.

Typedef Documentation

◆ Entity

using vex::Entity = uint32_t

Type alias representing a unique entity identifier in the ECS system.

Entities are lightweight handles (32-bit unsigned integers) that identify distinct objects in the entity-component-system. Each entity can have multiple components attached to it.

Examples
/home/devu/Documents/Projects/VEX/Engine/Core/include/components/ECS/ECS.hpp.

Definition at line 11 of file Types.hpp.

◆ LogCallbackFn

typedef void(* vex::LogCallbackFn) (LogLevel level, const char *message)

Defines the callback signature.

Definition at line 35 of file ErrorUtils.hpp.

◆ vex_map

template<class Key, class T, class Compare = std::less<Key>>
using vex::vex_map = std::map<Key, T, Compare>

Definition at line 14 of file Types.hpp.

Enumeration Type Documentation

◆ Align

enum class vex::Align
strong

Definition at line 14 of file Layout.hpp.

◆ AudioState

enum class vex::AudioState
strong

Definition at line 37 of file AudioSourceComponent.hpp.

◆ BodyType

enum class vex::BodyType
strong

Enumeration of available body types for physics components.

Definition at line 80 of file PhysicsSystem.hpp.

◆ FlexDirection

enum class vex::FlexDirection
strong

Definition at line 11 of file Layout.hpp.

◆ FlexWrap

enum class vex::FlexWrap
strong

Definition at line 15 of file Layout.hpp.

◆ InputActionState

enum class vex::InputActionState
strong

Enum representing the state of an input action.

Definition at line 18 of file InputComponent.hpp.

◆ InputMode

enum class vex::InputMode
strong

Enum representing different input modes.

Game - Mouse captured, hidden, for gameplay (e.g., camera control)

UI - Mouse visible, for UI interaction

GameAndUI - Mouse visible, both gameplay and UI inputs processed

Definition at line 23 of file InputSystem.hpp.

◆ Justify

enum class vex::Justify
strong

Definition at line 13 of file Layout.hpp.

◆ LogLevel

enum class vex::LogLevel
strong

Enum class for log levels.

Definition at line 27 of file ErrorUtils.hpp.

◆ MouseAxis

enum class vex::MouseAxis
strong

Enum representing the axis of a mouse.

Definition at line 25 of file InputComponent.hpp.

◆ PositionType

enum class vex::PositionType
strong

Definition at line 12 of file Layout.hpp.

◆ RenderType

enum class vex::RenderType
strong

Enum class for different types of rendering. It internally switches used pipeline.

Definition at line 410 of file BasicComponents.hpp.

◆ ResolutionMode

enum class vex::ResolutionMode
strong

Enumeration representing different resolution modes.

Enumerator
NATIVE 

Use window resolution.

RES_240P 

240p (426x240 for 16:9).

RES_480P 

480p (854x480 for 16:9).

PS1_SHARP 

Integer-scaled resolution closest to PS1.

Definition at line 34 of file ResolutionManager.hpp.

◆ ShapeType

enum class vex::ShapeType
strong

Enumeration of available shape types for physics components.

Definition at line 75 of file PhysicsSystem.hpp.

◆ TextAlign

enum class vex::TextAlign
strong

Allows for text aligment.

Definition at line 101 of file VexUI.hpp.

◆ UIUnitType

enum class vex::UIUnitType
strong

Supported responsive UI unit types.

Definition at line 38 of file VexUI.hpp.

◆ WidgetType

enum class vex::WidgetType
strong

Enum specifying possible types of widgets.

Definition at line 110 of file VexUI.hpp.

Function Documentation

◆ AddLogCallback()

void vex::AddLogCallback ( LogCallbackFn callback)

Adds a callback function to be called when a log message is generated.

Parameters
callbackThe callback function to be added.

Definition at line 57 of file ErrorUtils.cpp.

◆ assertSyncObjectConsistency()

void vex::assertSyncObjectConsistency ( size_t imageAvailSize,
size_t renderFinishedSize,
size_t fencesSize,
size_t poolsSize,
size_t buffersSize,
uint32_t expectedSize )
inline

Asserts that all frame-dependent sync object vectors are properly sized.

Call this after swapchain creation to ensure consistency.

Parameters
imageAvailSize- Size of imageAvailableSemaphores.
renderFinishedSize- Size of renderFinishedSemaphores.
fencesSize- Size of inFlightFences.
poolsSize- Size of commandPools.
buffersSize- Size of commandBuffers.
expectedSize- Expected size (MAX_FRAMES_IN_FLIGHT).

Definition at line 194 of file VulkanBoundsChecking.hpp.

◆ calculateLayout()

void vex::calculateLayout ( LayoutNode * node,
float parentWidth,
float parentHeight,
bool isRoot = false,
const VexUI * ui = nullptr,
float forcedW = NAN,
float forcedH = NAN )

Calculate the layout of a node tree using flex layout algorithm.

Parameters
nodeThe root node to calculate layout for.
parentWidthThe available parent width in pixels.
parentHeightThe available parent height in pixels.
isRootWhether this is the root node (defaults to false).
uiPointer to VexUI instance for rendering context (defaults to nullptr).
forcedWForced width constraint in pixels (defaults to NAN for no constraint).
forcedHForced height constraint in pixels (defaults to NAN for no constraint).

Definition at line 16 of file VexUI.cpp.

◆ createMeshFromPath()

MeshComponent vex::createMeshFromPath ( const std::string & path,
Engine & engine )

Just creates meshcomponent from file. Copies meshData and texture paths for later backend specific processing.

Parameters
conststd::string& path Path to the mesh file.
Engine&engine Reference to the engine.
Returns
MeshComponent created from the file.

Definition at line 13 of file ModelCreator.cpp.

◆ createModelFromComponents()

ModelObject * vex::createModelFromComponents ( const std::string & name,
MeshComponent meshComponent,
TransformComponent transformComponent,
Engine & engine,
vex::Entity parent = vex::NULL_ENTITY )

Creates model object From mesh and tranform components.

Important: MeshComponent can be created normally by just creating meshComponent object and setting meshData.path, but using this function ensures mesh is loaded from file when called and not when rendered, ensuring no stutters at runtime.

Parameters
conststd::string& name Name of the model object.
MeshComponentmeshComponent Mesh component of the model object.
TransformComponenttransformComponent Transform component of the model object.
Engine&engine Reference to the engine.
vex::Entityparent Parent entity of the model object.
Returns
Pointer to the created model object.

Definition at line 10 of file ModelCreator.cpp.

◆ createModelFromPath()

ModelObject * vex::createModelFromPath ( const std::string & path,
const std::string & name,
Engine & engine,
vex::Entity parent = vex::NULL_ENTITY )

Creates model object from file. Esentially just runs two other functions just with empty transform component.

Parameters
conststd::string& path Path to the mesh file.
conststd::string& name Name of the model object.
Engine&engine Reference to the engine.
vex::Entityparent Parent entity of the model object.
Returns
Pointer to the created model object.

Definition at line 16 of file ModelCreator.cpp.

◆ DrawWorldSettings()

void vex::DrawWorldSettings ( Engine & engine)
inline

Draws the world settings menu, allowing modification of environment parameters like shading, lighting, and retro effects.

Parameters
Engine&engine - Reference to the core Engine instance to get and set environment settings.

Definition at line 18 of file WorldSettingsMenu.hpp.

◆ extractCameraPosition()

glm::vec3 vex::extractCameraPosition ( const glm::mat4 & view)

Definition at line 51 of file Renderer.cpp.

◆ fastSyncTransform()

void vex::fastSyncTransform ( const glm::vec3 & pos,
const glm::quat & rot,
JPH::BodyInterface & bi,
const JPH::BodyID & id )
inline

Definition at line 26 of file PhysicsSystem.cpp.

◆ from_json() [1/2]

void vex::from_json ( const nlohmann::json & j,
MeshComponent & m )

Definition at line 50 of file SceneManager.cpp.

◆ from_json() [2/2]

void vex::from_json ( const nlohmann::json & j,
TransformComponent & t )

Definition at line 36 of file SceneManager.cpp.

◆ GenericComponentInspector()

template<typename T>
void vex::GenericComponentInspector ( GameObject & obj)

Definition at line 261 of file ComponentFactory.hpp.

◆ GetAssetDir()

std::string vex::GetAssetDir ( )

Gets the current asset directory override.

Returns
std::string - The path set by SetAssetRoot, or an empty string if not set.

Definition at line 29 of file PathUtils.cpp.

◆ GetAssetPath()

std::string vex::GetAssetPath ( const std::string & relativePath)

Resolves the absolute path of an asset based on the current build configuration.

  • If an override is set (via SetAssetRoot), resolves relative to that path.
  • Debug Builds: Resolves relative to the executable directory to allow loose file loading.
  • Release Builds: Returns the relativePath as-is, assuming the VirtualFileSystem (VFS) will handle lookup within packed VPKs.
    Parameters
    conststd::string& relativePath - The path relative to the asset root (e.g., "Assets/Textures/img.png").
    Returns
    std::string - The resolved absolute path or the relative path depending on configuration.

Definition at line 73 of file PathUtils.cpp.

◆ GetExecutableDir()

std::filesystem::path vex::GetExecutableDir ( )

Retrieves the directory containing the current executable.

Uses platform-specific API calls:

  • Windows: GetModuleFileNameW.
  • macOS: _NSGetExecutablePath (MacOS is not officially supported).
  • Linux: Reading symlink /proc/self/exe.
    Returns
    std::filesystem::path - The path to the directory containing the executable.

Definition at line 37 of file PathUtils.cpp.

◆ GetLogDir()

std::filesystem::path vex::GetLogDir ( )

Gets the directory where logs and crash dumps are stored.

Attempts to create and return GetExecutableDir() / "Engine" / "logs". If creation fails, falls back to std::filesystem::current_path().

Returns
std::filesystem::path - The resolved log directory.

Definition at line 95 of file PathUtils.cpp.

◆ GetThreadPool()

ThreadPool & vex::GetThreadPool ( )
inline

Definition at line 60 of file ThreadPool.hpp.

◆ GetUserDataDir()

std::string vex::GetUserDataDir ( )

Gets the current user data directory.

Returns
std::string - The path to the user data directory.

Definition at line 33 of file PathUtils.cpp.

◆ GetUserDataPath()

std::string vex::GetUserDataPath ( const std::string & relativePath)

Resolves the absolute path of a user data file based on the current user data directory.

Parameters
conststd::string& relativePath - The path relative to the user data directory (e.g., "savegame/save1.sav").
Returns
std::string - The resolved absolute path. (eg. APPDATA%/<GameName>/savegame/save1.sav)

Definition at line 91 of file PathUtils.cpp.

◆ glmToJph()

JPH::Quat vex::glmToJph ( const glm::quat & q)

Definition at line 136 of file PhysicsSystem.cpp.

◆ handle_critical_exception()

void vex::handle_critical_exception ( const std::exception & e)

Handles a critical exception, forcing termination.

  • Debug: Prints stack trace and rethrows.
  • Release: Writes a full crash report, closes logs, calls SDL_LogCritical, and terminates via _exit(1).
    Parameters
    conststd::exception& e - The exception to handle.
    try {
    something();
    } catch (const std::exception& e) {
    }
    void VEX_EXPORT handle_critical_exception(const std::exception &e)
    Handles a critical exception, forcing termination.

Definition at line 525 of file ErrorUtils.cpp.

◆ handle_exception()

void vex::handle_exception ( const std::exception & e)

Handles an exception based on build configuration.

  • Debug: Prints a stack trace using cpptrace.
  • Release: Pushes the error to the ring buffer and logs via SDL_LogCritical. Does not crash the application.
    Parameters
    conststd::exception& e - The exception to handle.
    try {
    something();
    } catch (const std::exception& e) {
    }
    void VEX_EXPORT handle_exception(const std::exception &e)
    Handles an exception based on build configuration.

Definition at line 519 of file ErrorUtils.cpp.

◆ InitCrashHandler()

void vex::InitCrashHandler ( )

Initializes the low-level crash handler.

  1. Opens a persistent log file game_session.log.
  2. Windows: Sets SetUnhandledExceptionFilter.
  3. Linux/Posix: Sets signal handlers for SIGSEGV, SIGABRT, SIGILL, SIGFPE. The handler is capable of dumping CPU registers (RAX, RBX, etc.) and memory maps to the log file upon crash.

Definition at line 386 of file ErrorUtils.cpp.

◆ log() [1/2]

void vex::log ( const char * fmt,
... )

Logs a formatted message.

Internally calls log_internal, which:

  1. Formats the string.
  2. Pushes entry to a thread-safe ring buffer (g_RingBuffer).
  3. Writes to the persistent crash log file (if open).
  4. Prints to SDL_LogMessage (unless filtered by log level).
    Parameters
    constchar* fmt - Printf-style format string.
    log("value a is %d", a);
    void VEX_EXPORT log(const char *fmt,...)
    Logs a formatted message.

Definition at line 511 of file ErrorUtils.cpp.

◆ log() [2/2]

void vex::log ( LogLevel level,
const char * fmt,
... )

Logs a formatted message with a specific severity level.

Parameters
LogLevellevel - Severity (INFO, WARNING, ERROR, CRITICAL).
constchar* fmt - Printf-style format string.
log(LogLevel::ERROR, "value a is %d", a);

Definition at line 515 of file ErrorUtils.cpp.

◆ posixSignalHandler()

void vex::posixSignalHandler ( int sig,
siginfo_t * info,
void * context )

Definition at line 359 of file ErrorUtils.cpp.

◆ ProcessParticles()

void vex::ProcessParticles ( vex::Registry & registry,
float deltaTime )

Processes CPU-side particle simulation and prepares GPU data.

Spawns new particles based on spawn rate, updates their physics (gravity, velocity), scales and colors over their lifetime, and removes dead particles. Maps the remaining active particles to a structure suitable for the GPU (ParticleGPUData).

Parameters
vex::Registry&registry - The ECS registry to fetch emitters and transforms.
floatdeltaTime - Time elapsed since the last frame.

Definition at line 13 of file UtilitySystem.hpp.

◆ ProcessUtilityComponents()

void vex::ProcessUtilityComponents ( vex::Registry & registry,
float deltaTime,
Engine & engine )

Definition at line 76 of file UtilitySystem.hpp.

◆ RegisterEngineCommands()

void vex::RegisterEngineCommands ( Engine * engine)

Definition at line 23 of file EngineCommands.cpp.

◆ safeVectorAccess()

template<typename T>
T vex::safeVectorAccess ( const std::vector< T > & vec,
size_t index,
const char * name,
T defaultValue )
inline

Safely accesses a vector element with bounds checking.

Template Parameters
T- The element type.
Parameters
vec- The vector to access.
index- The index to access.
name- Name of the vector for error logging.
defaultValue- Value to return on bounds error.
Returns
The element at vec[index] or defaultValue if out of bounds.

Definition at line 82 of file VulkanBoundsChecking.hpp.

◆ safeVectorAccessPtr()

template<typename T>
T * vex::safeVectorAccessPtr ( std::vector< T > & vec,
size_t index,
const char * name )
inline

Safely accesses a vector element with bounds checking (mutable version).

Template Parameters
T- The element type.
Parameters
vec- The vector to access.
index- The index to access.
name- Name of the vector for error logging.
Returns
Pointer to element or nullptr if out of bounds.

Definition at line 99 of file VulkanBoundsChecking.hpp.

◆ SetAssetRoot()

void vex::SetAssetRoot ( const std::string & projectPath)

Overrides the default asset root directory.

Sets the global g_AssetRootOverride variable. This is primarily used by the Editor to force the engine to look for assets in a specific project folder instead of the default executable location.

Parameters
conststd::string& projectPath - The absolute path to the project's root directory.

Definition at line 18 of file PathUtils.cpp.

◆ SetUserDataDir()

void vex::SetUserDataDir ( const std::string & userDataDir)

Sets the current user data directory.

Parameters
conststd::string& userDataDir - The absolute path to the user data directory.

Definition at line 22 of file PathUtils.cpp.

◆ throw_error()

void vex::throw_error ( const std::string & msg)

Throws an error or terminates the application.

  • Debug: Throws a cpptrace::runtime_error to show a stack trace.
  • Release: Writes a crash report to the log file via WriteCrashReport and immediately exits with _exit(1).
    Parameters
    conststd::string& msg - The error message.
    throw_error("An error occurred");
    void VEX_EXPORT throw_error(const std::string &msg)
    Throws an error or terminates the application.

Definition at line 498 of file ErrorUtils.cpp.

◆ to_json() [1/2]

void vex::to_json ( nlohmann::json & j,
const MeshComponent & m )

Definition at line 43 of file SceneManager.cpp.

◆ to_json() [2/2]

void vex::to_json ( nlohmann::json & j,
const TransformComponent & t )

Definition at line 28 of file SceneManager.cpp.

◆ validateFrameIndex()

bool vex::validateFrameIndex ( uint32_t frameIndex,
uint32_t maxFrames )
inline

Validates that a frame index is valid.

Parameters
frameIndex- The frame index to validate.
maxFrames- Maximum frames in flight.
Returns
true if frameIndex < maxFrames, false otherwise.

Definition at line 50 of file VulkanBoundsChecking.hpp.

◆ validateFrameVectorConsistency()

bool vex::validateFrameVectorConsistency ( size_t size1,
const char * name1,
size_t size2,
const char * name2,
size_t size3,
const char * name3 )
inline

Validates that multiple frame-dependent vectors have consistent sizes.

Useful for ensuring sync object arrays stay synchronized.

Returns
true if all sizes match, false otherwise.

Definition at line 144 of file VulkanBoundsChecking.hpp.

◆ validateImageIndex()

bool vex::validateImageIndex ( uint32_t imageIndex,
size_t imageCount )
inline

Validates that an image index is valid.

Parameters
imageIndex- The image index to validate.
imageCount- Total number of swapchain images.
Returns
true if imageIndex < imageCount, false otherwise.

Definition at line 64 of file VulkanBoundsChecking.hpp.

◆ validateNonNullHandles()

template<typename T>
bool vex::validateNonNullHandles ( const std::vector< T > & vec,
const char * name )
inline

Validates that all pointers in a vector are non-null.

Template Parameters
T- Pointer type.
Parameters
vec- The vector of pointers to validate.
name- Name of the vector for error logging.
Returns
true if all pointers are non-null, false otherwise.

Definition at line 174 of file VulkanBoundsChecking.hpp.

◆ validateVectorBounds() [1/2]

bool vex::validateVectorBounds ( size_t index,
size_t size,
const char * name )
inline

Validates that an index is within bounds of a vector.

Parameters
index- The index to validate (size_t version).
size- The size of the container.
name- Name of the container for error logging.
Returns
true if index < size, false otherwise.

Definition at line 36 of file VulkanBoundsChecking.hpp.

◆ validateVectorBounds() [2/2]

bool vex::validateVectorBounds ( uint32_t index,
size_t size,
const char * name )
inline

Validates that an index is within bounds of a vector.

Parameters
index- The index to validate.
size- The size of the container.
name- Name of the container for error logging.
Returns
true if index < size, false otherwise.

Definition at line 21 of file VulkanBoundsChecking.hpp.

◆ validateVectorMinSize()

template<typename T>
bool vex::validateVectorMinSize ( const std::vector< T > & vec,
size_t minSize,
const char * name )
inline

Validates that a vector has minimum required size.

Parameters
vec- The vector to validate.
minSize- The minimum required size.
name- Name of the vector for error logging.
Returns
true if vec.size() >= minSize, false otherwise.

Definition at line 131 of file VulkanBoundsChecking.hpp.

◆ validateVectorSize()

template<typename T>
bool vex::validateVectorSize ( const std::vector< T > & vec,
size_t expectedSize,
const char * name )
inline

Validates that a vector is properly sized.

Parameters
vec- The vector to validate.
expectedSize- The expected size.
name- Name of the vector for error logging.
Returns
true if vec.size() == expectedSize, false otherwise.

Definition at line 115 of file VulkanBoundsChecking.hpp.

Variable Documentation

◆ cosA

float float float float vex::cosA

Definition at line 270 of file VexUI.cpp.

◆ NULL_ENTITY

Entity vex::NULL_ENTITY = static_cast<Entity>(-1)
constexpr

Special entity value indicating an invalid or null entity.

Used as a sentinel value to represent the absence of a valid entity.

Definition at line 15 of file Types.hpp.

◆ pivotX

float vex::pivotX

Definition at line 270 of file VexUI.cpp.

◆ pivotY

float float vex::pivotY

Definition at line 270 of file VexUI.cpp.

◆ sinA

float float float vex::sinA

Definition at line 270 of file VexUI.cpp.

◆ t1

__m256 vex::t1 = _mm256_mul_ps(vDelta, vCos)

Definition at line 277 of file VexUI.cpp.

◆ t2

__m256 vex::t2 = _mm256_mul_ps(vDeltaSwapped, vSin)

Definition at line 278 of file VexUI.cpp.

◆ vCos

__m256 vex::vCos = _mm256_set1_ps(cosA)

Definition at line 274 of file VexUI.cpp.

◆ vDelta

__m256 vex::vDelta = _mm256_sub_ps(vPos, vPivot)

Definition at line 273 of file VexUI.cpp.

◆ vDeltaSwapped

__m256 vex::vDeltaSwapped = _mm256_permute_ps(vDelta, 0xB1)

Definition at line 276 of file VexUI.cpp.

◆ vPivot

__m256 vex::vPivot = _mm256_setr_ps(pivotX, pivotY, pivotX, pivotY, pivotX, pivotY, pivotX, pivotY)

Definition at line 272 of file VexUI.cpp.

◆ vResult

vex::vResult = _mm256_addsub_ps(t1, t2)

Definition at line 279 of file VexUI.cpp.

◆ vSin

__m256 vex::vSin = _mm256_set1_ps(sinA)

Definition at line 275 of file VexUI.cpp.

◆ x0

float float float float float vex::x0

Definition at line 270 of file VexUI.cpp.

◆ x1

float float float float float float float vex::x1

Definition at line 270 of file VexUI.cpp.

◆ y0

float float float float float float vex::y0

Definition at line 270 of file VexUI.cpp.

◆ y1

float float float float float float float float vex::y1
Initial value:
{
__m256 vPos = _mm256_setr_ps(x0, y0, x1, y0, x0, y1, x1, y1)

Definition at line 270 of file VexUI.cpp.