All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzu_engine.h File Reference

Structure for engine. More...

Classes

struct  KzuFPSConstraints
 Constraint for limiting the number of frames per second the Engine is rendering. More...
 

Namespaces

 kanzi
 

Macros

#define KZU_ENGINE_ENABLE_WATERMARK
 Enables the watermark. More...
 
#define KZU_ENGINE_DEFAULT_QUICK_MEMORY_SIZE
 Amount of quick memory used by engine. More...
 
#define KZU_ENGINE_DEFAULT_VERTEX_BUFFER_POOL_SIZE
 Default vertex buffer pool size. More...
 
#define KZU_ENGINE_DEFAULT_INDEX_BUFFER_POOL_SIZE
 Default index buffer pool size. More...
 

Enumerations

enum  KzuEngineLoadingMeasurement { KZU_ENGINE_LOADING_MEASUREMENT_RENDERER }
 Engine loading time measurement constants. More...
 

Functions

KANZI_API kzsError kzuEngineCreate (KzcMemoryManager *memoryManager, kzUint quickMemorySize, kzUint loadingThreadCount, kzUint maxPendingResources, kzString binaryName, kzBool useMemoryMappedLoading, kzBool enableEditing, const struct KzuPreviewProperties &previewProperties, struct KzuEngine **out_engine)
 Create a new engine and necessary components for it, such as renderer and its default materials. More...
 
KANZI_API kzsError kzuEngineDelete (KzuEngine *engine)
 Deletes an engine. More...
 
KANZI_API kzsError kzuEngineCreateTransformGizmo (struct KzuEngine *engine)
 Create transform gizmo. More...
 
KANZI_API struct
KzuTransformGizmo * 
kzuEngineGetTransformGizmo (const struct KzuEngine *engine)
 Get the transform gizmo (may return NULL). More...
 
KANZI_API void kzuEngineSetActiveRenderTarget (struct KzuEngine *engine, const kanzi::RenderTarget *renderTarget)
 Sets active render target for engine. More...
 
KANZI_API const
kanzi::RenderTarget
kzuEngineGetActiveRenderTarget (const struct KzuEngine *engine)
 Gets active render target that engine has. More...
 
KANZI_API kzsError kzuEngineBeginFrame (struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget)
 Starts a frame for engine rendering. More...
 
KANZI_API kzsError kzuEngineEndFrame (struct KzuEngine *engine)
 Ends a frame for engine rendering . More...
 
KANZI_API void kzuEngineSetMinimumDeltaTime (struct KzuEngine *engine, kzUint minimumDeltaTime)
 Sets minimum delta time for engine. More...
 
KANZI_API kzsError kzuEngineLimitFrameRate (struct KzuEngine *engine)
 Enforces minimum delta time for engine. More...
 
KANZI_API kzUint kzuEngineGetDeltaWallTime (const struct KzuEngine *engine)
 Returns the wall time interval between the two latest updates. More...
 
KANZI_API void kzuEngineMeasurePerformance (struct KzuEngine *engine)
 Updates engine FPS calculations. More...
 
KANZI_API kzFloat kzuEngineGetFramesPerSecond (const struct KzuEngine *engine)
 Gets frames per second from engine (FPS), measuring the overall frames per second. More...
 
KANZI_API void kzuEngineSetGPUCallsEnabled (struct KzuEngine *engine, kzBool enabled)
 Sets GPU calls enabled / disabled. More...
 
KANZI_API kanzi::Renderer3DkzuEngineGetRenderer (const struct KzuEngine *engine)
 Returns user renderer from engine. More...
 
KANZI_API kzUint kzuEngineGetLoadingTime (const struct KzuEngine *engine, enum KzuEngineLoadingMeasurement measurement)
 Gets loading time measurement from engine. More...
 
KANZI_API kzsError kzuEngineInitialize (struct KzuEngine *engine, kzBool toolPresent)
 Initialization. More...
 
KANZI_API kzsError kzuEngineUninitialize (struct KzuEngine *engine)
 Uninitialize. More...
 
KANZI_API kzsError kzuEngineLoadBinary (struct KzuEngine *engine, kzBool toolPresent)
 Loads the KZB files if they have not yet been loaded. More...
 
KANZI_API kzsError kzuEngineSetDefaultViewport (const struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget, kzBool toolPresent, kzBool centerize)
 Set default viewport parameters. More...
 
