Files
BlitzNext/Runtime/blitz3d/light.cpp
T

40 lines
621 B
C++
Raw Normal View History

2014-01-31 08:23:00 +13:00
2019-01-18 15:55:06 +01:00
#include "light.hpp"
#include "../gxruntime/gxscene.hpp"
2019-01-18 17:04:17 +01:00
#include "std.hpp"
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
extern gxScene* gx_scene;
2014-01-31 08:23:00 +13:00
2019-01-18 17:04:17 +01:00
Light::Light(int type)
{
light = gx_scene->createLight(type);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
Light::~Light()
{
gx_scene->freeLight(light);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
void Light::setRange(float r)
{
light->setRange(r);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
void Light::setColor(const Vector& v)
{
light->setColor((float*)&v.x);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
void Light::setConeAngles(float inner, float outer)
{
light->setConeAngles(inner, outer);
2014-01-31 08:23:00 +13:00
}
2019-01-18 17:04:17 +01:00
bool Light::beginRender(float tween)
{
Object::beginRender(tween);
light->setPosition(&getRenderTform().v.x);
light->setDirection(&getRenderTform().m.k.x);
2014-01-31 08:23:00 +13:00
return true;
}