Advertisement
antidamage

Untitled

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