100 lines
3.6 KiB
C++
100 lines
3.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Engine/Brush.h"
|
|
|
|
class UWorld;
|
|
class UModel;
|
|
class UMaterialInterface;
|
|
class FPoly;
|
|
|
|
|
|
class BSPUTILS_API FBSPUtils
|
|
{
|
|
public:
|
|
/** Repartition Bsp tree */
|
|
static void bspRepartition( UWorld* InWorld, int32 iNode );
|
|
|
|
/** Convert a Bsp node to an EdPoly. Returns number of vertices in Bsp node. */
|
|
static int32 bspNodeToFPoly( UModel* Model, int32 iNode, FPoly* EdPoly );
|
|
|
|
/**
|
|
* Clean up all nodes after a CSG operation. Resets temporary bit flags and unlinks
|
|
* empty leaves. Removes zero-vertex nodes which have nonzero-vertex coplanars.
|
|
*/
|
|
static void bspCleanup( UModel* Model );
|
|
|
|
/**
|
|
* Build EdPoly list from a model's Bsp. Not transactional.
|
|
* @param DestArray helps build bsp FPolys in non-main threads. It also allows to perform this action without GUndo
|
|
* interfering. Temporary results will be written to DestArray. Defaults to Model->Polys->Element
|
|
*/
|
|
static void bspBuildFPolys( UModel* Model, bool SurfLinks, int32 iNode, TArray<FPoly>* DestArray = NULL );
|
|
|
|
static void bspMergeCoplanars( UModel* Model, bool RemapLinks, bool MergeDisparateTextures );
|
|
|
|
/**
|
|
* Performs any CSG operation between the brush and the world.
|
|
*/
|
|
static int32 bspBrushCSG( ABrush* Actor, UModel* Model, UModel* TempModel, UMaterialInterface* SelectedMaterialInstance, uint32 PolyFlags, EBrushType BrushType, ECsgOper CSGOper, bool bBuildBounds, bool bMergePolys, bool bReplaceNULLMaterialRefs, bool bShowProgressBar=true );
|
|
|
|
/**
|
|
* Optimize a level's Bsp, eliminating T-joints where possible, and building side
|
|
* links. This does not always do a 100% perfect job, mainly due to imperfect
|
|
* levels, however it should never fail or return incorrect results.
|
|
*/
|
|
static void bspOptGeom( UModel* Model );
|
|
|
|
/**
|
|
* Sets and clears all Bsp node flags. Affects all nodes, even ones that don't
|
|
* really exist.
|
|
*/
|
|
static void polySetAndClearPolyFlags(UModel *Model, uint32 SetBits, uint32 ClearBits,bool SelectedOnly, bool UpdateBrush);
|
|
|
|
/**
|
|
*
|
|
* Find the Brush EdPoly corresponding to a given Bsp surface.
|
|
*
|
|
* @param InModel Model to get poly from
|
|
* @param iSurf surface index
|
|
* @param Poly
|
|
*
|
|
* returns true if poly not available
|
|
*/
|
|
static bool polyFindBrush(UModel* InModel, int32 iSurf, FPoly &Poly);
|
|
|
|
UE_DEPRECATED(5.1, "polyFindMaster is deprecated; please use polyFindBrush instead")
|
|
static bool polyFindMaster(UModel* InModel, int32 iSurf, FPoly &Poly);
|
|
|
|
/**
|
|
* Update the brush EdPoly corresponding to a newly-changed
|
|
* poly to reflect its new properties.
|
|
*
|
|
* Doesn't do any transaction tracking.
|
|
*/
|
|
static void polyUpdateBrush(UModel* Model, int32 iSurf, bool bUpdateTexCoords, bool bOnlyRefreshSurfaceMaterials);
|
|
|
|
UE_DEPRECATED(5.1, "polyUpdateMaster is deprecated; please use polyUpdateBrush instead")
|
|
static void polyUpdateMaster(UModel* Model, int32 iSurf, bool bUpdateTexCoords, bool bOnlyRefreshSurfaceMaterials);
|
|
|
|
/**
|
|
* Populates a list with all polys that are linked to the specified poly. The
|
|
* resulting list includes the original poly.
|
|
*/
|
|
static void polyGetLinkedPolys(ABrush* InBrush, FPoly* InPoly, TArray<FPoly>* InPolyList);
|
|
|
|
/**
|
|
* Takes a list of polygons and creates a new list of polys which have no overlapping edges. It splits
|
|
* edges as necessary to achieve this.
|
|
*/
|
|
static void polySplitOverlappingEdges( TArray<FPoly>* InPolyList, TArray<FPoly>* InResult );
|
|
|
|
/**
|
|
* Takes a list of polygons and returns a list of the outside edges (edges which are not shared
|
|
* by other polys in the list).
|
|
*/
|
|
static void polyGetOuterEdgeList(TArray<FPoly>* InPolyList, TArray<FEdge>* InEdgeList);
|
|
};
|