diff --git a/grafika_projekt/Debug/grafika_projekt.ilk b/grafika_projekt/Debug/grafika_projekt.ilk index 5a3dcfd..2728190 100644 Binary files a/grafika_projekt/Debug/grafika_projekt.ilk and b/grafika_projekt/Debug/grafika_projekt.ilk differ diff --git a/grafika_projekt/Debug/grafika_projekt.log b/grafika_projekt/Debug/grafika_projekt.log index f1a51d3..508aae7 100644 --- a/grafika_projekt/Debug/grafika_projekt.log +++ b/grafika_projekt/Debug/grafika_projekt.log @@ -1,4 +1,4 @@  main.cpp -C:\Users\sanan\source\repos\GRK-Projekt\grafika_projekt\src\main.cpp(112,10): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych 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 diff --git a/grafika_projekt/Debug/grafika_projekt.tlog/link.read.1.tlog b/grafika_projekt/Debug/grafika_projekt.tlog/link.read.1.tlog index 37fec46..7076b1b 100644 Binary files a/grafika_projekt/Debug/grafika_projekt.tlog/link.read.1.tlog and b/grafika_projekt/Debug/grafika_projekt.tlog/link.read.1.tlog differ diff --git a/grafika_projekt/Debug/main.obj b/grafika_projekt/Debug/main.obj index c966235..7a76dbd 100644 Binary files a/grafika_projekt/Debug/main.obj and b/grafika_projekt/Debug/main.obj differ diff --git a/grafika_projekt/Debug/vc142.idb b/grafika_projekt/Debug/vc142.idb index c7b29bc..494be81 100644 Binary files a/grafika_projekt/Debug/vc142.idb and b/grafika_projekt/Debug/vc142.idb differ diff --git a/grafika_projekt/Debug/vc142.pdb b/grafika_projekt/Debug/vc142.pdb index 0931ff6..b1265f7 100644 Binary files a/grafika_projekt/Debug/vc142.pdb and b/grafika_projekt/Debug/vc142.pdb differ diff --git a/grafika_projekt/grafika_projekt.vcxproj b/grafika_projekt/grafika_projekt.vcxproj index a8e3dc4..f6588d2 100644 --- a/grafika_projekt/grafika_projekt.vcxproj +++ b/grafika_projekt/grafika_projekt.vcxproj @@ -177,6 +177,10 @@ + + + + diff --git a/grafika_projekt/grafika_projekt.vcxproj.filters b/grafika_projekt/grafika_projekt.vcxproj.filters index 106fd4e..5a12b0c 100644 --- a/grafika_projekt/grafika_projekt.vcxproj.filters +++ b/grafika_projekt/grafika_projekt.vcxproj.filters @@ -96,5 +96,9 @@ + + + + \ No newline at end of file diff --git a/grafika_projekt/models/Blank image.jpg b/grafika_projekt/models/Blank image.jpg deleted file mode 100644 index e69de29..0000000 diff --git a/grafika_projekt/models/spaceship.obj b/grafika_projekt/models/spaceship.obj new file mode 100644 index 0000000..e96c964 --- /dev/null +++ b/grafika_projekt/models/spaceship.obj @@ -0,0 +1,464 @@ +# Exported from Wings 3D 1.0.1 +#48 vertices, 92 faces +v -0.46604296 -4.6098739e-2 6.1004010e-2 +v -0.46604296 4.5631895e-2 6.1004010e-2 +v -0.28477197 -9.3266190e-2 -0.41163609 +v -0.28477197 4.5631895e-2 -0.41163609 +v -5.3436673e-2 -4.9075029e-2 0.72044817 +v -5.3436673e-2 -0.10214269 0.72044817 +v 0.0000000e+0 -4.9075029e-2 0.74414179 +v 0.0000000e+0 -0.11873436 0.74414179 +v 0.0000000e+0 0.11653721 -0.35075536 +v 0.0000000e+0 -0.16403757 -0.35075536 +v 0.0000000e+0 0.16403757 6.1004010e-2 +v 0.0000000e+0 -0.16403757 6.1004010e-2 +v -0.64756828 -3.8727536e-2 -0.23804752 +v -0.64756828 7.1441743e-2 -0.23804752 +v -0.49663244 7.1441743e-2 -0.74414179 +v -0.49663244 -3.8727536e-2 -0.74414179 +v -4.0833684e-2 -0.10214269 0.73456352 +v -4.0833684e-2 -4.9075029e-2 0.73456352 +v -0.16961230 0.11653721 -0.38119573 +v -0.16961230 -0.14744589 -0.38119573 +v -0.16961230 0.16403757 6.1004010e-2 +v -0.16961230 -0.14744589 6.1004010e-2 +v -9.1308654e-2 4.5778787e-2 0.47242135 +v -9.1308654e-2 -0.10009243 0.47242135 +v 0.0000000e+0 4.5778787e-2 0.47242135 +v 0.0000000e+0 -0.11668411 0.47242135 +v -0.18261731 -6.9341139e-2 0.47242135 +v -0.18261731 -1.7215671e-3 0.47242135 +v 0.46604296 -4.6098739e-2 6.1004010e-2 +v 0.46604296 4.5631895e-2 6.1004010e-2 +v 0.28477197 -9.3266190e-2 -0.41163609 +v 0.28477197 4.5631895e-2 -0.41163609 +v 5.3436673e-2 -4.9075029e-2 0.72044817 +v 5.3436673e-2 -0.10214269 0.72044817 +v 0.64756828 -3.8727536e-2 -0.23804752 +v 0.64756828 7.1441743e-2 -0.23804752 +v 0.49663244 7.1441743e-2 -0.74414179 +v 0.49663244 -3.8727536e-2 -0.74414179 +v 4.0833684e-2 -0.10214269 0.73456352 +v 4.0833684e-2 -4.9075029e-2 0.73456352 +v 0.16961230 0.11653721 -0.38119573 +v 0.16961230 -0.14744589 -0.38119573 +v 0.16961230 0.16403757 6.1004010e-2 +v 0.16961230 -0.14744589 6.1004010e-2 +v 9.1308654e-2 4.5778787e-2 0.47242135 +v 9.1308654e-2 -0.10009243 0.47242135 +v 0.18261731 -6.9341139e-2 0.47242135 +v 0.18261731 -1.7215671e-3 0.47242135 +vt 0.0000000e+0 0.69053970 +vt 4.2285593e-2 0.71525416 +vt 0.11847455 0.48783383 +vt 0.16076015 0.51254829 +vt 0.16331352 0.33807909 +vt 0.17536475 0.59545214 +vt 0.18715376 0.64617830 +vt 0.21512694 0.12420912 +vt 0.23028866 0.37309998 +vt 0.27933871 3.3287708e-2 +vt 0.29111566 1.8231410e-2 +vt 0.29780728 0.0000000e+0 +vt 0.30306274 0.16395866 +vt 0.32256180 5.8152293e-2 +vt 0.33503069 5.1982011e-2 +vt 0.34659842 0.15855392 +vt 0.34866807 4.3914835e-2 +vt 0.35966131 0.56514644 +vt 0.36786859 0.34315696 +vt 0.38304782 0.66577476 +vt 0.38362189 0.14708561 +vt 0.40944282 0.52981351 +vt 0.43912922 0.32433135 +vt 0.44897715 0.70072227 +vt 0.48119448 0.50585981 +vt 0.52771590 0.47388085 +vt 0.52771590 0.68855148 +vt 0.53171542 0.29271280 +vt 0.54359004 0.11090107 +vt 0.54696463 8.9466723e-4 +vt 0.56615771 0.0000000e+0 +vt 0.58393029 6.3125387e-4 +vt 0.58452235 0.11195282 +vt 0.60240334 0.48892951 +vt 0.60614015 0.29553098 +vt 0.62473227 0.11194349 +vt 0.66991430 0.50491521 +vt 0.75162596 0.29695078 +vt 0.77873865 0.65209135 +vt 0.84024960 0.13148316 +vt 0.84024960 0.42828199 +vt 0.90677601 0.35344281 +vt 0.92024753 0.0000000e+0 +vt 1.00000000 0.20728785 +vn -0.85484036 0.0000000e+0 0.51889108 +vn -0.25024660 -0.96818192 6.4366946e-4 +vn -0.41030048 -0.90951551 -6.6596220e-2 +vn -0.82350309 0.0000000e+0 0.56731178 +vn -0.31890558 -0.93276809 0.16805628 +vn -0.31484356 -0.93485312 0.16408281 +vn -2.7217819e-2 -0.99959657 -8.1173501e-3 +vn -0.32350669 -0.94622588 0.0000000e+0 +vn -0.82350309 0.0000000e+0 0.56731178 +vn -0.85484036 0.0000000e+0 0.51889108 +vn -0.85484036 0.0000000e+0 0.51889108 +vn 8.6753709e-2 0.99567401 3.3272527e-2 +vn -0.36724289 0.91939897 -0.14084814 +vn -0.34874278 0.87308361 0.34073961 +vn -0.82350309 0.0000000e+0 0.56731178 +vn 0.84335584 0.0000000e+0 -0.53735549 +vn -0.25024660 -0.96818192 6.4366946e-4 +vn -0.41030048 -0.90951551 -6.6596220e-2 +vn 0.25555460 0.0000000e+0 -0.96679462 +vn 8.6753709e-2 0.99567401 3.3272527e-2 +vn 0.84335584 0.0000000e+0 -0.53735549 +vn 0.25555460 0.0000000e+0 -0.96679462 +vn -0.36724289 0.91939897 -0.14084814 +vn 0.84335584 0.0000000e+0 -0.53735549 +vn 0.25555460 0.0000000e+0 -0.96679462 +vn -0.50427448 0.85860405 -9.2229808e-2 +vn 8.2673579e-2 0.99627162 2.4656288e-2 +vn -0.88691408 0.0000000e+0 0.46193442 +vn -0.74593766 0.0000000e+0 0.66601577 +vn -0.42279812 0.82385482 0.37749832 +vn -0.88691408 0.0000000e+0 0.46193442 +vn -0.74593766 0.0000000e+0 0.66601577 +vn 1.1166894e-2 -0.99988794 -9.9704414e-3 +vn -0.88691408 0.0000000e+0 0.46193442 +vn -0.31890277 -0.94690597 4.0866878e-2 +vn -0.74593766 0.0000000e+0 0.66601577 +vn -0.22836934 0.0000000e+0 0.97357457 +vn -7.7079267e-2 0.94131828 0.32860109 +vn 0.22836934 0.0000000e+0 0.97357457 +vn 7.7079267e-2 0.94131828 0.32860109 +vn -0.22836934 0.0000000e+0 0.97357457 +vn -0.38916924 -0.91867155 6.7748717e-2 +vn -0.22836934 0.0000000e+0 0.97357457 +vn -0.17877724 -0.98386157 -7.4236827e-3 +vn 0.22836934 0.0000000e+0 0.97357457 +vn 0.38916924 -0.91867155 6.7748717e-2 +vn 0.22836934 0.0000000e+0 0.97357457 +vn 0.17877724 -0.98386157 -7.4236827e-3 +vn 0.17664795 0.0000000e+0 -0.98427410 +vn 0.0000000e+0 0.99341178 -0.11459949 +vn 0.17664795 0.0000000e+0 -0.98427410 +vn 1.9164607e-2 0.99409750 -0.10678429 +vn -0.17664795 0.0000000e+0 -0.98427410 +vn 0.0000000e+0 0.99341178 -0.11459949 +vn -0.17664795 0.0000000e+0 -0.98427410 +vn -1.9164607e-2 0.99409750 -0.10678429 +vn -9.7356475e-2 -0.99524958 0.0000000e+0 +vn 0.17664795 0.0000000e+0 -0.98427410 +vn 9.7356475e-2 -0.99524958 0.0000000e+0 +vn -0.17664795 0.0000000e+0 -0.98427410 +vn 0.0000000e+0 0.99341178 -0.11459949 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.0000000e+0 0.99341178 -0.11459949 +vn 0.0000000e+0 0.96108401 0.27625628 +vn -9.7356475e-2 -0.99524958 0.0000000e+0 +vn -9.6505640e-2 -0.98655171 0.13191807 +vn -9.7356475e-2 -0.99524958 0.0000000e+0 +vn -0.17764671 -0.97763993 0.11252476 +vn 9.7356475e-2 -0.99524958 0.0000000e+0 +vn 9.6505640e-2 -0.98655171 0.13191807 +vn 9.7356475e-2 -0.99524958 0.0000000e+0 +vn 0.17764671 -0.97763993 0.11252476 +vn -2.7217819e-2 -0.99959657 -8.1173501e-3 +vn -0.95829012 0.0000000e+0 -0.28579720 +vn -0.85484036 0.0000000e+0 0.51889108 +vn -0.95829012 0.0000000e+0 -0.28579720 +vn -0.85484036 0.0000000e+0 0.51889108 +vn 8.6753709e-2 0.99567401 3.3272527e-2 +vn 8.2673579e-2 0.99627162 2.4656288e-2 +vn -0.95829012 0.0000000e+0 -0.28579720 +vn -0.85484036 0.0000000e+0 0.51889108 +vn -0.95829012 0.0000000e+0 -0.28579720 +vn 0.84335584 0.0000000e+0 -0.53735549 +vn 8.2673579e-2 0.99627162 2.4656288e-2 +vn -0.95829012 0.0000000e+0 -0.28579720 +vn 0.84335584 0.0000000e+0 -0.53735549 +vn -0.25024660 -0.96818192 6.4366946e-4 +vn -2.7217819e-2 -0.99959657 -8.1173501e-3 +vn 0.84335584 0.0000000e+0 -0.53735549 +vn -0.95829012 0.0000000e+0 -0.28579720 +vn 1.1166894e-2 -0.99988794 -9.9704414e-3 +vn -0.38916924 -0.91867155 6.7748717e-2 +vn -0.22836934 0.0000000e+0 0.97357457 +vn -0.74593766 0.0000000e+0 0.66601577 +vn -0.22836934 0.0000000e+0 0.97357457 +vn -7.7079267e-2 0.94131828 0.32860109 +vn -0.74593766 0.0000000e+0 0.66601577 +vn -0.42279812 0.82385482 0.37749832 +vn -0.22836934 0.0000000e+0 0.97357457 +vn -0.42702825 0.82086493 0.37924616 +vn -0.74593766 0.0000000e+0 0.66601577 +vn 0.0000000e+0 0.94033441 0.34025166 +vn 0.25555460 0.0000000e+0 -0.96679462 +vn 0.17664795 0.0000000e+0 -0.98427410 +vn 1.9164607e-2 0.99409750 -0.10678429 +vn -0.50427448 0.85860405 -9.2229808e-2 +vn -9.7356475e-2 -0.99524958 0.0000000e+0 +vn 0.17664795 0.0000000e+0 -0.98427410 +vn -0.41030048 -0.90951551 -6.6596220e-2 +vn 0.25555460 0.0000000e+0 -0.96679462 +vn 0.25555460 0.0000000e+0 -0.96679462 +vn 0.17664795 0.0000000e+0 -0.98427410 +vn -9.7356475e-2 -0.99524958 0.0000000e+0 +vn -0.32350669 -0.94622588 0.0000000e+0 +vn 0.0000000e+0 0.99341178 -0.11459949 +vn -0.36724289 0.91939897 -0.14084814 +vn -0.34874278 0.87308361 0.34073961 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 1.9164607e-2 0.99409750 -0.10678429 +vn 0.0000000e+0 0.96108401 0.27625628 +vn -0.43656100 0.83918947 0.32430777 +vn -0.50427448 0.85860405 -9.2229808e-2 +vn -9.6505640e-2 -0.98655171 0.13191807 +vn -0.31890558 -0.93276809 0.16805628 +vn -9.7356475e-2 -0.99524958 0.0000000e+0 +vn -0.32350669 -0.94622588 0.0000000e+0 +vn 0.0000000e+0 0.96108401 0.27625628 +vn -0.43656100 0.83918947 0.32430777 +vn -0.42702825 0.82086493 0.37924616 +vn 0.0000000e+0 0.94033441 0.34025166 +vn -9.6505640e-2 -0.98655171 0.13191807 +vn 1.1166894e-2 -0.99988794 -9.9704414e-3 +vn -0.38916924 -0.91867155 6.7748717e-2 +vn -0.31890558 -0.93276809 0.16805628 +vn -0.17877724 -0.98386157 -7.4236827e-3 +vn -0.31484356 -0.93485312 0.16408281 +vn -0.17764671 -0.97763993 0.11252476 +vn -0.31890277 -0.94690597 4.0866878e-2 +vn -7.7079267e-2 0.94131828 0.32860109 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.0000000e+0 0.94033441 0.34025166 +vn 7.7079267e-2 0.94131828 0.32860109 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.0000000e+0 0.94033441 0.34025166 +vn -0.17877724 -0.98386157 -7.4236827e-3 +vn -0.17764671 -0.97763993 0.11252476 +vn 0.17877724 -0.98386157 -7.4236827e-3 +vn 0.17764671 -0.97763993 0.11252476 +vn -0.31484356 -0.93485312 0.16408281 +vn -0.88691408 0.0000000e+0 0.46193442 +vn -0.82350309 0.0000000e+0 0.56731178 +vn -0.31890277 -0.94690597 4.0866878e-2 +vn -0.88691408 0.0000000e+0 0.46193442 +vn -0.34874278 0.87308361 0.34073961 +vn -0.82350309 0.0000000e+0 0.56731178 +vn -0.42279812 0.82385482 0.37749832 +vn -0.43656100 0.83918947 0.32430777 +vn -0.88691408 0.0000000e+0 0.46193442 +vn -0.82350309 0.0000000e+0 0.56731178 +vn -0.42702825 0.82086493 0.37924616 +vn 0.85484036 0.0000000e+0 0.51889108 +vn 0.25024660 -0.96818192 6.4366946e-4 +vn 0.41030048 -0.90951551 -6.6596220e-2 +vn 0.82350309 0.0000000e+0 0.56731178 +vn 0.31890558 -0.93276809 0.16805628 +vn 0.31484356 -0.93485312 0.16408281 +vn 2.7217819e-2 -0.99959657 -8.1173501e-3 +vn 0.32350669 -0.94622588 0.0000000e+0 +vn 0.82350309 0.0000000e+0 0.56731178 +vn 0.85484036 0.0000000e+0 0.51889108 +vn 0.85484036 0.0000000e+0 0.51889108 +vn -8.6753709e-2 0.99567401 3.3272527e-2 +vn 0.36724289 0.91939897 -0.14084814 +vn 0.34874278 0.87308361 0.34073961 +vn 0.82350309 0.0000000e+0 0.56731178 +vn -0.84335584 0.0000000e+0 -0.53735549 +vn 0.25024660 -0.96818192 6.4366946e-4 +vn 0.41030048 -0.90951551 -6.6596220e-2 +vn -0.25555460 0.0000000e+0 -0.96679462 +vn -8.6753709e-2 0.99567401 3.3272527e-2 +vn -0.84335584 0.0000000e+0 -0.53735549 +vn -0.25555460 0.0000000e+0 -0.96679462 +vn 0.36724289 0.91939897 -0.14084814 +vn -0.84335584 0.0000000e+0 -0.53735549 +vn -0.25555460 0.0000000e+0 -0.96679462 +vn 0.50427448 0.85860405 -9.2229808e-2 +vn -8.2673579e-2 0.99627162 2.4656288e-2 +vn 0.88691408 0.0000000e+0 0.46193442 +vn 0.74593766 0.0000000e+0 0.66601577 +vn 0.42279812 0.82385482 0.37749832 +vn 0.88691408 0.0000000e+0 0.46193442 +vn 0.74593766 0.0000000e+0 0.66601577 +vn -1.1166894e-2 -0.99988794 -9.9704414e-3 +vn 0.88691408 0.0000000e+0 0.46193442 +vn 0.31890277 -0.94690597 4.0866878e-2 +vn 0.74593766 0.0000000e+0 0.66601577 +vn 2.7217819e-2 -0.99959657 -8.1173501e-3 +vn 0.95829012 0.0000000e+0 -0.28579720 +vn 0.85484036 0.0000000e+0 0.51889108 +vn 0.95829012 0.0000000e+0 -0.28579720 +vn 0.85484036 0.0000000e+0 0.51889108 +vn -8.6753709e-2 0.99567401 3.3272527e-2 +vn -8.2673579e-2 0.99627162 2.4656288e-2 +vn 0.95829012 0.0000000e+0 -0.28579720 +vn 0.85484036 0.0000000e+0 0.51889108 +vn 0.95829012 0.0000000e+0 -0.28579720 +vn -0.84335584 0.0000000e+0 -0.53735549 +vn -8.2673579e-2 0.99627162 2.4656288e-2 +vn 0.95829012 0.0000000e+0 -0.28579720 +vn -0.84335584 0.0000000e+0 -0.53735549 +vn 0.25024660 -0.96818192 6.4366946e-4 +vn 2.7217819e-2 -0.99959657 -8.1173501e-3 +vn -0.84335584 0.0000000e+0 -0.53735549 +vn 0.95829012 0.0000000e+0 -0.28579720 +vn -1.1166894e-2 -0.99988794 -9.9704414e-3 +vn 0.38916924 -0.91867155 6.7748717e-2 +vn 0.22836934 0.0000000e+0 0.97357457 +vn 0.74593766 0.0000000e+0 0.66601577 +vn 0.22836934 0.0000000e+0 0.97357457 +vn 7.7079267e-2 0.94131828 0.32860109 +vn 0.74593766 0.0000000e+0 0.66601577 +vn 0.42279812 0.82385482 0.37749832 +vn 0.22836934 0.0000000e+0 0.97357457 +vn 0.42702825 0.82086493 0.37924616 +vn 0.74593766 0.0000000e+0 0.66601577 +vn 0.0000000e+0 0.94033441 0.34025166 +vn -0.25555460 0.0000000e+0 -0.96679462 +vn -0.17664795 0.0000000e+0 -0.98427410 +vn -1.9164607e-2 0.99409750 -0.10678429 +vn 0.50427448 0.85860405 -9.2229808e-2 +vn 9.7356475e-2 -0.99524958 0.0000000e+0 +vn -0.17664795 0.0000000e+0 -0.98427410 +vn 0.41030048 -0.90951551 -6.6596220e-2 +vn -0.25555460 0.0000000e+0 -0.96679462 +vn -0.25555460 0.0000000e+0 -0.96679462 +vn -0.17664795 0.0000000e+0 -0.98427410 +vn 9.7356475e-2 -0.99524958 0.0000000e+0 +vn 0.32350669 -0.94622588 0.0000000e+0 +vn 0.0000000e+0 0.99341178 -0.11459949 +vn 0.36724289 0.91939897 -0.14084814 +vn 0.34874278 0.87308361 0.34073961 +vn 0.0000000e+0 0.96108401 0.27625628 +vn -1.9164607e-2 0.99409750 -0.10678429 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.43656100 0.83918947 0.32430777 +vn 0.50427448 0.85860405 -9.2229808e-2 +vn 9.6505640e-2 -0.98655171 0.13191807 +vn 0.31890558 -0.93276809 0.16805628 +vn 9.7356475e-2 -0.99524958 0.0000000e+0 +vn 0.32350669 -0.94622588 0.0000000e+0 +vn 0.0000000e+0 0.96108401 0.27625628 +vn 0.43656100 0.83918947 0.32430777 +vn 0.42702825 0.82086493 0.37924616 +vn 0.0000000e+0 0.94033441 0.34025166 +vn 9.6505640e-2 -0.98655171 0.13191807 +vn -1.1166894e-2 -0.99988794 -9.9704414e-3 +vn 0.38916924 -0.91867155 6.7748717e-2 +vn 0.31890558 -0.93276809 0.16805628 +vn 0.17877724 -0.98386157 -7.4236827e-3 +vn 0.31484356 -0.93485312 0.16408281 +vn 0.17764671 -0.97763993 0.11252476 +vn 0.31890277 -0.94690597 4.0866878e-2 +vn 0.31484356 -0.93485312 0.16408281 +vn 0.88691408 0.0000000e+0 0.46193442 +vn 0.82350309 0.0000000e+0 0.56731178 +vn 0.31890277 -0.94690597 4.0866878e-2 +vn 0.88691408 0.0000000e+0 0.46193442 +vn 0.34874278 0.87308361 0.34073961 +vn 0.82350309 0.0000000e+0 0.56731178 +vn 0.42279812 0.82385482 0.37749832 +vn 0.43656100 0.83918947 0.32430777 +vn 0.88691408 0.0000000e+0 0.46193442 +vn 0.82350309 0.0000000e+0 0.56731178 +vn 0.42702825 0.82086493 0.37924616 +g cube1_cube1_auv +usemtl cube1_auv +f 1/38/2 16/39/87 3/37/17 +f 1/38/8 20/34/114 22/35/126 +f 1/38/6 24/33/136 27/36/151 +f 1/5/4 28/13/157 2/9/15 +f 2/9/11 14/4/77 1/5/1 +f 2/9/14 28/13/156 21/19/117 +f 3/20/16 16/7/86 4/18/21 +f 3/37/18 20/34/109 1/38/3 +f 4/44/20 14/40/78 2/43/12 +f 4/18/22 20/24/110 3/20/19 +f 4/18/26 21/19/122 19/22/106 +f 5/14/28 28/13/155 6/10/31 +f 6/10/32 18/15/97 5/14/29 +f 6/32/33 24/33/132 17/31/91 +f 6/10/34 28/13/160 27/8/152 +f 7/17/37 18/15/95 8/12/41 +f 7/17/40 40/15/222 25/21/143 +f 8/12/43 18/15/99 17/11/93 +f 8/30/44 24/33/135 26/29/147 +f 8/12/45 40/15/221 7/17/39 +f 8/30/46 46/33/259 39/31/218 +f 9/25/51 20/24/112 19/22/104 +f 9/25/50 21/19/115 11/23/61 +f 9/25/53 42/24/234 10/27/60 +f 9/25/56 43/19/245 41/22/231 +f 10/27/58 20/24/108 9/25/49 +f 10/26/59 42/34/233 12/28/69 +f 11/23/63 43/19/241 9/25/54 +f 12/28/65 20/34/107 10/26/57 +f 12/28/66 24/33/131 22/35/123 +f 12/28/71 42/34/239 44/35/251 +f 12/28/72 46/33/263 26/29/150 +f 13/3/75 1/5/10 14/4/81 +f 13/41/73 16/39/88 1/38/7 +f 14/40/79 4/44/27 15/42/84 +f 14/4/80 16/1/90 13/3/74 +f 15/6/83 4/18/24 16/7/89 +f 15/2/82 16/1/85 14/4/76 +f 17/11/94 18/15/101 6/10/36 +f 17/31/92 24/33/133 8/30/42 +f 18/15/102 25/21/142 23/16/130 +f 18/15/98 28/13/158 5/14/30 +f 19/22/103 20/24/111 4/18/25 +f 19/22/105 21/19/119 9/25/52 +f 21/19/116 4/18/23 2/9/13 +f 21/19/118 25/21/140 11/23/62 +f 21/19/121 28/13/159 23/16/128 +f 22/35/125 20/34/113 12/28/67 +f 22/35/124 24/33/134 1/38/5 +f 23/16/127 25/21/141 21/19/120 +f 23/16/129 28/13/162 18/15/100 +f 25/21/139 18/15/96 7/17/38 +f 25/21/144 43/19/244 11/23/64 +f 26/29/148 24/33/137 12/28/68 +f 26/29/149 46/33/261 8/30/48 +f 27/36/154 24/33/138 6/32/35 +f 27/8/153 28/13/161 1/5/9 +f 29/5/163 36/4/203 30/9/173 +f 29/38/169 38/39/214 35/41/199 +f 29/38/165 42/34/235 31/37/180 +f 29/38/167 46/33/260 44/35/250 +f 29/5/171 48/13/275 47/8/267 +f 30/9/175 32/18/185 43/19/242 +f 30/43/174 36/40/204 32/44/182 +f 30/9/177 48/13/271 29/5/166 +f 31/37/179 38/39/213 29/38/164 +f 31/20/181 42/24/236 32/18/184 +f 32/18/183 38/7/212 31/20/178 +f 32/18/187 42/24/237 41/22/229 +f 33/14/191 40/15/223 34/10/194 +f 33/14/192 48/13/272 40/15/224 +f 34/10/198 40/15/227 39/11/220 +f 34/32/197 46/33/264 47/36/268 +f 34/10/193 48/13/269 33/14/190 +f 35/3/200 38/1/216 36/4/206 +f 36/4/207 29/5/172 35/3/201 +f 36/4/202 38/1/211 37/2/208 +f 37/42/210 32/44/189 36/40/205 +f 38/7/215 32/18/186 37/6/209 +f 39/11/219 40/15/225 8/12/47 +f 39/31/217 46/33/258 34/32/195 +f 40/15/226 48/13/276 45/16/255 +f 41/22/230 42/24/238 9/25/55 +f 41/22/232 43/19/248 32/18/188 +f 43/19/246 25/21/145 45/16/253 +f 43/19/243 48/13/270 30/9/176 +f 44/35/252 42/34/240 29/38/170 +f 44/35/249 46/33/257 12/28/70 +f 45/16/256 25/21/146 40/15/228 +f 45/16/254 48/13/273 43/19/247 +f 47/36/265 46/33/262 29/38/168 +f 47/8/266 48/13/274 34/10/196 diff --git a/grafika_projekt/shaders/shader_color.frag b/grafika_projekt/shaders/shader_color.frag new file mode 100644 index 0000000..fa3b562 --- /dev/null +++ b/grafika_projekt/shaders/shader_color.frag @@ -0,0 +1,13 @@ +#version 410 core + +uniform vec3 objectColor; +uniform vec3 lightDir; + +in vec3 interpNormal; + +void main() +{ + vec3 normal = normalize(interpNormal); + float diffuse = max(dot(normal, -lightDir), 0.0); + gl_FragColor = vec4(objectColor * diffuse, 1.0); +} diff --git a/grafika_projekt/shaders/shader_color.vert b/grafika_projekt/shaders/shader_color.vert new file mode 100644 index 0000000..b01a9f8 --- /dev/null +++ b/grafika_projekt/shaders/shader_color.vert @@ -0,0 +1,16 @@ +#version 410 core + +layout(location = 0) in vec3 vertexPosition; +layout(location = 1) in vec3 vertexNormal; +layout(location = 2) in vec2 vertexTexCoord; + +uniform mat4 modelViewProjectionMatrix; +uniform mat4 modelMatrix; + +out vec3 interpNormal; + +void main() +{ + gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0); + interpNormal = (modelMatrix * vec4(vertexNormal, 0.0)).xyz; +} diff --git a/grafika_projekt/shaders/shader_tex.frag b/grafika_projekt/shaders/shader_tex.frag new file mode 100644 index 0000000..08c1ade --- /dev/null +++ b/grafika_projekt/shaders/shader_tex.frag @@ -0,0 +1,16 @@ +#version 410 core + +uniform sampler2D textureSampler; +uniform vec3 lightDir; + +in vec3 interpNormal; +in vec2 interpTexCoord; + +void main() +{ + vec2 modifiedTexCoord = vec2(interpTexCoord.x, 1.0 - interpTexCoord.y); // Poprawka dla tekstur Ziemi, ktore bez tego wyswietlaja sie 'do gory nogami' + vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb; + vec3 normal = normalize(interpNormal); + float diffuse = max(dot(normal, -lightDir), 0.0); + gl_FragColor = vec4(color * diffuse, 1.0); +} diff --git a/grafika_projekt/shaders/shader_tex.vert b/grafika_projekt/shaders/shader_tex.vert new file mode 100644 index 0000000..c0e1d86 --- /dev/null +++ b/grafika_projekt/shaders/shader_tex.vert @@ -0,0 +1,18 @@ +#version 410 core + +layout(location = 0) in vec3 vertexPosition; +layout(location = 1) in vec3 vertexNormal; + +layout(location = 2) in vec2 vertexTexCoord; +uniform mat4 modelViewProjectionMatrix; +uniform mat4 modelMatrix; + +out vec3 interpNormal; +out vec2 interpTexCoord; + +void main() +{ + gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0); + interpNormal = (modelMatrix * vec4(vertexNormal, 0.0)).xyz; + interpTexCoord = vertexTexCoord; +} diff --git a/grafika_projekt/src/main.cpp b/grafika_projekt/src/main.cpp index 2d625cd..3bb3720 100644 --- a/grafika_projekt/src/main.cpp +++ b/grafika_projekt/src/main.cpp @@ -16,6 +16,7 @@ GLuint skyboxProgram, skyboxBuffer; GLuint programColor; GLuint programTexture; +GLuint textureFish; unsigned int cubemapTexture, skyboxVAO; float old_x, old_y = -1; @@ -184,8 +185,8 @@ void renderScene() glDrawArrays(GL_TRIANGLES, 0, 36); glBindVertexArray(0); - glm::mat4 fishInitialTransformation = glm::translate(glm::vec3(0, -0.25f, 0)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.25f)); - glm::mat4 fishModelMatrix = glm::translate(cameraPos + cameraDir * 0.5f) * glm::mat4_cast(glm::inverse(rotation)) * fishInitialTransformation; + glm::mat4 fishInitialTransformation = glm::translate(glm::vec3(-1, 0, -0.5)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.25f)); + glm::mat4 fishModelMatrix = glm::translate(cameraPos + cameraDir) * glm::mat4_cast(glm::inverse(rotation)) * fishInitialTransformation; drawObjectColor(fishContext, fishModelMatrix, glm::vec3(0.6f)); glutSwapBuffers(); @@ -256,14 +257,19 @@ void initSkybox() void init() { glEnable(GL_DEPTH_TEST); + programColor = shaderLoader.CreateProgram((char*) "shaders/shader_color.vert", (char*) "shaders/shader_color.frag"); + programTexture = shaderLoader.CreateProgram((char*) "shaders/shader_tex.vert", (char*) "shaders/shader_tex.frag"); skyboxProgram = shaderLoader.CreateProgram((char *) "shaders/skybox.vert", (char *) "shaders/skybox.frag"); cubemapTexture = loadCubemap(); - loadModelToContext("models/Blank.obj", fishContext); + loadModelToContext("models/fish.obj", fishContext); + textureFish = Core::LoadTexture("textures/fish_texture.png"); initSkybox(); } void shutdown() { + shaderLoader.DeleteProgram(programColor); + shaderLoader.DeleteProgram(programTexture); shaderLoader.DeleteProgram(skyboxProgram); } @@ -278,7 +284,7 @@ int main(int argc, char** argv) glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(200, 200); - glutInitWindowSize(600, 600); + glutInitWindowSize(800, 800); glutCreateWindow("Water and shit"); glewInit(); diff --git a/grafika_projekt/models/fish_texture.png b/grafika_projekt/textures/fish_texture.png similarity index 100% rename from grafika_projekt/models/fish_texture.png rename to grafika_projekt/textures/fish_texture.png