Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
bgfx.cpp File Reference
#include "../rendering.h"
#include <bgfx/bgfx.h>
#include <bx/math.h>
#include <bx/timer.h>
#include <Strings/components/utils/io/io.h>
#include <Strings/components/classes/events/game_engine_events/NewFrame/NewFrameEvent.h>
#include "components/diagnostics/profiler/stats.h"
#include "components/3rdparty/imgui/formats/bgfx/imgui.h"
#include "components/resources/engine_globals/globals.h"
#include "components/ui/imgui/imgui.h"
#include "components/diagnostics/logger/logger.h"
#include "components/core/tick/tick.h"
#include "components/settings/config/config.h"
#include "components/core/director/director.h"
#include "components/ui/blam/ui.h"
#include "components/rendering/bgfx/passes/passes.h"
#include "components/content/tags/scenario.h"
#include "components/core/input/keyboard.h"
#include "api/v1/types/tags/classes/camera.h"
#include "version_data.h"
#include "BlamBgfxCallbacks.h"
#include "core.h"
+ Include dependency graph for bgfx.cpp:

Classes

struct  mouse_info
 
struct  screen_vertex
 

Functions

bool UsingBgfx ()
 
BlamVector3 CalculateLookAtTarget (BlamVector3 camera_position, BlamVector3 camera_rotation)
 Calculates a look-at target position from a camera position and Euler rotation. More...
 

Variables

bool __using_bgfx = false
 
mouse_info mouse = mouse_info()
 
uint32_t reset_flags = BGFX_RESET_VSYNC
 
BlamBgfxCallbacks callbacks_struct = BlamBgfxCallbacks()
 
BlamVector2 viewport_size = { 640, 480 }
 
float delta_time = 0.0f
 
uint64_t state_flags_2d = BGFX_STATE_WRITE_RGB | BGFX_STATE_MSAA | BGFX_STATE_CULL_CCW | BGFX_STATE_BLEND_ALPHA
 
float view_matrix_3d [16]
 
float projection_3d [16]
 
bool shader_reload_hack = false
 
BlamVector3 bgfx_mouse_pos_3d = { 0, 0, 0 }
 
BlamVector3 bgfx_gizmo_pos_3d = { 0, 0, 0 }
 
BlamVector2 bgfx_ortho_window_size = { 320, 240 }
 
float bgfx_last_zoom_level = 0.0f
 
bool is_viewport_2d = false
 
bgfx::VertexBufferHandle screen_quad_vb = BGFX_INVALID_HANDLE
 
bgfx::VertexLayout screen_quad_layout
 
std::vector< BlamRenderPass * > passes = std::vector<BlamRenderPass*>()
 
bgfx::ViewId next_view_id = 0
 

Function Documentation

◆ CalculateLookAtTarget()

BlamVector3 CalculateLookAtTarget ( BlamVector3  camera_position,
BlamVector3  camera_rotation 
)

Calculates a look-at target position from a camera position and Euler rotation.

The returned vec3 is intended to be passed as the _at parameter of bx::mtxLookAt. Rotation is interpreted as (pitch, yaw, roll) in degrees, where pitch rotates around the X axis and yaw rotates around the Y axis. Roll does not affect the look-at target itself - it would instead be baked into the up vector passed to bx::mtxLookAt.

The forward direction is built assuming a Y-up coordinate system. The resulting target sits exactly one unit ahead of the camera along its forward vector, which is all bx::mtxLookAt needs to derive the view basis.

Parameters
camera_positionPointer to the camera's world-space position.
camera_rotationPointer to the camera's Euler rotation in degrees (pitch, yaw, roll).
Returns
A world-space point one unit ahead of the camera along its forward direction.
Author
Claude (Opus 4.7)
+ Here is the caller graph for this function:

◆ UsingBgfx()

bool UsingBgfx ( )

Variable Documentation

◆ __using_bgfx

bool __using_bgfx = false

◆ bgfx_gizmo_pos_3d

BlamVector3 bgfx_gizmo_pos_3d = { 0, 0, 0 }

◆ bgfx_last_zoom_level

float bgfx_last_zoom_level = 0.0f

◆ bgfx_mouse_pos_3d

BlamVector3 bgfx_mouse_pos_3d = { 0, 0, 0 }

◆ bgfx_ortho_window_size

BlamVector2 bgfx_ortho_window_size = { 320, 240 }

◆ callbacks_struct

BlamBgfxCallbacks callbacks_struct = BlamBgfxCallbacks()

◆ delta_time

float delta_time = 0.0f

◆ is_viewport_2d

bool is_viewport_2d = false

◆ mouse

◆ next_view_id

bgfx::ViewId next_view_id = 0

◆ passes

std::vector<BlamRenderPass*> passes = std::vector<BlamRenderPass*>()

◆ projection_3d

float projection_3d[16]

◆ reset_flags

uint32_t reset_flags = BGFX_RESET_VSYNC

◆ screen_quad_layout

bgfx::VertexLayout screen_quad_layout

◆ screen_quad_vb

bgfx::VertexBufferHandle screen_quad_vb = BGFX_INVALID_HANDLE

◆ shader_reload_hack

bool shader_reload_hack = false

◆ state_flags_2d

uint64_t state_flags_2d = BGFX_STATE_WRITE_RGB | BGFX_STATE_MSAA | BGFX_STATE_CULL_CCW | BGFX_STATE_BLEND_ALPHA

◆ view_matrix_3d

float view_matrix_3d[16]

◆ viewport_size

BlamVector2 viewport_size = { 640, 480 }