Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

52 changed files with 24 additions and 729375 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +0,0 @@
# Podwodna przygoda
Wejdź do podwodnego świata i zbierz wszystkie gwiazdy podziwiając przy tym piękną ale i tajemniczą podwodną przyrodę!
## Twórcy
- Łukasz Koziej
- Arkadiusz Kowalski
- Mariia Kuzmenko

View File

@ -1,9 +1,7 @@
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(513,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw6.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji.
main.cpp
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(167,23): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(168,23): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(547,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(658,28): warning C4244: "argument": konwersja z "float" do "int", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(658,21): warning C4244: "argument": konwersja z "float" do "int", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(72,23): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(73,23): warning C4244: "=": konwersja z "int" do "float", możliwa utrata danych
C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\cw 6\src\main.cpp(181,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych
Camera.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
grk-cw6.vcxproj -> C:\Users\lukas\Desktop\Projekt - Grafika komputerowa\Projekt\Debug\Projekt.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -37,12 +37,8 @@
<ItemGroup>
<None Include="shaders\shader_color.frag" />
<None Include="shaders\shader_color.vert" />
<None Include="shaders\shader_color_transparent.frag" />
<None Include="shaders\shader_color_transparent.vert" />
<None Include="shaders\shader_tex.frag" />
<None Include="shaders\shader_tex.vert" />
<None Include="shaders\skybox.frag" />
<None Include="shaders\skybox.vert" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{10701B86-9B0B-46A1-85DA-6238CBCC507B}</ProjectGuid>

View File

@ -97,17 +97,5 @@
<None Include="shaders\shader_tex.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\skybox.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_color_transparent.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_color_transparent.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
v 0 -100 -100
v 0 -100 100
v 0 100 -100
v 0 100 100
vt 0 0
vt 20 0
vt 0 20
vt 20 20
vn 0 1 0
s off
f 1/3/1 3/1/1 4/2/1
f 1/3/1 4/2/1 2/4/1
f 1/3/1 4/2/1 3/1/1
f 1/3/1 2/4/1 4/2/1

File diff suppressed because it is too large Load Diff

View File

@ -1,358 +0,0 @@
# This file uses centimeters as units for non-parametric coordinates.
mtllib estrellica.mtl
g default
v 7.889562 1.150329 -2.173651
v 2.212808 1.150329 -2.230414
v 0.068023 1.150328 -7.923502
v -2.151306 1.150329 -2.254857
v -7.817406 1.150328 -2.261558
v -3.523133 1.150328 1.888122
v -4.869315 1.150328 6.987552
v -0.006854 1.150329 4.473047
v 4.838127 1.150328 7.041885
v 3.538153 1.150329 1.927652
v 0.033757 0.000000 -0.314657
v 0.035668 2.269531 -0.312831
vt 0.626409 0.064409
vt 0.548284 0.007647
vt 0.451716 0.007647
vt 0.373591 0.064409
vt 0.343750 0.156250
vt 0.373591 0.248091
vt 0.451716 0.304853
vt 0.548284 0.304853
vt 0.626409 0.248091
vt 0.656250 0.156250
vt 0.375000 0.312500
vt 0.400000 0.312500
vt 0.425000 0.312500
vt 0.450000 0.312500
vt 0.475000 0.312500
vt 0.500000 0.312500
vt 0.525000 0.312500
vt 0.550000 0.312500
vt 0.575000 0.312500
vt 0.600000 0.312500
vt 0.625000 0.312500
vt 0.500000 0.688440
vt 0.500000 0.156250
vn 0.005105 -0.859861 -0.510503
vn 0.005105 -0.859861 -0.510503
vn 0.005105 -0.859861 -0.510503
vn 0.365127 -0.920739 -0.137556
vn 0.365127 -0.920739 -0.137556
vn 0.365127 -0.920739 -0.137556
vn -0.360232 -0.922140 -0.141034
vn -0.360232 -0.922140 -0.141034
vn -0.360232 -0.922140 -0.141034
vn 0.000604 -0.859880 -0.510496
vn 0.000604 -0.859880 -0.510496
vn 0.000604 -0.859880 -0.510496
vn -0.189615 -0.962051 0.196222
vn -0.189615 -0.962051 0.196222
vn -0.189615 -0.962051 0.196222
vn -0.358980 -0.928522 -0.094766
vn -0.358980 -0.928522 -0.094766
vn -0.358980 -0.928522 -0.094766
vn 0.120430 -0.965019 0.232884
vn 0.120430 -0.965019 0.232884
vn 0.120430 -0.965019 0.232884
vn -0.122414 -0.965251 0.230880
vn -0.122414 -0.965251 0.230880
vn -0.122414 -0.965251 0.230880
vn 0.363409 -0.927039 -0.092374
vn 0.363409 -0.927039 -0.092374
vn 0.363409 -0.927039 -0.092374
vn 0.188029 -0.961689 0.199495
vn 0.188029 -0.961689 0.199495
vn 0.188029 -0.961689 0.199495
vn 0.183421 0.963579 0.194606
vn 0.183421 0.963579 0.194606
vn 0.183421 0.963579 0.194606
vn 0.355062 0.930476 -0.090252
vn 0.355062 0.930476 -0.090252
vn 0.355062 0.930476 -0.090252
vn -0.119338 0.967005 0.225079
vn -0.119338 0.967005 0.225079
vn -0.119338 0.967005 0.225079
vn 0.117452 0.966757 0.227125
vn 0.117452 0.966757 0.227125
vn 0.117452 0.966757 0.227125
vn -0.350315 0.932055 -0.092478
vn -0.350315 0.932055 -0.092478
vn -0.350315 0.932055 -0.092478
vn -0.184852 0.963969 0.191293
vn -0.184852 0.963969 0.191293
vn -0.184852 0.963969 0.191293
vn 0.000591 0.866128 -0.499821
vn 0.000591 0.866128 -0.499821
vn 0.000591 0.866128 -0.499821
vn -0.351624 0.925964 -0.137664
vn -0.351624 0.925964 -0.137664
vn -0.351624 0.925964 -0.137664
vn 0.356828 0.924447 -0.134430
vn 0.356828 0.924447 -0.134430
vn 0.356828 0.924447 -0.134430
vn 0.004998 0.866108 -0.499832
vn 0.004998 0.866108 -0.499832
vn 0.004998 0.866108 -0.499832
s off
g pCylinder1
usemtl initialShadingGroup
f 1/11/1 11/22/2 2/12/3
f 2/12/4 11/22/5 3/13/6
f 3/13/7 11/22/8 4/14/9
f 4/14/10 11/22/11 5/15/12
f 5/15/13 11/22/14 6/16/15
f 6/16/16 11/22/17 7/17/18
f 7/17/19 11/22/20 8/18/21
f 8/18/22 11/22/23 9/19/24
f 9/19/25 11/22/26 10/20/27
f 10/20/28 11/22/29 1/21/30
f 1/1/31 12/23/32 10/10/33
f 10/10/34 12/23/35 9/9/36
f 9/9/37 12/23/38 8/8/39
f 8/8/40 12/23/41 7/7/42
f 7/7/43 12/23/44 6/6/45
f 6/6/46 12/23/47 5/5/48
f 5/5/49 12/23/50 4/4/51
f 4/4/52 12/23/53 3/3/54
f 3/3/55 12/23/56 2/2/57
f 2/2/58 12/23/59 1/1/60
g default
v 7.889562 1.150329 -2.173651
v 2.212808 1.150329 -2.230414
v 0.068023 1.150328 -7.923502
v -2.151306 1.150329 -2.254857
v -7.817406 1.150328 -2.261558
v -3.523133 1.150328 1.888122
v -4.869315 1.150328 6.987552
v -0.006854 1.150329 4.473047
v 4.838127 1.150328 7.041885
v 3.538153 1.150329 1.927652
v 0.033757 0.000000 -0.314657
v 0.035668 2.269531 -0.312831
vt 0.626409 0.064409
vt 0.548284 0.007647
vt 0.451716 0.007647
vt 0.373591 0.064409
vt 0.343750 0.156250
vt 0.373591 0.248091
vt 0.451716 0.304853
vt 0.548284 0.304853
vt 0.626409 0.248091
vt 0.656250 0.156250
vt 0.375000 0.312500
vt 0.400000 0.312500
vt 0.425000 0.312500
vt 0.450000 0.312500
vt 0.475000 0.312500
vt 0.500000 0.312500
vt 0.525000 0.312500
vt 0.550000 0.312500
vt 0.575000 0.312500
vt 0.600000 0.312500
vt 0.625000 0.312500
vt 0.500000 0.688440
vt 0.500000 0.156250
vn 0.005105 -0.859861 -0.510503
vn 0.005105 -0.859861 -0.510503
vn 0.005105 -0.859861 -0.510503
vn 0.365127 -0.920739 -0.137556
vn 0.365127 -0.920739 -0.137556
vn 0.365127 -0.920739 -0.137556
vn -0.360232 -0.922140 -0.141034
vn -0.360232 -0.922140 -0.141034
vn -0.360232 -0.922140 -0.141034
vn 0.000604 -0.859880 -0.510496
vn 0.000604 -0.859880 -0.510496
vn 0.000604 -0.859880 -0.510496
vn -0.189615 -0.962051 0.196222
vn -0.189615 -0.962051 0.196222
vn -0.189615 -0.962051 0.196222
vn -0.358980 -0.928522 -0.094766
vn -0.358980 -0.928522 -0.094766
vn -0.358980 -0.928522 -0.094766
vn 0.120430 -0.965019 0.232884
vn 0.120430 -0.965019 0.232884
vn 0.120430 -0.965019 0.232884
vn -0.122414 -0.965251 0.230880
vn -0.122414 -0.965251 0.230880
vn -0.122414 -0.965251 0.230880
vn 0.363409 -0.927039 -0.092374
vn 0.363409 -0.927039 -0.092374
vn 0.363409 -0.927039 -0.092374
vn 0.188029 -0.961689 0.199495
vn 0.188029 -0.961689 0.199495
vn 0.188029 -0.961689 0.199495
vn 0.183421 0.963579 0.194606
vn 0.183421 0.963579 0.194606
vn 0.183421 0.963579 0.194606
vn 0.355062 0.930476 -0.090252
vn 0.355062 0.930476 -0.090252
vn 0.355062 0.930476 -0.090252
vn -0.119338 0.967005 0.225079
vn -0.119338 0.967005 0.225079
vn -0.119338 0.967005 0.225079
vn 0.117452 0.966757 0.227125
vn 0.117452 0.966757 0.227125
vn 0.117452 0.966757 0.227125
vn -0.350315 0.932055 -0.092478
vn -0.350315 0.932055 -0.092478
vn -0.350315 0.932055 -0.092478
vn -0.184852 0.963969 0.191293
vn -0.184852 0.963969 0.191293
vn -0.184852 0.963969 0.191293
vn 0.000591 0.866128 -0.499821
vn 0.000591 0.866128 -0.499821
vn 0.000591 0.866128 -0.499821
vn -0.351624 0.925964 -0.137664
vn -0.351624 0.925964 -0.137664
vn -0.351624 0.925964 -0.137664
vn 0.356828 0.924447 -0.134430
vn 0.356828 0.924447 -0.134430
vn 0.356828 0.924447 -0.134430
vn 0.004998 0.866108 -0.499832
vn 0.004998 0.866108 -0.499832
vn 0.004998 0.866108 -0.499832
s off
g pCylinder1
f 13/34/61 23/45/62 14/35/63
f 14/35/64 23/45/65 15/36/66
f 15/36/67 23/45/68 16/37/69
f 16/37/70 23/45/71 17/38/72
f 17/38/73 23/45/74 18/39/75
f 18/39/76 23/45/77 19/40/78
f 19/40/79 23/45/80 20/41/81
f 20/41/82 23/45/83 21/42/84
f 21/42/85 23/45/86 22/43/87
f 22/43/88 23/45/89 13/44/90
f 13/24/91 24/46/92 22/33/93
f 22/33/94 24/46/95 21/32/96
f 21/32/97 24/46/98 20/31/99
f 20/31/100 24/46/101 19/30/102
f 19/30/103 24/46/104 18/29/105
f 18/29/106 24/46/107 17/28/108
f 17/28/109 24/46/110 16/27/111
f 16/27/112 24/46/113 15/26/114
f 15/26/115 24/46/116 14/25/117
f 14/25/118 24/46/119 13/24/120
g default
v 7.889562 1.150329 -2.173651
v 2.212808 1.150329 -2.230414
v 0.068023 1.150328 -7.923502
v -2.151306 1.150329 -2.254857
v -7.817406 1.150328 -2.261558
v -3.523133 1.150328 1.888122
v -4.869315 1.150328 6.987552
v -0.006854 1.150329 4.473047
v 4.838127 1.150328 7.041885
v 3.538153 1.150329 1.927652
v 0.033757 0.000000 -0.314657
v 0.035668 2.269531 -0.312831
vt 0.626409 0.064409
vt 0.548284 0.007647
vt 0.451716 0.007647
vt 0.373591 0.064409
vt 0.343750 0.156250
vt 0.373591 0.248091
vt 0.451716 0.304853
vt 0.548284 0.304853
vt 0.626409 0.248091
vt 0.656250 0.156250
vt 0.375000 0.312500
vt 0.400000 0.312500
vt 0.425000 0.312500
vt 0.450000 0.312500
vt 0.475000 0.312500
vt 0.500000 0.312500
vt 0.525000 0.312500
vt 0.550000 0.312500
vt 0.575000 0.312500
vt 0.600000 0.312500
vt 0.625000 0.312500
vt 0.500000 0.688440
vt 0.500000 0.156250
vn 0.005105 -0.859861 -0.510503
vn 0.005105 -0.859861 -0.510503
vn 0.005105 -0.859861 -0.510503
vn 0.365127 -0.920739 -0.137556
vn 0.365127 -0.920739 -0.137556
vn 0.365127 -0.920739 -0.137556
vn -0.360232 -0.922140 -0.141034
vn -0.360232 -0.922140 -0.141034
vn -0.360232 -0.922140 -0.141034
vn 0.000604 -0.859880 -0.510496
vn 0.000604 -0.859880 -0.510496
vn 0.000604 -0.859880 -0.510496
vn -0.189615 -0.962051 0.196222
vn -0.189615 -0.962051 0.196222
vn -0.189615 -0.962051 0.196222
vn -0.358980 -0.928522 -0.094766
vn -0.358980 -0.928522 -0.094766
vn -0.358980 -0.928522 -0.094766
vn 0.120430 -0.965019 0.232884
vn 0.120430 -0.965019 0.232884
vn 0.120430 -0.965019 0.232884
vn -0.122414 -0.965251 0.230880
vn -0.122414 -0.965251 0.230880
vn -0.122414 -0.965251 0.230880
vn 0.363409 -0.927039 -0.092374
vn 0.363409 -0.927039 -0.092374
vn 0.363409 -0.927039 -0.092374
vn 0.188029 -0.961689 0.199495
vn 0.188029 -0.961689 0.199495
vn 0.188029 -0.961689 0.199495
vn 0.183421 0.963579 0.194606
vn 0.183421 0.963579 0.194606
vn 0.183421 0.963579 0.194606
vn 0.355062 0.930476 -0.090252
vn 0.355062 0.930476 -0.090252
vn 0.355062 0.930476 -0.090252
vn -0.119338 0.967005 0.225079
vn -0.119338 0.967005 0.225079
vn -0.119338 0.967005 0.225079
vn 0.117452 0.966757 0.227125
vn 0.117452 0.966757 0.227125
vn 0.117452 0.966757 0.227125
vn -0.350315 0.932055 -0.092478
vn -0.350315 0.932055 -0.092478
vn -0.350315 0.932055 -0.092478
vn -0.184852 0.963969 0.191293
vn -0.184852 0.963969 0.191293
vn -0.184852 0.963969 0.191293
vn 0.000591 0.866128 -0.499821
vn 0.000591 0.866128 -0.499821
vn 0.000591 0.866128 -0.499821
vn -0.351624 0.925964 -0.137664
vn -0.351624 0.925964 -0.137664
vn -0.351624 0.925964 -0.137664
vn 0.356828 0.924447 -0.134430
vn 0.356828 0.924447 -0.134430
vn 0.356828 0.924447 -0.134430
vn 0.004998 0.866108 -0.499832
vn 0.004998 0.866108 -0.499832
vn 0.004998 0.866108 -0.499832
s off
g pCylinder1
f 25/57/121 35/68/122 26/58/123
f 26/58/124 35/68/125 27/59/126
f 27/59/127 35/68/128 28/60/129
f 28/60/130 35/68/131 29/61/132
f 29/61/133 35/68/134 30/62/135
f 30/62/136 35/68/137 31/63/138
f 31/63/139 35/68/140 32/64/141
f 32/64/142 35/68/143 33/65/144
f 33/65/145 35/68/146 34/66/147
f 34/66/148 35/68/149 25/67/150
f 25/47/151 36/69/152 34/56/153
f 34/56/154 36/69/155 33/55/156
f 33/55/157 36/69/158 32/54/159
f 32/54/160 36/69/161 31/53/162
f 31/53/163 36/69/164 30/52/165
f 30/52/166 36/69/167 29/51/168
f 29/51/169 36/69/170 28/50/171
f 28/50/172 36/69/173 27/49/174
f 27/49/175 36/69/176 26/48/177
f 26/48/178 36/69/179 25/47/180

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
v 0 -100 -100
v 0 -100 100
v 0 100 -100
v 0 100 100
vt 0 0
vt 20 0
vt 0 20
vt 20 20
vn 0 1 0
s off
f 1/3/1 3/1/1 4/2/1
f 1/3/1 4/2/1 2/4/1
f 1/3/1 4/2/1 3/1/1
f 1/3/1 2/4/1 4/2/1

View File

@ -1,33 +1,13 @@
#version 410 core
uniform vec3 objectColor;
uniform vec4 objectColorTransparent;
uniform vec3 lightDir;
in vec3 interpNormal;
out vec4 Color;
float near = 00.01f;
float far = 100.0f;
float linearizeDepth(float depth)
{
return (2.0 * near * far) / (far + near - (depth * 2.0 - 1.0) * (far - near));
}
float logisticDepth(float depth, float steepness, float offset)
{
float zVal = linearizeDepth(depth);
return (1 / (1 + exp(-steepness * (zVal - offset))));
}
void main()
{
vec3 normal = normalize(interpNormal);
float diffuse = max(dot(normal, -lightDir), 0.0);
//gl_FragColor = vec4(objectColor * diffuse, 1.0);
float depth = logisticDepth(gl_FragCoord.z, 0.5f, 4.0f);
Color = objectColorTransparent * diffuse * (1.0f - depth) + vec4(depth * vec3(5.0f/255.0f, 35.0f/255.0f, 95.0f/255.0f), 1.0f);
gl_FragColor = vec4(objectColor * diffuse, 1.0);
}

View File

@ -1,17 +0,0 @@
#version 410 core
uniform vec3 objectColor;
uniform vec4 objectColorTransparent;
uniform vec3 lightDir;
in vec3 interpNormal;
out vec4 Color;
void main()
{
vec3 normal = normalize(interpNormal);
float diffuse = max(dot(normal, -lightDir), 0.0);
//gl_FragColor = vec4(objectColor * diffuse, 1.0);
Color = objectColorTransparent * diffuse;
}

View File

@ -1,16 +0,0 @@
#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;
}

View File

@ -6,27 +6,11 @@ uniform vec3 lightDir;
in vec3 interpNormal;
in vec2 interpTexCoord;
float near = 00.01f;
float far = 100.0f;
float linearizeDepth(float depth)
{
return (2.0 * near * far) / (far + near - (depth * 2.0 - 1.0) * (far - near));
}
float logisticDepth(float depth, float steepness, float offset)
{
float zVal = linearizeDepth(depth);
return (1 / (1 + exp(-steepness * (zVal - offset))));
}
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);
float depth = logisticDepth(gl_FragCoord.z, 0.5f, 4.0f);
gl_FragColor = vec4(color * diffuse, 1.0) * (1.0f - depth) + vec4(depth * vec3(5.0f/255.0f, 35.0f/255.0f, 95.0f/255.0f), 1.0f);
}
gl_FragColor = vec4(color * diffuse, 1.0);
}

View File

@ -1,28 +0,0 @@
#version 330 core
out vec4 FragColor;
in vec3 texCoords;
uniform samplerCube skybox;
float near = 00.01f;
float far = 10.f;
float linearizeDepth(float depth)
{
return (2.0 * near * far) / (far + near - (depth * 2.0 - 1.0) * (far - near));
}
float logisticDepth(float depth, float steepness, float offset)
{
float zVal = linearizeDepth(depth);
return (1 / (1 + exp(-steepness * (zVal - offset))));
}
void main()
{
float depth = logisticDepth(gl_FragCoord.z, 0.5f, 4.0f);
FragColor = texture(skybox, texCoords) * (1.0f - depth) + vec4(depth * vec3(5.0f/255.0f, 35.0f/255.0f, 95.0f/255.0f), 1.0f);
}

View File

@ -1,16 +0,0 @@
#version 330 core
layout (location = 0) in vec3 aPos;
out vec3 texCoords;
uniform mat4 projection;
uniform mat4 view;
void main()
{
vec4 pos = projection * view * vec4(aPos, 1.0f);
// Having z equal w will always result in a depth of 1.0f
gl_Position = vec4(pos.x, pos.y, pos.w, pos.w);
// We want to flip the z axis due to the different coordinate systems (left hand vs right hand)
texCoords = vec3(aPos.x, aPos.y, -aPos.z);
}

