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) |
void | SetUpdateTransformAutomatically (bool UpdateAutomatically) |
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, and UAgrarsenseStatics::GetInstancedRenderer().
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 226 of file InstancedActor.h.
|
inlineoverridevirtual |
Definition at line 231 of file InstancedActor.h.
|
inline |
Definition at line 180 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
|
inline |
Definition at line 160 of file InstancedActor.h.
Referenced by AInstancedRenderer::UpdateInstancedActors().
|
inline |
Definition at line 137 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
|
inline |
Definition at line 165 of file InstancedActor.h.
Referenced by AInstancedRenderer::UpdateInstancedActors().
|
inline |
Definition at line 131 of file InstancedActor.h.
Referenced by AInstancedRenderer::FindOrAddUniqueMesh().
|
inlineoverridevirtual |
Definition at line 216 of file InstancedActor.h.
|
inlineoverridevirtual |
Definition at line 221 of file InstancedActor.h.
|
inline |
Definition at line 155 of file InstancedActor.h.
|
inline |
Definition at line 185 of file InstancedActor.h.
Referenced by AInstancedRenderer::UpdateInstancedActors().
|
inline |
Definition at line 125 of file InstancedActor.h.
Referenced by AInstancedRenderer::AddActorToInstancedRendering(), UAgrarsenseConsoleCommands::SetInstacedTreesVisibilityEditor(), and UAgrarsenseConsoleCommands::SetInstancedActorsVisibilityEditor().
|
inline |
Definition at line 149 of file InstancedActor.h.
|
inline |
Definition at line 170 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 101 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 119 of file InstancedActor.h.
|
inline |
Definition at line 175 of file InstancedActor.h.
Referenced by ATagger::TagActor().
bool AInstancedActor::IsTreeActor | ( | ) | const |
Definition at line 158 of file InstancedActor.cpp.
References StaticMeshComponent.
Referenced by ADeletionVolume::DestroyOverlappingActors().
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 241 of file InstancedActor.h.
|
inlineoverridevirtual |
Definition at line 236 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::SpawnProp().
void AInstancedActor::SetUpdateTransformAutomatically | ( | bool | UpdateAutomatically | ) |
Definition at line 141 of file InstancedActor.cpp.
References AddedToInstancedRenderer, AInstancedRenderer::AddOrRemoveActorFromAutomaticTransformUpdates(), UAgrarsenseStatics::GetInstancedRenderer(), and ShouldUpdateTransformAutomatically.
void AInstancedActor::UpdateIndex | ( | int32 | UpdatedIndex | ) |
Update this Actor instance index. This should only be called from InstancedRenderer.cpp
Definition at line 117 of file InstancedActor.cpp.
References InstanceNumber.
Referenced by AInstancedRenderer::RemoveInstance().
|
inline |
Updates the 'PreviousTransform' member variable with a new transform.
NewTransform | The new transform to be assigned to 'PreviousTransform'. |
Definition at line 109 of file InstancedActor.h.
Referenced by AInstancedRenderer::AddOrRemoveActorFromAutomaticTransformUpdates(), and AInstancedRenderer::UpdateInstancedActors().
|
inline |
Definition at line 143 of file InstancedActor.h.
Referenced by AInstancedRenderer::AddActorToInstancedRendering().
void AInstancedActor::UpdateTransformPosition | ( | ) |
Updates this InstancedActor Transform location to the InstancedRenderer.
Definition at line 127 of file InstancedActor.cpp.
References ComponentIndex, UAgrarsenseStatics::GetInstancedRenderer(), InstanceNumber, ShouldUpdateTransformAutomatically, and AInstancedRenderer::UpdateInstanceTransform().
Referenced by UROSCommands::HandleTeleportActorByID().
|
private |
Definition at line 254 of file InstancedActor.h.
|
private |
Definition at line 251 of file InstancedActor.h.
|
private |
Definition at line 262 of file InstancedActor.h.
Referenced by AddToInstancedRendering(), InstanceAdded(), RemoveFromInstancedRendering(), and SetUpdateTransformAutomatically().
bool AInstancedActor::AddToInstancedRenderer = true |
Definition at line 197 of file InstancedActor.h.
Referenced by AddToInstancedRendering().
bool AInstancedActor::AllowWorldPositionOffsetDisable = false |
Definition at line 194 of file InstancedActor.h.
bool AInstancedActor::AlternativeMaterial = false |
Definition at line 211 of file InstancedActor.h.
|
private |
Definition at line 258 of file InstancedActor.h.
Referenced by InstanceAdded(), RemoveFromInstancedRendering(), and UpdateTransformPosition().
|
private |
Definition at line 268 of file InstancedActor.h.
Referenced by BeginPlay().
int AInstancedActor::InstanceEndCullDistanceInCm = 46500 |
Definition at line 203 of file InstancedActor.h.
|
private |
Definition at line 260 of file InstancedActor.h.
Referenced by InstanceAdded(), RemoveFromInstancedRendering(), UpdateIndex(), and UpdateTransformPosition().
int AInstancedActor::InstanceStartCullDistanceInCm = 45000 |
Definition at line 200 of file InstancedActor.h.
FText AInstancedActor::InteractableName |
Definition at line 214 of file InstancedActor.h.
Referenced by AInstancedActor().
|
private |
Definition at line 266 of file InstancedActor.h.
|
private |
Definition at line 256 of file InstancedActor.h.
Referenced by BeginPlay().
bool AInstancedActor::ShouldUpdateTransformAutomatically = false |
Definition at line 207 of file InstancedActor.h.
Referenced by SetUpdateTransformAutomatically(), and UpdateTransformPosition().
UStaticMeshComponent* AInstancedActor::StaticMeshComponent = nullptr |
Definition at line 191 of file InstancedActor.h.
Referenced by AInstancedActor(), BeginPlay(), EndPlay(), InstanceAdded(), IsTreeActor(), and RemoveFromInstancedRendering().
|
private |
Definition at line 264 of file InstancedActor.h.