cae  0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
cae::Engine Class Reference

Engine class. More...

#include <Engine.hpp>

+ Collaboration diagram for cae::Engine:

Public Member Functions

 Engine (const EngineConfig &config, const std::function< std::shared_ptr< IAudio >()> &audioFactory, const std::function< std::shared_ptr< INetwork >()> &networkFactory, const std::function< std::shared_ptr< IRenderer >()> &rendererFactory, const std::function< std::shared_ptr< IShaderIR >()> &shaderIRFactory, const std::vector< std::function< std::shared_ptr< IShaderFrontend >()> > &shaderFrontendFactories, const std::function< std::shared_ptr< IWindow >()> &windowFactory)
 
 ~Engine ()=default
 
 Engine (const Engine &)=delete
 
Engineoperator= (const Engine &)=delete
 
 Engine (Engine &&)=delete
 
Engineoperator= (Engine &&)=delete
 
const std::shared_ptr< IAudio > & getAudio () const
 
const std::shared_ptr< INetwork > & getNetwork () const
 
const std::shared_ptr< IRenderer > & getRenderer () const
 
const std::shared_ptr< IWindow > & getWindow () const
 
const std::unique_ptr< utl::Clock > & getClock ()
 
const std::unique_ptr< ShaderManager > & getShaderManager () const
 
const std::unique_ptr< Camera > & getCamera () const
 
void initializeRenderResources (const std::vector< ShaderSourceDesc > &shaderSources, const std::vector< float > &vertices) const
 Initialize render resources.
 
void update (std::array< float, 10 > &fpsBuffer, int &fpsIndex)
 
void render ()
 
void stop ()
 Stop the engine.
 

Private Member Functions

void initWindow (const std::string &windowName, const WindowSize &windowSize, const std::string &iconPath) const
 Initialize the window.
 
void initShaders (const std::vector< ShaderSourceDesc > &shaderSources) const
 Initialize shaders.
 

Private Attributes

std::shared_ptr< IAudiom_audioPlugin = nullptr
 
std::shared_ptr< INetworkm_networkPlugin = nullptr
 
std::shared_ptr< IRendererm_rendererPlugin = nullptr
 
std::shared_ptr< IWindowm_windowPlugin = nullptr
 
std::unique_ptr< utl::Clockm_clock = nullptr
 
std::unique_ptr< ShaderManagerm_shaderManager = nullptr
 
std::unique_ptr< Cameram_camera = nullptr
 
bool m_logFps = false
 

Detailed Description

Engine class.

Definition at line 65 of file Engine.hpp.

Constructor & Destructor Documentation

◆ Engine() [1/3]

cae::Engine::Engine ( const EngineConfig & config,
const std::function< std::shared_ptr< IAudio >()> & audioFactory,
const std::function< std::shared_ptr< INetwork >()> & networkFactory,
const std::function< std::shared_ptr< IRenderer >()> & rendererFactory,
const std::function< std::shared_ptr< IShaderIR >()> & shaderIRFactory,
const std::vector< std::function< std::shared_ptr< IShaderFrontend >()> > & shaderFrontendFactories,
const std::function< std::shared_ptr< IWindow >()> & windowFactory )

◆ ~Engine()

cae::Engine::~Engine ( )
default

◆ Engine() [2/3]

cae::Engine::Engine ( const Engine & )
delete

◆ Engine() [3/3]

cae::Engine::Engine ( Engine && )
delete

Member Function Documentation

◆ getAudio()

const std::shared_ptr< IAudio > & cae::Engine::getAudio ( ) const
inlinenodiscard

Definition at line 82 of file Engine.hpp.

References m_audioPlugin.

◆ getCamera()

const std::unique_ptr< Camera > & cae::Engine::getCamera ( ) const
inlinenodiscard

Definition at line 89 of file Engine.hpp.

References m_camera.

◆ getClock()

const std::unique_ptr< utl::Clock > & cae::Engine::getClock ( )
inlinenodiscard

Definition at line 87 of file Engine.hpp.

References m_clock.

◆ getNetwork()

