void ACubiquityVolume::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent) { Super::PostEditChangeProperty(PropertyChangedEvent); const FName PropertyName = PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() : NAME_None; if (PropertyName == FName(TEXT("volumeFileName"))) { //Should we save the old volume? Probably not without asking. //Unload old volume //Load new one TArray<AActor*> children = Children; //Make a copy to avoid overruns for (AActor* childActor : children) //Should only be 1 child of this Actor { if (childActor && !childActor->IsPendingKillPending()) { GetWorld()->DestroyActor(childActor); } } loadVolume(); createOctree(); updateMaterial(); //TODO needed? } else if (PropertyName == FName(TEXT("Material"))) { updateMaterial(); } }
void ACubiquityVolume::BeginPlay() { UE_LOG(CubiquityLog, Log, TEXT("ACubiquityVolume::BeginPlay")); createOctree(); Super::BeginPlay(); }
Octree::Octree(std::vector<SimulationObject*>& objects_, int new_lifeLeft) { init(new_lifeLeft); // for (unsigned int i = 0; i < objects_.size(); i++) // { // aabb.update(objects_[i]->aabb); // } aabb.createAABB(20.0f, 60.0f, 20.0f, -20.0f, -15.0f, -120.0f); createOctree(objects_); }
void ACubiquityVolume::PostActorCreated() { loadVolume(); const auto eyePosition = eyePositionInVolumeSpace(); //while (!volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, 0.0)) { /*Keep calling update until it returns true*/ } volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, lodThreshold); createOctree(); Super::PostActorCreated(); }
void ACubiquityVolume::OnConstruction(const FTransform& transform) { UE_LOG(CubiquityLog, Log, TEXT("ACubiquityVolume::OnConstruction")); if (RootComponent->GetNumChildrenComponents() == 0) //If we haven't created the octree yet { createOctree(); } updateMaterial(); Super::OnConstruction(transform); }