00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035
00036 #include "SO3SCOL.h"
00037
00038
00039 #include "../SO3Renderer/SO3Root.h"
00040 #include "../SO3Renderer/SO3Window.h"
00041
00042
00043 #include "../SO3SceneGraph/SO3Environment.h"
00044 #include "../SO3SceneGraph/SO3Sun.h"
00045 #include "../SO3SceneGraph/SO3Moon.h"
00046 #include "../SO3SceneGraph/SO3Scene.h"
00047
00048
00049 #include "../SO3Utils/SO3ConversionTools.h"
00050
00060 int SO3EnvironmentSetViewport(mmachine m)
00061 {
00062 #ifdef SO3_DEBUG
00063 MMechostr(MSKDEBUG, "SO3EnvironmentSetViewport\n");
00064 #endif
00065
00066 int scolViewport = MMpull(m);
00067 int scolScene = MMget(m, 0);
00068 if((scolViewport==NIL)||(scolScene==NIL))
00069 {
00070 MMset(m, 0, NIL);
00071 return 0;
00072 }
00073
00074 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00075 if(parentScene==0)
00076 {
00077 MMechostr(MSKDEBUG, "SO3EnvironmentSetViewport: Scene instance is NULL\n");
00078 MMset(m, 0, NIL);
00079 return 0;
00080 }
00081
00082 SViewPort* targetViewport = (SViewPort*) MMfetch(m, MTOP(scolViewport), 0);
00083 if(targetViewport==0)
00084 {
00085 MMechostr(MSKDEBUG, "SO3EnvironmentSetViewport: Viewport instance is NULL\n");
00086 MMset(m, 0, NIL);
00087 return 0;
00088 }
00089
00090 parentScene->GetEnvironment()->SetViewport(targetViewport);
00091 MMset(m, 0, ITOM(1));
00092 return 0;
00093 }
00094
00103 int SO3EnvironmentGetWindSpeed(mmachine m)
00104 {
00105 int scolScene = MMget(m, 0);
00106 if(scolScene==NIL)
00107 {
00108 MMset(m, 0, NIL);
00109 return 0;
00110 }
00111
00112 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00113 if(parentScene==0)
00114 {
00115 MMechostr(MSKDEBUG, "SO3EnvironmentGetWindSpeed: Scene instance is NULL\n");
00116 MMset(m, 0, NIL);
00117 return 0;
00118 }
00119
00120 MMset(m, 0, FTOM(parentScene->GetEnvironment()->GetWindSpeed()));
00121 return 0;
00122 }
00123
00133 int SO3EnvironmentSetWindSpeed(mmachine m)
00134 {
00135 int scolWindSpeed = MMpull(m);
00136 int scolScene = MMget(m, 0);
00137 if((scolScene==NIL)||(scolWindSpeed==NIL))
00138 {
00139 MMset(m, 0, NIL);
00140 return 0;
00141 }
00142
00143 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00144 if(parentScene==0)
00145 {
00146 MMechostr(MSKDEBUG, "SO3EnvironmentSetWindSpeed: Scene instance is NULL\n");
00147 MMset(m, 0, NIL);
00148 return 0;
00149 }
00150
00151 parentScene->GetEnvironment()->SetWindSpeed(MTOF(scolWindSpeed));
00152 MMset(m, 0, ITOM(1));
00153 return 0;
00154 }
00155
00166 int SO3EnvironmentGetWindDirection(mmachine m)
00167 {
00168 int scolScene = MMget(m, 0);
00169 if(scolScene==NIL)
00170 {
00171 MMset(m, 0, NIL);
00172 return 0;
00173 }
00174
00175 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00176 if(parentScene==0)
00177 {
00178 MMechostr(MSKDEBUG, "SO3EnvironmentGetWindDirection: Scene instance is NULL\n");
00179 MMset(m, 0, NIL);
00180 return 0;
00181 }
00182
00183
00184 int scolWindDirection = MMmalloc(m, 6, TYPETAB);
00185 if(scolWindDirection==NIL)
00186 return MERRMEM;
00187
00188
00189 Ogre::Vector2 currentWindDirection = parentScene->GetEnvironment()->GetWindDirection();
00190 MMstore(m, scolWindDirection, 1, FTOM(currentWindDirection.x));
00191 MMstore(m, scolWindDirection, 0, FTOM(currentWindDirection.y));
00192 MMset(m, 0, PTOM(scolWindDirection));
00193 return 0;
00194 }
00195
00206 int SO3EnvironmentSetWindDirection(mmachine m)
00207 {
00208 int scolWindDirectionY = MMpull(m);
00209 int scolWindDirectionX = MMpull(m);
00210 int scolScene = MMget(m, 0);
00211 if((scolScene==NIL)||(scolWindDirectionX==NIL)||(scolWindDirectionY==NIL))
00212 {
00213 MMset(m, 0, NIL);
00214 return 0;
00215 }
00216
00217 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00218 if(parentScene==0)
00219 {
00220 MMechostr(MSKDEBUG, "SO3EnvironmentSetWindDirection: Scene instance is NULL\n");
00221 MMset(m, 0, NIL);
00222 return 0;
00223 }
00224
00225 parentScene->GetEnvironment()->SetWindDirection(Ogre::Vector2(MTOF(scolWindDirectionY), MTOF(scolWindDirectionX)));
00226 MMset(m, 0, ITOM(1));
00227 return 0;
00228 }
00229
00238 int SO3EnvironmentGetHumidity(mmachine m)
00239 {
00240 int scolScene = MMget(m, 0);
00241 if(scolScene==NIL)
00242 {
00243 MMset(m, 0, NIL);
00244 return 0;
00245 }
00246
00247 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00248 if(parentScene==0)
00249 {
00250 MMechostr(MSKDEBUG, "SO3EnvironmentGetHumidity: Scene instance is NULL\n");
00251 MMset(m, 0, NIL);
00252 return 0;
00253 }
00254
00255
00256 MMset(m, 0, FTOM(parentScene->GetEnvironment()->GetHumidity()));
00257 return 0;
00258 }
00259
00269 int SO3EnvironmentSetHumidity(mmachine m)
00270 {
00271 int scolHumidityFactor = MMpull(m);
00272 int scolScene = MMget(m, 0);
00273 if((scolScene==NIL)||(scolHumidityFactor==NIL))
00274 {
00275 MMset(m, 0, NIL);
00276 return 0;
00277 }
00278
00279 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00280 if(parentScene==0)
00281 {
00282 MMechostr(MSKDEBUG, "SO3EnvironmentSetHumidity: Scene instance is NULL\n");
00283 MMset(m, 0, NIL);
00284 return 0;
00285 }
00286
00287 parentScene->GetEnvironment()->SetHumidity(MTOF(scolHumidityFactor));
00288 MMset(m, 0, ITOM(1));
00289 return 0;
00290 }
00291
00300 int SO3EnvironmentGetTimeSpeedFactor(mmachine m)
00301 {
00302 int scolScene = MMget(m, 0);
00303 if(scolScene==NIL)
00304 {
00305 MMset(m, 0, NIL);
00306 return 0;
00307 }
00308
00309 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00310 if(parentScene==0)
00311 {
00312 MMechostr(MSKDEBUG, "SO3EnvironmentGetTimeSpeedFactor: Scene instance is NULL\n");
00313 MMset(m, 0, NIL);
00314 return 0;
00315 }
00316
00317 MMset(m, 0, FTOM(parentScene->GetEnvironment()->GetTimeSpeedFactor()));
00318 return 0;
00319 }
00320
00330 int SO3EnvironmentSetTimeSpeedFactor(mmachine m)
00331 {
00332 int scolTimeSpeedFactor = MMpull(m);
00333 int scolScene = MMget(m, 0);
00334 if(scolScene==NIL)
00335 {
00336 MMset(m, 0, NIL);
00337 return 0;
00338 }
00339
00340 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00341 if(parentScene==0)
00342 {
00343 MMechostr(MSKDEBUG, "SO3EnvironmentSetTimeSpeedFactor: Scene instance is NULL\n");
00344 MMset(m, 0, NIL);
00345 return 0;
00346 }
00347
00348
00349 float timeSpeedFactor = 0;
00350 if(scolTimeSpeedFactor != NIL)
00351 timeSpeedFactor = MTOF(scolTimeSpeedFactor);
00352
00353 parentScene->GetEnvironment()->SetTimeSpeedFactor(timeSpeedFactor);
00354 MMset(m, 0, ITOM(1));
00355 return 0;
00356 }
00357
00358
00367 int SO3EnvironmentGetPaused(mmachine m)
00368 {
00369 int scolScene = MMget(m, 0);
00370 if(scolScene==NIL)
00371 {
00372 MMset(m, 0, NIL);
00373 return 0;
00374 }
00375
00376 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00377 if(parentScene==0)
00378 {
00379 MMechostr(MSKDEBUG, "SO3EnvironmentGetPaused: Scene instance is NULL\n");
00380 MMset(m, 0, NIL);
00381 return 0;
00382 }
00383
00384 bool isPaused = parentScene->GetEnvironment()->GetPaused();
00385 if(isPaused)
00386 MMset(m, 0, ITOM(1));
00387 else
00388 MMset(m, 0, ITOM(0));
00389 return 0;
00390 }
00391
00392
00402 int SO3EnvironmentSetPaused(mmachine m)
00403 {
00404 int scolEnvironmentPause = MMpull(m);
00405 int scolScene = MMget(m, 0);
00406 if((scolScene==NIL)||(scolEnvironmentPause==NIL))
00407 {
00408 MMset(m, 0, NIL);
00409 return 0;
00410 }
00411
00412 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00413 if(parentScene==0)
00414 {
00415 MMechostr(MSKDEBUG, "SO3EnvironmentSetPaused: Scene instance is NULL\n");
00416 MMset(m, 0, NIL);
00417 return 0;
00418 }
00419
00420 bool pause = false;
00421 if(MTOI(scolEnvironmentPause) == 1)
00422 pause = true;
00423
00424 parentScene->GetEnvironment()->SetPaused(pause);
00425 MMset(m, 0, ITOM(1));
00426 return 0;
00427 }
00428
00429
00444 int SO3EnvironmentGetDateTime(mmachine m)
00445 {
00446 int scolScene = MMget(m, 0);
00447 if(scolScene==NIL)
00448 {
00449 MMset(m, 0, NIL);
00450 return 0;
00451 }
00452
00453 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00454 if(parentScene==0)
00455 {
00456 MMechostr(MSKDEBUG, "SO3EnvironmentGetDateTime: Scene instance is NULL\n");
00457 MMset(m, 0, NIL);
00458 return 0;
00459 }
00460
00461
00462 int scolDateTime = MMmalloc(m, 6, TYPETAB);
00463 if(scolDateTime==NIL)
00464 return MERRMEM;
00465
00466
00467 SDateTime currentDateTime = parentScene->GetEnvironment()->GetDateTime();
00468 MMstore(m, scolDateTime, 5, ITOM(currentDateTime.year));
00469 MMstore(m, scolDateTime, 4, ITOM(currentDateTime.month));
00470 MMstore(m, scolDateTime, 3, ITOM(currentDateTime.day));
00471 MMstore(m, scolDateTime, 2, ITOM(currentDateTime.hour));
00472 MMstore(m, scolDateTime, 1, ITOM(currentDateTime.minute));
00473 MMstore(m, scolDateTime, 0, ITOM(currentDateTime.second));
00474 MMset(m, 0, PTOM(scolDateTime));
00475 return 0;
00476 }
00477
00492 int SO3EnvironmentSetDateTime(mmachine m)
00493 {
00494 int scolSeconds = MMpull(m);
00495 int scolMinutes = MMpull(m);
00496 int scolHours = MMpull(m);
00497 int scolDay = MMpull(m);
00498 int scolMonth = MMpull(m);
00499 int scolYear = MMpull(m);
00500 int scolScene = MMget(m, 0);
00501 if(scolScene==NIL)
00502 {
00503 MMset(m, 0, NIL);
00504 return 0;
00505 }
00506
00507 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00508 if(parentScene==0)
00509 {
00510 MMechostr(MSKDEBUG, "SO3EnvironmentSetDateTime: Scene instance is NULL\n");
00511 MMset(m, 0, NIL);
00512 return 0;
00513 }
00514
00515
00516 SDateTime currentDateTime = parentScene->GetEnvironment()->GetDateTime();
00517
00518
00519 if(scolYear != NIL)
00520 currentDateTime.year = MTOI(scolYear);
00521
00522
00523 if(scolMonth != NIL)
00524 currentDateTime.month = MTOI(scolMonth);
00525
00526
00527 if(scolDay != NIL)
00528 currentDateTime.day = MTOI(scolDay);
00529
00530
00531 if(scolHours != NIL)
00532 currentDateTime.hour = MTOI(scolHours);
00533
00534
00535 if(scolMinutes != NIL)
00536 currentDateTime.minute = MTOI(scolMinutes);
00537
00538
00539 if(scolSeconds != NIL)
00540 currentDateTime.second = MTOI(scolSeconds);
00541
00542
00543 parentScene->GetEnvironment()->SetDateTime(currentDateTime);
00544 MMset(m, 0, ITOM(1));
00545 return 0;
00546 }
00547
00556 int SO3EnvironmentGetLongitude(mmachine m)
00557 {
00558 int scolScene = MMget(m, 0);
00559 if(scolScene==NIL)
00560 {
00561 MMset(m, 0, NIL);
00562 return 0;
00563 }
00564
00565 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00566 if(parentScene==0)
00567 {
00568 MMechostr(MSKDEBUG, "SO3EnvironmentGetLongitude: Scene instance is NULL\n");
00569 MMset(m, 0, NIL);
00570 return 0;
00571 }
00572
00573 MMset(m, 0, FTOM(parentScene->GetEnvironment()->GetLongitude().valueDegrees()));
00574 return 0;
00575 }
00576
00586 int SO3EnvironmentSetLongitude(mmachine m)
00587 {
00588 int scolLongitude = MMpull(m);
00589 int scolScene = MMget(m, 0);
00590 if((scolScene==NIL)||(scolLongitude==NIL))
00591 {
00592 MMset(m, 0, NIL);
00593 return 0;
00594 }
00595
00596 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00597 if(parentScene==0)
00598 {
00599 MMechostr(MSKDEBUG, "SO3EnvironmentSetLongitude: Scene instance is NULL\n");
00600 MMset(m, 0, NIL);
00601 return 0;
00602 }
00603
00604 parentScene->GetEnvironment()->SetLongitude(Ogre::Degree(MTOF(scolLongitude)));
00605 MMset(m, 0, ITOM(1));
00606 return 0;
00607 }
00608
00617 int SO3EnvironmentGetLatitude(mmachine m)
00618 {
00619 int scolScene = MMget(m, 0);
00620 if(scolScene==NIL)
00621 {
00622 MMset(m, 0, NIL);
00623 return 0;
00624 }
00625
00626 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00627 if(parentScene==0)
00628 {
00629 MMechostr(MSKDEBUG, "SO3EnvironmentGetLatitude: Scene instance is NULL\n");
00630 MMset(m, 0, NIL);
00631 return 0;
00632 }
00633
00634 MMset(m, 0, FTOM(parentScene->GetEnvironment()->GetLatitude().valueDegrees()));
00635 return 0;
00636 }
00637
00647 int SO3EnvironmentSetLatitude(mmachine m)
00648 {
00649 int scolLatitude = MMpull(m);
00650 int scolScene = MMget(m, 0);
00651 if((scolScene==NIL)||(scolLatitude==NIL))
00652 {
00653 MMset(m, 0, NIL);
00654 return 0;
00655 }
00656
00657 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00658 if(parentScene==0)
00659 {
00660 MMechostr(MSKDEBUG, "SO3EnvironmentSetLatitude: Scene instance is NULL\n");
00661 MMset(m, 0, NIL);
00662 return 0;
00663 }
00664
00665 parentScene->GetEnvironment()->SetLatitude(Ogre::Degree(MTOF(scolLatitude)));
00666 MMset(m, 0, ITOM(1));
00667 return 0;
00668 }
00669
00678 int SO3WaterGetEnable(mmachine m)
00679 {
00680 int scolScene = MMget(m, 0);
00681 if(scolScene==NIL)
00682 {
00683 MMset(m, 0, NIL);
00684 return 0;
00685 }
00686
00687 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00688 if(parentScene==0)
00689 {
00690 MMechostr(MSKDEBUG, "SO3WaterGetEnable: Scene instance is NULL\n");
00691 MMset(m, 0, NIL);
00692 return 0;
00693 }
00694
00695 if(parentScene->GetEnvironment()->GetWaterEnable())
00696 MMset(m, 0, ITOM(1));
00697 else
00698 MMset(m, 0, ITOM(0));
00699 return 0;
00700 }
00701
00711 int SO3WaterSetEnable(mmachine m)
00712 {
00713 int scolEnable = MMpull(m);
00714 int scolScene = MMget(m, 0);
00715 if(scolScene==NIL)
00716 {
00717 MMset(m, 0, NIL);
00718 return 0;
00719 }
00720
00721 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00722 if(parentScene==0)
00723 {
00724 MMechostr(MSKDEBUG, "SO3WaterSetEnable: Scene instance is NULL\n");
00725 MMset(m, 0, NIL);
00726 return 0;
00727 }
00728
00729 bool enable = false;
00730 if(MTOI(scolEnable) == 1)
00731 enable = true;
00732
00733 parentScene->GetEnvironment()->SetWaterEnable(enable);
00734 MMset(m, 0, ITOM(1));
00735 return 0;
00736 }
00737
00756 int SO3WaterComponentGetEnabled(mmachine m)
00757 {
00758 int scolComponentType = MMpull(m);
00759 int scolScene = MMget(m, 0);
00760 if((scolScene==NIL)||(scolComponentType==NIL))
00761 {
00762 MMset(m, 0, NIL);
00763 return 0;
00764 }
00765
00766 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00767 if(parentScene==0)
00768 {
00769 MMechostr(MSKDEBUG, "SO3WaterComponentGetEnabled: Scene instance is NULL\n");
00770 MMset(m, 0, NIL);
00771 return 0;
00772 }
00773
00774 SWater* water = parentScene->GetEnvironment()->GetWater();
00775 if(water)
00776 {
00777 try
00778 {
00779 bool isEnable = false;
00780 if(water->GetComponent(static_cast<SWater::WaterComponentType>(MTOI(scolComponentType)))->GetEnabled())
00781 isEnable = true;
00782
00783 if(isEnable)
00784 MMset(m, 0, ITOM(1));
00785 else
00786 MMset(m, 0, ITOM(0));
00787 return 0;
00788 }
00789 catch(const Ogre::Exception& e)
00790 {
00791 MMechostr(MSKDEBUG, "SO3WaterComponentGetEnabled: %s\n", e.getFullDescription().c_str());
00792 }
00793 }
00794 MMset(m, 0, NIL);
00795 return 0;
00796 }
00797
00817 int SO3WaterComponentSetEnabled(mmachine m)
00818 {
00819 int scolEnableComponent = MMpull(m);
00820 int scolComponentType = MMpull(m);
00821 int scolScene = MMget(m, 0);
00822 if((scolScene==NIL)||(scolComponentType==NIL)||(scolEnableComponent==NIL))
00823 {
00824 MMset(m, 0, NIL);
00825 return 0;
00826 }
00827
00828 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00829 if(parentScene==0)
00830 {
00831 MMechostr(MSKDEBUG, "SO3WaterComponentSetEnabled: Scene instance is NULL\n");
00832 MMset(m, 0, NIL);
00833 return 0;
00834 }
00835
00836 SWater* water = parentScene->GetEnvironment()->GetWater();
00837 if(water)
00838 {
00839 bool enableComponent = false;
00840 if(MTOI(scolEnableComponent) == 1)
00841 enableComponent = true;
00842
00843 try
00844 {
00845 water->GetComponent(static_cast<SWater::WaterComponentType>(MTOI(scolComponentType)))->SetEnabled(enableComponent);
00846 }
00847 catch(const Ogre::Exception& e)
00848 {
00849 MMechostr(MSKDEBUG, "SO3WaterComponentSetEnabled: %s\n", e.getFullDescription().c_str());
00850 MMset(m, 0, NIL);
00851 return 0;
00852 }
00853 }
00854
00855 MMset(m, 0, ITOM(1));
00856 return 0;
00857 }
00858
00867 int SO3SkyGetEnable(mmachine m)
00868 {
00869 int scolScene = MMget(m, 0);
00870 if(scolScene==NIL)
00871 {
00872 MMset(m, 0, NIL);
00873 return 0;
00874 }
00875
00876 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00877 if(parentScene==0)
00878 {
00879 MMechostr(MSKDEBUG, "SO3SkyGetEnable: Scene instance is NULL\n");
00880 MMset(m, 0, NIL);
00881 return 0;
00882 }
00883
00884 if(parentScene->GetEnvironment()->GetSkyEnable())
00885 MMset(m, 0, ITOM(1));
00886 else
00887 MMset(m, 0, ITOM(0));
00888 return 0;
00889 }
00890
00900 int SO3SkySetEnable(mmachine m)
00901 {
00902 int scolEnable = MMpull(m);
00903 int scolScene = MMget(m, 0);
00904 if(scolScene==NIL)
00905 {
00906 MMset(m, 0, NIL);
00907 return 0;
00908 }
00909
00910 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00911 if(parentScene==0)
00912 {
00913 MMechostr(MSKDEBUG, "SO3SkySetEnable: Scene instance is NULL\n");
00914 MMset(m, 0, NIL);
00915 return 0;
00916 }
00917
00918 bool enable = false;
00919 if(MTOI(scolEnable) == 1)
00920 enable = true;
00921
00922 parentScene->GetEnvironment()->SetSkyEnable(enable);
00923 MMset(m, 0, ITOM(1));
00924 return 0;
00925 }
00926
00940 int SO3SkyComponentGetEnabled(mmachine m)
00941 {
00942 int scolComponentType = MMpull(m);
00943 int scolScene = MMget(m, 0);
00944 if((scolScene==NIL)||(scolComponentType==NIL))
00945 {
00946 MMset(m, 0, NIL);
00947 return 0;
00948 }
00949
00950 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
00951 if(parentScene==0)
00952 {
00953 MMechostr(MSKDEBUG, "SO3SkyComponentGetEnabled: Scene instance is NULL\n");
00954 MMset(m, 0, NIL);
00955 return 0;
00956 }
00957
00958 SSky* sky = parentScene->GetEnvironment()->GetSky();
00959 if(sky)
00960 {
00961 try
00962 {
00963 bool isEnable = false;
00964 if(sky->GetComponent(static_cast<SSky::SkyComponentType>(MTOI(scolComponentType)))->GetEnabled())
00965 isEnable = true;
00966
00967 if(isEnable)
00968 MMset(m, 0, ITOM(1));
00969 else
00970 MMset(m, 0, ITOM(0));
00971 return 0;
00972 }
00973 catch(const Ogre::Exception& e)
00974 {
00975 MMechostr(MSKDEBUG, "SO3SkyComponentGetEnabled: %s\n", e.getFullDescription().c_str());
00976 }
00977 }
00978
00979 MMset(m, 0, NIL);
00980 return 0;
00981 }
00982
00995 int SO3SkyComponentSetEnabled(mmachine m)
00996 {
00997 int scolEnableComponent = MMpull(m);
00998 int scolComponentType = MMpull(m);
00999 int scolScene = MMget(m, 0);
01000 if((scolScene==NIL)||(scolEnableComponent==NIL)||(scolEnableComponent==NIL))
01001 {
01002 MMset(m, 0, NIL);
01003 return 0;
01004 }
01005
01006 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01007 if(parentScene==0)
01008 {
01009 MMechostr(MSKDEBUG, "SO3SkyComponentSetEnabled: Scene instance is NULL\n");
01010 MMset(m, 0, NIL);
01011 return 0;
01012 }
01013
01014 SSky* sky = parentScene->GetEnvironment()->GetSky();
01015 if(sky)
01016 {
01017 try
01018 {
01019 bool enableComponent = false;
01020 if(MTOI(scolEnableComponent) == 1)
01021 enableComponent = true;
01022
01023 sky->GetComponent(static_cast<SSky::SkyComponentType>(MTOI(scolComponentType)))->SetEnabled(enableComponent);
01024 }
01025 catch(const Ogre::Exception& e)
01026 {
01027 MMechostr(MSKDEBUG, "SO3SkyComponentSetEnabled: %s\n", e.getFullDescription().c_str());
01028 MMset(m, 0, NIL);
01029 return 0;
01030 }
01031 }
01032
01033 MMset(m, 0, ITOM(1));
01034 return 0;
01035 }
01036
01045 int SO3WaterGetPosition(mmachine m)
01046 {
01047 int scolScene = MMget(m, 0);
01048 if(scolScene==NIL)
01049 {
01050 MMset(m, 0, NIL);
01051 return 0;
01052 }
01053
01054 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01055 if(parentScene==0)
01056 {
01057 MMechostr(MSKDEBUG, "SO3WaterGetPosition: Scene instance is NULL\n");
01058 MMset(m, 0, NIL);
01059 return 0;
01060 }
01061
01062 SWater* water = parentScene->GetEnvironment()->GetWater();
01063 if(water)
01064 {
01065
01066 int scolWaterPosition = MMmalloc(m, 3, TYPETAB);
01067 if(scolWaterPosition==NIL)
01068 return MERRMEM;
01069
01070
01071 Ogre::Vector3 waterPosition = water->GetPosition();
01072 MMstore(m, scolWaterPosition, 2, FTOM(waterPosition.x));
01073 MMstore(m, scolWaterPosition, 1, FTOM(waterPosition.y));
01074 MMstore(m, scolWaterPosition, 0, FTOM(waterPosition.z));
01075 MMset(m, 0, PTOM(scolWaterPosition));
01076 return 0;
01077 }
01078
01079 MMset(m, 0, NIL);
01080 return 0;
01081 }
01082
01083
01093 int SO3WaterSetPosition(mmachine m)
01094 {
01095 int scolWaterPosition = MMpull(m);
01096 int scolScene = MMget(m, 0);
01097 if((scolScene==NIL)||(scolWaterPosition==NIL))
01098 {
01099 MMset(m, 0, NIL);
01100 return 0;
01101 }
01102
01103 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01104 if(parentScene==0)
01105 {
01106 MMechostr(MSKDEBUG, "SO3WaterSetPosition: Scene instance is NULL\n");
01107 MMset(m, 0, NIL);
01108 return 0;
01109 }
01110
01111 SWater* water = parentScene->GetEnvironment()->GetWater();
01112 if(water)
01113 {
01114 Ogre::Vector3 waterPosition;
01115 waterPosition.x = MTOF(MMfetch(m, MTOP(scolWaterPosition), 0));
01116 waterPosition.y = MTOF(MMfetch(m, MTOP(scolWaterPosition), 1));
01117 waterPosition.z = MTOF(MMfetch(m, MTOP(scolWaterPosition), 2));
01118 water->SetPosition(waterPosition);
01119 }
01120
01121 MMset(m, 0, ITOM(1));
01122 return 0;
01123 }
01124
01133 int SO3WaterGetColor(mmachine m)
01134 {
01135 int scolScene = MMget(m, 0);
01136 if(scolScene==NIL)
01137 {
01138 MMset(m, 0, NIL);
01139 return 0;
01140 }
01141
01142 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01143 if(parentScene==0)
01144 {
01145 MMechostr(MSKDEBUG, "SO3WaterGetColor: Scene instance is NULL\n");
01146 MMset(m, 0, NIL);
01147 return 0;
01148 }
01149
01150 SWater* water = parentScene->GetEnvironment()->GetWater();
01151 if(water)
01152 {
01153 MMset(m, 0, ITOM(ConversionTools::OgreToScolColorRGBA(water->GetColor())));
01154 return 0;
01155 }
01156
01157 MMset(m, 0, NIL);
01158 return 0;
01159 }
01160
01170 int SO3WaterSetColor(mmachine m)
01171 {
01172 int scolWaterColor = MMpull(m);
01173 int scolScene = MMget(m, 0);
01174 if((scolScene==NIL)||(scolWaterColor==NIL))
01175 {
01176 MMset(m, 0, NIL);
01177 return 0;
01178 }
01179
01180 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01181 if(parentScene==0)
01182 {
01183 MMechostr(MSKDEBUG, "SO3WaterSetColor: Scene instance is NULL\n");
01184 MMset(m, 0, NIL);
01185 return 0;
01186 }
01187
01188 SWater* water = parentScene->GetEnvironment()->GetWater();
01189 if(water)
01190 {
01191 water->SetColor(ConversionTools::ScolToOgreColorRGBA(MTOI(scolWaterColor)));
01192 MMset(m, 0, ITOM(1));
01193 return 0;
01194 }
01195
01196 MMset(m, 0, NIL);
01197 return 0;
01198 }
01199
01208 int SO3WaterGetAnimationSpeed(mmachine m)
01209 {
01210 int scolScene = MMget(m, 0);
01211 if(scolScene==NIL)
01212 {
01213 MMset(m, 0, NIL);
01214 return 0;
01215 }
01216
01217 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01218 if(parentScene==0)
01219 {
01220 MMechostr(MSKDEBUG, "SO3WaterGetAnimationSpeed: Scene instance is NULL\n");
01221 MMset(m, 0, NIL);
01222 return 0;
01223 }
01224
01225 SWater* water = parentScene->GetEnvironment()->GetWater();
01226 if(water)
01227 {
01228 MMset(m, 0, FTOM(water->GetAnimationSpeed()));
01229 return 0;
01230 }
01231
01232 MMset(m, 0, NIL);
01233 return 0;
01234 }
01235
01236
01246 int SO3WaterSetAnimationSpeed(mmachine m)
01247 {
01248 int scolWaterAnimationSpeed = MMpull(m);
01249 int scolScene = MMget(m, 0);
01250 if((scolScene==NIL)||(scolWaterAnimationSpeed==NIL))
01251 {
01252 MMset(m, 0, NIL);
01253 return 0;
01254 }
01255
01256 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01257 if(parentScene==0)
01258 {
01259 MMechostr(MSKDEBUG, "SO3WaterSetAnimationSpeed: Scene instance is NULL\n");
01260 MMset(m, 0, NIL);
01261 return 0;
01262 }
01263
01264 SWater* water = parentScene->GetEnvironment()->GetWater();
01265 if(water)
01266 {
01267 water->SetAnimationSpeed(MTOF(scolWaterAnimationSpeed));
01268 }
01269
01270 MMset(m, 0, ITOM(1));
01271 return 0;
01272 }
01273
01274
01287 int SO3WaterGetSunParameters(mmachine m)
01288 {
01289 int scolScene = MMget(m, 0);
01290 if(scolScene==NIL)
01291 {
01292 MMset(m, 0, NIL);
01293 return 0;
01294 }
01295
01296 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01297 if(parentScene==0)
01298 {
01299 MMechostr(MSKDEBUG, "SO3WaterGetSunParameters: Scene instance is NULL\n");
01300 MMset(m, 0, NIL);
01301 return 0;
01302 }
01303
01304
01305 SWater* water = parentScene->GetEnvironment()->GetWater();
01306 if(water)
01307 {
01308
01309 SWater::WaterComponentSun* sun = water->GetSun();
01310
01311
01312 int scolSunPosition = MMmalloc(m, 3, TYPETAB);
01313 if(scolSunPosition==NIL)
01314 return MERRMEM;
01315
01316
01317 Ogre::Vector3 sunPosition = sun->GetPosition();
01318 MMstore(m, scolSunPosition, 0, FTOM(sunPosition.x));
01319 MMstore(m, scolSunPosition, 1, FTOM(sunPosition.y));
01320 MMstore(m, scolSunPosition, 2, FTOM(sunPosition.z));
01321 MMpush(m, PTOM(scolSunPosition));
01322
01323
01324 MMpush(m, FTOM(sun->GetStrength()));
01325
01326
01327 MMpush(m, FTOM(sun->GetArea()));
01328
01329
01330 MMpush(m, ITOM(ConversionTools::OgreToScolColorRGBA(sun->GetColor())));
01331
01332
01333 int result = MMmalloc(m, 4, TYPETAB);
01334 if(result==NIL)
01335 return MERRMEM;
01336
01337
01338 MMstore(m, result, 3, MMpull(m));
01339 MMstore(m, result, 2, MMpull(m));
01340 MMstore(m, result, 1, MMpull(m));
01341 MMstore(m, result, 0, MMpull(m));
01342 MMset(m, 0, PTOM(result));
01343 return 0;
01344 }
01345
01346 MMset(m, 0, NIL);
01347 return 0;
01348 }
01349
01362 int SO3WaterSetSunParameters(mmachine m)
01363 {
01364 int scolSunColor = MMpull(m);
01365 int scolSunArea = MMpull(m);
01366 int scolSunStrength = MMpull(m);
01367 int scolSunPosition = MMpull(m);
01368 int scolScene = MMget(m, 0);
01369 if(scolScene==NIL)
01370 {
01371 MMset(m, 0, NIL);
01372 return 0;
01373 }
01374
01375 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01376 if(parentScene==0)
01377 {
01378 MMechostr(MSKDEBUG, "SO3WaterSetSunParameters: Scene instance is NULL\n");
01379 MMset(m, 0, NIL);
01380 return 0;
01381 }
01382
01383
01384 SWater* water = parentScene->GetEnvironment()->GetWater();
01385 if(water)
01386 {
01387
01388 SWater::WaterComponentSun* sun = water->GetSun();
01389
01390
01391 if(scolSunPosition!=NIL)
01392 {
01393 Ogre::Vector3 sunPosition;
01394 sunPosition.x = MTOF(MMfetch(m, MTOP(scolSunPosition), 0));
01395 sunPosition.y = MTOF(MMfetch(m, MTOP(scolSunPosition), 1));
01396 sunPosition.z = MTOF(MMfetch(m, MTOP(scolSunPosition), 2));
01397 sun->SetPosition(sunPosition);
01398 }
01399
01400
01401 if(scolSunStrength!=NIL)
01402 sun->SetStrength(MTOF(scolSunStrength));
01403
01404
01405 if(scolSunArea!=NIL)
01406 sun->SetArea(MTOF(scolSunArea));
01407
01408
01409 if(scolSunColor!=NIL)
01410 sun->SetColor(ConversionTools::ScolToOgreColorRGBA(MTOI(scolSunColor)));
01411 }
01412
01413 MMset(m, 0, ITOM(1));
01414 return 0;
01415 }
01416
01429 int SO3WaterGetFoamParameters(mmachine m)
01430 {
01431 int scolScene = MMget(m, 0);
01432 if(scolScene==NIL)
01433 {
01434 MMset(m, 0, NIL);
01435 return 0;
01436 }
01437
01438 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01439 if(parentScene==0)
01440 {
01441 MMechostr(MSKDEBUG, "SO3WaterGetFoamParameters: Scene instance is NULL\n");
01442 MMset(m, 0, NIL);
01443 return 0;
01444 }
01445
01446
01447 SWater* water = parentScene->GetEnvironment()->GetWater();
01448 if(water)
01449 {
01450
01451 SWater::WaterComponentFoam* foam = water->GetFoam();
01452
01453
01454 MMpush(m, FTOM(foam->GetMaxDistance()));
01455
01456
01457 MMpush(m, FTOM(foam->GetScale()));
01458
01459
01460 MMpush(m, FTOM(foam->GetStart()));
01461
01462
01463 MMpush(m, FTOM(foam->GetTransparency()));
01464
01465
01466 int result = MMmalloc(m, 4, TYPETAB);
01467 if(result==NIL)
01468 return MERRMEM;
01469
01470
01471 MMstore(m, result, 3, MMpull(m));
01472 MMstore(m, result, 2, MMpull(m));
01473 MMstore(m, result, 1, MMpull(m));
01474 MMstore(m, result, 0, MMpull(m));
01475 MMset(m, 0, PTOM(result));
01476 return 0;
01477 }
01478
01479 MMset(m, 0, NIL);
01480 return 0;
01481 }
01482
01495 int SO3WaterSetFoamParameters(mmachine m)
01496 {
01497 int scolFoamTransparancy = MMpull(m);
01498 int scolFoamStart = MMpull(m);
01499 int scolFoamScale = MMpull(m);
01500 int scolFoamMaxDistance = MMpull(m);
01501 int scolScene = MMget(m, 0);
01502 if(scolScene==NIL)
01503 {
01504 MMset(m, 0, NIL);
01505 return 0;
01506 }
01507
01508 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01509 if(parentScene==0)
01510 {
01511 MMechostr(MSKDEBUG, "SO3WaterSetFoamParameters: Scene instance is NULL\n");
01512 MMset(m, 0, NIL);
01513 return 0;
01514 }
01515
01516
01517 SWater* water = parentScene->GetEnvironment()->GetWater();
01518 if(water)
01519 {
01520
01521 SWater::WaterComponentFoam* foam = water->GetFoam();
01522
01523
01524 if(scolFoamMaxDistance!=NIL)
01525 foam->SetMaxDistance(MTOF(scolFoamMaxDistance));
01526
01527
01528 if(scolFoamScale!=NIL)
01529 foam->SetScale(MTOF(scolFoamScale));
01530
01531
01532 if(scolFoamStart!=NIL)
01533 foam->SetStart(MTOF(scolFoamStart));
01534
01535
01536 if(scolFoamTransparancy!=NIL)
01537 foam->SetTransparency(MTOF(scolFoamTransparancy));
01538 }
01539
01540 MMset(m, 0, ITOM(1));
01541 return 0;
01542 }
01543
01554 int SO3WaterGetDepthParameters(mmachine m)
01555 {
01556 int scolScene = MMget(m, 0);
01557 if(scolScene==NIL)
01558 {
01559 MMset(m, 0, NIL);
01560 return 0;
01561 }
01562
01563 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01564 if(parentScene==0)
01565 {
01566 MMechostr(MSKDEBUG, "SO3WaterGetDepthParameters: Scene instance is NULL\n");
01567 MMset(m, 0, NIL);
01568 return 0;
01569 }
01570
01571
01572 SWater* water = parentScene->GetEnvironment()->GetWater();
01573 if(water)
01574 {
01575
01576 MMpush(m, FTOM(water->GetDepth()->GetDepthLimit()));
01577
01578
01579 MMpush(m, FTOM(water->GetDepth()->GetDistortionLimit()));
01580
01581
01582 int result = MMmalloc(m, 2, TYPETAB);
01583 if(result==NIL)
01584 return MERRMEM;
01585
01586
01587 MMstore(m, result, 1, MMpull(m));
01588 MMstore(m, result, 0, MMpull(m));
01589 MMset(m, 0, PTOM(result));
01590 return 0;
01591 }
01592
01593 MMset(m, 0, NIL);
01594 return 0;
01595 }
01596
01607 int SO3WaterSetDepthParameters(mmachine m)
01608 {
01609 int scolDistortionDepthLimit = MMpull(m);
01610 int scolDepthLimit = MMpull(m);
01611 int scolScene = MMget(m, 0);
01612 if(scolScene==NIL)
01613 {
01614 MMset(m, 0, NIL);
01615 return 0;
01616 }
01617
01618 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01619 if(parentScene==0)
01620 {
01621 MMechostr(MSKDEBUG, "SO3WaterSetDepthParameters: Scene instance is NULL\n");
01622 MMset(m, 0, NIL);
01623 return 0;
01624 }
01625
01626
01627 SWater* water = parentScene->GetEnvironment()->GetWater();
01628 if(water)
01629 {
01630 if(scolDepthLimit!=NIL)
01631 water->GetDepth()->SetDepthLimit(MTOF(scolDepthLimit));
01632
01633 if(scolDistortionDepthLimit!=NIL)
01634 water->GetDepth()->SetDistortionLimit(MTOF(scolDistortionDepthLimit));
01635 }
01636
01637 MMset(m, 0, ITOM(1));
01638 return 0;
01639 }
01640
01649 int SO3WaterGetSmoothPower(mmachine m)
01650 {
01651 int scolScene = MMget(m, 0);
01652 if(scolScene==NIL)
01653 {
01654 MMset(m, 0, NIL);
01655 return 0;
01656 }
01657
01658 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01659 if(parentScene==0)
01660 {
01661 MMechostr(MSKDEBUG, "SO3WaterGetSmoothPower: Scene instance is NULL\n");
01662 MMset(m, 0, NIL);
01663 return 0;
01664 }
01665
01666
01667 SWater* water = parentScene->GetEnvironment()->GetWater();
01668 if(water)
01669 {
01670 MMset(m, 0, FTOM(water->GetSmooth()->GetPower()));
01671 return 0;
01672 }
01673
01674 MMset(m, 0, NIL);
01675 return 0;
01676 }
01677
01687 int SO3WaterSetSmoothPower(mmachine m)
01688 {
01689 int scolSmoothPower = MMpull(m);
01690 int scolScene = MMget(m, 0);
01691
01692
01693 if((scolSmoothPower==NIL)||(scolScene==NIL))
01694 {
01695 MMset(m, 0, NIL);
01696 return 0;
01697 }
01698
01699 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01700 if(parentScene==0)
01701 {
01702 MMechostr(MSKDEBUG, "SO3WaterSetSmoothPower: Scene instance is NULL\n");
01703 MMset(m, 0, NIL);
01704 return 0;
01705 }
01706
01707
01708 SWater* water = parentScene->GetEnvironment()->GetWater();
01709 if(water)
01710 water->GetSmooth()->SetPower(MTOF(scolSmoothPower));
01711
01712 MMset(m, 0, ITOM(1));
01713 return 0;
01714 }
01715
01727 int SO3WaterGetCausticsParameters(mmachine m)
01728 {
01729 int scolScene = MMget(m, 0);
01730 if(scolScene==NIL)
01731 {
01732 MMset(m, 0, NIL);
01733 return 0;
01734 }
01735
01736 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01737 if(parentScene==0)
01738 {
01739 MMechostr(MSKDEBUG, "SO3WaterGetCausticsParameters: Scene instance is NULL\n");
01740 MMset(m, 0, NIL);
01741 return 0;
01742 }
01743
01744
01745 SWater* water = parentScene->GetEnvironment()->GetWater();
01746 if(water)
01747 {
01748
01749 SWater::WaterComponentCaustics* caustics = water->GetCaustics();
01750
01751
01752 MMpush(m, FTOM(caustics->GetScale()));
01753
01754
01755 MMpush(m, FTOM(caustics->GetPower()));
01756
01757
01758 MMpush(m, FTOM(caustics->GetEnd()));
01759
01760
01761 int result = MMmalloc(m, 3, TYPETAB);
01762 if(result==NIL)
01763 return MERRMEM;
01764
01765
01766 MMstore(m, result, 2, MMpull(m));
01767 MMstore(m, result, 1, MMpull(m));
01768 MMstore(m, result, 0, MMpull(m));
01769 MMset(m, 0, PTOM(result));
01770 return 0;
01771 }
01772
01773 MMset(m, 0, NIL);
01774 return 0;
01775 }
01776
01788 int SO3WaterSetCausticsParameters(mmachine m)
01789 {
01790 int scolCausticsScale = MMpull(m);
01791 int scolCausticsPower = MMpull(m);
01792 int scolCausticsEnd = MMpull(m);
01793 int scolScene = MMget(m, 0);
01794 if(scolScene==NIL)
01795 {
01796 MMset(m, 0, NIL);
01797 return 0;
01798 }
01799
01800 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01801 if(parentScene==0)
01802 {
01803 MMechostr(MSKDEBUG, "SO3WaterSetCausticsParameters: Scene instance is NULL\n");
01804 MMset(m, 0, NIL);
01805 return 0;
01806 }
01807
01808
01809 SWater* water = parentScene->GetEnvironment()->GetWater();
01810 if(water)
01811 {
01812
01813 SWater::WaterComponentCaustics* caustics = water->GetCaustics();
01814
01815
01816 if(scolCausticsScale!=NIL)
01817 caustics->SetScale(MTOF(scolCausticsScale));
01818
01819
01820 if(scolCausticsPower!=NIL)
01821 caustics->SetPower(MTOF(scolCausticsPower));
01822
01823
01824 if(scolCausticsEnd!=NIL)
01825 caustics->SetEnd(MTOF(scolCausticsEnd));
01826 }
01827
01828 MMset(m, 0, ITOM(1));
01829 return 0;
01830 }
01831
01846 int SO3WaterGetGodRaysParameters(mmachine m)
01847 {
01848 int scolScene = MMget(m, 0);
01849 if(scolScene==NIL)
01850 {
01851 MMset(m, 0, NIL);
01852 return 0;
01853 }
01854
01855 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01856 if(parentScene==0)
01857 {
01858 MMechostr(MSKDEBUG, "SO3WaterGetGodRaysParameters: Scene instance is NULL\n");
01859 MMset(m, 0, NIL);
01860 return 0;
01861 }
01862
01863
01864 SWater* water = parentScene->GetEnvironment()->GetWater();
01865 if(water)
01866 {
01867
01868 SWater::WaterComponentGodRays* godRays = water->GetGodRays();
01869
01870
01871 int scolGodRaysExposure = MMmalloc(m, 3, TYPETAB);
01872 if(scolGodRaysExposure==NIL)
01873 return MERRMEM;
01874
01875
01876 Ogre::Vector3 godRaysExposure = godRays->GetExposure();
01877 MMstore(m, scolGodRaysExposure, 0, FTOM(godRaysExposure.x));
01878 MMstore(m, scolGodRaysExposure, 1, FTOM(godRaysExposure.y));
01879 MMstore(m, scolGodRaysExposure, 2, FTOM(godRaysExposure.z));
01880 MMpush(m, PTOM(scolGodRaysExposure));
01881
01882
01883 MMpush(m, FTOM(godRays->GetIntensity()));
01884
01885
01886 MMpush(m, FTOM(godRays->GetSpeed()));
01887
01888
01889 MMpush(m, ITOM(godRays->GetNumberOfRays()));
01890
01891
01892 MMpush(m, FTOM(godRays->GetRaysSize()));
01893
01894
01895 if(godRays->GetRaysIntersectionEnable())
01896 MMpush(m, ITOM(1));
01897 else
01898 MMpush(m, ITOM(0));
01899
01900
01901 int result = MMmalloc(m, 6, TYPETAB);
01902 if(result==NIL)
01903 return MERRMEM;
01904
01905
01906 MMstore(m, result, 5, MMpull(m));
01907 MMstore(m, result, 4, MMpull(m));
01908 MMstore(m, result, 3, MMpull(m));
01909 MMstore(m, result, 2, MMpull(m));
01910 MMstore(m, result, 1, MMpull(m));
01911 MMstore(m, result, 0, MMpull(m));
01912 MMset(m, 0, PTOM(result));
01913 return 0;
01914 }
01915
01916 MMset(m, 0, NIL);
01917 return 0;
01918 }
01919
01934 int SO3WaterSetGodRaysParameters(mmachine m)
01935 {
01936 int scolGodRaysObjectIntersect = MMpull(m);
01937 int scolGodRaysSize = MMpull(m);
01938 int scolGodRaysNumber = MMpull(m);
01939 int scolGodRaysSpeed = MMpull(m);
01940 int scolGodRaysIntensity = MMpull(m);
01941 int scolGodRaysExposure = MMpull(m);
01942 int scolScene = MMget(m, 0);
01943 if(scolScene==NIL)
01944 {
01945 MMset(m, 0, NIL);
01946 return 0;
01947 }
01948
01949 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
01950 if(parentScene==0)
01951 {
01952 MMechostr(MSKDEBUG, "SO3WaterSetGodRaysParameters: Scene instance is NULL\n");
01953 MMset(m, 0, NIL);
01954 return 0;
01955 }
01956
01957
01958 SWater* water = parentScene->GetEnvironment()->GetWater();
01959 if(water)
01960 {
01961
01962 SWater::WaterComponentGodRays* godRays = water->GetGodRays();
01963
01964
01965 if(scolGodRaysExposure!=NIL)
01966 {
01967 Ogre::Vector3 godRaysExposure;
01968 godRaysExposure.x = MTOF(MMfetch(m, MTOP(scolGodRaysExposure), 0));
01969 godRaysExposure.y = MTOF(MMfetch(m, MTOP(scolGodRaysExposure), 1));
01970 godRaysExposure.z = MTOF(MMfetch(m, MTOP(scolGodRaysExposure), 2));
01971 godRays->SetExposure(godRaysExposure);
01972 }
01973
01974
01975 if(scolGodRaysIntensity!=NIL)
01976 godRays->SetIntensity(MTOF(scolGodRaysIntensity));
01977
01978
01979 if(scolGodRaysSpeed!=NIL)
01980 godRays->SetSpeed(MTOF(scolGodRaysSpeed));
01981
01982
01983 if(scolGodRaysNumber!=NIL)
01984 godRays->SetNumberOfRays(MTOI(scolGodRaysNumber));
01985
01986
01987 if(scolGodRaysSize!=NIL)
01988 godRays->SetRaysSize(MTOF(scolGodRaysSize));
01989
01990
01991 if(scolGodRaysObjectIntersect!=NIL)
01992 if(MTOI(scolGodRaysObjectIntersect) == 1)
01993 godRays->SetRaysIntersectionEnable(true);
01994 else
01995 godRays->SetRaysIntersectionEnable(false);
01996 }
01997
01998 MMset(m, 0, ITOM(1));
01999 return 0;
02000 }
02001
02002
02011 int SO3SkyGetAnimationSpeed(mmachine m)
02012 {
02013 int scolScene = MMget(m, 0);
02014 if(scolScene==NIL)
02015 {
02016 MMset(m, 0, NIL);
02017 return 0;
02018 }
02019
02020 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02021 if(parentScene==0)
02022 {
02023 MMechostr(MSKDEBUG, "SO3SkyGetAnimationSpeed: Scene instance is NULL\n");
02024 MMset(m, 0, NIL);
02025 return 0;
02026 }
02027
02028 SSky* sky = parentScene->GetEnvironment()->GetSky();
02029 if(sky)
02030 {
02031 MMset(m, 0, FTOM(sky->GetAnimationSpeed()));
02032 return 0;
02033 }
02034
02035 MMset(m, 0, NIL);
02036 return 0;
02037 }
02038
02039
02049 int SO3SkySetAnimationSpeed(mmachine m)
02050 {
02051 int scolSkyAnimationSpeed = MMpull(m);
02052 int scolScene = MMget(m, 0);
02053 if((scolScene==NIL)||(scolSkyAnimationSpeed==NIL))
02054 {
02055 MMset(m, 0, NIL);
02056 return 0;
02057 }
02058
02059 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02060 if(parentScene==0)
02061 {
02062 MMechostr(MSKDEBUG, "SO3SkySetAnimationSpeed: Scene instance is NULL\n");
02063 MMset(m, 0, NIL);
02064 return 0;
02065 }
02066
02067 SSky* sky = parentScene->GetEnvironment()->GetSky();
02068 if(sky)
02069 {
02070 sky->SetAnimationSpeed(MTOF(scolSkyAnimationSpeed));
02071 MMset(m, 0, ITOM(1));
02072 return 0;
02073 }
02074
02075 MMset(m, 0, NIL);
02076 return 0;
02077 }
02078
02087 int SO3SkyGetHdrEnable(mmachine m)
02088 {
02089 int scolScene = MMget(m, 0);
02090 if(scolScene==NIL)
02091 {
02092 MMset(m, 0, NIL);
02093 return 0;
02094 }
02095
02096 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02097 if(parentScene==0)
02098 {
02099 MMechostr(MSKDEBUG, "SO3SkyGetHdrEnable: Scene instance is NULL\n");
02100 MMset(m, 0, NIL);
02101 return 0;
02102 }
02103
02104 SSky* sky = parentScene->GetEnvironment()->GetSky();
02105 if(sky)
02106 {
02107 if(sky->GetHDREnable())
02108 MMset(m, 0, ITOM(1));
02109 else
02110 MMset(m, 0, ITOM(0));
02111 return 0;
02112 }
02113 MMset(m, 0, NIL);
02114 return 0;
02115 }
02116
02126 int SO3SkySetHdrEnable(mmachine m)
02127 {
02128 int scolEnable = MMpull(m);
02129 int scolScene = MMget(m, 0);
02130 if(scolScene==NIL)
02131 {
02132 MMset(m, 0, NIL);
02133 return 0;
02134 }
02135
02136 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02137 if(parentScene==0)
02138 {
02139 MMechostr(MSKDEBUG, "SO3SkySetHdrEnable: Scene instance is NULL\n");
02140 MMset(m, 0, NIL);
02141 return 0;
02142 }
02143
02144 SSky* sky = parentScene->GetEnvironment()->GetSky();
02145 if(sky)
02146 {
02147 bool enable = false;
02148 if(MTOI(scolEnable) == 1)
02149 enable = true;
02150
02151 sky->SetHDREnable(enable);
02152 MMset(m, 0, ITOM(1));
02153 return 0;
02154 }
02155 MMset(m, 0, NIL);
02156 return 0;
02157 }
02158
02167 int SO3SkyGetCloudCeiling(mmachine m)
02168 {
02169 int scolScene = MMget(m, 0);
02170 if(scolScene==NIL)
02171 {
02172 MMset(m, 0, NIL);
02173 return 0;
02174 }
02175
02176 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02177 if(parentScene==0)
02178 {
02179 MMechostr(MSKDEBUG, "SO3SkyGetCloudCeiling: Scene instance is NULL\n");
02180 MMset(m, 0, NIL);
02181 return 0;
02182 }
02183
02184 SSky* sky = parentScene->GetEnvironment()->GetSky();
02185 if(sky)
02186 {
02187 MMset(m, 0, FTOM(sky->GetCloudCeiling()));
02188 return 0;
02189 }
02190
02191 MMset(m, 0, NIL);
02192 return 0;
02193 }
02194
02204 int SO3SkySetCloudCeiling(mmachine m)
02205 {
02206 int scolSkyCloudCeiling = MMpull(m);
02207 int scolScene = MMget(m, 0);
02208 if((scolScene==NIL)||(scolSkyCloudCeiling==NIL))
02209 {
02210 MMset(m, 0, NIL);
02211 return 0;
02212 }
02213
02214 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02215 if(parentScene==0)
02216 {
02217 MMechostr(MSKDEBUG, "SO3SkySetCloudCeiling: Scene instance is NULL\n");
02218 MMset(m, 0, NIL);
02219 return 0;
02220 }
02221
02222 SSky* sky = parentScene->GetEnvironment()->GetSky();
02223 if(sky)
02224 {
02225 sky->SetCloudCeiling(MTOF(scolSkyCloudCeiling));
02226 }
02227
02228 MMset(m, 0, ITOM(1));
02229 return 0;
02230 }
02231
02241 int SO3SkyAddLayeredCloud(mmachine m)
02242 {
02243 int scolScene = MMget(m, 0);
02244 if(scolScene==NIL)
02245 {
02246 MMset(m, 0, NIL);
02247 return 0;
02248 }
02249
02250 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02251 if(parentScene==0)
02252 {
02253 MMechostr(MSKDEBUG, "SO3SkyAddLayeredCloud: Scene instance is NULL\n");
02254 MMset(m, 0, NIL);
02255 return 0;
02256 }
02257
02258 SSky* sky = parentScene->GetEnvironment()->GetSky();
02259 if(sky)
02260 {
02261 int layerIndex = sky->GetCloudLayered()->AddLayer();
02262 MMset(m, 0, ITOM(layerIndex));
02263 return 0;
02264 }
02265
02266 MMset(m, 0, NIL);
02267 return 0;
02268 }
02269
02279 int SO3SkyRemoveLayeredCloud(mmachine m)
02280 {
02281 int scolLayerIndex = MMpull(m);
02282 int scolScene = MMget(m, 0);
02283 if((scolScene==NIL)||(scolLayerIndex==NIL))
02284 {
02285 MMset(m, 0, NIL);
02286 return 0;
02287 }
02288
02289 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02290 if(parentScene==0)
02291 {
02292 MMechostr(MSKDEBUG, "SO3SkyAddLayeredCloud: Scene instance is NULL\n");
02293 MMset(m, 0, NIL);
02294 return 0;
02295 }
02296
02297 SSky* sky = parentScene->GetEnvironment()->GetSky();
02298 if(sky)
02299 {
02300 try
02301 {
02302 sky->GetCloudLayered()->RemoveLayer(MTOI(scolLayerIndex));
02303 MMset(m, 0, ITOM(1));
02304 return 0;
02305 }
02306 catch(const Ogre::Exception& e)
02307 {
02308 MMechostr(MSKDEBUG, "SO3SkyAddLayeredCloud: %s\n", e.getFullDescription());
02309 }
02310 }
02311
02312 MMset(m, 0, NIL);
02313 return 0;
02314 }
02315
02324 int SO3SkyGetLayeredCloudIndexes(mmachine m)
02325 {
02326 int scolScene = MMget(m, 0);
02327 if(scolScene==NIL)
02328 {
02329 MMset(m, 0, NIL);
02330 return 0;
02331 }
02332
02333 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02334 if(parentScene==0)
02335 {
02336 MMechostr(MSKDEBUG, "SO3SkyAddLayeredCloud: Scene instance is NULL\n");
02337 MMset(m, 0, NIL);
02338 return 0;
02339 }
02340
02341
02342 MMpull(m);
02343
02344 SSky* sky = parentScene->GetEnvironment()->GetSky();
02345 if(sky)
02346 {
02347 try
02348 {
02349 std::vector<int> layerIndexes = sky->GetCloudLayered()->GetLayerIndexes();
02350 if(layerIndexes.size() > 0)
02351 {
02352
02353 std::vector<int>::iterator iLayerIndexes = layerIndexes.begin();
02354 while(iLayerIndexes != layerIndexes.end())
02355 {
02356 MMpush(m, ITOM(*iLayerIndexes));
02357 iLayerIndexes++;
02358 }
02359
02360
02361 if(MMpush(m, NIL))
02362 return MERRMEM;
02363
02364
02365 for(unsigned int j=0; j<layerIndexes.size(); j++)
02366 {
02367 if(MMpush(m, 2*2))
02368 return MERRMEM;
02369
02370 if(int k=MBdeftab(m))
02371 return k;
02372 }
02373 return 0;
02374 }
02375 }
02376 catch(const Ogre::Exception& e)
02377 {
02378 MMechostr(MSKDEBUG, "SO3SkyAddLayeredCloud: %s\n", e.getFullDescription());
02379 }
02380 }
02381
02382 MMpush(m, NIL);
02383 return 0;
02384 }
02385
02402 int SO3SkyGetLayeredCloudParameters(mmachine m)
02403 {
02404 int scolLayerIndex = MMpull(m);
02405 int scolScene = MMget(m, 0);
02406 if((scolScene==NIL)||(scolLayerIndex==NIL))
02407 {
02408 MMset(m, 0, NIL);
02409 return 0;
02410 }
02411
02412 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02413 if(parentScene==0)
02414 {
02415 MMechostr(MSKDEBUG, "SO3SkyGetLayeredCloudParameters: Scene instance is NULL\n");
02416 MMset(m, 0, NIL);
02417 return 0;
02418 }
02419
02420 SSky* sky = parentScene->GetEnvironment()->GetSky();
02421 if(sky)
02422 {
02423 try
02424 {
02425
02426 SSky::CloudLayered* layeredCloud = sky->GetCloudLayered();
02427 int cloudLayerIndex = MTOI(scolLayerIndex);
02428
02429
02430 MMpush(m, FTOM(layeredCloud->GetHeightFromCloudCeiling(cloudLayerIndex)));
02431
02432
02433 MMpush(m, FTOM(layeredCloud->GetAttenuationDistance(cloudLayerIndex)));
02434
02435
02436 MMpush(m, FTOM(layeredCloud->GetAttenuationDetail(cloudLayerIndex)));
02437
02438
02439 MMpush(m, FTOM(layeredCloud->GetNormalMultiplier(cloudLayerIndex)));
02440
02441
02442 MMpush(m, FTOM(layeredCloud->GetHeightVolume(cloudLayerIndex)));
02443
02444
02445 MMpush(m, FTOM(layeredCloud->GetNormalMultiplier(cloudLayerIndex)));
02446
02447
02448 MMpush(m, FTOM(layeredCloud->GetVolumetricDisplacement(cloudLayerIndex)));
02449
02450
02451 int result = MMmalloc(m, 7, TYPETAB);
02452 if(result==NIL)
02453 return MERRMEM;
02454
02455
02456 MMstore(m, result, 6, MMpull(m));
02457 MMstore(m, result, 5, MMpull(m));
02458 MMstore(m, result, 4, MMpull(m));
02459 MMstore(m, result, 3, MMpull(m));
02460 MMstore(m, result, 2, MMpull(m));
02461 MMstore(m, result, 1, MMpull(m));
02462 MMstore(m, result, 0, MMpull(m));
02463 MMset(m, 0, PTOM(result));
02464 return 0;
02465 }
02466 catch(const Ogre::Exception& e)
02467 {
02468 MMechostr(MSKDEBUG, "SO3SkyGetLayeredCloudParameters: %s\n", e.getFullDescription());
02469 }
02470 }
02471
02472 MMset(m, 0, NIL);
02473 return 0;
02474 }
02475
02492 int SO3SkySetLayeredCloudParameters(mmachine m)
02493 {
02494 int scolVolumetricDisplacement = MMpull(m);
02495 int scolHeightVolume = MMpull(m);
02496 int scolNormalMultiplier = MMpull(m);
02497 int scolAttenuationDetail = MMpull(m);
02498 int scolAttenuationDistance = MMpull(m);
02499 int scolScale = MMpull(m);
02500 int scolheightFromCloudCeiling = MMpull(m);
02501 int scolLayerIndex = MMpull(m);
02502 int scolScene = MMget(m, 0);
02503 if((scolScene==NIL)||(scolLayerIndex==NIL))
02504 {
02505 MMset(m, 0, NIL);
02506 return 0;
02507 }
02508
02509 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02510 if(parentScene==0)
02511 {
02512 MMechostr(MSKDEBUG, "SO3SkySetLayeredCloudParameters: Scene instance is NULL\n");
02513 MMset(m, 0, NIL);
02514 return 0;
02515 }
02516
02517 SSky* sky = parentScene->GetEnvironment()->GetSky();
02518 if(sky)
02519 {
02520 try
02521 {
02522
02523 SSky::CloudLayered* layeredCloud = sky->GetCloudLayered();
02524 int cloudLayerIndex = MTOI(scolLayerIndex);
02525
02526
02527 if(scolheightFromCloudCeiling != NIL)
02528 layeredCloud->SetHeightFromCloudCeiling(cloudLayerIndex, MTOF(scolheightFromCloudCeiling));
02529
02530
02531 if(scolScale != NIL)
02532 layeredCloud->SetScale(cloudLayerIndex, MTOF(scolScale));
02533
02534
02535 if(scolAttenuationDistance != NIL)
02536 layeredCloud->SetAttenuationDistance(cloudLayerIndex, MTOF(scolAttenuationDistance));
02537
02538
02539 if(scolAttenuationDetail != NIL)
02540 layeredCloud->SetAttenuationDetail(cloudLayerIndex, MTOF(scolAttenuationDetail));
02541
02542
02543 if(scolNormalMultiplier != NIL)
02544 layeredCloud->SetNormalMultiplier(cloudLayerIndex, MTOF(scolNormalMultiplier));
02545
02546
02547 if(scolHeightVolume != NIL)
02548 layeredCloud->SetHeightVolume(cloudLayerIndex, MTOF(scolHeightVolume));
02549
02550
02551 if(scolVolumetricDisplacement != NIL)
02552 layeredCloud->SetHeightVolume(cloudLayerIndex, MTOF(scolVolumetricDisplacement));
02553
02554 MMset(m, 0, ITOM(1));
02555 return 0;
02556 }
02557 catch(const Ogre::Exception& e)
02558 {
02559 MMechostr(MSKDEBUG, "SO3SkySetLayeredCloudParameters: %s\n", e.getFullDescription());
02560 }
02561 }
02562
02563 MMset(m, 0, NIL);
02564 return 0;
02565 }
02566
02578 int SO3SkyGetVolumetricCloudParameters(mmachine m)
02579 {
02580
02581 return 0;
02582 }
02583
02584 int SO3SkySetVolumetricCloudParameters(mmachine m)
02585 {
02586
02587 return 0;
02588 }
02589
02598 int SO3SunGetLightColor(mmachine m)
02599 {
02600 int scolScene = MMget(m, 0);
02601 if(scolScene==NIL)
02602 {
02603 MMset(m, 0, NIL);
02604 return 0;
02605 }
02606
02607 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02608 if(parentScene==0)
02609 {
02610 MMechostr(MSKDEBUG, "SO3SunGetLightColor: Scene instance is NULL\n");
02611 MMset(m, 0, NIL);
02612 return 0;
02613 }
02614
02615 SSun* sun = parentScene->GetEnvironment()->GetSun();
02616 if(sun)
02617 {
02618
02619 MMset(m, 0, ITOM(ConversionTools::OgreToScolColorRGBA(sun->GetLightColour())));
02620 return 0;
02621 }
02622
02623 MMset(m, 0, NIL);
02624 return 0;
02625 }
02626
02627
02637 int SO3SunSetLightColor(mmachine m)
02638 {
02639 int scolSunColor = MMpull(m);
02640 int scolScene = MMget(m, 0);
02641 if((scolScene==NIL)||(scolSunColor==NIL))
02642 {
02643 MMset(m, 0, NIL);
02644 return 0;
02645 }
02646
02647 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02648 if(parentScene==0)
02649 {
02650 MMechostr(MSKDEBUG, "SO3SunSetLightColor: Scene instance is NULL\n");
02651 MMset(m, 0, NIL);
02652 return 0;
02653 }
02654
02655 SSun* sun = parentScene->GetEnvironment()->GetSun();
02656 if(sun)
02657 {
02658 sun->SetLightColour(ConversionTools::ScolToOgreColorRGBA(MTOI(scolSunColor)));
02659 MMset(m, 0, ITOM(1));
02660 return 0;
02661 }
02662
02663 MMset(m, 0, NIL);
02664 return 0;
02665 }
02666
02675 int SO3MoonGetLightColor(mmachine m)
02676 {
02677 int scolScene = MMget(m, 0);
02678 if(scolScene==NIL)
02679 {
02680 MMset(m, 0, NIL);
02681 return 0;
02682 }
02683
02684 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02685 if(parentScene==0)
02686 {
02687 MMechostr(MSKDEBUG, "SO3MoonGetLightColor: Scene instance is NULL\n");
02688 MMset(m, 0, NIL);
02689 return 0;
02690 }
02691
02692 SMoon* moon = parentScene->GetEnvironment()->GetMoon();
02693 if(moon)
02694 {
02695
02696 MMset(m, 0, ITOM(ConversionTools::OgreToScolColorRGBA(moon->GetLightColour())));
02697 return 0;
02698 }
02699
02700 MMset(m, 0, NIL);
02701 return 0;
02702 }
02703
02713 int SO3MoonSetLightColor(mmachine m)
02714 {
02715 int scolMoonColor = MMpull(m);
02716 int scolScene = MMget(m, 0);
02717 if((scolScene==NIL)||(scolMoonColor==NIL))
02718 {
02719 MMset(m, 0, NIL);
02720 return 0;
02721 }
02722
02723 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02724 if(parentScene==0)
02725 {
02726 MMechostr(MSKDEBUG, "SO3MoonSetLightColor: Scene instance is NULL\n");
02727 MMset(m, 0, NIL);
02728 return 0;
02729 }
02730
02731 SMoon* moon = parentScene->GetEnvironment()->GetMoon();
02732 if(moon)
02733 {
02734 moon->SetLightColour(ConversionTools::ScolToOgreColorRGBA(MTOI(scolMoonColor)));
02735 MMset(m, 0, ITOM(1));
02736 return 0;
02737 }
02738
02739 MMset(m, 0, NIL);
02740 return 0;
02741 }
02742
02751 int SO3MoonGetTexturePath(mmachine m)
02752 {
02753 int scolScene = MMpull(m);
02754 if (scolScene==NIL)
02755 {
02756 MMpush(m, NIL);
02757 return 0;
02758 }
02759
02760 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02761 if(parentScene==0)
02762 {
02763 MMechostr(MSKDEBUG, "SO3MoonGetTexturePath: Scene instance is NULL\n");
02764 MMpush(m, NIL);
02765 return 0;
02766 }
02767
02768 SMoon* moon = parentScene->GetEnvironment()->GetMoon();
02769 if(moon)
02770 {
02771 return Mpushstrbloc(m, (char*)moon->GetTextureName().c_str());
02772 }
02773
02774 MMpush(m, NIL);
02775 return 0;
02776 }
02777
02787 int SO3MoonSetTexturePath(mmachine m)
02788 {
02789 int scolTexturePath = MMpull(m);
02790 int scolScene = MMget(m, 0);
02791 if (scolScene==NIL)
02792 {
02793 MMset(m, 0, NIL);
02794 return 0;
02795 }
02796
02797 if(scolTexturePath==NIL)
02798 {
02799 MMechostr(MSKDEBUG, "SO3MoonSetTexturePath: texture path not provided!\n");
02800 MMset(m, 0, NIL);
02801 }
02802
02803 SScene* parentScene = (SScene*) MMfetch(m, MTOP(scolScene), 0);
02804 if(parentScene==0)
02805 {
02806 MMechostr(MSKDEBUG, "SO3MoonSetTexturePath: Scene instance is NULL\n");
02807 MMset(m, 0, NIL);
02808 return 0;
02809 }
02810
02811 std::string texturePath(MMstartstr(m, MTOP(scolTexturePath)));
02812 SMoon* moon = parentScene->GetEnvironment()->GetMoon();
02813 if(moon)
02814 {
02815 moon->SetTextureName(texturePath);
02816 MMset(m, 0, ITOM(1));
02817 }
02818
02819 MMset(m, 0, NIL);
02820 return 0;
02821 }
02822
02826 #define ENVIRONMENT_NB_PKG 71
02827
02831 char* ENVIRONMENT_FUNCTIONS_NAMES[ENVIRONMENT_NB_PKG]=
02832 {
02833
02834 "SO3EnvironmentSetViewport",
02835 "SO3EnvironmentGetWindSpeed",
02836 "SO3EnvironmentSetWindSpeed",
02837 "SO3EnvironmentGetWindDirection",
02838 "SO3EnvironmentSetWindDirection",
02839 "SO3EnvironmentGetHumidity",
02840 "SO3EnvironmentSetHumidity",
02841 "SO3EnvironmentGetTimeSpeedFactor",
02842 "SO3EnvironmentSetTimeSpeedFactor",
02843 "SO3EnvironmentGetPaused",
02844 "SO3EnvironmentSetPaused",
02845 "SO3EnvironmentGetDateTime",
02846 "SO3EnvironmentSetDateTime",
02847 "SO3EnvironmentGetLongitude",
02848 "SO3EnvironmentSetLongitude",
02849 "SO3EnvironmentGetLatitude",
02850 "SO3EnvironmentSetLatitude",
02851 "SO3WaterGetEnable",
02852 "SO3WaterSetEnable",
02853 "SO3SkyGetEnable",
02854 "SO3SkySetEnable",
02855
02856 "SO3SunGetLightColor",
02857 "SO3SunSetLightColor",
02858
02859 "SO3MoonGetLightColor",
02860 "SO3MoonSetLightColor",
02861 "SO3MoonGetTexturePath",
02862 "SO3MoonSetTexturePath",
02863
02864 "SO3WaterComponentGetEnabled",
02865 "SO3WaterComponentSetEnabled",
02866 "SO3_WATER_COMPONENT_SUN",
02867 "SO3_WATER_COMPONENT_FOAM",
02868 "SO3_WATER_COMPONENT_DEPTH",
02869 "SO3_WATER_COMPONENT_SMOOTH",
02870 "SO3_WATER_COMPONENT_CAUSTICS",
02871 "SO3_WATER_COMPONENT_UNDERWATER",
02872 "SO3_WATER_COMPONENT_GODRAYS",
02873
02874 "SO3SkyComponentGetEnabled",
02875 "SO3SkyComponentSetEnabled",
02876 "SO3_SKY_COMPONENT_LAYERER_CLOUD",
02877 "SO3_SKY_COMPONENT_VOLUMETRIC_CLOUD",
02878
02879 "SO3WaterGetPosition",
02880 "SO3WaterSetPosition",
02881 "SO3WaterGetColor",
02882 "SO3WaterSetColor",
02883 "SO3WaterGetAnimationSpeed",
02884 "SO3WaterSetAnimationSpeed",
02885 "SO3WaterGetSunParameters",
02886 "SO3WaterSetSunParameters",
02887 "SO3WaterGetFoamParameters",
02888 "SO3WaterSetFoamParameters",
02889 "SO3WaterGetDepthParameters",
02890 "SO3WaterSetDepthParameters",
02891 "SO3WaterGetSmoothPower",
02892 "SO3WaterSetSmoothPower",
02893 "SO3WaterGetCausticsParameters",
02894 "SO3WaterSetCausticsParameters",
02895 "SO3WaterGetGodRaysParameters",
02896 "SO3WaterSetGodRaysParameters",
02897
02898 "SO3SkyGetAnimationSpeed",
02899 "SO3SkySetAnimationSpeed",
02900 "SO3SkyGetHdrEnable",
02901 "SO3SkySetHdrEnable",
02902 "SO3SkyGetCloudCeiling",
02903 "SO3SkySetCloudCeiling",
02904 "SO3SkyAddLayeredCloud",
02905 "SO3SkyRemoveLayeredCloud",
02906 "SO3SkyGetLayeredCloudIndexes",
02907 "SO3SkyGetLayeredCloudParameters",
02908 "SO3SkySetLayeredCloudParameters",
02909 "SO3SkyGetVolumetricCloudParameters",
02910 "SO3SkySetVolumetricCloudParameters"
02911 };
02912
02916 int (*ENVIRONMENT_FUNCTIONS[ENVIRONMENT_NB_PKG])(mmachine m)=
02917 {
02918 SO3EnvironmentSetViewport,
02919 SO3EnvironmentGetWindSpeed,
02920 SO3EnvironmentSetWindSpeed,
02921 SO3EnvironmentGetWindDirection,
02922 SO3EnvironmentSetWindDirection,
02923 SO3EnvironmentGetHumidity,
02924 SO3EnvironmentSetHumidity,
02925 SO3EnvironmentGetTimeSpeedFactor,
02926 SO3EnvironmentSetTimeSpeedFactor,
02927 SO3EnvironmentGetPaused,
02928 SO3EnvironmentSetPaused,
02929 SO3EnvironmentGetDateTime,
02930 SO3EnvironmentSetDateTime,
02931 SO3EnvironmentGetLongitude,
02932 SO3EnvironmentSetLongitude,
02933 SO3EnvironmentGetLatitude,
02934 SO3EnvironmentSetLatitude,
02935 SO3WaterGetEnable,
02936 SO3WaterSetEnable,
02937 SO3SkyGetEnable,
02938 SO3SkySetEnable,
02939 SO3SunGetLightColor,
02940 SO3SunSetLightColor,
02941 SO3MoonGetLightColor,
02942 SO3MoonSetLightColor,
02943 SO3MoonGetTexturePath,
02944 SO3MoonSetTexturePath,
02945 SO3WaterComponentGetEnabled,
02946 SO3WaterComponentSetEnabled,
02947 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_SUN),
02948 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_FOAM),
02949 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_DEPTH),
02950 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_SMOOTH),
02951 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_CAUSTICS),
02952 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_UNDERWATER),
02953 SCOL_TYPTYPE(SWater::SO3_WATER_COMPONENT_GODRAYS),
02954 SO3SkyComponentGetEnabled,
02955 SO3SkyComponentSetEnabled,
02956 SCOL_TYPTYPE(SSky::SO3_SKY_COMPONENT_LAYERER_CLOUD),
02957 SCOL_TYPTYPE(SSky::SO3_SKY_COMPONENT_VOLUMETRIC_CLOUD),
02958 SO3WaterGetPosition,
02959 SO3WaterSetPosition,
02960 SO3WaterGetColor,
02961 SO3WaterSetColor,
02962 SO3WaterGetAnimationSpeed,
02963 SO3WaterSetAnimationSpeed,
02964 SO3WaterGetSunParameters,
02965 SO3WaterSetSunParameters,
02966 SO3WaterGetFoamParameters,
02967 SO3WaterSetFoamParameters,
02968 SO3WaterGetDepthParameters,
02969 SO3WaterSetDepthParameters,
02970 SO3WaterGetSmoothPower,
02971 SO3WaterSetSmoothPower,
02972 SO3WaterGetCausticsParameters,
02973 SO3WaterSetCausticsParameters,
02974 SO3WaterGetGodRaysParameters,
02975 SO3WaterSetGodRaysParameters,
02976 SO3SkyGetAnimationSpeed,
02977 SO3SkySetAnimationSpeed,
02978 SO3SkyGetHdrEnable,
02979 SO3SkySetHdrEnable,
02980 SO3SkyGetCloudCeiling,
02981 SO3SkySetCloudCeiling,
02982 SO3SkyAddLayeredCloud,
02983 SO3SkyRemoveLayeredCloud,
02984 SO3SkyGetLayeredCloudIndexes,
02985 SO3SkyGetLayeredCloudParameters,
02986 SO3SkySetLayeredCloudParameters,
02987 SO3SkyGetVolumetricCloudParameters,
02988 SO3SkySetVolumetricCloudParameters
02989 };
02990
02994 int ENVIRONMENT_FUNCTIONS_NB_ARGS[ENVIRONMENT_NB_PKG]=
02995 {
02996 2,
02997 1,
02998 2,
02999 1,
03000 3,
03001 1,
03002 2,
03003 1,
03004 2,
03005 1,
03006 2,
03007 1,
03008 7,
03009 1,
03010 2,
03011 1,
03012 2,
03013 1,
03014 2,
03015 1,
03016 2,
03017 1,
03018 2,
03019 1,
03020 2,
03021 1,
03022 2,
03023 2,
03024 3,
03025 TYPVAR,
03026 TYPVAR,
03027 TYPVAR,
03028 TYPVAR,
03029 TYPVAR,
03030 TYPVAR,
03031 TYPVAR,
03032 2,
03033 3,
03034 TYPVAR,
03035 TYPVAR,
03036 1,
03037 2,
03038 1,
03039 2,
03040 1,
03041 2,
03042 1,
03043 5,
03044 1,
03045 5,
03046 1,
03047 3,
03048 1,
03049 2,
03050 1,
03051 4,
03052 1,
03053 7,
03054 1,
03055 2,
03056 1,
03057 2,
03058 1,
03059 2,
03060 1,
03061 2,
03062 2,
03063 2,
03064 9,
03065 1,
03066 3
03067 };
03068
03072 char* ENVIRONMENT_FUNCTIONS_SIGNATURES[ENVIRONMENT_NB_PKG]=
03073 {
03074 "fun [SO3_SCENE SO3_VIEWPORT] I",
03075 "fun [SO3_SCENE] F",
03076 "fun [SO3_SCENE F] I",
03077 "fun [SO3_SCENE] [F F]",
03078 "fun [SO3_SCENE F F] I",
03079 "fun [SO3_SCENE] F",
03080 "fun [SO3_SCENE F] I",
03081 "fun [SO3_SCENE] F",
03082 "fun [SO3_SCENE F] I",
03083 "fun [SO3_SCENE] I",
03084 "fun [SO3_SCENE I] I",
03085 "fun [SO3_SCENE] [I I I I I I]",
03086 "fun [SO3_SCENE I I I I I I] I",
03087 "fun [SO3_SCENE] F",
03088 "fun [SO3_SCENE F] I",
03089 "fun [SO3_SCENE] F",
03090 "fun [SO3_SCENE F] I",
03091 "fun [SO3_SCENE] I",
03092 "fun [SO3_SCENE I] I",
03093 "fun [SO3_SCENE] I",
03094 "fun [SO3_SCENE I] I",
03095 "fun [SO3_SCENE] I",
03096 "fun [SO3_SCENE I] I",
03097 "fun [SO3_SCENE] I",
03098 "fun [SO3_SCENE I] I",
03099 "fun [SO3_SCENE] S",
03100 "fun [SO3_SCENE S] I",
03101 "fun [SO3_SCENE I] I",
03102 "fun [SO3_SCENE I I] I",
03103 "I",
03104 "I",
03105 "I",
03106 "I",
03107 "I",
03108 "I",
03109 "I",
03110 "fun [SO3_SCENE I] I",
03111 "fun [SO3_SCENE I I] I",
03112 "I",
03113 "I",
03114 "fun [SO3_SCENE] [F F F]",
03115 "fun [SO3_SCENE [F F F]] I",
03116 "fun [SO3_SCENE] I",
03117 "fun [SO3_SCENE I] I",
03118 "fun [SO3_SCENE] F",
03119 "fun [SO3_SCENE F] I",
03120 "fun [SO3_SCENE] [[F F F] F F I]",
03121 "fun [SO3_SCENE [F F F] F F I] I",
03122 "fun [SO3_SCENE] [F F F F]",
03123 "fun [SO3_SCENE F F F F] I",
03124 "fun [SO3_SCENE] [F F]",
03125 "fun [SO3_SCENE F F] I",
03126 "fun [SO3_SCENE] F",
03127 "fun [SO3_SCENE F] I",
03128 "fun [SO3_SCENE] [F F F]",
03129 "fun [SO3_SCENE F F F] I",
03130 "fun [SO3_SCENE] [[F F F] F F I F I]",
03131 "fun [SO3_SCENE [F F F] F F I F I] I",
03132 "fun [SO3_SCENE] F",
03133 "fun [SO3_SCENE F] I",
03134 "fun [SO3_SCENE] I",
03135 "fun [SO3_SCENE I] I",
03136 "fun [SO3_SCENE] F",
03137 "fun [SO3_SCENE F] I",
03138 "fun [SO3_SCENE] I",
03139 "fun [SO3_SCENE I] I",
03140 "fun [SO3_SCENE] [I r1]",
03141 "fun [SO3_SCENE I] [F F F F F F F]",
03142 "fun [SO3_SCENE I F F F F F F F] I",
03143 "fun [SO3_SCENE] [F F]",
03144 "fun [SO3_SCENE F F] I"
03145 };
03146
03152 int SCOLloadEnvironment(mmachine m, cbmachine w)
03153 {
03154 return PKhardpak(m, "SO3_Environment", ENVIRONMENT_NB_PKG, ENVIRONMENT_FUNCTIONS_NAMES, ENVIRONMENT_FUNCTIONS, ENVIRONMENT_FUNCTIONS_NB_ARGS, ENVIRONMENT_FUNCTIONS_SIGNATURES);
03155 }
03156
03161 int SCOLfreeEnvironment()
03162 {
03163 return 0;
03164 }