//------------------------------------------------------------------------------
// Lamp : Open source game middleware
// Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//------------------------------------------------------------------------------

/** @file
 * ライト実装
 * @author Junpee
 */

#include "LampBasic.h"
#include "Graphics/Light/Light.h"
#include "Graphics/Light/LightManager.h"
#include "Graphics/Mesh/Mesh.h"

namespace Lamp{

//------------------------------------------------------------------------------
// コンストラクタ
Light::Light(const String& name, Scene* scene) : SceneLeaf(name, scene),
	lightMask_(1){
}
//------------------------------------------------------------------------------
// デストラクタ
Light::~Light(){
}
//------------------------------------------------------------------------------
// ライトの値コピー
void Light::copyLightValue(Light* destination) const{
	// シーンリーフの値コピー
	copySceneLeafValue(destination);
	// ライトマスク
	destination->setLightMask(lightMask_);
}
//------------------------------------------------------------------------------
// 破棄
int Light::destroy(Light* light){
	Assert(light != NULL);
	// 引数の破棄
	LightManager* manager = light->getScene()->getLightManager();
	if(manager->destroy(light) == 0){ return 1; }
	return 0;
}
//------------------------------------------------------------------------------
} // End of namespace Lamp
//------------------------------------------------------------------------------
