Wasabi
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Wasabi Class Referenceabstract

#include <WCore.hpp>

Inheritance diagram for Wasabi:
BulletDebugger

Public Member Functions

template<typename T >
GetEngineParam (std::string paramName, T fallback=T())
 
template<typename T >
void SetEngineParam (std::string paramName, T value)
 
virtual WError Setup ()=0
 
virtual bool Loop (float fDeltaTime)=0
 
virtual void Cleanup ()=0
 
void SwitchState (class WGameState *state)
 
WError StartEngine (int width, int height)
 
virtual WError Resize (uint32_t width, uint32_t height)
 
uint32_t GetCurrentBufferingIndex ()
 
VkInstance GetVulkanInstance () const
 
VkPhysicalDevice GetVulkanPhysicalDevice () const
 
VkDevice GetVulkanDevice () const
 
VkQueue GetVulkanGraphicsQeueue () const
 
VulkanSwapChainGetSwapChain ()
 

Public Attributes

class WVulkanMemoryManagerMemoryManager
 
class WSoundComponentSoundComponent
 
class WWindowAndInputComponentWindowAndInputComponent
 
class WTextComponentTextComponent
 
class WPhysicsComponentPhysicsComponent
 
class WRendererRenderer
 
class WFileManagerFileManager
 
class WObjectManagerObjectManager
 
class WGeometryManagerGeometryManager
 
class WEffectManagerEffectManager
 
class WShaderManagerShaderManager
 
class WMaterialManagerMaterialManager
 
class WCameraManagerCameraManager
 
class WImageManagerImageManager
 
class WSpriteManagerSpriteManager
 
class WRenderTargetManagerRenderTargetManager
 
class WLightManagerLightManager
 
class WAnimationManagerAnimationManager
 
class WParticlesManagerParticlesManager
 
class WTerrainManagerTerrainManager
 
WTimer Timer
 
float FPS
 
float maxFPS
 
class WGameStatecurState
 
bool __EXIT
 

Protected Member Functions

virtual VkInstance CreateVKInstance ()
 
virtual int SelectGPU (std::vector< VkPhysicalDevice > devices)
 
virtual VkPhysicalDeviceFeatures GetDeviceFeatures ()
 
virtual WError SetupRenderer ()
 
virtual class WTextComponentCreateTextComponent ()
 
virtual class WSoundComponentCreateSoundComponent ()
 
virtual class WWindowAndInputComponentCreateWindowAndInputComponent ()
 
virtual class WPhysicsComponentCreatePhysicsComponent ()
 
void _DestroyResources ()
 

Protected Attributes

VkInstance m_vkInstance
 
VkPhysicalDevice m_vkPhysDev
 
VkDevice m_vkDevice
 
VkQueue m_graphicsQueue
 
VulkanSwapChain m_swapChain
 
bool m_swapChainInitialized
 
VkDebugReportCallbackEXT m_debugCallback
 
std::map< std::string, void * > engineParams
 

Detailed Description

Main application class. This class is abstract and one must implement its three methods (Setup, Loop and Cleanup) to be able to run the engine.

Member Function Documentation

◆ _DestroyResources()

void Wasabi::_DestroyResources ( )
protected

Destroys all resources of the engine.

◆ Cleanup()

virtual void Wasabi::Cleanup ( )
pure virtual

This function must be implemented by an application. It is called by the engine to give the application a last chance to clean up its resources before the engine exits.

Implemented in BulletDebugger.

◆ CreatePhysicsComponent()

virtual class WPhysicsComponent* Wasabi::CreatePhysicsComponent ( )
protectedvirtual

This function can be overloaded by the application. This function is called by the engine in StartEngine() and will give the application a chance to set the physics component of the engine. Default implementation will return null. IMPORTANT: You must fully initialize the returned component, be it with ::Initialize() or any other required initialization.

Reimplemented in BulletDebugger.

◆ CreateSoundComponent()

virtual class WSoundComponent* Wasabi::CreateSoundComponent ( )
protectedvirtual

This function can be overloaded by the application. This function is called by the engine in StartEngine() and will give the application a chance to set the sound component of the engine. Default implementation will return null. IMPORTANT: You must fully initialize the returned component, be it with ::Initialize() or any other required initialization.

◆ CreateTextComponent()

virtual class WTextComponent* Wasabi::CreateTextComponent ( )
protectedvirtual

This function can be overloaded by the application. This function is called by the engine in StartEngine() and will give the application a chance to set the text component of the engine. Default implementation will create a WTextComponent.

◆ CreateVKInstance()

