#pragma once

#include <GL/glew.h>

#include <glm/vec3.hpp>
#include <vector>

#include "renderable.h"
#include "shader.h"

class PointLight final : public Renderable {
 public:
  explicit PointLight(const glm::vec3 &);
  ~PointLight() override;

  void LoadData(const Shader *) const;
  void GenerateCubeMaps(const std::vector<Renderable *> &) const;

  GLuint getDepthTexture() const { return depth_; }
  void setPosition(const glm::vec3 &pos) {
    pos_ = pos;
    CleanUp();
    InitGeom();
  }
  void setColors(const glm::vec3 &color) {
    diffuse_ = color;
    specular_ = color;
    ambient_ = color / 5.0f;
  }

 private:
  void SetData() override;

  glm::vec3 ambient_{0.2};
  glm::vec3 diffuse_{1};
  glm::vec3 specular_{diffuse_};
  float specularPower_{20};
  glm::vec3 pos_;

  Shader shadow_{R"(@SHADOW_VERT@)", R"(@SHADOW_FRAG@)", R"(@SHADOW_GEOM@)"};
  GLuint fbo_{0};
  GLuint depth_{0};
};
