UE4笔记-RHI相关
关于C++上的RHI应用的相关笔记记录:
Q.UE4读取当前视口屏幕(Camera)的像素数组:
参考
FRenderTarget::ReadPixels
对ENQUEUE_RENDER_COMMAND和ReadSurfaceData的使用
if(InRect == FIntRect(0, 0, 0, 0)) { InRect = FIntRect(0, 0, GetSizeXY().X, GetSizeXY().Y); } // Read the render target surface data back. struct FReadSurfaceContext { FRenderTarget* SrcRenderTarget; TArray<FColor>* OutData; FIntRect Rect; FReadSurfaceDataFlags Flags; }; OutImageData.Reset(); FReadSurfaceContext Context = { this, &OutImageData, InRect, InFlags }; ENQUEUE_RENDER_COMMAND(ReadSurfaceCommand)( [Context](FRHICommandListImmediate& RHICmdList) { RHICmdList.ReadSurfaceData( Context.SrcRenderTarget->GetRenderTargetTexture(), Context.Rect, *Context.OutData, Context.Flags ); }); FlushRenderingCommands(); return OutImageData.Num() > 0;
本文原创,不定时更新
可以随意转载到任何网站
~但是~ 转载也要按“基本法”
请注明原文出处和作者