virtual VkInstance Wasabi::CreateVKInstance ( )
protectedvirtual

Creates and initializes a VkInstance to use in the engine.

◆ CreateWindowAndInputComponent()

virtual class WWindowAndInputComponent* Wasabi::CreateWindowAndInputComponent ( )
protectedvirtual

This function can be overloaded by the application. This function is called by the engine in StartEngine() and will give the application a chance to set the window/input component of the engine. Default implementation will create the appropriate component based on the OS. IMPORTANT: You must fully initialize the returned component, be it with ::Initialize() or any other required initialization.

◆ GetCurrentBufferingIndex()

uint32_t Wasabi::GetCurrentBufferingIndex ( )

This simply returns Renderer::GetCurrentBufferingIndex()

◆ GetDeviceFeatures()

virtual VkPhysicalDeviceFeatures Wasabi::GetDeviceFeatures ( )
protectedvirtual

Can be overloaded by the application. This function should return the Vulkan features required by the application.

◆ GetSwapChain()

VulkanSwapChain* Wasabi::GetSwapChain ( )

Retrieves the currently used swap chain.

Returns
The swap chain

◆ GetVulkanDevice()

VkDevice Wasabi::GetVulkanDevice ( ) const

Retrieves the virtual device that the engine is using.

Returns
The Vulkan virtual device

◆ GetVulkanGraphicsQeueue()

VkQueue Wasabi::GetVulkanGraphicsQeueue ( ) const

Retrieves the currently used Vulkan graphics queue.

Returns
The Vulkan graphics queue

◆ GetVulkanInstance()

VkInstance Wasabi::GetVulkanInstance ( ) const

Retrieves the Vulkan instance.

Returns
The Vulkan instance

◆ GetVulkanPhysicalDevice()

VkPhysicalDevice Wasabi::GetVulkanPhysicalDevice ( ) const

Retrieves the Vulkan physical device that the engine is using.

Returns
The Vulkan physical device

◆ Loop()

virtual bool Wasabi::Loop ( float  fDeltaTime)
pure virtual

This function must be implemented by an application. It is called by the engine every frame to allow the application to update its state.

Parameters
fDeltaTimeThe step time for this frame (roughly 1 / FPS)
Returns
If this function returns true, execution continues, otherwise, the application will exit

Implemented in BulletDebugger.

◆ Resize()

virtual WError Wasabi::Resize ( uint32_t  width,
uint32_t  height 
)
virtual

This function can be overloaded by the user. This function is called by the engine when the window size changed. An overloaded implementation must call Wasabi::Resize(width, height) to allow the engine to also perform its internal resizing procedure.

Parameters
widthNew window width
heightNew window height
Returns
Error code, see WError.h. Returned value's impact depends on the currently used window component

◆ SelectGPU()

virtual int Wasabi::SelectGPU ( std::vector< VkPhysicalDevice >  devices)
protectedvirtual

This function can be overloaded by the application. This function gives the application a chance to select the physical device (A graphics card) from the list available to Vulkan. This function is called by the engine during StartEngine() and the selected physical device will be used.

Parameters
devicesThe list of available physical devices
Returns
Must return an index into the list devices, which will be used by the engine

◆ Setup()

virtual WError Wasabi::Setup ( )
pure virtual

This function must be implemented by an application. It is called after WInitialize and is supposed to call StartEngine() and initialize application resources.

Returns
Any error returned other than W_SUCCEEDED will result in the end of the program

Implemented in BulletDebugger.

◆ SetupRenderer()

virtual WError Wasabi::SetupRenderer ( )
protectedvirtual

This function can be overloaded by the application. This function is called by the engine in StartEngine() and will give the application a chance to setup renderer of the engine. Default implementation will call WInitializeDeferredRenderer().

Reimplemented in BulletDebugger.

◆ StartEngine()

WError Wasabi::StartEngine ( int  width,
int  height 
)

This function must be called by the user before any Wasabi resources are initiated/created. This function must be called during the application's Setup(). This function will start the engine, initializing all its resources and components.

Parameters
widthWidth of the window when the engine starts
heightHeight of the window when the engine starts
Returns
Error code, see WError.h

◆ SwitchState()

void Wasabi::SwitchState ( class WGameState state)

Switches the game state from the current state to the provided state. The previous state will have its Cleanup() method called, and the new state will have its Load() method called. The game states should be allocated by the user.

Parameters
stateThe new game state

Member Data Documentation

◆ __EXIT

bool Wasabi::__EXIT

When set to true, the engine will exit asap

◆ AnimationManager