KANZI_API kzsError kzuEngineInitializeProject (struct KzuEngine *engine, const KzuPreviewProperties &previewProperties, kzBool toolPresent)
 Initializes the engine and loads the .KZB file. More...
 
KANZI_API kzsError kzuEngineSetBinary (struct KzuEngine *engine, kzString binaryName)
 Makes engine to load a new binary from given binary name in the beginning of next update loop. More...
 
KANZI_API struct
kanzi::KzuInputManager
kzuEngineGetInputManager (const struct KzuEngine *engine)
 Get the engine input manager. More...
 
KANZI_API kzsError kzuEngineReLayout (struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget, kzBool centerize)
 Re-layout engine without validating or invalidating the layout. More...
 
KANZI_API kzFloat kzuEngineGetAnimationPlayerTime (const KzuEngine *engine)
 Get the current time from the engine special scrubbable animation player. More...
 
KANZI_API void kzuEngineSetAnimationPlayerTime (const KzuEngine *engine, kzFloat time)
 Sets the time to engine special scrubbable animation player. More...
 
KANZI_API kzsError kzuEngineCreateAnimationPlayer (KzuEngine *engine)
 Create a new special, scrubbable animation player for the engine. More...
 
KANZI_API kanzi::LayerRenderpasskzuEngineGetLayerComposer (const struct KzuEngine *engine)
 
KANZI_API struct
KzuMessageDispatcher
kzuEngineGetMessageDispatcher (const struct KzuEngine *engine)
 
KANZI_API kanzi::DomainkzuEngineGetUIDomain (const struct KzuEngine *engine)
 
KANZI_API struct KzuBinaryLoaderkzuEngineGetBinaryLoader (const struct KzuEngine *engine)
 
KANZI_API kanzi::ResourceManagerkzuEngineGetResourceManager (const struct KzuEngine *engine)
 
KANZI_API kanzi::RendererkzuEngineGetCoreRenderer (const struct KzuEngine *engine)
 
KANZI_API struct KzuTaskSchedulerkzuEngineGetTaskScheduler (const struct KzuEngine *engine)
 
KANZI_API
kanzi::TransformedScene2D
kzuEngineGetLayerTransformedScene (KzuEngine *engine)
 
KANZI_API kzsError kzuEngineInitializeProjectTask (struct KzuEngine *engine, const struct KzuPreviewProperties &previewProperties, kzBool toolPresent)
 
KANZI_API kzsError kzuEngineUpdate1 (struct KzuEngine *engine, kzUint deltaTime, const kanzi::RenderTarget &renderTarget, const struct KzuPreviewProperties &previewProperties, const struct KzuFPSConstraints &fpsConstraints, kzBool toolPresent)
 Updates engine. More...
 
KANZI_API kzsError kzuEngineUpdate2 (struct KzuEngine *engine, kzUint deltaTime, const kanzi::RenderTarget &renderTarget, const struct KzuPreviewProperties &previewProperties, const struct KzuFPSConstraints &fpsConstraints, kzBool toolPresent)
 
KANZI_API kzsError kzuEngineRenderFrame (struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget, bool toolPresent)
 Render a screen (usually containing root layer). More...
 
KANZI_API kzsError kzuEngineRenderAll (struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget, bool toolPresent)
 Render a screen (usually containing root layer). More...
 
KANZI_API kzsError kzuEnginePostRender (const struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget)
 
KANZI_API kzsError kzuEngineHandleEvents (KzuEngine *engine, KzsEventQueue *eventQueue)
 
KANZI_API void kzuEngineSetControlDown (const KzuEngine *engine, bool isControlDown)
 
KANZI_API kzsError kzuEngineProjectReloaded (const KzuEngine *engine)
 
KANZI_API KzuPreviewSystemkzuEngineGetPreviewSystem (const KzuEngine *engine)
 
KANZI_API kzsError kzuEngineSetScreen (struct KzuEngine *engine, kanzi::ScreenSharedPtr screen)
 Sets screen of engine. More...
 
KANZI_API kanzi::ScreenSharedPtr kzuEngineGetScreen (const struct KzuEngine *engine)
 Gets screen of engine. More...
 
KANZI_API kzsError kzuEngineSetScreenOrientation (struct KzuEngine *engine, enum KzsWindowOrientation orientation)
 Sets the orientation of the screen. More...
 
KANZI_API void kzuEngineInvalidateScreenLayout (struct KzuEngine *engine)
 Invalidates the layout of the attached screen. More...
 
KANZI_API kzsError kzuEngineInitializeGLContext (struct KzuEngine *engine)
 
