Castor3D 0.12.0
Multiplatform 3D engine
Public Member Functions | Static Public Member Functions | List of all members
castor3d::Engine Class Reference

#include <Engine.hpp>

Inheritance diagram for castor3d::Engine:
Inheritance graph
[legend]
Collaboration diagram for castor3d::Engine:
Collaboration graph
[legend]

Public Member Functions

C3D_API Engine (castor::String const &appName, Version const &appVersion, bool enableValidation)
 Constructor. More...
 
C3D_API Engine (castor::String const &appName, Version const &appVersion, bool enableValidation, castor::LoggerInstance &logger)
 Constructor. More...
 
C3D_API ~Engine ()
 Destructor. More...
 
C3D_API void initialise (uint32_t wantedFPS=100, bool threaded=false)
 Initialisation function, Sets the wanted frame rate. More...
 
C3D_API void cleanup ()
 Cleanup function, destroys everything created from the beginning. More...
 
C3D_API bool loadRenderer (castor::String const &type)
 Loads a renderer plug-in, given the renderer type. More...
 
C3D_API void loadRenderer (Renderer renderer)
 Loads a renderer plug-in, given the renderer type. More...
 
C3D_API CpuFrameEventpostEvent (CpuFrameEventUPtr event)
 Posts a frame event to the default frame listener. More...
 
C3D_API void sendEvent (GpuFrameEventUPtr event)
 If a device is enabled, executes the given event, if not posts it to the default frame listener. More...
 
C3D_API GpuFrameEventpostEvent (GpuFrameEventUPtr event)
 Posts a frame event to the default frame listener. More...
 
C3D_API bool fireMouseMove (castor::Position const &position)
 
C3D_API void update (CpuUpdater &updater)
 Updates the engine, CPU wise. More...
 
C3D_API void update (GpuUpdater &updater)
 Updates the engine, GPU wise. More...
 
C3D_API void upload (ashes::CommandBuffer const &commandBuffer)
 Updates the buffers. More...
 
C3D_API bool isCleaned ()
 Retrieves the cleanup status. More...
 
C3D_API void setCleaned ()
 Tells the engine is cleaned up. More...
 
C3D_API void pushCpuJob (castor::AsyncJobQueue::Job job)
 Enqueues the given CPU job. More...
 
C3D_API void pushGpuJob (std::function< void(RenderDevice const &, QueueData const &) > job)
 Enqueues the given GPU job. More...
 
C3D_API castor::RgbaColour getNextRainbowColour () const
 Retrieves a colour issued from a rainbow colours iterator. More...
 
C3D_API void registerWindow (RenderWindow &window)
 Registers a RenderWindow. More...
 
C3D_API void unregisterWindow (RenderWindow const &window)
 Unregisters a RenderWindow. More...
 
C3D_API void registerParsers (castor::String const &name, castor::AttributeParsers const &parsers, castor::StrUInt32Map const &sections, castor::UserContextCreator contextCreator)
 Registers additional parsers for SceneFileParser. More...
 
C3D_API void unregisterParsers (castor::String const &name)
 Unregisters parsers for SceneFileParser. More...
 
C3D_API uint32_t registerTimer (castor::String const &category, FramePassTimer &timer)
 Registers a render pass timer. More...
 
C3D_API void unregisterTimer (castor::String const &category, FramePassTimer &timer)
 Unregisters a render pass timer. More...
 
C3D_API void registerLightingModel (castor::String const &name, shader::LightingModelCreator creator)
 Registers a Lighting Model. More...
 
C3D_API void unregisterLightingModel (castor::String const &name)
 Unregisters a Lighting Model. More...
 
C3D_API void registerBuffer (ShaderBuffer const &buffer)
 Registers a ShaderBuffer. More...
 
C3D_API void unregisterBuffer (ShaderBuffer const &buffer)
 Unregisters a ShaderBuffer. More...
 
