UFUNCTION(blueprintCallable, Category = "Mybpf")
static void DrawVtx(UPARAM(ref) FPaintContext& Context,
FWidgetTransform InTransform,
USlateBrushAsset* Brush,
TArray<FVector2f> Vertexs,
TArray<int> Indexs
)
{
TArray<FSlateVertex> vertexs;
TArray<SlateIndex> indexs;
auto RenderTransform = InTransform.ToSlateRenderTransform();
for (auto vtx : Vertexs)
{
vertexs.Add(
FSlateVertex::Make<ESlateVertexRounding::Disabled>(RenderTransform, vtx, FVector2f(),FColor(1,1,1,1))
);
}
for (auto idx : Indexs)
{
indexs.Add(idx);
}
FSlateResourceHandle handle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(Brush->Brush);
Context.MaxLayer++;
FSlateDrawElement::MakeCustomVerts( Context.OutDrawElements,Context.MaxLayer,handle,vertexs,indexs,nullptr,0,0);
}