NAP
Public Member Functions | Protected Member Functions | List of all members
RenderVideoComponentInstance Class Reference

#include <rendervideocomponent.h>

Public Member Functions

 RenderVideoComponentInstance (EntityInstance &entity, Component &resource)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual bool isSupported (nap::CameraComponentInstance &camera) const override
 
Texture2DgetOutputTexture ()
 
void draw ()
 
- 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 RenderLayergetLayer () const
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
virtual void update (double deltaTime)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () 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
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Protected Member Functions

virtual 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
RenderServicemRenderService = nullptr
 

Description

Renders the output of a nap::VideoPlayer directly to texture without having to define a render target, shader or mesh. This components converts the YUV textures, generated by the nap::VideoPlayer, into an RGB texture. Call draw() in your application render() call, in between nap::RenderService::beginHeadlessRecording() and nap::RenderService::endHeadlessRecording(). The video frame is scaled to fit the dimensions of the given output texture. It is still possible to render this component using the render service, although only orthographic cameras are supported.

Inheritance diagram for RenderVideoComponentInstance:
[legend]
Collaboration diagram for RenderVideoComponentInstance:
[legend]

Constructor & Destructor Documentation

◆ RenderVideoComponentInstance()

RenderVideoComponentInstance ( EntityInstance entity,
Component resource 
)

Member Function Documentation

◆ draw()

void draw ( )

Renders the output of a nap::VideoPlayer directly to texture. This components converts the YUV textures, generated by the nap::VideoPlayer, into an RGB texture. Call this in your application render() call, in between nap::RenderService::beginHeadlessRecording() and nap::RenderService::endHeadlessRecording(). Do not call this function outside of a headless recording pass, ie: when rendering to a window. Alternatively, you can use the render service to render this component, see onDraw()

◆ getOutputTexture()

Texture2D& getOutputTexture ( )

Returns the rendered RGB video texture.

Returns
the rendered RGB video texture.

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initializes the component based on resource.

Parameters
errorStatecontains the error if initialization fails.
Returns
if initialization succeeded.

Reimplemented from RenderableComponentInstance.

◆ isSupported()

virtual bool isSupported ( nap::CameraComponentInstance camera) const
overridevirtual

Called by the Render Service. Only orthographic cameras are supported.

Reimplemented from RenderableComponentInstance.

◆ onDraw()

virtual void onDraw ( IRenderTarget renderTarget,
VkCommandBuffer  commandBuffer,
const glm::mat4 &  viewMatrix,
const glm::mat4 &  projectionMatrix 
)
overrideprotectedvirtual

Draws the video frame full screen to the currently active render target, when the view matrix = identity.

Parameters
renderTargetthe target to render to.
commandBufferthe currently active command buffer.
viewMatrixoften the camera world space location
projectionMatrixoften the camera projection matrix

Implements RenderableComponentInstance.