C3D_API void registerPassType (castor::String const &type, PassRegisterInfo info)
 Registers a material pass type. More...
 
C3D_API void unregisterPassType (castor::String const &type)
 Unregisters a material pass type. More...
 
C3D_API void registerRenderPassType (castor::String const &renderPassType, castor::UniquePtr< RenderPassRegisterInfo > info)
 Registers a scene render pass type, used to render given material pass type. More...
 
C3D_API void setRenderPassTypeConfiguration (castor::String const &renderPassType, Parameters parameters)
 Registers a scene render pass type's configuration parameters. More...
 
C3D_API Parameters getRenderPassTypeConfiguration (castor::String const &renderPassType) const
 Retrieve a scene render pass type's configuration parameters. More...
 
C3D_API RenderPassTypeID getRenderPassTypeID (castor::String const &renderPassType) const
 Retrieves the ID for given scene render pass type name. More...
 
C3D_API RenderPassRegisterInfogetRenderPassInfo (castor::String const &renderPassType) const
 Retrieves a scene render pass type's creation informations. More...
 
C3D_API std::vector< RenderPassRegisterInfo * > getRenderPassInfos (TechniquePassEvent event) const
 Retrieves the scene render passes type creation informations. More...
 
C3D_API void unregisterRenderPassType (castor::String const &renderPassType)
 Unregisters a scene render pass type. More...
 
C3D_API castor::String getPassesName () const
 
C3D_API ToneMappingFactory const & getToneMappingFactory () const
 
C3D_API ToneMappingFactorygetToneMappingFactory ()
 
C3D_API PostEffectFactory const & getPostEffectFactory () const
 
C3D_API PostEffectFactorygetPostEffectFactory ()
 
castor::String const & getAppName () const
 
Version const & getAppVersion () const
 
castor::ImageCache const & getImageCache () const
 
castor::ImageCache & getImageCache ()
 
castor::FontCache const & getFontCache () const
 
castor::FontCache & getFontCache ()
 
UserInputListenerSPtr getUserInputListener ()
 
RenderSystemgetRenderSystem () const
 
auto getDefaultSampler () const
 
auto getLightsSampler () const
 
std::map< castor::String, castor::AdditionalParsers > const & getAdditionalParsers () const
 
Version const & getVersion () const
 
bool isValidationEnabled () const
 
void enableUpdateOptimisations (bool value)
 
bool areUpdateOptimisationsEnabled () const
 
bool isApiTraceEnabled () const
 
bool hasRenderLoop () const
 
RenderLoopgetRenderLoop () const
 
bool isThreaded ()
 
MeshFactorygetMeshFactory () const
 
PassFactorygetPassFactory () const
 
MeshSubdividerFactorygetSubdividerFactory () const
 
MeshImporterFactorygetImporterFactory () const
 
ParticleFactorygetParticleFactory () const
 
castor::CpuInformations const & getCpuInformations () const
 
PassTypeID getPassesType () const
 
castor::ImageLoader const & getImageLoader () const
 
castor::ImageLoader & getImageLoader ()
 
castor::ImageWriter const & getImageWriter () const
 
ashes::RendererList const & getRenderersList () const
 
castor::LoggerInstance & getLogger () const
 
uint32_t getLpvGridSize () const
 
uint32_t getMaxImageSize () const
 
std::map< castor::String, RenderWindow * > const & getRenderWindows () const
 
crg::ResourceHandler & getGraphResourceHandler ()
 
shader::LightingModelFactory const & getLightingModelFactory () const
 
SceneRPtr getLoadingScene () const
 
C3D_API void setLoadingScene (SceneUPtr scene)
 
void setUserInputListener (UserInputListenerSPtr listener)
 
void setPassesType (PassTypeID type)
 
void setMaxImageSize (uint32_t size)
 
void setLpvGridSize (uint32_t size)
 

Static Public Member Functions

static C3D_API castor::Path getPluginsDirectory ()
 Retrieves plug-ins path. More...
 
