fix particles

This commit is contained in:
Damian 2022-02-10 20:14:47 +01:00
commit 0232edc068
6 changed files with 31604 additions and 33 deletions

367
cw 6/models/plant1.obj Normal file
View File

@ -0,0 +1,367 @@
# Blender v2.75 (sub 0) OBJ File: 'Pflanze.blend'
# www.blender.org
mtllib Pflanze.mtl
o Plane.007_Plane.009
v 0.017257 0.002228 -0.002340
v -0.003618 -0.002623 -0.000744
v -0.066132 0.128762 -0.521716
v -0.134185 0.130367 -0.516814
v -0.018185 0.176440 -0.353506
v -0.005913 0.177750 -0.232727
v -0.016649 0.150206 -0.133359
v -0.059505 0.146867 -0.125162
v -0.111631 0.173938 -0.205237
v -0.138452 0.180191 -0.318269
v -0.098806 0.095292 -0.593537
v -0.149056 0.159377 -0.433176
v -0.041377 0.154789 -0.450091
v -0.006771 0.102366 -0.061589
v -0.030130 0.099314 -0.057856
v -0.008522 -0.000338 -0.004206
v 0.007943 0.000897 0.008178
v 0.223240 0.170986 -0.337039
v 0.297657 0.175263 -0.298337
v 0.155267 0.175417 -0.249172
v 0.091529 0.153716 -0.155060
v 0.048529 0.100091 -0.060654
v 0.078389 0.103811 -0.040605
v 0.156116 0.158670 -0.105219
v 0.232966 0.182315 -0.197904
v 0.311769 0.152479 -0.397212
v -0.006585 0.002400 0.012784
v 0.005528 -0.002400 -0.003146
v 0.411260 0.185889 0.258076
v 0.449340 0.186821 0.204968
v 0.254778 0.210672 0.187091
v 0.159108 0.197196 0.122418
v 0.095872 0.158924 0.056140
v 0.116535 0.154757 0.019923
v 0.204370 0.190233 0.028300
v 0.302625 0.209949 0.076974
v 0.486796 0.162853 0.280444
v 0.394816 0.204183 0.140819
v 0.341428 0.201880 0.230590
v 0.041981 0.104737 0.023407
v 0.053895 0.101385 0.004210
v 0.003169 0.002570 -0.016153
v -0.000712 -0.002570 0.004924
v -0.514677 0.199065 -0.048706
v -0.525413 0.200064 0.020447
v -0.330831 0.225605 -0.056467
v -0.208152 0.211174 -0.040880
v -0.115697 0.170190 -0.008089
v -0.117947 0.165727 0.036508
v -0.205939 0.203718 0.070937
v -0.323358 0.224831 0.071889
v -0.597675 0.174397 -0.033590
v -0.442311 0.218657 0.055412
v -0.434659 0.216190 -0.056176
v -0.048379 0.112162 -0.002842
v -0.050490 0.108571 0.021261
v -0.015103 0.002823 -0.006339
v 0.006129 -0.002823 0.003821
v -0.198170 0.218636 0.533337
v -0.127935 0.219733 0.564556
v -0.153658 0.247785 0.336199
v -0.101940 0.231935 0.210608
v -0.040653 0.186922 0.121994
v 0.005982 0.182020 0.137174
v 0.017242 0.223746 0.240339
v -0.015433 0.246935 0.365098
v -0.205954 0.191542 0.625666
v -0.067025 0.240154 0.486484
v -0.183135 0.237444 0.446360
v -0.015779 0.123189 0.052130
v 0.009169 0.119246 0.061282
v 0.004994 0.000641 -0.008067
v -0.008927 -0.000323 0.007140
v 0.300292 0.176382 0.267173
v 0.254620 0.171965 0.337519
v 0.219055 0.179902 0.191353
v 0.133283 0.156656 0.117236
v 0.047804 0.100003 0.061371
v 0.024834 0.099900 0.089294
v 0.077416 0.152896 0.176774
v 0.160398 0.176932 0.263904
v 0.353239 0.155258 0.359644
v -0.002240 0.000500 0.009228
v 0.006278 -0.000375 -0.009551
v -0.358565 0.198934 -0.156601
v -0.336957 0.195659 -0.237696
v -0.257915 0.196122 -0.109460
v -0.154816 0.166482 -0.066072
v -0.059264 0.104259 -0.040867
v -0.046005 0.104417 -0.074505
v -0.120170 0.163016 -0.140017
v -0.224570 0.193876 -0.196616
v -0.438315 0.183755 -0.228783
v 0.004112 0.003760 0.023610
v 0.003334 -0.003760 -0.007732
v 0.755318 0.291222 -0.085406
v 0.749907 0.292682 -0.187642
v 0.494430 0.330048 -0.019044
v 0.314101 0.308936 -0.004494
v 0.171874 0.248978 -0.023657
v 0.161694 0.242449 -0.088184
v 0.277329 0.298028 -0.163922
v 0.445157 0.328916 -0.200572
v 0.869607 0.255132 -0.131991
v 0.620419 0.319883 -0.212730
v 0.642998 0.316273 -0.050664
v 0.073915 0.164086 -0.010939
v 0.069694 0.158834 -0.046082
v -0.111621 0.045667 0.041615
v -0.129294 0.037629 0.035388
v -0.343080 0.290097 0.496567
v -0.465836 0.250335 0.447578
v -0.247680 0.274928 0.350499
v -0.188559 0.209032 0.212861
v -0.139805 0.080068 0.070513
v -0.165621 0.067867 0.060859
v -0.314071 0.157737 0.164776
v -0.401829 0.217836 0.285926
v -0.451366 0.258711 0.605834
v 0.021766 0.009760 0.014113
v -0.019603 -0.009869 -0.001078
v -0.060135 0.016383 0.018677
v -0.074117 0.006389 0.010954
v -0.014591 0.000000 0.002772
v 0.017650 -0.000000 0.002772
v -0.016026 0.329720 -0.600940
v 0.113671 0.329527 -0.621928
v -0.019808 0.314743 -0.431160
v -0.015159 0.261805 -0.260630
v 0.013325 0.163256 -0.110841
v 0.069712 0.165806 -0.113614
v 0.112561 0.261026 -0.258936
v 0.125929 0.316248 -0.439529
v 0.037143 0.318943 -0.758811
vt 0.709755 0.063721
vt 0.808781 0.080183
vt 0.828500 0.217868
vt 0.729899 0.285634
vt 0.177060 0.182686
vt 0.299423 0.160425
vt 0.303825 0.249969
vt 0.179016 0.231599
vt 0.429438 0.090697
vt 0.434440 0.313863
vt 0.583042 0.060757
vt 0.585893 0.315793
vt 0.914355 0.111193
vt -0.002045 0.192802
vt -0.002045 0.236997
vt 0.591493 0.612631
vt 0.599092 0.416014
vt 0.760145 0.432551
vt 0.741914 0.607528
vt 0.060386 0.605593
vt 0.060386 0.562096
vt 0.261091 0.491857
vt 0.257446 0.567930
vt 0.426600 0.434050
vt 0.428334 0.606359
vt 0.878428 0.535798
vt 0.621477 0.939373
vt 0.624334 0.640818
vt 0.828341 0.674934
vt 0.819538 0.907595
vt 0.125212 0.815876
vt 0.125212 0.781397
vt 0.190253 0.761492
vt 0.191010 0.812451
vt 0.429177 0.659182
vt 0.427038 0.902417
vt 0.976110 0.817278
vt 0.048350 0.828829
vt 0.053289 0.859975
vt -0.006076 0.973257
vt -0.007177 0.891688
vn -0.008500 0.965500 -0.260200
vn -0.008400 0.929400 -0.369000
vn -0.008400 0.930400 -0.366200
vn -0.008600 0.966700 -0.255700
vn 0.018500 0.685500 0.727800
vn 0.022300 0.910600 0.412600
vn 0.022300 0.912600 0.408200
vn 0.018600 0.690400 0.723200
vn 0.012600 0.991200 0.131300
vn 0.013300 0.989800 0.141500
vn -0.002300 0.995300 -0.096700
vn -0.001200 0.996800 -0.079200
vn -0.008800 0.907900 -0.419100
vn 0.014600 0.501700 0.864900
vn -0.097600 0.995000 0.021000
vn -0.093100 0.995500 0.014500
vn 0.011300 0.989800 -0.142000
vn 0.005600 0.991100 -0.132500
vn -0.492200 0.623100 0.607800
vn -0.406000 0.790400 0.458700
vn -0.424600 0.761400 0.489800
vn -0.244200 0.944000 0.221700
vn -0.245600 0.943200 0.223500
vn 0.056600 0.974600 -0.216500
vn 0.109200 0.990800 0.080200
vn 0.195400 0.968800 0.152500
vn 0.193200 0.969500 0.150600
vn 0.105600 0.991400 0.077200
vn -0.632600 0.587300 -0.504800
vn -0.417200 0.850700 -0.319700
vn -0.414100 0.853200 -0.317000
vn -0.629600 0.592700 -0.502200
vn -0.204800 0.966500 -0.154700
vn -0.212900 0.963800 -0.160600
vn -0.022100 0.999500 -0.021400
vn -0.036300 0.998800 -0.031800
vn 0.235800 0.953800 0.185800
vn -0.716500 0.387500 -0.580000
vn -0.133600 0.990800 -0.022300
vn -0.243200 0.968800 -0.047900
vn -0.240400 0.969500 -0.047300
vn -0.129100 0.991400 -0.021200
vn 0.792300 0.587300 0.165100
vn 0.516600 0.850700 0.097000
vn 0.512600 0.853200 0.096100
vn 0.788500 0.592700 0.164100
vn 0.252600 0.966500 0.045700
vn 0.262400 0.963800 0.047200
vn 0.029400 0.999500 0.009100
vn 0.046700 0.998800 0.012000
vn -0.294300 0.953800 -0.059500
vn 0.901100 0.387500 0.194400
vn -0.056400 0.990800 0.123100
vn -0.109800 0.968800 0.222200
vn -0.108400 0.969500 0.219700
vn -0.054200 0.991400 0.119100
vn 0.366300 0.587300 -0.721700
vn 0.228600 0.850700 -0.473300
vn 0.226700 0.853200 -0.469700
vn 0.364300 0.592700 -0.718300
vn 0.110000 0.966500 -0.231900
vn 0.114200 0.963800 -0.241000
vn 0.016500 0.999500 -0.026000
vn 0.023800 0.998800 -0.042000
vn -0.134300 0.953800 0.268600
vn 0.423000 0.387500 -0.819100
vn -0.090200 0.995500 -0.027300
vn -0.084100 0.996200 -0.022000
vn 0.061900 0.993400 0.096600
vn 0.053000 0.994500 0.090200
vn -0.606600 0.615200 -0.503600
vn -0.479800 0.785300 -0.391200
vn -0.506600 0.755700 -0.414900
vn -0.271600 0.942200 -0.196200
vn -0.273300 0.941300 -0.197900
vn 0.132800 0.980000 0.147800
vn 0.143800 0.989300 0.025500
vn 0.136500 0.990400 0.022300
vn -0.038900 0.998200 -0.045500
vn -0.028300 0.998700 -0.042100
vn 0.761700 0.569500 0.308700
vn 0.615300 0.749000 0.245600
vn 0.646600 0.717500 0.259000
vn 0.365500 0.921800 0.128700
vn 0.367500 0.920900 0.129700
vn -0.122600 0.989800 -0.072600
vn 0.135300 0.990800 -0.005600
vn 0.247800 0.968800 -0.003100
vn 0.245000 0.969500 -0.003100
vn 0.130700 0.991400 -0.005700
vn -0.809400 0.587300 0.001200
vn -0.525500 0.850700 0.011100
vn -0.521400 0.853200 0.011200
vn -0.805400 0.592700 0.001400
vn -0.256600 0.966500 0.007200
vn -0.266500 0.963800 0.007600
vn -0.030600 0.999500 -0.002900
vn -0.048200 0.998800 -0.002100
vn 0.300300 0.953800 -0.002300
vn -0.921800 0.387500 -0.005100
vn -0.179100 0.906900 -0.381500
vn -0.179400 0.907200 -0.380500
vn -0.255300 0.952500 -0.165700
vn -0.254500 0.952400 -0.167900
vn -0.007200 0.623500 -0.781800
vn -0.009200 0.627200 -0.778800
vn -0.031800 0.690600 -0.722500
vn -0.030700 0.687200 -0.725800
vn -0.096300 0.808900 -0.579900
vn -0.095600 0.807900 -0.581400
vn -0.299700 0.953700 -0.023100
vn 0.000600 0.611100 -0.791600
vn 0.002300 0.609100 -0.793100
vn 0.004900 0.606100 -0.795400
vn 0.004200 0.981300 0.192200
vn 0.004200 0.982900 0.184000
vn -0.002500 0.999900 0.011400
vn -0.001500 0.999800 0.022000
vn 0.009200 0.571300 0.820600
vn 0.000800 0.743000 0.669200
vn 0.002500 0.712300 0.701900
vn 0.000300 0.910500 0.413500
vn 0.000200 0.909000 0.416700
vn -0.010100 0.997400 -0.071500
usemtl Material.001
s 1
f 13/1/1 3/2/2 4/3/3 12/4/4
f 14/5/5 7/6/6 8/7/7 15/8/8
f 7/6/6 6/9/9 9/10/10 8/7/7
f 6/9/9 5/11/11 10/12/12 9/10/10
f 3/2/2 11/13/13 4/3/3
f 5/11/11 13/1/1 12/4/4 10/12/12
f 1/14/14 14/5/5 15/8/8 2/15/14
f 20/16/15 25/17/16 19/18/17 18/19/18
f 16/20/19 17/21/19 23/22/20 22/23/21
f 22/23/21 23/22/20 24/24/22 21/25/23
f 21/25/23 24/24/22 25/17/16 20/16/15
f 18/19/18 19/18/17 26/26/24
f 39/1/25 29/2/26 30/3/27 38/4/28
f 40/5/29 33/6/30 34/7/31 41/8/32
f 33/6/30 32/9/33 35/10/34 34/7/31
f 32/9/33 31/11/35 36/12/36 35/10/34
f 29/2/26 37/13/37 30/3/27
f 31/11/35 39/1/25 38/4/28 36/12/36
f 27/14/38 40/5/29 41/8/32 28/15/38
f 54/1/39 44/2/40 45/3/41 53/4/42
f 55/5/43 48/6/44 49/7/45 56/8/46
f 48/6/44 47/9/47 50/10/48 49/7/45
f 47/9/47 46/11/49 51/12/50 50/10/48
f 44/2/40 52/13/51 45/3/41
f 46/11/49 54/1/39 53/4/42 51/12/50
f 42/14/52 55/5/43 56/8/46 43/15/52
f 69/1/53 59/2/54 60/3/55 68/4/56
f 70/5/57 63/6/58 64/7/59 71/8/60
f 63/6/58 62/9/61 65/10/62 64/7/59
f 62/9/61 61/11/63 66/12/64 65/10/62
f 59/2/54 67/13/65 60/3/55
f 61/11/63 69/1/53 68/4/56 66/12/64
f 57/14/66 70/5/57 71/8/60 58/15/66
f 76/16/67 81/17/68 75/18/69 74/19/70
f 72/20/71 73/21/71 79/22/72 78/23/73
f 78/23/73 79/22/72 80/24/74 77/25/75
f 77/25/75 80/24/74 81/17/68 76/16/67
f 74/19/70 75/18/69 82/26/76
f 87/16/77 92/17/78 86/18/79 85/19/80
f 83/20/81 84/21/81 90/22/82 89/23/83
f 89/23/83 90/22/82 91/24/84 88/25/85
f 88/25/85 91/24/84 92/17/78 87/16/77
f 85/19/80 86/18/79 93/26/86
f 106/1/87 96/2/88 97/3/89 105/4/90
f 107/5/91 100/6/92 101/7/93 108/8/94
f 100/6/92 99/9/95 102/10/96 101/7/93
f 99/9/95 98/11/97 103/12/98 102/10/96
f 96/2/88 104/13/99 97/3/89
f 98/11/97 106/1/87 105/4/90 103/12/98
f 94/14/100 107/5/91 108/8/94 95/15/100
f 113/27/101 118/28/102 112/29/103 111/30/104
f 109/31/105 110/32/106 116/33/107 115/34/108
f 115/34/108 116/33/107 117/35/109 114/36/110
f 114/36/110 117/35/109 118/28/102 113/27/101
f 111/30/104 112/29/103 119/37/111
f 123/38/112 122/39/113 120/40/114 121/41/114
f 110/32/106 109/31/105 122/39/113 123/38/112
f 128/16/115 133/17/116 127/18/117 126/19/118
f 124/20/119 125/21/119 131/22/120 130/23/121
f 130/23/121 131/22/120 132/24/122 129/25/123
f 129/25/123 132/24/122 133/17/116 128/16/115
f 126/19/118 127/18/117 134/26/124

