Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Azrielx86 authored Nov 29, 2023
2 parents ce3b8da + c212c49 commit 032dd15
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 47 deletions.
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ Compilación

cmake --build .

# Capturas del programa

![](docs/Screenshot1.png)

![](docs/Screenshot2.png)

![](docs/Screenshot3.png)

# Roadmap
## Fase 1 - Base del programa
- [x] Manejo de ventanas
Expand All @@ -53,7 +61,6 @@ Compilación
## Fase 2 - Modelos
- [x] Carga de modelos por `Assimp`
- [x] Optimizado de la carga de modelos
- [ ] Sistema de jerarquías y transformaciones

## Fase 3 - Shading y texturizado
- [x] Sistema de carga / búsqueda de texturas
Expand All @@ -63,11 +70,27 @@ Compilación
## Fase 4 - Iluminación
- [x] Skyboxes
- [x] Sistema de iluminación (Colecciones de luces)
- [ ] (De ser necesario) light baking

## Fase 5 - Animación
- [ ] Animación de los elementos en el tablero
- [ ] Animación del avatar
- [x] Animación de los elementos en el tablero
- [x] Animación del avatar

## Fase 6 - Audio
- [ ] Integración de OpenAL
- [x] Integración de OpenAL

[//]: # (Quería poner esto en BoneModel.cpp o alguno de esos)

[//]: # (archivos, pero causaría conflicos (carácteres incompatibles)
[//]: # (con C++))
[//]: # ((Consideremos esto un pequeño easter egg en el repositorio))
[//]: # (⠄⠄⠄⠄⢠⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣯⢻⣿⣿⣿⣿⣆⠄⠄⠄)
[//]: # (⠄⠄⣼⢀⣿⣿⣿⣿⣏⡏⠄⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢻⣿⣿⣿⣿⡆⠄⠄)
[//]: # (⠄⠄⡟⣼⣿⣿⣿⣿⣿⠄⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⣿⣇⢻⣿⣿⣿⣿⠄⠄)
[//]: # (⠄⢰⠃⣿⣿⠿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠙⠿⣿⣿⣿⣿⣿⠄⢿⣿⣿⣿⡄⠄)
[//]: # (⠄⢸⢠⣿⣿⣧⡙⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠈⠛⢿⣿⣿⡇⠸⣿⡿⣸⡇⠄)
[//]: # (⠄⠈⡆⣿⣿⣿⣿⣦⡙⠳⠄⠄⠄⠄⠄⠄⢀⣠⣤⣀⣈⠙⠃⠄⠿⢇⣿⡇⠄)
[//]: # (⠄⠄⡇⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⣠⣶⣿⣿⣿⣿⣿⣿⣷⣆⡀⣼⣿⡇⠄)
[//]: # (⠄⠄⢹⡘⣿⣿⣿⢿⣷⡀⠄⢀⣴⣾⣟⠉⠉⠉⠉⣽⣿⣿⣿⣿⠇⢹⣿⠃⠄)
[//]: # (⠄⠄⠄⢷⡘⢿⣿⣎⢻⣷⠰⣿⣿⣿⣿⣦⣀⣀⣴⣿⣿⣿⠟⢫⡾⢸⡟⠄.)
[//]: # (⠄⠄⠄⠄⠻⣦⡙⠿⣧⠙⢷⠙⠻⠿⢿⡿⠿⠿⠛⠋⠉⠄⠂⠘⠁⠞⠄⠄⠄)
[//]: # (⠄⠄⠄⠄⠄⠈⠙⠑⣠⣤⣴⡖⠄⠿⣋⣉⣉⡁⠄⢾⣦⠄⠄⠄⠄⠄⠄⠄⠄)
Binary file added docs/Screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion shaders/shader_light.frag
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ in vec4 vColor;

out vec4 color;

const int MAX_POINT_LIGHTS = 5;
const int MAX_POINT_LIGHTS = 6;
const int MAX_SPOT_LIGHTS = 2;

struct Light
Expand Down
3 changes: 2 additions & 1 deletion src/GlobalConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
const float TURN_SPEED = 4.0;
const float MOVE_SPEED = 0.4;

const int MAX_POINT_LIGHTS = 5;

const int MAX_POINT_LIGHTS = 6;
const int MAX_SPOT_LIGHTS = 2;

enum KEYMAPS
Expand Down
82 changes: 42 additions & 40 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,25 +253,13 @@ void InitKeymaps()
KEYMAPS::FREE_CAMERA, GLFW_KEY_1,
[]() -> void
{
spotLights.toggleLight(1, !spotLights.getLightStatus(1));
pointLights.toggleLight(3, !pointLights.getLightStatus(3));
})
.addCallback(
KEYMAPS::FREE_CAMERA, GLFW_KEY_2,
[]() -> void
{
spotLights.toggleLight(2, !spotLights.getLightStatus(2));
})
.addCallback(
KEYMAPS::FREE_CAMERA, GLFW_KEY_3,
[]() -> void
{
pointLights.toggleLight(0, !pointLights.getLightStatus(0));
})
.addCallback(
KEYMAPS::FREE_CAMERA, GLFW_KEY_4,
[]() -> void
{
pointLights.toggleLight(1, !pointLights.getLightStatus(1));
pointLights.toggleLight(4, !pointLights.getLightStatus(4));
});

Input::KeyboardInput::GetInstance()
Expand Down Expand Up @@ -407,7 +395,6 @@ void CrearPrimitiva()

GLfloat cubo_vertices[] = {
// x y z S T NX NY NZ

///lados
-4.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f,
-2.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f,
Expand Down Expand Up @@ -639,7 +626,7 @@ void InitLights()
0.0f, -1.0f, 0.0f))
.build();

Lights::LightCollectionBuilder<Lights::PointLight> pointLightsBuilder(5); // nuevo
Lights::LightCollectionBuilder<Lights::PointLight> pointLightsBuilder(MAX_POINT_LIGHTS); // nuevo
pointLights = pointLightsBuilder
.addLight(Lights::PointLight(ToRGB(51), 1.0f, ToRGB(119),
0.8f, 0.3f,
Expand All @@ -662,26 +649,14 @@ void InitLights()
-58.6934, 51.8151, -9.73,
1.0f, 0.05f, 0.008f))
.build();
Lights::LightCollectionBuilder<Lights::SpotLight> spotLightBuilder(3);
Lights::LightCollectionBuilder<Lights::SpotLight> spotLightBuilder(MAX_SPOT_LIGHTS);
spotLights = spotLightBuilder
.addLight(Lights::SpotLight(1.0f, 1.0f, 1.0f,
0.8f, 0.3f,
5.22617, 234.113, 1.82546,
0.0f, -1.0f, 0.0f,
1.0f, 0.008f, 0.001f,
50.0f))
/*.addLight(Lights::SpotLight(ToRGB(199), 1.0f, ToRGB(51),
0.8f, 0.3f,
47.6584, 84.0895, 36.4503,
-2.0f, -2.0f, -2.0f,
1.0f, 0.005f, 0.0008f,
20.0f))
.addLight(Lights::SpotLight(1.0f, ToRGB(221), ToRGB(51),
0.8f, 0.3f,
47.6584, 84.0895, -36.4503,
-2.0f, -2.0f, 2.0f,
1.0f, 0.005f, 0.0008f,
20.0f))*/
.build();
}

Expand Down Expand Up @@ -1225,7 +1200,7 @@ void InitAnimations()
return true;
}
})
.prepare();
.prepare();

MjPos_0 = {0.0f, 2.9f, -3.2f};
}
Expand Down Expand Up @@ -1339,7 +1314,7 @@ int main(int argc, char **argv)
std::cerr << "No se pudo iniciar la ventana\n";
return 1;
}
CrearPrimitiva();
CrearPrimitiva();
// Inicializar los componentes del programa
Audio::AudioDevice::GetInstance(); // inicializa el componente de audio
Audio::AudioDevice::InitAlut(&argc, argv);
Expand All @@ -1352,11 +1327,10 @@ CrearPrimitiva();
InitAnimations();
LoadAnimations();
InitAudios();
//CrearDado();

primitiva = Model::Texture("assets/Textures/Hielo3.png");
primitiva.LoadTexture();


// region Skybox settings
// SKyBoxes Faces Day
std::vector<std::string> skbfDay;
Expand Down Expand Up @@ -1410,6 +1384,8 @@ CrearPrimitiva();
auto PicoM = models[MODELS::PICOM];
auto Muneco = models[MODELS::MUNECO];
auto destroyedBuilding = models[MODELS::DESTROYED_BUILDING];
auto robot = models[MODELS::ROBOT];
auto pod = models[MODELS::POD];

Animation::BoneAnimation walkAnimation(Utils::PathUtils::getModelsPath().append("/2b_walk_static.fbx"), &avatar);
Animation::BoneAnimation idleAnimation(Utils::PathUtils::getModelsPath().append("/2b_idle.fbx"), &avatar);
Expand Down Expand Up @@ -1520,8 +1496,9 @@ CrearPrimitiva();
shaderLight->SetDirectionalLight(&directionalLights[ambLight]);
shaderLight->SetSpotLights(spotLights.getLightArray(), spotLights.getCurrentCount());
shaderLight->SetPointLights(pointLights.getLightArray(), pointLights.getCurrentCount());

if (marbleKfAnim.Returnindex() > 6) {

if (marbleKfAnim.Returnindex() > 6)
{
activarP3 = true;
PicoJerarquia3.start();
}
Expand All @@ -1544,7 +1521,6 @@ CrearPrimitiva();
pointLights.toggleLight(2, false);
} /////////////////////////////


toffset = {0.0f, 0.0f};
color = {1.0f, 1.0f, 1.0f};
Material_opaco.UseMaterial(uSpecularIntensity, uShininess);
Expand Down Expand Up @@ -1784,9 +1760,38 @@ CrearPrimitiva();
.getMatrix();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
PicoM.render();
// endregion

//destroyedBuilding.render();
// region MODELOS_NIER
model = handler.setMatrix(glm::mat4(1.0f))
.translate(53.983, 71.612, -27.538)
.rotateY(46.061)
.getMatrix();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
destroyedBuilding.render();

model = handler.setMatrix(glm::mat4(1.0f))
.translate(56.002, 71.377, 35.124)
.rotateY(-416.5)
.getMatrix();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
destroyedBuilding.render();

model = handler.setMatrix(glm::mat4(1.0f))
.translate(44.797, 66.892, 0)
.rotateY(180)
.scale(11.492)
.getMatrix();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
robot.render();

model = handler.setMatrix(glm::mat4(1.0f))
.translate(-1.48956, 66.183f + (float) (1.5f * sin(glfwGetTime())), 19.9368)
.rotateY(131.41)
.scale(2)
.getMatrix();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
pod.render();
// endregion

// region Entity Marble
Expand All @@ -1806,7 +1811,6 @@ CrearPrimitiva();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
marbleKf.render();
// endregion Entity Marble
// if ()

// region Resorte

Expand All @@ -1822,7 +1826,6 @@ CrearPrimitiva();
// endregion Resorte

// region muñeco de hielo

model = handler.setMatrix(glm::mat4(1.0f))
.translate(8, 55, -26)
.scale(0.4)
Expand All @@ -1842,7 +1845,6 @@ CrearPrimitiva();
glUniformMatrix4fv((GLint) uModel, 1, GL_FALSE, glm::value_ptr(model));
primitiva.UseTexture();
meshListPrimitive[0]->RenderMeshPrimitive();
// a

// region ALPHA
glEnable(GL_BLEND);
Expand Down

0 comments on commit 032dd15

Please sign in to comment.