You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- 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]
102 lines
2.4 KiB
C++
102 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Physics/PhysicsDataCollection.h"
|
|
#include "Physics/CollisionGeometryConversion.h"
|
|
|
|
#include "Engine/Classes/Engine/StaticMesh.h"
|
|
#include "Engine/Classes/Components/StaticMeshComponent.h"
|
|
#include "Engine/Classes/PhysicsEngine/BodySetup.h"
|
|
|
|
|
|
|
|
void FPhysicsDataCollection::InitializeFromComponent(const UActorComponent* Component, bool bInitializeAggGeom)
|
|
{
|
|
const UStaticMeshComponent* StaticMeshComponent = CastChecked<UStaticMeshComponent>(Component);
|
|
const UStaticMesh* StaticMesh = StaticMeshComponent->GetStaticMesh();
|
|
|
|
SourceComponent = StaticMeshComponent;
|
|
SourceStaticMesh = StaticMesh;
|
|
BodySetup = StaticMesh->GetBodySetup();
|
|
|
|
ExternalScale3D = FVector(1.f, 1.f, 1.f);
|
|
|
|
if (bInitializeAggGeom)
|
|
{
|
|
AggGeom = BodySetup->AggGeom;
|
|
// transfer AggGeom to FSimpleShapeSet3d...
|
|
}
|
|
}
|
|
|
|
|
|
void FPhysicsDataCollection::InitializeFromStaticMesh(const UStaticMesh* StaticMesh, bool bInitializeAggGeom)
|
|
{
|
|
SourceStaticMesh = StaticMesh;
|
|
BodySetup = StaticMesh->GetBodySetup();
|
|
|
|
ExternalScale3D = FVector(1.f, 1.f, 1.f);
|
|
|
|
if (bInitializeAggGeom)
|
|
{
|
|
AggGeom = BodySetup->AggGeom;
|
|
// transfer AggGeom to FSimpleShapeSet3d...
|
|
}
|
|
}
|
|
|
|
|
|
void FPhysicsDataCollection::InitializeFromExisting(const FPhysicsDataCollection& Other)
|
|
{
|
|
SourceComponent = Other.SourceComponent;
|
|
SourceStaticMesh = Other.SourceStaticMesh;
|
|
BodySetup = Other.BodySetup;
|
|
|
|
ExternalScale3D = Other.ExternalScale3D;
|
|
}
|
|
|
|
|
|
|
|
void FPhysicsDataCollection::CopyGeometryFromExisting(const FPhysicsDataCollection& Other)
|
|
{
|
|
Geometry = Other.Geometry;
|
|
AggGeom = Other.AggGeom;
|
|
}
|
|
|
|
|
|
void FPhysicsDataCollection::ClearAggregate()
|
|
{
|
|
AggGeom = FKAggregateGeom();
|
|
}
|
|
|
|
void FPhysicsDataCollection::CopyGeometryToAggregate()
|
|
{
|
|
for (FBoxShape3d& BoxGeom : Geometry.Boxes)
|
|
{
|
|
FKBoxElem Element;
|
|
UE::Geometry::GetFKElement(BoxGeom.Box, Element);
|
|
AggGeom.BoxElems.Add(Element);
|
|
}
|
|
|
|
for (FSphereShape3d& SphereGeom : Geometry.Spheres)
|
|
{
|
|
FKSphereElem Element;
|
|
UE::Geometry::GetFKElement(SphereGeom.Sphere, Element);
|
|
AggGeom.SphereElems.Add(Element);
|
|
}
|
|
|
|
for (FCapsuleShape3d& CapsuleGeom : Geometry.Capsules)
|
|
{
|
|
FKSphylElem Element;
|
|
UE::Geometry::GetFKElement(CapsuleGeom.Capsule, Element);
|
|
AggGeom.SphylElems.Add(Element);
|
|
}
|
|
|
|
for (FConvexShape3d& ConvexGeom : Geometry.Convexes)
|
|
{
|
|
FKConvexElem Element;
|
|
UE::Geometry::GetFKElement(ConvexGeom.Mesh, Element);
|
|
AggGeom.ConvexElems.Add(Element);
|
|
}
|
|
}
|
|
|
|
|
|
|