Skip to content
Snippets Groups Projects
Commit 6ddf8a94 authored by aenneking's avatar aenneking
Browse files

changed value to reference argument

parent 54a4ca5c
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ public class MultiLine : ModuleRules
new string[]
{
"Core",
"ProceduralMeshComponent"
// ... add other public dependencies that you statically link with here ...
}
);
......
......@@ -18,8 +18,9 @@ AMultiLineActor::AMultiLineActor()
RootComponent = mesh_;
}
#pragma optimize( "", off )
void AMultiLineActor::CreateMesh(TArray<LineProps> line_props_vec, bool has_collision_context)
void AMultiLineActor::CreateMesh(TArray<LineProps> & line_props_vec, bool has_collision_context)
{
TArray<FLinearColor> vertex_colors;
FOccluderVertexArray vertices;
......@@ -58,7 +59,7 @@ void AMultiLineActor::CreateMesh(TArray<LineProps> line_props_vec, bool has_coll
}
void AMultiLineActor::UpdateMesh(TArray<LineProps> line_props_vec)
void AMultiLineActor::UpdateMesh(TArray<LineProps> & line_props_vec)
{
auto uv = TArray<FVector2D>();
auto tangents = TArray<FProcMeshTangent>();
......@@ -77,6 +78,7 @@ void AMultiLineActor::UpdateMesh(TArray<LineProps> line_props_vec)
mesh_->UpdateMeshSection_LinearColor(0, vertices, normals, uv, vertex_colors, tangents);
}
void AMultiLineActor::SetFlatShading(bool use_flat_shading)
{
if (use_flat_shading)
......@@ -84,15 +86,22 @@ void AMultiLineActor::SetFlatShading(bool use_flat_shading)
else
material_->SetShadingModel(EMaterialShadingModel::MSM_DefaultLit);
}
void AMultiLineActor::Destroyed()
{
if (mesh_)
mesh_->ClearAllMeshSections();
AActor::Destroyed();
}
#pragma optimize( "", on )
// Called when the game starts or when spawned
void AMultiLineActor::BeginPlay()
{
Super::BeginPlay();
}
void AMultiLineActor::CreateVertices(LineProps line_props, FOccluderVertexArray & vertices)
void AMultiLineActor::CreateVertices(LineProps & line_props, FOccluderVertexArray & vertices)
{
for (size_t i = 1; i < line_props.points.Num(); ++i)
{
......
......@@ -17,18 +17,20 @@ public:
// Sets default values for this actor's properties
AMultiLineActor();
void CreateMesh(TArray<LineProps> line_props_vec, bool has_collision_context = false);
void CreateMesh(TArray<LineProps> & line_props_vec, bool has_collision_context = false);
void UpdateMesh(TArray<LineProps> line_props_vec);
void UpdateMesh(TArray<LineProps> & line_props_vec);
UFUNCTION(BlueprintCallable, Category = "SunShine")
void SetFlatShading(bool use_flat_shading);
virtual void Destroyed() override;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void CreateVertices(LineProps line_props, FOccluderVertexArray & vertices);
void CreateVertices(LineProps & line_props, FOccluderVertexArray & vertices);
void SetUpTriangles(size_t index_offset, TArray<int32> & triangles);
public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment