Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Physics/PhysicsDataCollection.h

85 lines
2.4 KiB
C
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ShapeApproximation/SimpleShapeSet3.h"
#include "Engine/StaticMesh.h"
#include "PhysicsEngine/AggregateGeom.h"
class UActorComponent;
class UBodySetup;
/**
* FPhysicsDataCollection holds onto physics-system data that is needed for various interactive tools and algorithms.
* Currently this is split into two parts, pointers to the owning physics state, and collision geometry data.
*
* The collision geometry data is stored in both the editable GeometryProcessing format and the
* physics-system representations (currently FKAggregateGeom but more are expected).
* This class provides a high-level API for transferring geometry between these two representations.
*/
class MODELINGCOMPONENTS_API FPhysicsDataCollection
{
public:
//
// External State Data
//
/** The Component this physics data came from / is for */
TWeakObjectPtr<const UActorComponent> SourceComponent;
GeometryProcessing improvements/additions - new correspondence-finding strategy in FMeshImageBakingCache. Added a global Thickness parameter, and now preferentially uses the ray-hit found by casting inwards from Point+Thickness*Normal. This handles the cases where a greeble/etc is just layered on top of base mesh. These kind of mesh elements are only intended to show up in the normal map, so they aren't stitched in. - expose Thickness and World-Space options in BakeMeshAttributeMapsTool - initialize image in Normal and ResampleImage Bakers, otherwise initial value is garbage - add TSampledScalarField2::BilinearSampleGradientClamped and fix typo in BilinearSampleClamped() that resulted in incorrect interpolation - add Texture2DUtil, contains functions for reading a TImageBuilder from a UTexture2D. Can read from source data if available. - ColorConstants now returns white for group 0 - add double version of FMeshDescriptionToDynamicMesh::CopyTangents() - add support for computing on subset of vertiecs in FMeshConvexHull - fix up template export in TMeshTangents - make mesh const in TImplicitMorphology, TImplicitSolidify - accessor/etc additions in TDenseGrid2, TImageBuilder, TSampledScalarField2, TIndexedWeightMap - add source UStaticMesh reference in FPhysicsDataCollection, function to initialize from a UStaticMesh - update Tools affected by above changes - add TSampleSetStatisticBuilder::ComputeMultiPass() helper function to compute stats for iterable collections in one line - remove dead code in UVLayoutOp.cpp #rb tyson.brochu #rnx #jira none [CL 14769759 by Ryan Schmidt in ue5-main branch]
2020-11-17 22:32:38 -04:00
/** The StaticMesh this physics data came from / is for */
TWeakObjectPtr<const UStaticMesh> SourceStaticMesh;
/** The BodySetup in use by the SourceComponent */
TWeakObjectPtr<const UBodySetup> BodySetup;
/** Scaling factor applied to the SourceComponent, which should be transferred to Collision Geometry in some cases */
GeometryProcessing improvements/additions - new correspondence-finding strategy in FMeshImageBakingCache. Added a global Thickness parameter, and now preferentially uses the ray-hit found by casting inwards from Point+Thickness*Normal. This handles the cases where a greeble/etc is just layered on top of base mesh. These kind of mesh elements are only intended to show up in the normal map, so they aren't stitched in. - expose Thickness and World-Space options in BakeMeshAttributeMapsTool - initialize image in Normal and ResampleImage Bakers, otherwise initial value is garbage - add TSampledScalarField2::BilinearSampleGradientClamped and fix typo in BilinearSampleClamped() that resulted in incorrect interpolation - add Texture2DUtil, contains functions for reading a TImageBuilder from a UTexture2D. Can read from source data if available. - ColorConstants now returns white for group 0 - add double version of FMeshDescriptionToDynamicMesh::CopyTangents() - add support for computing on subset of vertiecs in FMeshConvexHull - fix up template export in TMeshTangents - make mesh const in TImplicitMorphology, TImplicitSolidify - accessor/etc additions in TDenseGrid2, TImageBuilder, TSampledScalarField2, TIndexedWeightMap - add source UStaticMesh reference in FPhysicsDataCollection, function to initialize from a UStaticMesh - update Tools affected by above changes - add TSampleSetStatisticBuilder::ComputeMultiPass() helper function to compute stats for iterable collections in one line - remove dead code in UVLayoutOp.cpp #rb tyson.brochu #rnx #jira none [CL 14769759 by Ryan Schmidt in ue5-main branch]
2020-11-17 22:32:38 -04:00
FVector ExternalScale3D = FVector::OneVector;
//
// Geometry data
//
/**
* Stores representation of Collision geometry
*/
UE::Geometry::FSimpleShapeSet3d Geometry;
/**
* Collision geometry in Physics-system format. Not necessarily in sync with Geometry member.
*/
FKAggregateGeom AggGeom;
/**
* Initialize from the given Component, and optionally initialize internal geometry members
*/
void InitializeFromComponent(const UActorComponent* Component, bool bInitializeAggGeom);
GeometryProcessing improvements/additions - new correspondence-finding strategy in FMeshImageBakingCache. Added a global Thickness parameter, and now preferentially uses the ray-hit found by casting inwards from Point+Thickness*Normal. This handles the cases where a greeble/etc is just layered on top of base mesh. These kind of mesh elements are only intended to show up in the normal map, so they aren't stitched in. - expose Thickness and World-Space options in BakeMeshAttributeMapsTool - initialize image in Normal and ResampleImage Bakers, otherwise initial value is garbage - add TSampledScalarField2::BilinearSampleGradientClamped and fix typo in BilinearSampleClamped() that resulted in incorrect interpolation - add Texture2DUtil, contains functions for reading a TImageBuilder from a UTexture2D. Can read from source data if available. - ColorConstants now returns white for group 0 - add double version of FMeshDescriptionToDynamicMesh::CopyTangents() - add support for computing on subset of vertiecs in FMeshConvexHull - fix up template export in TMeshTangents - make mesh const in TImplicitMorphology, TImplicitSolidify - accessor/etc additions in TDenseGrid2, TImageBuilder, TSampledScalarField2, TIndexedWeightMap - add source UStaticMesh reference in FPhysicsDataCollection, function to initialize from a UStaticMesh - update Tools affected by above changes - add TSampleSetStatisticBuilder::ComputeMultiPass() helper function to compute stats for iterable collections in one line - remove dead code in UVLayoutOp.cpp #rb tyson.brochu #rnx #jira none [CL 14769759 by Ryan Schmidt in ue5-main branch]
2020-11-17 22:32:38 -04:00
/**
* Initialize from the given StaticMesh, and optionally initialize internal geometry members
*/
void InitializeFromStaticMesh(const UStaticMesh* StaticMesh, bool bInitializeAggGeom);
/**
* Initialize
*/
void InitializeFromExisting(const FPhysicsDataCollection& Other);
/**
* replace our geometry data with that from another FPhysicsDataCollection
*/
void CopyGeometryFromExisting(const FPhysicsDataCollection& Other);
/**
* Empty out our FKAggregateGeom
*/
void ClearAggregate();
/**
* Populate our FKAggregateGeom from our FSimpleShapeSet3d
*/
void CopyGeometryToAggregate();
};