Merge pull request 'feat: add skybox' (#2) from skybox into master

Reviewed-on: #2
This commit is contained in:
Mateusz Romański 2021-12-28 19:03:24 +01:00
commit 548003f35f
14 changed files with 7 additions and 3 deletions

View File

@ -1 +1,4 @@
 grafika_projekt.vcxproj -> J:\source\repos\grafika_projekt\Debug\grafika_projekt.exe  main.cpp
J:\source\repos\grafika_projekt\grafika_projekt\src\main.cpp(108,10): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
J:\source\repos\grafika_projekt\grafika_projekt\src\main.cpp(109,10): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
grafika_projekt.vcxproj -> J:\source\repos\grafika_projekt\Debug\grafika_projekt.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 KiB

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 KiB

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 KiB

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

After

Width:  |  Height:  |  Size: 338 KiB

View File

@ -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);
} }