KANZI_API kzsError kzuEngineUninitializeGLContext (struct KzuEngine *engine, kzBool temporary)
 
KANZI_API kzsError kzuEngineReloadProject (struct KzuEngine *engine, kzUint byteCount, const kzByte *bytes, bool isToolPresent)
 
KANZI_API kzsError kzuEngineReloadProjectFromFile (struct KzuEngine *engine, kzString binaryPath, bool isToolPresent)
 
KANZI_API kzsError kzuEngineReloadProjectFromFileResource (struct KzuEngine *engine, kzString resourceFile, bool isToolPresent)
 
KANZI_API kzsError kzuEnginePatchProject (struct KzuEngine *engine, kzUint byteCount, const kzByte *bytes)
 
KANZI_API kzsError kzuEnginePatchProjectFromFile (const struct KzuEngine *engine, kzString binaryPath)
 
KANZI_API kzsError kzuEnginePatchProjectFromFileResource (const struct KzuEngine *engine, kzString resourceFile)
 
KANZI_API kzsError kzuEngineInvalidateGPUResources (const struct KzuEngine *engine)
 
KANZI_API kzsError kzuEngineRestoreNodeResources (const struct KzuEngine *engine)
 
KANZI_API kzsError kzuEngineSetRootLayerAsync (struct KzuEngine *engine, kanzi::Node2D *layer)
 
KANZI_API kzsError kzuEngineRender (struct KzuEngine *engine, const kanzi::RenderTarget &renderTarget, bool isToolPresent)
 
KANZI_API kzsError kzuEngineEnablePreviewSystem (KzuEngine *engine)
 

Detailed Description

Structure for engine.

Contains pipeline specific assets (current scene, renderer), timer, etc.

Copyright 2008-2020 by Rightware. All rights reserved.

Macro Definition Documentation

#define KZU_ENGINE_ENABLE_WATERMARK

Enables the watermark.

#define KZU_ENGINE_DEFAULT_QUICK_MEMORY_SIZE

Amount of quick memory used by engine.

#define KZU_ENGINE_DEFAULT_VERTEX_BUFFER_POOL_SIZE

Default vertex buffer pool size.

#define KZU_ENGINE_DEFAULT_INDEX_BUFFER_POOL_SIZE

Default index buffer pool size.

Enumeration Type Documentation

Engine loading time measurement constants.

Enumerator
KZU_ENGINE_LOADING_MEASUREMENT_RENDERER 

Renderer loading time.

Function Documentation

KANZI_API kzsError kzuEngineCreate ( KzcMemoryManager memoryManager,
kzUint  quickMemorySize,
kzUint  loadingThreadCount,
kzUint  maxPendingResources,
kzString  binaryName,
kzBool  useMemoryMappedLoading,
kzBool  enableEditing,
const struct KzuPreviewProperties previewProperties,
struct KzuEngine **  out_engine 
)

Create a new engine and necessary components for it, such as renderer and its default materials.

KANZI_API kzsError kzuEngineDelete ( KzuEngine engine)

Deletes an engine.

KANZI_API kzsError kzuEngineCreateTransformGizmo ( struct KzuEngine engine)

Create transform gizmo.

KANZI_API struct KzuTransformGizmo* kzuEngineGetTransformGizmo ( const struct KzuEngine engine)

Get the transform gizmo (may return NULL).

KANZI_API void kzuEngineSetActiveRenderTarget ( struct KzuEngine engine,
const kanzi::RenderTarget renderTarget 
)

Sets active render target for engine.

KANZI_API const kanzi::RenderTarget* kzuEngineGetActiveRenderTarget ( const struct KzuEngine engine)

Gets active render target that engine has.

KANZI_API kzsError kzuEngineBeginFrame ( struct KzuEngine engine,
const kanzi::RenderTarget renderTarget 
)

Starts a frame for engine rendering.

KANZI_API kzsError kzuEngineEndFrame ( struct KzuEngine engine)

Ends a frame for engine rendering .

KANZI_API void kzuEngineSetMinimumDeltaTime ( struct KzuEngine engine,
kzUint  minimumDeltaTime 
)

Sets minimum delta time for engine.

KANZI_API kzsError kzuEngineLimitFrameRate ( struct KzuEngine engine)

Enforces minimum delta time for engine.

KANZI_API kzUint kzuEngineGetDeltaWallTime ( const struct KzuEngine engine)

Returns the wall time interval between the two latest updates.

