CARLA
 
载入中...
搜索中...
未找到
TaggedComponent.h
浏览该文件的文档.
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
10UCLASS( meta=(BlueprintSpawnableComponent) )
11class CARLA_API UTaggedComponent : public UPrimitiveComponent
12{
13 GENERATED_BODY()
14
15public:
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
27private:
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{
50public:
51 FTaggedStaticMeshSceneProxy(UStaticMeshComponent * Component, bool bForceLODsShareStaticLighting, UMaterialInstance * MaterialInstance);
52
53 virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
54
55private:
56 UMaterialInstance * TaggedMaterialInstance;
57};
58
60{
61public:
62 FTaggedSkeletalMeshSceneProxy(const USkinnedMeshComponent * Component, FSkeletalMeshRenderData * InSkeletalMeshRenderData, UMaterialInstance * MaterialInstance);
63
64 virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
65
66private:
67 UMaterialInstance * TaggedMaterialInstance;
68};
69
71{
72public:
73 FTaggedInstancedStaticMeshSceneProxy(UInstancedStaticMeshComponent * Component, ERHIFeatureLevel::Type InFeatureLevel, UMaterialInstance * MaterialInstance);
74
75 virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
76
77private:
78 UMaterialInstance * TaggedMaterialInstance;
79};
80
81
83{
84public:
85 FTaggedHierarchicalStaticMeshSceneProxy(UHierarchicalInstancedStaticMeshComponent * Component, bool bInIsGrass, ERHIFeatureLevel::Type InFeatureLevel, UMaterialInstance * MaterialInstance);
86
87 virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView * View) const override;
88
89private:
90 UMaterialInstance * TaggedMaterialInstance;
91};
FTaggedHierarchicalStaticMeshSceneProxy(UHierarchicalInstancedStaticMeshComponent *Component, bool bInIsGrass, ERHIFeatureLevel::Type InFeatureLevel, UMaterialInstance *MaterialInstance)
virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView *View) const override
virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView *View) const override
FTaggedInstancedStaticMeshSceneProxy(UInstancedStaticMeshComponent *Component, ERHIFeatureLevel::Type InFeatureLevel, UMaterialInstance *MaterialInstance)
virtual FPrimitiveViewRelevance GetViewRelevance(const FSceneView *View) const override
UMaterialInstance * TaggedMaterialInstance
FTaggedSkeletalMeshSceneProxy(const USkinnedMeshComponent *Component, FSkeletalMeshRenderData *InSkeletalMeshRenderData, UMaterialInstance *MaterialInstance)
UMaterialInstance * TaggedMaterialInstance
FLinearColor Color