static C3D_API castor::Path getEngineDirectory ()
 Gives the Castor directory. More...
 
static C3D_API castor::Path getDataDirectory ()
 Retrieves data path. More...
 
static C3D_API std::locale const & getLocale ()
 Retrieves data path. More...
 

Constructor & Destructor Documentation

◆ Engine() [1/2]

C3D_API castor3d::Engine::Engine ( castor::String const &  appName,
Version const &  appVersion,
bool  enableValidation 
)

Constructor.

Parameters
[in]appNameThe user application name.
[in]appVersionThe user application version.
[in]enableValidationtrue to enable rendering API validation.

◆ Engine() [2/2]

C3D_API castor3d::Engine::Engine ( castor::String const &  appName,
Version const &  appVersion,
bool  enableValidation,
castor::LoggerInstance &  logger 
)

Constructor.

Parameters
[in]appNameThe user application name.
[in]appVersionThe user application version.
[in]enableValidationtrue to enable rendering API validation.
[in]loggerThe logger instance.

◆ ~Engine()

C3D_API castor3d::Engine::~Engine ( )

Destructor.

Member Function Documentation

◆ areUpdateOptimisationsEnabled()

bool castor3d::Engine::areUpdateOptimisationsEnabled ( ) const
inline

◆ cleanup()

C3D_API void castor3d::Engine::cleanup ( )

Cleanup function, destroys everything created from the beginning.

Remarks
Destroys also RenderWindows, the only things left after that is RenderSystem and loaded plug-ins

◆ enableUpdateOptimisations()

void castor3d::Engine::enableUpdateOptimisations ( bool  value)
inline

◆ fireMouseMove()

C3D_API bool castor3d::Engine::fireMouseMove ( castor::Position const &  position)

◆ getAdditionalParsers()

std::map< castor::String, castor::AdditionalParsers > const & castor3d::Engine::getAdditionalParsers ( ) const
inline

◆ getAppName()

castor::String const & castor3d::Engine::getAppName ( ) const
inline

◆ getAppVersion()

Version const & castor3d::Engine::getAppVersion ( ) const
inline

◆ getCpuInformations()

castor::CpuInformations const & castor3d::Engine::getCpuInformations ( ) const
inline

◆ getDataDirectory()

static C3D_API castor::Path castor3d::Engine::getDataDirectory ( )
static

Retrieves data path.

Returns
The data path

◆ getDefaultSampler()

auto castor3d::Engine::getDefaultSampler ( ) const
inline

◆ getEngineDirectory()

static C3D_API castor::Path castor3d::Engine::getEngineDirectory ( )
static

Gives the Castor directory.

Returns
The directory

◆ getFontCache() [1/2]

castor::FontCache & castor3d::Engine::getFontCache ( )
inline

◆ getFontCache() [2/2]

castor::FontCache const & castor3d::Engine::getFontCache ( ) const
inline

◆ getGraphResourceHandler()

crg::ResourceHandler & castor3d::Engine::getGraphResourceHandler ( )
inline

◆ getImageCache() [1/2]

castor::ImageCache & castor3d::Engine::getImageCache ( )
inline

◆ getImageCache() [2/2]

castor::ImageCache const & castor3d::Engine::getImageCache ( ) const
inline

◆ getImageLoader() [1/2]

castor::ImageLoader & castor3d::Engine::getImageLoader ( )
inline

◆ getImageLoader() [2/2]

castor::ImageLoader const & castor3d::Engine::getImageLoader ( ) const
inline

◆ getImageWriter()

castor::ImageWriter const & castor3d::Engine::getImageWriter ( ) const
inline

◆ getImporterFactory()

MeshImporterFactory & castor3d::Engine::getImporterFactory ( ) const
inline

◆ getLightingModelFactory()

shader::LightingModelFactory const & castor3d::Engine::getLightingModelFactory ( ) const
inline

◆ getLightsSampler()

auto castor3d::Engine::getLightsSampler ( ) const
inline

