2012-04-05 23:09:41 +00:00
|
|
|
//
|
|
|
|
|
// KRLight.cpp
|
|
|
|
|
// KREngine
|
|
|
|
|
//
|
|
|
|
|
// Created by Kearwood Gilbert on 12-04-05.
|
|
|
|
|
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
#import "KRLight.h"
|
|
|
|
|
|
2012-04-12 00:43:53 +00:00
|
|
|
KRLight::KRLight(std::string name) : KRNode(name)
|
2012-04-05 23:09:41 +00:00
|
|
|
{
|
2012-04-12 00:43:53 +00:00
|
|
|
m_intensity = 1.0f;
|
2012-04-05 23:09:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KRLight::~KRLight()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-12 00:43:53 +00:00
|
|
|
tinyxml2::XMLElement *KRLight::saveXML( tinyxml2::XMLNode *parent)
|
2012-04-05 23:09:41 +00:00
|
|
|
{
|
2012-04-12 00:43:53 +00:00
|
|
|
tinyxml2::XMLElement *e = KRNode::saveXML(parent);
|
|
|
|
|
e->SetAttribute("intensity", m_intensity);
|
|
|
|
|
e->SetAttribute("color_r", m_color.x);
|
|
|
|
|
e->SetAttribute("color_g", m_color.y);
|
|
|
|
|
e->SetAttribute("color_b", m_color.z);
|
|
|
|
|
e->SetAttribute("decay_start", m_decayStart);
|
|
|
|
|
return e;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-12 01:27:30 +00:00
|
|
|
void KRLight::loadXML(tinyxml2::XMLElement *e) {
|
|
|
|
|
KRNode::loadXML(e);
|
|
|
|
|
float x,y,z;
|
|
|
|
|
e->QueryFloatAttribute("color_r", &x);
|
|
|
|
|
e->QueryFloatAttribute("color_g", &y);
|
|
|
|
|
e->QueryFloatAttribute("color_b", &z);
|
|
|
|
|
m_color = KRVector3(x,y,z);
|
|
|
|
|
|
|
|
|
|
e->QueryFloatAttribute("intensity", &m_intensity);
|
|
|
|
|
e->QueryFloatAttribute("decay_start", &m_decayStart);
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-12 00:43:53 +00:00
|
|
|
void KRLight::setIntensity(float intensity) {
|
|
|
|
|
m_intensity = intensity;
|
|
|
|
|
}
|
|
|
|
|
float KRLight::getIntensity() {
|
|
|
|
|
return m_intensity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const KRVector3 &KRLight::getColor() {
|
|
|
|
|
return m_color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KRLight::setColor(const KRVector3 &color) {
|
|
|
|
|
m_color = color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KRLight::setDecayStart(float decayStart) {
|
|
|
|
|
m_decayStart = decayStart;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float KRLight::getDecayStart() {
|
|
|
|
|
return m_decayStart;
|
|
|
|
|
}
|