Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.63 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "UObject/ObjectMacros.h"
  7. #include "Engine/Brush.h"
  8. #include "GameFramework/Volume.h"
  9. #include "Engine/Public/EngineUtils.h"
  10. #include "Engine/Classes/Components/InstancedStaticMeshComponent.h"
  11. #include "Foliage/Public/InstancedFoliageActor.h"
  12. #include "Classes/Engine/TextureRenderTarget2D.h"
  13. #include "Core/Public/Logging/MessageLog.h"
  14. #include "UnrealEd/Public/ScopedTransaction.h"
  15. #include "Engine/Classes/Engine/CanvasRenderTarget2D.h"
  16. #include "Runtime/Engine/Classes/Engine/Canvas.h"
  17. #include "Runtime/Engine/Classes/Kismet/KismetRenderingLibrary.h"
  18. #include "Runtime/Core/Public/Misc/ScopedSlowTask.h"
  19.  
  20. #include "Runtime/Landscape/Classes/LandscapeProxy.h"
  21. #include "Landscape/Classes/Landscape.h"
  22. #include "Landscape/Classes/LandscapeStreamingProxy.h"
  23. #include "Landscape/Public/LandscapeEdit.h"
  24.  
  25. #include "HyperFoliageCollection.h"
  26. #include "HyperFoliageFlora.h"
  27. #include "HyperFoliageISMC.h"
  28. #include "HyperFoliageISM.h"
  29.  
  30. #include "HyperFoliageVolume.generated.h"
  31.  
  32.  
  33. class UHyperFoliageCollection;
  34. class UHyperFoliageFlora;
  35. class UHyperFoliageISMC;
  36.  
  37.  
  38. USTRUCT(BlueprintType)
  39. struct FHyperFoliageLandscapeLayer
  40. {
  41.     GENERATED_USTRUCT_BODY()
  42.  
  43.     UPROPERTY()
  44.         ALandscapeProxy * Landscape;
  45.  
  46.     UPROPERTY()
  47.         FName Layer;
  48.  
  49.     UPROPERTY()
  50.         UCanvasRenderTarget2D * Texture;
  51.  
  52.     FHyperFoliageLandscapeLayer() {};
  53.  
  54.     FHyperFoliageLandscapeLayer(ALandscapeProxy * InLandscape, FName InLayer)
  55.     {
  56.         Landscape = InLandscape;
  57.         Layer = InLayer;
  58.     };
  59. };
  60.  
  61.  
  62. UCLASS(NotBlueprintable, HideDropdown, CollapseCategories, AutoExpandCategories=("Brush Settings"))
  63. class AHyperFoliageVolume : public AVolume
  64. {
  65.     GENERATED_UCLASS_BODY()
  66.  
  67.         friend UHyperFoliageFlora;
  68.  
  69. public:
  70.     virtual bool IsVolumeBrush() const
  71.     {
  72.         return true;
  73.     }
  74.  
  75.     virtual bool IsEditorOnly() const
  76.     {
  77.         return true;
  78.     }
  79.  
  80.     /**
  81.      * Whether the volume is currently enabled or not.
  82.      */
  83.     UPROPERTY(EditAnywhere, BlueprintReadOnly)
  84.         uint32 bEnabled : 1;
  85.  
  86. // HyperFoliage properties and functions
  87.     UPROPERTY(EditAnywhere, SimpleDisplay, Category = "HyperFoliage")
  88.         TSubclassOf <UHyperFoliageCollection> HyperFoliageCollectionType;
  89.  
  90.     UPROPERTY()
  91.         UHyperFoliageCollection * HyperFoliageCollection;
  92.  
  93.     UPROPERTY()
  94.         TArray <UHyperFoliageFlora *> HyperFoliageFlora;
  95.  
  96.     UPROPERTY(EditAnywhere, AdvancedDisplay, Category = "HyperFoliage")
  97.         TArray <FHyperFoliageInstance> HyperFoliageInstances;
  98.  
  99.     UPROPERTY()
  100.         TArray <UHyperFoliageISMC *> HyperISMCs;
  101.  
  102.     FScopedSlowTask * SlowTask;
  103.     float SlowTaskIncrement;
  104.    
  105.     UPROPERTY()
  106.         TArray <FHyperFoliageNeighbour> Neighbours;
  107.  
  108.     UPROPERTY()
  109.         AHyperFoliageISM * FoliageActor;
  110.  
  111.     UPROPERTY()
  112.         ULevel * CurrentLandscape;
  113.  
  114.     UPROPERTY()
  115.         TArray <FHyperFoliageLandscapeLayer> RenderTargets;
  116.  
  117.     // Start the procedural foliage placement process
  118.     UFUNCTION(BlueprintCallable)
  119.         void GenerateFoliage();
  120.  
  121.     // Start the procedural foliage placement process
  122.     UFUNCTION(BlueprintCallable)
  123.         void ClearFoliage();
  124.  
  125.     UFUNCTION(BlueprintCallable, meta = (UnsafeDuringActorConstruction = "true"), Category = "HyperFoliage")
  126.         bool LandscapeImportWeightmapFromRenderTarget(UTextureRenderTarget2D * InRenderTarget, FName InLayerName, ALandscapeProxy * Landscape);
  127.  
  128.     bool DistributeFoliage();
  129.     bool PlaceFoliage(FHyperFoliageInstance HyperFoliageInstance);
  130.     bool PaintLandscapeLayer(FHyperFoliageInstance HyperFoliageInstance);
  131.     bool SaveLandscapeLayers();
  132.     float GatherWorkNeeded(TSubclassOf <UHyperFoliageFlora> HyperFoliageFloraType);
  133.     void ChangeCurrentLandscape(ALandscapeProxy * Landscape);
  134. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement