dodanie nowych skyboxów

This commit is contained in:
K4RP4T 2024-02-08 03:23:13 +01:00
parent baa8f806d4
commit 1d0f465bfd
2 changed files with 54 additions and 16 deletions

View File

@ -3,14 +3,14 @@ Pos=60,60
Size=400,400
[Window][Planet]
Pos=1,217
Size=327,227
Pos=1,257
Size=327,229
[Window][Sun]
Pos=1,445
Size=327,118
Pos=1,487
Size=327,120
[Window][General]
Pos=1,0
Size=327,216
Size=327,256

View File

@ -75,14 +75,16 @@ bool lightingCheck = false;
bool skyBoxCheck = false;
bool toneMappingCheck = false;
const char* skyBoxPaths[] = { "./textures/skybox/bkg2_left2.png", "./textures/skybox/bkg2_right1.png", "./textures/skybox/bkg2_top3.png", "./textures/skybox/bkg2_bottom4.png",
const char* skyBoxPaths0[] = { "./textures/skybox/bkg1_left.png", "./textures/skybox/bkg1_right.png", "./textures/skybox/bkg1_top.png", "./textures/skybox/bkg1_bot.png",
"./textures/skybox/bkg1_back.png", "./textures/skybox/bkg1_front.png" };
const char* skyBoxPaths1[] = { "./textures/skybox/left.png", "./textures/skybox/right.png", "./textures/skybox/top.png", "./textures/skybox/bot.png",
"./textures/skybox/back.png", "./textures/skybox/front.png" };
const char* skyBoxPaths2[] = { "./textures/skybox/bkg2_left2.png", "./textures/skybox/bkg2_right1.png", "./textures/skybox/bkg2_top3.png", "./textures/skybox/bkg2_bottom4.png",
"./textures/skybox/bkg2_back6.png", "./textures/skybox/bkg2_front5.png" };
//const char* skyBoxPaths[] = { "./textures/skybox/left.png", "./textures/skybox/right.png", "./textures/skybox/top.png", "./textures/skybox/bot.png",
// "./textures/skybox/back.png", "./textures/skybox/front.png" };
//const char* skyBoxPaths[] = { "./textures/skybox/bkg1_left.png", "./textures/skybox/bkg1_right.png", "./textures/skybox/bkg1_top.png", "./textures/skybox/bkg1_bot.png",
// "./textures/skybox/bkg1_back.png", "./textures/skybox/bkg1_front.png" };
//const char* skyBoxPaths[] = { "./textures/skybox/space_rt.png", "./textures/skybox/space_lf.png", "./textures/skybox/space_up.png", "./textures/skybox/space_dn.png",
// "./textures/skybox/space_bk.png", "./textures/skybox/space_ft.png" };
const char* skyBoxPaths3[] = { "./textures/skybox/space_rt.png", "./textures/skybox/space_lf.png", "./textures/skybox/space_up.png", "./textures/skybox/space_dn.png",
"./textures/skybox/space_bk.png", "./textures/skybox/space_ft.png" };
const char** skyBoxArrays[] = { skyBoxPaths0, skyBoxPaths1, skyBoxPaths2, skyBoxPaths3 };
int skyBoxIndex = 0;
GLuint skyBoxTex;
glm::vec3 skyBoxPos = glm::vec3(0.f, 0.f, 0.f);
@ -195,8 +197,28 @@ void showGUI() {
{
ImGui::Checkbox("Sky Box", &skyBoxCheck);
if (skyBoxCheck)
if (skyBoxCheck) {
ImGui::Text("Texture");
if (ImGui::Button("Prev", ImVec2(60, 20))) {
--skyBoxIndex;
if (skyBoxIndex < 0)
skyBoxIndex = sizeof(skyBoxArrays) / sizeof(skyBoxArrays[0]) - 1;
skyBoxTex = Core::LoadSkyBox(skyBoxArrays[skyBoxIndex]);
}
ImGui::SameLine();
if (ImGui::Button("Next", ImVec2(60, 20))) {
++skyBoxIndex;
if (skyBoxIndex > sizeof(skyBoxArrays) / sizeof(skyBoxArrays[0]) - 1)
skyBoxIndex = 0;
skyBoxTex = Core::LoadSkyBox(skyBoxArrays[skyBoxIndex]);
}
ImGui::SliderFloat("Rotation", &skyBoxRot, 0.0f, 360.0f, "%.3f", ImGuiSliderFlags_AlwaysClamp);
}
ImGui::Checkbox("Tone Mapping", &toneMappingCheck);
ImGui::SliderInt("Bloom Level", &blur_count, 1, 5, "%d", ImGuiSliderFlags_AlwaysClamp);
@ -489,8 +511,6 @@ void renderScene(GLFWwindow* window) {
else
drawPlanetTex(sphereContext, planetTranslate * planetRotate * planetScale, planetTex, normalTex);
//drawPlanetTex(sphereContext, planetTranslate * planetRotate * planetScale, planetRock, rockNormal);
//rysowanie słońca
glm::mat4 sunScale = glm::scale(glm::vec3(sunSize));
glm::mat4 sunRotate = glm::rotate(PI, glm::vec3(0, 1, 0));
@ -577,6 +597,24 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
sunTex = Core::LoadTexture(sunTexPaths[sunTexIndex]);
}
//tekstura skyboxa
if (key == GLFW_KEY_G && action == GLFW_PRESS) {
++skyBoxIndex;
if (skyBoxIndex > sizeof(skyBoxArrays) / sizeof(skyBoxArrays[0]) - 1)
skyBoxIndex = 0;
skyBoxTex = Core::LoadSkyBox(skyBoxArrays[skyBoxIndex]);
}
else if (key == GLFW_KEY_H && action == GLFW_PRESS) {
--skyBoxIndex;
if (skyBoxIndex < 0)
skyBoxIndex = sizeof(skyBoxArrays) / sizeof(skyBoxArrays[0]) - 1;
skyBoxTex = Core::LoadSkyBox(skyBoxArrays[skyBoxIndex]);
}
//atmosfera
if (key == GLFW_KEY_O && action == GLFW_PRESS)
atmosphereCheck = !atmosphereCheck;
@ -738,7 +776,7 @@ void init(GLFWwindow* window) {
normalTex = Core::LoadTexture(normalTexPaths[planetTexIndex]);
sunTex = Core::LoadTexture(sunTexPaths[sunTexIndex]);
skyBoxTex = Core::LoadSkyBox(skyBoxPaths);
skyBoxTex = Core::LoadSkyBox(skyBoxArrays[skyBoxIndex]);
blurPingPong(window);