#include <rendertowindowcomponent.h>
Public Member Functions | |
| RenderToWindowComponentInstance (EntityInstance &entity, Component &resource) | |
| bool | init (utility::ErrorState &errorState) override |
| MaterialInstance & | getMaterialInstance () |
| const MaterialInstance & | getMaterialInstance () const |
| void | draw () |
| bool | isSupported (nap::CameraComponentInstance &camera) const override |
| RenderToWindowComponent::EScaleMode | getMode () const |
| void | setMode (RenderToWindowComponent::EScaleMode mode) |
| glm::vec2 | getRatio () const |
| void | setRatio (const glm::vec2 &ratio) |
Public Member Functions inherited from RenderableComponentInstance | |
| RenderableComponentInstance (EntityInstance &entity, Component &resource) | |
| void | draw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix) |
| void | setVisible (bool visible) |
| bool | isVisible () const |
| const std::vector< ResourcePtr< RenderTag > > & | getTags () const |
| RenderMask | getMask () const |
| bool | includesMask (RenderMask otherMask) |
| int | getRank () const |
| const RenderLayer * | getLayer () const |
Public Member Functions inherited from ComponentInstance | |
| ComponentInstance (EntityInstance &entity, Component &resource) | |
| virtual void | update (double deltaTime) |
| nap::EntityInstance * | getEntityInstance () const |
| nap::Component * | getComponent () const |
| template<typename T > | |
| T * | getComponent () const |
| virtual bool | init (utility::ErrorState &errorState) |
Public Member Functions inherited from Object | |
| Object () | |
| virtual | ~Object () |
| virtual void | onDestroy () |
| Object (Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object (Object &&)=delete | |
| Object & | operator= (Object &&)=delete |
Protected Member Functions | |
| void | onDraw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix) override |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Public Attributes inherited from Object | |
| std::string | mID |
| Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Protected Attributes inherited from RenderableComponentInstance | |
| RenderService * | mRenderService = nullptr |
Renders a plane directly to a window using a custom material, centering and scaling it based on the selected mode. Use this component to, for example, present the output of a render-pass to screen.
Simply declare the component in json and call RenderToWindowComponent::draw() in the render part of your application. This component manages its own nap::PlaneMesh to render with, you only have to provide it with a material.
This component expects a material with a shader that contains both a model and projection matrix uniform. The view matrix uniform is optional. It will be set if found, otherwise bypassed. If you don't care about view space (camera) transformation, don't declare it.
| RenderToWindowComponentInstance | ( | EntityInstance & | entity, |
| Component & | resource | ||
| ) |
| void draw | ( | ) |
Renders directly to the window using a custom material, without having to define a mesh. Call this in your application render() call -> the result is rendered into the given window. This call starts and stops the render operation, you can't render anything else to the window after it's done. Alternatively, you can use the render service to render this component, see onDraw()
| MaterialInstance& getMaterialInstance | ( | ) |
| const MaterialInstance& getMaterialInstance | ( | ) | const |
| RenderToWindowComponent::EScaleMode getMode | ( | ) | const |
| glm::vec2 getRatio | ( | ) | const |
Returns current canvas scaling ratio.
|
overridevirtual |
Initialize the component
| errorState | holds the error message when initialization fails |
Reimplemented from RenderableComponentInstance.
|
overridevirtual |
Only orthographic cameras are supported.
Reimplemented from RenderableComponentInstance.
|
overrideprotectedvirtual |
Draws full screen to the currently active render window, when the view matrix = identity.
| renderTarget | the target to render to. |
| commandBuffer | the currently active command buffer. |
| viewMatrix | often the camera world space location |
| projectionMatrix | often the camera projection matrix |
Implements RenderableComponentInstance.
| void setMode | ( | RenderToWindowComponent::EScaleMode | mode | ) |
Set current canvas scaling mode
| mode | canvas scaling mode |
| void setRatio | ( | const glm::vec2 & | ratio | ) |
Set and use custom canvas scaling ratio.
| ratio | new canvas scaling ratio |