You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
ADDED UE-14356 HLOD: Print user friendly message if you try build and meshes don't have have LODs ADDED MergeStaticMeshComponets to MeshUtilities needed for next CHANGE ADDED HLOD preview build step for maps, this only builds the clusters for previewing the settings ADDED SphereComponent now takes into account min and max drawing distances ADDED Global forward declares and removed local ones from HierarchicalLOD.h ADDED Visualization to LODActor class, uses USphereComponent to render its bounds ADDED IsPreviewActor flag to LODActor class, if true during cluster generation DrawSphereComponents bounds will be used instead of LODActor's ADDED vertex duplication removal on import ADDED vertex/index buffer cache optimization on import CHANGED World.h now forward declares HierarchicalLODBuilder to minimize (re)compile time CHANGED While building/merging actors HLOD system now takes the orginal staticmesh from previously merged LODActors, this to enable retrieving the correct LOD per mesh (related to UE-15398) CHANGED HLOD Cluster generation process, now takes into account HierarchicalLODVolumes to exclude actors from cluster generation CHANGED Renamed CalculateRawMeshTangents to ExtractMeshDataForGeometryCache FIXED Crash where a nullptr actor was added to actors list for > LOD0 clusters FIXED Bound creation for actor within a cluster used FVector.Size(), now used FVector.AbsMax() MOVED FLODCLuster structure into seperate header and cpp file [CL 2617884 by Jurre DeBaare in Main branch]
249 lines
8.4 KiB
C++
249 lines
8.4 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "ModuleInterface.h"
|
|
|
|
/**
|
|
* Mesh reduction interface.
|
|
*/
|
|
class IMeshReduction
|
|
{
|
|
public:
|
|
/**
|
|
* Reduces the raw mesh using the provided reduction settings.
|
|
* @param OutReducedMesh - Upon return contains the reduced mesh.
|
|
* @param OutMaxDeviation - Upon return contains the maximum distance by which the reduced mesh deviates from the original.
|
|
* @param InMesh - The mesh to reduce.
|
|
* @param ReductionSettings - Setting with which to reduce the mesh.
|
|
*/
|
|
virtual void Reduce(
|
|
struct FRawMesh& OutReducedMesh,
|
|
float& OutMaxDeviation,
|
|
const struct FRawMesh& InMesh,
|
|
const struct FMeshReductionSettings& ReductionSettings
|
|
) = 0;
|
|
/**
|
|
* Reduces the provided skeletal mesh.
|
|
* @returns true if reduction was successful.
|
|
*/
|
|
virtual bool ReduceSkeletalMesh(
|
|
class USkeletalMesh* SkeletalMesh,
|
|
int32 LODIndex,
|
|
const struct FSkeletalMeshOptimizationSettings& Settings,
|
|
bool bCalcLODDistance
|
|
) = 0;
|
|
/**
|
|
* Returns a unique string identifying both the reduction plugin itself and the version of the plugin.
|
|
*/
|
|
virtual const FString& GetVersionString() const = 0;
|
|
|
|
/**
|
|
* Returns true if mesh reduction is supported
|
|
*/
|
|
virtual bool IsSupported() const = 0;
|
|
};
|
|
|
|
struct FFlattenMaterial;
|
|
|
|
/**
|
|
* Mesh merging interface.
|
|
*/
|
|
class IMeshMerging
|
|
{
|
|
public:
|
|
virtual void BuildProxy(
|
|
const TArray<FRawMesh>& InputMeshes,
|
|
const TArray<FFlattenMaterial>& InputMaterials,
|
|
const struct FMeshProxySettings& InProxySettings,
|
|
FRawMesh& OutProxyMesh,
|
|
FFlattenMaterial& OutMaterial
|
|
) = 0;
|
|
};
|
|
|
|
|
|
/**
|
|
* Mesh reduction module interface.
|
|
*/
|
|
class IMeshReductionModule : public IModuleInterface
|
|
{
|
|
public:
|
|
/**
|
|
* Retrieve the mesh reduction interface.
|
|
*/
|
|
virtual class IMeshReduction* GetMeshReductionInterface() = 0;
|
|
|
|
/**
|
|
* Retrieve the mesh merging interface.
|
|
*/
|
|
virtual class IMeshMerging* GetMeshMergingInterface() = 0;
|
|
};
|
|
|
|
class IMeshUtilities : public IModuleInterface
|
|
{
|
|
public:
|
|
/** Returns a string uniquely identifying this version of mesh utilities. */
|
|
virtual const FString& GetVersionString() const = 0;
|
|
|
|
/**
|
|
* Builds a renderable static mesh using the provided source models and the LOD groups settings.
|
|
* @returns true if the renderable mesh was built successfully.
|
|
*/
|
|
virtual bool BuildStaticMesh(
|
|
class FStaticMeshRenderData& OutRenderData,
|
|
TArray<struct FStaticMeshSourceModel>& SourceModels,
|
|
const class FStaticMeshLODGroup& LODGroup
|
|
) = 0;
|
|
|
|
/**
|
|
* Builds a static mesh using the provided source models and the LOD groups settings, and replaces
|
|
* the RawMeshes with the reduced meshes. Does not modify renderable data.
|
|
* @returns true if the meshes were built successfully.
|
|
*/
|
|
virtual bool GenerateStaticMeshLODs(
|
|
TArray<struct FStaticMeshSourceModel>& Models,
|
|
const class FStaticMeshLODGroup& LODGroup
|
|
) = 0;
|
|
|
|
/** Builds a signed distance field volume for the given LODModel. */
|
|
virtual void GenerateSignedDistanceFieldVolumeData(
|
|
const FStaticMeshLODResources& LODModel,
|
|
class FQueuedThreadPool& ThreadPool,
|
|
const TArray<EBlendMode>& MaterialBlendModes,
|
|
const FBoxSphereBounds& Bounds,
|
|
float DistanceFieldResolutionScale,
|
|
bool bGenerateAsIfTwoSided,
|
|
class FDistanceFieldVolumeData& OutData) = 0;
|
|
|
|
/**
|
|
* Create all render specific data for a skeletal mesh LOD model
|
|
* @returns true if the mesh was built successfully.
|
|
*/
|
|
virtual bool BuildSkeletalMesh(
|
|
FStaticLODModel& LODModel,
|
|
const FReferenceSkeleton& RefSkeleton,
|
|
const TArray<FVertInfluence>& Influences,
|
|
const TArray<FMeshWedge>& Wedges,
|
|
const TArray<FMeshFace>& Faces,
|
|
const TArray<FVector>& Points,
|
|
const TArray<int32>& PointToOriginalMap,
|
|
bool bKeepOverlappingVertices = false,
|
|
bool bComputeNormals = true,
|
|
bool bComputeTangents = true,
|
|
TArray<FText> * OutWarningMessages = NULL,
|
|
TArray<FName> * OutWarningNames = NULL
|
|
) = 0;
|
|
|
|
/** Returns the mesh reduction plugin if available. */
|
|
virtual IMeshReduction* GetMeshReductionInterface() = 0;
|
|
|
|
/** Returns the mesh merging plugin if available. */
|
|
virtual IMeshMerging* GetMeshMergingInterface() = 0;
|
|
|
|
/** Cache optimize the index buffer. */
|
|
virtual void CacheOptimizeIndexBuffer(TArray<uint16>& Indices) = 0;
|
|
|
|
/** Cache optimize the index buffer. */
|
|
virtual void CacheOptimizeIndexBuffer(TArray<uint32>& Indices) = 0;
|
|
|
|
/** Build adjacency information for the skeletal mesh used for tessellation. */
|
|
virtual void BuildSkeletalAdjacencyIndexBuffer(
|
|
const TArray<struct FSoftSkinVertex>& VertexBuffer,
|
|
const uint32 TexCoordCount,
|
|
const TArray<uint32>& Indices,
|
|
TArray<uint32>& OutPnAenIndices
|
|
) = 0;
|
|
|
|
|
|
virtual void RechunkSkeletalMeshModels(USkeletalMesh* SrcMesh, int32 MaxBonesPerChunk) = 0;
|
|
|
|
/**
|
|
* Calculate the verts associated weighted to each bone of the skeleton.
|
|
* The vertices returned are in the local space of the bone.
|
|
*
|
|
* @param SkeletalMesh The target skeletal mesh.
|
|
* @param Infos The output array of vertices associated with each bone.
|
|
* @param bOnlyDominant Controls whether a vertex is added to the info for a bone if it is most controlled by that bone, or if that bone has ANY influence on that vert.
|
|
*/
|
|
virtual void CalcBoneVertInfos( USkeletalMesh* SkeletalMesh, TArray<FBoneVertInfo>& Infos, bool bOnlyDominant) = 0;
|
|
|
|
/**
|
|
* Harvest static mesh components from input actors
|
|
* and merge into signle mesh grouping them by unique materials
|
|
*
|
|
* @param SourceActors List of actors to merge
|
|
* @param InSettings Settings to use
|
|
* @param InOuter Outer if required
|
|
* @param InBasePackageName Destination package name for a generated assets. Used if Outer is null.
|
|
* @param UseLOD -1 if you'd like to build for all LODs. If you specify, that LOD mesh for source meshes will be used to merge the mesh
|
|
* This is used by hierarchical building LODs
|
|
* @param OutAssetsToSync Merged mesh assets
|
|
* @param OutMergedActorLocation World position of merged mesh
|
|
*/
|
|
virtual void MergeActors(
|
|
const TArray<AActor*>& SourceActors,
|
|
const FMeshMergingSettings& InSettings,
|
|
UPackage* InOuter,
|
|
const FString& InBasePackageName,
|
|
int32 UseLOD, // does not build all LODs but only use this LOD to create base mesh
|
|
TArray<UObject*>& OutAssetsToSync,
|
|
FVector& OutMergedActorLocation,
|
|
bool bSilent=false) const = 0;
|
|
|
|
/**
|
|
* MergeStaticMeshComponents
|
|
*
|
|
* @param ComponentsToMerge - Components to merge
|
|
* @param World - World in which the component reside
|
|
* @param InSettings - Settings to use
|
|
* @param InOuter - Outer if required
|
|
* @param InBasePackageName - Destination package name for a generated assets. Used if Outer is null.
|
|
* @param UseLOD -1 if you'd like to build for all LODs. If you specify, that LOD mesh for source meshes will be used to merge the mesh
|
|
* This is used by hierarchical building LODs
|
|
* @param OutAssetsToSync Merged mesh assets
|
|
* @param OutMergedActorLocation World position of merged mesh
|
|
* @param ViewDistance Distance for LOD determination
|
|
* @param bSilent Non-verbose flag
|
|
* @return void
|
|
*/
|
|
virtual void MergeStaticMeshComponents(
|
|
const TArray<UStaticMeshComponent*>& ComponentsToMerge,
|
|
UWorld* World,
|
|
const FMeshMergingSettings& InSettings,
|
|
UPackage* InOuter,
|
|
const FString& InBasePackageName,
|
|
int32 UseLOD, /* does not build all LODs but only use this LOD to create base mesh */
|
|
TArray<UObject*>& OutAssetsToSync,
|
|
FVector& OutMergedActorLocation,
|
|
float ViewDistance,
|
|
bool bSilent /*= false*/) const = 0;
|
|
|
|
/**
|
|
* Merges list of actors into single proxy mesh
|
|
*
|
|
* @param Actors List of Actors to merge
|
|
* @param InProxySettings Merge settings
|
|
* @param InOuter Package for a generated assets, if NULL new packages will be created for each asset
|
|
* @param ProxyBasePackageName Will be used for naming generated assets, in case InOuter is not specified ProxyBasePackageName will be used as long package name for creating new packages
|
|
* @param OutAssetsToSync Result assets - mesh, material
|
|
* @param OutProxyLocation Proxy mesh location in the world (bounding box origin of merged actors)
|
|
*/
|
|
virtual void CreateProxyMesh(
|
|
const TArray<AActor*>& Actors,
|
|
const struct FMeshProxySettings& InProxySettings,
|
|
UPackage* InOuter,
|
|
const FString& ProxyBasePackageName,
|
|
TArray<UObject*>& OutAssetsToSync,
|
|
FVector& OutProxyLocation
|
|
) = 0;
|
|
|
|
/**
|
|
* CalculateRawMeshTangents
|
|
*
|
|
* @param OutRawMesh - InOut raw Mesh for calculating tangents
|
|
* @return void
|
|
*/
|
|
virtual void CalculateRawMeshTangents(FRawMesh& OutRawMesh, const FMeshBuildSettings& BuildSettings) = 0;
|
|
|
|
};
|