class Viewport

Viewport determines to which RenderTarget should rendering be performed.

It allows you to render to a sub-region of the target by specifying the area rectangle, and allows you to set up color/depth/stencil clear values for that specific region.

Public

Methods

SetTarget

void SetTarget(const SPtr<RenderTarget> &target)

Determines the render target the viewport is associated with.

GetTarget

SPtr<RenderTarget> GetTarget() const

staticCreate

static SPtr<Viewport> Create(const SPtr<RenderTarget> &target, float x = 0.F, float y = 0.F, float width = 1.F, float height = 1.F)

Creates a new viewport.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

~TViewport<IsRenderProxy>

virtual ~TViewport<IsRenderProxy>() = default

Protected

Constructors

Viewport

Viewport(const SPtr<RenderTarget> &target, float x = 0.F, float y = 0.F, float width = 1.F, float height = 1.F)

Viewport

Viewport() = default

*********************************************************************

Methods

MarkRenderProxyDataDirtyInternal

void MarkRenderProxyDataDirtyInternal() override

Marks the render proxy data as dirty.

This causes the data from the main thread object be synced with the render thread version of the object.

GetTargetWidth

u32 GetTargetWidth() const override

Gets the render target width.

GetTargetHeight

u32 GetTargetHeight() const override

Gets the render target width.

CreateRenderProxySyncPacket

RenderProxySyncPacket *CreateRenderProxySyncPacket(FrameAllocator &allocator, u32 flags) override

Creates a data packet that will be used for syncing the core object with it's render proxy.

Caller must free the retrieved packet using the provided allocator when done using it.

GetCoreDependencies

void GetCoreDependencies(Vector<CoreObject *> &dependencies) override

Populates the provided array with all core objects that this core object depends upon.

Dependencies are required for syncing to the render thread, so the system can be aware to update the dependant objects if a dependency is marked as dirty (for example updating a camera's viewport should also trigger an update on camera so it has a chance to potentially update its data).

CreateRenderProxy

SPtr<render::RenderProxy> CreateRenderProxy() const override

Creates an object that contains render thread specific data and methods for this object.

Can be null if such object is not required.

staticCreateEmpty

static SPtr<Viewport> CreateEmpty()

Creates an empty viewport for serialization purposes.

Fields

mTarget

SPtr<RenderTargetType> mTarget