// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #ifdef USE_OPENMODEL #include "OpenModelUtils.h" #include "CADModelToCADKernelConverterBase.h" #include "Core/Session.h" #include "Core/Types.h" class AlDagNode; class AlShell; class AlSurface; class AlTrimBoundary; class AlTrimCurve; class AlTrimRegion; namespace UE::CADKernel { class FShell; class FSurface; class FTopologicalEdge; class FTopologicalFace; class FTopologicalLoop; } namespace UE_DATASMITHWIRETRANSLATOR_NAMESPACE { class FAliasModelToCADKernelConverter : public FCADModelToCADKernelConverterBase { public: FAliasModelToCADKernelConverter(const FDatasmithTessellationOptions& Options, CADLibrary::FImportParameters InImportParameters); // Begin FCADModelToCADKernelConverterBase overrides virtual bool Tessellate(const CADLibrary::FMeshParameters& InMeshParameters, FMeshDescription& OutMeshDescription) override; virtual bool RepairTopology() override; virtual bool AddGeometry(const CADLibrary::FCADModelGeometry& Geometry) override; // End FCADModelToCADKernelConverterBase overrides bool AddBRep(const FAlDagNodePtr& DagNode, const FColor& Color, EAliasObjectReference ObjectReference); bool AddBRep(const FAlDagNodePtr& DagNode, uint32 SlotID, EAliasObjectReference ObjectReference); protected: TSharedPtr AddEdge(const AlTrimCurve& TrimCurve, TSharedPtr& CarrierSurface); TSharedPtr AddLoop(const AlTrimBoundary& TrimBoundary, TSharedPtr& CarrierSurface, const bool bIsExternal); /** * Build face's links with its neighbor have to be done after the loop is finalize. * This is to avoid to link an edge with another and then to delete it... */ void LinkEdgesLoop(const AlTrimBoundary& TrimBoundary, UE::CADKernel::FTopologicalLoop& Loop); TSharedPtr AddTrimRegion(const AlTrimRegion& InTrimRegion, EAliasObjectReference InObjectReference, const AlMatrix4x4& InAlMatrix, bool bInOrientation); void AddFace(const AlSurface& InSurface, EAliasObjectReference InObjectReference, const AlMatrix4x4& InAlMatrix, bool bInOrientation, TSharedRef& Shell); void AddShell(const AlShell& InShell, EAliasObjectReference InObjectReference, const AlMatrix4x4& InAlMatrix, bool bInOrientation, TSharedRef& Shell); protected: int32 LastFaceId = 1; TMap> AlEdge2CADKernelEdge; }; } #endif