Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Warning! Experimental! No guarantees on functionality! Use at your own risk!!!!!
- #pragma once
- #include "CoreMinimal.h"
- #include "Kismet/BlueprintFunctionLibrary.h"
- #include "Landscape.h"
- #include "Plugin.h"
- #include "ESMDataMapper.generated.h"
- UCLASS()
- class UESMDataMapper : public UBlueprintFunctionLibrary
- {
- GENERATED_BODY()
- public:
- /** Extracts height data from a single LAND record. Returns false if the record is not a LAND record or lacks VHGT data. */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static bool ExtractHeightDataFromRecord(const FRecord& Record, int32 CellX, int32 CellY, TArray<float>& OutHeightData, float& OutHeightOffset);
- /** Extracts height data from an array of records for a specific cell (X, Y). Returns false if no matching LAND record is found. */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static bool ExtractHeightDataFromRecords(const TArray<FRecord>& Records, int32 CellX, int32 CellY, TArray<float>& OutHeights, float& OutHeightOffset);
- /** Extracts height data from LAND records in the plugin for a specific cell (X, Y). Returns false if no matching LAND record is found. */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static bool ExtractLandHeightDataFromPlugin(const FPlugin& Plugin, int32 CellX, int32 CellY, TArray<float>& OutHeights, float& OutHeightOffset);
- /** Handles individual LAND record processing, extracting CellX, CellY, and height data. */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static bool LANDHandler(const FRecord& Record, int32& CellX, int32& CellY, TArray<float>& OutHeightData, float& OutHeightOffset);
- /** Converts raw height data to a heightmap represented as bytes (legacy method). */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static TArray<uint8> ConvertESMHeightToHeightmapBytes(const TArray<float>& Heights, float MinHeight, float MaxHeight);
- /** Creates a landscape actor from a heightmap stored as bytes (legacy method). */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static ALandscape* CreateLandscapeFromHeightmapBytes(UWorld* World, const TArray<uint8>& HeightmapBytes, int32 Width, int32 Height, float ScaleX, float ScaleY, float ScaleZ);
- /** Creates a landscape actor using a modern Unreal Engine 5 approach with raw height data. */
- UFUNCTION(BlueprintCallable, Category = "ESM Mapping")
- static ALandscape* CreateLandscapeModern(UWorld* World, const TArray<float>& Heights, int32 CellX, int32 CellY, int32 Width, int32 Height, float ScaleX, float ScaleY, float ScaleZ);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement