CARLA
TaggedComponent.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CoreMinimal.h"
4 #include "Materials/MaterialInstanceDynamic.h"
5 #include "Engine/InstancedStaticMesh.h"
6 #include "Components/HierarchicalInstancedStaticMeshComponent.h"
7 
8 #include "TaggedComponent.generated.h"
9 
10 UCLASS( meta=(BlueprintSpawnableComponent) )
11 class CARLA_API UTaggedComponent : public UPrimitiveComponent
12 {
13  GENERATED_BODY()
14 
15 public:
16  UTaggedComponent(const FObjectInitializer& ObjectInitializer);
17 
18  virtual FPrimitiveSceneProxy * CreateSceneProxy() override;
19  virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override;
20  virtual void OnRegister() override;
21  virtual FBoxSphereBounds CalcBounds(const FTransform & LocalToWorld) const ;
22 
23  // FIXME: Should take an int32 and convert to FVector4
24  void SetColor(FLinearColor color);
25  FLinearColor GetColor();
26 
27 private:
28  FLinearColor Color;
29 
30  UPROPERTY()
31  UMaterial * TaggedMaterial;
32 
33  UPROPERTY()
34  UMaterialInstanceDynamic * TaggedMID;
35 
36  bool bSkeletalMesh = false;
37 
38  FPrimitiveSceneProxy * CreateSceneProxy(UStaticMeshComponent * StaticMeshComponent);
39  FPrimitiveSceneProxy * CreateSceneProxy(USkeletalMeshComponent * SkeletalMeshComponent);
40  FPrimitiveSceneProxy * CreateSceneProxy(UHierarchicalInstancedStaticMeshComponent * MeshComponent);
41  FPrimitiveSceneProxy * CreateSceneProxy(UInstancedStaticMeshComponent * MeshComponent);
42 
43  // small hack to allow unreal to initialize the base component in skeletal meshes
44  bool bShouldWaitFrame = true;
45  int NumFramesToWait = 2;
46 };
47 
49 {
50 public:
51  FTaggedStaticMeshSceneProxy(UStaticMeshComponent * Component, bool bForceLODsShareStaticLighting, UMaterialInstance * MaterialInstance);
52 
53  virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
54 
55 private:
56  UMaterialInstance * TaggedMaterialInstance;
57 };
58 
60 {
61 public:
62  FTaggedSkeletalMeshSceneProxy(const USkinnedMeshComponent * Component, FSkeletalMeshRenderData * InSkeletalMeshRenderData, UMaterialInstance * MaterialInstance);
63 
64  virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
65 
66 private:
67  UMaterialInstance * TaggedMaterialInstance;
68 };
69 
71 {
72 public:
73  FTaggedInstancedStaticMeshSceneProxy(UInstancedStaticMeshComponent * Component, ERHIFeatureLevel::Type InFeatureLevel, UMaterialInstance * MaterialInstance);
74 
75  virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
76 
77 private:
78  UMaterialInstance * TaggedMaterialInstance;
79 };
80 
81 
83 {
84 public:
85  FTaggedHierarchicalStaticMeshSceneProxy(UHierarchicalInstancedStaticMeshComponent * Component, bool bInIsGrass, ERHIFeatureLevel::Type InFeatureLevel, UMaterialInstance * MaterialInstance);
86 
87  virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
88 
89 private:
90  UMaterialInstance * TaggedMaterialInstance;
91 };
FTaggedSkeletalMeshSceneProxy(const USkinnedMeshComponent *Component, FSkeletalMeshRenderData *InSkeletalMeshRenderData, UMaterialInstance *MaterialInstance)
UMaterialInstance * TaggedMaterialInstance
UMaterialInstance * TaggedMaterialInstance
FLinearColor Color
UMaterialInstance * TaggedMaterialInstance
virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView *View) const override
static LaneMarking::Color GetColor(std::string str)
Definition: LaneMarking.cpp:44