So are there any good tutorials or information on setting this up in C++?
I was looking at setting it up. For a single part like the ClearRenderTarget2D node the KismetRenderingLibrary calls an ENQUEUE_RENDER_COMMAND
Specifically in KismetRenderingLibrary.cpp
void UKismetRenderingLibrary::ClearRenderTarget2D(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, FLinearColor ClearColor)
{
check(WorldContextObject);
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject);
if (TextureRenderTarget
&& TextureRenderTarget->Resource
&& World)
{
FTextureRenderTargetResource* RenderTargetResource = TextureRenderTarget->GameThread_GetRenderTargetResource();
ENQUEUE_RENDER_COMMAND(ClearRTCommand)(
[RenderTargetResource, ClearColor](FRHICommandList& RHICmdList)
{
SetRenderTarget(RHICmdList, RenderTargetResource->GetRenderTargetTexture(), FTextureRHIRef(), true);
DrawClearQuad(RHICmdList, GMaxRHIFeatureLevel, ClearColor);
});
}
}
In other parts of my project I am using an ENQUEUE_UNIQUE_RENDER_COMMAND_FOURPARAMETER in order to grab data from VRAM and it works very nicely. I have all the appropriate includes and dependencies setup. For this I cannot seem to get it to work though. I have looked through and added all the possible header files that might do something but always get back to the DrawClearQuad being an unresolved external symbol.
I know previously the Kismet libraries didn’t have their symbols exported and I’m wondering if there is something I need to dig up and find to make this work.
I’m looking to do basically what they do in the content creation example of the BlueprintRenderToTarget Level
static ENGINE_API UTextureRenderTarget2D* CreateRenderTarget2D(UObject* WorldContextObject, int32 Width = 256, int32 Height = 256);
static ENGINE_API void DrawMaterialToRenderTarget(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, UMaterialInterface* Material);
static ENGINE_API void BeginDrawCanvasToRenderTarget(UObject* WorldContextObject, UTextureRenderTarget2D* TextureRenderTarget, UCanvas*& Canvas, FVector2D& Size, FDrawToRenderTargetContext& Context);
static ENGINE_API void EndDrawCanvasToRenderTarget(UObject* WorldContextObject, const FDrawToRenderTargetContext& Context);
and from the Canvas.h the
void K2_DrawMaterial(UMaterialInterface* RenderMaterial, FVector2D ScreenPosition, FVector2D ScreenSize, FVector2D CoordinatePosition, FVector2D CoordinateSize=FVector2D::UnitVector, float Rotation=0.f, FVector2D PivotPoint=FVector2D(0.5f,0.5f));
Any thoughts?