KANZI_API void kzuEngineMeasurePerformance ( struct KzuEngine engine)

Updates engine FPS calculations.

Should be called once per frame.

KANZI_API kzFloat kzuEngineGetFramesPerSecond ( const struct KzuEngine engine)

Gets frames per second from engine (FPS), measuring the overall frames per second.

KANZI_API void kzuEngineSetGPUCallsEnabled ( struct KzuEngine engine,
kzBool  enabled 
)

Sets GPU calls enabled / disabled.

KANZI_API kanzi::Renderer3D* kzuEngineGetRenderer ( const struct KzuEngine engine)

Returns user renderer from engine.

KANZI_API kzUint kzuEngineGetLoadingTime ( const struct KzuEngine engine,
enum KzuEngineLoadingMeasurement  measurement 
)

Gets loading time measurement from engine.

KANZI_API kzsError kzuEngineInitialize ( struct KzuEngine engine,
kzBool  toolPresent 
)

Initialization.

Loads metadata, including properties and messages from all .KZB files.

KANZI_API kzsError kzuEngineUninitialize ( struct KzuEngine engine)

Uninitialize.

Frees memory allocated at initialization time.

KANZI_API kzsError kzuEngineLoadBinary ( struct KzuEngine engine,
kzBool  toolPresent 
)

Loads the KZB files if they have not yet been loaded.

KANZI_API kzsError kzuEngineSetDefaultViewport ( const struct KzuEngine engine,
const kanzi::RenderTarget renderTarget,
kzBool  toolPresent,
kzBool  centerize 
)

Set default viewport parameters.

KANZI_API kzsError kzuEngineInitializeProject ( struct KzuEngine engine,
const KzuPreviewProperties previewProperties,
kzBool  toolPresent 
)

Initializes the engine and loads the .KZB file.

Parameters
engineA valid engine structure.
renderTarget
Returns
KZS_SUCCESS on success. An error can be returned if something goes wrong during initialization, loading or if the onProjectLoaded callback returns an error.
KANZI_API kzsError kzuEngineSetBinary ( struct KzuEngine engine,
kzString  binaryName 
)

Makes engine to load a new binary from given binary name in the beginning of next update loop.

Parameters
binaryNamePath to either the binary config file listing all .kzb files that are loaded to project, or a path to a single .kzb file.
Returns
KZS_SUCCESS on success.
KANZI_API struct kanzi::KzuInputManager* kzuEngineGetInputManager ( const struct KzuEngine engine)

Get the engine input manager.

The input manager is used when the engine handles input events. The manager e.g. creates messages for keyboard events and figures out where to send pointer events.

KANZI_API kzsError kzuEngineReLayout ( struct KzuEngine engine,
const kanzi::RenderTarget renderTarget,
kzBool  centerize 
)

Re-layout engine without validating or invalidating the layout.

This means the layout is only calculated for nodes that already have their layout invalidated. Also, the engine is prepared for the next rendering call by calculating the transformed scene. This function can be useful after loading a project in the user part of engine update, and wanting to use the objects acquired from that project immediately. Do not call this function unless you REALLY know what you're doing.

KANZI_API kzFloat kzuEngineGetAnimationPlayerTime ( const KzuEngine engine)

Get the current time from the engine special scrubbable animation player.

Returns
Current time in the main animation player or 0 if it does not exist.
KANZI_API void kzuEngineSetAnimationPlayerTime ( const KzuEngine engine,
kzFloat  time 
)

Sets the time to engine special scrubbable animation player.

Parameters
engineEngine to set the player time in.
timeTime to set.
KANZI_API kzsError kzuEngineCreateAnimationPlayer ( KzuEngine engine)

Create a new special, scrubbable animation player for the engine.

Will analyze the current screen and use appropriate prefab placeholder that would be linked to a time line sequence.

