Agrarsense
|
#include <InstancedActor.h>
Public Member Functions | |
AInstancedActor (const FObjectInitializer &ObjectInitializer) | |
virtual void | BeginPlay () override |
virtual void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
bool | AddToInstancedRendering () |
void | RemoveFromInstancedRendering (bool EnableStaticMeshComponent=true) |
void | UpdateTransformPosition () |
void | InstanceAdded (int32 CompIndex, int32 InstanceNum) |
void | UpdateIndex (int32 UpdatedIndex) |
void | SetTypeAndModel (const FString &Type, const FString &Model) |
bool | IsTreeActor () const |
void | UpdatePreviousTransform (const FTransform &NewTransform) |
bool | IsAddedToInstancedRendering () const |
UStaticMeshComponent * | GetStaticMeshComponent () const |
int | GetInstanceStartCullDistance () const |
int | GetInstanceEndCullDistance () const |
bool | UpdateTransformAutomatically () const |
FString | GetTypeIDString () const |
FString | GetModelIDString () const |
int | GetComponentIndex () const |
int | GetInstanceIndex () const |
bool | HasAlternativeMaterial () const |
bool | IsCustomDepthSetup () const |
bool | GetAllowWorldPositionOffsetDisable () const |
FTransform | GetPreviousTransform () const |
virtual FText | GetInteractableName_Implementation () const override |
virtual FTransform | GetInteractableWorldTransform_Implementation () const override |
virtual FString | GetActorID_Implementation () const override |
virtual FString | GetActorName_Implementation () const override |
virtual void | SetActorName_Implementation (const FString &NewActorName) override |
virtual void | SetActorIDAndName_Implementation (const FString &NewActorName, const FString &NewID) override |
Public Member Functions inherited from IInteractable | |
FText | GetInteractableName () const |
FTransform | GetInteractableWorldTransform () const |
Public Member Functions inherited from IActorInformation | |
FString | GetActorID () const |
FString | GetActorName () const |
FString | GetActorInformation () const |
void | SetActorName (const FString &NewActorName) |
void | SetActorIDAndName (const FString &NewActorName, const FString &NewID) |
Public Attributes | |
UStaticMeshComponent * | StaticMeshComponent = nullptr |
bool | AllowWorldPositionOffsetDisable = false |
bool | AddToInstancedRenderer = true |
int | InstanceStartCullDistanceInCm = 45000 |
int | InstanceEndCullDistanceInCm = 46500 |
bool | ShouldUpdateTransformAutomatically = false |
bool | AlternativeMaterial = false |
FText | InteractableName |
Private Attributes | |
FString | ActorName |
FString | ActorID |
FTransform | PreviousTransform |
int32 | ComponentIndex = 9999999 |
int32 | InstanceNumber = 9999999 |
bool | AddedToInstancedRenderer = false |
FString | TypeID = "none" |
FString | ModelID = "none" |
bool | CustomDepthSetup = false |
Additional Inherited Members | |
Static Public Member Functions inherited from IActorInformation | |
static void | SetAndValidateActorIDAndName (FString &ActorName, FString &ActorID, TWeakObjectPtr< AActor > Actor) |
static bool | DestroyActorByID (const FString &ID) |
static AActor * | GetActorByID (const FString &ID) |
template<typename T > | |
static TArray< T * > | GetActorsWithInterface () |
static void | PrintAllIds () |
Instanced Actor class. InstancedRenderer.cpp renders all of these Actors efficiently with UInstancedStaticMeshComponent. see InstancedRenderer.cpp
To use this:
Note. If you need to move the Actor, you either call UpdateTransformPosition() each time you change the position, or Set UpdateTransformAutomatically to true in Blueprint or call SetUpdateTransformAutomatically(true); It's recommeded to keep UpdateTransformAutomatically false or call SetUpdateTransformAutomatically(false); If you don't need any Transform updates since this adds some performance cost.
Definition at line 37 of file InstancedActor.h.
AInstancedActor::AInstancedActor | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 14 of file InstancedActor.cpp.
References InteractableName, and StaticMeshComponent.
bool AInstancedActor::AddToInstancedRendering | ( | ) |
Add this InstancedActor to Instanced rendering if it wasn't already added.
Definition at line 74 of file InstancedActor.cpp.
References AInstancedRenderer::AddActorToInstancedRendering(), AddedToInstancedRenderer, AddToInstancedRenderer, UAgrarsenseStatics::GetInstancedRenderer(), and ShouldUpdateTransformAutomatically.
Referenced by BeginPlay().
|
overridevirtual |
Definition at line 22 of file InstancedActor.cpp.
References AddToInstancedRendering(), CustomDepthSetup, PreviousTransform, and StaticMeshComponent.
|
overridevirtual |
Definition at line 37 of file InstancedActor.cpp.
References RemoveFromInstancedRendering(), and StaticMeshComponent.
|
inlineoverridevirtual |
Definition at line 219 of file InstancedActor.h.
|
inlineoverridevirtual |
Definition at line 224 of file InstancedActor.h.
|
inline |
Definition at line 173 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
|
inline |
Definition at line 153 of file InstancedActor.h.
|
inline |
Definition at line 130 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
|
inline |
Definition at line 158 of file InstancedActor.h.
|
inline |
Definition at line 124 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
|
inlineoverridevirtual |
Definition at line 209 of file InstancedActor.h.
|
inlineoverridevirtual |
Definition at line 214 of file InstancedActor.h.
|
inline |
Definition at line 148 of file InstancedActor.h.
|
inline |
Definition at line 178 of file InstancedActor.h.
|
inline |
Definition at line 118 of file InstancedActor.h.
Referenced by AInstancedRenderer::AddActorToInstancedRendering().
|
inline |
Definition at line 142 of file InstancedActor.h.
|
inline |
Definition at line 163 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
void AInstancedActor::InstanceAdded | ( | int32 | CompIndex, |
int32 | InstanceNum | ||
) |
Notify that this Actor instance has been added to InstancedRenderer. This should only be called from InstancedRenderer.cpp
Definition at line 90 of file InstancedActor.cpp.
References AddedToInstancedRenderer, ComponentIndex, InstanceNumber, and StaticMeshComponent.
Referenced by AInstancedRenderer::AddActorToInstancedRendering().
|
inline |
Check if this InstancedActor is already added to Instanced rendering.
Definition at line 112 of file InstancedActor.h.
|
inline |
Definition at line 168 of file InstancedActor.h.
Referenced by ATagger::TagActor().
bool AInstancedActor::IsTreeActor | ( | ) | const |
Definition at line 130 of file InstancedActor.cpp.
References StaticMeshComponent.
Referenced by ADeletionVolume::DestroyOverlappingActors(), and AInstancedRenderer::FindOrAddUniqueMesh().
void AInstancedActor::RemoveFromInstancedRendering | ( | bool | EnableStaticMeshComponent = true | ) |
Remove this InstancedActor from Instanced rendering if it was added.
EnableStaticMeshComponent | If true, enables the StaticMeshComponent after removal. |
Definition at line 54 of file InstancedActor.cpp.
References AddedToInstancedRenderer, ComponentIndex, UAgrarsenseStatics::GetInstancedRenderer(), InstanceNumber, AInstancedRenderer::RemoveInstance(), and StaticMeshComponent.
Referenced by EndPlay().
|
inlineoverridevirtual |
Definition at line 234 of file InstancedActor.h.
|
inlineoverridevirtual |
Definition at line 229 of file InstancedActor.h.
|
inline |
Set Type and Model strings for this InstancedActor This is used when exporting InstancedActor(s) into JSON files
Definition at line 86 of file InstancedActor.h.
Referenced by UAssetLibrary::SpawnFoliage(), and UAssetLibrary::SpawnProp().
void AInstancedActor::UpdateIndex | ( | int32 | UpdatedIndex | ) |
Update this Actor instance index. This should only be called from InstancedRenderer.cpp
Definition at line 106 of file InstancedActor.cpp.
References InstanceNumber.
|
inline |
Updates the 'PreviousTransform' member variable with a new transform.
NewTransform | The new transform to be assigned to 'PreviousTransform'. |
Definition at line 102 of file InstancedActor.h.
|
inline |
Definition at line 136 of file InstancedActor.h.
void AInstancedActor::UpdateTransformPosition | ( | ) |
Updates this InstancedActor Transform location to the InstancedRenderer.
Definition at line 116 of file InstancedActor.cpp.
References ComponentIndex, UAgrarsenseStatics::GetInstancedRenderer(), InstanceNumber, ShouldUpdateTransformAutomatically, and AInstancedRenderer::UpdateInstanceTransform().
Referenced by UROSCommands::HandleTeleportActorByID().
|
private |
Definition at line 247 of file InstancedActor.h.
|
private |
Definition at line 244 of file InstancedActor.h.
|
private |
Definition at line 255 of file InstancedActor.h.
Referenced by AddToInstancedRendering(), InstanceAdded(), and RemoveFromInstancedRendering().
bool AInstancedActor::AddToInstancedRenderer = true |
Definition at line 190 of file InstancedActor.h.
Referenced by AddToInstancedRendering(), and AInstancedRenderer::SpawnInstanceBackToActor().
bool AInstancedActor::AllowWorldPositionOffsetDisable = false |
Definition at line 187 of file InstancedActor.h.
bool AInstancedActor::AlternativeMaterial = false |
Definition at line 204 of file InstancedActor.h.
|
private |
Definition at line 251 of file InstancedActor.h.
Referenced by InstanceAdded(), RemoveFromInstancedRendering(), and UpdateTransformPosition().
|
private |
Definition at line 261 of file InstancedActor.h.
Referenced by BeginPlay().
int AInstancedActor::InstanceEndCullDistanceInCm = 46500 |
Definition at line 196 of file InstancedActor.h.
|
private |
Definition at line 253 of file InstancedActor.h.
Referenced by InstanceAdded(), RemoveFromInstancedRendering(), UpdateIndex(), and UpdateTransformPosition().
int AInstancedActor::InstanceStartCullDistanceInCm = 45000 |
Definition at line 193 of file InstancedActor.h.
FText AInstancedActor::InteractableName |
Definition at line 207 of file InstancedActor.h.
Referenced by AInstancedActor().
|
private |
Definition at line 259 of file InstancedActor.h.
|
private |
Definition at line 249 of file InstancedActor.h.
Referenced by BeginPlay().
bool AInstancedActor::ShouldUpdateTransformAutomatically = false |
Definition at line 200 of file InstancedActor.h.
Referenced by AddToInstancedRendering(), and UpdateTransformPosition().
UStaticMeshComponent* AInstancedActor::StaticMeshComponent = nullptr |
Definition at line 184 of file InstancedActor.h.
Referenced by AInstancedActor(), BeginPlay(), EndPlay(), InstanceAdded(), IsTreeActor(), and RemoveFromInstancedRendering().
|
private |
Definition at line 257 of file InstancedActor.h.