View File

@ -1,48 +0,0 @@
#include "Physics.h"
#define PX_RELEASE(x) if(x) { x->release(); x = NULL; }
Physics::Physics(float gravity)
{
foundation = PxCreateFoundation(PX_PHYSICS_VERSION, allocator, errorCallback);
physics = PxCreatePhysics(PX_PHYSICS_VERSION, *foundation, PxTolerancesScale(), true);
PxSceneDesc sceneDesc(physics->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -gravity, 0.0f);
dispatcher = PxDefaultCpuDispatcherCreate(2);
sceneDesc.cpuDispatcher = dispatcher;
sceneDesc.filterShader = PxDefaultSimulationFilterShader;
scene = physics->createScene(sceneDesc);
}
Physics::Physics(float gravity,
PxSimulationFilterShader simulationFilterShader,
PxSimulationEventCallback* simulationEventCallback)
{
foundation = PxCreateFoundation(PX_PHYSICS_VERSION, allocator, errorCallback);
physics = PxCreatePhysics(PX_PHYSICS_VERSION, *foundation, PxTolerancesScale(), true);
PxSceneDesc sceneDesc(physics->getTolerancesScale());
sceneDesc.gravity = PxVec3(0.0f, -gravity, 0.0f);
dispatcher = PxDefaultCpuDispatcherCreate(2);
sceneDesc.cpuDispatcher = dispatcher;
sceneDesc.filterShader = simulationFilterShader;
sceneDesc.kineKineFilteringMode = PxPairFilteringMode::eKEEP; // So kin-kin contacts with be reported
sceneDesc.staticKineFilteringMode = PxPairFilteringMode::eKEEP; // So static-kin constacts will be reported
sceneDesc.simulationEventCallback = simulationEventCallback;
scene = physics->createScene(sceneDesc);
}
Physics::~Physics()
{
PX_RELEASE(scene);
PX_RELEASE(dispatcher);
PX_RELEASE(physics);
PX_RELEASE(foundation);
}
void Physics::step(float dt)
{
scene->simulate(dt);
scene->fetchResults(true);
}

