Exemple #1
0
int main()
{
	glfwInit();

	GLFWwindow* window;
	window = glfwCreateWindow(800, 600, "ParticleSystemScene", NULL, NULL);
	glfwMakeContextCurrent(window);

	//CAM
	cam.setKeySpeed(4.0);
	iH.setAllInputMaps(cam);
	glfwSetKeyCallback(window, key_callback);
	cam.setFOV(50);
	cam.setNearFar(1, 100);

	glewInit();

	//TEXTURES
	Texture* smokeWhiteTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeWhite/smokeWhite01.png");
	Texture* smokeWhiteTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeWhite/smokeWhite02.png");
	Texture* smokeBlackTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeBlack/smokeBlack01.png");
	Texture* smokeBlackTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeBlack/smokeBlack02.png");
	Texture* snowTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/snowflake.png"); //TODO better Resolution

	//FINAL EMITTER SNOW
	Emitter* snow = new Emitter(0, glm::vec3(0.0, 10.0, -5.0), 0.0, 0.166, 100, 30.0, true);
	snow->setVelocity(0);
	snow->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 1.0), 0.5f);
	snow->setAreaEmitting(false, true, 10.0, 10000);
	snow->addTexture(snowTex, 0.0);
	snow->defineLook(true, 0.04, 2.0);
	snow->setMovable(true);

	//FINAL EMITTER WHITE SMOKE
	Emitter* smokeWhite = new Emitter(0, glm::vec3(0.0, 0.0, 5.0), 0.0, 0.4, 1, 8.0, true);
	smokeWhite->setVelocity(2);
	smokeWhite->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.8), 0.3f);
	smokeWhite->addTexture(smokeWhiteTex1, 1.0);
	smokeWhite->addTexture(smokeWhiteTex2, 0.25);
	std::vector<float> smokeWhiteSize{ 0.05f, 0.5f, 0.75f, 1.2f };
	std::vector<float> smokeWhiteTime{ 0.0f, 0.4f, 0.75f, 1.0f };
	smokeWhite->defineLook(true, smokeWhiteSize, smokeWhiteTime, 1.0, 4.0, 4.0, false, 0.3);
	smokeWhite->switchToGeometryShader();

	//FINAL EMITTER BLACK SMOKE
	Emitter* smokeBlack = new Emitter(0, glm::vec3(0.0, 0.0, -10.0), 0.0, 0.4, 1, 8.0, true);
	smokeBlack->setVelocity(2);
	smokeBlack->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.8), 0.3f);
	smokeBlack->addTexture(smokeBlackTex1, 1.0);
	smokeBlack->addTexture(smokeBlackTex2, 0.08);
	std::vector<float> smokeBlackSize{ 0.1f, 0.4f, 0.8f, 1.2f };
	std::vector<float> smokeBlackTime{ 0.0f, 0.2f, 0.75f, 1.0f };
	smokeBlack->defineLook(true, smokeBlackSize, smokeBlackTime, 1.0, 4.0, 4.0, false, 0.3);
	smokeBlack->switchToGeometryShader();

	//PARTICLE SYSTEM
	Effect* sn = new Effect();
	sn->addEmitter(snow);
	ParticleSystem* psSnow = new ParticleSystem(glm::vec3(0, 2, -5), sn);
	Node snowNode("snowNode");
	snowNode.setParticleActive(true);
	snowNode.setCamera(&cam);
	snowNode.addParticleSystem(psSnow);
	
	Effect* smWhi = new Effect();
	smWhi->addEmitter(smokeWhite);
	ParticleSystem* psSmokeWhite = new ParticleSystem(glm::vec3(0, 0, 3), smWhi);
	Node whiteSmokeNode("whiteSmokeNode");
	whiteSmokeNode.setParticleActive(true);
	whiteSmokeNode.setCamera(&cam);
	whiteSmokeNode.addParticleSystem(psSmokeWhite);
	
	Effect* smBla = new Effect();
	smBla->addEmitter(smokeBlack);
	ParticleSystem* psSmokeBlack = new ParticleSystem(glm::vec3(0, 0, -3), smBla);
	Node blackSmokeNode("blackSmokeNode");
	blackSmokeNode.setParticleActive(true);
	blackSmokeNode.setCamera(&cam);
	blackSmokeNode.addParticleSystem(psSmokeBlack);
	
	// Shader
	VertexShader vs(loadShaderSource(SHADERS_PATH + std::string("/ColorShader3D/ColorShader3D.vert")));
	FragmentShader fs(loadShaderSource(SHADERS_PATH + std::string("/ColorShader3D/ColorShader3D.frag")));
	ShaderProgram shader(vs, fs);

	// Renderer
	OpenGL3Context context;
	Renderer renderer(context);

	// Object
	Teapot teapot;
	teapot.loadBufferData();
	Node teapotNode("teapotNode");
	teapotNode.addGeometry(&teapot);
	teapotNode.setCamera(&cam);
	teapotNode.setModelMatrix(glm::translate(teapotNode.getModelMatrix(), glm::vec3(0.0, 0.0, -7.0)));
	
	//need scene here mainly because of input
	Level testLevel("testLevel");
	Scene testScene("testScene");
	testLevel.addScene(&testScene);
	testLevel.changeScene("testScene");

	//Add Camera to Scene
	testScene.getScenegraph()->addCamera(&cam);
	testScene.getScenegraph()->setActiveCamera("Pilotview");

	//Set Input-Maps and activate one
	iH.setAllInputMaps(*(testScene.getScenegraph()->getActiveCamera()));
	iH.changeActiveInputMap("Pilotview");

	//Add Objects to the Scene
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&teapotNode);	
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&blackSmokeNode);	
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&whiteSmokeNode);
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&snowNode);

	//start the ParticleSystems
	psSmokeBlack->start();
	psSmokeWhite->start();
	psSnow->start();

	// getting the start time
	double startTime = glfwGetTime();

	while (!glfwWindowShouldClose(window))
	{
		cam.setSensitivity(glfwGetTime() - startTime);
		startTime = glfwGetTime();

		glEnable(GL_DEPTH);
		glEnable(GL_DEPTH_TEST);
		glEnable(GL_BLEND);

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		shader.bind();
		shader.sendMat4("modelMatrix", teapotNode.getModelMatrix());
		shader.sendMat4("viewMatrix", cam.getViewMatrix());
		shader.sendMat4("projectionMatrix", cam.getProjectionMatrix());
		testScene.render(shader);
		shader.unbind();

		glfwSwapBuffers(window);
		glfwPollEvents();
	}
	glfwDestroyWindow(window);
	glfwTerminate();

	return 0;
}
Exemple #2
0
int main()
{
    glfwInit();

    ////our window
    //GLFWwindow* window;
    //window = glfwCreateWindow(800, 600, "ParticleSystemXML", NULL, NULL);
    //glfwMakeContextCurrent(window);
    //
    ////CAM
    //cam.setKeySpeed(4.0);
    //iH.setAllInputMaps(cam);
    //glfwSetKeyCallback(window, key_callback);
    //cam.setFOV(50);
    //cam.setNearFar(1, 100);

    Window testWindow(500, 50, 800, 600, "ParticleSystem");
    glfwMakeContextCurrent(testWindow.getWindow());

    // Callback
    glfwSetKeyCallback(testWindow.getWindow(), key_callback);

    cam.setKeySpeed(4.0);
    cam.setNearFar(0.1, 100);
    cam.setPosition(glm::vec4(0, 0, 8, 0));

    glewInit();

    //our renderer
    OpenGL3Context context;
    Renderer *renderer;
    renderer = new Renderer(context);


    //////////////////////Textures//////////////////////

    Texture* fireTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/Fire2_M.png");
    Texture* fireTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fire1_M.png");
    Texture* fireTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fire3_M.png");
    Texture* fireTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/flame02_L.png");
    //Texture* fireFlickering1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fire_flickering_1.png");
    //Texture* fireFlickering2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fire_flickering_2.png");
    //Texture* fireFlickering3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fire_flickering_3.png");
    //Texture* fireFlickering4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fire_flickering_4.png");
    Texture* fireSparkleTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fireSparkle1_S.png");
    Texture* fireSparkleTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/fireSparkle2.png");

    Texture* texFireworkBlue = new Texture((char*)RESOURCES_PATH "/ParticleSystem/firework/firework_blue.png");
    Texture* texFireworkRed = new Texture((char*)RESOURCES_PATH "/ParticleSystem/firework/firework_red.png");
    Texture* texFireworkGreen = new Texture((char*)RESOURCES_PATH "/ParticleSystem/firework/firework_green.png");
    Texture* texFireworkGold = new Texture((char*)RESOURCES_PATH "/ParticleSystem/firework/firework_gold.png");
    Texture* texFireworkTail = new Texture((char*)RESOURCES_PATH "/ParticleSystem/firework/firework_tail.png");

    Texture* smokeWhiteTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeWhite/smokeWhite01.png");
    Texture* smokeWhiteTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeWhite/smokeWhite02.png");
    Texture* smokeBlack1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeBlack/smokeBlack01.png");
    Texture* smokeBlack2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeBlack/smokeBlack02.png");

    //////////////////////Emitter//////////////////////

    //Emitter explosion sparkle
    Emitter* explosionSparkle = new Emitter(0, glm::vec3(0.0, 0.0, 0.0), 0.25, 0.01, 80, 1.25, true);
    explosionSparkle->setVelocity(5);
    //explosionSparkle->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 0.3), 3.0f);
    explosionSparkle->usePhysicPointGravity(glm::vec3(0.0, 0.0, 0.0), 0.6, 10.0, 2, 4.0f, true);
    explosionSparkle->addTexture(fireSparkleTex1, 1.0);
    explosionSparkle->defineLook(true, 0.01, 0.0, 0.1);

    //Emitter explosion fire
    //TODO

    //Emitter fire smoke
    Emitter* fire = new Emitter(0, glm::vec3(0.0, 0.0, 0.0), 0.0, 0.2, 2, 5.0, true);
    fire->setVelocity(5);
    fire->usePhysicDirectionGravity(glm::vec4(0.0, 1.0, 0.0, 5.0), 0.5f);
    fire->addTexture(fireTex1, 1.0);
    fire->addTexture(fireTex2, 0.7);
    fire->addTexture(smokeBlack2, 0.1);
    //fire->addTexture(smokeBlack2, 0.1);
    //fire->addTexture(smokeWhiteTex2, 0.25);
    std::vector<float> sizeF{ 0.05f, 0.5f, 0.75f, 1.0f };
    std::vector<float> timeF{ 0.0f, 0.4f, 0.75f, 1.0f };
    fire->defineLook(true, sizeF, timeF, 0.5, 4.0, 3.0, true, 0.3);
    fire->switchToGeometryShader();

    //Emitter fire flickering
    Emitter* fireFlickering = new Emitter(0, glm::vec3(0.0, 0.1, 0.0), 0.0, 0.2, 1, 2.0, true);
    fireFlickering->setVelocity(5);
    fireFlickering->usePhysicDirectionGravity(glm::vec4(0.0, 1.0, 0.0, 0.5), 0.3f);
    /*fireFlickering->addTexture(fireFlickering1, 1.0);
    fireFlickering->addTexture(fireFlickering2, 0.7);
    fireFlickering->addTexture(fireFlickering3, 0.5);
    fireFlickering->addTexture(fireFlickering4, 0.3);*/
    fireFlickering->defineLook(true, 0.1, 0.5, 1.0, 0.5, true, 0.3);
    fireFlickering->switchToGeometryShader();

    Emitter* fireSparkle = new Emitter(0, glm::vec3(0.0, 0.1, 0.0), 0.0, 0.05, 3, 2.5, true);
    fireSparkle->setVelocity(5);
    fireSparkle->usePhysicDirectionGravity(glm::vec4(0.0, 1.0, 0.0, 0.8), 0.5f);
    fireSparkle->addTexture(fireSparkleTex1, 1.0);
    fireSparkle->defineLook(true, 0.05, 0.5, 0.5);


    //Emitter firework explosion
    Emitter* fireworkExplosion = new Emitter(0, glm::vec3(0.0, 0.0, 0.0), 0.1, 0.01, 80, 2.0, true);
    fireworkExplosion->setVelocity(6);
    //fireworkExplosion->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 0.6), 3.0f);
    fireworkExplosion->usePhysicPointGravity(glm::vec3(0.0, -2.0, 0.0), 0.9, 5.0, 2, 2.0f, true);
    fireworkExplosion->addTexture(texFireworkRed, 1.0);
    fireworkExplosion->defineLook(true, 0.04, 0.0, 0.5);
    fireworkExplosion->setStartTime(2.0);

    //Emitter firework tail
    Emitter* fireworkTail = new Emitter(0, glm::vec3(0.0, 0.0, 0.0), 2.0, 0.01, 20, 0.5, true);
    fireworkTail->setVelocity(5);
    //fireworkTail->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 2.9), 0.2f);
    fireworkTail->usePhysicPointGravity(glm::vec3(0.0, -4.0, 0.0), 30.6, 10.0, 2, 0.2f, true);
    fireworkTail->addTexture(texFireworkTail, 1.0);
    fireworkTail->defineLook(true, 0.001, 0.0, 0.1);


    //FINAL EMITTER WHITE SMOKE
    Emitter* smokeWhite = new Emitter(0, glm::vec3(0.0, 0.0, 0.0), 0.0, 0.4, 1, 8.0, true);
    smokeWhite->setVelocity(2);
    smokeWhite->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.8), 0.3f);
    smokeWhite->addTexture(smokeWhiteTex1, 1.0);
    smokeWhite->addTexture(smokeWhiteTex2, 0.25);
    std::vector<float> smokeWhiteSize{ 0.05f, 0.5f, 0.75f, 1.0f };
    std::vector<float> smokeWhiteTime{ 0.0f, 0.4f, 0.75f, 1.0f };
    smokeWhite->defineLook(true, smokeWhiteSize, smokeWhiteTime, 1.0, 2.0, 1.0, false, 0.3);
    smokeWhite->switchToGeometryShader();

    //////////////////////Effect//////////////////////
    Effect* efExplosion = new Effect();
    efExplosion->addEmitter(explosionSparkle);

    Effect* efFire = new Effect();
    efFire->addEmitter(fire);
    //efFire->addEmitter(fireFlickering);
    efFire->addEmitter(fireSparkle);
    efFire->saveEffect(RESOURCES_PATH "/XML/Effect_Fire.xml");

    Effect* efFirework = new Effect();
    efFirework->addEmitter(fireworkTail);
    efFirework->addEmitter(fireworkExplosion);
    //efFirework->saveEffect(RESOURCES_PATH "/XML/Effect_Firework.xml");

    Effect* efFireworkTail = new Effect();
    efFireworkTail->addEmitter(fireworkTail);

    Effect* efFireworkExplosion = new Effect();
    efFireworkExplosion->addEmitter(fireworkExplosion);

    Effect* efSmWhi = new Effect();
    efSmWhi->addEmitter(smokeWhite);
    efSmWhi->saveEffect(RESOURCES_PATH "/XML/Effect_SmokeWhite.xml");


    //////////////////////ParticleSystem//////////////////////
    //ParticleSystem* psExplosion = new ParticleSystem(glm::vec3(0, -1, 0), efExplosion);
    //ParticleSystem* psFire = new ParticleSystem(glm::vec3(-2, 0, 3), efFire);
    ParticleSystem* psFire = new ParticleSystem(glm::vec3(-2, 0, 3), RESOURCES_PATH "/XML/Effect_Fire.xml");
    ParticleSystem* psFirework = new ParticleSystem(glm::vec3(0, 0, 5), efFirework);
    ParticleSystem* psFireworkTail = new ParticleSystem(glm::vec3(0, 0, 5), efFireworkTail);
    ParticleSystem* psFireworkExplosion = new ParticleSystem(glm::vec3(0, 2, 5), efFireworkExplosion);
    ParticleSystem* psSmokeWhite = new ParticleSystem(glm::vec3(2, 0, 3), efSmWhi);
    //ParticleSystem* psSmokeWhite = new ParticleSystem(glm::vec3(2, 0, 3), RESOURCES_PATH "/XML/Effect_SmokeWhite.xml");

    ParticleSystem* psFireworkRed = new ParticleSystem(glm::vec3(-6, -1, -3), RESOURCES_PATH "/XML/Effect_FireworkRed.xml");
    ParticleSystem* psFireworkBlue = new ParticleSystem(glm::vec3(-2, -1, -3), RESOURCES_PATH "/XML/Effect_FireworkBlue.xml");
    ParticleSystem* psFireworkGreen = new ParticleSystem(glm::vec3(2, -1, -3), RESOURCES_PATH "/XML/Effect_FireworkGreen.xml");
    ParticleSystem* psFireworkGold = new ParticleSystem(glm::vec3(6, -1, -3), RESOURCES_PATH "/XML/Effect_FireworkGold.xml");

    ParticleSystem* psComicCloud = new ParticleSystem(glm::vec3(0, -1, 3), RESOURCES_PATH "/XML/Effect_ComicCloud.xml");


    //////////////////////Node//////////////////////
    //Node nodeExplosion("nodeExplosion");
    //nodeExplosion.setCamera(&cam);
    //nodeExplosion.addParticleSystem(psExplosion);
    //nodeExplosion.setParticleActive(true);
    //
    //Node fireNode("fireNode");
    //fireNode.setCamera(&cam);
    //fireNode.addParticleSystem(psFire);
    //fireNode.setParticleActive(true);
    //
    //Node nodeFirework("fireworkNode");
    //nodeFirework.setCamera(&cam);
    //nodeFirework.addParticleSystem(psFirework);
    //nodeFirework.setParticleActive(true);
    //
    //Node whiteSmokeNode("whiteSmokeNode");
    //whiteSmokeNode.setCamera(&cam);
    //whiteSmokeNode.addParticleSystem(psSmokeWhite);
    //whiteSmokeNode.setParticleActive(true);

    ////Firework
    //Node nodeFireworkRed("fireworkRedNode");
    //nodeFireworkRed.setCamera(&cam);
    //nodeFireworkRed.addParticleSystem(psFireworkRed);
    //nodeFireworkRed.setParticleActive(true);

    //Node nodeFireworkBlue("fireworBlueNode");
    //nodeFireworkBlue.setCamera(&cam);
    //nodeFireworkBlue.addParticleSystem(psFireworkBlue);
    //nodeFireworkBlue.setParticleActive(true);

    //Node nodeFireworkGreen("fireworkGreenNode");
    //nodeFireworkGreen.setCamera(&cam);
    //nodeFireworkGreen.addParticleSystem(psFireworkGreen);
    //nodeFireworkGreen.setParticleActive(true);

    //Node nodeFireworkGold("fireworkGoldNode");
    //nodeFireworkGold.setCamera(&cam);
    //nodeFireworkGold.addParticleSystem(psFireworkGold);
    //nodeFireworkGold.setParticleActive(true);


    // Shader
    VertexShader vs(loadShaderSource(SHADERS_PATH + std::string("/ColorShader3D/ColorShader3D.vert")));
    FragmentShader fs(loadShaderSource(SHADERS_PATH + std::string("/ColorShader3D/ColorShader3D.frag")));
    ShaderProgram shader(vs, fs);

    //need scene here mainly because of input
    Level testLevel("testLevel");
    Scene testScene("testScene");
    testLevel.addScene(&testScene);
    testLevel.changeScene("testScene");

    //Add Camera to Scene
    testScene.getScenegraph()->addCamera(&cam);
    testScene.getScenegraph()->setActiveCamera("Pilotview");

    //Set Input-Maps and activate one
    iH.setAllInputMaps(*(testScene.getScenegraph()->getActiveCamera()));
    iH.changeActiveInputMap(MapType::CAMPILOTVIEW);
    iH.getActiveInputMap()->update(cam);

    //Object
    Cube cube;
    Texture bricks((char*)RESOURCES_PATH "/Wall/bricks_diffuse.png");
    Node cube1("cube");
    cube1.addGeometry(&cube);
    cube1.addTexture(&bricks);
    cube1.setModelMatrix(glm::translate(cube1.getModelMatrix(), glm::vec3(0.0, 0.0, 0.0)));
    //cube1.setModelMatrix(glm::scale(cube1.getModelMatrix(), glm::vec3(0.5, 0.5, 0.5)));
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube1);

    //add nodes to the scenegraph
    //testScene.getScenegraph()->getRootNode()->addChildrenNode(&nodeExplosion);
    //testScene.getScenegraph()->getRootNode()->addChildrenNode(&fireNode);
    //testScene.getScenegraph()->getRootNode()->addChildrenNode(&whiteSmokeNode);
    //testScene.getScenegraph()->getRootNode()->addChildrenNode(&nodeFirework);
    /*testScene.getScenegraph()->getRootNode()->addChildrenNode(&nodeFireworkRed);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&nodeFireworkBlue);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&nodeFireworkGreen);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&nodeFireworkGold);*/

    //using this, the ParticleSystems get rendered in order of their distance to the camera
    testScene.getScenegraph()->addParticleSystem(psFire);
    testScene.getScenegraph()->addParticleSystem(psSmokeWhite);
    testScene.getScenegraph()->addParticleSystem(psFireworkBlue);
    testScene.getScenegraph()->addParticleSystem(psFireworkRed);
    testScene.getScenegraph()->addParticleSystem(psFireworkGreen);
    testScene.getScenegraph()->addParticleSystem(psFireworkGold);
    //testScene.getScenegraph()->addParticleSystem(psComicCloud);

    ////TEST
    //Emitter* etest = new Emitter(0, glm::vec3(0, 0, 0), 0, 1, 1000000, 1, true);
    //etest->setVelocity(6);
    //etest->usePhysicPointGravity(glm::vec3(0, 0, 0), 0.5, 20, 1, -2.5, true);
    //etest->defineLook(false, 0.005);
    //Effect* eftest = new Effect();
    //eftest->addEmitter(etest);
    //ParticleSystem* pstest = new ParticleSystem(glm::vec3(0, 2, 0), eftest);
    //testScene.getScenegraph()->addParticleSystem(pstest);
    //pstest->start();


    //start the ParticleSystems
    psFire->start();
    psSmokeWhite->start();
    //psExplosion->start();
    //psFirework->start();
    psFireworkRed->start();
    psFireworkBlue->start();
    psFireworkGreen->start();
    psFireworkGold->start();
    //psComicCloud->start();

    double startTime = glfwGetTime();

    double lastTime = glfwGetTime();
    int nbFrames = 0;

    while (!glfwWindowShouldClose(testWindow.getWindow()))
    {
        // Measure speed
        double currentTime = glfwGetTime();
        nbFrames++;
        if (currentTime - lastTime >= 1.0) { // If last prinf() was more than 1 sec ago
            // printf and reset timer
            //printf("%f ms/frame\n", 1000.0 / double(nbFrames));
            nbFrames = 0;
            lastTime += 1.0;
        }

        double dt = glfwGetTime() - startTime;
        cam.setSensitivity(dt);
        startTime = glfwGetTime();

        /*glEnable(GL_DEPTH);
        glEnable(GL_DEPTH_TEST);
        glEnable(GL_BLEND);

        glClearColor(0.5, 0.5, 0.5, 1.0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        shader.bind();
        shader.sendMat4("viewMatrix", cam.getViewMatrix());
        shader.sendMat4("projectionMatrix", cam.getProjectionMatrix());
        testScene.render(shader);
        testScene.renderParticleSystems();
        shader.unbind();*/

        //renderer->useBloom(true);
        renderer->renderScene(testScene, testWindow);

        //update Positions of firework ParticleSystems
        glm::vec3 pos = psFireworkRed->getPosition();
        psFireworkRed->setPosition(glm::vec3(pos.x, pos.y + (2 * dt), pos.z));

        pos = psFireworkBlue->getPosition();
        psFireworkBlue->setPosition(glm::vec3(pos.x, pos.y + (2 * dt), pos.z));

        pos = psFireworkGreen->getPosition();
        psFireworkGreen->setPosition(glm::vec3(pos.x, pos.y + (2 * dt), pos.z));

        pos = psFireworkGold->getPosition();
        psFireworkGold->setPosition(glm::vec3(pos.x, pos.y + (2 * dt), pos.z));


        /*glfwSwapBuffers(testWindow.getWindow());
        glfwPollEvents();*/
    }
    glfwDestroyWindow(testWindow.getWindow());
    glfwTerminate();

    return 0;
}
Exemple #3
0
int main()
{
    glfwInit();

    Window testWindow(50, 50, WINDOW_WIDTH, WINDOW_HEIGHT, "Deferred Shading");
    glfwMakeContextCurrent(testWindow.getWindow());
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);


    // You have to set a camera name
    cam.setName("PilotviewCam");
    cam.setPosition(glm::vec4(0.0, 0.5, 3.0, 1.0));
    cam.setNearFar(0.01f, 100.0f);

    iH.setAllInputMaps(cam);
    iH.changeActiveInputMap("Pilotview");

    //Callback
    glfwSetKeyCallback(testWindow.getWindow(), key_callback);

    glewInit();

    //our shader
    VertexShader vsGBuffer(loadShaderSource(SHADERS_PATH + std::string("/GBuffer/GBuffer.vert")));
    FragmentShader fsGBuffer(loadShaderSource(SHADERS_PATH + std::string("/GBuffer/GBuffer.frag")));
    ShaderProgram shaderGBuffer(vsGBuffer, fsGBuffer);

    //load shader here
    VertexShader vsDsLighting(loadShaderSource(SHADERS_PATH + std::string("/DeferredShading/dsLighting.vert")));
    FragmentShader fsDsLighting(loadShaderSource(SHADERS_PATH + std::string("/DeferredShading/dsLighting.frag")));
    ShaderProgram shaderDsLightingShader(vsDsLighting, fsDsLighting);

    VertexShader vsDsCompositing(loadShaderSource(SHADERS_PATH + std::string("/DeferredShading/dsFinalCompositing.vert")));
    FragmentShader fsDsCompositing(loadShaderSource(SHADERS_PATH + std::string("/DeferredShading/dsFinalCompositing.frag")));
    ShaderProgram shaderDsCompositingShader(vsDsCompositing, fsDsCompositing);

    VertexShader vsSfq(loadShaderSource(SHADERS_PATH + std::string("/ScreenFillingQuad/ScreenFillingQuad.vert")));
    FragmentShader fsSfq(loadShaderSource(SHADERS_PATH + std::string("/ScreenFillingQuad/ScreenFillingQuad.frag")));
    ShaderProgram shaderSFQ(vsSfq, fsSfq);

    //our renderer
    OpenGL3Context context;
    Renderer renderer(context);

    FBO fboGBuffer(WINDOW_WIDTH, WINDOW_HEIGHT, 3, true, false);
    FBO fboDeferredShading(WINDOW_WIDTH, WINDOW_HEIGHT, 3, true, false);
    FBO fboCompositing(WINDOW_WIDTH, WINDOW_HEIGHT, 3, false, false);

    //our object
    Cube cube;

    Teapot teapot;

    Rect plane;
    Rect screenFillingQuad;
    screenFillingQuad.loadBufferData();

    //our textures
    Texture bricks((char*)RESOURCES_PATH "/bricks_diffuse.png");
    Texture bricks_normal((char*)RESOURCES_PATH "/bricks_normal.png");
    Texture bricks_height((char*)RESOURCES_PATH "/bricks_height.png");

    Texture chrome((char*)RESOURCES_PATH "/chrome.jpg");
    Texture cvLogo((char*)RESOURCES_PATH "/cv_logo.bmp");

    //Scene creation
    Level testLevel("testLevel");
    Scene testScene("testScene");
    testLevel.addScene(&testScene);
    testLevel.changeScene("testScene");

    //Add Camera to scenegraph
    testScene.getScenegraph()->addCamera(&cam);
    testScene.getScenegraph()->getCamera("PilotviewCam");
    testScene.getScenegraph()->setActiveCamera("PilotviewCam");

    Rect rect;

    Node cube1("cube1");
    cube1.addGeometry(&cube);
    cube1.addTexture(&bricks);
    cube1.addNormalMap(&bricks_normal);
    cube1.addHeightMap(&bricks_height);
    cube1.setModelMatrix(glm::translate(cube1.getModelMatrix(), glm::vec3(-1.0, 0.5, -0.5)));
    cube1.setModelMatrix(glm::scale(cube1.getModelMatrix(), glm::vec3(0.7, 0.7, 0.7)));

    Node cube2("cube2");
    cube2.addGeometry(&cube);
    cube2.addTexture(&bricks);
    cube2.addNormalMap(&bricks_normal);
    cube2.setModelMatrix(glm::translate(cube2.getModelMatrix(), glm::vec3(-1, 0.5, 0.5)));
    cube2.setModelMatrix(glm::scale(cube2.getModelMatrix(), glm::vec3(0.7, 0.7, 0.7)));

    Node cube3("cube3");
    cube3.addGeometry(&cube);
    cube3.addTexture(&bricks);
    cube3.setModelMatrix(glm::translate(cube3.getModelMatrix(), glm::vec3(0, 0.5, -0.5)));
    cube3.setModelMatrix(glm::scale(cube3.getModelMatrix(), glm::vec3(0.7, 0.7, 0.7)));

    Node cube4("cube4");
    cube4.addGeometry(&cube);
    cube4.addTexture(&bricks);
    cube4.addNormalMap(&bricks_normal);
    cube4.addHeightMap(&bricks_height,0.07,0.1,true);
    cube4.setModelMatrix(glm::translate(cube4.getModelMatrix(), glm::vec3(0, 0.5, 0.5)));
    cube4.setModelMatrix(glm::scale(cube4.getModelMatrix(), glm::vec3(0.7, 0.7, 0.7)));

    Node wallNode1("wall1");
    wallNode1.addGeometry(&plane);
    wallNode1.addTexture(&cvLogo);
    wallNode1.setModelMatrix(glm::translate(wallNode1.getModelMatrix(), glm::vec3(0.0, 0.1, 0.2)));
    wallNode1.setModelMatrix(glm::rotate(wallNode1.getModelMatrix(), 90.0f, glm::vec3(1.0, 0.0, 0.0)));
    wallNode1.setModelMatrix(glm::scale(wallNode1.getModelMatrix(), glm::vec3(10.5, 10.5, 10.5)));


    Node teaNode("teaNode");
    teaNode.addGeometry(&teapot);
    teaNode.addTexture(&chrome);
    teaNode.setModelMatrix(glm::translate(teaNode.getModelMatrix(), glm::vec3(0.2, 0.4, 0.7)));
    teaNode.setModelMatrix(glm::scale(teaNode.getModelMatrix(), glm::vec3(0.5, 0.5, 0.5)));


    //Creating a scenegraph
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&wallNode1);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube1);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube2);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube3);
    testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube4);
    //testScene.getScenegraph()->getRootNode()->addChildrenNode(&teaNode);

    double startTime = glfwGetTime();
    //Renderloop

    //create Light spheres for DS
    Node lights = Node("Root");
    Sphere lightSphere = Sphere();

    for (int i = -4; i < 4; i++)
        for (int j = -4; j < 4; j++)
        {
            Node *newLight = new Node(std::string("Node_"+std::to_string(i)+std::to_string(j)));
            newLight->addGeometry(&lightSphere);
            newLight->setModelMatrix(glm::translate(glm::mat4(1.0f), glm::vec3(i*1.5, 1.0f, j*1.5)));
            //newLight.setModelMatrix(glm::translate(glm::mat4(1.0f), glm::vec3(0, 1, 1.0f)));
            newLight->setModelMatrix(glm::scale(newLight->getModelMatrix(), glm::vec3(2.0, 2.0, 2.0)));
            lights.addChildrenNode(newLight);
        }

    int outputFPS = 0;

    while (!glfwWindowShouldClose(testWindow.getWindow()))
    {
        // You have to compute the delta time

        float deltaTime = glfwGetTime() - startTime;
        cam.setSensitivity(deltaTime);

        //if (!(outputFPS % 20))
        //std::cout << "FPS: " << static_cast<int>(1 / (glfwGetTime() - startTime)) << std::endl;

        std::cout << "FPS: " << static_cast<double>(glfwGetTime() - startTime) * 100 << std::endl;


        outputFPS++;
        startTime = glfwGetTime();

        //update Model Matrix
        lights.setModelMatrix(glm::rotate(lights.getModelMatrix(), 10.0f * deltaTime, glm::vec3(0.0, 1.0, 0.0)));


        fboGBuffer.bind();
        glClearColor(0, 0, 0, 0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        shaderGBuffer.bind();
        shaderGBuffer.sendMat4("viewMatrix", cam.getViewMatrix());
        shaderGBuffer.sendMat4("projectionMatrix", cam.getProjectionMatrix());

        testScene.render(shaderGBuffer);


        shaderGBuffer.unbind();
        fboGBuffer.unbind();

        //DEFERRED SHADING TEIL============================

        fboDeferredShading.bind();

        glCullFace(GL_FRONT);
        glEnable(GL_CULL_FACE);
        glDisable(GL_DEPTH_TEST);
        glEnable(GL_BLEND);
        glBlendFunc(GL_ONE, GL_ONE);
        glClearColor(0, 0, 0, 0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        shaderDsLightingShader.bind();

        shaderDsLightingShader.sendMat4("viewMatrix", cam.getViewMatrix());
        shaderDsLightingShader.sendMat4("projectionMatrix", cam.getProjectionMatrix());

        shaderDsLightingShader.sendSampler2D("positionMap", fboGBuffer.getColorTexture(0),0);
        shaderDsLightingShader.sendSampler2D("normalMap", fboGBuffer.getColorTexture(1),1);

        shaderDsLightingShader.sendInt("windowWidth", testWindow.getWidth());
        shaderDsLightingShader.sendInt("windowHeight", testWindow.getHeight());

        shaderDsLightingShader.sendVec3("lightColor", glm::fvec3(0.7f,0.7f,0.4f));

        lights.render(shaderDsLightingShader);

        glDisable(GL_CULL_FACE);
        glEnable(GL_DEPTH_TEST);
        glDisable(GL_BLEND);
        glClearColor(1.0, 1.0, 1.0, 0.0);
        shaderDsLightingShader.unbind();
        fboDeferredShading.unbind();

        //COMPOSITING TEIL ===============================
        fboCompositing.bind();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        shaderDsCompositingShader.bind();

        shaderDsCompositingShader.sendSampler2D("colorMap", fboGBuffer.getColorTexture(2),0);
        shaderDsCompositingShader.sendSampler2D("lightMap", fboDeferredShading.getColorTexture(2),1);

        screenFillingQuad.renderGeometry();

        shaderDsCompositingShader.unbind();
        fboCompositing.unbind();

        //================================================

        //ScreenFillingQuad Render Pass
        shaderSFQ.bind();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        if (glfwGetKey(testWindow.getWindow(), GLFW_KEY_F1))
            shaderSFQ.sendSampler2D("fboTexture", fboDeferredShading.getColorTexture(2));
        else
            shaderSFQ.sendSampler2D("fboTexture", fboCompositing.getColorTexture(2));

        screenFillingQuad.renderGeometry();
        shaderSFQ.unbind();


        glfwSwapBuffers(testWindow.getWindow());
        glfwPollEvents();
    }

    glfwDestroyWindow(testWindow.getWindow());
    glfwTerminate();

    return 0;
}
Exemple #4
0
int main() {
	glfwInit();

	//our window
	GLFWwindow* window;
	window = glfwCreateWindow(800, 600, "ComputeShader", NULL, NULL);
	glfwMakeContextCurrent(window);

	cam.setName("PilotviewCam");
	cam.setPosition(glm::vec4(0, 0, 2.0, 1.0));
	cam.setNearFar(0.01f, 10.0f);

	// Set all InputMaps and set one InputMap active
	iH.setAllInputMaps(cam);
	iH.changeActiveInputMap("Pilotview");

	// Callback
	glfwSetKeyCallback(window, key_callback);

	glewInit();
	
	/*MAGIC*/

	ComputeShader cs(loadShaderSource(SHADERS_PATH + std::string("/ComputeShader/simpleComputeShader.comp")));
	ShaderProgram compute(cs);

	VertexShader vs(loadShaderSource(SHADERS_PATH + std::string("/ComputeShader/ExComputeShader.vert")));
	FragmentShader fs(loadShaderSource(SHADERS_PATH + std::string("/ComputeShader/ExComputeShader.frag")));
	ShaderProgram render(vs, fs);

	//GLuint render_vao;
	//glGenVertexArrays(1, &render_vao);
	//glBindVertexArray(render_vao);

	GLuint position_ssbo;
	glGenBuffers(1, &position_ssbo);
	glBindBuffer(GL_SHADER_STORAGE_BUFFER, position_ssbo);
	glBufferData(GL_SHADER_STORAGE_BUFFER, PARTICLE_COUNT * sizeof(struct pos), NULL, GL_STATIC_DRAW);

	GLint bufMask = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT;
	struct pos* positions = (struct pos*)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, PARTICLE_COUNT * sizeof(struct pos), bufMask);
	for (int i = 0; i < PARTICLE_COUNT; i++)
	{
		positions[i].x = ((rand() % 100) / 100.0f) - 0.5;
		positions[i].y = ((rand() % 100) / 100.0f) - 0.5;
		positions[i].z = ((rand() % 100) / 100.0f) - 0.5;
		positions[i].w = 1;
	}
	glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);

	//glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL);
	//glEnableVertexAttribArray(0);

	//std::cout << "HIER MUSS 000 STEHEN:   " << positions[1].x << positions[1].y << positions[1].z << std::endl;
	/*END*/

	float startCamTime = glfwGetTime();

	double lastTime = glfwGetTime();
	int nbFrames = 0;

	while (!glfwWindowShouldClose(window))
	{
		// Measure speed
		double currentTime = glfwGetTime();
		nbFrames++;
		if (currentTime - lastTime >= 1.0){ // If last prinf() was more than 1 sec ago
			// printf and reset timer
			printf("%f ms/frame\n", 1000.0 / double(nbFrames));
			nbFrames = 0;
			lastTime += 1.0;
		}

		cam.setSensitivity(glfwGetTime() - startCamTime);
		startCamTime = cam.getSensitivity();

		compute.bind();
		glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, position_ssbo);
		compute.sendFloat("time", glfwGetTime());
		glDispatchCompute(PARTICLE_GROUP_COUNT, 1, 1);
		glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, 0);
		glMemoryBarrier(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT);
		compute.unbind();

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glDisable(GL_DEPTH_TEST);

		render.bind();
		glBindBuffer(GL_ARRAY_BUFFER, position_ssbo);
		render.sendMat4("viewMatrix", cam.getViewMatrix());
		render.sendMat4("projectionMatrix", cam.getProjectionMatrix());
		glVertexPointer(4, GL_FLOAT, 0, (void*)0);
		glEnableClientState(GL_VERTEX_ARRAY);
		//glPointSize(1.0);
		glDrawArrays(GL_POINTS, 0, PARTICLE_COUNT);
		glDisableClientState(GL_VERTEX_ARRAY);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		render.unbind();

		glfwSwapBuffers(window);
		glfwPollEvents();
	}

	glfwDestroyWindow(window);
	glfwTerminate();

	return 0;
}
Exemple #5
0
int main()
{
	//////////////////////////////////////////BASICS///////////////////////////////////////////

	srand(time(NULL));

	glfwInit();

	//WINDOW
	Window window(50, 50, 800, 600, "ParticleSystem");
	glfwMakeContextCurrent(window.getWindow());

	//CAM
	cam.setPosition(glm::vec4(-15.0, 0.0, 7.0, 1.0));
	cam.setNearFar(0.1f, 100.0f);
	cam.setLookAt(glm::vec3(cam.getPosition().x, cam.getPosition().y, cam.getPosition().z - 1.0));
	cam.setKeySpeed(8.0);
	iH.setAllInputMaps(cam);
	iH.changeActiveInputMap("Pilotview");

	//Callback
	glfwSetKeyCallback(window.getWindow(), key_callback);

	//More then just 60 fps, vsync off
	glfwSwapInterval(0);

	glewInit();

	//SHADER
	VertexShader vsSkybox(loadShaderSource(SHADERS_PATH + std::string("/SkyboxShader/SkyboxShader.vert")));
	FragmentShader fsSkybox(loadShaderSource(SHADERS_PATH + std::string("/SkyboxShader/SkyboxShader.frag")));
	ShaderProgram shaderSkybox(vsSkybox, fsSkybox);

	VertexShader vsObject(loadShaderSource(SHADERS_PATH + std::string("/TextureShader3D/TextureShader3D.vert")));
	FragmentShader fsObject(loadShaderSource(SHADERS_PATH + std::string("/TextureShader3D/TextureShader3D.frag")));
	ShaderProgram shaderObject(vsObject, fsObject);

	/////////////////////////////////////////TEXTURES//////////////////////////////////////////

	//COMIC CLOUD
	Texture* comicBalloonTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/balloon01.png"); 
	Texture* comicBalloonTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/balloon02.png"); 
	Texture* comicBalloonTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/balloon03.png"); 
	Texture* comicBalloonTex4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/balloon04.png"); 
	Texture* comicCloudTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/cloud01.png"); 
	Texture* comicCloudTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/cloud02.png");
	Texture* comicCloudTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/cloud03.png");
	Texture* comicCloudTex4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/cloud04.png");
	Texture* comicExclamationMarkTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/exclamationMark01.png");
	Texture* comicExclamationMarkTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/exclamationMark02.png");
	Texture* comicExclamationMarkTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/exclamationMark03.png");
	Texture* comicExclamationMarkTex4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/exclamationMark04.png");
	Texture* comicLightningTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/lightning01.png");
	Texture* comicLightningTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/lightning02.png");
	Texture* comicLightningTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/lightning03.png");
	Texture* comicLightningTex4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/lightning04.png");
	Texture* comicSpiralTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/spiral01.png");
	Texture* comicSpiralTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/spiral02.png");
	Texture* comicSpiralTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/spiral03.png");
	Texture* comicSpiralTex4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/spiral04.png");
	Texture* comicSpiralTex5 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/spiral05.png");
	Texture* comicSpiralTex6 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/spiral06.png");
	Texture* comicStarTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/star01.png");
	Texture* comicStarTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/comicCloud/star02.png");

	//FIRE
	Texture* fireTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/flame01_L.png");
	Texture* fireTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/flame02_L.png");
	Texture* fireTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/fire/flame03_L.png");

	//PARTICLE
	Texture* particleBlackTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/virus.png");
	Texture* particleWhiteTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/particle.png");
	Texture* snowTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/snowflake.png"); //TODO better Resolution
	Texture* glowwormTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/glowworm.png");
	Texture* energyTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/energy.png");
	Texture* fireflyTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/firefly.png");
	Texture* fireSparkTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/sparkOrange.png");
	Texture* fireSparkTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/particle/sparkRed.png");

	//RAIN
	Texture* rainTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/rain/rain.png"); //TODO darker

	//SMOKE
	Texture* drawSmokeTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeDraw/smoke01_L.png");
	Texture* drawSmokeTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeDraw/smoke02_L.png");
	Texture* drawSmokeTex3 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeDraw/smoke03_L.png");
	Texture* drawSmokeTex4 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeDraw/smoke04_L.png");
	Texture* smokeWhiteTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeWhite/smokeWhite01.png");
	Texture* smokeWhiteTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeWhite/smokeWhite02.png");
	Texture* smokeBlackTex1 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeBlack/smokeBlack01.png");
	Texture* smokeBlackTex2 = new Texture((char*)RESOURCES_PATH "/ParticleSystem/smoke/smokeBlack/smokeBlack02.png");

	//STAR
	Texture* fireWorkYellowTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/star/starYellow.png"); //TODO Work?
	Texture* fireWorkOrangeTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/star/starPink.png"); //TODO Work?
	Texture* fireWorkRedTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/star/starRed.png"); //TODO Work?
	Texture* fireWorkBlueTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/star/starBlue.png"); //TODO Work?
	Texture* fireWorkGreenTex = new Texture((char*)RESOURCES_PATH "/ParticleSystem/star/starGreen.png"); //TODO Work?

	///////////////////////////////////////FINAL EMITTER///////////////////////////////////////

	//FINAL EMITTER SNOW
	Emitter* snow = new Emitter(0, glm::vec3(0.0, 5.0, 0.0), 0.0, 0.166, 100, 30.0, true);
	snow->setVelocity(0);
	snow->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 1.0), 0.5f);
	snow->setAreaEmitting(false,true, 10.0, 10000);
	snow->addTexture(snowTex, 0.0);
	snow->defineLook(true, 0.04, 2.0);
	particleCount += (100 * 30 / 0.166);

	//FINAL EMITTER STRONG SNOW
	Emitter* snowStrong = new Emitter(0, glm::vec3(-3.5, 4.0, 0.0), 0.0, 0.166, 100, 15.0, true);
	snowStrong->setVelocity(2);
	snowStrong->usePhysicDirectionGravity(glm::vec4(0.6, -1.5, 0.0, 1.0), 2.6f);
	snowStrong->setAreaEmitting(false, true, 8.0, 10000);
	snowStrong->addTexture(snowTex, 0.0);
	snowStrong->defineLook(true, 0.03, 1.0, 3.0);
	particleCount += (100 * 15.0 / 0.166);

	//FINAL EMITTER WHITE SMOKE
	Emitter* smokeWhite = new Emitter(0, glm::vec3(3.0, -1.0, 1.0), 0.0, 0.4, 1, 8.0, true);
	smokeWhite->setVelocity(2);
	smokeWhite->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.8), 0.3f);
	smokeWhite->addTexture(smokeWhiteTex1, 1.0);
	smokeWhite->addTexture(smokeWhiteTex2, 0.25);
	std::vector<float> smokeWhiteSize{ 0.05f, 0.5f, 0.75f, 1.2f };
	std::vector<float> smokeWhiteTime{ 0.0f, 0.4f, 0.75f, 1.0f };
	smokeWhite->defineLook(true, smokeWhiteSize, smokeWhiteTime, 1.0, 4.0, 3.0, false, 0.3);
	smokeWhite->switchToGeometryShader();
	particleCount += (1 * 8.0 / 0.4);

	//FINAL EMITTER BLACK SMOKE
	Emitter* smokeBlack = new Emitter(0, glm::vec3(6.0, -1.0, 1.0), 0.0, 0.6, 1, 8.0, true);
	smokeBlack->setVelocity(2);
	smokeBlack->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.8), 0.3f);
	smokeBlack->addTexture(smokeBlackTex1, 1.0);
	smokeBlack->addTexture(smokeBlackTex2, 0.2);
	std::vector<float> smokeBlackSize{ 0.1f, 0.4f, 0.8f, 1.2f };
	std::vector<float> smokeBlackTime{ 0.0f, 0.2f, 0.75f, 1.0f };
	smokeBlack->defineLook(true, smokeBlackSize, smokeBlackTime, 1.0, 5.0, 3.0, false, 0.3);
	smokeBlack->switchToGeometryShader();
	particleCount += (1 * 8 / 0.4);

	//FINAL EMITTER CLOUD SMOKE
	Emitter* smokeCloud = new Emitter(0, glm::vec3(15.0, -1.0, 1.0), 0.0, 0.3, 1, 10.0, true);
	smokeCloud->setVelocity(3);
	smokeCloud->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.1), 0.15f);
	smokeCloud->addTexture(smokeWhiteTex1, 1.0);
	smokeCloud->addTexture(smokeWhiteTex2, 0.08);
	std::vector<float> smokeCloudSize{ 0.1f, 0.4f, 0.8f, 1.2f };
	std::vector<float> smokeCloudTime{ 0.0f, 0.2f, 0.75f, 1.0f };
	smokeCloud->defineLook(true, smokeBlackSize, smokeBlackTime, 1.0, 2.0, 4.0, false, 0.3);
	smokeCloud->switchToGeometryShader();
	particleCount += (1 * 10.0 / 0.3);

	//FINAL EMITTER RAIN
	Emitter* rain = new Emitter(0, glm::vec3(0.0, 3.0, 0.0), 0.0, 0.02, 50, 5.0, true);
	rain->setVelocity(0);
	rain->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 1.0), 5.0f);
	rain->setAreaEmitting(false, true, 8.0, 10000);
	rain->addTexture(rainTex, 0.0);
	rain->defineLook(true, 0.03, 1.0, 0.0);
	particleCount += (50 * 5.0 / 0.02);

	//FINAL EMITTER FONTAINE
	Emitter* fontaine = new Emitter(0, glm::vec3(-15.0,-1.0, 1.0), 0.0, 0.05, 5, 2.0, true);
	fontaine->setVelocity(0);
	fontaine->usePhysicTrajectory(glm::vec4(0.0, 0.0, 0.0, 1.0), 1.0);
	//fontaine->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.0), 0.7f);
	fontaine->defineLook(false, 0.3, 0.0, 0.5, 0.0, true, 1.0);
	particleCount += (3 * 2.0 / 0.05);

	//FINAL EMITTER CIRCLE
	Emitter* circle = new Emitter(0, glm::vec3(-18.0, 0.0, 1.0), 0.0, 0.2, 50, 4.0, true);
	circle->setVelocity(4);
	circle->addTexture(fireSparkTex1, 1.0);
	circle->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.0), 0.3f);
	circle->addTexture(fireSparkTex2 ,0.1);
	circle->defineLook(true, 0.03, 0.0, 2.0, 1.0, true, 0.0);
	circle->switchToGeometryShader();
	particleCount += (50 * 4.0 / 0.4);

	//FINAL EMITTER QUAD
	Emitter* quad = new Emitter(0, glm::vec3(-21.0, 0.0, 1.0), 0.0, 1.0, 100, 1.0, true);
	quad->setVelocity(0);
	quad->setAreaEmitting(true, true, 0.5, 1);
	quad->defineLook(false, 0.1, 0.0, 0.0, 0.0, false, 0.0);
	particleCount += (50 * 1.0 / 1.0);

	//FINAL EMITTER FRUITFLIES
	Emitter* fruitFlies = new Emitter(0, glm::vec3(11.5, 0.0, 1.0), 0.0, 0.166, 2, 10.0, true);
	fruitFlies->setVelocity(0);
	fruitFlies->usePhysicSwarmCircleMotion(true, true, true, 3.0);
	fruitFlies->setAreaEmitting(true, true, 0.5, 100);
	fruitFlies->addTexture(particleBlackTex, 0.0);
	fruitFlies->defineLook(true, 0.012, 3.0, 3.0, 0.0, true, 1.0);
	fruitFlies->switchToGeometryShader();
	particleCount += (2 * 10.0 / 0.166);

	//FINAL SCREEN EMITTER FRUITFLIES
	Emitter* screenFruitFlies = new Emitter(0, glm::vec3(-0.2, 0.2, 7.0), 0.0, 0.1, 2, 10.0, true);
	screenFruitFlies->setVelocity(0);
	screenFruitFlies->usePhysicSwarmCircleMotion(true, true, true, 3.0);
	screenFruitFlies->setAreaEmitting(true, false, 2.5, 1000);
	screenFruitFlies->addTexture(particleBlackTex, 0.0);
	screenFruitFlies->defineLook(true, 0.02, 1.0, 3.0, 0.0, true, 1.0);
	screenFruitFlies->switchToGeometryShader();
	particleCount += (3 * 10.0 / 0.166);

	//FINAL EMITTER GLOWWORM
	Emitter* glowworm = new Emitter(0, glm::vec3(-3.0, 0.0, 1.0), 0.0, 0.2, 1, 10.0, true);
	glowworm->setVelocity(0);
	glowworm->usePhysicSwarmCircleMotion(true, true, true, 3.0);
	glowworm->setAreaEmitting(true, false, 0.4, 1000);
	glowworm->addTexture(glowwormTex, 0.0);
	glowworm->defineLook(true, 0.1, 1.0, 1.5);
	particleCount += (1 * 10.0 / 0.2);

	//FINAL EMITTER ENERGYBALL
	Emitter* energyBall = new Emitter(0, glm::vec3(-12.0, -1.0, 1.0), 0.0, 0.01, 5, 15.0, true);
	energyBall->setVelocity(5);
	energyBall->usePhysicPointGravity(glm::vec4(-10.0, 1.0, 1.0, 3.0), 8.0, 2, 1.8);
	energyBall->addTexture(energyTex, 1.0);
	energyBall->defineLook(true, 0.04);
	particleCount += (5 * 15.0 / 0.01);

	//FINAL EMITTER COMIC CLOUD
	Emitter* cloud01 = new Emitter(0, glm::vec3(-6.0, 0.5, 1.0), 0.0, 1.6, 1, 10.0, true);
	cloud01->setVelocity(4);
	cloud01->usePhysicPointGravity(glm::vec4(0.0, -1.0, 0.0, -0.0), 0.0, 0, 0.72);
	cloud01->addTexture(comicCloudTex1, 0.0);
	std::vector<float> cloudSize1{ 0.8f, 1.6f };
	std::vector<float> cloudTime1{ 0.0f, 1.0f };
	cloud01->defineLook(true, cloudSize1, cloudTime1, 0.4, 4.0, 0.0, false, 0.3);
	cloud01->switchToGeometryShader();
	particleCount += (1 * 1.5 / 10.0);

	Emitter* cloud02 = new Emitter(0, glm::vec3(-6.0, 0.5, 1.0), 0.0, 2.3, 1, 10.0, true);
	cloud02->setVelocity(4);
	cloud02->usePhysicPointGravity(glm::vec4(0.0, -1.0, 0.0, -0.0), 0.0, 0, 0.6);
	cloud02->addTexture(comicCloudTex3, 0.0);
	std::vector<float> cloudSize2{ 0.8f, 1.6f };
	std::vector<float> cloudTime2{ 0.0f, 1.0f };
	cloud02->defineLook(true, cloudSize2, cloudTime2, 0.4, 4.0, 0.0, false, 0.3);
	cloud02->switchToGeometryShader();
	particleCount += (1 * 2.1 / 10.0);

	Emitter* cloud03 = new Emitter(0, glm::vec3(-7.0, 1.0, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud03->setVelocity(0);
	cloud03->addTexture(comicBalloonTex4, 1.0);
	cloud03->defineLook(true, 0.8, 2.0);
	cloud03->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud04 = new Emitter(0, glm::vec3(-4.8, 2.0, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud04->setVelocity(0);
	cloud04->addTexture(comicStarTex2, 1.0);
	cloud04->defineLook(true, 0.3, 2.0, 0.0, 0.0, false, 0.6);
	cloud04->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud05 = new Emitter(0, glm::vec3(-7.0, -1.0, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud05->setVelocity(0);
	cloud05->addTexture(comicStarTex2, 1.0);
	cloud05->defineLook(true, 0.5, 2.0, 0.0, 0.0, true, 0.4);
	cloud05->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud06 = new Emitter(0, glm::vec3(-4.3, 0.2, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud06->setVelocity(0);
	cloud06->addTexture(comicSpiralTex5, 1.0);
	cloud06->defineLook(true, 0.3, 2.0);
	cloud06->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud07 = new Emitter(0, glm::vec3(-8.0, 0.7, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud07->setVelocity(0);
	cloud07->addTexture(comicSpiralTex3, 1.0);
	cloud07->defineLook(true, 0.3, 2.0);
	cloud07->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud08 = new Emitter(0, glm::vec3(-7.9, 2.1, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud08->setVelocity(0);
	cloud08->addTexture(comicLightningTex1, 1.0);
	cloud08->defineLook(true, 0.6, 2.0);
	cloud08->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud09 = new Emitter(0, glm::vec3(-4.0, 1.4, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud09->setVelocity(0);
	cloud09->addTexture(comicLightningTex4, 1.0);
	cloud09->defineLook(true, 0.5, 2.0);
	cloud09->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud10 = new Emitter(0, glm::vec3(-3.7, 0.8, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud10->setVelocity(0);
	cloud10->addTexture(comicExclamationMarkTex3, 1.0);
	cloud10->defineLook(true, 0.3, 2.0);
	cloud10->switchToGeometryShader();
	particleCount += 1;

	Emitter* cloud11 = new Emitter(0, glm::vec3(-6.5, 2.4, 1.0), 0.0, 0.0, 1, 0.0, false);
	cloud11->setVelocity(0);
	cloud11->addTexture(comicExclamationMarkTex2, 1.0);
	cloud11->defineLook(true, 0.5, 2.0);
	cloud11->switchToGeometryShader();
	particleCount += 1;

	////////////////////////////////NOT FINAL EMITTER////////////////////////////////

	//FINAL EMITTER MAXIMUM; SET POSITION
	Emitter* maximumParticle = new Emitter(0, glm::vec3(-21.0, -3.0, 0.0), 0.0, 0.2, 5000, 12.0, true);
	maximumParticle->setVelocity(3);
	maximumParticle->usePhysicDirectionGravity(glm::vec4(0.0, 1.0, 0.0, 0.2), 0.5);
	maximumParticle->defineLook(false, 0.01);
	int particleCountMax = 5000 * 12 / 0.2;

	//particleMax with Texture

	//!EMITTER FIRE
	Emitter* fireMiddle = new Emitter(0, glm::vec3(9.0, 0.0, 1.0), 0.0, 1.0, 3.0, 4.0, true);
	fireMiddle->setVelocity(3);
	fireMiddle->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.5), 0.2);
	fireMiddle->addTexture(fireTex1, 1.0);
	//fireMiddle->addTexture(fireTex2, 0.5);
	fireMiddle->addTexture(fireTex3, 0.0);
	fireMiddle->defineLook(true, 0.5, 1.0, 2.0);
	fireMiddle->switchToGeometryShader();

	Emitter* fireSmoke = new Emitter(0, glm::vec3(9.0, -1.0, 1.0), 0.0, 0.4, 1, 8.0, true);
	fireSmoke->setVelocity(2);
	fireSmoke->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -0.8), 0.3f);
	fireSmoke->addTexture(smokeBlackTex1, 1.0);
	fireSmoke->addTexture(smokeBlackTex2, 0.08);
	std::vector<float> fireSmokeSize{ 0.1f, 0.4f, 0.8f, 1.2f };
	std::vector<float> fireSmokeTime{ 0.0f, 0.2f, 0.75f, 1.0f };
	fireSmoke->defineLook(true, fireSmokeSize, fireSmokeTime, 1.0, 4.0, 1.0, false, 0.3);
	fireSmoke->switchToGeometryShader();

	Emitter* firefly = new Emitter(0, glm::vec3(9.1, -0.9, 1.0), 0.0, 1.3, 1, 9.0, true);
	firefly->setVelocity(3);
	firefly->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -1.5), 0.13f);
	firefly->addTexture(fireflyTex, 1.0);
	firefly->defineLook(true, 0.04, 2.0, 2.0, 0.0, false, 0.3);

	Emitter* fireSparkOrange = new Emitter(0, glm::vec3(9.1, -0.9, 1.0), 0.0, 0.1, 1, 0.8, true);
	fireSparkOrange->setVelocity(3);
	fireSparkOrange->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -1.0), 1.5f);
	fireSparkOrange->addTexture(fireSparkTex1, 1.0);
	fireSparkOrange->defineLook(true, 0.02, 0.4, 0.3, 0.0, false, 0.3);

	Emitter* fireSparkRed = new Emitter(0, glm::vec3(9.1, -0.9, 1.0), 0.0, 0.1, 1, 1.0, true);
	fireSparkRed->setVelocity(3);
	fireSparkRed->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, -1.5), 1.5f);
	fireSparkRed->addTexture(fireSparkTex2, 1.0);
	fireSparkRed->defineLook(true, 0.02, 0.4, 0.3, 0.0, false, 0.3);

	//!EMITTER FIREWORK
	Emitter* firework = new Emitter(0, glm::vec3(0.6, 0.6, 0.0), 0.0, 0.5, 5, 1.0, true);
	firework->setVelocity(4);
	firework->usePhysicDirectionGravity(glm::vec4(0.0,-1.0,0.0,0.1), 1.0f);
	//firework->addTexture(*fireWorkYellowTex, 0.0);
	//firework->defineLook(true, 0.8, 0.1, 0.2);
	Emitter* firework2 = new Emitter(0, glm::vec3(-0.6, -0.6, 0.0), 0.0, 0.5, 5, 1.0, true);
	firework2->setVelocity(4);
	firework2->usePhysicDirectionGravity(glm::vec4(0.0, -1.0, 0.0, 0.1), 1.0f);
	//firework2->addTexture(*fireWorkOrangeTex, 0.0);
	//firework2->defineLook(true, 0.8, 0.1, 0.2);

	//////////////////////////////////////OUR SCENE///////////////////////////////////////////////

	//SKYBOX
	Cube cube;
	const char *textureNames[6] = { 
		/*(char*)RESOURCES_PATH "/PereaBeach1/posx.jpg",
		(char*)RESOURCES_PATH "/PereaBeach1/negx.jpg",
		(char*)RESOURCES_PATH "/PereaBeach1/posy.jpg",
		(char*)RESOURCES_PATH "/PereaBeach1/negy.jpg",
		(char*)RESOURCES_PATH "/PereaBeach1/posz.jpg",
		(char*)RESOURCES_PATH "/PereaBeach1/negz.jpg"*/
		(char*)RESOURCES_PATH "/Color/testTex.png",
		(char*)RESOURCES_PATH "/Color/testTex.png",
		(char*)RESOURCES_PATH "/Color/testTex.png",
		(char*)RESOURCES_PATH "/Color/testTex.png",
		(char*)RESOURCES_PATH "/Color/testTex.png",
		(char*)RESOURCES_PATH "/Color/testTex.png" };
	Skybox skybox(textureNames);
	Node skyboxNode("skybox");
	skyboxNode.addGeometry(&cube);

	//OBJECTS
	Teapot teapot;
	teapot.loadBufferData();
	Sphere sphere;
	sphere.loadBufferData();
	Rect plane;
	plane.loadBufferData();

	//TEXTURES
	Texture chrome((char*)RESOURCES_PATH "/Metal/chrome.jpg");
	Texture marble((char*)RESOURCES_PATH "/Wall/seamless_marble.png"); //TODO JPG
	Texture cvLogo((char*)RESOURCES_PATH "/Symbol/cv_logo.bmp");
	Texture bricks((char*)RESOURCES_PATH "/Wall/brick.bmp");

	//CREATING NODES
	Level testLevel("testLevel");
	Scene testScene("testScene");
	testLevel.addScene(&testScene);
	testLevel.changeScene("testScene");

	Node cube1("cube1");
	cube1.addGeometry(&cube);
	cube1.addTexture(&chrome);
	cube1.setModelMatrix(glm::translate(cube1.getModelMatrix(), glm::vec3(-0.3, 0.25, 0.4)));
	cube1.setModelMatrix(glm::scale(cube1.getModelMatrix(), glm::vec3(0.3, 0.3, 0.3)));

	Node cube2("cube2");
	cube2.addGeometry(&cube);
	cube2.addTexture(&chrome);
	cube2.setModelMatrix(glm::translate(cube2.getModelMatrix(), glm::vec3(0.7, 0.25, 0.4)));
	cube2.setModelMatrix(glm::scale(cube2.getModelMatrix(), glm::vec3(0.3, 0.3, 0.3)));

	Node wallNode1("wall1");
	wallNode1.addGeometry(&plane);
	wallNode1.addTexture(&marble);
	wallNode1.setModelMatrix(glm::translate(wallNode1.getModelMatrix(), glm::vec3(0.0, -1.0, 0.0)));
	wallNode1.setModelMatrix(glm::rotate(wallNode1.getModelMatrix(), 90.0f, glm::vec3(1.0, 0.0, 0.0)));
	wallNode1.setModelMatrix(glm::scale(wallNode1.getModelMatrix(), glm::vec3(25.0, 2.0, 1.0)));

	Node wallNode2("wall2");
	wallNode2.addGeometry(&plane);
	wallNode2.addTexture(&bricks);
	wallNode2.setModelMatrix(glm::translate(wallNode2.getModelMatrix(), glm::vec3(0.0, 0.0, 0.0)));
	wallNode2.setModelMatrix(glm::scale(wallNode2.getModelMatrix(), glm::vec3(25.0, 2.5, 1.0)));

	Node teaNode("teaNode");
	teaNode.addGeometry(&teapot);
	teaNode.addTexture(&cvLogo);
	teaNode.setModelMatrix(glm::translate(teaNode.getModelMatrix(), glm::vec3(0.2, 0.3, 1.0)));
	teaNode.setModelMatrix(glm::scale(teaNode.getModelMatrix(), glm::vec3(0.3, 0.3, 0.3)));

	//CREATING A SCENEGRAPH
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&wallNode1);
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&wallNode2);
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube1);
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&cube2);
	testScene.getScenegraph()->getRootNode()->addChildrenNode(&teaNode);

	//ADD CAMERA TO SCENEGRAPH
	testScene.getScenegraph()->addCamera(&cam);
	testScene.getScenegraph()->getCamera("Pilotview");
	testScene.getScenegraph()->setActiveCamera("Pilotview");

	//GUI
	initGUI();

	double startCamTime = glfwGetTime();

	int outputFrames = 0;
	float dTime;

	while (!glfwWindowShouldClose(window.getWindow()))
	{
		//CAM
		dTime = glfwGetTime() - startCamTime;
		cam.setSensitivity(dTime);
		startCamTime = glfwGetTime();

		//Maximum Particle
		if (!useMaximumParticle->isActive()){

			//SKYBOX
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			shaderSkybox.bind();
			glDisable(GL_DEPTH_TEST);
			shaderSkybox.sendMat4("viewMatrix", cam.getViewMatrix());
			shaderSkybox.sendMat4("projectionMatrix", cam.getProjectionMatrix());
			shaderSkybox.sendSkyboxTexture("testTexture", skybox.getSkyboxTexture());
			//skyboxNode.render();
			shaderSkybox.unbind();

			glEnable(GL_DEPTH_TEST);
			shaderObject.bind();
			shaderObject.sendMat4("viewMatrix", cam.getViewMatrix());
			shaderObject.sendMat4("projectionMatrix", cam.getProjectionMatrix());
			shaderObject.sendInt("useTexture", 1);
			teaNode.setModelMatrix(glm::rotate(teaNode.getModelMatrix(), 3.0f, glm::vec3(0.0, 1.0, 0.0)));
			cube1.setModelMatrix(glm::rotate(cube1.getModelMatrix(), 3.0f, glm::vec3(0.0, 1.0, 0.0)));
			cube2.setModelMatrix(glm::rotate(cube2.getModelMatrix(), 3.0f, glm::vec3(0.0, 1.0, 0.0)));
			//testScene.render(shaderObject);
			shaderObject.unbind();

			///////////////////////////////////////FINAL EMITTER///////////////////////////////////////
			glDisable(GL_DEPTH_TEST);

			//smokeWhite->update();
			//smokeWhite->render(cam);

			//smokeBlack->update();
			//smokeBlack->render(cam);

			fontaine->update();
			fontaine->render(cam);

			//circle->update();
			//circle->render(cam);

			//quad->update();
			//quad->render(cam);

			//glowworm->update();
			//glowworm->render(cam);

			//fruitFlies->update();
			//fruitFlies->render(cam);

			//energyBall->update();
			//energyBall->render(cam);

			//cloud01->update();
			//cloud01->render(cam);
			//cloud02->update();
			//cloud02->render(cam);
			//cloud03->update();
			//cloud03->render(cam);
			//cloud04->update();
			//cloud04->render(cam);
			//cloud05->update();
			//cloud05->render(cam);
			//cloud06->update();
			//cloud06->render(cam);
			//cloud07->update();
			//cloud07->render(cam);
			//cloud08->update();
			//cloud08->render(cam);
			//cloud09->update();
			//cloud09->render(cam);
			//cloud10->update();
			//cloud10->render(cam);
			//cloud11->update();
			//cloud11->render(cam);
		}
		////////////////////////////////FINAL SCREEN EMITTER//////////////////////////////////////////////////
		else{
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			maximumParticle->update();
			maximumParticle->render(cam);
			particleCount = particleCountMax;
		}

		if (useFruitFliesButton->isActive()){
			screenFruitFlies->update();
			screenFruitFlies->render(screen);
		}
		else{
			screenFruitFlies->startTime();
		}

			////////////////////////////////FINAL GUI EMITTER///////////////////////////////////////////
		if (useSnowButton->isActive()){
			snow->update(glm::vec3(cam.getPosition()));
			snow->render(cam);
		}
		else{
			snow->startTime();
		}

		if (useStrongSnowButton->isActive()){
			snowStrong->update(glm::vec3(cam.getPosition()));
			snowStrong->render(cam);
		}
		else{
			snowStrong->startTime();
		}

		if (useRainButton->isActive()){
			rain->update(glm::vec3(cam.getPosition()));
			rain->render(cam);
		}{
			rain->startTime();
		}

		////////////////////////////////WAITING FOR TEXTURES EMITTER////////////////////////////////

		//todo: flamme
		//fireMiddle->update();
		//fireMiddle->render(cam);
		//fireSmoke->update();
		//fireSmoke->render(cam);
		//firefly->update();
		//firefly->render(cam);
		//fireSparkOrange->update();
		//fireSparkOrange->render(cam);
		//fireSparkRed->update();
		//fireSparkRed->render(cam);

		// todo all
		//firework->update();
		//firework->render(cam);

		//smokeCloud
		//smokeCloud->update();
		//smokeCloud->render(cam);

		////////////////////////////////BASICS///////////////////////////////////////////////////////

		//renderer->renderGUI(*gui, window);

		//WINDOW
		window.swapAndPoll();

		//FPS
		if (!(outputFrames % 30)){
			outputFrames = 1;
			//std::cout << "FPS: " << static_cast<int> (1 / dTime) << "; Up to " << particleCount << " particles"<<std::endl;
		}
		outputFrames++;
	}
	glfwDestroyWindow(window.getWindow());
	glfwTerminate();

	return 0;
}