merge master to fish
@ -1,20 +0,0 @@
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\vc142.pdb
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\vc142.idb
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\camera.obj
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\main.obj
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\shader_loader.obj
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\stb_image_aug.obj
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\soil.obj
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\image_helper.obj
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\image_dxt.obj
|
||||
j:\source\repos\grafika_projekt\debug\grafika_projekt.pdb
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\cl.command.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\cl.read.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\cl.write.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link-cvtres.read.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link-cvtres.write.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link-rc.read.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link-rc.write.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link.command.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link.read.1.tlog
|
||||
j:\source\repos\grafika_projekt\grafika_projekt\debug\grafika_projekt.tlog\link.write.1.tlog
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\Users\sanan\source\repos\GRK-Projekt\Debug\grafika_projekt.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
@ -1,4 +0,0 @@
|
||||
main.cpp
|
||||
C:\Users\sanan\source\repos\GRK-Projekt\grafika_projekt\src\main.cpp(113,10): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
|
||||
C:\Users\sanan\source\repos\GRK-Projekt\grafika_projekt\src\main.cpp(114,10): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
|
||||
grafika_projekt.vcxproj -> C:\Users\sanan\source\repos\GRK-Projekt\Debug\grafika_projekt.exe
|
@ -1,2 +0,0 @@
|
||||
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionATL=14.29.30136:VCServicingVersionCrtHeaders=14.29.30136:VCServicingVersionCompilers=14.29.30136:TargetPlatformVersion=10.0.19041.0:
|
||||
Debug|Win32|C:\Users\sanan\source\repos\GRK-Projekt\|
|
Before Width: | Height: | Size: 723 KiB After Width: | Height: | Size: 304 KiB |
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 251 KiB |
Before Width: | Height: | Size: 462 KiB After Width: | Height: | Size: 275 KiB |
Before Width: | Height: | Size: 588 KiB After Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 525 KiB After Width: | Height: | Size: 311 KiB |
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 346 KiB |
@ -43,64 +43,93 @@ std::string skyboxTextures[6] = {
|
||||
"models/skybox/back.jpg"
|
||||
};
|
||||
|
||||
float skyboxVerticeParameter = 20.0f;
|
||||
float skyboxBoundary = 19.5f;
|
||||
|
||||
float skyboxVertices[] = {
|
||||
-20.0f, 20.0f, -20.0f,
|
||||
-20.0f, -20.0f, -20.0f,
|
||||
20.0f, -20.0f, -20.0f,
|
||||
20.0f, -20.0f, -20.0f,
|
||||
20.0f, 20.0f, -20.0f,
|
||||
-20.0f, 20.0f, -20.0f,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
|
||||
-20.0f, -20.0f, 20.0f,
|
||||
-20.0f, -20.0f, -20.0f,
|
||||
-20.0f, 20.0f, -20.0f,
|
||||
-20.0f, 20.0f, -20.0f,
|
||||
-20.0f, 20.0f, 20.0f,
|
||||
-20.0f, -20.0f, 20.0f,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
|
||||
20.0f, -20.0f, -20.0f,
|
||||
20.0f, -20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, -20.0f,
|
||||
20.0f, -20.0f, -20.0f,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
|
||||
-20.0f, -20.0f, 20.0f,
|
||||
-20.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f,
|
||||
20.0f, -20.0f, 20.0f,
|
||||
-20.0f, -20.0f, 20.0f,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
|
||||
-20.0f, 20.0f, -20.0f,
|
||||
20.0f, 20.0f, -20.0f,
|
||||
20.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f,
|
||||
-20.0f, 20.0f, 20.0f,
|
||||
-20.0f, 20.0f, -20.0f,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
|
||||
-20.0f, -20.0f, -20.0f,
|
||||
-20.0f, -20.0f, 20.0f,
|
||||
20.0f, -20.0f, -20.0f,
|
||||
20.0f, -20.0f, -20.0f,
|
||||
-20.0f, -20.0f, 20.0f,
|
||||
20.0f, -20.0f, 20.0f
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, -skyboxVerticeParameter,
|
||||
-skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter,
|
||||
skyboxVerticeParameter, -skyboxVerticeParameter, skyboxVerticeParameter
|
||||
};
|
||||
|
||||
|
||||
bool isInBoundaries(glm::vec3 nextPosition) {
|
||||
return nextPosition.z > -skyboxBoundary && nextPosition.z < skyboxBoundary && nextPosition.y > -skyboxBoundary &&
|
||||
nextPosition.y < skyboxBoundary && nextPosition.x < skyboxBoundary && nextPosition.x > -skyboxBoundary;
|
||||
}
|
||||
|
||||
|
||||
void keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
float angleSpeed = 10.f;
|
||||
float moveSpeed = 0.1f;
|
||||
glm::vec3 nextPosition;
|
||||
switch (key)
|
||||
{
|
||||
case 'z': cursorDiff.z -= angleSpeed; break;
|
||||
case 'x': cursorDiff.z += angleSpeed; break;
|
||||
case 'w': cameraPos += cameraDir * moveSpeed; break;
|
||||
case 's': cameraPos -= cameraDir * moveSpeed; break;
|
||||
case 'd': cameraPos += cameraSide * moveSpeed; break;
|
||||
case 'a': cameraPos -= cameraSide * moveSpeed; break;
|
||||
case 'w':
|
||||
nextPosition = cameraPos + (cameraDir * moveSpeed);
|
||||
if (isInBoundaries(nextPosition)) {
|
||||
cameraPos = nextPosition;
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
nextPosition = cameraPos - (cameraDir * moveSpeed);
|
||||
if (isInBoundaries(nextPosition)) {
|
||||
cameraPos = nextPosition;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
nextPosition = cameraPos + (cameraSide * moveSpeed);
|
||||
if (isInBoundaries(nextPosition)) {
|
||||
cameraPos = nextPosition;
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
nextPosition = cameraPos - (cameraSide * moveSpeed);
|
||||
if (isInBoundaries(nextPosition)) {
|
||||
cameraPos = nextPosition;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,16 +243,17 @@ unsigned int loadCubemap()
|
||||
int width, height, nrChannels;
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << stbi_failure_reason() << std::endl;
|
||||
std::cout << "Cubemap tex failed to load at path: " << skyboxTextures[i] << std::endl;
|
||||
stbi_image_free(data);
|
||||
}
|
||||
|