Search Y function

This commit is contained in:
unknown 2022-02-18 21:37:53 +01:00
parent 62b30b2f0f
commit ffd4452c3a
36 changed files with 4096 additions and 435 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project> <Project>
<ProjectOutputs> <ProjectOutputs>
<ProjectOutput> <ProjectOutput>
<FullPath>C:\Users\pyron\Documents\grafika\submarine\Debug\grk-cw2.exe</FullPath> <FullPath>C:\Users\pyron\Documents\grafika\projekt_grafika\Debug\grk-cw2.exe</FullPath>
</ProjectOutput> </ProjectOutput>
</ProjectOutputs> </ProjectOutputs>
<ContentFiles /> <ContentFiles />

View File

@ -1 +1 @@
 grk-cw2.vcxproj -> C:\Users\pyron\Documents\grafika\submarine\Debug\grk-cw2.exe  grk-cw2.vcxproj -> C:\Users\pyron\Documents\grafika\projekt_grafika\Debug\grk-cw2.exe

View File

@ -1,2 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0: PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|C:\Users\pyron\Documents\grafika\submarine\| Debug|Win32|C:\Users\pyron\Documents\grafika\projekt_grafika\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
cw 2/models/23129.txt Normal file
View File

View File

@ -1,414 +0,0 @@
# Blender v3.0.0 OBJ File: 'untitled.blend'
# www.blender.org
o Plane_Plane.001
v -11.557339 0.000000 11.557339
v 11.557339 0.000000 11.557339
v -11.557339 0.000000 -11.557339
v 11.557339 0.000000 -11.557339
v -11.557339 0.000000 -9.456004
v -11.557339 0.000000 -7.354670
v -11.557339 0.000000 -5.253335
v -11.557339 0.000000 -3.152001
v -11.557339 0.000000 -1.050667
v -11.557339 0.000000 1.050667
v -11.557339 0.000000 3.152002
v -11.557339 0.000000 5.253336
v -11.557339 0.000000 7.354670
v -11.557339 0.000000 9.456004
v -9.456004 0.000000 11.557339
v -7.354670 0.000000 11.557339
v -5.253335 0.000000 11.557339
v -3.152001 0.000000 11.557339
v -1.050667 0.000000 11.557339
v 1.050667 0.000000 11.557339
v 3.152002 0.000000 11.557339
v 5.253336 0.000000 11.557339
v 7.354670 0.000000 11.557339
v 9.456004 0.000000 11.557339
v 11.557339 0.000000 9.456004
v 11.557339 0.000000 7.354670
v 11.557339 0.000000 5.253335
v 11.557339 0.000000 3.152001
v 11.557339 0.000000 1.050667
v 11.557339 0.000000 -1.050667
v 11.557339 0.000000 -3.152002
v 11.557339 0.000000 -5.253336
v 11.557339 0.000000 -7.354670
v 11.557339 0.000000 -9.456004
v 9.456004 0.000000 -11.557339
v 7.354670 0.000000 -11.557339
v 5.253335 0.000000 -11.557339
v 3.152001 0.000000 -11.557339
v 1.050667 0.000000 -11.557339
v -1.050667 0.000000 -11.557339
v -3.152002 0.000000 -11.557339
v -5.253336 0.000000 -11.557339
v -7.354670 0.000000 -11.557339
v -9.456004 0.000000 -11.557339
v -9.456004 0.000000 9.456004
v -9.456004 0.000000 7.354670
v -9.456004 0.000000 5.253335
v -9.456004 0.000000 3.152001
v -9.456004 0.000000 1.050667
v -9.456004 0.000000 -1.050667
v -9.456004 0.000000 -3.152002
v -9.456004 0.000000 -5.253336
v -9.456004 0.000000 -7.354670
v -9.456004 0.000000 -9.456004
v -7.354670 0.000000 9.456004
v -7.354670 0.000000 7.354670
v -7.354670 0.000000 5.253335
v -7.354670 0.000000 3.152001
v -7.354670 0.000000 1.050667
v -7.354670 0.000000 -1.050667
v -7.354670 0.000000 -3.152002
v -7.354670 0.000000 -5.253336
v -7.354670 0.000000 -7.354670
v -7.354670 0.000000 -9.456004
v -5.253335 0.000000 9.456004
v -5.253335 0.000000 7.354670
v -5.253335 0.000000 5.253335
v -5.253335 0.000000 3.152001
v -5.253335 0.000000 1.050667
v -5.253335 0.000000 -1.050667
v -5.253335 0.000000 -3.152002
v -5.253335 0.000000 -5.253336
v -5.253335 0.000000 -7.354670
v -5.253335 0.000000 -9.456004
v -3.152001 0.000000 9.456004
v -3.152001 0.000000 7.354670
v -3.152001 0.000000 5.253335
v -3.152001 0.000000 3.152001
v -3.152001 0.000000 1.050667
v -3.152001 0.000000 -1.050667
v -3.152001 0.000000 -3.152002
v -3.152001 0.000000 -5.253336
v -3.152001 0.000000 -7.354670
v -3.152001 0.000000 -9.456004
v -1.050667 0.000000 9.456004
v -1.050667 0.000000 7.354670
v -1.050667 0.000000 5.253335
v -1.050667 0.000000 3.152001
v -1.050667 0.000000 1.050667
v -1.050667 0.000000 -1.050667
v -1.050667 0.000000 -3.152002
v -1.050667 0.000000 -5.253336
v -1.050667 0.000000 -7.354670
v -1.050667 0.000000 -9.456004
v 1.050667 0.000000 9.456004
v 1.050667 0.000000 7.354670
v 1.050667 0.000000 5.253335
v 1.050667 0.000000 3.152001
v 1.050667 0.000000 1.050667
v 1.050667 0.000000 -1.050667
v 1.050667 0.000000 -3.152002
v 1.050667 0.000000 -5.253336
v 1.050667 0.000000 -7.354670
v 1.050667 0.000000 -9.456004
v 3.152002 0.000000 9.456004
v 3.152002 0.000000 7.354670
v 3.152002 0.000000 5.253335
v 3.152002 0.000000 3.152001
v 3.152002 0.000000 1.050667
v 3.152002 0.000000 -1.050667
v 3.152002 0.000000 -3.152002
v 3.152002 0.000000 -5.253336
v 3.152002 0.000000 -7.354670
v 3.152001 0.000000 -9.456004
v 5.253336 0.000000 9.456004
v 5.253336 0.000000 7.354670
v 5.253336 0.000000 5.253335
v 5.253336 0.000000 3.152001
v 5.253336 0.000000 1.050667
v 5.253336 0.000000 -1.050667
v 5.253336 0.000000 -3.152002
v 5.253336 0.000000 -5.253336
v 5.253336 0.000000 -7.354670
v 5.253335 0.000000 -9.456004
v 7.354670 0.000000 9.456004
v 7.354670 0.000000 7.354670
v 7.354670 0.000000 5.253335
v 7.354670 0.000000 3.152001
v 7.354670 0.000000 1.050667
v 7.354670 0.000000 -1.050667
v 7.354670 0.000000 -3.152002
v 7.354670 0.000000 -5.253336
v 7.354670 0.000000 -7.354670
v 7.354670 0.000000 -9.456004
v 9.456004 0.000000 9.456004
v 9.456004 0.000000 7.354670
v 9.456004 0.000000 5.253335
v 9.456004 0.000000 3.152001
v 9.456004 0.000000 1.050667
v 9.456004 0.000000 -1.050667
v 9.456004 0.000000 -3.152002
v 9.456004 0.000000 -5.253336
v 9.456004 0.000000 -7.354670
v 9.456004 0.000000 -9.456004
vt 0.909091 0.909091
vt 1.000000 0.909091
vt 1.000000 1.000000
vt 0.909091 1.000000
vt 0.000000 0.909091
vt 0.090909 0.909091
vt 0.090909 1.000000
vt 0.000000 1.000000
vt 0.181818 0.909091
vt 0.181818 1.000000
vt 0.272727 0.909091
vt 0.272727 1.000000
vt 0.363636 0.909091
vt 0.363636 1.000000
vt 0.454545 0.909091
vt 0.454545 1.000000
vt 0.545455 0.909091
vt 0.545455 1.000000
vt 0.636364 0.909091
vt 0.636364 1.000000
vt 0.727273 0.909091
vt 0.727273 1.000000
vt 0.818182 0.909091
vt 0.818182 1.000000
vt 0.000000 0.000000
vt 0.090909 0.000000
vt 0.090909 0.090909
vt 0.000000 0.090909
vt 0.090909 0.181818
vt 0.000000 0.181818
vt 0.090909 0.272727
vt 0.000000 0.272727
vt 0.090909 0.363636
vt 0.000000 0.363636
vt 0.090909 0.454545
vt 0.000000 0.454545
vt 0.090909 0.545455
vt 0.000000 0.545455
vt 0.090909 0.636364
vt 0.000000 0.636364
vt 0.090909 0.727273
vt 0.000000 0.727273
vt 0.090909 0.818182
vt 0.000000 0.818182
vt 0.181818 0.000000
vt 0.181818 0.090909
vt 0.181818 0.181818
vt 0.181818 0.272727
vt 0.181818 0.363636
vt 0.181818 0.454545
vt 0.181818 0.545455
vt 0.181818 0.636364
vt 0.181818 0.727273
vt 0.181818 0.818182
vt 0.272727 0.000000
vt 0.272727 0.090909
vt 0.272727 0.181818
vt 0.272727 0.272727
vt 0.272727 0.363636
vt 0.272727 0.454545
vt 0.272727 0.545455
vt 0.272727 0.636364
vt 0.272727 0.727273
vt 0.272727 0.818182
vt 0.363636 0.000000
vt 0.363636 0.090909
vt 0.363636 0.181818
vt 0.363636 0.272727
vt 0.363636 0.363636
vt 0.363636 0.454545
vt 0.363636 0.545455
vt 0.363636 0.636364
vt 0.363636 0.727273
vt 0.363636 0.818182
vt 0.454545 0.000000
vt 0.454545 0.090909
vt 0.454545 0.181818
vt 0.454545 0.272727
vt 0.454545 0.363636
vt 0.454545 0.454545
vt 0.454545 0.545455
vt 0.454545 0.636364
vt 0.454545 0.727273
vt 0.454545 0.818182
vt 0.545455 0.000000
vt 0.545455 0.090909
vt 0.545455 0.181818
vt 0.545455 0.272727
vt 0.545455 0.363636
vt 0.545455 0.454545
vt 0.545455 0.545455
vt 0.545455 0.636364
vt 0.545455 0.727273
vt 0.545455 0.818182
vt 0.636364 0.000000
vt 0.636364 0.090909
vt 0.636364 0.181818
vt 0.636364 0.272727
vt 0.636364 0.363636
vt 0.636364 0.454545
vt 0.636364 0.545455
vt 0.636364 0.636364
vt 0.636364 0.727273
vt 0.636364 0.818182
vt 0.727273 0.000000
vt 0.727273 0.090909
vt 0.727273 0.181818
vt 0.727273 0.272727
vt 0.727273 0.363636
vt 0.727273 0.454545
vt 0.727273 0.545455
vt 0.727273 0.636364
vt 0.727273 0.727273
vt 0.727273 0.818182
vt 0.818182 0.000000
vt 0.818182 0.090909
vt 0.818182 0.181818
vt 0.818182 0.272727
vt 0.818182 0.363636
vt 0.818182 0.454545
vt 0.818182 0.545455
vt 0.818182 0.636364
vt 0.818182 0.727273
vt 0.818182 0.818182
vt 0.909091 0.000000
vt 0.909091 0.090909
vt 0.909091 0.181818
vt 0.909091 0.272727
vt 0.909091 0.363636
vt 0.909091 0.454545
vt 0.909091 0.545455
vt 0.909091 0.636364
vt 0.909091 0.727273
vt 0.909091 0.818182
vt 1.000000 0.000000
vt 1.000000 0.090909
vt 1.000000 0.181818
vt 1.000000 0.272727
vt 1.000000 0.363636
vt 1.000000 0.454545
vt 1.000000 0.545455
vt 1.000000 0.636364
vt 1.000000 0.727273
vt 1.000000 0.818182
vn 0.0000 1.0000 0.0000
s off
f 144/1/1 34/2/1 4/3/1 35/4/1
f 5/5/1 54/6/1 44/7/1 3/8/1
f 54/6/1 64/9/1 43/10/1 44/7/1
f 64/9/1 74/11/1 42/12/1 43/10/1
f 74/11/1 84/13/1 41/14/1 42/12/1
f 84/13/1 94/15/1 40/16/1 41/14/1
f 94/15/1 104/17/1 39/18/1 40/16/1
f 104/17/1 114/19/1 38/20/1 39/18/1
f 114/19/1 124/21/1 37/22/1 38/20/1
f 124/21/1 134/23/1 36/24/1 37/22/1
f 134/23/1 144/1/1 35/4/1 36/24/1
f 1/25/1 15/26/1 45/27/1 14/28/1
f 14/28/1 45/27/1 46/29/1 13/30/1
f 13/30/1 46/29/1 47/31/1 12/32/1
f 12/32/1 47/31/1 48/33/1 11/34/1
f 11/34/1 48/33/1 49/35/1 10/36/1
f 10/36/1 49/35/1 50/37/1 9/38/1
f 9/38/1 50/37/1 51/39/1 8/40/1
f 8/40/1 51/39/1 52/41/1 7/42/1
f 7/42/1 52/41/1 53/43/1 6/44/1
f 6/44/1 53/43/1 54/6/1 5/5/1
f 15/26/1 16/45/1 55/46/1 45/27/1
f 45/27/1 55/46/1 56/47/1 46/29/1
f 46/29/1 56/47/1 57/48/1 47/31/1
f 47/31/1 57/48/1 58/49/1 48/33/1
f 48/33/1 58/49/1 59/50/1 49/35/1
f 49/35/1 59/50/1 60/51/1 50/37/1
f 50/37/1 60/51/1 61/52/1 51/39/1
f 51/39/1 61/52/1 62/53/1 52/41/1
f 52/41/1 62/53/1 63/54/1 53/43/1
f 53/43/1 63/54/1 64/9/1 54/6/1
f 16/45/1 17/55/1 65/56/1 55/46/1
f 55/46/1 65/56/1 66/57/1 56/47/1
f 56/47/1 66/57/1 67/58/1 57/48/1
f 57/48/1 67/58/1 68/59/1 58/49/1
f 58/49/1 68/59/1 69/60/1 59/50/1
f 59/50/1 69/60/1 70/61/1 60/51/1
f 60/51/1 70/61/1 71/62/1 61/52/1
f 61/52/1 71/62/1 72/63/1 62/53/1
f 62/53/1 72/63/1 73/64/1 63/54/1
f 63/54/1 73/64/1 74/11/1 64/9/1
f 17/55/1 18/65/1 75/66/1 65/56/1
f 65/56/1 75/66/1 76/67/1 66/57/1
f 66/57/1 76/67/1 77/68/1 67/58/1
f 67/58/1 77/68/1 78/69/1 68/59/1
f 68/59/1 78/69/1 79/70/1 69/60/1
f 69/60/1 79/70/1 80/71/1 70/61/1
f 70/61/1 80/71/1 81/72/1 71/62/1
f 71/62/1 81/72/1 82/73/1 72/63/1
f 72/63/1 82/73/1 83/74/1 73/64/1
f 73/64/1 83/74/1 84/13/1 74/11/1
f 18/65/1 19/75/1 85/76/1 75/66/1
f 75/66/1 85/76/1 86/77/1 76/67/1
f 76/67/1 86/77/1 87/78/1 77/68/1
f 77/68/1 87/78/1 88/79/1 78/69/1
f 78/69/1 88/79/1 89/80/1 79/70/1
f 79/70/1 89/80/1 90/81/1 80/71/1
f 80/71/1 90/81/1 91/82/1 81/72/1
f 81/72/1 91/82/1 92/83/1 82/73/1
f 82/73/1 92/83/1 93/84/1 83/74/1
f 83/74/1 93/84/1 94/15/1 84/13/1
f 19/75/1 20/85/1 95/86/1 85/76/1
f 85/76/1 95/86/1 96/87/1 86/77/1
f 86/77/1 96/87/1 97/88/1 87/78/1
f 87/78/1 97/88/1 98/89/1 88/79/1
f 88/79/1 98/89/1 99/90/1 89/80/1
f 89/80/1 99/90/1 100/91/1 90/81/1
f 90/81/1 100/91/1 101/92/1 91/82/1
f 91/82/1 101/92/1 102/93/1 92/83/1
f 92/83/1 102/93/1 103/94/1 93/84/1
f 93/84/1 103/94/1 104/17/1 94/15/1
f 20/85/1 21/95/1 105/96/1 95/86/1
f 95/86/1 105/96/1 106/97/1 96/87/1
f 96/87/1 106/97/1 107/98/1 97/88/1
f 97/88/1 107/98/1 108/99/1 98/89/1
f 98/89/1 108/99/1 109/100/1 99/90/1
f 99/90/1 109/100/1 110/101/1 100/91/1
f 100/91/1 110/101/1 111/102/1 101/92/1
f 101/92/1 111/102/1 112/103/1 102/93/1
f 102/93/1 112/103/1 113/104/1 103/94/1
f 103/94/1 113/104/1 114/19/1 104/17/1
f 21/95/1 22/105/1 115/106/1 105/96/1
f 105/96/1 115/106/1 116/107/1 106/97/1
f 106/97/1 116/107/1 117/108/1 107/98/1
f 107/98/1 117/108/1 118/109/1 108/99/1
f 108/99/1 118/109/1 119/110/1 109/100/1
f 109/100/1 119/110/1 120/111/1 110/101/1
f 110/101/1 120/111/1 121/112/1 111/102/1
f 111/102/1 121/112/1 122/113/1 112/103/1
f 112/103/1 122/113/1 123/114/1 113/104/1
f 113/104/1 123/114/1 124/21/1 114/19/1
f 22/105/1 23/115/1 125/116/1 115/106/1
f 115/106/1 125/116/1 126/117/1 116/107/1
f 116/107/1 126/117/1 127/118/1 117/108/1
f 117/108/1 127/118/1 128/119/1 118/109/1
f 118/109/1 128/119/1 129/120/1 119/110/1
f 119/110/1 129/120/1 130/121/1 120/111/1
f 120/111/1 130/121/1 131/122/1 121/112/1
f 121/112/1 131/122/1 132/123/1 122/113/1
f 122/113/1 132/123/1 133/124/1 123/114/1
f 123/114/1 133/124/1 134/23/1 124/21/1
f 23/115/1 24/125/1 135/126/1 125/116/1
f 125/116/1 135/126/1 136/127/1 126/117/1
f 126/117/1 136/127/1 137/128/1 127/118/1
f 127/118/1 137/128/1 138/129/1 128/119/1
f 128/119/1 138/129/1 139/130/1 129/120/1
f 129/120/1 139/130/1 140/131/1 130/121/1
f 130/121/1 140/131/1 141/132/1 131/122/1
f 131/122/1 141/132/1 142/133/1 132/123/1
f 132/123/1 142/133/1 143/134/1 133/124/1
f 133/124/1 143/134/1 144/1/1 134/23/1
f 24/125/1 2/135/1 25/136/1 135/126/1
f 135/126/1 25/136/1 26/137/1 136/127/1
f 136/127/1 26/137/1 27/138/1 137/128/1
f 137/128/1 27/138/1 28/139/1 138/129/1
f 138/129/1 28/139/1 29/140/1 139/130/1
f 139/130/1 29/140/1 30/141/1 140/131/1
f 140/131/1 30/141/1 31/142/1 141/132/1
f 141/132/1 31/142/1 32/143/1 142/133/1
f 142/133/1 32/143/1 33/144/1 143/134/1
f 143/134/1 33/144/1 34/2/1 144/1/1

