Hi Guys,
I’m currently creating a ocean plane mesh with LOD like the NVIDIA demo in 2008 in c++ with the hope of
digging into unreal engine rendering system,
Using information from Generate Procedural Mesh - C++ - Epic Developer Community Forums to generate a plane for the ocean surface.
I’m at the part where in the NVIDIA demo code, it do the d3d11Context->DrawIndexed() call
AFAIK the same call can be done in Unreal Engine with, DrawIndexedPrimitiveUP(), but I can’t seem to locate the first parameter to pass, which is a RHICmdList
Here’s my code,
//Declarations
class FOceanMeshVertexBuffer : public FVertexBuffer
{
public:
TArray<FVector> Vertices;
virtual void InitRHI() override;
};
class FOceanMeshIndexBuffer : public FIndexBuffer
{
public:
TArray<unsigned long> Indices;
virtual void InitRHI() override;
};
////////
void FOceanMeshSceneProxy::DrawDynamicElements(FPrimitiveDrawInterface* PDI, const FSceneView* View)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_GeneratedMeshSceneProxy_DrawDynamicElements);
const bool bWireframe = AllowDebugViewmodes() && View->Family->EngineShowFlags.Wireframe;
FColoredMaterialRenderProxy WireframeMaterialInstance(
GEngine->WireframeMaterial ? GEngine->WireframeMaterial->GetRenderProxy(IsSelected()) : NULL,
FLinearColor(0, 0.5f, 1.f)
);
DrawIndexedPrimitiveUP(RHICmdList, PT_TriangleList, 0, VertexBuffer.Vertices.Num(), IndexBuffer.Indices.Num() / 3, IndexBuffer, sizeof(unsigned long), VertexBuffer, sizeof(FVector)); //can't do it here, can't find the RHICmdList
}
What I’m wondering is where do I should do the DrawIndexedPrimitiveUP call? I think what I did there is safe since it happens on RenderThread (I checked on visual studio threads window).
Comments from Unreal Dev would be really helpful, so I could know if what I did is “the right way to do it” in unreal.
Thanks!