kinda works, but ship looks like it's on fire
This commit is contained in:
parent
12f2044980
commit
b3abac8b97
@ -51,7 +51,7 @@
|
|||||||
<ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid>
|
<ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>grk-cw9</RootNamespace>
|
<RootNamespace>grk-cw9</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>grk-project</ProjectName>
|
<ProjectName>grk-project</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
84
src/main.cpp
84
src/main.cpp
@ -410,50 +410,15 @@ void renderScene()
|
|||||||
|
|
||||||
drawObjectTexture(programSun, sphereContext, sunModelMatrix, glm::vec3(3.5f, 3.8f, 3.8f), sunTexture);
|
drawObjectTexture(programSun, sphereContext, sunModelMatrix, glm::vec3(3.5f, 3.8f, 3.8f), sunTexture);
|
||||||
drawObjectTexture(programSun, sphereContext, sunModelMatrix2, glm::vec3(0.9f, 0.9f, 2.0f), sunTexture);
|
drawObjectTexture(programSun, sphereContext, sunModelMatrix2, glm::vec3(0.9f, 0.9f, 2.0f), sunTexture);
|
||||||
drawSkybox(programSkybox, cubeContext, skyboxTexture);
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
|
|
||||||
bool horizontal = true, first_iteration = true;
|
|
||||||
unsigned int amount = 10;
|
|
||||||
glUseProgram(programBlur);
|
|
||||||
for (unsigned int i = 0; i < amount; i++)
|
|
||||||
{
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[horizontal]);
|
|
||||||
glUniform1i(glGetUniformLocation(programBlur, "horizontal"), horizontal);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, first_iteration ? colorBuffers[1] : pingpongColorbuffers[!horizontal]);
|
|
||||||
renderQuad();
|
|
||||||
horizontal = !horizontal;
|
|
||||||
if (first_iteration)
|
|
||||||
first_iteration = false;
|
|
||||||
}
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
|
|
||||||
glUseProgram(programBloom);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[!horizontal]);
|
|
||||||
renderQuad();
|
|
||||||
|
|
||||||
|
|
||||||
if (engineLightTimer < 50) engineLightTimer++;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lights[2].intensity = 0.00001;
|
|
||||||
lights[3].intensity = 0.00001;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
glutSwapBuffers();
|
|
||||||
//particlepart
|
//particlepart
|
||||||
glUseProgram(programParticle);
|
glUseProgram(programParticle);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
double currentTime = glutGet(GLUT_ELAPSED_TIME) / 1000.f;
|
double currentTime = glutGet(GLUT_ELAPSED_TIME) / 1000.f;
|
||||||
double delta = currentTime - lastTime;
|
double delta = currentTime - lastTime;
|
||||||
lastTime = currentTime;
|
lastTime = currentTime;
|
||||||
glm::mat4 ProjectionMatrix = perspectiveMatrix * glm::mat4(glm::mat3(cameraMatrix));
|
glm::mat4 ProjectionMatrix = perspectiveMatrix;// *glm::mat4(glm::mat3(cameraMatrix));
|
||||||
glm::mat4 ViewMatrix = cameraMatrix;
|
glm::mat4 ViewMatrix = cameraMatrix;
|
||||||
glm::vec3 CameraPosition(glm::inverse(ViewMatrix)[3]);
|
glm::vec3 CameraPosition(glm::inverse(ViewMatrix)[3]);
|
||||||
glm::mat4 ViewProjectionMatrix = ProjectionMatrix * ViewMatrix;
|
glm::mat4 ViewProjectionMatrix = ProjectionMatrix * ViewMatrix;
|
||||||
@ -465,7 +430,7 @@ void renderScene()
|
|||||||
for (int i = 0; i < newparticles; i++) {
|
for (int i = 0; i < newparticles; i++) {
|
||||||
int particleIndex = FindUnusedParticle();
|
int particleIndex = FindUnusedParticle();
|
||||||
ParticlesContainer[particleIndex].life = 100.0f;
|
ParticlesContainer[particleIndex].life = 100.0f;
|
||||||
ParticlesContainer[particleIndex].pos = glm::vec3(0, 0, 0.0f);
|
ParticlesContainer[particleIndex].pos = lights[2].position;
|
||||||
|
|
||||||
float spread = 1.5f;
|
float spread = 1.5f;
|
||||||
glm::vec3 maindir = glm::vec3(0.0f, 0.0f, 0.0f);
|
glm::vec3 maindir = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||||
@ -484,7 +449,7 @@ void renderScene()
|
|||||||
ParticlesContainer[particleIndex].b = rand() % 256;
|
ParticlesContainer[particleIndex].b = rand() % 256;
|
||||||
ParticlesContainer[particleIndex].a = (rand() % 256) / 3;
|
ParticlesContainer[particleIndex].a = (rand() % 256) / 3;
|
||||||
|
|
||||||
ParticlesContainer[particleIndex].size = (rand() % 1000) / 2000.0f + 0.1f;
|
ParticlesContainer[particleIndex].size = (rand() % 1000) / 50000.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Simulate all particles
|
// Simulate all particles
|
||||||
@ -582,6 +547,47 @@ void renderScene()
|
|||||||
glDisableVertexAttribArray(0);
|
glDisableVertexAttribArray(0);
|
||||||
glDisableVertexAttribArray(1);
|
glDisableVertexAttribArray(1);
|
||||||
glDisableVertexAttribArray(2);
|
glDisableVertexAttribArray(2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
drawSkybox(programSkybox, cubeContext, skyboxTexture);
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
|
bool horizontal = true, first_iteration = true;
|
||||||
|
unsigned int amount = 10;
|
||||||
|
glUseProgram(programBlur);
|
||||||
|
for (unsigned int i = 0; i < amount; i++)
|
||||||
|
{
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[horizontal]);
|
||||||
|
glUniform1i(glGetUniformLocation(programBlur, "horizontal"), horizontal);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, first_iteration ? colorBuffers[1] : pingpongColorbuffers[!horizontal]);
|
||||||
|
renderQuad();
|
||||||
|
horizontal = !horizontal;
|
||||||
|
if (first_iteration)
|
||||||
|
first_iteration = false;
|
||||||
|
}
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
|
glUseProgram(programBloom);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);
|
||||||
|
glActiveTexture(GL_TEXTURE1);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[!horizontal]);
|
||||||
|
renderQuad();
|
||||||
|
|
||||||
|
|
||||||
|
if (engineLightTimer < 50) engineLightTimer++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lights[2].intensity = 0.00001;
|
||||||
|
lights[3].intensity = 0.00001;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glutSwapBuffers();
|
||||||
|
//particlepart
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
|
Loading…
Reference in New Issue
Block a user