31191
cw 6/models/plant2.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -72,8 +72,9 @@ float prevX = 0;
float prevY = 0;
int score = 0;
int prevTimeDEBUG;
GLuint orcaTexture, orcaNormal, plantTexture, groundTexture, groundNormal;
GLuint orcaTexture, orcaNormal, plantTexture, plantTextureNormal, groundTexture, groundNormal;
static PxFilterFlags simulationFilterShader(PxFilterObjectAttributes attributes0,
PxFilterData filterData0, PxFilterObjectAttributes attributes1, PxFilterData filterData1,
@ -335,6 +336,11 @@ void move(glm::vec3 axis, float moveSpeed) {
orcaBody->setKinematicTarget(PxTransform(posAndOrientToPxTransform(newOrcaPos, glm::inverse(rotation))));
}
void printPos() {
glm::quat rotationxd = glm::inverse(rotation);
printf("{glm::vec3(%ff, %ff, %ff), glm::quat(%ff, %ff, %ff, %ff)},\n", cameraPos.x, cameraPos.y, cameraPos.z, rotationxd.x, rotationxd.y, rotationxd.z, rotationxd.w);
}
void keyboard(unsigned char key, int x, int y)
{
@ -349,6 +355,7 @@ void keyboard(unsigned char key, int x, int y)
case 's': move(cameraDir, moveSpeed); break;
case 'd': move(cameraSide, moveSpeed); break;
case 'a': move(cameraSide, -moveSpeed); break;
case 'p': printPos(); break;
}
}
@ -390,6 +397,7 @@ glm::mat4 createCameraMatrix()
glm::quat invRotation = glm::inverse(rotation);
cameraDir = invRotation * glm::vec3(0.0f, 0.0f, 1.0f);
cameraSide = invRotation * glm::vec3(1.0f, 0.0f, 0.0f);
cameraVertical = inverse(rotation) * glm::vec3(0, 1, 0);
PxVec3 orcaPos = orcaBody->getWorldBounds().getCenter();
cameraPos = glm::vec3(orcaPos.x, orcaPos.y, orcaPos.z) + glm::inverse(rotation) * glm::vec3(0.0f, 0.0f, 1.0f);
@ -464,17 +472,20 @@ void drawFish(float time)
}
void drawSeaweed() {
drawObjectTexture(plantContext, glm::translate(glm::vec3(2, -8, 4)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(9, -8, 6)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(1, -8, 0)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(-7, -6, 5)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(-5, -6, -5)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(-1, -8, 9)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(2, -7, 6)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(10, -7, 5)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(-4, -7, 9)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(1, -7, 9)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(8, -6, 8)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(2, -8, 4)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(9, -8, 6)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(1, -8, 0)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(-7, -6, 5)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(-5, -6, -5)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(-1, -8, 9)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(2, -7, 6)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(10, -7, 5)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(-4, -7, 9)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTexture(plantContext, glm::translate(glm::vec3(1, -7, 9)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
//drawObjectTextureWithNormal(plantContext, glm::translate(glm::vec3(8, -6, 8)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture, plantTextureNormal);
//drawObjectTextureWithNormal(plantContext, glm::translate(glm::vec3(0, -6, 0)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture, plantTextureNormal);
drawObjectTexture(plantContext, glm::translate(glm::vec3(0, -6, 2)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
drawObjectTexture(plantContext, glm::translate(glm::vec3(0, -6, 2)) * glm::rotate(glm::radians(0.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.5f)), plantTexture);
}
@ -499,34 +510,36 @@ void renderScene()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.f, 0.4f, 1.0f, 1.0f);
//updateTransforms();
updateTransforms();
//for (int i = 0; i < bubbles.size(); i++) {
// bubblesPx[i]->setKinematicTarget(PxTransform(posToPxTransform(bubbles[i].getPositionAndElevate())));
//}
for (int i = 0; i < bubbles.size(); i++) {
bubblesPx[i]->setKinematicTarget(PxTransform(posToPxTransform(bubbles[i].getPositionAndElevate())));
}
// SKYBOX
//glm::mat4 view = glm::mat4(glm::mat3(cameraMatrix));
//drawSkyBox(perspectiveMatrix, view, programSkyBox, skyboxVAO, skyboxVBO, cubemapTexture);
glm::mat4 view = glm::mat4(glm::mat3(cameraMatrix));
drawSkyBox(perspectiveMatrix, view, programSkyBox, skyboxVAO, skyboxVBO, cubemapTexture);
glm::mat4 shipInitialTransformation = glm::translate(glm::vec3(0,-1.0f,-1.0f)) * glm::rotate(glm::radians(180.0f), glm::vec3(0,1,0)) * glm::scale(glm::vec3(0.25f));
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 0.5f) * glm::mat4_cast(glm::inverse(rotationX * rotationY * rotationZ)) * shipInitialTransformation;
handleAllParticleSources(cameraPos, programParticles, cameraSide, cameraVertical, cameraMatrix, perspectiveMatrix);
//drawFish(time);
//drawObjectTextureWithNormal(renderables.back().context, renderables.back().physicsTransform * renderables.back().localTransform, renderables.back().textureId, renderables.back().normalId);
//drawObjectTextureWithNormal(groundContext, glm::translate(glm::vec3(0, 2, 0)) * glm::rotate(glm::radians(-90.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(50)), groundTexture, groundNormal);
drawFish(time);
drawObjectTextureWithNormal(renderables.back().context, renderables.back().physicsTransform * renderables.back().localTransform, renderables.back().textureId, renderables.back().normalId);
drawObjectTextureWithNormal(groundContext, glm::translate(glm::vec3(0, 2, 0)) * glm::rotate(glm::radians(-90.0f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(50)), groundTexture, groundNormal);
//drawSeaweed();
drawSeaweed();
//for (int i = 0; i < renderables.size() - 1; i++) {
// glm::mat4 transform = renderables[i].physicsTransform * renderables[i].localTransform;
// drawObjectColor(sphereContext, transform, glm::vec4(0.0f, 0.0f, 1.0f, 0.3f));
//}
for (int i = 0; i < renderables.size() - 1; i++) {
glm::mat4 transform = renderables[i].physicsTransform * renderables[i].localTransform;
drawObjectColor(sphereContext, transform, glm::vec4(0.0f, 0.0f, 1.0f, 0.3f));
}
//Core::DrawString((char*)to_string(score).c_str());
Core::DrawString((char*)to_string(score).c_str());
glutSwapBuffers();
}
void initBubbles(int n) {
for (int i = 0; i < n; i++) {
bubbles.push_back(Bubble(randRange(0.05f, 0.2f), randRange(-8.0f, 8.0f), randRange(-5.0f, 5.0f), randRange(-8.0f, 8.0f), randRange(0.7f, 7.0f)));
bubbles.push_back(Bubble(randRange(0.05f, 0.2f), randRange(-16.0f, 16.0f), randRange(-5.0f, 5.0f), randRange(-16.0f, 16.0f), randRange(0.7f, 7.0f)));
bubblesPx.push_back(nullptr);
}
}
@ -567,17 +580,17 @@ void init()
loadModelToContext("models/sphere.obj", sphereContext);
loadModelToContext("models/terobj.obj", groundContext);
loadModelToContext("models/waterplant.obj", plantContext);
plantTexture = Core::LoadTexture("textures/waterplant.png");
loadModelToContext("models/plant1.obj", plantContext);
plantTexture = Core::LoadTexture("textures/plant1.png");
plantTextureNormal = Core::LoadTexture("textures/plant2_normal.jpg");
orcaTexture = Core::LoadTexture("textures/Orca_Diffuse.jpg");
orcaNormal = Core::LoadTexture("textures/orca_normal.jpg");
groundTexture = Core::LoadTexture("textures/ground1.jpg");
groundNormal = Core::LoadTexture("textures/ground1_NormalMap.png");
initBubbles(80);
initBubbles(150);
initFish(150);
initParticles();
addParticleSource(glm::vec3(0, -7, 0), 300.0f, 1.0f);

BIN
cw 6/textures/plant1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 KiB

BIN
cw 6/textures/plant2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB