Files
vertical-partition-system-p…/Source/VerticalPartition/Public/VerticalPartitionManager.h
Bonchellon 04ad6d3f25 Initial commit: Vertical Partition Streaming plugin (UE 5.7)
Bounded vertical route partition / streaming for handcrafted spiral climb maps
(Only Up / Only Climb). Not World Partition, not Level Instances as core arch.

- Z-cell segmentation + optional XY subcells, editor builder + commandlet
- NonDestructive visibility backend + streaming-level backend
- Offline HLOD proxies: MergedMesh / SimplifiedProxy (ProxyLOD)
- Universal Level Instance + Packed Level Actor + HISM support (flatten+merge)
- Vertical-aware runtime streamer (full/preload/HLOD/unload, hysteresis,
  velocity prediction, fall-risk), WP-style debug viz + vp.* console
- Safe-by-default: only static decor streams; sky/lights/gameplay stay persistent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 17:42:41 +03:00

63 lines
2.3 KiB
C++

// Copyright IHY. Vertical Partition Streaming plugin.
//
// In-world coordinator. One per streamed level (auto-spawned by the volume at
// BeginPlay, or placed manually). Determines the tracked player's current cell,
// drives the runtime subsystem at the configured interval, and hosts the debug
// component. Keep this lightweight: the heavy lifting is in the subsystem.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "VerticalPartitionTypes.h"
#include "VerticalPartitionManager.generated.h"
class UVerticalPartitionDescriptor;
class UVerticalPartitionDebugComponent;
class AVerticalPartitionVolume;
UCLASS()
class VERTICALPARTITION_API AVerticalPartitionManager : public AActor
{
GENERATED_BODY()
public:
AVerticalPartitionManager();
/** Descriptor to stream. If unset, the manager searches the level for a volume. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VerticalPartition")
TSoftObjectPtr<UVerticalPartitionDescriptor> Descriptor;
/** Optional explicit volume (otherwise the first one found is used). */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VerticalPartition")
TObjectPtr<AVerticalPartitionVolume> Volume;
/** Pawn whose position drives streaming. Defaults to local player pawn each tick. */
UPROPERTY(BlueprintReadWrite, Category="VerticalPartition")
TWeakObjectPtr<APawn> TrackedPawn;
UPROPERTY(VisibleAnywhere, Category="VerticalPartition")
TObjectPtr<UVerticalPartitionDebugComponent> DebugComponent;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void Tick(float DeltaSeconds) override;
/** Snap streaming to the tracked pawn immediately (checkpoint / teleport). */
UFUNCTION(BlueprintCallable, Category="VerticalPartition")
void RequestSnap() { bSnapNextUpdate = true; }
/** Teleport the tracked pawn to the centre of a Z cell (debug). */
UFUNCTION(BlueprintCallable, Category="VerticalPartition")
void TeleportToCell(int32 Z);
private:
float UpdateAccumulator = 0.f;
bool bSnapNextUpdate = true; // snap on the first update
bool bHavePrevPos = false;
FVector PrevTrackedPos = FVector::ZeroVector;
FVector SmoothedVelocity = FVector::ZeroVector;
APawn* ResolveTrackedPawn();
bool BuildContext(struct FVerticalStreamingContext& OutCtx, float DeltaSeconds, bool& bOutTeleport);
};