class WAnimationManager* Wasabi::AnimationManager

Pointer to the animation manager

◆ CameraManager

class WCameraManager* Wasabi::CameraManager

Pointer to the camera manager

◆ curState

class WGameState* Wasabi::curState

Current game state

◆ EffectManager

class WEffectManager* Wasabi::EffectManager

Pointer to the effect manager

◆ engineParams

std::map<std::string, void*> Wasabi::engineParams
protected

A map of various parameters used by the engine. Built-in parameters are:

  • "appName": Pointer to the name of the application. Default is (void*)"Wasabi".
  • "enableVulkanValidation": Whether or not to enable Vulkan SDK validation while in debug mode. Default is (void*)(false).
  • "bufferingCount": Buffering count, usually double (2) or triple (3) is used. Buffering defines the maximum number of frames that can be all in-flight (rendering) at the same time. Default is 2.
  • "fontBmpSize": The size of the font bitmap when a new font is created. default is (void*)(512).
  • "fontBmpCharHeight": The height of each character when a new font bitmap is crated. Default is (void*)(32).
  • "fontBmpNumChars": Number of characters to put when a new font bitmap is created. Default is (void*)(96).
  • "textBatchSize": The maximum number of characters to be passed in for a single text draw. Default is (void*)(256).
  • "geometryImmutable": When set to true, created geometry will be immutable (more efficient and uses less memory, but loses all dynamic attributes). Default is (void*)(false).
  • "numGeneratedMips": Number of mipmaps to generate when a new image is crated. Default is (void*)(1).

◆ FileManager

class WFileManager* Wasabi::FileManager

Pointer to the file manager

◆ FPS

float Wasabi::FPS

Current FPS, set by the engine

◆ GeometryManager

class WGeometryManager* Wasabi::GeometryManager

Pointer to the geometry manager

◆ ImageManager

class WImageManager* Wasabi::ImageManager

Pointer to the image manager

◆ LightManager

class WLightManager* Wasabi::LightManager

Pointer to the light manager

◆ m_debugCallback

VkDebugReportCallbackEXT Wasabi::m_debugCallback
protected

Handle to the debugging callback created in debug mode

◆ m_graphicsQueue

VkQueue Wasabi::m_graphicsQueue
protected

The used graphics queue

◆ m_swapChain

VulkanSwapChain Wasabi::m_swapChain
protected

The swap chain

◆ m_swapChainInitialized

bool Wasabi::m_swapChainInitialized
protected

true if the swap chain has been initialized yet, false otherwise

◆ m_vkDevice

VkDevice Wasabi::m_vkDevice
protected

The used Vulkan virtual device

◆ m_vkInstance

VkInstance Wasabi::m_vkInstance
protected

The Vulkan instance

◆ m_vkPhysDev

VkPhysicalDevice Wasabi::m_vkPhysDev
protected

The used Vulkan physical device

◆ MaterialManager

class WMaterialManager* Wasabi::MaterialManager

Pointer to the material manager

◆ maxFPS

float Wasabi::maxFPS

Maximum FPS the engine should reach, can be set by the user, 0 sets no limit

◆ MemoryManager

class WVulkanMemoryManager* Wasabi::MemoryManager

Pointer to the vulkan memory manager

◆ ObjectManager

class WObjectManager* Wasabi::ObjectManager

Pointer to the object manager

◆ ParticlesManager

class WParticlesManager* Wasabi::ParticlesManager

Pointer to the particles manager

◆ PhysicsComponent

class WPhysicsComponent* Wasabi::PhysicsComponent

Pointer to the attached physics component

◆ Renderer

class WRenderer* Wasabi::Renderer

Pointer to the attached renderer

◆ RenderTargetManager

class WRenderTargetManager* Wasabi::RenderTargetManager

Pointer to the render target manager

◆ ShaderManager

class WShaderManager* Wasabi::ShaderManager

Pointer to the shader manager

◆ SoundComponent

class WSoundComponent* Wasabi::SoundComponent

Pointer to the attached sound component

◆ SpriteManager

class WSpriteManager* Wasabi::SpriteManager

Pointer to the sprite manager

◆ TerrainManager

class WTerrainManager* Wasabi::TerrainManager

Pointer to the terrain manager

◆ TextComponent

class WTextComponent* Wasabi::TextComponent

Pointer to the attached text component

◆ Timer

WTimer Wasabi::Timer

A timer object, which starts counting when the application starts

◆ WindowAndInputComponent

class WWindowAndInputComponent* Wasabi::WindowAndInputComponent

Pointer to the attached window/input component


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