View File

@ -1,24 +0,0 @@
#pragma once
#include "PxPhysicsAPI.h"
using namespace physx;
class Physics
{
public:
Physics(float gravity);
Physics(float gravity,
PxSimulationFilterShader simulationFilterShader,
PxSimulationEventCallback* simulationEventCallback);
virtual ~Physics();
PxPhysics* physics = nullptr;
PxScene* scene = nullptr;
void step(float dt);
private:
PxDefaultAllocator allocator;
PxDefaultErrorCallback errorCallback;
PxFoundation* foundation = nullptr;
PxDefaultCpuDispatcher* dispatcher = nullptr;
};

View File

@ -10,35 +10,14 @@
#include "Render_Utils.h"
#include "Camera.h"
#include "Texture.h"
#include "SOIL/SOIL.h"
float width = 1000;
float height = 1000;
float moveTime = glutGet(GLUT_ELAPSED_TIME) / 10000000000.0f;
float rotateStar = 0.0f;
int score = 0;
GLuint programColor;
GLuint programColorTransparent;
GLuint programTexture;
GLuint programSkybox;
Core::Shader_Loader shaderLoader;
Core::RenderContext shipContext;
Core::RenderContext fishContext;
Core::RenderContext skyboxContext;
Core::RenderContext bubbleContext;
Core::RenderContext terrainContext;
Core::RenderContext planeContext;
Core::RenderContext plant_1_Context;
Core::RenderContext plant_2_Context;
Core::RenderContext plant_3_Context;
Core::RenderContext plant_4_Context;
Core::RenderContext plant_5_Context;
Core::RenderContext starContext;
Core::RenderContext sphereContext;
glm::vec3 cameraPos = glm::vec3(0, 0, 5);
glm::vec3 cameraDir; // Wektor "do przodu" kamery
@ -47,46 +26,13 @@ float cameraAngle = 0;
glm::mat4 cameraMatrix, perspectiveMatrix;
glm::vec3 lightDir = glm::normalize(glm::vec3(1.0f, -0.9f, -1.0f));
glm::vec3 lightDir = glm::normalize(glm::vec3(1.0f, -0.9f, 1.0f));
glm::quat rotation = glm::quat(1, 0, 0, 0);
GLuint textureFish;
GLuint textureBubble;
GLuint textureShip;
GLuint textureGround;
GLuint textureRock;
glm::vec3 fishLocation[50];
bool fishChangeDirection[50];
float fishRadianDirection[50];
glm::mat4 fishTransformation[50];
int fishDirection[50];
// 0 - prosto, 1 - prawo, 2 - do ty³u, 3 - lewo
glm::vec3 bubbleLocation[100];
glm::vec3 plant_1_location[30];
glm::vec3 plant_2_location[30];
glm::vec3 plant_3_location[30];
glm::vec3 plant_4_location[30];
glm::vec3 plant_5_location[30];
float plantSize[4] = { 0.f, 0.2f, 0.3f, 0.4f };
glm::vec3 starLocation[3] =
{
glm::vec3(0.f, -4.f, -7.f),
glm::vec3(2.f, -5.f, -5.f),
glm::vec3(-1.f, -5.f, -2.f)
};
bool starCatched[3] =
{
false,
false,
false
};
GLuint textureAsteroid;
glm::vec3 planetLocation[10];
float mouseXPosition;
float mouseYPosition;
@ -100,47 +46,6 @@ glm::quat rotation_x;
float dy = 0;
float dx = 0;
// SKYBOX
unsigned int skyboxVAO, skyboxVBO, skyboxEBO;
unsigned int cubemapTexture;
float skyboxVertices[] =
{
// Coordinates
-1.0f, -1.0f, 1.0f,// 7--------6
1.0f, -1.0f, 1.0f,// /| /|
1.0f, -1.0f, -1.0f,// 4--------5 |
-1.0f, -1.0f, -1.0f,// | | | |
-1.0f, 1.0f, 1.0f,// | 3------|-2
1.0f, 1.0f, 1.0f,// |/ |/
1.0f, 1.0f, -1.0f,// 0--------1
-1.0f, 1.0f, -1.0f
};
unsigned int skyboxIndices[] =
{
// Right
1, 2, 6,
6, 5, 1,
// Left
0, 4, 7,
7, 3, 0,
// Top
4, 5, 6,
6, 7, 4,
// Bottom
0, 3, 2,
2, 1, 0,
// Back
0, 1, 5,
5, 4, 0,
// Front
3, 7, 6,
6, 2, 3
};
void keyboard(unsigned char key, int x, int y)
{
@ -175,7 +80,7 @@ glm::mat4 createCameraMatrix()
dy += delta_y;
dx += delta_x;
//printf("%f", delta_y);
printf("%f", delta_y);
delta_x = 0;
delta_y = 0;
@ -229,196 +134,6 @@ void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuin
glUseProgram(0);
}
void drawObjectTransparent(Core::RenderContext context, glm::mat4 modelMatrix, glm::vec4 color)
{
GLuint program = programColor;
glUseProgram(program);
glUniform4f(glGetUniformLocation(program, "objectColorTransparent"), color.x, color.y, color.z, color.a);
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
Core::DrawContext(context);
glUseProgram(0);
}
void drawObjectTransparentBubble(Core::RenderContext context, glm::mat4 modelMatrix, glm::vec4 color)
{
GLuint program = programColorTransparent;
glUseProgram(program);
glUniform4f(glGetUniformLocation(program, "objectColorTransparent"), color.x, color.y, color.z, color.a);
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
Core::DrawContext(context);
glUseProgram(0);
}
void drawObjectSkybox(Core::RenderContext context)
{
glUseProgram(programSkybox);
glUniform1i(glGetUniformLocation(programSkybox, "skybox"), 0);
glDepthFunc(GL_LEQUAL);
glm::mat4 view = glm::mat4(1.0f);
glm::mat4 projection = glm::mat4(1.0f);
// We make the mat4 into a mat3 and then a mat4 again in order to get rid of the last row and column
// The last row and column affect the translation of the skybox (which we don't want to affect)
view = glm::mat4(glm::mat3(glm::lookAt(cameraPos, cameraPos + cameraDir, glm::vec3(0, 1, 0))));
projection = glm::perspective(glm::radians(45.0f), (float)width / height, 0.1f, 100.0f);
glUniformMatrix4fv(glGetUniformLocation(programSkybox, "view"), 1, GL_FALSE, glm::value_ptr(view));
glUniformMatrix4fv(glGetUniformLocation(programSkybox, "projection"), 1, GL_FALSE, glm::value_ptr(projection));
// Draws the cubemap as the last object so we can save a bit of performance by discarding all fragments
// where an object is present (a depth of 1.0f will always fail against any object's depth value)
glBindVertexArray(skyboxVAO);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
// Switch back to the normal depth function
glDepthFunc(GL_LESS);
}
void drawPlaneTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuint textureId)
{
modelMatrix = glm::translate(modelMatrix, glm::vec3(-10.f, 0.f, 0.f));
GLuint program = programTexture;
glUseProgram(program);
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
Core::SetActiveTexture(textureId, "textureSampler", program, 0);
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "modelViewProjectionMatrix"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
Core::DrawContext(context);
glUseProgram(0);
}
glm::vec3 moveBubble(glm::vec3 location, int index)
{
location.y = location.y + moveTime * 4;
if (location.y >= 10)
{
location = glm::ballRand(15.0);
location.y = -10;
}
bubbleLocation[index] = location;
return bubbleLocation[index];
}
glm::mat4 moveFish(glm::vec3 location, int index)
{
// zmiana kierunku
if (fishChangeDirection[index] == true)
{
fishDirection[index] = (fishDirection[index] + 1) % 4;
fishChangeDirection[index] = false;
}
// ruch
if (fishDirection[index] == 0)
{
if (location.z < -20)
{
fishChangeDirection[index] = true;
}
else {
location.z = location.z - moveTime * 10;
fishRadianDirection[index] = 180.0f;
}
}
else if (fishDirection[index] == 1)
{
if (location.x > 20)
{
fishChangeDirection[index] = true;
}
else {
location.x = location.x + moveTime * 10;
fishRadianDirection[index] = 90.0f;
}
}
else if (fishDirection[index] == 2)
{
if (location.z < -20)
{
fishChangeDirection[index] = true;
}
else {
location.z = location.z - moveTime * 10;
fishRadianDirection[index] = 0.0f;
}
}
else
{
if (location.x < -20)
{
fishChangeDirection[index] = true;
}
else {
location.x = location.x - moveTime * 10;
fishRadianDirection[index] = 270.0f;
}
}
fishLocation[index] = location;
fishTransformation[index] = glm::translate(fishLocation[index]) * glm::rotate(glm::radians(fishRadianDirection[index]), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.002f));
return fishTransformation[index];
}
void checkGettingStar(int index) {
bool xCorrect = false;
bool yCorrect = false;
bool zCorrect = false;
if (cameraPos.x < starLocation[index].x + 1 && cameraPos.x > starLocation[index].x - 1)
{
xCorrect = true;
}
if (cameraPos.y < starLocation[index].y + 1 && cameraPos.y > starLocation[index].y - 1)
{
yCorrect = true;
}
if (cameraPos.z < starLocation[index].z + 1 && cameraPos.z > starLocation[index].z - 1)
{
zCorrect = true;
}
if (xCorrect && yCorrect && zCorrect)
{
starCatched[index] = true;
score = score + 1;
std::cout << " Brawo, zebrales " << score << " gwiazdke" << std::endl;
}
}
void renderScene()
{
// Aktualizacja macierzy widoku i rzutowania
@ -426,67 +141,23 @@ void renderScene()
perspectiveMatrix = Core::createPerspectiveMatrix();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClearColor(0.0f, 0.1f, 0.3f, 1.0f);
// rysowanie statku
glm::mat4 shipInitialTransformation = glm::translate(glm::vec3(0, 0, 0)) * glm::rotate(glm::radians(270.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.0015f));
glm::mat4 shipInitialTransformation = glm::translate(glm::vec3(0, 0, 0)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.5f));
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir) * glm::rotate(-cameraAngle, glm::vec3(0, 1, 0)) * shipInitialTransformation;
drawObjectTexture(shipContext, shipModelMatrix, textureShip);
drawObjectColor(shipContext, shipModelMatrix, glm::vec3(0.6f));
// rysowanie ryb
for (int i = 0; i < 50; i++)
for (int i = 0; i < 10; i++)
{
//glm::mat4 fishInitialTransformation = glm::translate(fishLocation[i]) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.005f));
//drawObjectTexture(fishContext, fishInitialTransformation, textureFish);
drawObjectTexture(fishContext, moveFish(fishLocation[i], i), textureFish);
glm::mat4 fishInitialTransformation = glm::translate(planetLocation[i]) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.01f));
drawObjectTexture(sphereContext, fishInitialTransformation, textureAsteroid);
}
// narysuj teren z pliku terenu
//drawObjectTexture(terrainContext, glm::translate(glm::vec3(0, -10, 0)) * glm::rotate(glm::radians(0.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(1.f)), textureGround);
//drawObjectTexture(terrainContext, glm::translate(glm::vec3(130, -20, 0)) * glm::rotate(glm::radians(90.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(1.5f)), textureGround);
//drawObjectTexture(terrainContext, glm::translate(glm::vec3(-130, -20, 0)) * glm::rotate(glm::radians(90.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(1.5f)), textureGround);
// narysuj p³ask¹ powierzchniê
drawPlaneTexture(planeContext, glm::rotate(glm::radians(120.f), glm::vec3(1.f, 1.f, 1.f)), textureGround);
// rysowanie gwiazdek
for (int i = 0; i < 3; i++)
{
checkGettingStar(i);
if (starCatched[i])
{
starLocation[i] = glm::vec3(0, -20, 0);
}
drawObjectTransparent(starContext, glm::translate(starLocation[i]) * glm::rotate(glm::radians(90.0f), glm::vec3(1, 0, 0)) * glm::rotate(glm::radians(rotateStar), glm::vec3(0, 0, 1)) * glm::scale(glm::vec3(0.02f)), glm::vec4(1.f, 1.f, 0.1f, 1.f));
rotateStar = rotateStar + 1.0f;
}
// rysowanie roœlin
for (int i = 0; i < 30; i++)
{
drawObjectTransparent(plant_1_Context, glm::translate(plant_1_location[i]) * glm::scale(glm::vec3(plantSize[i % 4] - 0.1f)), glm::vec4(0.9f, 0.4f, 1.f, 1.f));
drawObjectTransparent(plant_2_Context, glm::translate(plant_2_location[i]) * glm::rotate(glm::radians(90.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(plantSize[i % 4] - 0.2f)), glm::vec4(0.9f, 0.2f, 0.1f, 1.f));
drawObjectTransparent(plant_3_Context, glm::translate(plant_3_location[i]) * glm::rotate(glm::radians(270.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(plantSize[i % 4] - 0.3f)), glm::vec4(0.9f, 0.5f, 0.2f, 1.f));
drawObjectTransparent(plant_4_Context, glm::translate(plant_4_location[i]) * glm::rotate(glm::radians(270.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(plantSize[i % 4] - 0.2f)), glm::vec4(0.8f, 0.5f, 0.4f, 1.f));
drawObjectTransparent(plant_5_Context, glm::translate(plant_5_location[i]) * glm::rotate(glm::radians(270.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.03f)), glm::vec4(0.6f, 0.8f, 0.3f, 1.f));
}
// rysowanie skyboxa
drawObjectSkybox(skyboxContext);
// rysowanie b¹belków powietrza
for (int i = 0; i < 100; i++)
{
drawObjectTransparentBubble(bubbleContext, glm::translate(moveBubble(bubbleLocation[i], i)) * glm::rotate(glm::radians(0.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.05f)), glm::vec4(1.f, 1.f, 1.f, 0.7f));
}
glutSwapBuffers();
}
void loadModelToContext(std::string path, Core::RenderContext& context)
{
Assimp::Importer import;
@ -502,147 +173,24 @@ void loadModelToContext(std::string path, Core::RenderContext& context)
void init()
{
for (int i = 0; i < 50; i++)
for (int i = 0; i < 10; i++)
{
fishLocation[i] = glm::ballRand(30.0);
fishDirection[i] = rand() % 4 + 0;
if (fishDirection[i] == 0)
{
fishRadianDirection[i] = 180.0f;
}
else if (fishDirection[i] == 1)
{
fishRadianDirection[i] = 90.0f;
}
else if (fishDirection[i] == 3)
{
fishRadianDirection[i] = 0.0f;
}
else
{
fishRadianDirection[i] = 270.0f;
}
fishChangeDirection[i] = false;
}
for (int i = 0; i < 100; i++)
{
bubbleLocation[i] = glm::ballRand(15.0);
}
for (int i = 0; i < 30; i++)
{
plant_1_location[i] = glm::ballRand(20.0);
plant_1_location[i].y = -10.f;
plant_2_location[i] = glm::ballRand(20.0);
plant_2_location[i].y = -10.1f;
plant_3_location[i] = glm::ballRand(20.0);
plant_3_location[i].y = -10.f;
plant_4_location[i] = glm::ballRand(20.0);
plant_4_location[i].y = -10.3f;
plant_5_location[i] = glm::ballRand(20.0);
plant_5_location[i].y = -10.3f;
planetLocation[i] = glm::ballRand(20.0);
}
srand(time(0));
glEnable(GL_DEPTH_TEST);
programColor = shaderLoader.CreateProgram("shaders/shader_color.vert", "shaders/shader_color.frag");
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
programSkybox = shaderLoader.CreateProgram("shaders/skybox.vert", "shaders/skybox.frag");
programColorTransparent = shaderLoader.CreateProgram("shaders/shader_color_transparent.vert", "shaders/shader_color_transparent.frag");
loadModelToContext("models/submarine.obj", shipContext);
loadModelToContext("models/TropicalFish01.obj", fishContext);
loadModelToContext("models/sphere.obj", bubbleContext);
loadModelToContext("models/seafloor.obj", terrainContext);
loadModelToContext("models/plane.obj", planeContext);
loadModelToContext("models/21488_Tree_Coral_v2_NEW.obj", plant_1_Context);
loadModelToContext("models/18765_Pencil_sea_urchin_V1.obj", plant_2_Context);
loadModelToContext("models/18764_Common_N_Atlantic_Starfish_v1.obj", plant_3_Context);
loadModelToContext("models/20944_Pillar_Coral_v1.obj", plant_4_Context);
loadModelToContext("models/21487_Gorgonian_Soft_Coral_v1.obj", plant_5_Context);
loadModelToContext("models/star.obj", starContext);
textureFish = Core::LoadTexture("textures/TropicalFish01.jpg");
textureBubble = Core::LoadTexture("textures/bubble.png");
textureShip = Core::LoadTexture("textures/txt-subm-1.jpg");
textureGround = Core::LoadTexture("textures/ground.jpg");
textureRock = Core::LoadTexture("textures/rock.jpg");
// SKYBOX
// Create VAO, VBO, and EBO for the skybox
glGenVertexArrays(1, &skyboxVAO);
glGenBuffers(1, &skyboxVBO);
glGenBuffers(1, &skyboxEBO);
glBindVertexArray(skyboxVAO);
glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyboxEBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(skyboxIndices), &skyboxIndices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
// All the faces of the cubemap (make sure they are in this exact order)
std::string facesCubemap[6] =
{
"textures/skybox/uw_rt.jpg",
"textures/skybox/uw_lf.jpg",
"textures/skybox/uw_up.jpg",
"textures/skybox/uw_dn.jpg",
"textures/skybox/uw_bk.jpg",
"textures/skybox/uw_ft.jpg"
};
// Creates the cubemap texture object
glGenTextures(1, &cubemapTexture);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// These are very important to prevent seams
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
// This might help with seams on some systems
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// Cycles through all the textures and attaches them to the cubemap object
for (unsigned int i = 0; i < 6; i++)
{
int width, height, nrChannels;
unsigned char* data = SOIL_load_image(facesCubemap[i].c_str(), &width, &height, &nrChannels, 0);
if (data)
{
//stbi_set_flip_vertically_on_load(false);
glTexImage2D
(
GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
0,
GL_RGB,
width,
height,
0,
GL_RGB,
GL_UNSIGNED_BYTE,
data
);
SOIL_free_image_data(data);
}
else
{
std::cout << "Failed to load texture: " << facesCubemap[i] << std::endl;
SOIL_free_image_data(data);
}
}
loadModelToContext("models/spaceship.obj", shipContext);
loadModelToContext("models/TropicalFish01.obj", sphereContext);
textureAsteroid = Core::LoadTexture("textures/TropicalFish01.jpg");
}
void shutdown()
{
shaderLoader.DeleteProgram(programColor);
shaderLoader.DeleteProgram(programTexture);
shaderLoader.DeleteProgram(programSkybox);
}
void idle()
@ -655,13 +203,9 @@ int main(int argc, char** argv)
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(200, 200);
glutInitWindowSize(width, height);
glutInitWindowSize(600, 600);
glutCreateWindow("Projekt - Grafika komputerowa");
// dodanie przezroczystoœci obiektów
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glewInit();
init();
@ -670,7 +214,6 @@ int main(int argc, char** argv)
glutDisplayFunc(renderScene);
glutIdleFunc(idle);
glutMainLoop();
shutdown();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 KiB

File diff suppressed because it is too large Load Diff