◆ getLoadingScene()

SceneRPtr castor3d::Engine::getLoadingScene ( ) const
inline

◆ getLocale()

static C3D_API std::locale const & castor3d::Engine::getLocale ( )
static

Retrieves data path.

Returns
The data path

◆ getLogger()

castor::LoggerInstance & castor3d::Engine::getLogger ( ) const
inline

◆ getLpvGridSize()

uint32_t castor3d::Engine::getLpvGridSize ( ) const
inline

◆ getMaxImageSize()

uint32_t castor3d::Engine::getMaxImageSize ( ) const
inline

◆ getMeshFactory()

MeshFactory & castor3d::Engine::getMeshFactory ( ) const
inline

◆ getNextRainbowColour()

C3D_API castor::RgbaColour castor3d::Engine::getNextRainbowColour ( ) const

Retrieves a colour issued from a rainbow colours iterator.

◆ getParticleFactory()

ParticleFactory & castor3d::Engine::getParticleFactory ( ) const
inline

◆ getPassesName()

C3D_API castor::String castor3d::Engine::getPassesName ( ) const

name Getters.

◆ getPassesType()

PassTypeID castor3d::Engine::getPassesType ( ) const
inline

◆ getPassFactory()

PassFactory & castor3d::Engine::getPassFactory ( ) const
inline

◆ getPluginsDirectory()

static C3D_API castor::Path castor3d::Engine::getPluginsDirectory ( )
static

Retrieves plug-ins path.

Returns
The plug-ins path

◆ getPostEffectFactory() [1/2]

C3D_API PostEffectFactory & castor3d::Engine::getPostEffectFactory ( )

◆ getPostEffectFactory() [2/2]

C3D_API PostEffectFactory const & castor3d::Engine::getPostEffectFactory ( ) const

◆ getRenderersList()

ashes::RendererList const & castor3d::Engine::getRenderersList ( ) const
inline

◆ getRenderLoop()

RenderLoop & castor3d::Engine::getRenderLoop ( ) const
inline

◆ getRenderPassInfo()

C3D_API RenderPassRegisterInfo * castor3d::Engine::getRenderPassInfo ( castor::String const &  renderPassType) const

Retrieves a scene render pass type's creation informations.

Parameters
[in]renderPassTypeThe pass type name.

◆ getRenderPassInfos()

C3D_API std::vector< RenderPassRegisterInfo * > castor3d::Engine::getRenderPassInfos ( TechniquePassEvent  event) const

Retrieves the scene render passes type creation informations.

Parameters
[in]eventThe event type for wanted passes.

◆ getRenderPassTypeConfiguration()

C3D_API Parameters castor3d::Engine::getRenderPassTypeConfiguration ( castor::String const &  renderPassType) const

Retrieve a scene render pass type's configuration parameters.

Parameters
[in]renderPassTypeThe pass type name.
Returns
The pass configuration parameters.

◆ getRenderPassTypeID()

C3D_API RenderPassTypeID castor3d::Engine::getRenderPassTypeID ( castor::String const &  renderPassType) const

Retrieves the ID for given scene render pass type name.

Parameters
[in]renderPassTypeThe pass type name.

◆ getRenderSystem()

RenderSystem * castor3d::Engine::getRenderSystem ( ) const
inline

◆ getRenderWindows()

std::map< castor::String, RenderWindow * > const & castor3d::Engine::getRenderWindows ( ) const
inline

◆ getSubdividerFactory()

MeshSubdividerFactory & castor3d::Engine::getSubdividerFactory ( ) const
inline

◆ getToneMappingFactory() [1/2]

C3D_API ToneMappingFactory & castor3d::Engine::getToneMappingFactory ( )

◆ getToneMappingFactory() [2/2]

C3D_API ToneMappingFactory const & castor3d::Engine::getToneMappingFactory ( ) const

◆ getUserInputListener()

UserInputListenerSPtr castor3d::Engine::getUserInputListener ( )
inline

