add: flame colour change on engine upgrade
This commit is contained in:
parent
6c511bd695
commit
90d60a0e48
13
README.md
13
README.md
@ -4,10 +4,10 @@ Szymon Szczubkowski, Agnieszka Wyrosławska
|
||||
## Zaimplementowane technologie
|
||||
|
||||
### Physically based rendering
|
||||
W projekcie zaimplementowane jest oświetlenie PBR. Wspiera ono albedo, roughness, metallic, ambient occlusion oraz **normal** mapy.
|
||||
W projekcie zaimplementowane jest oświetlenie **PBR**. Wspiera ono albedo, roughness, metallic, ambient occlusion oraz **normal** mapy.
|
||||
|
||||
### Normal mapping
|
||||
Razem z PBR zaimplementowane zostało wsparcie dla normal maps.
|
||||
Razem z **PBR** zaimplementowane zostało wsparcie dla **normal maps**.
|
||||
|
||||
|
||||
![picture](https://i.imgur.com/VJP72bY.png)
|
||||
@ -19,7 +19,7 @@ W tle widoczny jest skybox kosmosu.
|
||||
|
||||
|
||||
### Billboarding
|
||||
Na potrzeby wyświetlania cząsteczek ognia zaimplementowany został billboarding.
|
||||
Na potrzeby wyświetlania cząsteczek ognia zaimplementowany został **billboarding**. Aby osiągnąć bardziej realistyczny efekt płonącego ognia wykorzystana została technika **blending**u.
|
||||
|
||||
![picture](https://i.gyazo.com/d00aba38d49f6179861f68ec464b4753.gif)
|
||||
|
||||
@ -34,3 +34,10 @@ LOT W PRZÓD | PRAWY TRIGGER
|
||||
LOT W TYŁ | LEWY TRIGGER
|
||||
OBRÓT LEWO-PRAWO | LEWA GAŁKA
|
||||
NACHYLENIE GÓRA-DÓŁ | PRAWA GAŁKA
|
||||
MONOTWANIE ULEPSZENIA | A / X
|
||||
|
||||
### Interaktywność
|
||||
|
||||
W związku z brakami kadrowymi, "gra" stanowi bardziej demo typu "Proof of concept".
|
||||
Możliwe jest zebranie ulepszenia które poprawia prędkość statku oraz zmienia kolor płomieni.
|
||||
![picture](https://i.gyazo.com/35f28bdc6ef12186f38395b3f967cdb7.gif)
|
@ -7,6 +7,9 @@ uniform sampler2D sprite;
|
||||
|
||||
void main()
|
||||
{
|
||||
if(ParticleColor.w > 0){
|
||||
FragColor = (texture(sprite, TexCoords) * ParticleColor);
|
||||
}else{
|
||||
FragColor = texture(sprite, TexCoords);
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ ParticleGenerator::ParticleGenerator() {
|
||||
this->init();
|
||||
}
|
||||
|
||||
void ParticleGenerator::Draw(glm::mat4 modelMatrix, GLuint programParticle, GLuint texture, glm::vec3 cameraDir) {
|
||||
void ParticleGenerator::Draw(glm::mat4 modelMatrix, GLuint programParticle, GLuint texture, glm::vec3 cameraDir, bool isColour) {
|
||||
glEnable(GL_BLEND);
|
||||
glDepthMask(GL_FALSE);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
@ -18,7 +18,12 @@ void ParticleGenerator::Draw(glm::mat4 modelMatrix, GLuint programParticle, GLui
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(programParticle, "transformation"), 1, GL_FALSE, (float*)&(modelMatrix));
|
||||
glUniform3f(glGetUniformLocation(programParticle, "position"), particle.position.x, particle.position.y + (rand() % 10 - 5) / 500.f, particle.position.z + (rand() % 10 - 5) / 500.f);
|
||||
glUniform4f(glGetUniformLocation(programParticle, "color"), particle.color.x, particle.color.y, particle.color.z, particle.color.w);
|
||||
if (isColour) {
|
||||
glUniform4f(glGetUniformLocation(programParticle, "color"), 0.f, 0.9f, 0.f, 1.f);
|
||||
}
|
||||
else {
|
||||
glUniform4f(glGetUniformLocation(programParticle, "color"), 0.f, 0.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||
glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, cameraDir));
|
||||
|
@ -15,7 +15,7 @@ struct Particle {
|
||||
|
||||
class ParticleGenerator {
|
||||
public:
|
||||
void Draw(glm::mat4 modelMatrix, GLuint programParticle, GLuint texture, glm::vec3 cameraDir);
|
||||
void Draw(glm::mat4 modelMatrix, GLuint programParticle, GLuint texture, glm::vec3 cameraDir, bool isColour);
|
||||
ParticleGenerator();
|
||||
private:
|
||||
std::vector<Particle> particles;
|
||||
|
@ -407,7 +407,7 @@ void renderScene(GLFWwindow* window) {
|
||||
drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY(-1.5f * time) * glm::scale(glm::vec3(0.1f)), texture::earth_albedo, texture::earth_normal, texture::earth_ao, texture::earth_roughness, texture::earth_metallic);
|
||||
drawObjectPBR(planetContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(0, 0, -3.f)) * glm::eulerAngleY( 2.f * time) * glm::translate(glm::vec3(0.4f, 0, 0.4f)) * glm::eulerAngleY(-0.5f * time) * glm::scale(glm::vec3(0.04f)), texture::moon_albedo, texture::moon_normal, texture::moon_ao, texture::moon_roughness, texture::moon_metallic);
|
||||
|
||||
mainEngine->Draw(createPerspectiveMatrix() * createCameraMatrix() * glm::translate(glm::vec3(0.f, -0.22f, 0.0f)) * glm::translate(cameraPos + 0.2 * cameraDir + glm::vec3(0, 1, 0) * 0.05f), programParticle, texture::particle_fire, cameraDir);
|
||||
mainEngine->Draw(createPerspectiveMatrix() * createCameraMatrix() * glm::translate(glm::vec3(0.f, -0.22f, 0.0f)) * glm::translate(cameraPos + 0.2 * cameraDir + glm::vec3(0, 1, 0) * 0.05f), programParticle, texture::particle_fire, cameraDir, engineIs == 2);
|
||||
std::cout << glm::to_string(spaceshipPos) << std::endl;
|
||||
//desired objects end here
|
||||
glUseProgram(0);
|
||||
|
Loading…
Reference in New Issue
Block a user