/// Copyright (c) 2010 Ruben Penalva. All rights reserved.
/// Redistribution and use in source and binary forms, with or without modification, 
/// are permitted provided that the following conditions are met:
///    1. Redistributions of source code must retain the above copyright notice, this 
///    list of conditions and the following disclaimer.
///    2. Redistributions in binary form must reproduce the above copyright notice,
///    this list of conditions and the following disclaimer in the documentation and/or
///    other materials provided with the distribution.
///    3. The name of the author may not be used to endorse or promote products derived
///    from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
/// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
/// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
/// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
/// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
/// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
/// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "TestScene.h"

#include <windows.h>
#include "UnicodeString.h"


using namespace TaskBasedFlockSim;

TestScene::TestScene()	:	TestFrameWork::Scene(), m_flock(),
							m_teapot(L"data\\teapot.obj"), m_vertexShaderFile(L"glsl\\vertexShader.glsl"),
							m_pixelShaderFile(L"glsl\\pixelShader.glsl"), m_logicElapsedTime(0.0f)
{
	TestFrameWork::Matrix4x4 scale;
	scale.BuildScale(0.1f, 0.1f, 0.1f);

	m_transformation.BuildRotationY(-90.0f);
	
	m_transformation *= scale;
}

TestScene::~TestScene(void)
{
}

void TestScene::SetTasksCount(size_t tasksCount)
{
	m_tasksCount = tasksCount;
}

size_t TestScene::GetTasksCount(void) const
{
	return m_tasksCount;
}

Flock& TestScene::GetFlock(void)
{
	return m_flock;
}

const TestFrameWork::Geometry& TestScene::GetTeapot(void) const
{
	return m_teapot;
}

const std::wstring& TestScene::GetVertexShaderFile(void) const
{
	return m_vertexShaderFile;
}

const std::wstring& TestScene::GetPixelShaderFile(void) const
{
	return m_pixelShaderFile;
}

const TestFrameWork::Matrix4x4& TestScene::GetTeapotTransformation(void) const
{
	return m_transformation;
}

void TestScene::SetLogicElapsedTime(float elpasedTime)
{
	m_logicElapsedTime = elpasedTime;
}

float TestScene::GetLogicElapsedTime(void) const
{
	return m_logicElapsedTime;
}

void TestScene::Clone(TestFrameWork::ScenePtr scene)
{
	boost::shared_ptr<TestScene> testScene(boost::shared_polymorphic_downcast<TestScene>(scene));

	m_teapot = testScene->m_teapot;
	m_flock = testScene->m_flock;
	m_tasksCount = testScene->m_tasksCount;
	m_camera = testScene->m_camera;
	m_logicElapsedTime = testScene->m_logicElapsedTime;
}