Skip to content
Snippets Groups Projects
Commit edd9497a authored by David Gilbert's avatar David Gilbert :bug:
Browse files

- Added subdivided meshes with more triangles. For some weird reason those can...

- Added subdivided meshes with more triangles. For some weird reason those can achieve better performance, especially the #5 one. Still use the regular one by default for now.
- Cleaned up some c-style casts.
- Cleaned up some NULL comparisons.
- Cleaned up some unused functions.
- Cleaned up UpdateTexture function and combined a few others.
parent dd8cfb52
No related branches found
No related tags found
No related merge requests found
No preview for this file type
File added
File added
File added
File added
...@@ -99,7 +99,6 @@ public: ...@@ -99,7 +99,6 @@ public:
virtual void BeginPlay() override; virtual void BeginPlay() override;
virtual void PostInitProperties() override;
#if WITH_EDITOR #if WITH_EDITOR
virtual void PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) override; virtual void PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) override;
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; // need this for the widget as for some godforsaken reason the Chain event doesn't fire... virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; // need this for the widget as for some godforsaken reason the Chain event doesn't fire...
...@@ -107,17 +106,8 @@ public: ...@@ -107,17 +106,8 @@ public:
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
#endif #endif
//virtual TStructOnScope<FActorComponentInstanceData> GetComponentInstanceData() const override;
/** Applies the cached component instance data to a newly blueprint constructed component. */
//virtual void ApplyComponentInstanceData(struct FUGPUInstancedLineComponentInstanceData* ComponentInstanceData);
virtual void PostLoad() override;
virtual void OnComponentCreated() override;
virtual void BeginDestroy() override; virtual void BeginDestroy() override;
virtual void Serialize(FArchive& Ar) override;
private: private:
void MoveTextureMarker() void MoveTextureMarker()
...@@ -134,19 +124,21 @@ private: ...@@ -134,19 +124,21 @@ private:
void Init(); void Init();
//void RegisterSerializedEditorLines();
void UpdateAllEditorLines(); void UpdateAllEditorLines();
FUpdateTextureRegion2D* CalculateTextureRegions(const FIntPoint& StartIndex, int32 NumberOfPoints, int32& NumberOfRegionsOut); FUpdateTextureRegion2D* CalculateTextureRegions(const FIntPoint& StartIndex, int32 NumberOfPoints, int32& NumberOfRegionsOut);
public: void ReleaseData(); // todo
// todo
void ReleaseData(); int32 AddNewSegmentInstance(const FLinearColor& Color, float Width, int32 Index);
void UpdateTexture(const FIntPoint& StartIndex, int32 NumberOfPoints, uint8* SrcData, bool bMarkRenderStateDirty = true);
public:
void UpdateWholeTexture() const; void UpdateWholeTexture() const;
int32 AddNewSegmentInstance(const FLinearColor& Color, float Width, int32 Index); FLinearColor GetLineColor(int32 LineId);
/** /**
* Reserves internal memory for a given amount of Lines and Segments per Line. * Reserves internal memory for a given amount of Lines and Segments per Line.
...@@ -189,6 +181,9 @@ public: ...@@ -189,6 +181,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "Components|InstancedLineComponent") UFUNCTION(BlueprintCallable, Category = "Components|InstancedLineComponent")
void InitializeLinesInBulk(int32 NumberOfLines, int32 NumberOfSegmentsPerLine, TArray<FVector4>& Points, const TArray<FLinearColor>& Colors, const TArray<float>& Widths); void InitializeLinesInBulk(int32 NumberOfLines, int32 NumberOfSegmentsPerLine, TArray<FVector4>& Points, const TArray<FLinearColor>& Colors, const TArray<float>& Widths);
void InitializeLinesInBulkTesselate(int32 NumberOfLines, int32 NumberOfSegmentsPerLine, TArray<FVector4>& Points, const TArray<FLinearColor>& Colors, const TArray<float>& Widths);
/** /**
* Adds a line and returns the respective ID of the line, which can be used to identify it for updating, modifying and removing. * Adds a line and returns the respective ID of the line, which can be used to identify it for updating, modifying and removing.
* *
...@@ -202,7 +197,7 @@ public: ...@@ -202,7 +197,7 @@ public:
int32 AddLine(const TArray<FVector>& Line, FLinearColor Color, float Width = 1.0); int32 AddLine(const TArray<FVector>& Line, FLinearColor Color, float Width = 1.0);
int32 AddLine(TArray<FVector4>& Line, FLinearColor Color, float Width = 1.0); int32 AddLine(TArray<FVector4>& Line, FLinearColor Color, float Width = 1.0, bool bMarkRenderStateDirty = true);
/** /**
* Adds a line and returns the respective ID of the line, which can be used to identify it for updating, modifying and removing. * Adds a line and returns the respective ID of the line, which can be used to identify it for updating, modifying and removing.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment