diff --git a/res/fern.obj b/res/fern.obj new file mode 100644 index 0000000..184116c --- /dev/null +++ b/res/fern.obj @@ -0,0 +1,424 @@ +# Blender v2.67 (sub 0) OBJ File: 'fern.blend' +# www.blender.org +o Plane +v -1.668906 1.421207 -4.981303 +v 1.291248 1.274556 -4.874573 +v -1.681098 2.133895 -4.624559 +v 1.441855 2.133895 -4.624559 +v -1.716799 2.696792 -3.607163 +v 1.406155 2.587040 -3.607163 +v -1.561477 2.636679 -1.975693 +v 1.561477 2.470482 -1.975693 +v -1.347036 1.668626 -1.121537 +v 1.561477 1.857010 -0.942828 +v -1.561477 -0.004097 -0.036216 +v 1.561477 -0.004097 -0.036216 +v 4.922924 2.330723 -2.113493 +v 4.930951 2.184072 0.848574 +v 4.372616 2.743763 -2.092158 +v 4.493601 2.743764 1.028451 +v 3.455437 2.912039 -2.056599 +v 3.576422 2.802288 1.064010 +v 1.942091 2.636679 -1.997928 +v 2.063076 2.470482 1.122681 +v 1.096885 1.668625 -1.750557 +v 1.030987 1.857010 1.162695 +v 0.004071 -0.004097 -1.922791 +v 0.125055 -0.004097 1.197818 +v 5.066892 1.391006 0.895784 +v 3.068532 1.226996 3.537834 +v 4.896961 2.123907 0.870659 +v 2.891804 2.123907 3.730312 +v 4.156424 2.763720 0.489422 +v 2.151268 2.640977 3.349074 +v 2.614438 2.708673 -0.523145 +v 0.609281 2.522805 2.336507 +v 1.694611 1.626036 -0.875212 +v -0.336501 1.836719 1.673335 +v 0.838482 -0.244677 -1.768426 +v -1.166676 -0.244677 1.091226 +v 1.019397 2.313956 4.808662 +v -1.755515 2.175439 4.451704 +v 1.067131 2.704086 4.290682 +v -1.870153 2.704086 4.020000 +v 1.146687 2.863028 3.427385 +v -1.790596 2.759363 3.156702 +v 1.277956 2.602941 2.002943 +v -1.659327 2.445963 1.732260 +v 1.150299 1.688583 1.180983 +v -1.569803 1.866519 0.760803 +v 1.446060 0.108644 0.178775 +v -1.491222 0.108645 -0.091908 +v -2.841108 2.359943 5.062696 +v -4.854967 2.199116 2.513874 +v -2.381020 2.812909 4.671439 +v -4.599705 2.812910 2.062436 +v -1.614207 2.997452 4.019345 +v -3.832892 2.877091 1.410342 +v -0.348966 2.695474 2.943390 +v -2.567650 2.513212 0.334387 +v 0.212271 1.633845 2.157409 +v -1.704767 1.840439 -0.399406 +v 1.271327 -0.200569 1.565499 +v -0.947357 -0.200569 -1.043504 +v -6.274055 1.495219 2.121059 +v -6.142600 1.319109 -1.433610 +v -5.544260 2.263995 1.986592 +v -5.540795 2.263996 -1.763698 +v -4.359546 2.953154 1.726256 +v -4.356080 2.821356 -2.024032 +v -2.407223 2.758862 1.710761 +v -2.403757 2.559280 -2.039528 +v -1.381247 1.596347 1.454191 +v -1.163412 1.822574 -2.038382 +v -0.078146 -0.412391 1.712912 +v -0.074680 -0.412391 -2.037376 +v -5.393490 2.359763 -2.091071 +v -3.270963 2.199023 -4.547807 +v -4.922800 2.812483 -1.713156 +v -2.779778 2.812484 -4.382275 +v -4.138320 2.996925 -1.083301 +v -1.995298 2.876630 -3.752418 +v -2.843926 2.695112 -0.044037 +v -0.700904 2.512949 -2.713154 +v -1.966746 1.634059 0.358820 +v 0.181862 1.840542 -2.004385 +v -1.186299 -0.199359 1.286863 +v 0.956723 -0.199359 -1.382254 +v -3.411818 3.548868 0.997281 +v -2.987591 3.599077 -1.523562 +v -2.848599 3.707952 1.095761 +v -2.444523 3.919941 -1.557639 +v -2.065775 3.556531 1.202876 +v -1.694590 3.680621 -1.462553 +v -0.939843 2.863784 1.318995 +v -0.585573 2.942669 -1.352623 +v -0.520648 1.836716 1.113190 +v 0.054735 2.129301 -1.320096 +v -0.183668 0.144097 1.216864 +v 0.220408 0.356086 -1.436535 +v -2.752246 3.548868 -2.331894 +v -0.428357 3.599077 -3.396862 +v -2.517365 3.707952 -1.810603 +v -0.095124 3.919941 -2.966700 +v -2.166277 3.556531 -1.102773 +v 0.247442 3.680621 -2.292838 +v -1.629914 2.863784 -0.106017 +v 0.779423 2.942669 -1.313553 +v -1.224182 1.836715 0.125201 +v 1.112171 2.129301 -0.765528 +v -1.120676 0.144097 0.462233 +v 1.301564 0.356086 -0.693862 +v 1.179569 3.548868 -3.299581 +v 3.068619 3.599077 -1.577340 +v 0.791671 3.707952 -2.879523 +v 2.803056 3.919941 -1.102408 +v 0.345733 3.637383 -2.162762 +v 2.385048 3.761473 -0.406775 +v -0.430031 2.863784 -1.396071 +v 1.623650 2.942669 0.349049 +v -0.484141 1.836715 -0.932226 +v 1.249424 2.129301 0.869633 +v -0.753842 0.144098 -0.705146 +v 1.257542 0.356086 1.071969 +v 3.478751 3.063767 0.129736 +v 2.508179 3.113976 2.494606 +v 2.969543 3.472751 -0.191974 +v 1.989343 3.684741 2.306629 +v 2.194941 3.556531 -0.538472 +v 1.244161 3.680621 1.979129 +v 1.122468 2.863784 -0.900428 +v 0.186821 2.942669 1.626945 +v 0.668168 1.836715 -0.792301 +v -0.430486 2.129301 1.453785 +v 0.362412 0.144098 -0.967850 +v -0.617787 0.356086 1.530752 +v 1.723514 3.227772 2.919589 +v -0.813319 3.277982 3.234388 +v 1.606172 3.518214 2.393483 +v -1.051909 3.730203 2.765519 +v 1.425735 3.556531 1.529277 +v -1.234463 3.680621 1.936269 +v 1.214835 2.863784 0.417193 +v -1.446452 2.942669 0.842165 +v 0.897690 1.836715 0.074411 +v -1.598496 2.129301 0.219321 +v 0.900611 0.144098 -0.278144 +v -1.757470 0.356086 0.093891 +vt 0.261788 0.894097 +vt 0.741905 0.894097 +vt 0.261788 0.999931 +vt 0.261788 0.750634 +vt 0.741905 0.750634 +vt 0.261788 0.513983 +vt 0.741905 0.513983 +vt 0.261788 0.307545 +vt 0.741905 0.307545 +vt 0.261788 0.000069 +vt 0.741905 0.000069 +vt 0.741905 0.999931 +vn 0.012848 0.702567 -0.711478 +vn 0.020722 0.682089 -0.730949 +vn 0.008454 0.417798 -0.908475 +vn 0.034089 0.970763 -0.237495 +vn 0.028413 0.982147 -0.185919 +vn -0.002197 0.931425 0.363872 +vn 0.050600 0.950804 0.305551 +vn -0.060060 0.579974 0.812403 +vn -0.036378 0.647877 0.760857 +vn 0.000000 0.544298 0.838862 +vn -0.051668 0.478774 0.876400 +vn 0.409406 0.911954 0.025819 +vn 0.432630 0.901395 -0.016755 +vn 0.762535 0.646565 -0.021699 +vn -0.002838 0.999115 0.041627 +vn -0.064425 0.997650 0.023103 +vn -0.440352 0.897580 0.020173 +vn -0.361736 0.930509 0.057314 +vn -0.797571 0.600513 -0.056856 +vn -0.745903 0.665731 0.019196 +vn -0.861782 0.506851 -0.018891 +vn -0.898312 0.437910 0.034822 +vn 0.698874 0.494675 0.516556 +vn 0.674551 0.550340 0.491989 +vn 0.814081 0.058443 0.577746 +vn 0.238380 0.950316 0.200171 +vn 0.172155 0.971587 0.162389 +vn -0.299814 0.931639 -0.205206 +vn -0.266366 0.954711 -0.132359 +vn -0.600360 0.600513 -0.528123 +vn -0.605304 0.665731 -0.436293 +vn -0.674459 0.506851 -0.536790 +vn -0.736076 0.437910 -0.516129 +vn -0.036775 0.916135 0.399121 +vn -0.080782 0.901364 0.425428 +vn -0.066225 0.776391 0.626728 +vn -0.025605 0.999512 -0.017548 +vn -0.027863 0.996460 -0.078982 +vn -0.003967 0.883175 -0.468978 +vn 0.045595 0.915891 -0.398785 +vn 0.083438 0.617115 -0.782434 +vn 0.155522 0.675375 -0.720847 +vn 0.076968 0.544298 -0.835322 +vn 0.131870 0.478774 -0.867946 +vn -0.305338 0.916135 0.259651 +vn -0.355174 0.901364 0.247688 +vn -0.485519 0.776391 0.401807 +vn -0.005890 0.999725 -0.022248 +vn 0.027192 0.996612 -0.077395 +vn 0.333567 0.880856 -0.335856 +vn 0.311014 0.913816 -0.261086 +vn 0.606677 0.617115 -0.501083 +vn 0.615162 0.675375 -0.406659 +vn 0.639058 0.544298 -0.543443 +vn 0.701102 0.478774 -0.528367 +vn -0.626392 0.779382 -0.011170 +vn -0.616840 0.786798 -0.020203 +vn -0.752464 0.658498 -0.011689 +vn -0.232734 0.971923 -0.034364 +vn -0.149419 0.988311 -0.029939 +vn 0.432173 0.900845 -0.040376 +vn 0.368816 0.929472 0.002625 +vn 0.786767 0.617115 0.011994 +vn 0.731986 0.675375 0.089389 +vn 0.838862 0.544298 0.000763 +vn 0.876339 0.478774 0.052461 +vn -0.312540 0.916135 -0.250923 +vn -0.310190 0.901364 -0.302133 +vn -0.486099 0.776391 -0.401105 +vn 0.020722 0.999725 -0.009980 +vn 0.081118 0.996612 0.012116 +vn 0.392682 0.880856 0.264290 +vn 0.315012 0.913816 0.256233 +vn 0.606433 0.617115 0.501389 +vn 0.515305 0.675375 0.527512 +vn 0.654134 0.544298 0.525193 +vn 0.651021 0.478774 0.588977 +vn -0.039766 0.997467 0.058840 +vn -0.070223 0.996551 0.043672 +vn -0.312082 0.949828 0.019776 +vn 0.351970 0.931425 0.092380 +vn 0.406476 0.907346 0.107028 +vn 0.748741 0.650807 0.125645 +vn 0.693106 0.701834 0.164220 +vn 0.941008 0.287820 0.177740 +vn 0.899045 0.355663 0.255348 +vn 0.965636 0.202216 0.163182 +vn 0.969817 0.123722 0.209998 +vn -0.071017 0.997467 0.000122 +vn -0.075594 0.996551 -0.033570 +vn -0.191656 0.949828 -0.247078 +vn 0.121281 0.931425 0.343089 +vn 0.139744 0.907346 0.396405 +vn 0.316568 0.650807 0.690054 +vn 0.253426 0.701834 0.665700 +vn 0.381481 0.287820 0.878384 +vn 0.293710 0.355663 0.887234 +vn 0.407361 0.202216 0.890561 +vn 0.370983 0.123722 0.920347 +vn 0.044221 0.993347 -0.106052 +vn 0.014801 0.990722 -0.134922 +vn 0.269295 0.877132 -0.397565 +vn -0.255837 0.938749 0.230781 +vn -0.302591 0.912412 0.275491 +vn -0.551134 0.636799 0.539171 +vn -0.469649 0.713095 0.520463 +vn -0.716178 0.263527 0.646229 +vn -0.648152 0.347850 0.677389 +vn -0.701132 0.155553 0.695822 +vn -0.664724 0.081668 0.742607 +vn 0.327616 0.942656 0.063509 +vn 0.362804 0.927641 0.088351 +vn 0.580432 0.796350 0.169958 +vn -0.204443 0.971740 -0.117893 +vn -0.237220 0.959471 -0.151952 +vn -0.667226 0.674642 -0.315622 +vn -0.624378 0.736290 -0.260781 +vn -0.852535 0.263527 -0.451338 +vn -0.858486 0.347850 -0.376751 +vn -0.893948 0.155553 -0.420240 +vn -0.925413 0.081668 -0.369976 +vn 0.088076 0.954680 0.284280 +vn 0.097964 0.957030 0.272896 +vn 0.140873 0.767968 0.624775 +vn 0.011750 0.963805 -0.266305 +vn -0.005890 0.945097 -0.326640 +vn -0.052400 0.674642 -0.736229 +vn -0.079134 0.736290 -0.672018 +vn -0.025086 0.263527 -0.964324 +vn -0.092990 0.347850 -0.932920 +vn -0.072512 0.155553 -0.985137 +vn -0.131748 0.081668 -0.987884 +vn 0.048097 0.271249 -0.961303 +vn 0.600787 0.798486 0.037904 +vn 0.775353 0.200293 0.598895 +vn -0.130985 0.609851 0.781579 +vn -0.640095 0.609851 0.467238 +vn -0.851009 0.521989 -0.057314 +vn -0.579485 0.609851 -0.540574 +vn -0.510666 0.856990 -0.068850 +vn -0.229835 0.856990 -0.461165 +vn 0.166631 0.963195 -0.210852 +vn 0.670217 0.694968 0.260292 +vn 0.075594 0.879971 0.468917 +s 1 +f 3/1/1 4/2/2 1/3/3 +f 5/4/4 6/5/5 3/1/1 +f 7/6/6 8/7/7 6/5/5 +f 9/8/8 10/9/9 7/6/6 +f 11/10/10 12/11/11 9/8/8 +f 15/1/12 16/2/13 14/12/14 +f 17/4/15 18/5/16 15/1/12 +f 19/6/17 20/7/18 17/4/15 +f 21/8/19 22/9/20 19/6/17 +f 23/10/21 24/11/22 22/9/20 +f 27/1/23 28/2/24 26/12/25 +f 29/4/26 30/5/27 28/2/24 +f 31/6/28 32/7/29 29/4/26 +f 33/8/30 34/9/31 31/6/28 +f 35/10/32 36/11/33 34/9/31 +f 39/1/34 40/2/35 37/3/36 +f 41/4/37 42/5/38 40/2/35 +f 43/6/39 44/7/40 41/4/37 +f 45/8/41 46/9/42 44/7/40 +f 47/10/43 48/11/44 45/8/41 +f 51/1/45 52/2/46 49/3/47 +f 53/4/48 54/5/49 52/2/46 +f 55/6/50 56/7/51 54/5/49 +f 57/8/52 58/9/53 56/7/51 +f 59/10/54 60/11/55 57/8/52 +f 63/1/56 64/2/57 61/3/58 +f 65/4/59 66/5/60 63/1/56 +f 67/6/61 68/7/62 66/5/60 +f 69/8/63 70/9/64 68/7/62 +f 71/10/65 72/11/66 69/8/63 +f 75/1/67 76/2/68 73/3/69 +f 77/4/70 78/5/71 76/2/68 +f 79/6/72 80/7/73 78/5/71 +f 81/8/74 82/9/75 80/7/73 +f 83/10/76 84/11/77 81/8/74 +f 87/1/78 88/2/79 85/3/80 +f 89/4/81 90/5/82 87/1/78 +f 91/6/83 92/7/84 90/5/82 +f 93/8/85 94/9/86 92/7/84 +f 95/10/87 96/11/88 93/8/85 +f 99/1/89 100/2/90 97/3/91 +f 101/4/92 102/5/93 99/1/89 +f 103/6/94 104/7/95 102/5/93 +f 105/8/96 106/9/97 104/7/95 +f 107/10/98 108/11/99 105/8/96 +f 111/1/100 112/2/101 110/12/102 +f 113/4/103 114/5/104 111/1/100 +f 115/6/105 116/7/106 114/5/104 +f 117/8/107 118/9/108 115/6/105 +f 119/10/109 120/11/110 118/9/108 +f 123/1/111 124/2/112 121/3/113 +f 125/4/114 126/5/115 123/1/111 +f 127/6/116 128/7/117 125/4/114 +f 129/8/118 130/9/119 127/6/116 +f 131/10/120 132/11/121 130/9/119 +f 135/1/122 136/2/123 134/12/124 +f 137/4/125 138/5/126 136/2/123 +f 139/6/127 140/7/128 137/4/125 +f 141/8/129 142/9/130 139/6/127 +f 143/10/131 144/11/132 142/9/130 +f 4/2/2 2/12/133 1/3/3 +f 6/5/5 4/2/2 3/1/1 +f 5/4/4 7/6/6 6/5/5 +f 10/9/9 8/7/7 7/6/6 +f 12/11/11 10/9/9 9/8/8 +f 13/3/134 15/1/12 14/12/14 +f 18/5/16 16/2/13 15/1/12 +f 20/7/18 18/5/16 17/4/15 +f 22/9/20 20/7/18 19/6/17 +f 21/8/19 23/10/21 22/9/20 +f 25/3/135 27/1/23 26/12/25 +f 27/1/23 29/4/26 28/2/24 +f 32/7/29 30/5/27 29/4/26 +f 34/9/31 32/7/29 31/6/28 +f 33/8/30 35/10/32 34/9/31 +f 40/2/35 38/12/136 37/3/36 +f 39/1/34 41/4/37 40/2/35 +f 44/7/40 42/5/38 41/4/37 +f 43/6/39 45/8/41 44/7/40 +f 48/11/44 46/9/42 45/8/41 +f 52/2/46 50/12/137 49/3/47 +f 51/1/45 53/4/48 52/2/46 +f 53/4/48 55/6/50 54/5/49 +f 55/6/50 57/8/52 56/7/51 +f 60/11/55 58/9/53 57/8/52 +f 64/2/57 62/12/138 61/3/58 +f 66/5/60 64/2/57 63/1/56 +f 65/4/59 67/6/61 66/5/60 +f 67/6/61 69/8/63 68/7/62 +f 72/11/66 70/9/64 69/8/63 +f 76/2/68 74/12/139 73/3/69 +f 75/1/67 77/4/70 76/2/68 +f 77/4/70 79/6/72 78/5/71 +f 79/6/72 81/8/74 80/7/73 +f 84/11/77 82/9/75 81/8/74 +f 88/2/79 86/12/140 85/3/80 +f 90/5/82 88/2/79 87/1/78 +f 89/4/81 91/6/83 90/5/82 +f 91/6/83 93/8/85 92/7/84 +f 96/11/88 94/9/86 93/8/85 +f 100/2/90 98/12/141 97/3/91 +f 102/5/93 100/2/90 99/1/89 +f 101/4/92 103/6/94 102/5/93 +f 103/6/94 105/8/96 104/7/95 +f 108/11/99 106/9/97 105/8/96 +f 109/3/142 111/1/100 110/12/102 +f 114/5/104 112/2/101 111/1/100 +f 113/4/103 115/6/105 114/5/104 +f 118/9/108 116/7/106 115/6/105 +f 117/8/107 119/10/109 118/9/108 +f 124/2/112 122/12/143 121/3/113 +f 126/5/115 124/2/112 123/1/111 +f 128/7/117 126/5/115 125/4/114 +f 130/9/119 128/7/117 127/6/116 +f 129/8/118 131/10/120 130/9/119 +f 133/3/144 135/1/122 134/12/124 +f 135/1/122 137/4/125 136/2/123 +f 140/7/128 138/5/126 137/4/125 +f 142/9/130 140/7/128 139/6/127 +f 141/8/129 143/10/131 142/9/130 diff --git a/res/fern.png b/res/fern.png new file mode 100644 index 0000000..a666647 Binary files /dev/null and b/res/fern.png differ diff --git a/res/grassModel.obj b/res/grassModel.obj new file mode 100644 index 0000000..da634d4 --- /dev/null +++ b/res/grassModel.obj @@ -0,0 +1,413 @@ +# Blender v2.67 (sub 0) OBJ File: 'lowPolyPlants.blend' +# www.blender.org +o Plane +v 0.063088 0.003610 -4.997082 +v -1.136912 0.003610 -4.997082 +v 0.063088 1.203610 -4.997082 +v -1.136912 1.203610 -4.997082 +v -0.536911 0.003610 -5.597082 +v -0.536912 0.003610 -4.397082 +v -0.536912 1.203610 -5.597083 +v -0.536912 1.203610 -4.397082 +v -5.427285 0.003610 -0.769423 +v -6.627285 0.003610 -0.769423 +v -5.427285 1.203610 -0.769424 +v -6.627285 1.203610 -0.769424 +v -6.027285 0.003610 -1.369424 +v -6.027285 0.003610 -0.169423 +v -6.027285 1.203610 -1.369424 +v -6.027285 1.203610 -0.169424 +v 0.627331 0.003610 1.154491 +v 0.120805 0.003610 0.066634 +v 0.627331 1.203610 1.154491 +v 0.120805 1.203610 0.066634 +v 0.917996 0.003610 0.357300 +v -0.169860 0.003611 0.863825 +v 0.917996 1.203610 0.357300 +v -0.169860 1.203610 0.863825 +v 2.736700 0.003610 -2.973755 +v 1.939363 0.003610 -3.870557 +v 2.736700 1.203610 -2.973755 +v 1.939363 1.203610 -3.870557 +v 2.786432 0.003610 -3.820825 +v 1.889630 0.003610 -3.023487 +v 2.786432 1.203610 -3.820825 +v 1.889630 1.203610 -3.023487 +v -2.374338 0.003610 -1.890785 +v -3.247929 0.003610 -2.713487 +v -2.374338 1.203610 -1.890785 +v -3.247929 1.203610 -2.713487 +v -2.399782 0.003610 -2.738931 +v -3.222484 0.003611 -1.865341 +v -2.399782 1.203610 -2.738931 +v -3.222484 1.203610 -1.865341 +v 6.729870 0.003610 2.758007 +v 7.206303 0.003610 1.656639 +v 6.729870 1.203610 2.758007 +v 7.206303 1.203610 1.656640 +v 7.518770 0.003610 2.445540 +v 6.417403 0.003611 1.969108 +v 7.518770 1.203610 2.445540 +v 6.417403 1.203610 1.969108 +v -2.949056 0.003611 6.270791 +v -2.019891 0.003611 5.511415 +v -2.949056 1.203610 6.270791 +v -2.019891 1.203610 5.511416 +v -2.104786 0.003610 6.355686 +v -2.864161 0.003611 5.426521 +v -2.104786 1.203610 6.355686 +v -2.864161 1.203610 5.426521 +v -11.257655 0.003611 -0.649311 +v -12.123328 0.003610 0.181718 +v -11.257655 1.203610 -0.649312 +v -12.123328 1.203610 0.181718 +v -12.106008 0.003611 -0.666633 +v -11.274976 0.003610 0.199040 +v -12.106008 1.203610 -0.666633 +v -11.274976 1.203610 0.199040 +v -5.115887 0.003611 6.717537 +v -5.981559 0.003611 7.548567 +v -5.115886 1.203610 6.717537 +v -5.981559 1.203610 7.548567 +v -5.964238 0.003611 6.700215 +v -5.133207 0.003611 7.565888 +v -5.964237 1.203610 6.700215 +v -5.133207 1.203610 7.565887 +v -4.044483 0.003611 4.351145 +v -5.163255 0.003611 3.917153 +v -4.044483 1.203610 4.351144 +v -5.163255 1.203610 3.917153 +v -4.386873 0.003611 3.574763 +v -4.820865 0.003611 4.693535 +v -4.386873 1.203610 3.574763 +v -4.820865 1.203610 4.693534 +v -5.924183 0.003610 -3.071747 +v -6.925926 0.003611 -3.732436 +v -5.924183 1.203610 -3.071747 +v -6.925926 1.203610 -3.732436 +v -6.094710 0.003611 -3.902963 +v -6.755400 0.003611 -2.901220 +v -6.094710 1.203610 -3.902963 +v -6.755400 1.203610 -2.901221 +v -7.753965 0.003611 1.248239 +v -8.950217 0.003611 1.153468 +v -7.753965 1.203610 1.248238 +v -8.950217 1.203610 1.153467 +v -8.304706 0.003611 0.602727 +v -8.399476 0.003611 1.798979 +v -8.304706 1.203610 0.602727 +v -8.399476 1.203610 1.798979 +v -1.912768 0.003610 0.464466 +v -2.331797 0.003611 -0.659996 +v -1.912768 1.203610 0.464466 +v -2.331796 1.203610 -0.659996 +v -1.560051 0.003611 -0.307279 +v -2.684512 0.003611 0.111750 +v -1.560051 1.203610 -0.307280 +v -2.684513 1.203610 0.111750 +v -4.742368 0.003611 1.656384 +v -5.161397 0.003611 0.531922 +v -4.742368 1.203610 1.656384 +v -5.161397 1.203610 0.531922 +v -4.389652 0.003611 0.884638 +v -5.514113 0.003611 1.303667 +v -4.389652 1.203610 0.884638 +v -5.514114 1.203610 1.303667 +v 4.391148 1.203610 0.926363 +v 3.597642 1.203610 0.026169 +v 4.391148 0.003611 0.926362 +v 3.597642 0.003610 0.026169 +v 3.544298 1.203610 0.873019 +v 4.444492 1.203610 0.079513 +v 3.544298 0.003610 0.873018 +v 4.444492 0.003610 0.079513 +v 4.806449 1.203610 3.812527 +v 3.732761 1.203610 3.276623 +v 4.806449 0.003611 3.812527 +v 3.732761 0.003611 3.276624 +v 4.001654 1.203610 4.081419 +v 4.537557 1.203610 3.007731 +v 4.001654 0.003611 4.081419 +v 4.537557 0.003611 3.007731 +v 6.609623 1.203610 -3.161592 +v 7.186171 1.203610 -4.214014 +v 6.609624 0.003611 -3.161592 +v 7.186171 0.003610 -4.214014 +v 6.371686 1.203610 -3.976077 +v 7.424108 1.203610 -3.399530 +v 6.371686 0.003611 -3.976076 +v 7.424108 0.003610 -3.399530 +v -0.487433 1.203610 1.980146 +v -1.577091 1.203610 1.477509 +v -0.487433 0.003611 1.980146 +v -1.577091 0.003610 1.477509 +v -1.283581 1.203610 2.273656 +v -0.780943 1.203610 1.183998 +v -1.283581 0.003610 2.273657 +v -0.780943 0.003610 1.183998 +v 10.179677 1.203610 0.517455 +v 8.984852 1.203610 0.406136 +v 10.179677 0.003611 0.517455 +v 8.984852 0.003610 0.406136 +v 9.526605 1.203610 1.059208 +v 9.637924 1.203610 -0.135617 +v 9.526605 0.003610 1.059208 +v 9.637924 0.003610 -0.135617 +v 5.869500 1.203610 5.422760 +v 4.930470 1.203610 6.169901 +v 5.869502 0.003611 5.422760 +v 4.930470 0.003611 6.169903 +v 5.773557 1.203610 6.265846 +v 5.026414 1.203610 5.326817 +v 5.773557 0.003611 6.265847 +v 5.026415 0.003611 5.326817 +v 0.637121 1.203610 -1.805795 +v 1.213668 1.203610 -2.858217 +v 0.637121 0.003611 -1.805795 +v 1.213669 0.003611 -2.858217 +v 0.399184 1.203610 -2.620279 +v 1.451606 1.203610 -2.043732 +v 0.399184 0.003611 -2.620279 +v 1.451606 0.003611 -2.043732 +v 1.740329 1.203610 -0.516481 +v 1.336903 1.203610 -1.646635 +v 1.740329 0.003611 -0.516482 +v 1.336903 0.003610 -1.646635 +v 0.973539 1.203610 -0.879845 +v 2.103693 1.203610 -1.283271 +v 0.973540 0.003611 -0.879845 +v 2.103693 0.003611 -1.283271 +v 3.117721 1.203610 2.883694 +v 2.804810 1.203610 1.725209 +v 3.117721 0.003611 2.883693 +v 2.804810 0.003611 1.725209 +v 2.382023 1.203610 2.460907 +v 3.540508 1.203610 2.147995 +v 2.382023 0.003611 2.460907 +v 3.540508 0.003611 2.147995 +v 1.243791 1.203610 8.964542 +v 0.077800 1.203610 9.248203 +v 1.243791 0.003611 8.964540 +v 0.077800 0.003611 9.248203 +v 0.802626 1.203610 9.689367 +v 0.518964 1.203610 8.523376 +v 0.802626 0.003611 9.689367 +v 0.518964 0.003611 8.523376 +v 4.819168 1.203610 -1.187724 +v 4.506256 1.203610 -2.346208 +v 4.819168 0.003611 -1.187724 +v 4.506257 0.003611 -2.346208 +v 4.083470 1.203610 -1.610511 +v 5.241954 1.203610 -1.923421 +v 4.083470 0.003611 -1.610510 +v 5.241954 0.003611 -1.923421 +v 0.499905 1.203610 -8.019167 +v -0.210803 1.203610 -8.986067 +v 0.499905 0.003610 -8.019167 +v -0.210803 0.003610 -8.986066 +v -0.338899 1.203610 -8.147264 +v 0.628001 1.203610 -8.857970 +v -0.338898 0.003610 -8.147264 +v 0.628001 0.003610 -8.857970 +v -2.017782 1.203610 3.719780 +v -2.953916 1.203610 2.969012 +v -2.017782 0.003611 3.719780 +v -2.953915 0.003611 2.969012 +v -2.861232 1.203610 3.812463 +v -2.110465 1.203610 2.876329 +v -2.861232 0.003611 3.812463 +v -2.110465 0.003611 2.876329 +v 1.450961 1.203610 5.045464 +v 0.268659 1.203610 4.840132 +v 1.450961 0.003611 5.045464 +v 0.268660 0.003611 4.840132 +v 0.757144 1.203610 5.533949 +v 0.962477 1.203610 4.351647 +v 0.757144 0.003611 5.533949 +v 0.962477 0.003611 4.351646 +vt 0.000100 0.000100 +vt 0.999900 0.000100 +vt 0.999900 0.999900 +vt 0.000100 0.999900 +vn 0.000000 0.000000 1.000000 +vn 1.000000 0.000000 0.000000 +vn -0.906547 0.000000 0.422104 +vn 0.422104 0.000000 0.906547 +vn -0.747335 0.000000 0.664448 +vn 0.664448 0.000000 0.747335 +vn -0.685585 0.000000 0.727992 +vn 0.727992 0.000000 0.685585 +vn -0.917807 0.000001 -0.397027 +vn -0.397027 0.000000 0.917807 +vn -0.632813 0.000000 -0.774304 +vn -0.774305 0.000000 0.632813 +vn 0.692525 0.000000 0.721394 +vn 0.721393 -0.000000 -0.692526 +vn 0.721394 -0.000001 -0.692525 +vn -0.361660 0.000000 0.932310 +vn 0.932310 0.000000 0.361660 +vn -0.550575 0.000000 0.834786 +vn 0.834786 0.000000 0.550575 +vn -0.078976 0.000000 0.996877 +vn 0.996877 0.000000 0.078975 +vn -0.937052 0.000000 0.349191 +vn 0.349191 0.000001 0.937052 +vn 0.349191 -0.000000 0.937052 +vn 0.750161 0.000000 -0.661255 +vn 0.661255 -0.000000 0.750162 +vn 0.446586 -0.000000 -0.894741 +vn 0.894741 -0.000000 0.446586 +vn 0.877019 0.000000 0.480456 +vn -0.480456 0.000001 0.877019 +vn 0.418865 -0.000000 -0.908049 +vn 0.908049 0.000000 0.418865 +vn 0.092766 0.000000 -0.995688 +vn 0.995688 0.000000 0.092766 +vn -0.622618 -0.000001 -0.782526 +vn 0.782526 0.000001 -0.622618 +vn -0.480456 0.000000 0.877019 +vn 0.941795 -0.000000 -0.336188 +vn 0.336188 0.000000 0.941795 +vn 0.965404 -0.000000 -0.260759 +vn 0.260759 0.000000 0.965404 +vn -0.236386 0.000001 -0.971659 +vn 0.971659 -0.000000 -0.236386 +vn 0.965404 0.000001 -0.260759 +vn 0.260760 0.000000 0.965404 +vn 0.805749 -0.000000 -0.592257 +vn 0.592256 -0.000000 0.805750 +vn 0.625641 0.000001 -0.780111 +vn 0.780112 0.000000 0.625640 +vn 0.171110 0.000000 -0.985252 +vn 0.985252 0.000000 0.171111 +vn 0.664448 0.000000 0.747334 +vn -0.917807 -0.000000 -0.397028 +vn -0.632813 -0.000000 -0.774305 +vn -0.774304 0.000000 0.632813 +vn 0.721394 -0.000000 -0.692525 +vn -0.361659 0.000000 0.932310 +vn 0.661254 -0.000000 0.750162 +vn 0.877019 0.000001 0.480457 +vn 0.092765 -0.000000 -0.995688 +vn -0.622618 -0.000000 -0.782526 +vn 0.782525 -0.000000 -0.622619 +vn -0.236384 0.000000 -0.971660 +vn 0.971659 0.000000 -0.236385 +vn 0.965404 0.000000 -0.260760 +vn 0.260759 0.000001 0.965404 +vn 0.805750 0.000000 -0.592256 +vn 0.625640 -0.000000 -0.780112 +vn 0.780112 0.000000 0.625639 +s off +f 2/1/1 1/2/1 3/3/1 +f 6/1/2 5/2/2 7/3/2 +f 10/1/1 9/2/1 11/3/1 +f 14/1/2 13/2/2 15/3/2 +f 18/1/3 17/2/3 20/4/3 +f 22/1/4 21/2/4 23/3/4 +f 26/1/5 25/2/5 28/4/5 +f 30/1/6 29/2/6 31/3/6 +f 34/1/7 33/2/7 36/4/7 +f 38/1/8 37/2/8 39/3/8 +f 42/1/9 41/2/9 44/4/9 +f 46/1/10 45/2/10 48/4/10 +f 50/1/11 49/2/11 52/4/11 +f 54/1/12 53/2/12 56/4/12 +f 58/1/13 57/2/13 59/3/13 +f 62/1/14 61/2/14 63/3/14 +f 66/1/13 65/2/13 67/3/13 +f 70/1/15 69/2/15 71/3/15 +f 74/1/16 73/2/16 76/4/16 +f 78/1/17 77/2/17 79/3/17 +f 82/1/18 81/2/18 84/4/18 +f 86/1/19 85/2/19 87/3/19 +f 90/1/20 89/2/20 92/4/20 +f 94/1/21 93/2/21 95/3/21 +f 98/1/22 97/2/22 100/4/22 +f 102/1/23 101/2/23 103/3/23 +f 106/1/22 105/2/22 108/4/22 +f 110/1/24 109/2/24 111/3/24 +f 115/1/25 116/2/25 114/3/25 +f 119/1/26 120/2/26 118/3/26 +f 123/1/27 124/2/27 122/3/27 +f 127/1/28 128/2/28 126/3/28 +f 131/1/29 132/2/29 130/3/29 +f 135/1/30 136/2/30 133/4/30 +f 139/1/31 140/2/31 138/3/31 +f 143/1/32 144/2/32 142/3/32 +f 147/1/33 148/2/33 146/3/33 +f 151/1/34 152/2/34 150/3/34 +f 155/1/35 156/2/35 153/4/35 +f 159/1/36 160/2/36 158/3/36 +f 163/1/29 164/2/29 162/3/29 +f 167/1/37 168/2/37 165/4/37 +f 171/1/38 172/2/38 170/3/38 +f 175/1/39 176/2/39 174/3/39 +f 179/1/40 180/2/40 178/3/40 +f 183/1/41 184/2/41 182/3/41 +f 187/1/42 188/2/42 185/4/42 +f 191/1/43 192/2/43 190/3/43 +f 195/1/44 196/2/44 194/3/44 +f 199/1/45 200/2/45 198/3/45 +f 203/1/46 204/2/46 202/3/46 +f 207/1/47 208/2/47 206/3/47 +f 211/1/48 212/2/48 210/3/48 +f 215/1/49 216/2/49 214/3/49 +f 219/1/50 220/2/50 218/3/50 +f 223/1/51 224/2/51 222/3/51 +f 4/4/1 2/1/1 3/3/1 +f 8/4/2 6/1/2 7/3/2 +f 12/4/1 10/1/1 11/3/1 +f 16/4/2 14/1/2 15/3/2 +f 17/2/3 19/3/3 20/4/3 +f 24/4/4 22/1/4 23/3/4 +f 25/2/5 27/3/5 28/4/5 +f 32/4/52 30/1/52 31/3/52 +f 33/2/7 35/3/7 36/4/7 +f 40/4/8 38/1/8 39/3/8 +f 41/2/53 43/3/53 44/4/53 +f 45/2/10 47/3/10 48/4/10 +f 49/2/54 51/3/54 52/4/54 +f 53/2/55 55/3/55 56/4/55 +f 60/4/13 58/1/13 59/3/13 +f 64/4/14 62/1/14 63/3/14 +f 68/4/13 66/1/13 67/3/13 +f 72/4/56 70/1/56 71/3/56 +f 73/2/57 75/3/57 76/4/57 +f 80/4/17 78/1/17 79/3/17 +f 81/2/18 83/3/18 84/4/18 +f 88/4/19 86/1/19 87/3/19 +f 89/2/20 91/3/20 92/4/20 +f 96/4/21 94/1/21 95/3/21 +f 97/2/22 99/3/22 100/4/22 +f 104/4/24 102/1/24 103/3/24 +f 105/2/22 107/3/22 108/4/22 +f 112/4/24 110/1/24 111/3/24 +f 113/4/25 115/1/25 114/3/25 +f 117/4/58 119/1/58 118/3/58 +f 121/4/27 123/1/27 122/3/27 +f 125/4/28 127/1/28 126/3/28 +f 129/4/59 131/1/59 130/3/59 +f 136/2/37 134/3/37 133/4/37 +f 137/4/31 139/1/31 138/3/31 +f 141/4/32 143/1/32 142/3/32 +f 145/4/60 147/1/60 146/3/60 +f 149/4/34 151/1/34 150/3/34 +f 156/2/61 154/3/61 153/4/61 +f 157/4/62 159/1/62 158/3/62 +f 161/4/29 163/1/29 162/3/29 +f 168/2/37 166/3/37 165/4/37 +f 169/4/38 171/1/38 170/3/38 +f 173/4/39 175/1/39 174/3/39 +f 177/4/40 179/1/40 178/3/40 +f 181/4/45 183/1/45 182/3/45 +f 188/2/63 186/3/63 185/4/63 +f 189/4/64 191/1/64 190/3/64 +f 193/4/65 195/1/65 194/3/65 +f 197/4/66 199/1/66 198/3/66 +f 201/4/67 203/1/67 202/3/67 +f 205/4/47 207/1/47 206/3/47 +f 209/4/68 211/1/68 210/3/68 +f 213/4/69 215/1/69 214/3/69 +f 217/4/50 219/1/50 218/3/50 +f 221/4/51 223/1/51 222/3/51 diff --git a/res/grassTexture.png b/res/grassTexture.png new file mode 100644 index 0000000..ef72a83 Binary files /dev/null and b/res/grassTexture.png differ diff --git a/src/engineTester/MainGameLoop.java b/src/engineTester/MainGameLoop.java index 26a27bb..f3cce6b 100644 --- a/src/engineTester/MainGameLoop.java +++ b/src/engineTester/MainGameLoop.java @@ -55,9 +55,11 @@ public class MainGameLoop { TexturedModel grassModel = new TexturedModel(OBJLoader.loadObjModel("grassModel", loader), new ModelTexture(loader.loadTexture("grassTexture"))); - + grassModel.getTexture().setHasTransparency(true); + grassModel.getTexture().setUseFakeLighting(true); TexturedModel fernModel = new TexturedModel(OBJLoader.loadObjModel("fern", loader), new ModelTexture(loader.loadTexture("fern"))); + fernModel.getTexture().setHasTransparency(true); Light light = new Light(new Vector3f(3000,2000,2000), new Vector3f(1,1,1)); @@ -89,11 +91,11 @@ public class MainGameLoop { //entity.increaseRotation(0, 0, 0.01f); //entity.increaseRotation(0.01f, 0.02f, 0.0f); camera.move(); + renderer.processTerrain(terrain); + renderer.processTerrain(terrain2); for (Entity entity : entities) { renderer.processEntity(entity); } - renderer.processTerrain(terrain); - renderer.processTerrain(terrain2); renderer.render(light, camera); } }); diff --git a/src/models/TexturedModel.java b/src/models/TexturedModel.java index caf9d5b..53b03f4 100644 --- a/src/models/TexturedModel.java +++ b/src/models/TexturedModel.java @@ -7,25 +7,25 @@ public class TexturedModel { private RawModel rawModel; private ModelTexture texture; - public TexturedModel(RawModel model, ModelTexture texture) { - this.rawModel = model; - this.texture = texture; + public TexturedModel(RawModel model, ModelTexture texture) { + this.rawModel = model; + this.texture = texture; } - public RawModel getRawModel() { - return rawModel; - } + public RawModel getRawModel() { + return rawModel; + } - public void setRawModel(RawModel rawModel) { - this.rawModel = rawModel; - } + public void setRawModel(RawModel rawModel) { + this.rawModel = rawModel; + } - public ModelTexture getTexture() { - return texture; - } + public ModelTexture getTexture() { + return texture; + } - public void setTexture(ModelTexture texture) { - this.texture = texture; - } + public void setTexture(ModelTexture texture) { + this.texture = texture; + } } diff --git a/src/renderEngine/EntityRenderer.java b/src/renderEngine/EntityRenderer.java index 4848f47..03bdb19 100644 --- a/src/renderEngine/EntityRenderer.java +++ b/src/renderEngine/EntityRenderer.java @@ -57,12 +57,17 @@ public class EntityRenderer { GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); ModelTexture texture = model.getTexture(); + if (texture.isHasTransparency()) { + MasterRenderer.disableCulling(); + } + shader.loadFakeLightingVariable(texture.isUseFakeLighting()); shader.loadShineVariable(texture.getShineDamper(), texture.getReflectivity()); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getTexturedID()); } private void unbindTexturedModel() { + MasterRenderer.enableCulling(); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); diff --git a/src/renderEngine/Loader.java b/src/renderEngine/Loader.java index 79bf78f..717acdb 100644 --- a/src/renderEngine/Loader.java +++ b/src/renderEngine/Loader.java @@ -21,14 +21,7 @@ import de.matthiasmann.twl.utils.PNGDecoder; import de.matthiasmann.twl.utils.PNGDecoder.Format; import models.RawModel; -/** - * Handles the loading of geometry data into VAOs. It also keeps track of all - * the created VAOs and VBOs so that they can all be deleted when the game - * closes. - * - * @author Karl - * - */ + public class Loader { private List vaos = new ArrayList(); @@ -47,28 +40,6 @@ public class Loader { System.exit(-1); } } - /** - * Creates a VAO and stores the position data of the vertices into attribute - * 0 of the VAO. The indices are stored in an index buffer and bound to the - * VAO. - * - * @param positions - * - The 3D positions of each vertex in the geometry (in this - * example a quad). - * @param indices - * - The indices of the model that we want to store in the VAO. - * The indices indicate how the vertices should be connected - * together to form triangles. - * @return The loaded model. - */ - - public RawModel loadToVAO(float[] positions, int[] indices) { - int vaoID = createVAO(); - bindIndicesBuffer(indices); - storeDataInAttributeList(0, 3, positions); - unbindVAO(); - return new RawModel(vaoID, indices.length); - } public RawModel loadToVAO(float[] positions, float[] textureCoordinates, float[] normals, int[] indices) { int vaoID = createVAO(); bindIndicesBuffer(indices); @@ -117,7 +88,7 @@ public class Loader { GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); // Upload the texture data and generate mip maps (for scaling) - GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, tWidth, tHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, tWidth, tHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); // Setup the ST coordinate system @@ -125,8 +96,10 @@ public class Loader { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); // Setup what to do when the texture has to be scaled - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); +// GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); +// GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); this.exitOnGLError("loadPNGTexture"); diff --git a/src/renderEngine/MasterRenderer.java b/src/renderEngine/MasterRenderer.java index fd02f81..244e257 100644 --- a/src/renderEngine/MasterRenderer.java +++ b/src/renderEngine/MasterRenderer.java @@ -35,12 +35,22 @@ public class MasterRenderer { private List terrains = new ArrayList(); public MasterRenderer() { - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glEnable(GL11.GL_BACK); + enableCulling(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); createProjectionMatrix(); renderer = new EntityRenderer(shader, projectionMatrix); terrainRenderer = new TerrainRenderer(terrainShader, projectionMatrix); } + + public static void enableCulling() { + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_BACK); + } + public static void disableCulling() { + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BACK); + } public void render(Light sun, Camera camera) { prepare(); diff --git a/src/shaders/ShaderProgram.java b/src/shaders/ShaderProgram.java index 8cdc6e5..dd9f6ad 100644 --- a/src/shaders/ShaderProgram.java +++ b/src/shaders/ShaderProgram.java @@ -65,7 +65,8 @@ public abstract class ShaderProgram { GL20.glUniform3f(location, value.x, value.y, value.z); } protected void loadBoolean(int location, boolean value) { - GL20.glUniform1f(location, value?1.0f:0.0f); + //System.out.println("set value " + value + " " + (value==true?1.0f:0.0f)); + GL20.glUniform1f(location, value==true?1.0f:0.0f); } protected void loadMatrix(int location, Matrix4f value) { diff --git a/src/shaders/StaticShader.java b/src/shaders/StaticShader.java index dce68e8..872bca0 100644 --- a/src/shaders/StaticShader.java +++ b/src/shaders/StaticShader.java @@ -17,6 +17,7 @@ public class StaticShader extends ShaderProgram { private int location_lightColour; private int location_reflectivity; private int location_shineDamper; + private int location_useFakeLighting; public StaticShader() { super(VERTEX_FILE, FRAGMENT_FILE); @@ -38,7 +39,13 @@ public class StaticShader extends ShaderProgram { location_lightColour = super.getUniformLocation("lightColour"); location_reflectivity = super.getUniformLocation("reflectivity"); location_shineDamper = super.getUniformLocation("shineDamper"); + location_useFakeLighting = super.getUniformLocation("useFakeLighting"); } + + public void loadFakeLightingVariable(boolean useFake) { + super.loadBoolean(location_useFakeLighting, useFake); + } + public void loadShineVariable(float shineDamper, float reflectivity) { super.loadFloat(location_reflectivity, reflectivity); super.loadFloat(location_shineDamper, shineDamper); diff --git a/src/shaders/fragmentShader.txt b/src/shaders/fragmentShader.txt index 325900b..896772a 100644 --- a/src/shaders/fragmentShader.txt +++ b/src/shaders/fragmentShader.txt @@ -1,6 +1,6 @@ #version 400 core -in vec2 pass_textureCoords; +in vec2 pass_textureCoordinates; in vec3 surfaceNormal; in vec3 toLightVector; in vec3 toCameraVector; @@ -32,6 +32,13 @@ void main(void) { float damperFactor = pow(specularFactor, shineDamper); vec3 finalSpecular = damperFactor * reflectivity * lightColour; - out_Color = vec4(diffuse,1.0) * texture(textureSampler,pass_textureCoords) + vec4(finalSpecular, 1.0); + // disable transparency elements in the texture ... + // Can be set at the start of the shader ... + vec4 textureColour = texture(textureSampler,pass_textureCoordinates); + if (textureColour.a < 0.5) { + discard; + } + + out_Color = vec4(diffuse,1.0) * textureColour + vec4(finalSpecular, 1.0); } diff --git a/src/shaders/terrainFragmentShader.txt b/src/shaders/terrainFragmentShader.txt index 325900b..12dd662 100644 --- a/src/shaders/terrainFragmentShader.txt +++ b/src/shaders/terrainFragmentShader.txt @@ -1,6 +1,6 @@ #version 400 core -in vec2 pass_textureCoords; +in vec2 pass_textureCoordinates; in vec3 surfaceNormal; in vec3 toLightVector; in vec3 toCameraVector; @@ -32,6 +32,6 @@ void main(void) { float damperFactor = pow(specularFactor, shineDamper); vec3 finalSpecular = damperFactor * reflectivity * lightColour; - out_Color = vec4(diffuse,1.0) * texture(textureSampler,pass_textureCoords) + vec4(finalSpecular, 1.0); + out_Color = vec4(diffuse,1.0) * texture(textureSampler,pass_textureCoordinates) + vec4(finalSpecular, 1.0); } diff --git a/src/shaders/terrainVertexShader.txt b/src/shaders/terrainVertexShader.txt index 404f7bf..4b47da4 100644 --- a/src/shaders/terrainVertexShader.txt +++ b/src/shaders/terrainVertexShader.txt @@ -4,7 +4,7 @@ in vec3 position; in vec2 textureCoords; in vec3 normal; -out vec2 pass_textureCoords; +out vec2 pass_textureCoordinates; out vec3 surfaceNormal; out vec3 toLightVector; out vec3 toCameraVector; @@ -17,7 +17,7 @@ uniform vec3 lightPosition; void main(void) { vec4 worldPosition = transformationMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * viewMatrix * worldPosition; - pass_textureCoords = textureCoords; + pass_textureCoordinates = textureCoords; surfaceNormal = (transformationMatrix * vec4(normal, 0.0)).xyz; toLightVector = lightPosition - worldPosition.xyz; diff --git a/src/shaders/vertexShader.txt b/src/shaders/vertexShader.txt index 404f7bf..c449a1f 100644 --- a/src/shaders/vertexShader.txt +++ b/src/shaders/vertexShader.txt @@ -4,7 +4,7 @@ in vec3 position; in vec2 textureCoords; in vec3 normal; -out vec2 pass_textureCoords; +out vec2 pass_textureCoordinates; out vec3 surfaceNormal; out vec3 toLightVector; out vec3 toCameraVector; @@ -12,14 +12,20 @@ out vec3 toCameraVector; uniform mat4 transformationMatrix; uniform mat4 projectionMatrix; uniform mat4 viewMatrix; -uniform vec3 lightPosition; +uniform vec3 lightPosition; + +uniform float useFakeLighting; void main(void) { vec4 worldPosition = transformationMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * viewMatrix * worldPosition; - pass_textureCoords = textureCoords; + pass_textureCoordinates = textureCoords; - surfaceNormal = (transformationMatrix * vec4(normal, 0.0)).xyz; + vec3 actualNormal = normal; + if (useFakeLighting > 0.5) { + actualNormal = vec3(0.0, 1.0, 0.0); + } + surfaceNormal = (transformationMatrix * vec4(actualNormal, 0.0)).xyz; toLightVector = lightPosition - worldPosition.xyz; toCameraVector = (inverse(viewMatrix) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz; } diff --git a/src/textures/ModelTexture.java b/src/textures/ModelTexture.java index 62d5f2e..6c0b80f 100644 --- a/src/textures/ModelTexture.java +++ b/src/textures/ModelTexture.java @@ -6,8 +6,10 @@ public class ModelTexture { // Reflectivity of the light on the surface of the texture private float reflectivity = 0; - // Distance of whitch the camera must to be to receive the the reflection + // Distance of witch the camera must to be to receive the the reflection private float shineDamper = 1; + private boolean hasTransparency = false; + private boolean useFakeLighting = false; public ModelTexture(int id) { this.textureID = id; @@ -33,4 +35,21 @@ public class ModelTexture { this.shineDamper = shineDamper; } + public boolean isHasTransparency() { + return hasTransparency; + } + + public void setHasTransparency(boolean hasTransparency) { + this.hasTransparency = hasTransparency; + } + + public boolean isUseFakeLighting() { + return useFakeLighting; + } + + public void setUseFakeLighting(boolean useFakeLighting) { + this.useFakeLighting = useFakeLighting; + } + + }