33 lines
579 B
C++
33 lines
579 B
C++
#include "../core/Defines.h"
|
|
#include "PointLight.h"
|
|
|
|
PointLight::PointLight() {
|
|
SetPosition(0.0);
|
|
}
|
|
|
|
PointLight::~PointLight() {
|
|
|
|
}
|
|
|
|
const glm::vec3& PointLight::GetPosition() const
|
|
{
|
|
return mPosition;
|
|
}
|
|
|
|
void PointLight::SetPosition(const glm::vec3& pos)
|
|
{
|
|
mPosition = pos;
|
|
}
|
|
|
|
void PointLight::SetPosition(double seed) {
|
|
double theta = mPi * (.65 + .25 * sin(.9*seed));
|
|
double phi = m2Pi * (.4*seed - int(.4*seed));
|
|
|
|
double x = 500.0 * sin(theta) * cos(phi);
|
|
double y = 500.0 * cos(theta);
|
|
double z = 500.0 * sin(theta) * sin(phi);
|
|
|
|
mPosition = glm::vec3(x, y, z);
|
|
}
|
|
|