2025
cw 2/models/test.obj Normal file

File diff suppressed because it is too large Load Diff

2025
cw 2/models/test.obj.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include <cstdlib> #include <cstdlib>
#include <chrono>
#include "Shader_Loader.h" #include "Shader_Loader.h"
#include "Render_Utils.h" #include "Render_Utils.h"
@ -14,12 +15,12 @@
#include "SOIL/stb_image_aug.h" #include "SOIL/stb_image_aug.h"
#define SIZE 1.0f #define SIZE 1.0f
#define SCREEN_X 1920 #define SCREEN_X 1280
#define SCREEN_Y 1080 #define SCREEN_Y 720
#define SEAWEED_NUM 100 #define SEAWEED_NUM 200
#define FISH_NUM 100 #define FISH_NUM 100
#define PARTICLE_NUM 300 #define PARTICLE_NUM 300
#define GROUND_XY 400 #define GROUND_XY 168
#define GEYSER_NUM 3 #define GEYSER_NUM 3
Core::Shader_Loader shaderLoader; Core::Shader_Loader shaderLoader;
@ -109,6 +110,7 @@ glm::vec3 cameraSide;
glm::vec3 cameraDir; glm::vec3 cameraDir;
glm::vec3 lightDir = glm::normalize(glm::vec3(-0.5, -1, -0.5)); glm::vec3 lightDir = glm::normalize(glm::vec3(-0.5, -1, -0.5));
glm::mat4 cameraMatrix, perspectiveMatrix; glm::mat4 cameraMatrix, perspectiveMatrix;
glm::mat4 groundMatrix;
glm::quat rotation = glm::quat(1, 0, 0, 0); glm::quat rotation = glm::quat(1, 0, 0, 0);
std::vector<glm::vec3> seaweedPosition; std::vector<glm::vec3> seaweedPosition;
@ -122,6 +124,26 @@ void initGround() {
} }
glm::vec3 search_for_y(float objX, float objZ, obj::Model model)
{
float y = 0;
float x = 0;
float z = 0;
float diff = 1000000;
float new_diff = 0;
int test = 0;
for (int j = 0; j < model.vertex.size(); j += 3) {
x = model.vertex[j];
z = model.vertex[j + 2];
new_diff = abs(objX - x) + abs(objZ - z);
if (new_diff < diff) {
diff = new_diff;
y = model.vertex[j + 1];
}
}
return glm::vec3(objX, y, objZ);
}
void keyboard(unsigned char key, int x, int y) void keyboard(unsigned char key, int x, int y)
{ {
float angleSpeed = 0.05f; float angleSpeed = 0.05f;
@ -249,9 +271,10 @@ void initBubbles() {
} }
void initSeaweed() { void initSeaweed() {
for (int i = 0; i < SEAWEED_NUM; i++) { for (int i = 0; i < SEAWEED_NUM; i++) {
auto x = static_cast<float>(rand() % GROUND_XY - (GROUND_XY / 2)); float plantX = static_cast<float>(rand() % (2 * GROUND_XY) - GROUND_XY);
auto z = static_cast<float>(rand() % GROUND_XY - (GROUND_XY / 2)); float plantZ = static_cast<float>(rand() % (2 * GROUND_XY) - GROUND_XY);
seaweedPosition.push_back(glm::vec3(x,0.1f,z)); glm::vec3 plant_pos = search_for_y(plantX, plantZ, groundModel);
seaweedPosition.push_back(plant_pos);
} }
} }
@ -259,8 +282,8 @@ void initFish() {
for (int i = 0; i < FISH_NUM; i++) { for (int i = 0; i < FISH_NUM; i++) {
fish new_fish; fish new_fish;
auto x = static_cast<float>(rand() % GROUND_XY - (GROUND_XY / 2)); auto x = static_cast<float>(rand() % (2* GROUND_XY) - GROUND_XY );
auto z = static_cast<float>(rand() % GROUND_XY - (GROUND_XY / 2)); auto z = static_cast<float>(rand() % (2 * GROUND_XY) - GROUND_XY );
new_fish.position = glm::vec3(x, static_cast<float>(rand() % 40 + 10), z); new_fish.position = glm::vec3(x, static_cast<float>(rand() % 40 + 10), z);
new_fish.rotation = rand() % 4; new_fish.rotation = rand() % 4;
@ -323,14 +346,15 @@ void renderSubmarine()
} }
void renderGround() void renderGround()
{ {
float scale = static_cast<float>(GROUND_XY) / 100.0f;
//glm::mat4 groundMatrix = glm::translate(glm::vec3(0, 0, 0)) * glm::rotate(glm::radians(90.0f), glm::vec3(0, 0, -1)) * glm::scale(glm::vec3(scale)); //groundMatrix = glm::translate(glm::vec3(0, -5, 0)) *glm::scale(glm::vec3(3));
glm::mat4 groundMatrix = glm::translate(glm::vec3(0, -5, 0)) * glm::scale(glm::vec3(3)); groundMatrix = glm::translate(glm::vec3(0, 0, 0));
drawObjectTexture(&groundContext, groundMatrix, groundTexture); drawObjectTexture(&groundContext, groundMatrix, groundTexture);
} }
void renderSeaweed() void renderSeaweed()
{ {
for (int i = 0; i < SEAWEED_NUM; i++) { for (int i = 0; i < SEAWEED_NUM; i++) {
glm::mat4 seaweedMatrix = glm::translate(seaweedPosition[i]); glm::mat4 seaweedMatrix = glm::translate(seaweedPosition[i]);
drawObjectColor(&seaweedContext, seaweedMatrix, glm::vec3(0.1f, 0.6f, 0.1f)); drawObjectColor(&seaweedContext, seaweedMatrix, glm::vec3(0.1f, 0.6f, 0.1f));
} }
@ -339,6 +363,7 @@ void renderFish()
{ {
glm::mat4 fishMatrix; glm::mat4 fishMatrix;
float fishSpeed = 0.05f;
for (int i = 0; i < FISH_NUM; i++) { for (int i = 0; i < FISH_NUM; i++) {
int result = rand() % (20000 - fishList[i].counter); int result = rand() % (20000 - fishList[i].counter);
if (result == 0) if (result == 0)
@ -354,16 +379,16 @@ void renderFish()
switch (fishList[i].rotation) switch (fishList[i].rotation)
{ {
case 0: case 0:
fishList[i].position.z -= 0.008f; fishList[i].position.z -= fishSpeed;
break; break;
case 1: case 1:
fishList[i].position.x -= 0.008f; fishList[i].position.x -= fishSpeed;
break; break;
case 2: case 2:
fishList[i].position.z += 0.008f; fishList[i].position.z += fishSpeed;
break; break;
case 3: case 3:
fishList[i].position.x += 0.008f; fishList[i].position.x += fishSpeed;
break; break;
} }
fishMatrix = glm::translate(fishList[i].position) * glm::rotate(glm::radians(fishList[i].rotation * 90.0f), glm::vec3(0, 1, 0)); fishMatrix = glm::translate(fishList[i].position) * glm::rotate(glm::radians(fishList[i].rotation * 90.0f), glm::vec3(0, 1, 0));
@ -396,7 +421,8 @@ void renderGeyser()
{ {
for (int j = 0; j < GEYSER_NUM; j++) for (int j = 0; j < GEYSER_NUM; j++)
{ {
glm::mat4 gayserModelMatrix = glm::translate(geyserList[j]) * scale(glm::vec3(0.006f)) * scale(glm::vec3(1.0f, 3.0f, 1.0f)); glm::vec3 new_geyser = search_for_y(geyserList[j].x, geyserList[j].z, groundModel);
glm::mat4 gayserModelMatrix = glm::translate(new_geyser) * scale(glm::vec3(0.006f)) * scale(glm::vec3(1.0f, 3.0f, 1.0f));
drawObjectTexture(&geyserContext, gayserModelMatrix, geyserTexture); drawObjectTexture(&geyserContext, gayserModelMatrix, geyserTexture);
} }
} }
@ -454,7 +480,6 @@ void init()
initGeyser(); initGeyser();
initBubbles(); initBubbles();
initGround(); initGround();
} }
void shutdown() void shutdown()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 KiB

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
cw 2/textures/test.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB