2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2018-12-12 11:25:29 -05:00
# pragma once
# include "GameFramework/Actor.h"
2019-06-08 17:15:34 -04:00
# include "Components/BillboardComponent.h"
2018-12-12 11:25:29 -05:00
2020-10-21 17:56:05 -04:00
# include <type_traits>
2018-12-12 11:25:29 -05:00
# include "GeometryCollectionDebugDrawActor.generated.h"
2019-06-26 13:41:32 -04:00
class AChaosSolverActor ;
class AGeometryCollectionActor ;
2019-06-08 17:15:34 -04:00
class UGeometryCollectionComponent ;
template < class InElementType > class TManagedArray ;
2021-03-05 19:27:14 -04:00
class FGeometryCollectionParticlesData ;
2019-06-08 17:15:34 -04:00
template < class T > class TAutoConsoleVariable ;
/**
* EGeometryCollectionDebugDrawActorHideGeometry
* Visibility enum .
*/
UENUM ( )
enum class EGeometryCollectionDebugDrawActorHideGeometry : uint8
{
// Do not hide any geometry.
HideNone ,
// Hide the geometry associated with rigid bodies that are selected for collision volume visualization.
HideWithCollision ,
// Hide the geometry associated with the selected rigid bodies.
HideSelected ,
// Hide the entire geometry collection associated with the selected rigid bodies.
HideWholeCollection ,
// Hide all geometry collections.
HideAll
} ;
2019-08-07 14:56:14 -04:00
/**
* FGeometryCollectionDebugDrawWarningMessage
* Empty structure used to embed a warning message in the UI through a detail customization .
*/
USTRUCT ( )
struct FGeometryCollectionDebugDrawWarningMessage
{
GENERATED_USTRUCT_BODY ( )
} ;
2019-06-08 17:15:34 -04:00
/**
* FGeometryCollectionDebugDrawActorSelectedRigidBody
* Structure used to select a rigid body id with a picking tool through a detail customization .
*/
USTRUCT ( )
struct FGeometryCollectionDebugDrawActorSelectedRigidBody
{
GENERATED_USTRUCT_BODY ( )
2019-06-26 13:41:32 -04:00
explicit FGeometryCollectionDebugDrawActorSelectedRigidBody ( int32 InId = - 1 ) : Id ( InId ) , Solver ( nullptr ) , GeometryCollection ( nullptr ) { }
2019-11-08 19:47:41 -05:00
//explicit FGeometryCollectionDebugDrawActorSelectedRigidBody(FGuid InId = FGuid()) : Id(InId), Solver(nullptr), GeometryCollection(nullptr) {}
2019-07-22 08:16:50 -04:00
2019-06-08 17:15:34 -04:00
/** Id of the selected rigid body whose to visualize debug informations. Use -1 to visualize all Geometry Collections. */
2019-06-26 13:41:32 -04:00
UPROPERTY ( EditAnywhere , Category = " Selected Rigid Body " , meta = ( ClampMin = " -1 " ) )
2019-06-08 17:15:34 -04:00
int32 Id ;
2019-11-08 19:47:41 -05:00
//FGuid Id;
2019-06-17 14:53:58 -04:00
2019-06-26 13:41:32 -04:00
/** Chaos RBD Solver. Will use the world's default solver actor if null. */
UPROPERTY ( EditAnywhere , Category = " Selected Rigid Body " )
2021-01-27 17:40:25 -04:00
TObjectPtr < AChaosSolverActor > Solver ;
2019-06-26 13:41:32 -04:00
/** Currently selected geometry collection. */
UPROPERTY ( VisibleAnywhere , Category = " Selected Rigid Body " )
2021-01-27 17:40:25 -04:00
TObjectPtr < AGeometryCollectionActor > GeometryCollection ;
2019-06-26 13:41:32 -04:00
/** Return the name of selected solver, or "None" if none is selected. */
FString GetSolverName ( ) const ;
2019-06-08 17:15:34 -04:00
} ;
2018-12-12 11:25:29 -05:00
/**
* AGeometryCollectionDebugDrawActor
2019-06-08 17:15:34 -04:00
* An actor representing the collection of data necessary to visualize the
* geometry collections ' debug informations .
* Only one actor is to be used in the world , and should be automatically
* spawned by any GeometryDebugDrawComponent that needs it .
2018-12-12 11:25:29 -05:00
*/
2019-06-08 17:15:34 -04:00
UCLASS ( HideCategories = ( " Rendering " , " Replication " , " Input " , " Actor " , " Collision " , " LOD " , " Cooking " ) )
2018-12-12 11:25:29 -05:00
class GEOMETRYCOLLECTIONENGINE_API AGeometryCollectionDebugDrawActor : public AActor
{
GENERATED_UCLASS_BODY ( )
public :
2019-07-22 08:16:50 -04:00
/** Warning message to explain that the debug draw properties have no effect until starting playing/simulating. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw " )
FGeometryCollectionDebugDrawWarningMessage WarningMessage ;
2019-06-08 17:15:34 -04:00
/** Picking tool used to select a rigid body id. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw " )
FGeometryCollectionDebugDrawActorSelectedRigidBody SelectedRigidBody ;
/** Show debug visualization for the rest of the geometry collection related to the current rigid body id selection. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw " )
bool bDebugDrawWholeCollection ;
/** Show debug visualization for the top level node rather than the bottom leaf nodes of a cluster's hierarchy. * Only affects Clustering and Geometry visualization.
2018-12-12 11:25:29 -05:00
*/
2019-06-08 17:15:34 -04:00
UPROPERTY ( EditAnywhere , Category = " Debug Draw " )
bool bDebugDrawHierarchy ;
/** Show debug visualization for all clustered children associated to the current rigid body id selection. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw " )
bool bDebugDrawClustering ;
/** Geometry visibility setting. Select the part of the geometry to hide in order to better visualize the debug information. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw " )
EGeometryCollectionDebugDrawActorHideGeometry HideGeometry ;
/** Display the selected rigid body's id. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyId ;
/** Show the selected rigid body's collision volume. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyCollision ;
/** Show the selected rigid body's collision volume at the origin, in local space. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bCollisionAtOrigin ;
/** Show the selected rigid body's transform. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyTransform ;
/** Show the selected rigid body's inertia tensor box. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyInertia ;
/** Show the selected rigid body's linear and angular velocity. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyVelocity ;
/** Show the selected rigid body's applied force and torque. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyForce ;
/** Show the selected rigid body's on screen text information. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Rigid Body " )
bool bShowRigidBodyInfos ;
/** Show the transform index for the selected rigid body's associated cluster nodes. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Clustering " )
bool bShowTransformIndex ;
/** Show the transform for the selected rigid body's associated cluster nodes. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Clustering " )
bool bShowTransform ;
/** Show a link from the selected rigid body's associated cluster nodes to their parent's nodes. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Clustering " )
bool bShowParent ;
/** Show the hierarchical level for the selected rigid body's associated cluster nodes. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Clustering " )
bool bShowLevel ;
/** Show the connectivity edges for the selected rigid body's associated cluster nodes. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Clustering " )
bool bShowConnectivityEdges ;
/** Show the geometry index for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowGeometryIndex ;
/** Show the geometry transform for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowGeometryTransform ;
/** Show the bounding box for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowBoundingBox ;
/** Show the faces for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowFaces ;
/** Show the face indices for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowFaceIndices ;
/** Show the face normals for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowFaceNormals ;
/** Enable single face visualization for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowSingleFace ;
/** The index of the single face to visualize. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " , meta = ( ClampMin = " 0 " ) )
int32 SingleFaceIndex ;
/** Show the vertices for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowVertices ;
/** Show the vertex indices for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowVertexIndices ;
/** Show the vertex normals for the selected rigid body's associated geometries. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Geometry " )
bool bShowVertexNormals ;
/** Adapt visualization depending of the cluster nodes' hierarchical level. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " )
bool bUseActiveVisualization ;
/** Thickness of points when visualizing vertices. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0 " ) )
2018-12-12 11:25:29 -05:00
float PointThickness ;
2019-06-08 17:15:34 -04:00
/** Thickness of lines when visualizing faces, normals, ...etc. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0 " ) )
2018-12-12 11:25:29 -05:00
float LineThickness ;
2019-06-08 17:15:34 -04:00
/** Draw shadows under the displayed text. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " )
2018-12-12 11:25:29 -05:00
bool bTextShadow ;
2019-06-08 17:15:34 -04:00
/** Scale of the font used to display text. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
2018-12-12 11:25:29 -05:00
float TextScale ;
2019-06-08 17:15:34 -04:00
/** Scale factor used for visualizing normals. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
2018-12-12 11:25:29 -05:00
float NormalScale ;
2019-08-07 14:56:14 -04:00
/** Scale of the axis used for visualizing all transforms. */
2019-06-08 17:15:34 -04:00
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
2019-08-07 14:56:14 -04:00
float AxisScale ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Size of arrows used for visualizing normals, breaking information, ...etc. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
2018-12-12 11:25:29 -05:00
float ArrowScale ;
2019-08-07 14:56:14 -04:00
/** Color used for the visualization of the rigid body ids. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor RigidBodyIdColor ;
/** Scale for rigid body transform visualization. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
float RigidBodyTransformScale ;
/** Color used for collision primitives visualization. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor RigidBodyCollisionColor ;
/** Color used for the visualization of the rigid body inertia tensor box. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor RigidBodyInertiaColor ;
/** Color used for rigid body velocities visualization. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor RigidBodyVelocityColor ;
/** Color used for rigid body applied force and torque visualization. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor RigidBodyForceColor ;
/** Color used for the visualization of the rigid body infos. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor RigidBodyInfoColor ;
/** Color used for the visualization of the transform indices. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor TransformIndexColor ;
/** Scale for cluster transform visualization. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
float TransformScale ;
/** Color used for the visualization of the levels. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor LevelColor ;
/** Color used for the visualization of the link from the parents. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor ParentColor ;
/** Line thickness used for the visualization of the rigid clustering connectivity edges. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
float ConnectivityEdgeThickness ;
/** Color used for the visualization of the geometry indices. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor GeometryIndexColor ;
/** Scale for geometry transform visualization. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( ClampMin = " 0.0001 " ) )
float GeometryTransformScale ;
/** Color used for the visualization of the bounding boxes. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor BoundingBoxColor ;
/** Color used for the visualization of the faces. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor FaceColor ;
/** Color used for the visualization of the face indices. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor FaceIndexColor ;
/** Color used for the visualization of the face normals. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor FaceNormalColor ;
/** Color used for the visualization of the single face. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor SingleFaceColor ;
/** Color used for the visualization of the vertices. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor VertexColor ;
/** Color used for the visualization of the vertex indices. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor VertexIndexColor ;
/** Color used for the visualization of the vertex normals. */
UPROPERTY ( EditAnywhere , Category = " Debug Draw|Settings " , meta = ( HideAlphaChannel ) )
FColor VertexNormalColor ;
2019-06-08 17:15:34 -04:00
/** Display icon in the editor. */
UPROPERTY ( )
2021-01-27 17:40:25 -04:00
TObjectPtr < UBillboardComponent > SpriteComponent ;
2019-06-08 17:15:34 -04:00
/** Game tick callback. This tick function is required to clean up the persistent debug lines. */
static AGeometryCollectionDebugDrawActor * FindOrCreate ( UWorld * World ) ;
/** Game tick callback. This tick function is required to clean up the persistent debug lines. */
2018-12-12 11:25:29 -05:00
virtual void Tick ( float DeltaSeconds ) override ;
2019-06-08 17:15:34 -04:00
/** Actor destruction callback. Used here to clear up the command callbacks. */
2018-12-12 11:25:29 -05:00
virtual void BeginDestroy ( ) override ;
2019-06-08 17:15:34 -04:00
/** Register debug draw service. */
virtual void BeginPlay ( ) override ;
/** Unregister debug draw service. */
virtual void EndPlay ( EEndPlayReason : : Type ReasonEnd ) override ;
/** Reset command variables from the newly loaded properties. */
virtual void PostLoad ( ) override ;
2018-12-12 11:25:29 -05:00
# if WITH_EDITOR
2019-06-08 17:15:34 -04:00
/** Property changed callback. Required to synchronize the command variables to this Actor's properties. */
2018-12-12 11:25:29 -05:00
virtual void PostEditChangeProperty ( FPropertyChangedEvent & PropertyChangedEvent ) override ;
2019-06-08 17:15:34 -04:00
/** Some properties are unlocked depending on the value of the indices not being -1. */
2019-12-13 11:07:03 -05:00
virtual bool CanEditChange ( const FProperty * InProperty ) const override ;
2018-12-12 11:25:29 -05:00
# endif
2019-06-08 17:15:34 -04:00
/** Draw vertices. */
void DrawVertices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw vertices for the part of the geometry attached to the specified transform index. */
void DrawVertices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw vertex indices. */
void DrawVertexIndices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw vertex indices for the part of the geometry attached to the specified transform index. */
2019-08-07 14:56:14 -04:00
void DrawVertexIndices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw vertex normals. */
void DrawVertexNormals ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw vertex normals for the part of the geometry attached to the specified transform index. */
void DrawVertexNormals ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw faces. */
void DrawFaces ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw faces for the part of the geometry attached to the specified transform index. */
void DrawFaces ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw face indices. */
void DrawFaceIndices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw face indices for the part of the geometry attached to the specified transform index. */
void DrawFaceIndices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw face normals. */
void DrawFaceNormals ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw face normals for the part of the geometry attached to the specified transform index. */
void DrawFaceNormals ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw single face. */
void DrawSingleFace ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const int32 FaceIndex , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Draw geometry indices. */
void DrawGeometryIndices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
/** Draw the geometry index for the part of the geometry attached to the specified transform index. */
void DrawGeometryIndex ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
/** Draw transforms. */
void DrawTransforms ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , float Scale ) ;
/** Draw the transform for the part of the geometry attached to the specified transform index. */
void DrawTransform ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , float Scale ) ;
/** Draw transform indices. */
void DrawTransformIndices ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
/** Draw the transform index for the part of the geometry attached to the specified transform index. */
void DrawTransformIndex ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
/** Draw hierarchical levels. */
void DrawLevels ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
/** Draw the hierarchical level for the part of the geometry attached to the specified transform index. */
void DrawLevel ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
/** Draw links to the parent. */
void DrawParents ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
/** Draw a link to the parent for the part of the geometry attached to the specified transform index. */
void DrawParent ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
/** Draw bounding boxes. */
void DrawBoundingBoxes ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , const FColor & Color ) ;
/** Draw the bounding box for the part of the geometry attached to the specified transform index. */
void DrawBoundingBox ( const TArray < FTransform > & GlobalTransforms , const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FColor & Color ) ;
/** Return the concatenated transform for the specified particle. */
static FTransform GetParticleTransform ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData ) ;
/** Draw Chaos' rigid body ids. */
2019-11-08 19:47:41 -05:00
//void DrawRigidBodiesId(const UGeometryCollectionComponent* GeometryCollectionComponent, const FGeometryCollectionParticlesData& ParticlesData, const TManagedArray<int32>& RigidBodyIdArray, const FColor& Color);
void DrawRigidBodiesId ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const TManagedArray < FGuid > & RigidBodyIdArray , const FColor & Color ) ;
2019-06-08 17:15:34 -04:00
/** Draw Chaos' rigid body id. */
2019-11-08 19:47:41 -05:00
//void DrawRigidBodyId(const UGeometryCollectionComponent* GeometryCollectionComponent, int32 TransformIndex, const FGeometryCollectionParticlesData& ParticlesData, const TManagedArray<int32>& RigidBodyIdArray, const FColor& Color);
void DrawRigidBodyId ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const TManagedArray < FGuid > & RigidBodyIdArray , const FColor & Color ) ;
2019-06-08 17:15:34 -04:00
/** Draw Chaos' rigid body transform. */
void DrawRigidBodiesTransform ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , float Scale ) ;
/** Draw Chaos' single rigid body transform. */
void DrawRigidBodyTransform ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , float Scale ) ;
/** Draw Chaos' implicit collision primitives. */
void DrawRigidBodiesCollision ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' implicit single collision primitive. */
void DrawRigidBodyCollision ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' inertia tensors. */
void DrawRigidBodiesInertia ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid body inertia tensor. */
void DrawRigidBodyInertia ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' rigid body informations. */
void DrawRigidBodiesInfo ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid body informations. */
void DrawRigidBodyInfo ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' rigid clustering's connectivities edges */
2019-11-08 19:47:41 -05:00
//void DrawConnectivityEdges(const UGeometryCollectionComponent* GeometryCollectionComponent, const FGeometryCollectionParticlesData& ParticlesData, const TManagedArray<int32>& RigidBodyIdArray);
void DrawConnectivityEdges ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const TManagedArray < FGuid > & RigidBodyIdArray ) ;
2019-06-08 17:15:34 -04:00
/** Draw Chaos' single rigid clustering's connectivity edges. */
2019-11-08 19:47:41 -05:00
//void DrawConnectivityEdges(const UGeometryCollectionComponent* GeometryCollectionComponent, int32 TransformIndex, const FGeometryCollectionParticlesData& ParticlesData, const TManagedArray<int32>& RigidBodyIdArray, FColor HSVColor = FColor(157, 160, 128));
void DrawConnectivityEdges ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const TManagedArray < FGuid > & RigidBodyIdArray , FColor HSVColor = FColor ( 157 , 160 , 128 ) ) ;
2019-06-08 17:15:34 -04:00
/** Draw Chaos' rigid body velocity. */
void DrawRigidBodiesVelocity ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid body velocity. */
void DrawRigidBodyVelocity ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' rigid body applied force and torque. */
void DrawRigidBodiesForce ( const UGeometryCollectionComponent * GeometryCollectionComponent , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid body applied force and torque. */
void DrawRigidBodyForce ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
2018-12-12 11:25:29 -05:00
private :
2019-06-08 17:15:34 -04:00
/** Return a darker color depending on level. */
static FColor MakeDarker ( const FColor & Color , int32 Level = 1 ) ;
2018-12-12 11:25:29 -05:00
2019-06-08 17:15:34 -04:00
/** Return a smaller scale depending on level. */
static float MakeSmaller ( float Scale , int32 Level = 1 ) { while ( - - Level > = 0 ) { Scale * = 0.666666f ; } return Scale ; }
/** Return the hierarchy level for this transform index. */
static int32 GetLevel ( int32 TransformIndex , const TManagedArray < int32 > & Parents ) ;
/** Callback on property changes. */
void OnPropertyChanged ( bool bForceVisibilityUpdate ) ;
/** Property update function helper. */
template < typename T1 , typename T2 >
void UpdatePropertyValue ( T1 & PropertyValue , const TAutoConsoleVariable < T2 > & ConsoleVariable , bool & bHasChanged ) ;
2020-10-21 17:56:05 -04:00
/** Property update function helper. */
template < typename T , decltype ( ImplicitConv < AChaosSolverActor * > ( std : : declval < T > ( ) ) ) * = nullptr >
void UpdatePropertyValue ( T & PropertyValue , const TAutoConsoleVariable < FString > & ConsoleVariable , bool & bHasChanged ) ;
2019-06-08 17:15:34 -04:00
/** Callback on console variable. */
void OnCVarsChanged ( ) ;
/** Add debug text output. */
void AddDebugText ( const FString & Text , const FVector & Position = FVector : : ZeroVector , const FColor & Color = FColor : : White , float Scale = 1.f , bool bDrawShadow = false ) ;
/** Draw all text output. */
void DebugDrawText ( UCanvas * Canvas , APlayerController * PlayerController ) ;
/** Clear all persistent strings and debug lines. */
void Flush ( ) ;
/** Return the concatenated transform for the specified particle. Must have the ParticleData X, R, and ChildToParentMap already synced. */
static FTransform GetParticleTransformNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData ) ;
/** Draw Chaos' single rigid body id without synchronization checks. */
2019-11-08 19:47:41 -05:00
//void DrawRigidBodyIdNoChecks(const UGeometryCollectionComponent* GeometryCollectionComponent, int32 TransformIndex, const FGeometryCollectionParticlesData& ParticlesData, const TManagedArray<int32>& RigidBodyIdArray, const FColor& Color);
void DrawRigidBodyIdNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const TManagedArray < FGuid > & RigidBodyIdArray , const FColor & Color ) ;
2019-06-08 17:15:34 -04:00
/** Draw Chaos' single rigid body transform without synchronization checks. */
void DrawRigidBodyTransformNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , float Scale ) ;
/** Draw Chaos' implicit single collision primitive without synchronization checks. */
void DrawRigidBodyCollisionNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' implicit inertia tensor without synchronization checks. */
void DrawRigidBodyInertiaNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid body informations without synchronization checks. */
void DrawRigidBodyInfoNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid clustering's connectivity edges without synchronization checks. */
2019-11-08 19:47:41 -05:00
//void DrawConnectivityEdgesNoChecks(const UGeometryCollectionComponent* GeometryCollectionComponent, int32 TransformIndex, const FGeometryCollectionParticlesData& ParticlesData, const TManagedArray<int32>& RigidBodyIdArray, const FColor& Color);
void DrawConnectivityEdgesNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const TManagedArray < FGuid > & RigidBodyIdArray , const FColor & Color ) ;
2019-06-08 17:15:34 -04:00
/** Draw Chaos' single rigid body velocity without synchronization checks. */
void DrawRigidBodyVelocityNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
/** Draw Chaos' single rigid body applied force and torque without synchronization checks. */
void DrawRigidBodyForceNoChecks ( const UGeometryCollectionComponent * GeometryCollectionComponent , int32 TransformIndex , const FGeometryCollectionParticlesData & ParticlesData , const FColor & Color ) ;
private :
struct FDebugDrawText
{
FString Text ;
FVector Position ;
FColor Color ;
float Scale ;
bool bDrawShadow ;
} ;
FConsoleVariableSinkHandle ConsoleVariableSinkHandle ;
FDelegateHandle DebugDrawTextDelegateHandle ;
TArray < FDebugDrawText > DebugDrawTexts ;
bool bNeedsDebugLinesFlush ;
2019-10-02 17:27:26 -04:00
# if WITH_EDITOR
2019-06-08 17:15:34 -04:00
bool bWasEditorPaused ;
2019-10-02 17:27:26 -04:00
# endif // #if WITH_EDITOR
2018-12-12 11:25:29 -05:00
} ;