◆ getVersion()

Version const & castor3d::Engine::getVersion ( ) const
inline

◆ hasRenderLoop()

bool castor3d::Engine::hasRenderLoop ( ) const
inline

◆ initialise()

C3D_API void castor3d::Engine::initialise ( uint32_t  wantedFPS = 100,
bool  threaded = false 
)

Initialisation function, Sets the wanted frame rate.

Parameters
[in]wantedFPSThe wanted FPS count
[in]threadedIf false, the render can't be threaded

◆ isApiTraceEnabled()

bool castor3d::Engine::isApiTraceEnabled ( ) const
inline

◆ isCleaned()

C3D_API bool castor3d::Engine::isCleaned ( )

Retrieves the cleanup status.

Remarks
Thread-safe
Returns
true if cleaned up

◆ isThreaded()

bool castor3d::Engine::isThreaded ( )
inline

◆ isValidationEnabled()

bool castor3d::Engine::isValidationEnabled ( ) const
inline

◆ loadRenderer() [1/2]

C3D_API bool castor3d::Engine::loadRenderer ( castor::String const &  type)

Loads a renderer plug-in, given the renderer type.

Parameters
[in]typeThe renderer type.
Returns
true if ok

◆ loadRenderer() [2/2]

C3D_API void castor3d::Engine::loadRenderer ( Renderer  renderer)

Loads a renderer plug-in, given the renderer type.

Parameters
[in]rendererThe renderer.

◆ postEvent() [1/2]

C3D_API CpuFrameEvent * castor3d::Engine::postEvent ( CpuFrameEventUPtr  event)

Posts a frame event to the default frame listener.

Parameters
[in]eventThe event to add

◆ postEvent() [2/2]

C3D_API GpuFrameEvent * castor3d::Engine::postEvent ( GpuFrameEventUPtr  event)

Posts a frame event to the default frame listener.

Parameters
[in]eventThe event to add

◆ pushCpuJob()

C3D_API void castor3d::Engine::pushCpuJob ( castor::AsyncJobQueue::Job  job)

Enqueues the given CPU job.

Parameters
[in]jobThe job to execute.

◆ pushGpuJob()

C3D_API void castor3d::Engine::pushGpuJob ( std::function< void(RenderDevice const &, QueueData const &) >  job)

Enqueues the given GPU job.

Parameters
[in]jobThe job to execute.

◆ registerBuffer()

C3D_API void castor3d::Engine::registerBuffer ( ShaderBuffer const &  buffer)

Registers a ShaderBuffer.

Parameters
[in]bufferThe ShaderBuffer.

◆ registerLightingModel()

C3D_API void castor3d::Engine::registerLightingModel ( castor::String const &  name,
shader::LightingModelCreator  creator 
)

Registers a Lighting Model.

Parameters
[in]nameThe lighting model name.
[in]creatorThe model creation function.

◆ registerParsers()

C3D_API void castor3d::Engine::registerParsers ( castor::String const &  name,
castor::AttributeParsers const &  parsers,
castor::StrUInt32Map const &  sections,
castor::UserContextCreator  contextCreator 
)

Registers additional parsers for SceneFileParser.

Parameters
[in]nameThe registering name.
[in]parsersThe parsers.
[in]sectionsThe sections.
[in]contextCreatorThe user parser context creation function.

◆ registerPassType()

C3D_API void castor3d::Engine::registerPassType ( castor::String const &  type,
PassRegisterInfo  info 
)

Registers a material pass type.

Parameters
[in]typeThe pass type name.
[in]infoThe pass creation informations.

◆ registerRenderPassType()

C3D_API void castor3d::Engine::registerRenderPassType ( castor::String const &  renderPassType,
castor::UniquePtr< RenderPassRegisterInfo info 
)

Registers a scene render pass type, used to render given material pass type.

Parameters
[in]renderPassTypeThe pass type name.
[in]infoThe pass creation informations.

