Merge branch 'master' of github.com:sippeangelo/Return-to-the-Return-of-Return-Fire-2-Returngeance
This commit is contained in:
+1
-1
Submodule assets updated: c2ee1b0198...e09ebf5a29
@@ -20,6 +20,7 @@ struct ParticleEmitter : Component
|
||||
, SpreadAngle(0)
|
||||
, LifeTime(0)
|
||||
, TimeSinceLastSpawn(100)
|
||||
, Emitting(false)
|
||||
, Color(glm::vec4(0)) { }
|
||||
|
||||
EntityID ParticleTemplate;
|
||||
@@ -32,6 +33,7 @@ struct ParticleEmitter : Component
|
||||
double LifeTime;
|
||||
bool UseGoalVelocity;
|
||||
bool Fade;
|
||||
bool Emitting;
|
||||
glm::vec3 GoalVelocity;
|
||||
std::vector<float> AngularVelocitySpectrum;
|
||||
std::vector<glm::vec3> OrientationSpectrum; //Keep? noo..
|
||||
|
||||
@@ -9,8 +9,10 @@ namespace Events
|
||||
{
|
||||
struct CreateExplosion : Event
|
||||
{
|
||||
CreateExplosion()
|
||||
: Color(glm::vec4(0)) {}
|
||||
CreateExplosion() :
|
||||
Color(glm::vec4(0)),
|
||||
UseGoalVector(false) {}
|
||||
|
||||
glm::vec3 Position;
|
||||
glm::vec4 Color;
|
||||
double LifeTime;
|
||||
@@ -20,6 +22,10 @@ namespace Events
|
||||
float Speed;
|
||||
float SpreadAngle;
|
||||
std::vector<float> ParticleScale;
|
||||
bool UseGoalVector;
|
||||
glm::vec3 GoalVelocity;
|
||||
bool Emitting;
|
||||
float SpawnFrequency;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+9
-6
@@ -93,7 +93,7 @@ Model::Model(std::shared_ptr<ResourceManager> rm, OBJ &obj)
|
||||
if (Vertices.size() > 0)
|
||||
{
|
||||
CreateTangents();
|
||||
//getSimilarVertexIndex();
|
||||
getSimilarVertexIndex();
|
||||
CreateBuffers(Vertices, Normals, TangentNormals, BiTangentNormals, TextureCoords);
|
||||
}
|
||||
else
|
||||
@@ -105,7 +105,7 @@ Model::Model(std::shared_ptr<ResourceManager> rm, OBJ &obj)
|
||||
void Model::CreateBuffers( std::vector<glm::vec3> vertices, std::vector<glm::vec3> normals, std::vector<glm::vec3> tangents, std::vector<glm::vec3> biTangents, std::vector<glm::vec2>textureCoords)
|
||||
{
|
||||
|
||||
LOG_INFO("Generating VertexBuffer");
|
||||
//LOG_INFO("Generating VertexBuffer");
|
||||
glGenBuffers(1, &VertexBuffer);
|
||||
if (vertices.size() > 0)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ void Model::CreateBuffers( std::vector<glm::vec3> vertices, std::vector<glm::vec
|
||||
LOG_WARNING("Created empty vertex buffer!");
|
||||
}
|
||||
|
||||
LOG_INFO("Generating NormalBuffer");
|
||||
//LOG_INFO("Generating NormalBuffer");
|
||||
glGenBuffers(1, &NormalBuffer);
|
||||
if (normals.size() > 0)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ void Model::CreateBuffers( std::vector<glm::vec3> vertices, std::vector<glm::vec
|
||||
LOG_WARNING("Created empty normal buffer!");
|
||||
}
|
||||
|
||||
LOG_INFO("Generating TangentNormalsBuffer");
|
||||
//LOG_INFO("Generating TangentNormalsBuffer");
|
||||
glGenBuffers(1, &TangentNormalsBuffer);
|
||||
if (tangents.size() > 0)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ void Model::CreateBuffers( std::vector<glm::vec3> vertices, std::vector<glm::vec
|
||||
LOG_WARNING("Created empty tangent buffer!");
|
||||
}
|
||||
|
||||
LOG_INFO("Generating BiTangentNormalsBuffer");
|
||||
//LOG_INFO("Generating BiTangentNormalsBuffer");
|
||||
glGenBuffers(1, &BiTangentNormalsBuffer);
|
||||
if (biTangents.size() > 0)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ void Model::CreateBuffers( std::vector<glm::vec3> vertices, std::vector<glm::vec
|
||||
}
|
||||
|
||||
|
||||
LOG_INFO("Generating textureCoordBuffer");
|
||||
//LOG_INFO("Generating textureCoordBuffer");
|
||||
glGenBuffers(1, &TextureCoordBuffer);
|
||||
if (textureCoords.size() > 0)
|
||||
{
|
||||
@@ -223,6 +223,8 @@ void Model::getSimilarVertexIndex()
|
||||
{
|
||||
glm::vec3 tempNormal, tempTangent, tempBiTangent;
|
||||
|
||||
if(glm::dot(Normals[i], Normals[t]) > 0)
|
||||
{
|
||||
tempNormal = Normals[i] + Normals[t];
|
||||
tempTangent = TangentNormals[i] + TangentNormals[t];
|
||||
tempBiTangent = BiTangentNormals[i] + BiTangentNormals[t];
|
||||
@@ -239,6 +241,7 @@ void Model::getSimilarVertexIndex()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Model::CreateTangents()
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ bool OBJ::LoadFromFile(std::string filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_INFO("Parsing .obj \"%s\"", m_Path.string().c_str());
|
||||
//LOG_INFO("Parsing .obj \"%s\"", m_Path.string().c_str());
|
||||
|
||||
std::string line;
|
||||
while (std::getline(file, line))
|
||||
@@ -121,7 +121,7 @@ void OBJ::ParseMaterial()
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("Parsing .mtl \"%s\"", m_MaterialPath.string().c_str());
|
||||
//LOG_INFO("Parsing .mtl \"%s\"", m_MaterialPath.string().c_str());
|
||||
|
||||
std::string currentMaterialName;
|
||||
MaterialInfo* currentMaterial = nullptr;
|
||||
@@ -144,7 +144,7 @@ void OBJ::ParseMaterial()
|
||||
{
|
||||
MaterialInfo mat;
|
||||
ss >> currentMaterialName;
|
||||
LOG_INFO("Parsing material %s", currentMaterialName.c_str());
|
||||
//LOG_INFO("Parsing material %s", currentMaterialName.c_str());
|
||||
Materials[currentMaterialName] = mat;
|
||||
currentMaterial = &Materials[currentMaterialName];
|
||||
continue;
|
||||
|
||||
+95
-68
@@ -22,7 +22,7 @@ Renderer::Renderer(std::shared_ptr<::ResourceManager> resourceManager)
|
||||
LAtt = 0.0f;
|
||||
QAtt = 3.0f;
|
||||
m_ShadowMapRes = 1;
|
||||
m_SunPosition = glm::vec3(0.f, 1.0f, 0.5f);
|
||||
m_SunPosition = glm::vec3(0.f, 1.0f, 0.7f);
|
||||
m_SunTarget = glm::vec3(0, 0, 0);
|
||||
m_SunProjection_height = glm::vec2(-40.f, 40.f);
|
||||
m_SunProjection_width = glm::vec2(-40.f, 40.f);
|
||||
@@ -126,6 +126,7 @@ void Renderer::LoadContent()
|
||||
m_SunPassProgram.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SunPass.vert.glsl")));
|
||||
m_SunPassProgram.AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SunPass.frag.glsl")));
|
||||
m_SunPassProgram.Compile();
|
||||
glBindFragDataLocation(m_SunPassProgram.GetHandle(), 0, "frag_Light");
|
||||
m_SunPassProgram.Link();
|
||||
|
||||
m_ForwardRendering.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardRendering.vert.glsl")));
|
||||
@@ -142,7 +143,6 @@ void Renderer::LoadContent()
|
||||
m_FirstPassProgram.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Vertex.glsl")));
|
||||
m_FirstPassProgram.AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Fragment.glsl")));
|
||||
m_FirstPassProgram.Compile();
|
||||
|
||||
glBindFragDataLocation(m_FirstPassProgram.GetHandle(), 0, "frag_Diffuse");
|
||||
glBindFragDataLocation(m_FirstPassProgram.GetHandle(), 1, "frag_Position");
|
||||
glBindFragDataLocation(m_FirstPassProgram.GetHandle(), 2, "frag_Normal");
|
||||
@@ -151,6 +151,7 @@ void Renderer::LoadContent()
|
||||
m_SecondPassProgram.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Vertex2.glsl")));
|
||||
m_SecondPassProgram.AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Fragment2.glsl")));
|
||||
m_SecondPassProgram.Compile();
|
||||
glBindFragDataLocation(m_SecondPassProgram.GetHandle(), 0, "frag_Light");
|
||||
m_SecondPassProgram.Link();
|
||||
|
||||
m_SecondPassProgram_Debug.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Vertex2.glsl")));
|
||||
@@ -161,6 +162,7 @@ void Renderer::LoadContent()
|
||||
m_FinalPassProgram.AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FinalPass.vert.glsl")));
|
||||
m_FinalPassProgram.AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FinalPass.frag.glsl")));
|
||||
m_FinalPassProgram.Compile();
|
||||
glBindFragDataLocation(m_FinalPassProgram.GetHandle(), 0, "frag_Diffuse");
|
||||
m_FinalPassProgram.Link();
|
||||
m_ScreenQuad = CreateQuad();
|
||||
CreateShadowMap(m_ShadowMapRes);
|
||||
@@ -269,6 +271,7 @@ void Renderer::Draw(double dt)
|
||||
|
||||
void Renderer::DrawFrame(RenderQueuePair &rq)
|
||||
{
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
glScissor(m_Scissor.X, m_Height - m_Scissor.Y - m_Scissor.Height, m_Scissor.Width, m_Scissor.Height);
|
||||
@@ -386,71 +389,68 @@ void Renderer::DrawWorld(RenderQueuePair &rq)
|
||||
rq.Forward.Jobs.sort(Renderer::DepthSort);
|
||||
|
||||
//DrawShadowMap(rq.Deferred);
|
||||
|
||||
/*
|
||||
Base pass
|
||||
*/
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbBasePass);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbBasePass);
|
||||
glViewport(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
glScissor(m_Scissor.X, m_Height - m_Scissor.Y - m_Scissor.Height, m_Scissor.Width, m_Scissor.Height);
|
||||
//glViewport(0, 0, m_Width, m_Height);
|
||||
|
||||
// Clear G-buffer
|
||||
GLenum windowBuffClear[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
||||
glDrawBuffers(4, windowBuffClear);
|
||||
glClearColor(115.f / 255, 192.f / 255, 255.f / 255, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Execute the first render stage which will fill out the internal buffers with data(??)
|
||||
m_FirstPassProgram.Bind();
|
||||
GLenum windowBuffOpaque[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
||||
glDrawBuffers(4, windowBuffOpaque);
|
||||
|
||||
glCullFace(GL_BACK);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
DrawSkybox();
|
||||
//DrawSkybox();
|
||||
|
||||
DrawFBOScene(rq.Deferred);
|
||||
|
||||
/*
|
||||
Lighting pass
|
||||
*/
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbLightingPass);
|
||||
//glBindFramebuffer(GL_FRAMEBUFFER, m_fbBasePass);
|
||||
glViewport(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
glScissor(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
GLenum lightingPassAttachments[] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDrawBuffers(1, lightingPassAttachments);
|
||||
glScissor(m_Scissor.X, m_Height - m_Scissor.Y - m_Scissor.Height, m_Scissor.Width, m_Scissor.Height);
|
||||
|
||||
|
||||
glCullFace(GL_FRONT);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
m_SecondPassProgram.Bind();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fPositionTexture);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fNormalsTexture);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fSpecularTexture);
|
||||
|
||||
glCullFace(GL_FRONT);
|
||||
DrawLightScene(rq.Deferred);
|
||||
glCullFace(GL_BACK);
|
||||
DrawSunLightScene();
|
||||
|
||||
/*
|
||||
Final pass
|
||||
*/
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
//glViewport(m_Viewport.X, m_Viewport.Y, m_Viewport.Width, m_Viewport.Height);
|
||||
glViewport(0, 0, m_Width, m_Height);
|
||||
//glScissor(0, 0, m_Width, m_Height);
|
||||
glScissor(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbFinalPass);
|
||||
glViewport(0, 0, m_Width, m_Height);
|
||||
glScissor(0, 0, m_Width, m_Height);
|
||||
//glScissor(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
|
||||
|
||||
|
||||
m_FinalPassProgram.Bind();
|
||||
|
||||
// Ambient light
|
||||
glUniform3fv(glGetUniformLocation(m_FinalPassProgram.GetHandle(), "La"), 1, glm::value_ptr(glm::vec3(0.7f)));
|
||||
glUniform1f(glGetUniformLocation(m_FinalPassProgram.GetHandle(), "Gamma"), Gamma);
|
||||
glUniform3fv(glGetUniformLocation(m_FinalPassProgram.GetHandle(), "La"), 1, glm::value_ptr(glm::vec3(1.0f)));
|
||||
//glUniform1f(glGetUniformLocation(m_FinalPassProgram.GetHandle(), "Gamma"), Gamma);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fDiffuseTexture);
|
||||
@@ -470,25 +470,23 @@ void Renderer::DrawWorld(RenderQueuePair &rq)
|
||||
|
||||
void Renderer::ForwardRendering(RenderQueue &rq)
|
||||
{
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbBasePass);
|
||||
|
||||
glViewport(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
glScissor(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
|
||||
// Clear G-buffer
|
||||
GLenum attachments[] = { GL_COLOR_ATTACHMENT0, GL_NONE , GL_NONE , GL_NONE };
|
||||
glDrawBuffers(4, attachments);
|
||||
//glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
//glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
//glBindFramebuffer(GL_FRAMEBUFFER, m_fbBasePass);
|
||||
glViewport(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
glScissor(m_Viewport.X, m_Height - m_Viewport.Y - m_Viewport.Height, m_Viewport.Width, m_Viewport.Height);
|
||||
|
||||
// Clear G-buffer
|
||||
//GLenum attachments[] = { GL_COLOR_ATTACHMENT0, GL_NONE , GL_NONE, GL_NONE };
|
||||
//glDrawBuffers(4, attachments);
|
||||
//glClear(GL_COLOR_BUFFER_BIT);
|
||||
//glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
glm::mat4 cameraProjection = m_Camera->ProjectionMatrix((float)m_Viewport.Width / m_Viewport.Height);
|
||||
glm::mat4 cameraMatrix = cameraProjection * m_Camera->ViewMatrix();
|
||||
glm::mat4 MVP;
|
||||
@@ -508,12 +506,14 @@ void Renderer::ForwardRendering(RenderQueue &rq)
|
||||
glUniformMatrix4fv(glGetUniformLocation(ShaderProgramHandle, "V"), 1, GL_FALSE, glm::value_ptr(m_Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(ShaderProgramHandle, "P"), 1, GL_FALSE, glm::value_ptr(cameraProjection));
|
||||
glUniform4fv(glGetUniformLocation(ShaderProgramHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||
glUniform3fv(glGetUniformLocation(ShaderProgramHandle, "La"), 1, glm::value_ptr(glm::vec3(1.0f)));
|
||||
glUniform3fv(glGetUniformLocation(ShaderProgramHandle, "directionToSun"), 1, glm::value_ptr(glm::normalize(m_SunPosition)));
|
||||
|
||||
glBindVertexArray(modelJob->VAO);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture);
|
||||
/*if (modelJob->NormalTexture != 0)
|
||||
if (modelJob->NormalTexture != 0)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, modelJob->NormalTexture);
|
||||
@@ -522,7 +522,7 @@ void Renderer::ForwardRendering(RenderQueue &rq)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_2D, modelJob->SpecularTexture);
|
||||
}*/
|
||||
}
|
||||
glDrawArrays(GL_TRIANGLES, modelJob->StartIndex, modelJob->EndIndex - modelJob->StartIndex + 1);
|
||||
|
||||
continue;
|
||||
@@ -555,7 +555,8 @@ void Renderer::ForwardRendering(RenderQueue &rq)
|
||||
/*
|
||||
Final pass
|
||||
*/
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(0, 0, m_Width, m_Height);
|
||||
glScissor(0, 0, m_Width, m_Height);
|
||||
|
||||
@@ -571,7 +572,9 @@ void Renderer::ForwardRendering(RenderQueue &rq)
|
||||
//glUniform1f(glGetUniformLocation(ShaderProgramHandle, "Gamma"), Gamma);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fDiffuseTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fFinalDiffuseTexture);
|
||||
// glActiveTexture(GL_TEXTURE1);
|
||||
// glBindTexture(GL_TEXTURE_2D, m_fLightingTexture);
|
||||
|
||||
glCullFace(GL_BACK);
|
||||
glBindVertexArray(m_ScreenQuad);
|
||||
@@ -947,7 +950,7 @@ void Renderer::FrameBufferTextures()
|
||||
//Generate and bind diffuse texture
|
||||
glGenTextures(1, &m_fDiffuseTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fDiffuseTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
@@ -999,6 +1002,9 @@ void Renderer::FrameBufferTextures()
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, m_fSpecularTexture, 0);
|
||||
//glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, m_fShadowTexture, 0);
|
||||
|
||||
GLenum FirstPass[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
||||
glDrawBuffers(4, FirstPass);
|
||||
|
||||
GLenum fbStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(fbStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
@@ -1006,12 +1012,37 @@ void Renderer::FrameBufferTextures()
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
m_fbFinalPass = 0;
|
||||
glGenFramebuffers(1, &m_fbFinalPass);
|
||||
glGenTextures(1, &m_fFinalDiffuseTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fFinalDiffuseTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbFinalPass);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_fFinalDiffuseTexture, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_fDepthBuffer);
|
||||
|
||||
GLenum FinalPassAttachments[] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDrawBuffers(1, FinalPassAttachments);
|
||||
|
||||
fbStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(fbStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
LOG_ERROR("DeferredLighting:Init: m_fbLightingPass incomplete: 0x%x\n", fbStatus);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
|
||||
m_fbLightingPass = 0;
|
||||
glGenFramebuffers(1, &m_fbLightingPass);
|
||||
|
||||
glGenTextures(1, &m_fLightingTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fLightingTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
@@ -1020,6 +1051,9 @@ void Renderer::FrameBufferTextures()
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbLightingPass);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_fLightingTexture, 0);
|
||||
|
||||
GLenum lightingPassAttachments[] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDrawBuffers(1, lightingPassAttachments);
|
||||
|
||||
fbStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if(fbStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
@@ -1268,12 +1302,7 @@ void Renderer::DrawFBOScene(RenderQueue &rq)
|
||||
|
||||
void Renderer::DrawLightScene(RenderQueue &rq)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation (GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE,GL_ONE);
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDepthMask (GL_FALSE);
|
||||
glBindVertexArray(m_sphereModel->VAO);
|
||||
|
||||
glm::mat4 cameraProjection = m_Camera->ProjectionMatrix((float)m_Viewport.Width / m_Viewport.Height);
|
||||
@@ -1284,6 +1313,13 @@ void Renderer::DrawLightScene(RenderQueue &rq)
|
||||
m_SecondPassProgram.Bind();
|
||||
GLuint ShaderProgramHandle = m_SecondPassProgram.GetHandle();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fPositionTexture);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fNormalsTexture);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fSpecularTexture);
|
||||
|
||||
for (auto &light : Lights)
|
||||
{
|
||||
MVP = cameraMatrix * light.SphereModelMatrix;
|
||||
@@ -1306,21 +1342,10 @@ void Renderer::DrawLightScene(RenderQueue &rq)
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_sphereModel->Vertices.size());
|
||||
};
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void Renderer::DrawSunLightScene()
|
||||
{
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE,GL_ONE);
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDepthMask (GL_FALSE);
|
||||
//glBindVertexArray(m_sphereModel->VAO);
|
||||
|
||||
glm::mat4 cameraProjection = m_Camera->ProjectionMatrix((float)m_Viewport.Width / m_Viewport.Height);
|
||||
@@ -1330,6 +1355,12 @@ void Renderer::DrawSunLightScene()
|
||||
m_SunPassProgram.Bind();
|
||||
GLuint ShaderProgramHandle = m_SunPassProgram.GetHandle();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fPositionTexture);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fNormalsTexture);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, m_fSpecularTexture);
|
||||
|
||||
glUniform2fv(glGetUniformLocation(ShaderProgramHandle, "ViewportSize"), 1, glm::value_ptr(glm::vec2(m_Width, m_Height)));
|
||||
glUniformMatrix4fv(glGetUniformLocation(ShaderProgramHandle, "MVP"), 1, GL_FALSE, glm::value_ptr(MVP));
|
||||
@@ -1341,10 +1372,6 @@ void Renderer::DrawSunLightScene()
|
||||
glBindVertexArray(m_ScreenQuad);
|
||||
glEnableVertexAttribArray(0);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthMask (GL_TRUE);
|
||||
glDisable (GL_BLEND);
|
||||
}
|
||||
|
||||
void Renderer::SetSphereModel( Model* _model )
|
||||
|
||||
@@ -167,6 +167,10 @@ private:
|
||||
GLuint m_ShadowFrameBuffer;
|
||||
GLuint m_ShadowDepthTexture;
|
||||
|
||||
|
||||
GLuint m_fbFinalPass;
|
||||
GLuint m_fFinalDiffuseTexture;
|
||||
|
||||
GLuint m_fbBasePass;
|
||||
GLuint m_fDiffuseTexture;
|
||||
GLuint m_fPositionTexture;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#version 430
|
||||
|
||||
//uniform vec3 La;
|
||||
|
||||
layout (binding=0) uniform sampler2D DiffuseTexture;
|
||||
|
||||
@@ -15,11 +14,11 @@ out vec4 FragmentColor;
|
||||
void main()
|
||||
{
|
||||
vec4 DiffuseTexel = texture(DiffuseTexture, Input.TextureCoord);
|
||||
//vec4 LightingTexel = texture(LightingTexture, Input.TextureCoord);
|
||||
|
||||
//FragmentColor = LightingTexel + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0);
|
||||
//FragmentColor = DiffuseTexel;
|
||||
|
||||
FragmentColor = DiffuseTexel;
|
||||
//FragmentColor = DiffuseTexel * (vec4(La, 0.0) + vec4(LightingTexel.rgb, 0.0)) + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0);
|
||||
//FragmentColor = vec4(pow(_FragmentColor.rgb, vec3(1.0 / Gamma)), _FragmentColor.a);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#version 430
|
||||
//Dicksdickdickdickssssss
|
||||
|
||||
uniform vec3 La;
|
||||
uniform float Gamma;
|
||||
|
||||
layout (binding=0) uniform sampler2D DiffuseTexture;
|
||||
layout (binding=1) uniform sampler2D LightingTexture;
|
||||
@@ -12,7 +12,7 @@ in VertexData
|
||||
vec2 TextureCoord;
|
||||
} Input;
|
||||
|
||||
out vec4 FragmentColor;
|
||||
out vec4 frag_Diffuse;
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -21,7 +21,12 @@ void main()
|
||||
|
||||
//FragmentColor = LightingTexel + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0);
|
||||
//FragmentColor = DiffuseTexel;
|
||||
//FragmentColor = DiffuseTexel;
|
||||
//frag_Diffuse = vec4(LightingTexel.rgb, 0.0);
|
||||
|
||||
//frag_Diffuse = DiffuseTexel * ((vec4(LightingTexel.rgb, 0.0) + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0)));
|
||||
frag_Diffuse = DiffuseTexel * (vec4(La, 0.0) * (vec4(LightingTexel.rgb, 0.0) + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0)));
|
||||
//frag_Diffuse = LightingTexel;
|
||||
|
||||
FragmentColor = DiffuseTexel * (vec4(La, 0.0) + vec4(LightingTexel.rgb, 0.0)) + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0);
|
||||
//FragmentColor = vec4(pow(_FragmentColor.rgb, vec3(1.0 / Gamma)), _FragmentColor.a);
|
||||
}
|
||||
@@ -1,8 +1,23 @@
|
||||
#version 430
|
||||
|
||||
uniform vec4 Color;
|
||||
uniform vec3 La;
|
||||
uniform vec3 directionToSun;
|
||||
uniform mat4 V;
|
||||
|
||||
layout(binding=0) uniform sampler2D texture0;
|
||||
layout(binding=1) uniform sampler2D PositionTexture;
|
||||
layout(binding=2) uniform sampler2D NormalsTexture;
|
||||
layout(binding=3) uniform sampler2D SpecularTexture;
|
||||
|
||||
const vec3 ks = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 kd = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 ka = vec3(1.0, 1.0, 1.0);
|
||||
const float kshine = 1.0;
|
||||
const vec3 SunDiffuseLight = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 SunSpecularLight = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 SunPos = directionToSun*vec3(100);
|
||||
const float specularExponent = 100;
|
||||
|
||||
in VertexData {
|
||||
vec3 Position;
|
||||
@@ -12,9 +27,34 @@ in VertexData {
|
||||
|
||||
out vec4 frag_Diffuse;
|
||||
|
||||
vec4 phong(vec3 position, vec3 normal, vec3 specular)
|
||||
{
|
||||
|
||||
//Diffuse Sunlight
|
||||
vec3 directionToLight = normalize(vec3(V * vec4(directionToSun, 0.0)));
|
||||
float dotProdLight = dot(directionToLight, normal);
|
||||
dotProdLight = max(dotProdLight, 0.0);
|
||||
vec3 sId = kd * SunDiffuseLight * dotProdLight;
|
||||
|
||||
//Specular Sunlight
|
||||
vec3 surfaceToViewer = normalize(-position);
|
||||
vec3 halfWay = normalize(surfaceToViewer + directionToLight);
|
||||
float dotSpecular = max(dot(halfWay, normal), 0.0);
|
||||
float specularFactorSun = pow(dotSpecular, specularExponent);
|
||||
vec3 sIs = specular.r * SunSpecularLight * specularFactorSun;
|
||||
|
||||
return vec4((sId), sIs.r);
|
||||
}
|
||||
|
||||
void main() {
|
||||
// Texture
|
||||
vec4 texel = texture(texture0, Input.TextureCoord);
|
||||
vec4 PositionTexel = texture(PositionTexture, Input.TextureCoord);
|
||||
vec4 NormalTexel = texture(NormalsTexture, Input.TextureCoord);
|
||||
vec4 SpecularTexel = texture(SpecularTexture, Input.TextureCoord);
|
||||
|
||||
|
||||
frag_Diffuse = texel * Color;
|
||||
//frag_Diffuse = texel * Color * (vec4(La, 0.0) * phong(vec3(PositionTexel), vec3(NormalTexel), vec3(SpecularTexel)));
|
||||
//frag_Diffuse = DiffuseTexel * (vec4(La, 0.0) * (vec4(LightingTexel.rgb, 0.0) + vec4(LightingTexel.a, LightingTexel.a, LightingTexel.a, 0.0)));
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ const vec3 ks = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 kd = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 ka = vec3(1.0, 1.0, 1.0);
|
||||
const float kshine = 1.0;
|
||||
const vec3 La = vec3(0.3, 0.3, 0.3);
|
||||
|
||||
|
||||
in VertexData
|
||||
@@ -32,7 +33,7 @@ in VertexData
|
||||
vec2 TextureCoord;
|
||||
} Input;
|
||||
|
||||
out vec4 FragColor;
|
||||
out vec4 frag_Light;
|
||||
|
||||
vec4 phong(vec3 position, vec3 normal, vec3 specular)
|
||||
{
|
||||
@@ -67,6 +68,8 @@ void main()
|
||||
vec4 NormalTexel = texture(NormalsTexture, TextureCoord);
|
||||
vec4 SpecularTexel = texture(SpecularTexture, TextureCoord);
|
||||
|
||||
FragColor = phong(vec3(PositionTexel), vec3(NormalTexel), vec3(SpecularTexel));
|
||||
frag_Light = phong(vec3(PositionTexel), vec3(NormalTexel), vec3(SpecularTexel));
|
||||
//FragColor = DiffuseTexel * vec4(1.0/La, 0.0) * (vec4(La, 0.0) + vec4(LightTexel.rgb, 0.0) + vec4(LightTexel.a, LightTexel.a, LightTexel.a, 0.0));
|
||||
//FragColor = DiffuseTexel * (vec4(La, 0.0) + vec4(LightTexel.rgb, 0.0)) + vec4(LightTexel.a, LightTexel.a, LightTexel.a, 0.0);
|
||||
//FragColor = NormalTexel;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ layout (binding=0) uniform sampler2D PositionTexture;
|
||||
layout (binding=1) uniform sampler2D NormalsTexture;
|
||||
layout (binding=2) uniform sampler2D SpecularTexture;
|
||||
|
||||
|
||||
uniform vec2 ViewportSize;
|
||||
uniform mat4 MVP;
|
||||
uniform mat4 M;
|
||||
@@ -16,10 +17,12 @@ const vec3 ks = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 kd = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 ka = vec3(1.0, 1.0, 1.0);
|
||||
const float kshine = 1.0;
|
||||
const vec3 SunDiffuseLight = vec3(0.3, 0.3, 0.3);
|
||||
const vec3 SunDiffuseLight = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 SunSpecularLight = vec3(1.0, 1.0, 1.0);
|
||||
const vec3 SunPos = directionToSun*vec3(100);
|
||||
const float specularExponent = 5;
|
||||
const float specularExponent = 100;
|
||||
const vec3 La = vec3(0.3, 0.3, 0.3);
|
||||
|
||||
|
||||
|
||||
in VertexData
|
||||
@@ -28,7 +31,7 @@ in VertexData
|
||||
vec2 TextureCoord;
|
||||
} Input;
|
||||
|
||||
out vec4 FragColor;
|
||||
out vec4 frag_Light;
|
||||
|
||||
vec4 phong(vec3 position, vec3 normal, vec3 specular)
|
||||
{
|
||||
@@ -46,7 +49,7 @@ vec4 phong(vec3 position, vec3 normal, vec3 specular)
|
||||
float specularFactorSun = pow(dotSpecular, specularExponent);
|
||||
vec3 sIs = specular.r * SunSpecularLight * specularFactorSun;
|
||||
|
||||
return vec4((sId), sIs.r);
|
||||
return vec4((sId + La), sIs.r);
|
||||
}
|
||||
|
||||
void main()
|
||||
@@ -56,6 +59,8 @@ void main()
|
||||
vec4 NormalTexel = texture(NormalsTexture, TextureCoord);
|
||||
vec4 SpecularTexel = texture(SpecularTexture, TextureCoord);
|
||||
|
||||
FragColor = phong(vec3(PositionTexel), vec3(normalize(NormalTexel)), vec3(SpecularTexel));
|
||||
|
||||
frag_Light = phong(vec3(PositionTexel), vec3(NormalTexel), vec3(SpecularTexel));
|
||||
//FragColor = DiffuseTexel * (vec4(La, 0.0) * (vec4(LightTexel.rgb, 0.0) + vec4(LightTexel.a, LightTexel.a, LightTexel.a, 0.0)));
|
||||
//FragColor = NormalTexel;
|
||||
}
|
||||
@@ -49,11 +49,15 @@ void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
{
|
||||
emitterComponent->TimeSinceLastSpawn += dt;
|
||||
auto emitterTransformComponent = m_World->GetComponent<Components::Transform>(entity);
|
||||
// if(emitterComponent->TimeSinceLastSpawn > emitterComponent->SpawnFrequency)
|
||||
// {
|
||||
// SpawnParticles(entity);
|
||||
// emitterComponent->TimeSinceLastSpawn = 0;
|
||||
// }
|
||||
if(emitterComponent->Emitting)
|
||||
{
|
||||
if(emitterComponent->TimeSinceLastSpawn > emitterComponent->SpawnFrequency)
|
||||
{
|
||||
SpawnParticles(entity);
|
||||
emitterComponent->TimeSinceLastSpawn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
auto particleComponent = m_World->GetComponent<Components::Particle>(entity);
|
||||
@@ -242,10 +246,17 @@ bool Systems::ParticleSystem::CreateExplosion(const Events::CreateExplosion &e)
|
||||
emitter->SpawnCount = e.ParticlesToSpawn;
|
||||
emitter->Speed = e.Speed;
|
||||
emitter->SpreadAngle = e.SpreadAngle;
|
||||
emitter->Emitting = e.Emitting;
|
||||
emitter->SpawnFrequency = e.SpawnFrequency;
|
||||
//emitter->ScaleSpectrum.push_back(glm::vec3(e.ParticleScale));
|
||||
emitter->SpawnFrequency = e.LifeTime + 20; //temp
|
||||
emitter->Fade = true;
|
||||
emitter->Color = e.Color;
|
||||
if(e.UseGoalVector)
|
||||
{
|
||||
emitter->UseGoalVelocity = e.UseGoalVector;
|
||||
emitter->GoalVelocity = e.GoalVelocity;
|
||||
}
|
||||
std::vector<glm::vec3> scale;
|
||||
scale.push_back(glm::vec3(e.ParticleScale[0]));
|
||||
if(e.ParticleScale.size() >= 2)
|
||||
|
||||
@@ -11,7 +11,7 @@ void Systems::SoundSystem::Initialize()
|
||||
|
||||
m_TransformSystem = m_World->GetSystem<Systems::TransformSystem>();
|
||||
FMOD_System_Create(&m_System);
|
||||
FMOD_RESULT result = FMOD_System_Init(m_System, 32, FMOD_INIT_3D_RIGHTHANDED, 0);
|
||||
FMOD_RESULT result = FMOD_System_Init(m_System, 32, FMOD_INIT_3D_RIGHTHANDED | FMOD_INIT_ENABLE_PROFILE, 0);
|
||||
if(result != FMOD_OK)
|
||||
{
|
||||
LOG_ERROR("Did initialized load FMOD correctly");
|
||||
@@ -59,16 +59,20 @@ void Systems::SoundSystem::Update(double dt)
|
||||
|
||||
}
|
||||
//LOG_INFO("Antal emitters i listan: %i", m_Channels.size());
|
||||
for (auto channel : m_Channels)
|
||||
|
||||
for(it = m_Channels.begin(); it != m_Channels.end();)
|
||||
{
|
||||
FMOD_BOOL isPlaying = false;
|
||||
FMOD_Channel_IsPlaying(channel.second, &isPlaying);
|
||||
FMOD_Channel_IsPlaying(it->second, &isPlaying);
|
||||
if(!isPlaying)
|
||||
{
|
||||
m_Channels.erase(channel.first);
|
||||
it = m_Channels.erase(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Systems::SoundSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
|
||||
@@ -102,12 +102,14 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit
|
||||
e.LifeTime = 1.5;
|
||||
e.ParticleScale.push_back(0.6);
|
||||
e.ParticleScale.push_back(1.8);
|
||||
e.ParticlesToSpawn = 5;
|
||||
e.ParticlesToSpawn = 1;
|
||||
e.Position = cloneTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 1.7;
|
||||
e.SpreadAngle = glm::pi<float>()/10;
|
||||
e.SpreadAngle = glm::pi<float>()/100;
|
||||
e.spritePath = "Textures/Sprites/Smoke1.png";
|
||||
e.Emitting = true;
|
||||
e.SpawnFrequency = 0.2;
|
||||
e.Color = glm::vec4(0.6,0.6,0.6,1);
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
@@ -192,36 +194,65 @@ bool Systems::TankSteeringSystem::OnCollision(const Events::Collision &e)
|
||||
//auto otherTransform = m_World->GetComponent<Components::Transform>(otherEntity);
|
||||
|
||||
{
|
||||
// Events::CreateExplosion e;
|
||||
// e.LifeTime = 3;
|
||||
// e.ParticleScale.push_back(8);
|
||||
// e.ParticlesToSpawn = 20;
|
||||
// e.Position = shellTransform->Position;
|
||||
// e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
// e.Speed = 3;
|
||||
// e.SpreadAngle = glm::pi<float>();
|
||||
// e.spritePath = "Textures/Sprites/Smoke1.png";
|
||||
// e.Color = glm::vec4(0.6,0.6,0.6,1);
|
||||
// EventBroker->Publish(e);
|
||||
// e.LifeTime = 0.7;
|
||||
// e.ParticleScale.push_back(12);
|
||||
// e.ParticlesToSpawn = 10;
|
||||
// e.Position = shellTransform->Position;
|
||||
// e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
// e.Speed = 17;
|
||||
// e.SpreadAngle = glm::pi<float>();
|
||||
// e.spritePath = "Textures/Sprites/Fire.png";
|
||||
// EventBroker->Publish(e);
|
||||
// e.LifeTime = 0.2;
|
||||
// e.ParticleScale.push_back(1);
|
||||
// e.ParticleScale.push_back(15);
|
||||
// e.ParticlesToSpawn = 5;
|
||||
// e.Position = shellTransform->Position;
|
||||
// e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
// e.Speed = 6;
|
||||
// e.SpreadAngle = glm::pi<float>();
|
||||
// e.spritePath = "Textures/Sprites/Blast1.png";
|
||||
// e.Color = glm::vec4(2, 2, 2, 0.2);
|
||||
// EventBroker->Publish(e);
|
||||
|
||||
Events::CreateExplosion e;
|
||||
e.LifeTime = 3;
|
||||
e.ParticleScale.push_back(8);
|
||||
e.LifeTime = 1.5;
|
||||
e.ParticleScale.push_back(1);
|
||||
e.ParticleScale.push_back(6);
|
||||
e.ParticlesToSpawn = 20;
|
||||
e.Position = shellTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 3;
|
||||
e.SpreadAngle = glm::pi<float>();
|
||||
e.spritePath = "Textures/Sprites/Smoke1.png";
|
||||
e.Color = glm::vec4(0.6,0.6,0.6,1);
|
||||
e.SpreadAngle = glm::radians<float>(180) / 4;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::radians<float>(90), glm::vec3(1,0,0));
|
||||
e.UseGoalVector = true;
|
||||
e.GoalVelocity = glm::vec3(0,-12,0);
|
||||
e.Speed = 12;
|
||||
e.spritePath = "Textures/Sprites/Splash.png";
|
||||
e.Color = glm::vec4(5.f,5.f,5.f,1);
|
||||
|
||||
EventBroker->Publish(e);
|
||||
e.LifeTime = 0.7;
|
||||
e.ParticleScale.push_back(12);
|
||||
e.ParticlesToSpawn = 10;
|
||||
e.Position = shellTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 17;
|
||||
e.SpreadAngle = glm::pi<float>();
|
||||
e.spritePath = "Textures/Sprites/Fire.png";
|
||||
EventBroker->Publish(e);
|
||||
e.LifeTime = 0.2;
|
||||
e.LifeTime = 1.5;
|
||||
e.ParticleScale.push_back(1);
|
||||
e.ParticleScale.push_back(15);
|
||||
e.ParticlesToSpawn = 5;
|
||||
e.ParticleScale.push_back(6);
|
||||
e.ParticlesToSpawn = 20;
|
||||
e.Position = shellTransform->Position;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(1,0,0));
|
||||
e.Speed = 6;
|
||||
e.SpreadAngle = glm::pi<float>();
|
||||
e.spritePath = "Textures/Sprites/Blast1.png";
|
||||
e.Color = glm::vec4(2, 2, 2, 0.2);
|
||||
e.SpreadAngle = glm::radians<float>(180)/ 4;
|
||||
e.RelativeUpOrientation = glm::angleAxis(glm::radians<float>(90), glm::vec3(1,0,0));
|
||||
e.UseGoalVector = true;
|
||||
e.GoalVelocity = glm::vec3(0,-12,0);
|
||||
e.Speed = 12;
|
||||
e.spritePath = "Textures/Sprites/Splash.png";
|
||||
e.Color = glm::vec4(1.f,1.f,1.f,1);
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user