Пример #1
0
void Pipe::Train() {

  PreprocessData();
  CreateInstances();
  parameters_->Initialize(options_->use_averaging());
  
  if (options_->only_supported_features()) MakeSupportedParameters();

  for (int i = 0; i < options_->GetNumEpochs(); ++i) {
    TrainEpoch(i);
  }

  parameters_->Finalize(options_->GetNumEpochs() * instances_.size());
}
Пример #2
0
  SliceOrdering::SliceOrdering(ServerIndex& index,
                               const std::string& seriesId) :
    index_(index),
    seriesId_(seriesId),
    isVolume_(false)
  {
    ComputeNormal();
    CreateInstances();

    if (!SortUsingPositions() &&
        !SortUsingIndexInSeries())
    {
      LOG(ERROR) << "Unable to order the slices of the series " << seriesId;
      throw OrthancException(ErrorCode_CannotOrderSlices);
    }
  }
Пример #3
0
// the program starts here
void AppMain() {
    // initialise GLFW
    if(!glfwInit())
        throw std::runtime_error("glfwInit failed");

    // open a window with GLFW
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
    glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
    if(!glfwOpenWindow((int)SCREEN_SIZE.x, (int)SCREEN_SIZE.y, 8, 8, 8, 8, 16, 0, GLFW_WINDOW))
        throw std::runtime_error("glfwOpenWindow failed. Can your hardware handle OpenGL 3.2?");

    // GLFW settings
    glfwDisable(GLFW_MOUSE_CURSOR);
    glfwSetMousePos(0, 0);
    glfwSetMouseWheel(0);

    // initialise GLEW
    glewExperimental = GL_TRUE; //stops glew crashing on OSX :-/
    if(glewInit() != GLEW_OK)
        throw std::runtime_error("glewInit failed");

    // GLEW throws some errors, so discard all the errors so far
    while(glGetError() != GL_NO_ERROR) {}

    // print out some info about the graphics drivers
    std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;
    std::cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
    std::cout << "Vendor: " << glGetString(GL_VENDOR) << std::endl;
    std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl;

    // make sure OpenGL version 3.2 API is available
    if(!GLEW_VERSION_3_2)
        throw std::runtime_error("OpenGL 3.2 API is not available.");

    // OpenGL settings
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    // initialise the gWoodenCrate asset
    LoadWoodenCrateAsset();

    // create all the instances in the 3D scene based on the gWoodenCrate asset
    CreateInstances();

    // setup gCamera
    gCamera.setPosition(glm::vec3(-4,0,17));
    gCamera.setViewportAspectRatio(SCREEN_SIZE.x / SCREEN_SIZE.y);
    gCamera.setNearAndFarPlanes(0.5f, 100.0f);

    // setup gLight
    gLight.position = glm::vec3(-4,0,4);
    gLight.intensities = glm::vec3(1,1,1); //white
    gLight.attenuation = 0.2f;
    gLight.ambientCoefficient = 0.005f;

    // run while the window is open
    double lastTime = glfwGetTime();
    while(glfwGetWindowParam(GLFW_OPENED)){
        // update the scene based on the time elapsed since last update
        double thisTime = glfwGetTime();
        Update((float)(thisTime - lastTime));
        lastTime = thisTime;

        // draw one frame
        Render();

        // check for errors
        GLenum error = glGetError();
        if(error != GL_NO_ERROR)
            std::cerr << "OpenGL Error " << error << ": " << (const char*)gluErrorString(error) << std::endl;

        //exit program if escape key is pressed
        if(glfwGetKey(GLFW_KEY_ESC))
            glfwCloseWindow();
    }

    // clean up and exit
    glfwTerminate();
}
Пример #4
0
// the program starts here
void AppMain() {
    // initialise GLFW
    glfwSetErrorCallback(OnError);
    if(!glfwInit())
        throw std::runtime_error("glfwInit failed");

    // open a window with GLFW
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    gWindow = glfwCreateWindow((int)SCREEN_SIZE.x, (int)SCREEN_SIZE.y, "OpenGL Tutorial", NULL, NULL);
    if(!gWindow)
        throw std::runtime_error("glfwCreateWindow failed. Can your hardware handle OpenGL 3.2?");

    // GLFW settings
    glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
    glfwSetCursorPos(gWindow, 0, 0);
    glfwSetScrollCallback(gWindow, OnScroll);
    glfwMakeContextCurrent(gWindow);

    // initialise GLEW
    glewExperimental = GL_TRUE; //stops glew crashing on OSX :-/
    if(glewInit() != GLEW_OK)
        throw std::runtime_error("glewInit failed");

    // GLEW throws some errors, so discard all the errors so far
    while(glGetError() != GL_NO_ERROR) {}

    // print out some info about the graphics drivers
    std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;
    std::cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
    std::cout << "Vendor: " << glGetString(GL_VENDOR) << std::endl;
    std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl;

    // make sure OpenGL version 3.2 API is available
    if(!GLEW_VERSION_3_2)
        throw std::runtime_error("OpenGL 3.2 API is not available.");

    // OpenGL settings
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    // initialise the gWoodenCrate asset
    LoadWoodenCrateAsset();

    // create all the instances in the 3D scene based on the gWoodenCrate asset
    CreateInstances();

    // setup gCamera
    gCamera.setPosition(glm::vec3(-4,0,17));
    gCamera.setViewportAspectRatio(SCREEN_SIZE.x / SCREEN_SIZE.y);
    gCamera.setNearAndFarPlanes(0.5f, 100.0f);

    // setup gLight
    gLight.position = gCamera.position();
    gLight.intensities = glm::vec3(1,1,1); //white

    // run while the window is open
    float lastTime = (float)glfwGetTime();
    while(!glfwWindowShouldClose(gWindow)){
        // process pending events
        glfwPollEvents();

        // update the scene based on the time elapsed since last update
        float thisTime = (float)glfwGetTime();
        Update(thisTime - lastTime);
        lastTime = thisTime;

        // draw one frame
        Render();

        // check for errors
        GLenum error = glGetError();
        if(error != GL_NO_ERROR)
            std::cerr << "OpenGL Error " << error << std::endl;

        //exit program if escape key is pressed
        if(glfwGetKey(gWindow, GLFW_KEY_ESCAPE))
            glfwSetWindowShouldClose(gWindow, GL_TRUE);
    }

    // clean up and exit
    glfwTerminate();
}
Пример #5
0
int main(void)
{
	GLFWwindow* window;

	/* Initialize the library */
	if (!glfwInit())
		return -1;

	/* Create a windowed mode window and its OpenGL context */
	window = glfwCreateWindow(800, 600, "Hello World", NULL, NULL);
	if (!window)
	{
		glfwTerminate();
		return -1;
	}

	glfwSetScrollCallback(window, OnScroll);

	// GLFW settings
	glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
	glfwSetCursorPos(window, 0, 0);

	/* Make the window's context current */
	glfwMakeContextCurrent(window);

	if (glewInit() != GLEW_OK)
	{
		glfwTerminate();
		return -1;
	}

	// print out some info about the graphics drivers
	std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;
	std::cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
	std::cout << "Vendor: " << glGetString(GL_VENDOR) << std::endl;
	std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl;

	// OpenGL settings
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	LoadWoodenCrateAsset();

	CreateInstances();

	//glClearColor(0.196078431372549f, 0.3137254901960784f, 0.5882352941176471f, 1);
	glClearColor(0.0f, 0.0f, 0.0f, 1);


	gCamera.setPosition(glm::vec3(3.8, 1, 11));
	gCamera.offsetOrientation(10, 0);
	gCamera.setViewportAspectRatio(800.0f / 600.0f);
	gCamera.setNearAndFarPlanes(0.5f, 100.0f);

	double lastTime = glfwGetTime();
	while (!glfwWindowShouldClose(window))
	{
		/* Poll for and process events */
		glfwPollEvents();

		double thisTime = glfwGetTime();
		Update((float)(thisTime - lastTime), window);
		lastTime = thisTime;

		Render(window);

		// check for errors
		GLenum error = glGetError();
		if (error != GL_NO_ERROR)
			std::cerr << "OpenGL Error " << error << std::endl;

		//exit program if escape key is pressed
		if (glfwGetKey(window, GLFW_KEY_ESCAPE))
			glfwSetWindowShouldClose(window, GL_TRUE);
	}

	glfwTerminate();
	return 0;
}
Пример #6
0
// the program starts here
void AppMain() {
    // initialise GLFW
    glfwSetErrorCallback(OnError);
    if(!glfwInit())
        throw std::runtime_error("glfwInit failed");

    // open a window with GLFW
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

	glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
	gWindow = glfwCreateWindow((int)SCREEN_SIZE.x, (int)SCREEN_SIZE.y, "Mek", NULL /*glfwGetPrimaryMonitor()*/, NULL);
	if (!gWindow)
		throw std::runtime_error("glfwCreateWindow failed. Can your hardware handle OpenGL 3.3?");

    // GLFW settings
    glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
    glfwSetCursorPos(gWindow, 0, 0);
    glfwSetScrollCallback(gWindow, OnScroll);
    glfwMakeContextCurrent(gWindow);

	// required or we crash on VAO creation
	glewExperimental = GL_TRUE;
    // initialise GLEW
	if (glewInit() != GLEW_OK)
	{
        throw std::runtime_error("glewInit failed");
	}

    // GLEW throws some errors so discard all the errors so far
    while(glGetError() != GL_NO_ERROR) {}

	// Init DevIL
	ilInit();

	// enable vsync using windows only code
#ifdef _WIN32
	// Turn on vertical screen sync under Windows.
	typedef BOOL(WINAPI *PFNWGLSWAPINTERVALEXTPROC)(int interval);
	PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
	wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
	if (wglSwapIntervalEXT)
		wglSwapIntervalEXT(1);
#endif

    // print out some info about the graphics drivers
    std::cout << "OpenGL version: " << glGetString(GL_VERSION) << std::endl;
    std::cout << "GLSL version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
    std::cout << "Vendor: " << glGetString(GL_VENDOR) << std::endl;
    std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl;

    // make sure OpenGL version 3.2 API is available
    if(!GLEW_VERSION_3_3)
        throw std::runtime_error("OpenGL 3.3 API is not available.");

    // OpenGL settings
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    // initialise the gWoodenCrate asset
    LoadWoodenCrateAsset();

    // create all the instances in the 3D scene based on the gWoodenCrate asset
    CreateInstances();

    // setup Camera::getInstance()
    Camera::getInstance().setPosition(glm::vec3(1100, 75, 0));
    Camera::getInstance().setViewportAspectRatio(SCREEN_SIZE.x / SCREEN_SIZE.y);
	Camera::getInstance().setNearAndFarPlanes(1.f, 500.0f);
	Camera::getInstance().setFieldOfView(179);

	crosshair = new twodOverlay("crosshair.png", 0, 0, 1);
	skull = new twodOverlayAnim("killSkull.png", 5, 0.5);
	startscreen = new twodOverlay("pressStart.png", 0, 0, 10);
	skull->updatePos(-0.85f, -0.75f, 4);
	skull ->cycle = true;
	//MODEL INITS

	prepProjectiles();

	model = new GameObject(0);
	model->SetName("Moving");
	gModel = new ComponentGraphics();
	gModel->setOwner(model);
	gModel->loadModel("models/TallCube.dae");
	Component* gp = gModel;
	model->AddComponent(GRAPHICS, gp);
	gCol = new ComponentCollision();
	gCol->setCollisionMask(gModel->getScene());
	gCol->setOwner(model);
	model->pos = glm::vec3(7.5, 0.5, -11);
	model->vel = 0.01;
	model->dir = glm::vec3(1, 0, 0);
	model->scale = glm::vec3(5, 5, 5);
	gCol->type = MOVING;
	gCol->createHitboxRender();
	gp = gCol;
	model->AddComponent(PHYSICS, gp);
	ComponentInput* ci = new ComponentInput(0.05,0.05);
	gp = ci;
	model->AddComponent(CONTROLLER, gp);
	
	//PROPER INIT
	for (int i = 0; i < 22; i++)
	{
		if (i != 3 && i != 0 && i != 4 && i != 8 && i != 18 && i != 19 && i != 20 && i !=21)
		{
			GameObject *gObject = new GameObject(goVec.size());
			ComponentGraphics *cModel = new ComponentGraphics();
			ComponentCollision *cCollision = new ComponentCollision();
			Component *c;

			if (i == 0)
			{
				gObject->SetName("Spawn Container 1");
				cModel->loadModel("models/Container.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(60, 0, -110);
			}
			else if (i == 1)
			{
				gObject->SetName("Water Tower");
				cModel->loadModel("models/Watertower.dae");

				gObject->scale = glm::vec3(3, 3, 3);
				gObject->pos = glm::vec3(-65, 0, -90);
			}
			else if (i == 2)
			{
				gObject->SetName("MenuScene");
				cModel->loadModel("models/Warehouse_One_mesh_No_roof.dae");

				gObject->scale = glm::vec3(1, 1, 1);// glm::vec3(1.6, 1.6, 1.6);
				gObject->pos = glm::vec3(10000, 0, 0);
			}
			else if (i == 3)
			{
				gObject->SetName("Spawn Container 2");
				cModel->loadModel("models/Container90.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(85, 0, -75);
			}
			else if (i == 4)
			{
				gObject->SetName("Middle Plus");
				cModel->loadModel("models/Container.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(15, 0, -20);
			}
			else if (i == 5)
			{
				gObject->SetName("North Wall");
				cModel->loadModel("models/Container_Wal_LPl.dae");

				gObject->scale = glm::vec3(0.7, 0.70, 0.70);
				gObject->pos = glm::vec3(100, 0, 165);
			}
			else if (i == 6)
			{
				gObject->SetName("Dumbster");//Crane
				cModel->loadModel("models/Dumspter2.dae");
				gObject->pos = glm::vec3(0, 0, -140);
				gObject->scale = glm::vec3(0.4, 0.4, 0.4);
			}
			else if (i == 7)
			{
				gObject->SetName("Shack");
				cModel->loadModel("models/Shack.dae");

				gObject->scale = glm::vec3(0.75, 0.75, 0.75);
				gObject->pos = glm::vec3(0, 0, 120);
			}
			else if (i == 8)
			{
				gObject->SetName("Middle Plus");
				cModel->loadModel("models/Container.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(-5, 0, -20);
			}
			else if (i == 9)
			{
				gObject->SetName("Container 2");
				cModel->loadModel("models/Container.dae");

				gObject->scale = glm::vec3(0.70, 0.70, 0.70);
				gObject->pos = glm::vec3(80, 0, 100);
			}
			else if (i == 10)
			{
				gObject->SetName("South Wall");
				cModel->loadModel("models/Container_Wal_LPl.dae");

				gObject->scale = glm::vec3(0.7, 0.70, 0.70);
				gObject->pos = glm::vec3(-100, 0, 165);
			}
			else if (i == 11)
			{
				gObject->SetName("East Wall");
				cModel->loadModel("models/Container_Wal_LP90.dae");

				gObject->scale = glm::vec3(0.7, 0.70, 0.70);
				gObject->pos = glm::vec3(50, 0, 145);
			}
			else if (i == 12)
			{
				gObject->SetName("West Wall");
				cModel->loadModel("models/Container_Wal_LP90.dae");

				gObject->scale = glm::vec3(0.7, 0.70, 0.70);
				gObject->pos = glm::vec3(50, 0, -125);
			}
			else if (i == 13)
			{
				gObject->SetName("Container 2");
				cModel->loadModel("models/Container.dae");

				gObject->scale = glm::vec3(0.70, 0.70, 0.70);
				gObject->pos = glm::vec3(60, 0, 100);
			}
			else if (i == 14)
			{
				gObject->SetName("Container 90");
				cModel->loadModel("models/Container90.dae");

				gObject->scale = glm::vec3(0.70, 0.70, 0.70);
				gObject->pos = glm::vec3(70, 0, 70);
			}
			else if (i == 15)
			{
				gObject->SetName("Shack");
				cModel->loadModel("models/Shack.dae");

				gObject->scale = glm::vec3(0.75, 0.75, 0.75);
				gObject->pos = glm::vec3(-30, 0, 120);
			}
			else if (i == 16)
			{
				gObject->SetName("Shack");
				cModel->loadModel("models/Shack.dae");

				gObject->scale = glm::vec3(0.75, 0.75, 0.75);
				gObject->pos = glm::vec3(30, 0, 120);
			}
			else if (i == 17)
			{
				gObject->SetName("Shack");
				cModel->loadModel("models/Shack.dae");

				gObject->scale = glm::vec3(0.75, 0.75, 0.75);
				gObject->pos = glm::vec3(-60, 0, 120);
			}
			else if (i == 18)
			{
				gObject->SetName("Middle Plus North");
				cModel->loadModel("models/Container90.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(27, 0, -5);
			}
			else if (i == 19)
			{
				gObject->SetName("Middle Plus North");
				cModel->loadModel("models/Container90.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(27, 0, 15);
			}
			else if (i == 20)
			{
				gObject->SetName("Middle Plus North");
				cModel->loadModel("models/Container90.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(-20, 0, 15);
			}
			else if (i == 21)
			{
				gObject->SetName("Middle Plus North");
				cModel->loadModel("models/Container90.dae");

				gObject->scale = glm::vec3(0.7, 0.7, 0.7);
				gObject->pos = glm::vec3(-20, 0, -5);
			}

			gObject->pos /= 10.f;

			cModel->setOwner(gObject);
			c = cModel;
			gObject->AddComponent(GRAPHICS, c);
			cCollision->setOwner(gObject);
			cCollision->setCollisionMask(cModel->getScene());
			cCollision->type = STATIC;
			cCollision->setCollisionElip(glm::vec3(1, 1, 1));
			cCollision->createHitboxRender();
			gObject->AddComponent(PHYSICS, cCollision);
			goVec.push_back(gObject);
		}
	}

	LoadTargets();
	

	spotLightColour = glm::normalize(spotLightColour);
	for (int i = 0; i < 6; i++)
	{
		LightComponent* light;
		if (i == 0)
		{
			light = new LightComponent(lSPOT);
			SpotLight* lc = new SpotLight;
			lc->Base.Base.Color = spotLightColour;
			lc->Base.Base.AmbientIntensity = 0.1f;
			lc->Base.Base.DiffuseIntensity = 0.1f;
			
			lc->Base.Atten.Constant = 0.1f;
			lc->Base.Atten.Exp = 0.1f;
			lc->Base.Atten.Linear = 0.1f;
			
			lc->Cutoff = 0.75f;
			lc->Base.Position = glm::vec3(-6, 1, 11);
			lc->Direction = glm::vec3(0, 0, -1);
			
			light->SetVars(lSPOT, lc);
		}
		if (i == 1)
		{
			light = new LightComponent(lSPOT);
			SpotLight* lc = new SpotLight;
			lc->Base.Base.Color = spotLightColour;
			lc->Base.Base.AmbientIntensity = 0.5f;
			lc->Base.Base.DiffuseIntensity = 0.5f;
			
			lc->Base.Atten.Constant = 0.5f;
			lc->Base.Atten.Exp = 0.5f;
			lc->Base.Atten.Linear = 0.5f;
			
			lc->Cutoff = 0.75f;
			lc->Base.Position = glm::vec3(3, 1, 11);
			lc->Direction = (glm::vec3(0, 0, 10));
			
			light->SetVars(lSPOT, lc);
		}
		if (i == 2)
		{
			//light = new LightComponent(lSPOT);
			//SpotLight* lc = new SpotLight;
			//lc->Base.Base.Color = glm::vec3(0,0.1,0);
			//lc->Base.Base.AmbientIntensity = 0.5f;
			//lc->Base.Base.DiffuseIntensity = 0.5f;
			//
			//lc->Base.Atten.Constant = 0.5f;
			//lc->Base.Atten.Exp = 0.5f;
			//lc->Base.Atten.Linear = 0.5f;
			//
			//lc->Cutoff = 0.75f;
			//lc->Base.Position = glm::vec3(-3, 1, 11);
			//lc->Direction = (glm::vec3(-3, 0, 12));
			//
			//light->SetVars(lSPOT, lc);
		}
		if (i == 3)
		{
			//light = new LightComponent(lSPOT);
			//SpotLight* lc = new SpotLight;
			//lc->Base.Base.Color = spotLightColour;
			//lc->Base.Base.AmbientIntensity = 0.5f;
			//lc->Base.Base.DiffuseIntensity = 0.5f;
			//
			//lc->Base.Atten.Constant = 0.5f;
			//lc->Base.Atten.Exp = 0.5f;
			//lc->Base.Atten.Linear = 0.5f;
			//
			//lc->Cutoff = 0.75f;
			//lc->Base.Position = glm::vec3(-6, 1, 11);
			//lc->Direction = (glm::vec3(-6, 1, 12));
			//
			//light->SetVars(lSPOT, lc);
		}
		if (i == 4)
		{
			//light = new LightComponent(lSPOT);
			//SpotLight* lc = new SpotLight;
			//lc->Base.Base.Color = spotLightColour;
			//lc->Base.Base.AmbientIntensity = 0.1f;
			//lc->Base.Base.DiffuseIntensity = 0.1f;
			//
			//lc->Base.Atten.Constant = 0.1f;
			//lc->Base.Atten.Exp = 0.1f;
			//lc->Base.Atten.Linear = 0.1f;
			//
			//lc->Cutoff = 0.75f;
			//lc->Base.Position = glm::vec3(0, 1, 0);
			//lc->Direction = glm::vec3(0, -1, 0);
			//
			//light->SetVars(lSPOT, lc);
		}
		if (i == 5)
		{
			light = new LightComponent(lSPOT);
			SpotLight* lc = new SpotLight;
			lc->Base.Base.Color = spotLightColour;
			lc->Base.Base.AmbientIntensity = 0.5f;
			lc->Base.Base.DiffuseIntensity = 0.5f;

			lc->Base.Atten.Constant = 0.5f;
			lc->Base.Atten.Exp = 0.5f;
			lc->Base.Atten.Linear = 0.5f;

			lc->Cutoff = 0.5f;
			lc->Base.Position = glm::vec3(1000, 1, 0);//4 1 0
			lc->Direction = glm::vec3(0, -1, 0);// 5 0 0

			light->SetVars(lSPOT, lc);
		}
	}

	animatedMech = new GameObject(100);
	animatedMechGC = new ComponentGraphics();
	animatedMechGC->loadModel("models/Test_Animation_DAE.dae");
	Component* c = animatedMechGC;
	animatedMech->AddComponent(GRAPHICS, c);
	animatedMech->pos = glm::vec3(0, 0, 0);
	animatedMech->scale = glm::vec3(1, 1, 1);

	//END MODEL INITS
	camInterp.points.push_back(glm::vec3(1025, 1, 0));
	camInterp.points.push_back(glm::vec3(1000, 1, 25));
	camInterp.points.push_back(glm::vec3(975, 1, 0));
	camInterp.points.push_back(glm::vec3(1000, 1, -25));
	camInterp.points.push_back(glm::vec3(1025, 1, 0));
	camInterp.state = SLERP;
	camInterp.buildCurve();

	TextRendering::getInstance().initText2D("MekFont.bmp");
	fontColour = glm::normalize(fontColour);

	wglSwapIntervalEXT(1);


    // run while the window is open
    double lastTime = glfwGetTime();
    while(!glfwWindowShouldClose(gWindow)){
        // process pending events
        glfwPollEvents();

        // update the scene based on the time elapsed since last update
        double thisTime = glfwGetTime();
        Update((float)(thisTime - lastTime));
        lastTime = thisTime;

        // draw one frame
        Render();

        // check for errors
        GLenum error = glGetError();
		if (error != GL_NO_ERROR)
		{
			std::cerr << "OpenGL Error " << error << " - " << glewGetErrorString(error) << std::endl;
		}

        //exit program if escape key is pressed
        if(glfwGetKey(gWindow, GLFW_KEY_ESCAPE))
            glfwSetWindowShouldClose(gWindow, GL_TRUE);
    }

    // clean up and exit
    glfwTerminate();
}