Kohi Game Engine
camera_system.h File Reference

The camera system is responsible for managing cameras throughout the engine. More...

#include "renderer/camera.h"

Go to the source code of this file.

Data Structures

struct  camera_system_config
 The camera system configuration. More...
 

Macros

#define DEFAULT_CAMERA_NAME   "default"
 The name of the default camera. More...
 

Typedefs

typedef struct camera_system_config camera_system_config
 The camera system configuration. More...
 

Functions

b8 camera_system_initialize (u64 *memory_requirement, void *state, void *config)
 Initializes the camera system. Should be called twice; once to get the memory requirement (passing state=0), and a second time passing an allocated block of memory to actually initialize the system. More...
 
void camera_system_shutdown (void *state)
 Shuts down the geometry camera. More...
 
KAPI cameracamera_system_acquire (const char *name)
 Acquires a pointer to a camera by name. If one is not found, a new one is created and retuned. Internal reference counter is incremented. More...
 
KAPI void camera_system_release (const char *name)
 Releases a camera with the given name. Intenral reference counter is decremented. If this reaches 0, the camera is reset, and the reference is usable by a new camera. More...
 
KAPI cameracamera_system_get_default (void)
 Gets a pointer to the default camera. More...
 

Detailed Description

The camera system is responsible for managing cameras throughout the engine.

Author
Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
Version
1.0
Date
2022-05-21

Macro Definition Documentation

◆ DEFAULT_CAMERA_NAME

#define DEFAULT_CAMERA_NAME   "default"

The name of the default camera.

Typedef Documentation

◆ camera_system_config

The camera system configuration.

Function Documentation

◆ camera_system_acquire()

KAPI camera* camera_system_acquire ( const char *  name)

Acquires a pointer to a camera by name. If one is not found, a new one is created and retuned. Internal reference counter is incremented.

Parameters
nameThe name of the camera to acquire.
Returns
A pointer to a camera if successful; 0 if an error occurs.

◆ camera_system_get_default()

KAPI camera* camera_system_get_default ( void  )

Gets a pointer to the default camera.

Returns
A pointer to the default camera.

◆ camera_system_initialize()

b8 camera_system_initialize ( u64 memory_requirement,
void *  state,
void *  config 
)

Initializes the camera system. Should be called twice; once to get the memory requirement (passing state=0), and a second time passing an allocated block of memory to actually initialize the system.

Parameters
memory_requirementA pointer to hold the memory requirement as it is calculated.
stateA block of memory to hold the state or, if gathering the memory requirement, 0.
configThe configuration (camera_system_config) for this system.
Returns
True on success; otherwise false.

◆ camera_system_release()

KAPI void camera_system_release ( const char *  name)

Releases a camera with the given name. Intenral reference counter is decremented. If this reaches 0, the camera is reset, and the reference is usable by a new camera.

Parameters
nameThe name of the camera to release.

◆ camera_system_shutdown()

void camera_system_shutdown ( void *  state)

Shuts down the geometry camera.

Parameters
stateThe state block of memory.