◆ registerTimer()

C3D_API uint32_t castor3d::Engine::registerTimer ( castor::String const &  category,
FramePassTimer &  timer 
)

Registers a render pass timer.

Parameters
[in]categoryThe timer category name.
[in]timerThe timer to register.
Returns
The query ID.

◆ registerWindow()

C3D_API void castor3d::Engine::registerWindow ( RenderWindow window)

Registers a RenderWindow.

Parameters
[in]windowThe RenderWindow.

◆ sendEvent()

C3D_API void castor3d::Engine::sendEvent ( GpuFrameEventUPtr  event)

If a device is enabled, executes the given event, if not posts it to the default frame listener.

Parameters
[in]eventThe event.

◆ setCleaned()

C3D_API void castor3d::Engine::setCleaned ( )

Tells the engine is cleaned up.

Remarks
Thread-safe

◆ setLoadingScene()

C3D_API void castor3d::Engine::setLoadingScene ( SceneUPtr  scene)

name Mutators.

◆ setLpvGridSize()

void castor3d::Engine::setLpvGridSize ( uint32_t  size)
inline

◆ setMaxImageSize()

void castor3d::Engine::setMaxImageSize ( uint32_t  size)
inline

◆ setPassesType()

void castor3d::Engine::setPassesType ( PassTypeID  type)
inline

◆ setRenderPassTypeConfiguration()

C3D_API void castor3d::Engine::setRenderPassTypeConfiguration ( castor::String const &  renderPassType,
Parameters  parameters 
)

Registers a scene render pass type's configuration parameters.

Parameters
[in]renderPassTypeThe pass type name.
[in]parametersThe pass configuration parameters.

◆ setUserInputListener()

void castor3d::Engine::setUserInputListener ( UserInputListenerSPtr  listener)
inline

◆ unregisterBuffer()

C3D_API void castor3d::Engine::unregisterBuffer ( ShaderBuffer const &  buffer)

Unregisters a ShaderBuffer.

Parameters
[in]bufferThe ShaderBuffer.

◆ unregisterLightingModel()

C3D_API void castor3d::Engine::unregisterLightingModel ( castor::String const &  name)

Unregisters a Lighting Model.

Parameters
[in]nameThe lighting model name.

◆ unregisterParsers()

C3D_API void castor3d::Engine::unregisterParsers ( castor::String const &  name)

Unregisters parsers for SceneFileParser.

Parameters
[in]nameThe registering name.

◆ unregisterPassType()

C3D_API void castor3d::Engine::unregisterPassType ( castor::String const &  type)

Unregisters a material pass type.

Parameters
[in]typeThe pass type name.

◆ unregisterRenderPassType()

C3D_API void castor3d::Engine::unregisterRenderPassType ( castor::String const &  renderPassType)

Unregisters a scene render pass type.

Parameters
[in]renderPassTypeThe pass type name.

◆ unregisterTimer()

C3D_API void castor3d::Engine::unregisterTimer ( castor::String const &  category,
FramePassTimer &  timer 
)

Unregisters a render pass timer.

Parameters
[in]categoryThe timer category name.
[in]timerThe timer to unregister.

◆ unregisterWindow()

C3D_API void castor3d::Engine::unregisterWindow ( RenderWindow const &  window)

Unregisters a RenderWindow.

Parameters
[in]windowThe RenderWindow.

◆ update() [1/2]

C3D_API void castor3d::Engine::update ( CpuUpdater updater)

Updates the engine, CPU wise.

Parameters
[in,out]updaterThe update data.

◆ update() [2/2]

C3D_API void castor3d::Engine::update ( GpuUpdater updater)

Updates the engine, GPU wise.

Parameters
[in,out]updaterThe update data.

◆ upload()

C3D_API void castor3d::Engine::upload ( ashes::CommandBuffer const &  commandBuffer)

Updates the buffers.

Parameters
[in]commandBufferReceives the upload commands.

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