add skybox

This commit is contained in:
matixezor 2021-12-27 20:27:35 +01:00
parent ec433e3e87
commit bec3180028
27 changed files with 9 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 723 KiB

After

Width:  |  Height:  |  Size: 723 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 KiB

View File

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

View File

Before

Width:  |  Height:  |  Size: 462 KiB

After

Width:  |  Height:  |  Size: 462 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 KiB

View File

Before

Width:  |  Height:  |  Size: 588 KiB

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

View File

Before

Width:  |  Height:  |  Size: 525 KiB

After

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 KiB

View File

Before

Width:  |  Height:  |  Size: 338 KiB

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

View File

@ -30,12 +30,12 @@ glm::mat4 cameraMatrix, perspectiveMatrix;
Core::Shader_Loader shaderLoader; Core::Shader_Loader shaderLoader;
std::string skyboxTextures[6] = { std::string skyboxTextures[6] = {
"models/skybox/right.jpg", "models/skybox/right1.jpg",
"models/skybox/left.jpg", "models/skybox/left1.jpg",
"models/skybox/top.jpg", "models/skybox/top1.jpg",
"models/skybox/bottom.jpg", "models/skybox/bottom1.jpg",
"models/skybox/front.jpg", "models/skybox/front1.jpg",
"models/skybox/back.jpg" "models/skybox/back1.jpg"
}; };
float skyboxVertices[] = { float skyboxVertices[] = {
@ -156,16 +156,17 @@ unsigned int loadCubemap()
int width, height, nrChannels; int width, height, nrChannels;
for (unsigned int i = 0; i < 6; i++) for (unsigned int i = 0; i < 6; i++)
{ {
unsigned char* data = stbi_load(skyboxTextures[i].c_str(), &width, &height, &nrChannels, 0); unsigned char* data = stbi_load(skyboxTextures[i].c_str(), &width, &height, &nrChannels, STBI_rgb_alpha);
if (data) if (data)
{ {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data
); );
stbi_image_free(data); stbi_image_free(data);
} }
else else
{ {
std::cout << stbi_failure_reason() << std::endl;
std::cout << "Cubemap tex failed to load at path: " << skyboxTextures[i] << std::endl; std::cout << "Cubemap tex failed to load at path: " << skyboxTextures[i] << std::endl;
stbi_image_free(data); stbi_image_free(data);
} }