Parameters
engineEngine to create player in.
KANZI_API kanzi::LayerRenderpass* kzuEngineGetLayerComposer ( const struct KzuEngine engine)
KANZI_API struct KzuMessageDispatcher* kzuEngineGetMessageDispatcher ( const struct KzuEngine engine)
KANZI_API kanzi::Domain* kzuEngineGetUIDomain ( const struct KzuEngine engine)
KANZI_API struct KzuBinaryLoader* kzuEngineGetBinaryLoader ( const struct KzuEngine engine)
KANZI_API kanzi::ResourceManager* kzuEngineGetResourceManager ( const struct KzuEngine engine)
KANZI_API kanzi::Renderer* kzuEngineGetCoreRenderer ( const struct KzuEngine engine)
KANZI_API struct KzuTaskScheduler* kzuEngineGetTaskScheduler ( const struct KzuEngine engine)
KANZI_API kanzi::TransformedScene2D* kzuEngineGetLayerTransformedScene ( KzuEngine engine)
KANZI_API kzsError kzuEngineInitializeProjectTask ( struct KzuEngine engine,
const struct KzuPreviewProperties previewProperties,
kzBool  toolPresent 
)
KANZI_API kzsError kzuEngineUpdate1 ( struct KzuEngine engine,
kzUint  deltaTime,
const kanzi::RenderTarget renderTarget,
const struct KzuPreviewProperties previewProperties,
const struct KzuFPSConstraints fpsConstraints,
kzBool  toolPresent 
)

Updates engine.

KANZI_API kzsError kzuEngineUpdate2 ( struct KzuEngine engine,
kzUint  deltaTime,
const kanzi::RenderTarget renderTarget,
const struct KzuPreviewProperties previewProperties,
const struct KzuFPSConstraints fpsConstraints,
kzBool  toolPresent 
)
KANZI_API kzsError kzuEngineRenderFrame ( struct KzuEngine engine,
const kanzi::RenderTarget renderTarget,
bool  toolPresent 
)

Render a screen (usually containing root layer).

KANZI_API kzsError kzuEngineRenderAll ( struct KzuEngine engine,
const kanzi::RenderTarget renderTarget,
bool  toolPresent 
)

Render a screen (usually containing root layer).

KANZI_API kzsError kzuEnginePostRender ( const struct KzuEngine engine,
const kanzi::RenderTarget renderTarget 
)
KANZI_API kzsError kzuEngineHandleEvents ( KzuEngine engine,
KzsEventQueue *  eventQueue 
)
KANZI_API void kzuEngineSetControlDown ( const KzuEngine engine,
bool  isControlDown 
)
KANZI_API kzsError kzuEngineProjectReloaded ( const KzuEngine engine)
KANZI_API KzuPreviewSystem* kzuEngineGetPreviewSystem ( const KzuEngine engine)
KANZI_API kzsError kzuEngineSetScreen ( struct KzuEngine engine,
kanzi::ScreenSharedPtr  screen 
)

Sets screen of engine.

KANZI_API kanzi::ScreenSharedPtr kzuEngineGetScreen ( const struct KzuEngine engine)

Gets screen of engine.

KANZI_API kzsError kzuEngineSetScreenOrientation ( struct KzuEngine engine,
enum KzsWindowOrientation  orientation 
)

Sets the orientation of the screen.

KANZI_API void kzuEngineInvalidateScreenLayout ( struct KzuEngine engine)

Invalidates the layout of the attached screen.

KANZI_API kzsError kzuEngineInitializeGLContext ( struct KzuEngine engine)
KANZI_API kzsError kzuEngineUninitializeGLContext ( struct KzuEngine engine,
kzBool  temporary 
)
KANZI_API kzsError kzuEngineReloadProject ( struct KzuEngine engine,
kzUint  byteCount,
const kzByte bytes,
bool  isToolPresent 
)
KANZI_API kzsError kzuEngineReloadProjectFromFile ( struct KzuEngine engine,
kzString  binaryPath,
bool  isToolPresent 
)
KANZI_API kzsError kzuEngineReloadProjectFromFileResource ( struct KzuEngine engine,
kzString  resourceFile,
bool  isToolPresent 
)
KANZI_API kzsError kzuEnginePatchProject ( struct KzuEngine engine,
kzUint  byteCount,
const kzByte bytes 
)
KANZI_API kzsError kzuEnginePatchProjectFromFile ( const struct KzuEngine engine,
kzString  binaryPath 
)
KANZI_API kzsError kzuEnginePatchProjectFromFileResource ( const struct KzuEngine engine,
kzString  resourceFile 
)
KANZI_API kzsError kzuEngineInvalidateGPUResources ( const struct KzuEngine engine)
KANZI_API kzsError kzuEngineRestoreNodeResources ( const struct KzuEngine engine)
KANZI_API kzsError kzuEngineSetRootLayerAsync ( struct KzuEngine engine,
kanzi::Node2D layer 
)
KANZI_API kzsError kzuEngineRender ( struct KzuEngine engine,
const kanzi::RenderTarget renderTarget,
bool  isToolPresent 
)
KANZI_API kzsError kzuEngineEnablePreviewSystem ( KzuEngine engine)