// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "ProceduralMeshComponent.h"
#include "Ocean.generated.h"

UCLASS()
class SEAOFCROOKS_API AOcean : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AOcean();

	float GetOceanHeight();

protected:
	UPROPERTY(BlueprintReadOnly, Category="Components")
	UProceduralMeshComponent* OceanMesh;

	// XSize and YSize are the number of tiles in the mesh
	UPROPERTY(EditDefaultsOnly, Category="Properties")
	uint32 XSize;

	UPROPERTY(EditDefaultsOnly, Category="Properties")
	uint32 YSize;	

	UPROPERTY()
	TArray<FVector> Vertices;
	
	UPROPERTY()
	TArray<int32> Triangles;

	UPROPERTY()
	TArray<FVector> Normals;

	UPROPERTY()
	TArray<FVector2D> UV0;

	UPROPERTY()
	TArray<FColor> VertexColors;

	UPROPERTY()
	TArray<FProcMeshTangent> Tangents;
	
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

private:
	void GenerateMesh();
	
};