const std::shared_ptr< INetwork > & cae::Engine::getNetwork ( ) const
inlinenodiscard

Definition at line 83 of file Engine.hpp.

References m_networkPlugin.

◆ getRenderer()

const std::shared_ptr< IRenderer > & cae::Engine::getRenderer ( ) const
inlinenodiscard

Definition at line 84 of file Engine.hpp.

References m_rendererPlugin.

◆ getShaderManager()

const std::unique_ptr< ShaderManager > & cae::Engine::getShaderManager ( ) const
inlinenodiscard

Definition at line 88 of file Engine.hpp.

References m_shaderManager.

◆ getWindow()

const std::shared_ptr< IWindow > & cae::Engine::getWindow ( ) const
inlinenodiscard

Definition at line 85 of file Engine.hpp.

References m_windowPlugin.

◆ initializeRenderResources()

void cae::Engine::initializeRenderResources ( const std::vector< ShaderSourceDesc > & shaderSources,
const std::vector< float > & vertices ) const

Initialize render resources.

Parameters
shaderSourcesShader sources to initialize
verticesVertex data to initialize

Definition at line 55 of file engine.cpp.

◆ initShaders()

void cae::Engine::initShaders ( const std::vector< ShaderSourceDesc > & shaderSources) const
private

Initialize shaders.

Parameters
shaderSourcesShader sources to initialize

Definition at line 106 of file engine.cpp.

References cae::SPIRV.

◆ initWindow()

void cae::Engine::initWindow ( const std::string & windowName,
const WindowSize & windowSize,
const std::string & iconPath ) const
private

Initialize the window.

Parameters
windowNamewindow name
windowSizewindow size
iconPathpath to window icon

Definition at line 96 of file engine.cpp.

Referenced by Engine().

+ Here is the caller graph for this function:

◆ operator=() [1/2]

Engine & cae::Engine::operator= ( const Engine & )
delete

◆ operator=() [2/2]

Engine & cae::Engine::operator= ( Engine && )
delete

◆ render()

void cae::Engine::render ( )

Definition at line 62 of file engine.cpp.

◆ stop()

void cae::Engine::stop ( )

Stop the engine.

Definition at line 81 of file engine.cpp.

References utl::INFO, and utl::Logger::log().

+ Here is the call graph for this function:

◆ update()

void cae::Engine::update ( std::array< float, 10 > & fpsBuffer,
int & fpsIndex )
Parameters
fpsBuffer
fpsIndex

Definition at line 72 of file engine.cpp.

References printFps().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_audioPlugin

std::shared_ptr<IAudio> cae::Engine::m_audioPlugin = nullptr
private

Definition at line 117 of file Engine.hpp.

Referenced by getAudio().

◆ m_camera

std::unique_ptr<Camera> cae::Engine::m_camera = nullptr
private

Definition at line 124 of file Engine.hpp.

Referenced by getCamera().

◆ m_clock

std::unique_ptr<utl::Clock> cae::Engine::m_clock = nullptr
private

Definition at line 122 of file Engine.hpp.

Referenced by getClock().

◆ m_logFps

bool cae::Engine::m_logFps = false
private

Definition at line 126 of file Engine.hpp.

◆ m_networkPlugin

std::shared_ptr<INetwork> cae::Engine::m_networkPlugin = nullptr
private

Definition at line 118 of file Engine.hpp.

Referenced by getNetwork().

◆ m_rendererPlugin

std::shared_ptr<IRenderer> cae::Engine::m_rendererPlugin = nullptr
private

Definition at line 119 of file Engine.hpp.

Referenced by Engine(), and getRenderer().

◆ m_shaderManager

std::unique_ptr<ShaderManager> cae::Engine::m_shaderManager = nullptr
private

Definition at line 123 of file Engine.hpp.

Referenced by getShaderManager().

◆ m_windowPlugin

std::shared_ptr<IWindow> cae::Engine::m_windowPlugin = nullptr
private

Definition at line 120 of file Engine.hpp.

Referenced by Engine(), and getWindow().


The documentation for this class was generated from the following files: