diff --git a/.gitignore b/.gitignore
index 55083f4..1a074fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-################################################################################
-# Ten plik .gitignore został utworzony automatycznie przez Microsoft(R) Visual Studio.
-################################################################################
+
/grk/project/shaders
+
+/grk/.vs/grk-cw
+/grk/project/Debug
\ No newline at end of file
diff --git a/grk/.vs/grk-cw/v16/Browse.VC.db b/grk/.vs/grk-cw/v16/Browse.VC.db
deleted file mode 100644
index f14a9ad..0000000
Binary files a/grk/.vs/grk-cw/v16/Browse.VC.db and /dev/null differ
diff --git a/grk/.vs/grk-cw/v16/Solution.VC.db b/grk/.vs/grk-cw/v16/Solution.VC.db
deleted file mode 100644
index fc232d7..0000000
Binary files a/grk/.vs/grk-cw/v16/Solution.VC.db and /dev/null differ
diff --git a/grk/project/Debug/Box.obj b/grk/project/Debug/Box.obj
deleted file mode 100644
index 1e5cd88..0000000
Binary files a/grk/project/Debug/Box.obj and /dev/null differ
diff --git a/grk/project/Debug/Camera.obj b/grk/project/Debug/Camera.obj
deleted file mode 100644
index 5fc7d26..0000000
Binary files a/grk/project/Debug/Camera.obj and /dev/null differ
diff --git a/grk/project/Debug/Render_Utils.obj b/grk/project/Debug/Render_Utils.obj
deleted file mode 100644
index 55c3ff6..0000000
Binary files a/grk/project/Debug/Render_Utils.obj and /dev/null differ
diff --git a/grk/project/Debug/SOIL.obj b/grk/project/Debug/SOIL.obj
deleted file mode 100644
index fb57f23..0000000
Binary files a/grk/project/Debug/SOIL.obj and /dev/null differ
diff --git a/grk/project/Debug/Shader_Loader.obj b/grk/project/Debug/Shader_Loader.obj
deleted file mode 100644
index 9caa264..0000000
Binary files a/grk/project/Debug/Shader_Loader.obj and /dev/null differ
diff --git a/grk/project/Debug/Texture.obj b/grk/project/Debug/Texture.obj
deleted file mode 100644
index 57f70e5..0000000
Binary files a/grk/project/Debug/Texture.obj and /dev/null differ
diff --git a/grk/project/Debug/grk-project.exe.recipe b/grk/project/Debug/grk-project.exe.recipe
deleted file mode 100644
index 089ed98..0000000
--- a/grk/project/Debug/grk-project.exe.recipe
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- C:\Users\KOMP\Documents\projekt_grafika_komputerowa\grafika_komputerowa\grk\Debug\grk-project.exe
-
-
-
-
-
-
\ No newline at end of file
diff --git a/grk/project/Debug/image_DXT.obj b/grk/project/Debug/image_DXT.obj
deleted file mode 100644
index 337be3d..0000000
Binary files a/grk/project/Debug/image_DXT.obj and /dev/null differ
diff --git a/grk/project/Debug/image_helper.obj b/grk/project/Debug/image_helper.obj
deleted file mode 100644
index 819d134..0000000
Binary files a/grk/project/Debug/image_helper.obj and /dev/null differ
diff --git a/grk/project/Debug/main.obj b/grk/project/Debug/main.obj
deleted file mode 100644
index 024a7f1..0000000
Binary files a/grk/project/Debug/main.obj and /dev/null differ
diff --git a/grk/project/Debug/stb_image_aug.obj b/grk/project/Debug/stb_image_aug.obj
deleted file mode 100644
index 5038a9b..0000000
Binary files a/grk/project/Debug/stb_image_aug.obj and /dev/null differ
diff --git a/grk/project/GameUtils.h b/grk/project/GameUtils.h
index a1b7ebb..04ba976 100644
--- a/grk/project/GameUtils.h
+++ b/grk/project/GameUtils.h
@@ -2,6 +2,7 @@
#include "Sun.h"
#include "Bullet.h"
#include "src/Shader_Loader.h"
+#include "ParticleSystem.h"
#pragma once
class GameUtils
@@ -12,9 +13,11 @@ private:
{
this->suns = new std::list();
this->shaderLoader = new Core::Shader_Loader();
+ this->particleSystems = new std::list();
}
std::list* suns;
std::list bullets;
+ std::list* particleSystems;
float aspectRatio;
@@ -35,6 +38,10 @@ public:
return suns;
}
+ std::list* getParticleSystems() {
+ return particleSystems;
+ }
+
static GameUtils* getInstance()
{
static GameUtils instance; // Jedna i jedyna instancja
diff --git a/grk/project/ParticleSystem.h b/grk/project/ParticleSystem.h
new file mode 100644
index 0000000..123b190
--- /dev/null
+++ b/grk/project/ParticleSystem.h
@@ -0,0 +1,142 @@
+#pragma once
+#include "glew.h"
+#include
+#include "glm.hpp"
+#include
+#include "ext.hpp"
+
+
+struct Particle
+{
+public:
+ float birthTime;
+ glm::vec3 startPosition;
+ glm::vec3 direction;
+ glm::vec3 randomPointOnCircle;
+
+ float getAge(float time) {
+ return time - birthTime;
+ }
+};
+
+class ParticleSystem
+{
+private:
+ std::list particles;
+ GLuint VBO;
+ GLuint VAO;
+ GLfloat vertices[9];
+ float lastGenerated = -1.f;
+
+ bool shouldGenerateNewParticle(float time) {
+ return lastGenerated == -1.f || time - lastGenerated > generationInterval;
+ }
+
+ glm::vec3 generateRandomPointOnCircle() {
+ float distanceFromCenter = static_cast (rand()) / static_cast (RAND_MAX/sourceRadius);
+ float radians = static_cast (rand()) / static_cast (RAND_MAX / 6.28f);
+
+ glm::vec3 referenceVector(0.0f, 1.0f, 0.0f);
+ glm::vec3 output = glm::normalize(glm::cross(sourceDirection, referenceVector)) * distanceFromCenter;
+
+ glm::mat4 rotationMatrix = glm::rotate(glm::mat4(1.0f), radians, sourceDirection);
+ output = glm::vec3(rotationMatrix * glm::vec4(output, 1.0f));
+
+ return output;
+ }
+
+ void generateNewParticle(float time) {
+ Particle newParticle;
+ newParticle.birthTime = time;
+ newParticle.startPosition = sourcePosition;
+ newParticle.randomPointOnCircle = generateRandomPointOnCircle();
+ newParticle.direction = sourceDirection;
+ particles.push_back(newParticle);
+ lastGenerated = time;
+ }
+
+ void deleteOld(float time) {
+ auto it = particles.begin();
+
+ while (it != particles.end()) {
+ if ((*it).getAge(time) > lifetime) {
+ it = particles.erase(it);
+ }
+ else {
+ ++it;
+ }
+ }
+ }
+
+ glm::vec3 calculateParticleColor(float age) {
+ float rate = glm::clamp(age / lifetime, 0.f, 1.f);
+ glm::vec3 mixedColor = (1.0f - rate) * startColor + rate * endColor;
+ return mixedColor;
+ }
+
+public:
+ glm::vec3 sourcePosition;
+ float sourceRadius = 0.02f;
+ glm::vec3 sourceDirection = glm::vec3(1.f, 0.f, 0.f);
+ float generationInterval = 0.0025f;
+ float lifetime = 0.5f;
+ float speed = 100.f;
+ glm::vec3 startColor = glm::vec3(1.f, 0.f, 0.f);
+ glm::vec3 endColor = glm::vec3(1.f, 1.f, 0.f);
+
+ ParticleSystem() {
+ // Inicjalizacja wierzcho³ków trójk¹ta w 3D
+ vertices[0] = -0.5f; vertices[1] = -0.5f; vertices[2] = 0.0f;
+ vertices[3] = 0.5f; vertices[4] = -0.5f; vertices[5] = 0.0f;
+ vertices[6] = 0.0f; vertices[7] = 0.5f; vertices[8] = 0.0f;
+
+ glGenBuffers(1, &VBO);
+ glBindBuffer(GL_ARRAY_BUFFER, VBO);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
+
+ glGenVertexArrays(1, &VAO);
+ glBindVertexArray(VAO);
+
+ glBindBuffer(GL_ARRAY_BUFFER, VBO);
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (void*)0);
+ glEnableVertexAttribArray(0);
+
+ glBindVertexArray(0);
+ }
+
+ void drawParticles(GLuint program, glm::mat4 view, glm::mat4 projection, float time) {
+ if (shouldGenerateNewParticle(time)) {
+ generateNewParticle(time);
+ }
+
+ deleteOld(time);
+
+ glUseProgram(program);
+ GLuint modelLoc = glGetUniformLocation(program, "model");
+ GLuint viewLoc = glGetUniformLocation(program, "view");
+ GLuint projectionLoc = glGetUniformLocation(program, "projection");
+ GLuint colorLoc = glGetUniformLocation(program, "color");
+
+ int i = 0;
+ for (auto particle : particles) {
+ glm::vec3 color = calculateParticleColor(particle.getAge(time));
+ glUniform3f(colorLoc, color.x, color.y, color.z);
+ glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
+ glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
+
+ glm::mat4 model = glm::translate(glm::mat4(1.0f), sourcePosition + particle.randomPointOnCircle);
+ model = glm::scale(model, glm::vec3(0.005f, 0.005f, 0.005f));
+ model = glm::translate(model, particle.direction * speed * (time - particle.birthTime));
+ glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
+
+ glBindVertexArray(VAO);
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+ i++;
+ }
+
+ glBindVertexArray(0);
+ }
+};
+
+
+
diff --git a/grk/project/Source.cpp b/grk/project/Source.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/grk/project/Spaceship.h b/grk/project/Spaceship.h
index c5620d9..5435ef2 100644
--- a/grk/project/Spaceship.h
+++ b/grk/project/Spaceship.h
@@ -3,6 +3,7 @@
#include
#include
#include "Bullet.h"
+#include "ParticleSystem.h"
#pragma once
@@ -12,10 +13,12 @@ private:
std::list bullets;
float lastShootTime = 0.f;
float shootInterval = 0.3f;
+ ParticleSystem* leftParticle;
+ ParticleSystem* rightParticle;
// Prywatny konstruktor, aby zapobiec zewnêtrznemu tworzeniu instancji
Spaceship() {
-
+
}
// Prywatny destruktor, aby zapobiec przypadkowemu usuwaniu instancji
@@ -33,7 +36,7 @@ public:
float roughness = 0.2;
float metallic = 1.0;
- glm::vec3 spaceshipPos = glm::vec3(0.065808f, 1.250000f, -2.189549f);
+ glm::vec3 spaceshipPos /*= glm::vec3(0.065808f, 1.250000f, -2.189549f)*/;
glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);
glm::vec3 spotlightPos = glm::vec3(0, 0, 0);
@@ -57,6 +60,13 @@ public:
return glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi()) * glm::scale(glm::vec3(0.03f));
}
+ void setPerticlesParameters(float speed, float generationInterval) {
+ leftParticle->speed = speed;
+ leftParticle->generationInterval = generationInterval;
+ rightParticle->speed = speed;
+ rightParticle->generationInterval = generationInterval;
+ }
+
void processInput(GLFWwindow* window, float deltaTime, float time) {
static bool mouseButtonCallbackSet = false;
if (!mouseButtonCallbackSet) {
@@ -67,12 +77,30 @@ public:
float angleSpeed = 0.05f * deltaTime * 60;
float moveSpeed = 0.05f * deltaTime * 60;
+ int w = glfwGetKey(window, GLFW_KEY_W);
+ int s = glfwGetKey(window, GLFW_KEY_S);
+
+ if (w == GLFW_PRESS) {
+ if (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) {
+ moveSpeed *= 2;
+ setPerticlesParameters(200.f, 0.00005f);
+ }
+ else {
+ setPerticlesParameters(100.f, 0.0001f);
+ }
+ }
+ else {
+ setPerticlesParameters(50.f, 0.0002f);
+ }
+
+
+
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
glfwSetWindowShouldClose(window, true);
}
- if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
+ if (w == GLFW_PRESS)
spaceshipPos += spaceshipDir * moveSpeed;
- if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
+ if (s == GLFW_PRESS)
spaceshipPos -= spaceshipDir * moveSpeed;
if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS)
spaceshipPos += spaceshipSide * moveSpeed;
@@ -89,13 +117,37 @@ public:
if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS)
requestShoot(time);
- cameraPos = spaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.2f;
+ cameraPos = spaceshipPos - 1.f * spaceshipDir + glm::vec3(0, 1, 0) * 0.2f;
cameraDir = spaceshipDir;
+ glm::vec3 perpendicularVector = 0.04f * glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.0f, 1.0f, 0.0f)));
+ if (leftParticle != nullptr && rightParticle != nullptr) {
+ leftParticle->sourcePosition = spaceshipPos + perpendicularVector - (0.25f * spaceshipDir);
+ rightParticle->sourcePosition = spaceshipPos - perpendicularVector - (0.25f * spaceshipDir);
+ leftParticle->sourceDirection = -spaceshipDir;
+ rightParticle->sourceDirection = -spaceshipDir;
+ }
spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
spotlightConeDir = spaceshipDir;
}
+ void renderParticles(GLuint program, glm::mat4 view, glm::mat4 projection, float time) {
+ if (leftParticle != nullptr && rightParticle != nullptr) {
+ leftParticle->drawParticles(program, view, projection, time);
+ rightParticle->drawParticles(program, view, projection, time);
+ }
+ }
+
+ void createParticles() {
+ if (leftParticle != nullptr && rightParticle != nullptr) {
+ delete leftParticle;
+ delete rightParticle;
+ }
+
+ leftParticle = new ParticleSystem();
+ rightParticle = new ParticleSystem();
+ }
+
glm::mat4 createCameraMatrix()
{
glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir, glm::vec3(0.f, 1.f, 0.f)));
diff --git a/grk/project/grk-project.vcxproj b/grk/project/grk-project.vcxproj
index abb491b..74edb9f 100644
--- a/grk/project/grk-project.vcxproj
+++ b/grk/project/grk-project.vcxproj
@@ -14,6 +14,7 @@
+
@@ -30,6 +31,7 @@
+
@@ -50,6 +52,8 @@
+
+
diff --git a/grk/project/grk-project.vcxproj.filters b/grk/project/grk-project.vcxproj.filters
index 8109db6..117ac2c 100644
--- a/grk/project/grk-project.vcxproj.filters
+++ b/grk/project/grk-project.vcxproj.filters
@@ -59,6 +59,8 @@
Source Files
+
+ Shader Files
@@ -120,6 +122,7 @@
Header Files
+
Header Files
@@ -154,6 +157,10 @@
Shader Files
+
+ Shader Files
+
+
Shader Files
diff --git a/grk/project/grk-project.vcxproj.filters.orig b/grk/project/grk-project.vcxproj.filters.orig
deleted file mode 100644
index 3638fc3..0000000
--- a/grk/project/grk-project.vcxproj.filters.orig
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {0a247bb8-2e8e-4a90-b0ef-17415b0941ba}
-
-
- {0af44075-33f4-4953-b1d6-1d28d61d758f}
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files
-
-
- Source Files
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files\SOIL
-
-
- Source Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
-
-
- Shader Files
-
-
- Shader Files
-
-
- Shader Files
-
-
- Shader Files
-
-
- Shader Files
-
-
- Shader Files
-
-<<<<<<< HEAD
-
- Shader Files
-
-
-=======
-
- Shader Files
-
-
->>>>>>> 62afe67 (add shooting)
- Shader Files
-
-
-
\ No newline at end of file
diff --git a/grk/project/src/Camera.h b/grk/project/src/Camera.h
index 54c29b3..52e4ba2 100644
--- a/grk/project/src/Camera.h
+++ b/grk/project/src/Camera.h
@@ -4,7 +4,7 @@
namespace Core
{
- glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 100.0f, float frustumScale = 1.f);
+ glm::mat4 createPerspectiveMatrix(float zNear, float zFar, float frustumScale);
// position - pozycja kamery
// forward - wektor "do przodu" kamery (jednostkowy)
diff --git a/grk/project/src/ex_9_1.hpp b/grk/project/src/ex_9_1.hpp
index 3443a46..9db200f 100644
--- a/grk/project/src/ex_9_1.hpp
+++ b/grk/project/src/ex_9_1.hpp
@@ -24,6 +24,8 @@
#include "../SpriteRenderer.h"
#include "../Enemy.h"
+#include "../ParticleSystem.h"
+#include "Camera.h"
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
@@ -50,6 +52,7 @@ GLuint programSun;
GLuint programTest;
GLuint programSprite;
GLuint programCubemap;
+GLuint programParticle;
std::list planets;
Sun* sun;
@@ -142,10 +145,10 @@ void renderScene(GLFWwindow* window)
}
-
-
- //drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);
-
+ glm::vec3 cameraSide = glm::normalize(glm::cross(spaceship->cameraDir, glm::vec3(0.f, 1.f, 0.f)));
+ glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, spaceship->cameraDir));
+ glm::mat4 viewMatrix = Core::createViewMatrix(spaceship->cameraPos, spaceship->cameraDir, cameraUp);
+ spaceship->renderParticles(programParticle, viewMatrix, Core::createPerspectiveMatrix(), time);
glUseProgram(0);
glfwSwapBuffers(window);
@@ -207,7 +210,8 @@ void init(GLFWwindow* window)
programSun = gameUtils->shaderLoader->CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
programCubemap = gameUtils->shaderLoader->CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
programSprite = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite.vert", "shaders/shader_sprite.frag");
-
+ programParticle = gameUtils->shaderLoader->CreateProgram("shaders/particle.vert", "shaders/particle.frag");
+
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
loadModelToContext("./models/spaceship.obj", models::spaceshipContext);
loadModelToContext("./models/sphere.obj", models::sphereContext);
@@ -227,6 +231,7 @@ void init(GLFWwindow* window)
texture::cubemapTexture = Core::LoadCubemap(cubeFaces);
+ spaceship->createParticles();
createSuns();
createEnemies();
}
diff --git a/grk/project/src/ex_9_1.hpp.orig b/grk/project/src/ex_9_1.hpp.orig
index 328f38e..de240ec 100644
--- a/grk/project/src/ex_9_1.hpp.orig
+++ b/grk/project/src/ex_9_1.hpp.orig
@@ -21,9 +21,14 @@
#include "../Planet.h"
#include "../GameObject.h"
#include "../GameUtils.h"
+<<<<<<< HEAD
#include "../SpriteRenderer.h"
#include "../Enemy.h"
+=======
+#include "../ParticleSystem.h"
+#include "Camera.h"
+>>>>>>> 2162820 (fire from ship)
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
@@ -50,6 +55,7 @@ GLuint programSun;
GLuint programTest;
GLuint programSprite;
GLuint programCubemap;
+GLuint programParticle;
std::list planets;
Sun* sun;
@@ -67,12 +73,9 @@ float lastTime = -1.f;
float deltaTime = 0.f;
Spaceship* spaceship = Spaceship::getInstance();
-<<<<<<< HEAD
void createSolarSystem(glm::vec3 sunPos, float sunScale, float* planetSizes, int numberOfPlanets, float planetsDistance, float planetSpeedCoef);
-=======
Core::SpriteRenderer* spriteRenderer;
->>>>>>> c0971c9 (Add enemy class)
void updateDeltaTime(float time) {
if (lastTime < 0) {
lastTime = time;
@@ -128,6 +131,8 @@ void renderScene(GLFWwindow* window)
spaceship->color,
spaceship->roughness, spaceship->metallic, program
);
+
+<<<<<<< HEAD
glUseProgram(programSprite);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
@@ -148,6 +153,16 @@ void renderScene(GLFWwindow* window)
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);
+=======
+ std::list* particleSystems = GameUtils::getInstance()->getParticleSystems();
+ glm::vec3 cameraSide = glm::normalize(glm::cross(spaceship->cameraDir, glm::vec3(0.f, 1.f, 0.f)));
+ glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, spaceship->cameraDir));
+ glm::mat4 viewMatrix = Core::createViewMatrix(spaceship->cameraPos, spaceship->cameraDir, cameraUp);
+ spaceship->renderParticles(programParticle, viewMatrix, Core::createPerspectiveMatrix(), time);
+ /*for (auto particleSystem : *particleSystems) {
+ particleSystem->drawParticles(programParticle, viewMatrix, Core::createPerspectiveMatrix(), time);
+ }*/
+>>>>>>> 2162820 (fire from ship)
glUseProgram(0);
glfwSwapBuffers(window);
@@ -187,9 +202,7 @@ void createSolarSystem(glm::vec3 sunPos, float sunScale, float* planetSizes, int
planets.push_back(planet);
}
}
-<<<<<<< HEAD
-=======
void createEnemies() {
enemies.push_back(new Enemy(100, glm::mat4(1.0f), 20, 5.0f));
@@ -197,7 +210,7 @@ void createEnemies() {
enemies.push_back(new Enemy(100, glm::translate(glm::mat4(1.0f), glm::vec3(-1.f, 2.f, -0.9f)), 25, 5.0f));
}
->>>>>>> c0971c9 (Add enemy class)
+
void init(GLFWwindow* window)
{
GameUtils* gameUtils = GameUtils::getInstance();
@@ -210,8 +223,13 @@ void init(GLFWwindow* window)
programTest = gameUtils->shaderLoader->CreateProgram("shaders/test.vert", "shaders/test.frag");
programSun = gameUtils->shaderLoader->CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
programCubemap = gameUtils->shaderLoader->CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
+<<<<<<< HEAD
programSprite = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite.vert", "shaders/shader_sprite.frag");
+=======
+ programParticle = gameUtils->shaderLoader->CreateProgram("shaders/particle.vert", "shaders/particle.frag");
+
+>>>>>>> 2162820 (fire from ship)
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
loadModelToContext("./models/spaceship.obj", models::spaceshipContext);
loadModelToContext("./models/sphere.obj", models::sphereContext);
@@ -231,6 +249,7 @@ void init(GLFWwindow* window)
texture::cubemapTexture = Core::LoadCubemap(cubeFaces);
+ spaceship->createParticles();
createSuns();
createEnemies();
}