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
00036
00037 #include "SO3SCOL.h"
00038
00039
00040 #include "../SO3Material/SO3Material.h"
00041 #include "../SO3Material/SO3Texture.h"
00042
00043
00044 #include "../SO3Renderer/SO3Root.h"
00045
00046
00047 #include "../SO3SceneGraph/SO3Scene.h"
00048
00049 #include "../SO3Utils/SO3ConversionTools.h"
00050
00061 int SO3MaterialCreate(mmachine m)
00062 {
00063 #ifdef SO3_DEBUG
00064 MMechostr(MSKDEBUG,"SO3MaterialCreate\n");
00065 #endif
00066
00067 int group = MMpull(m);
00068 int name = MMpull(m);
00069 int s = MMget(m,0);
00070
00071 if((s==NIL)||(name==NIL))
00072 {
00073 MMset(m, 0, NIL);
00074 return 0;
00075 }
00076
00077 SScene* scene = (SScene*) MMfetch(m,MTOP(s),0);
00078 if(scene==NULL)
00079 {
00080 MMset(m, 0, NIL);
00081 return 0;
00082 }
00083
00084 const char* groupResource;
00085 if(group == NIL)
00086 groupResource = "General";
00087 else
00088 groupResource = MMstartstr(m, MTOP(group));
00089
00090 std::string matName(MMstartstr(m, MTOP(name)));
00091
00092 SMaterial* material = scene->CreateMaterial(groupResource, matName);
00093 if(material == NULL)
00094 {
00095 Ogre::LogManager::getSingleton().logMessage("Can't Create Material! ", Ogre::LML_CRITICAL, true);
00096 MMset(m, 0, NIL);
00097 return 0;
00098 }
00099
00100
00101 MMpull(m);
00102 int pmat = createMaterial(m, material, scene);
00103
00104 return 0;
00105 }
00106
00107
00116 int SO3MaterialDestroy(mmachine m)
00117 {
00118 #ifdef SO3_DEBUG
00119 MMechostr(MSKDEBUG,"SO3MaterialDestroy\n");
00120 #endif
00121
00122 int mt = MMget(m, 0);
00123 if(mt==NIL)
00124 {
00125 MMset(m,0,NIL);
00126 return 0;
00127 }
00128
00129 SMaterial * material = (SMaterial*) MMfetch(m,MTOP(mt),0);
00130 if(material == NULL)
00131 {
00132 MMset(m,0,NIL);
00133 return 0;
00134 }
00135
00136
00137 int mat = OBJfindTH(m, SO3MATERIAL, (int)(material));
00138 if(mat!=NIL)
00139 mat = MMfetch(m, mat, OFFOBJMAG);
00140
00141 OBJdelTM(m, SO3MATERIAL, mat);
00142
00143 return 0;
00144 }
00145
00146
00155 int SO3MaterialGetName(mmachine m)
00156 {
00157 #ifdef SO3_DEBUG
00158 MMechostr(MSKDEBUG,"SO3MaterialGetName\n");
00159 #endif
00160
00161 int mt = MMpull(m);
00162 if(mt == NIL)
00163 {
00164 return MMpush(m, NIL);
00165 }
00166
00167 SMaterial* material = (SMaterial*)MMfetch(m, MTOP(mt), 0);
00168 if(material == NULL)
00169 {
00170 return MMpush(m, NIL);
00171 }
00172
00173 return Mpushstrbloc(m, (char*)material->GetName().c_str());
00174 }
00175
00176
00186 int SO3MaterialSetAmbient(mmachine m)
00187 {
00188 #ifdef SO3_DEBUG
00189 MMechostr(MSKDEBUG,"SO3MaterialSetAmbient\n");
00190 #endif
00191
00192 int color = MMpull(m);
00193 int mat = MMget(m, 0);
00194 if(mat==NIL)
00195 {
00196 MMset(m, 0, NIL);
00197 return 0;
00198 }
00199
00200 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00201 if(material==NULL)
00202 {
00203 MMset(m, 0, NIL);
00204 return 0;
00205 }
00206
00207 if (color == NIL)
00208 color = 0;
00209 else
00210 color = MTOI(color);
00211
00212 material->SetAmbientColor(color);
00213
00214 MMset(m, 0, ITOM(1));
00215 return 0;
00216
00217 }
00218
00219
00231 int SO3MaterialSetAmbientByTechAndPass(mmachine m)
00232 {
00233 #ifdef SO3_DEBUG
00234 MMechostr(MSKDEBUG,"SO3MaterialSetAmbientByTechAndPass\n");
00235 #endif
00236
00237 int color = MMpull(m);
00238 int pass = MMpull(m);
00239 int tec = MMpull(m);
00240 int mat = MMget(m, 0);
00241
00242 if((mat==NIL) || (tec == NIL) || (pass == NIL))
00243 {
00244 MMset(m, 0, NIL);
00245 return 0;
00246 }
00247
00248 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00249 if(material==NULL)
00250 {
00251 MMset(m, 0, NIL);
00252 return 0;
00253 }
00254
00255
00256 tec = (unsigned int) abs(MTOI(tec));
00257 pass = (unsigned int) abs(MTOI(pass));
00258
00259 if (color == NIL)
00260 color = 0;
00261 else
00262 color = MTOI(color);
00263
00264 try
00265 {
00266 material->SetAmbientColor(tec, pass, color);
00267 MMset(m, 0, ITOM(1));
00268 }
00269 catch (Ogre::Exception)
00270 {
00271 MMechostr(MSKDEBUG, "SO3MaterialSetAmbientByTechAndPass technique or pass error\n");
00272 MMset(m, 0, NIL);
00273 }
00274
00275 return 0;
00276 }
00277
00278
00288 int SO3MaterialSetDiffuse(mmachine m)
00289 {
00290 #ifdef SO3_DEBUG
00291 MMechostr(MSKDEBUG,"SO3MaterialSetDiffuse\n");
00292 #endif
00293
00294 int color = MMpull(m);
00295 int mat = MMget(m, 0);
00296 if(mat==NIL)
00297 {
00298 MMset(m, 0, NIL);
00299 return 0;
00300 }
00301
00302 SMaterial * material = (SMaterial*) MMfetch(m,MTOP(mat),0);
00303 if(material==NULL)
00304 {
00305 MMechostr(MSKDEBUG,"material==NULL\n");
00306 MMset(m, 0, NIL);
00307 return 0;
00308 }
00309
00310 if (color == NIL)
00311 color = 0;
00312 else
00313 color = MTOI(color);
00314
00315 material->SetDiffuseColor(color);
00316
00317 MMset(m, 0, ITOM(1));
00318
00319 return 0;
00320 }
00321
00322
00334 int SO3MaterialSetDiffuseByTechAndPass(mmachine m)
00335 {
00336 #ifdef SO3_DEBUG
00337 MMechostr(MSKDEBUG,"SO3MaterialSetDiffuseByTechAndPass\n");
00338 #endif
00339
00340 int color = MMpull(m);
00341 int pass = MMpull(m);
00342 int tec = MMpull(m);
00343 int mat = MMget(m, 0);
00344
00345 if((mat==NIL) || (tec == NIL) || (pass == NIL))
00346 {
00347 MMset(m,0,NIL);
00348 return 0;
00349 }
00350
00351 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00352 if(material==NULL)
00353 {
00354 MMset(m,0,NIL);
00355 return 0;
00356 }
00357
00358
00359 tec = (unsigned int) abs(MTOI(tec));
00360 pass = (unsigned int) abs(MTOI(pass));
00361
00362 if (color == NIL)
00363 color = 0;
00364 else
00365 color = MTOI(color);
00366
00367 try
00368 {
00369 material->SetDiffuseColor(tec, pass, color);
00370 MMset(m, 0, ITOM(1));
00371 }
00372 catch (Ogre::Exception)
00373 {
00374 MMechostr(MSKDEBUG, "SO3MaterialSetDiffuseByTechAndPass technique or pass error\n");
00375 MMset(m, 0, NIL);
00376 }
00377
00378 return 0;
00379 }
00380
00381
00390 int SO3MaterialGetReceiveShadows(mmachine m)
00391 {
00392 #ifdef SO3_DEBUG
00393 MMechostr(MSKDEBUG,"SO3MaterialGetReceiveShadows\n");
00394 #endif
00395
00396 int mat = MMget(m, 0);
00397 if(mat==NIL)
00398 {
00399 MMset(m, 0, NIL);
00400 return 0;
00401 }
00402
00403 SMaterial* material = (SMaterial*) MMfetch(m,MTOP(mat),0);
00404 if(material==NULL)
00405 {
00406 MMechostr(MSKDEBUG,"material==NULL\n");
00407 MMset(m, 0, NIL);
00408 return 0;
00409 }
00410
00411 int result = 0;
00412 if(material->GetReceiveShadows())
00413 result = 1;
00414 MMset(m, 0, ITOM(result));
00415
00416 return 0;
00417 }
00418
00419
00429 int SO3MaterialSetSelfIllumination(mmachine m)
00430 {
00431 #ifdef SO3_DEBUG
00432 MMechostr(MSKDEBUG,"SO3MaterialSetSelfIllumination\n");
00433 #endif
00434
00435 int color = MMpull(m);
00436 int mat = MMget(m, 0);
00437 if(mat==NIL)
00438 {
00439 MMset(m, 0, NIL);
00440 return 0;
00441 }
00442
00443 SMaterial * material = (SMaterial*) MMfetch(m,MTOP(mat),0);
00444 if(material==NULL)
00445 {
00446 MMechostr(MSKDEBUG,"material==NULL\n");
00447 MMset(m, 0, NIL);
00448 return 0;
00449 }
00450
00451 if (color == NIL)
00452 color = 0;
00453 else
00454 color = MTOI(color);
00455
00456 material->SetSelfIlluminationColor(color);
00457
00458 MMset(m, 0, ITOM(1));
00459 return 0;
00460
00461 }
00462
00463
00475 int SO3MaterialSetSelfIlluminationByTechAndPass(mmachine m)
00476 {
00477 #ifdef SO3_DEBUG
00478 MMechostr(MSKDEBUG,"SO3MaterialSetSelfIlluminationByTechAndPass\n");
00479 #endif
00480
00481 int color = MMpull(m);
00482 int pass = MMpull(m);
00483 int tec = MMpull(m);
00484 int mat = MMget(m, 0);
00485 if((mat==NIL) || (tec == NIL) || (pass == NIL))
00486 {
00487 MMset(m,0,NIL);
00488 return 0;
00489 }
00490
00491 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00492 if(material==NULL)
00493 {
00494 MMset(m, 0, NIL);
00495 return 0;
00496 }
00497
00498
00499 tec = (unsigned int) abs(MTOI(tec));
00500 pass = (unsigned int) abs(MTOI(pass));
00501
00502 if (color == NIL)
00503 color = 0;
00504 else
00505 color = MTOI(color);
00506
00507 try
00508 {
00509 material->SetSelfIlluminationColor(tec, pass, color);
00510 MMset(m, 0, ITOM(1));
00511 }
00512 catch (Ogre::Exception)
00513 {
00514 MMechostr(MSKDEBUG, "SO3MaterialSetSelfIlluminationByTechAndPass technique or pass error\n");
00515 MMset(m, 0, NIL);
00516 }
00517
00518 return 0;
00519
00520 }
00521
00522
00532 int SO3MaterialSetSpecular(mmachine m)
00533 {
00534 #ifdef SO3_DEBUG
00535 MMechostr(MSKDEBUG,"SO3MaterialSetSpecular\n");
00536 #endif
00537
00538 int color = MMpull(m);
00539 int mat = MMget(m, 0);
00540 if(mat==NIL)
00541 {
00542 MMset(m, 0, NIL);
00543 return 0;
00544 }
00545
00546 SMaterial * material = (SMaterial*) MMfetch(m,MTOP(mat),0);
00547 if(material==NULL)
00548 {
00549 MMechostr(MSKDEBUG,"material==NULL\n");
00550 MMset(m, 0, NIL);
00551 return 0;
00552 }
00553
00554 if (color == NIL)
00555 color = 0;
00556 else
00557 color = MTOI(color);
00558
00559 material->SetSpecularColor(color);
00560
00561 MMset(m, 0, ITOM(1));
00562 return 0;
00563 }
00564
00565
00577 int SO3MaterialSetSpecularByTechAndPass(mmachine m)
00578 {
00579 #ifdef SO3_DEBUG
00580 MMechostr(MSKDEBUG,"SO3MaterialSetSpecularByTechAndPass\n");
00581 #endif
00582
00583 int color = MMpull(m);
00584 int pass = MMpull(m);
00585 int tec = MMpull(m);
00586 int mat = MMget(m, 0);
00587
00588 if((mat==NIL) || (tec == NIL) || (pass == NIL))
00589 {
00590 MMset(m, 0, NIL);
00591 return 0;
00592 }
00593
00594 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00595 if(material==NULL)
00596 {
00597 MMset(m, 0, NIL);
00598 return 0;
00599 }
00600
00601
00602 tec = (unsigned int) abs(MTOI(tec));
00603 pass = (unsigned int) abs(MTOI(pass));
00604
00605 if (color == NIL)
00606 color = 0;
00607 else
00608 color = MTOI(color);
00609
00610 try
00611 {
00612 material->SetSpecularColor(tec, pass, color);
00613 MMset(m, 0, ITOM(1));
00614 }
00615 catch (Ogre::Exception)
00616 {
00617 MMechostr(MSKDEBUG, "SO3MaterialSetSpecularByTechAndPass technique or pass error\n");
00618 MMset(m, 0, NIL);
00619 }
00620
00621 return 0;
00622 }
00623
00624
00634 int SO3MaterialSetShininess(mmachine m)
00635 {
00636 #ifdef SO3_DEBUG
00637 MMechostr(MSKDEBUG,"SO3MaterialSetShininess\n");
00638 #endif
00639
00640 int shin = MMpull(m);
00641 int mat = MMget(m, 0);
00642 if((shin == NIL) || (mat==NIL))
00643 {
00644 MMset(m, 0, NIL);
00645 return 0;
00646 }
00647
00648 SMaterial * material = (SMaterial*) MMfetch(m,MTOP(mat),0);
00649 if(material==NULL)
00650 {
00651 MMechostr(MSKDEBUG,"material==NULL\n");
00652 MMset(m, 0, NIL);
00653 return 0;
00654 }
00655
00656 material->SetShininess(MTOF(shin));
00657
00658 MMset(m, 0, ITOM(1));
00659 return 0;
00660 }
00661
00662
00674 int SO3MaterialSetShininessByTechAndPass(mmachine m)
00675 {
00676 #ifdef SO3_DEBUG
00677 MMechostr(MSKDEBUG,"SO3MaterialSetShininessByTechAndPass\n");
00678 #endif
00679
00680 int shin = MMpull(m);
00681 int pass = MMpull(m);
00682 int tec = MMpull(m);
00683 int mat = MMget(m, 0);
00684 if((shin==NIL) || (mat==NIL) || (tec == NIL) || (pass == NIL))
00685 {
00686 MMset(m, 0, NIL);
00687 return 0;
00688 }
00689
00690 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00691 if(material==NULL)
00692 {
00693 MMset(m, 0, NIL);
00694 return 0;
00695 }
00696
00697
00698 tec = (unsigned int) abs(MTOI(tec));
00699 pass = (unsigned int) abs(MTOI(pass));
00700
00701 try
00702 {
00703 material->SetShininess(tec, pass, MTOF(shin));
00704 MMset(m, 0, ITOM(1));
00705 }
00706 catch (Ogre::Exception)
00707 {
00708 MMechostr(MSKDEBUG, "SO3MaterialSetShininessByTechAndPass technique or pass error\n");
00709 MMset(m, 0, NIL);
00710 }
00711
00712 return 0;
00713 }
00714
00715
00726 int SO3MaterialGetDiffuseByTechAndPass(mmachine m)
00727 {
00728 #ifdef SO3_DEBUG
00729 MMechostr(MSKDEBUG,"SO3MaterialGetDiffuseByTechAndPass\n");
00730 #endif
00731
00732 int pass = MMpull(m);
00733 int tec = MMpull(m);
00734 int mat = MMget(m, 0);
00735
00736 if((mat==NIL) || (tec==NIL) || (pass == NIL))
00737 {
00738 MMset(m, 0, NIL);
00739 return 0;
00740 }
00741
00742 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00743 if(material==NULL)
00744 {
00745 MMechostr(MSKDEBUG,"material==NULL\n");
00746 MMset(m, 0, NIL);
00747 return 0;
00748 }
00749
00750
00751 tec = (unsigned int) abs(MTOI(tec));
00752 pass = (unsigned int) abs(MTOI(pass));
00753
00754 try
00755 {
00756 MMset(m, 0, ITOM(material->GetDiffuseColor(tec, pass)));
00757 }
00758 catch (Ogre::Exception)
00759 {
00760 MMechostr(MSKDEBUG, "SO3MaterialGetDiffuseByTechAndPass technique or pass error\n");
00761 MMset(m, 0, NIL);
00762 }
00763
00764 return 0;
00765 }
00766
00767
00778 int SO3MaterialGetAmbientByTechAndPass(mmachine m)
00779 {
00780 #ifdef SO3_DEBUG
00781 MMechostr(MSKDEBUG,"SO3MaterialGetAmbientByTechAndPass\n");
00782 #endif
00783
00784 int pass = MMpull(m);
00785 int tec = MMpull(m);
00786 int mat = MMget(m, 0);
00787
00788 if((mat==NIL) || (tec==NIL) || (pass == NIL))
00789 {
00790 MMset(m, 0, NIL);
00791 return 0;
00792 }
00793
00794 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00795 if(material==NULL)
00796 {
00797 MMechostr(MSKDEBUG,"material==NULL\n");
00798 MMset(m, 0, NIL);
00799 return 0;
00800 }
00801
00802
00803 tec = (unsigned int) abs(MTOI(tec));
00804 pass = (unsigned int) abs(MTOI(pass));
00805
00806 try
00807 {
00808 MMset(m, 0, ITOM(material->GetAmbientColor(tec, pass)));
00809 }
00810 catch (Ogre::Exception)
00811 {
00812 MMechostr(MSKDEBUG, "SO3MaterialGetAmbientByTechAndPass technique or pass error\n");
00813 MMset(m, 0, NIL);
00814 }
00815
00816 return 0;
00817 }
00818
00819
00830 int SO3MaterialGetSpecularByTechAndPass(mmachine m)
00831 {
00832 #ifdef SO3_DEBUG
00833 MMechostr(MSKDEBUG,"SO3MaterialGetSpecularByTechAndPass\n");
00834 #endif
00835
00836 int pass = MMpull(m);
00837 int tec = MMpull(m);
00838 int mat = MMget(m, 0);
00839
00840 if((mat==NIL) || (tec==NIL) || (pass == NIL))
00841 {
00842 MMset(m, 0, NIL);
00843 return 0;
00844 }
00845
00846 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00847 if(material==NULL)
00848 {
00849 MMechostr(MSKDEBUG,"material==NULL\n");
00850 MMset(m, 0, NIL);
00851 return 0;
00852 }
00853
00854
00855 tec = (unsigned int) abs(MTOI(tec));
00856 pass = (unsigned int) abs(MTOI(pass));
00857
00858 try
00859 {
00860 MMset(m, 0, ITOM(material->GetSpecularColor(tec, pass)));
00861 }
00862 catch (Ogre::Exception)
00863 {
00864 MMechostr(MSKDEBUG, "SO3MaterialGetSpecularByTechAndPass technique or pass error\n");
00865 MMset(m, 0, NIL);
00866 }
00867
00868 return 0;
00869 }
00870
00871
00882 int SO3MaterialGetShininessByTechAndPass(mmachine m)
00883 {
00884 #ifdef SO3_DEBUG
00885 MMechostr(MSKDEBUG,"SO3MaterialGetShininessByTechAndPass\n");
00886 #endif
00887
00888 int pass = MMpull(m);
00889 int tec = MMpull(m);
00890 int mat = MMget(m, 0);
00891 if((mat==NIL) || (tec==NIL) || (pass == NIL))
00892 {
00893 MMset(m, 0, NIL);
00894 return 0;
00895 }
00896
00897 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00898 if(material==NULL)
00899 {
00900 MMechostr(MSKDEBUG,"material==NULL\n");
00901 MMset(m, 0, NIL);
00902 return 0;
00903 }
00904
00905
00906 tec = (unsigned int) abs(MTOI(tec));
00907 pass = (unsigned int) abs(MTOI(pass));
00908
00909 try
00910 {
00911 MMset(m, 0, FTOM(material->GetShininess(tec, pass)));
00912 }
00913 catch (Ogre::Exception)
00914 {
00915 MMechostr(MSKDEBUG, "SO3MaterialGetShininessByTechAndPass technique or pass error\n");
00916 MMset(m, 0, NIL);
00917 }
00918
00919 return 0;
00920 }
00921
00922
00933 int SO3MaterialGetSelfIlluminationByTechAndPass(mmachine m)
00934 {
00935 #ifdef SO3_DEBUG
00936 MMechostr(MSKDEBUG,"SO3MaterialGetSelfIlluminationByTechAndPass\n");
00937 #endif
00938
00939 int pass = MMpull(m);
00940 int tec = MMpull(m);
00941 int mat = MMget(m, 0);
00942
00943 if((mat==NIL) || (tec==NIL) || (pass == NIL))
00944 {
00945 MMset(m, 0, NIL);
00946 return 0;
00947 }
00948
00949 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
00950 if(material==NULL)
00951 {
00952 MMechostr(MSKDEBUG,"material==NULL\n");
00953 MMset(m, 0, NIL);
00954 return 0;
00955 }
00956
00957
00958 tec = (unsigned int) abs(MTOI(tec));
00959 pass = (unsigned int) abs(MTOI(pass));
00960
00961 try
00962 {
00963 MMset(m, 0, ITOM(material->GetSelfIlluminationColor(tec, pass)));
00964 }
00965 catch (Ogre::Exception)
00966 {
00967 MMechostr(MSKDEBUG, "SO3MaterialGetSelfIlluminationByTechAndPass technique or pass error\n");
00968 MMset(m, 0, NIL);
00969 }
00970
00971 return 0;
00972 }
00973
00974
00984 int SO3MaterialIsLighting(mmachine m)
00985 {
00986 #ifdef SO3_DEBUG
00987 MMechostr(MSKDEBUG,"SO3MaterialIsLighting\n");
00988 #endif
00989
00990 int state = MMpull(m);
00991 int mat = MMget(m, 0);
00992 if((mat==NIL) || (state==NIL))
00993 {
00994 MMset(m, 0, NIL);
00995 return 0;
00996 }
00997
00998 SMaterial* material = (SMaterial*) MMfetch(m,MTOP(mat),0);
00999 if(material==NULL)
01000 {
01001 MMechostr(MSKDEBUG,"material==NULL\n");
01002 MMset(m, 0, NIL);
01003 return 0;
01004 }
01005
01006 state = MTOI(state);
01007 if(state==SO3_TRUE)
01008 material->SetLightingEnabled(true);
01009 else
01010 material->SetLightingEnabled(false);
01011
01012 MMset(m, 0, ITOM(1));
01013 return 0;
01014 }
01015
01016
01025 int SO3MaterialNumberOfTechniques(mmachine m)
01026 {
01027 #ifdef SO3_DEBUG
01028 MMechostr(MSKDEBUG,"SO3MaterialNumberOfTechniques\n");
01029 #endif
01030
01031 int mat = MMget(m, 0);
01032 if(mat==NIL)
01033 {
01034 MMset(m, 0, NIL);
01035 return 0;
01036 }
01037
01038 SMaterial* material = (SMaterial*) MMfetch(m,MTOP(mat),0);
01039 if(material==NULL)
01040 {
01041 MMechostr(MSKDEBUG,"material==NULL\n");
01042 MMset(m, 0, NIL);
01043 return 0;
01044 }
01045
01046 int val = material->GetNumTechniques();
01047
01048 MMset(m, 0, ITOM(val));
01049 return 0;
01050
01051 }
01052
01053
01063 int SO3MaterialNumberOfPassesByTechnique(mmachine m)
01064 {
01065 #ifdef SO3_DEBUG
01066 MMechostr(MSKDEBUG,"SO3MaterialNumberOfPassesByTechnique\n");
01067 #endif
01068
01069 int tec = MMpull(m);
01070 int mat = MMget(m, 0);
01071 if((mat==NIL) || (tec==NIL))
01072 {
01073 MMset(m, 0, NIL);
01074 return 0;
01075 }
01076
01077 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01078 if(material==NULL)
01079 {
01080 MMechostr(MSKDEBUG,"material==NULL\n");
01081 MMset(m, 0, NIL);
01082 return 0;
01083 }
01084
01085
01086 tec = (unsigned int) abs(MTOI(tec));
01087
01088 try
01089 {
01090 int val = material->GetNumPasses(tec);
01091 MMset(m, 0, ITOM(val));
01092 }
01093 catch (Ogre::Exception)
01094 {
01095 MMechostr(MSKDEBUG, "SO3MaterialNumberOfPassesByTechnique technique or pass error\n");
01096 MMset(m, 0, ITOM(0));
01097 }
01098
01099 return 0;
01100 }
01101
01102
01113 int SO3MaterialNumberOfTexturesByTechniqueAndPass(mmachine m)
01114 {
01115 #ifdef SO3_DEBUG
01116 MMechostr(MSKDEBUG,"SO3MaterialNumberOfTexturesByTechniqueAndPass\n");
01117 #endif
01118
01119 int pass = MMpull(m);
01120 int tec = MMpull(m);
01121 int mat = MMget(m, 0);
01122 if((mat==NIL) || (tec==NIL) || (pass==NIL))
01123 {
01124 MMset(m, 0, NIL);
01125 return 0;
01126 }
01127
01128 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01129 if(material==NULL)
01130 {
01131 MMechostr(MSKDEBUG,"SO3MaterialNumberOfTexturesByTechniqueAndPass material==NULL\n");
01132 MMset(m, 0, NIL);
01133 return 0;
01134 }
01135
01136
01137 tec = (unsigned int) abs(MTOI(tec));
01138 pass = (unsigned int) abs(MTOI(pass));
01139
01140 try
01141 {
01142 int val = material->GetNumTextureUnitStates(tec, pass);
01143 MMset(m, 0, ITOM(val));
01144 }
01145 catch (Ogre::Exception)
01146 {
01147 MMechostr(MSKDEBUG, "SO3MaterialNumberOfTexturesByTechniqueAndPass technique or pass error\n");
01148 MMset(m, 0, ITOM(0));
01149 }
01150
01151 return 0;
01152 }
01153
01154
01164 int SO3MaterialTechniqueGetNameByIndex(mmachine m)
01165 {
01166 #ifdef SO3_DEBUG
01167 MMechostr(MSKDEBUG,"SO3MaterialTechniqueGetNameByIndex\n");
01168 #endif
01169
01170 int tec = MMpull(m);
01171 int mat = MMpull(m);
01172 if((mat==NIL) || (tec==NIL))
01173 {
01174 MMpush(m, NIL);
01175 return 0;
01176 }
01177
01178 SMaterial* material = (SMaterial*)MMfetch(m, MTOP(mat), 0);
01179 if(material==NULL)
01180 {
01181 MMechostr(MSKDEBUG,"material==NULL\n");
01182 MMpush(m, NIL);
01183 return 0;
01184 }
01185
01186
01187 tec = (unsigned int) abs(MTOI(tec));
01188
01189 try
01190 {
01191 std::string tecName = material->GetTechniqueName(tec);
01192 Mpushstrbloc(m, (char*)(tecName.c_str()));
01193 }
01194 catch (Ogre::Exception)
01195 {
01196 MMechostr(MSKDEBUG, "SO3MaterialTechniqueGetNameByIndex technique or pass error\n");
01197 MMpush(m, NIL);
01198 }
01199
01200 return 0;
01201 }
01202
01203
01213 int SO3MaterialTechniqueGetIndexByName(mmachine m)
01214 {
01215 #ifdef SO3_DEBUG
01216 MMechostr(MSKDEBUG,"SO3MaterialTechniqueGetIndexByName\n");
01217 #endif
01218
01219 int nam = MMpull(m);
01220 int mat = MMget(m, 0);
01221 if((mat==NIL)||(nam==NIL))
01222 {
01223 MMset(m, 0, NIL);
01224 return 0;
01225 }
01226
01227 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01228 if(material==NULL)
01229 {
01230 MMechostr(MSKDEBUG,"material==NULL\n");
01231 MMset(m, 0, NIL);
01232 return 0;
01233 }
01234
01235 if(material->getOgreMaterialPointer().isNull())
01236 {
01237 MMechostr(MSKDEBUG,"Ogre Material is NULL\n");
01238 MMset(m, 0, NIL);
01239 return 0;
01240 }
01241
01242 std::string name = MMstartstr(m, MTOP(nam));
01243 int index = material->GetTechniqueIndexByName(name);
01244
01245 MMset(m, 0, ITOM(index));
01246 return 0;
01247 }
01248
01249
01260 int SO3MaterialPassGetNameByIndex(mmachine m)
01261 {
01262 #ifdef SO3_DEBUG
01263 MMechostr(MSKDEBUG,"SO3MaterialPassGetNameByIndex\n");
01264 #endif
01265
01266 int pass = MMpull(m);
01267 int tec = MMpull(m);
01268 int mat = MMpull(m);
01269 if((mat==NIL) || (tec==NIL) || (pass==NIL))
01270 {
01271 MMpush(m, NIL);
01272 return 0;
01273 }
01274
01275 SMaterial* material = (SMaterial*)MMfetch(m, MTOP(mat), 0);
01276 if(material==NULL)
01277 {
01278 MMechostr(MSKDEBUG,"material==NULL\n");
01279 MMpush(m, NIL);
01280 return 0;
01281 }
01282
01283
01284 tec = (unsigned int) abs(MTOI(tec));
01285 pass = (unsigned int) abs(MTOI(pass));
01286
01287 try
01288 {
01289 std::string passName = material->GetPassName(tec, pass);
01290 Mpushstrbloc(m, (char*)passName.c_str());
01291 }
01292 catch (Ogre::Exception)
01293 {
01294 MMechostr(MSKDEBUG, "SO3MaterialPassGetNameByIndex technique or pass error\n");
01295 MMpush(m, NIL);
01296 }
01297
01298 return 0;
01299 }
01300
01301
01312 int SO3MaterialPassGetIndexByName(mmachine m)
01313 {
01314 #ifdef SO3_DEBUG
01315 MMechostr(MSKDEBUG,"SO3MaterialPassGetIndexByName\n");
01316 #endif
01317
01318 int nam = MMpull(m);
01319 int tec = MMpull(m);
01320 int mat = MMget(m, 0);
01321 if((mat==NIL) || (nam==NIL) || (tec == NIL))
01322 {
01323 MMset(m, 0, NIL);
01324 return 0;
01325 }
01326
01327 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01328 if(material==NULL)
01329 {
01330 MMechostr(MSKDEBUG,"material==NULL\n");
01331 MMset(m, 0, NIL);
01332 return 0;
01333 }
01334
01335 if(material->getOgreMaterialPointer().isNull())
01336 {
01337 MMechostr(MSKDEBUG,"Ogre Material is NULL\n");
01338 MMset(m, 0, NIL);
01339 return 0;
01340 }
01341
01342
01343 tec = (unsigned int) abs(MTOI(tec));
01344
01345 std::string name = MMstartstr(m, MTOP(nam));
01346
01347 try
01348 {
01349 int index = material->GetPassIndexByName(tec, name);
01350 MMset(m, 0, ITOM(index));
01351 }
01352 catch (Ogre::Exception)
01353 {
01354 MMechostr(MSKDEBUG, "SO3MaterialPassGetIndexByName technique error\n");
01355 MMset(m, 0, NIL);
01356 }
01357
01358 return 0;
01359 }
01360
01361
01373 int SO3MaterialTextureUnitGetNameByIndex(mmachine m)
01374 {
01375 #ifdef SO3_DEBUG
01376 MMechostr(MSKDEBUG,"SO3MaterialTextureUnitGetNameByIndex\n");
01377 #endif
01378
01379 int index = MMpull(m);
01380 int pass = MMpull(m);
01381 int tec = MMpull(m);
01382 int mat = MMpull(m);
01383 if((mat==NIL) || (tec==NIL) || (pass==NIL) || (index==NIL))
01384 {
01385 MMpush(m, NIL);
01386 return 0;
01387 }
01388
01389 SMaterial* material = (SMaterial*)MMfetch(m, MTOP(mat), 0);
01390 if(material==NULL)
01391 {
01392 MMechostr(MSKDEBUG,"material==NULL\n");
01393 MMpush(m, NIL);
01394 return 0;
01395 }
01396
01397
01398 tec = (unsigned int) abs(MTOI(tec));
01399 pass = (unsigned int) abs(MTOI(pass));
01400 index = (unsigned int) abs(MTOI(index));
01401
01402 try
01403 {
01404 std::string txName = material->GetTextureUnitName(tec, pass, index);
01405 Mpushstrbloc(m, (char*)(txName.c_str()));
01406 }
01407 catch (Ogre::Exception)
01408 {
01409 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetNameByIndex technique or pass error\n");
01410 MMpush(m, NIL);
01411 }
01412
01413 return 0;
01414 }
01415
01416
01428 int SO3MaterialTextureUnitGetIndexByName(mmachine m)
01429 {
01430 #ifdef SO3_DEBUG
01431 MMechostr(MSKDEBUG,"SO3MaterialTextureUnitGetIndexByName\n");
01432 #endif
01433
01434 int nam = MMpull(m);
01435 int pass = MMpull(m);
01436 int tec = MMpull(m);
01437 int mat = MMget(m, 0);
01438 if((mat==NIL) || (tec == NIL) || (pass == NIL) || (nam==NIL))
01439 {
01440 MMset(m, 0, NIL);
01441 return 0;
01442 }
01443
01444 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01445 if(material==NULL)
01446 {
01447 MMechostr(MSKDEBUG,"material==NULL\n");
01448 MMset(m, 0, NIL);
01449 return 0;
01450 }
01451
01452 if(material->getOgreMaterialPointer().isNull())
01453 {
01454 MMechostr(MSKDEBUG,"Ogre Material is NULL\n");
01455 MMset(m, 0, NIL);
01456 return 0;
01457 }
01458
01459
01460 tec = (unsigned int) abs(MTOI(tec));
01461 pass = (unsigned int) abs(MTOI(pass));
01462
01463 std::string name = MMstartstr(m, MTOP(nam));
01464
01465 try
01466 {
01467 int index = material->GetTextureUnitIndexByName(tec, pass, name);
01468 MMset(m, 0, ITOM(index));
01469 }
01470 catch (Ogre::Exception)
01471 {
01472 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetIndexByName technique or pass error\n");
01473 MMset(m, 0, NIL);
01474 }
01475
01476 return 0;
01477 }
01478
01479
01489 int SO3MaterialSetReceiveShadows(mmachine m)
01490 {
01491 #ifdef SO3_DEBUG
01492 MMechostr(MSKDEBUG,"SO3MaterialSetReceiveShadows\n");
01493 #endif
01494
01495 int state = MMpull(m);
01496 int mat = MMget(m,0);
01497 if((mat==NIL)||(state==NIL))
01498 {
01499 MMset(m, 0, NIL);
01500 return 0;
01501 }
01502
01503 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01504 if(material==NULL)
01505 {
01506 MMechostr(MSKDEBUG,"material==NULL\n");
01507 MMset(m, 0, NIL);
01508 return 0;
01509 }
01510
01511 state = MTOI(state);
01512
01513 if(state==SO3_TRUE)
01514 material->SetReceiveShadows(true);
01515 else
01516 material->SetReceiveShadows(false);
01517
01518 MMset(m, 0, ITOM(1));
01519 return 0;
01520 }
01521
01522
01535 int SO3MaterialSetTexture(mmachine m)
01536 {
01537 #ifdef SO3_DEBUG
01538 MMechostr(MSKDEBUG,"SO3MaterialSetTexture\n");
01539 #endif
01540
01541 int index = MMpull(m);
01542 int pass = MMpull(m);
01543 int tec = MMpull(m);
01544 int mtx = MMpull(m);
01545 int mat = MMget(m, 0);
01546 if((mat == NIL) || (mtx == NIL) || (tec == NIL) || (pass == NIL))
01547 {
01548 MMset(m, 0, NIL);
01549 return 0;
01550 }
01551
01552 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01553 if(material==NULL)
01554 {
01555 MMechostr(MSKDEBUG,"material==NULL\n");
01556 MMset(m, 0, NIL);
01557 return 0;
01558 }
01559
01560 STexture* texture = (STexture*) MMfetch(m, MTOP(mtx), 0);
01561 if(texture==NULL)
01562 {
01563 MMechostr(MSKDEBUG,"texture==NULL\n");
01564 MMset(m, 0, NIL);
01565 return 0;
01566 }
01567
01568
01569 tec = (unsigned int) abs(MTOI(tec));
01570 pass = (unsigned int) abs(MTOI(pass));
01571 index = (unsigned int) abs(MTOI(index));
01572
01573 try
01574 {
01575 material->SetTexture(tec, pass, index, texture);
01576 MMset(m, 0, ITOM(1));
01577 }
01578 catch (Ogre::Exception)
01579 {
01580 MMechostr(MSKDEBUG, "SO3MaterialSetTexture technique or pass error\n");
01581 MMset(m, 0, NIL);
01582 }
01583
01584 return 0;
01585 }
01586
01587
01599 int SO3MaterialGetTexture(mmachine m)
01600 {
01601 #ifdef SO3_DEBUG
01602 MMechostr(MSKDEBUG,"SO3MaterialGetTexture\n");
01603 #endif
01604
01605 int index = MMpull(m);
01606 int pass = MMpull(m);
01607 int tec = MMpull(m);
01608 int mat = MMget(m, 0);
01609 if((mat==NIL) || (tec==NIL) || (pass==NIL) || (index==NIL))
01610 {
01611 MMset(m, 0, NIL);
01612 return 0;
01613 }
01614
01615 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
01616 if(material==NULL)
01617 {
01618 MMechostr(MSKDEBUG,"material==NULL\n");
01619 MMset(m, 0, NIL);
01620 return 0;
01621 }
01622
01623
01624 MMpull(m);
01625
01626
01627 tec = (unsigned int) abs(MTOI(tec));
01628 pass = (unsigned int) abs(MTOI(pass));
01629 index = (unsigned int) abs(MTOI(index));
01630
01631 SScene* scene = material->GetScene();
01632
01633 try
01634 {
01635 STexture* texture = material->GetTexture(tec, pass, index);
01636 if(texture!=NULL)
01637 {
01638 int tx = OBJfindTH(m, SO3TEXTURE, (int)(texture));
01639 if(tx!=NIL)
01640 {
01641 tx = MMfetch(m,tx,OFFOBJMAG);
01642 MMpush(m, tx);
01643 return 0;
01644 }
01645 else
01646 {
01647
01648 return createTexture(m, texture, scene);
01649 }
01650 }
01651 }
01652 catch (Ogre::Exception)
01653 {
01654 MMechostr(MSKDEBUG, "SO3MaterialGetTexture technique or pass error\n");
01655 }
01656
01657 MMpush(m, NIL);
01658 return 0;
01659 }
01660
01661
01675 int SO3TextureCreate(mmachine m)
01676 {
01677 #ifdef SO3_DEBUG
01678 MMechostr(MSKDEBUG,"SO3TextureCreate\n");
01679 #endif
01680
01681 int h = MTOI(MMpull(m));
01682 int w = MTOI(MMpull(m));
01683 int group = MMpull(m);
01684 int file = MMpull(m);
01685 int name = MMpull(m);
01686 int s = MMget(m,0);
01687 if((s==NIL) || (name == NIL))
01688 {
01689 MMset(m, 0, NIL);
01690 return 0;
01691 }
01692
01693 SScene* scene = (SScene*) MMfetch(m, MTOP(s), 0);
01694 if(scene==NULL)
01695 {
01696 MMset(m, 0, NIL);
01697 return 0;
01698 }
01699
01700 std::string tmpTextureName = MMstartstr(m, MTOP(name));
01701 std::string filePath("");
01702 if (file != NIL)
01703 filePath = MMstartstr(m, MTOP(file));
01704
01705 const char* groupResource;
01706 if(group == NIL)
01707 groupResource = "General";
01708 else
01709 groupResource = MMstartstr(m, MTOP(group));
01710
01711 STexture* texture = scene->CreateTexture(groupResource, tmpTextureName, filePath, w, h);
01712 if(texture==NULL || texture->getOgreTexturePointer().isNull())
01713 {
01714 scene->DeleteTexture(texture);
01715 MMset(m, 0, NIL);
01716 MMechostr(MSKRUNTIME, "SO3TextureCreate : Texture creation failed ! > %s", tmpTextureName.c_str());
01717 return 0;
01718 }
01719
01720
01721 MMpull(m);
01722 return createTexture(m,texture,scene);
01723 }
01724
01725
01734 int SO3TextureDestroy(mmachine m)
01735 {
01736 #ifdef SO3_DEBUG
01737 MMechostr(MSKDEBUG,"SO3TextureDestroy\n");
01738 #endif
01739
01740 int tx = MMget(m, 0);
01741 if(tx==NIL)
01742 {
01743 MMset(m, 0, NIL);
01744 return 0;
01745 }
01746
01747 OBJdelTM(m,SO3TEXTURE,tx);
01748 return 0;
01749 }
01750
01759 int SO3TextureGetName(mmachine m)
01760 {
01761 #ifdef SO3_DEBUG
01762 MMechostr(MSKDEBUG,"SO3TextureGetName\n");
01763 #endif
01764
01765 int tx = MMpull(m);
01766 if(tx==NIL)
01767 {
01768 MMpush(m, NIL);
01769 return 0;
01770 }
01771
01772 STexture* texture = (STexture*)MMfetch(m, MTOP(tx), 0);
01773 if(texture == NULL)
01774 {
01775 MMpush(m, NIL);
01776 return 0;
01777 }
01778
01779 return Mpushstrbloc(m, (char*)texture->GetName().c_str());
01780 }
01781
01782
01791 int SO3TextureManagerGetMemoryUsage(mmachine m)
01792 {
01793 #ifdef SO3_DEBUG
01794 MMechostr(MSKDEBUG,"SO3TextureManagerGetMemoryUsage\n");
01795 #endif
01796
01797 int s = MMget(m, 0);
01798 if((s==NIL))
01799 {
01800 MMset(m, 0, NIL);
01801 return 0;
01802 }
01803
01804 SScene* scene = (SScene*) MMfetch(m, MTOP(s), 0);
01805 if(scene==NULL)
01806 {
01807 MMset(m, 0, NIL);
01808 return 0;
01809 }
01810
01811 size_t count = scene->O3TextureManager->getMemoryUsage();
01812 MMset(m, 0, ITOM(count));
01813 return 0;
01814 }
01815
01816
01826 int SO3TextureBlit(mmachine m)
01827 {
01828 #ifdef SO3_DEBUG
01829 MMechostr(MSKDEBUG,"SO3TextureBlit\n");
01830 #endif
01831
01832 int bitm = MMpull(m);
01833 int tx = MMget(m, 0);
01834 if(tx==NIL)
01835 {
01836 MMechostr(MSKDEBUG,"tex==NIL\n");
01837 MMset(m, 0, NIL);
01838 return 0;
01839 }
01840 if(bitm==NIL)
01841 {
01842 MMechostr(MSKDEBUG,"objBmp==NIL\n");
01843 MMset(m, 0, NIL);
01844 return 0;
01845 }
01846
01847 STexture* texture = (STexture*) MMfetch(m, MTOP(tx), 0);
01848 if(texture==NULL)
01849 {
01850 MMechostr(MSKDEBUG,"texture==NULL\n");
01851 MMset(m, 0, NIL);
01852 return 0;
01853 }
01854
01855
01856 PtrObjVoid OB;
01857 PtrObjBitmap B;
01858
01859 OB = (PtrObjVoid) MMstart(m, MTOP(bitm));
01860 if(OB->Type != OBJ_TYPE_BITMAP<< 1)
01861 {
01862 MMset(m, 0, NIL);
01863 return 0;
01864 }
01865 B = (PtrObjBitmap) MMstart(m, MTOP(OB->Buffer));
01866
01867
01868 Ogre::TexturePtr ogreTexture = texture->getOgreTexturePointer();
01869 if(ogreTexture.isNull())
01870 {
01871 MMset(m, 0, NIL);
01872 MMechostr(MSKRUNTIME, "SO3TextureBlit : Texture is null");
01873 return 0;
01874 }
01875
01876 std::size_t textureNumMipmap = ogreTexture->getNumMipmaps();
01877
01878
01879 Ogre::HardwarePixelBufferSharedPtr pixelBuffer = ogreTexture->getBuffer(0, 0);
01880
01881
01882 pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
01883
01884 int bsize = (sizeof(unsigned char*) * 3);
01885 void* pixelsData = (void*)malloc(B->TailleW * B->TailleH * bsize);
01886 if (pixelsData == 0)
01887 {
01888 MMset(m, 0, NIL);
01889 MMechostr(MSKRUNTIME, "SO3TextureBlit : Malloc fail");
01890 return 0;
01891 }
01892
01893 const Ogre::PixelBox& largePixelBox = pixelBuffer->getCurrentLock();
01894
01895
01896
01897
01898
01899 ConversionTools::ScolBitmapGetRGB(B, static_cast<unsigned char*>(pixelsData));
01900
01901 const Ogre::PixelBox scolPixelBox(B->TailleW, B->TailleH, 1, Ogre::PF_R8G8B8, pixelsData);
01902 Ogre::Image::scale(scolPixelBox, largePixelBox);
01903
01904
01905 for(size_t iMipmap = 1; iMipmap < textureNumMipmap; iMipmap++)
01906 {
01907
01908 Ogre::HardwarePixelBufferSharedPtr pixelBufferMipmap = ogreTexture->getBuffer(0, iMipmap);
01909
01910
01911 pixelBufferMipmap->lock(Ogre::HardwareBuffer::HBL_DISCARD);
01912 const Ogre::PixelBox& smallPixelBox = pixelBufferMipmap->getCurrentLock();
01913
01914
01915 Ogre::Image::scale(largePixelBox, smallPixelBox);
01916
01917
01918 pixelBufferMipmap->unlock();
01919 }
01920
01921
01922 pixelBuffer->unlock();
01923
01924 if(pixelsData)
01925 free(pixelsData);
01926
01927 MMset(m, 0, ITOM(1));
01928 return 0;
01929 }
01930
01940 int SO3TextureBlitAlpha(mmachine m)
01941 {
01942 #ifdef SO3_DEBUG
01943 MMechostr(MSKDEBUG,"SO3TextureBlitAlpha\n");
01944 #endif
01945
01946 int alphaBitmap = MMpull(m);
01947 int tx = MMget(m, 0);
01948
01949 if((tx==NIL))
01950 {
01951 MMechostr(MSKDEBUG,"tex==NIL\n");
01952 MMset(m, 0, NIL);
01953 return 0;
01954 }
01955 if((alphaBitmap==NIL))
01956 {
01957 MMechostr(MSKDEBUG,"alphaBitmap==NIL\n");
01958 MMset(m, 0, NIL);
01959 return 0;
01960 }
01961
01962 STexture* texture = (STexture*) MMfetch(m, MTOP(tx), 0);
01963 if(texture==NULL)
01964 {
01965 MMechostr(MSKDEBUG,"texture==NULL\n");
01966 MMset(m, 0, NIL);
01967 return 0;
01968 }
01969
01970
01971 int colorLayer = MMfetch(m, MTOP(alphaBitmap), 0);
01972 int alphaLayer = MMfetch(m, MTOP(alphaBitmap), 1);
01973
01974 PtrObjVoid OBcolor;
01975 PtrObjBitmap Bcolor;
01976 OBcolor = (PtrObjVoid) MMstart(m, MTOP(colorLayer));
01977 if(OBcolor->Type != OBJ_TYPE_BITMAP << 1)
01978 {
01979 MMset(m, 0, NIL);
01980 return 0;
01981 }
01982 Bcolor = (PtrObjBitmap) MMstart(m, MTOP(OBcolor->Buffer));
01983
01984 PtrObjVoid OBalpha;
01985 PtrObjBitmap Balpha;
01986 OBalpha = (PtrObjVoid) MMstart(m, MTOP(alphaLayer));
01987 if(OBalpha->Type != OBJ_TYPE_BITMAP << 1)
01988 {
01989 MMset(m, 0, NIL);
01990 return 0;
01991 }
01992 Balpha = (PtrObjBitmap) MMstart(m,MTOP(OBalpha->Buffer));
01993
01994
01995 Ogre::TexturePtr ogreTexture = texture->getOgreTexturePointer();
01996 if(ogreTexture.isNull())
01997 {
01998 MMset(m, 0, NIL);
01999 MMechostr(MSKRUNTIME, "SO3TextureBlitAlpha : Texture is null");
02000 return 0;
02001 }
02002
02003 std::size_t textureNumMipmap = ogreTexture->getNumMipmaps();
02004
02005
02006 Ogre::HardwarePixelBufferSharedPtr pixelBuffer = ogreTexture->getBuffer(0, 0);
02007
02008
02009 pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
02010
02011 int bsize = sizeof(Ogre::uint32*);
02012 void* pixelsData = (void*)malloc(Bcolor->TailleW * Bcolor->TailleH * bsize);
02013 if (pixelsData == 0)
02014 {
02015 MMset(m, 0, NIL);
02016 MMechostr(MSKRUNTIME, "SO3TextureBlitAlpha : Malloc fail");
02017 return 0;
02018 }
02019
02020 const Ogre::PixelBox scolPixelBox(Bcolor->TailleW, Bcolor->TailleH, 1, Ogre::PF_R8G8B8A8, pixelsData);
02021
02022
02023 ConversionTools::ScolBitmapGetRGBA(Bcolor, Balpha, static_cast<Ogre::uint32*>(pixelsData));
02024
02025
02026 const Ogre::PixelBox finalPixelBox(Bcolor->TailleW, Bcolor->TailleH, 1, Ogre::PF_R8G8B8A8, pixelsData);
02027 const Ogre::PixelBox& largePixelBox = pixelBuffer->getCurrentLock();
02028
02029
02030 Ogre::Image::scale(finalPixelBox, largePixelBox);
02031
02032
02033 for(size_t iMipmap = 1; iMipmap < textureNumMipmap; iMipmap++)
02034 {
02035
02036 Ogre::HardwarePixelBufferSharedPtr pixelBufferMipmap = ogreTexture->getBuffer(0, iMipmap);
02037
02038
02039 pixelBufferMipmap->lock(Ogre::HardwareBuffer::HBL_DISCARD);
02040 const Ogre::PixelBox& smallPixelBox = pixelBufferMipmap->getCurrentLock();
02041
02042
02043 Ogre::Image::scale(largePixelBox, smallPixelBox);
02044
02045
02046 pixelBufferMipmap->unlock();
02047 }
02048
02049
02050 pixelBuffer->unlock();
02051
02052 if(pixelsData)
02053 free(pixelsData);
02054
02055 MMset(m, 0, ITOM(1));
02056 return 0;
02057 }
02058
02071 int SO3MaterialSetTextureUScroll(mmachine m)
02072 {
02073 #ifdef SO3_DEBUG
02074 MMechostr(MSKDEBUG, "SO3MaterialSetTextureUScroll\n");
02075 #endif
02076
02077 int scrollValue = MMpull(m);
02078 int textureUnit = MMpull(m);
02079 int pass = MMpull(m);
02080 int technique = MMpull(m);
02081 int mat = MMget(m, 0);
02082
02083
02084 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(scrollValue==NIL))
02085 {
02086 MMset(m, 0, NIL);
02087 return 0;
02088 }
02089
02090
02091 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02092 if(material == NULL)
02093 {
02094 MMset(m, 0, NIL);
02095 return 0;
02096 }
02097
02098
02099 technique = MTOI(technique);
02100 pass = MTOI(pass);
02101 textureUnit = MTOI(textureUnit);
02102 float value = MTOF(scrollValue);
02103
02104 try
02105 {
02106 material->SetTextureUScroll(technique, pass, textureUnit, value);
02107 MMset(m, 0, ITOM(1));
02108 }
02109 catch(Ogre::Exception& e)
02110 {
02111 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02112 MMset(m, 0, NIL);
02113 }
02114 return 0;
02115 }
02116
02129 int SO3MaterialGetTextureUScroll(mmachine m)
02130 {
02131 #ifdef SO3_DEBUG
02132 MMechostr(MSKDEBUG, "SO3MaterialGetTextureUScroll\n");
02133 #endif
02134
02135 int textureUnit = MMpull(m);
02136 int pass = MMpull(m);
02137 int technique = MMpull(m);
02138 int mat = MMget(m, 0);
02139
02140
02141 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL))
02142 {
02143 MMset(m, 0, NIL);
02144 return 0;
02145 }
02146
02147
02148 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02149 if(material == NULL)
02150 {
02151 MMset(m, 0, NIL);
02152 return 0;
02153 }
02154
02155
02156 technique = MTOI(technique);
02157 pass = MTOI(pass);
02158 textureUnit = MTOI(textureUnit);
02159
02160 try
02161 {
02162 float value = material->GetTextureUScroll(technique, pass, textureUnit);
02163 MMset(m, 0, FTOM(value));
02164 }
02165 catch(Ogre::Exception& e)
02166 {
02167 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02168 MMset(m, 0, NIL);
02169 }
02170 return 0;
02171 }
02172
02185 int SO3MaterialSetTextureVScroll(mmachine m)
02186 {
02187 #ifdef SO3_DEBUG
02188 MMechostr(MSKDEBUG, "SO3MaterialSetTextureVScroll\n");
02189 #endif
02190
02191 int scrollValue = MMpull(m);
02192 int textureUnit = MMpull(m);
02193 int pass = MMpull(m);
02194 int technique = MMpull(m);
02195 int mat = MMget(m, 0);
02196
02197
02198 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(scrollValue==NIL))
02199 {
02200 MMset(m, 0, NIL);
02201 return 0;
02202 }
02203
02204
02205 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02206 if(material == NULL)
02207 {
02208 MMset(m, 0, NIL);
02209 return 0;
02210 }
02211
02212
02213 technique = MTOI(technique);
02214 pass = MTOI(pass);
02215 textureUnit = MTOI(textureUnit);
02216 float value = MTOF(scrollValue);
02217
02218 try
02219 {
02220 material->SetTextureVScroll(technique, pass, textureUnit, value);
02221 MMset(m, 0, ITOM(1));
02222 }
02223 catch(Ogre::Exception& e)
02224 {
02225 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02226 MMset(m, 0, NIL);
02227 }
02228 return 0;
02229 }
02230
02243 int SO3MaterialGetTextureVScroll(mmachine m)
02244 {
02245 #ifdef SO3_DEBUG
02246 MMechostr(MSKDEBUG, "SO3MaterialGetTextureVScroll\n");
02247 #endif
02248
02249 int textureUnit = MMpull(m);
02250 int pass = MMpull(m);
02251 int technique = MMpull(m);
02252 int mat = MMget(m, 0);
02253
02254
02255 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL))
02256 {
02257 MMset(m, 0, NIL);
02258 return 0;
02259 }
02260
02261
02262 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02263 if(material == NULL)
02264 {
02265 MMset(m, 0, NIL);
02266 return 0;
02267 }
02268
02269
02270 technique = MTOI(technique);
02271 pass = MTOI(pass);
02272 textureUnit = MTOI(textureUnit);
02273
02274 try
02275 {
02276 float value = material->GetTextureVScroll(technique, pass, textureUnit);
02277 MMset(m, 0, FTOM(value));
02278 }
02279 catch(Ogre::Exception& e)
02280 {
02281 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02282 MMset(m, 0, NIL);
02283 }
02284 return 0;
02285 }
02286
02299 int SO3MaterialSetTextureUScale(mmachine m)
02300 {
02301 #ifdef SO3_DEBUG
02302 MMechostr(MSKDEBUG, "SO3MaterialSetTextureUScale\n");
02303 #endif
02304
02305 int scaleValue = MMpull(m);
02306 int textureUnit = MMpull(m);
02307 int pass = MMpull(m);
02308 int technique = MMpull(m);
02309 int mat = MMget(m, 0);
02310
02311
02312 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(scaleValue==NIL))
02313 {
02314 MMset(m, 0, NIL);
02315 return 0;
02316 }
02317
02318
02319 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02320 if(material == NULL)
02321 {
02322 MMset(m, 0, NIL);
02323 return 0;
02324 }
02325
02326
02327 technique = MTOI(technique);
02328 pass = MTOI(pass);
02329 textureUnit = MTOI(textureUnit);
02330 float value = MTOF(scaleValue);
02331
02332 try
02333 {
02334 material->SetTextureUScale(technique, pass, textureUnit, value);
02335 MMset(m, 0, ITOM(1));
02336 }
02337 catch(Ogre::Exception& e)
02338 {
02339 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02340 MMset(m, 0, NIL);
02341 }
02342 return 0;
02343 }
02344
02357 int SO3MaterialGetTextureUScale(mmachine m)
02358 {
02359 #ifdef SO3_DEBUG
02360 MMechostr(MSKDEBUG, "SO3MaterialGetTextureUScale\n");
02361 #endif
02362
02363 int textureUnit = MMpull(m);
02364 int pass = MMpull(m);
02365 int technique = MMpull(m);
02366 int mat = MMget(m, 0);
02367
02368
02369 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL))
02370 {
02371 MMset(m, 0, NIL);
02372 return 0;
02373 }
02374
02375
02376 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02377 if(material == NULL)
02378 {
02379 MMset(m, 0, NIL);
02380 return 0;
02381 }
02382
02383
02384 technique = MTOI(technique);
02385 pass = MTOI(pass);
02386 textureUnit = MTOI(textureUnit);
02387
02388 try
02389 {
02390 float value = material->GetTextureUScale(technique, pass, textureUnit);
02391 MMset(m, 0, FTOM(value));
02392 }
02393 catch(Ogre::Exception& e)
02394 {
02395 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02396 MMset(m, 0, NIL);
02397 }
02398 return 0;
02399 }
02400
02413 int SO3MaterialSetTextureVScale(mmachine m)
02414 {
02415 #ifdef SO3_DEBUG
02416 MMechostr(MSKDEBUG, "SO3MaterialSetTextureVScale\n");
02417 #endif
02418
02419 int scaleValue = MMpull(m);
02420 int textureUnit = MMpull(m);
02421 int pass = MMpull(m);
02422 int technique = MMpull(m);
02423 int mat = MMget(m, 0);
02424
02425
02426 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(scaleValue==NIL))
02427 {
02428 MMset(m, 0, NIL);
02429 return 0;
02430 }
02431
02432
02433 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02434 if(material == NULL)
02435 {
02436 MMset(m, 0, NIL);
02437 return 0;
02438 }
02439
02440
02441 technique = MTOI(technique);
02442 pass = MTOI(pass);
02443 textureUnit = MTOI(textureUnit);
02444 float value = MTOF(scaleValue);
02445
02446 try
02447 {
02448 material->SetTextureVScale(technique, pass, textureUnit, value);
02449 MMset(m, 0, ITOM(1));
02450 }
02451 catch(Ogre::Exception& e)
02452 {
02453 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02454 MMset(m, 0, NIL);
02455 }
02456 return 0;
02457 }
02458
02471 int SO3MaterialGetTextureVScale(mmachine m)
02472 {
02473 #ifdef SO3_DEBUG
02474 MMechostr(MSKDEBUG, "SO3MaterialGetTextureVScale\n");
02475 #endif
02476
02477 int textureUnit = MMpull(m);
02478 int pass = MMpull(m);
02479 int technique = MMpull(m);
02480 int mat = MMget(m, 0);
02481
02482
02483 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL))
02484 {
02485 MMset(m, 0, NIL);
02486 return 0;
02487 }
02488
02489
02490 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02491 if(material == NULL)
02492 {
02493 MMset(m, 0, NIL);
02494 return 0;
02495 }
02496
02497
02498 technique = MTOI(technique);
02499 pass = MTOI(pass);
02500 textureUnit = MTOI(textureUnit);
02501
02502 try
02503 {
02504 float value = material->GetTextureVScale(technique, pass, textureUnit);
02505 MMset(m, 0, FTOM(value));
02506 }
02507 catch(Ogre::Exception& e)
02508 {
02509 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02510 MMset(m, 0, NIL);
02511 }
02512 return 0;
02513 }
02514
02527 int SO3MaterialSetTextureRotate(mmachine m)
02528 {
02529 #ifdef SO3_DEBUG
02530 MMechostr(MSKDEBUG, "SO3MaterialSetTextureRotate\n");
02531 #endif
02532
02533 int rotationAngle = MMpull(m);
02534 int textureUnit = MMpull(m);
02535 int pass = MMpull(m);
02536 int technique = MMpull(m);
02537 int mat = MMget(m, 0);
02538
02539
02540 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(rotationAngle==NIL))
02541 {
02542 MMset(m, 0, NIL);
02543 return 0;
02544 }
02545
02546
02547 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02548 if(material == NULL)
02549 {
02550 MMset(m, 0, NIL);
02551 return 0;
02552 }
02553
02554
02555 technique = MTOI(technique);
02556 pass = MTOI(pass);
02557 textureUnit = MTOI(textureUnit);
02558 float angle = MTOF(rotationAngle);
02559
02560 try
02561 {
02562 material->SetTextureRotate(technique, pass, textureUnit, angle);
02563 MMset(m, 0, ITOM(1));
02564 }
02565 catch(Ogre::Exception& e)
02566 {
02567 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02568 MMset(m, 0, NIL);
02569 }
02570 return 0;
02571 }
02572
02585 int SO3MaterialGetTextureRotate(mmachine m)
02586 {
02587 #ifdef SO3_DEBUG
02588 MMechostr(MSKDEBUG, "SO3MaterialGetTextureRotate\n");
02589 #endif
02590
02591 int textureUnit = MMpull(m);
02592 int pass = MMpull(m);
02593 int technique = MMpull(m);
02594 int mat = MMget(m, 0);
02595
02596
02597 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL))
02598 {
02599 MMset(m, 0, NIL);
02600 return 0;
02601 }
02602
02603
02604 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02605 if(material == NULL)
02606 {
02607 MMset(m, 0, NIL);
02608 return 0;
02609 }
02610
02611
02612 technique = MTOI(technique);
02613 pass = MTOI(pass);
02614 textureUnit = MTOI(textureUnit);
02615
02616 try
02617 {
02618 float value = material->GetTextureRotate(technique, pass, textureUnit);
02619 MMset(m, 0, FTOM(value));
02620 }
02621 catch(Ogre::Exception& e)
02622 {
02623 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02624 MMset(m, 0, NIL);
02625 }
02626 return 0;
02627 }
02628
02641 int SO3MaterialSetTextureRotateAnimation(mmachine m)
02642 {
02643 #ifdef SO3_DEBUG
02644 MMechostr(MSKDEBUG, "SO3MaterialSetTextureRotateAnimation\n");
02645 #endif
02646
02647 int rotationSpeed = MMpull(m);
02648 int textureUnit = MMpull(m);
02649 int pass = MMpull(m);
02650 int technique = MMpull(m);
02651 int mat = MMget(m, 0);
02652
02653
02654 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(rotationSpeed==NIL))
02655 {
02656 MMset(m, 0, NIL);
02657 return 0;
02658 }
02659
02660
02661 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02662 if(material == NULL)
02663 {
02664 MMset(m, 0, NIL);
02665 return 0;
02666 }
02667
02668
02669 technique = MTOI(technique);
02670 pass = MTOI(pass);
02671 textureUnit = MTOI(textureUnit);
02672 float speed = MTOF(rotationSpeed);
02673
02674 try
02675 {
02676 material->SetTextureRotateAnimation(technique, pass, textureUnit, speed);
02677 MMset(m, 0, ITOM(1));
02678 }
02679 catch(Ogre::Exception& e)
02680 {
02681 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02682 MMset(m, 0, NIL);
02683 }
02684 return 0;
02685 }
02686
02700 int SO3MaterialSetTextureScrollAnimation(mmachine m)
02701 {
02702 #ifdef SO3_DEBUG
02703 MMechostr(MSKDEBUG, "SO3MaterialSetTextureScrollAnimation\n");
02704 #endif
02705
02706 int speedVertical = MMpull(m);
02707 int speedHorizontal = MMpull(m);
02708 int textureUnit = MMpull(m);
02709 int pass = MMpull(m);
02710 int technique = MMpull(m);
02711 int mat = MMget(m, 0);
02712
02713
02714 if((mat==NIL)||(technique==NIL)||(pass==NIL)||(textureUnit==NIL)||(speedHorizontal==NIL)||(speedVertical==NIL))
02715 {
02716 MMset(m, 0, NIL);
02717 return 0;
02718 }
02719
02720
02721 SMaterial* material = (SMaterial*) MMfetch(m, MTOP(mat), 0);
02722 if(material == NULL)
02723 {
02724 MMset(m, 0, NIL);
02725 return 0;
02726 }
02727
02728
02729 technique = MTOI(technique);
02730 pass = MTOI(pass);
02731 textureUnit = MTOI(textureUnit);
02732 float valueH = MTOF(speedHorizontal);
02733 float valueV = MTOF(speedVertical);
02734
02735 try
02736 {
02737 material->SetTextureScrollAnimation(technique, pass, textureUnit, valueH, valueV);
02738 MMset(m, 0, ITOM(1));
02739 }
02740 catch(Ogre::Exception& e)
02741 {
02742 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
02743 MMset(m, 0, NIL);
02744 }
02745 return 0;
02746 }
02747
02751 #define NBMATERIALPKG 50
02752
02753
02757 char* MATERIALname[NBMATERIALPKG]=
02758 {
02759 "SO3MaterialCreate",
02760 "SO3MaterialDestroy",
02761 "SO3MaterialGetName",
02762 "SO3MaterialSetAmbient",
02763 "SO3MaterialSetAmbientByTechAndPass",
02764 "SO3MaterialSetDiffuse",
02765 "SO3MaterialSetDiffuseByTechAndPass",
02766 "SO3MaterialGetReceiveShadows",
02767 "SO3MaterialSetSelfIllumination",
02768 "SO3MaterialSetSelfIlluminationByTechAndPass",
02769 "SO3MaterialSetSpecular",
02770 "SO3MaterialSetSpecularByTechAndPass",
02771 "SO3MaterialSetShininess",
02772 "SO3MaterialSetShininessByTechAndPass",
02773 "SO3MaterialGetDiffuseByTechAndPass",
02774 "SO3MaterialGetAmbientByTechAndPass",
02775 "SO3MaterialGetSpecularByTechAndPass",
02776 "SO3MaterialGetShininessByTechAndPass",
02777 "SO3MaterialGetSelfIlluminationByTechAndPass",
02778 "SO3MaterialIsLighting",
02779 "SO3MaterialNumberOfTechniques",
02780 "SO3MaterialNumberOfPassesByTechnique",
02781 "SO3MaterialNumberOfTexturesByTechniqueAndPass",
02782 "SO3MaterialTechniqueGetNameByIndex",
02783 "SO3MaterialTechniqueGetIndexByName",
02784 "SO3MaterialPassGetNameByIndex",
02785 "SO3MaterialPassGetIndexByName",
02786 "SO3MaterialTextureUnitGetNameByIndex",
02787 "SO3MaterialTextureUnitGetIndexByName",
02788 "SO3MaterialSetReceiveShadows",
02789 "SO3MaterialSetTexture",
02790 "SO3MaterialGetTexture",
02791 "SO3TextureCreate",
02792 "SO3TextureDestroy",
02793 "SO3TextureGetName",
02794 "SO3TextureManagerGetMemoryUsage",
02795 "SO3TextureBlit",
02796 "SO3TextureBlitAlpha",
02797 "SO3MaterialSetTextureUScroll",
02798 "SO3MaterialGetTextureUScroll",
02799 "SO3MaterialSetTextureVScroll",
02800 "SO3MaterialGetTextureVScroll",
02801 "SO3MaterialSetTextureUScale",
02802 "SO3MaterialGetTextureUScale",
02803 "SO3MaterialSetTextureVScale",
02804 "SO3MaterialGetTextureVScale",
02805 "SO3MaterialSetTextureRotate",
02806 "SO3MaterialGetTextureRotate",
02807 "SO3MaterialSetTextureRotateAnimation",
02808 "SO3MaterialSetTextureScrollAnimation"
02809 };
02810
02811
02815 int (*MATERIALFunc[NBMATERIALPKG])(mmachine m)=
02816 {
02817 SO3MaterialCreate,
02818 SO3MaterialDestroy,
02819 SO3MaterialGetName,
02820 SO3MaterialSetAmbient,
02821 SO3MaterialSetAmbientByTechAndPass,
02822 SO3MaterialSetDiffuse,
02823 SO3MaterialSetDiffuseByTechAndPass,
02824 SO3MaterialGetReceiveShadows,
02825 SO3MaterialSetSelfIllumination,
02826 SO3MaterialSetSelfIlluminationByTechAndPass,
02827 SO3MaterialSetSpecular,
02828 SO3MaterialSetSpecularByTechAndPass,
02829 SO3MaterialSetShininess,
02830 SO3MaterialSetShininessByTechAndPass,
02831 SO3MaterialGetDiffuseByTechAndPass,
02832 SO3MaterialGetAmbientByTechAndPass,
02833 SO3MaterialGetSpecularByTechAndPass,
02834 SO3MaterialGetShininessByTechAndPass,
02835 SO3MaterialGetSelfIlluminationByTechAndPass,
02836 SO3MaterialIsLighting,
02837 SO3MaterialNumberOfTechniques,
02838 SO3MaterialNumberOfPassesByTechnique,
02839 SO3MaterialNumberOfTexturesByTechniqueAndPass,
02840 SO3MaterialTechniqueGetNameByIndex,
02841 SO3MaterialTechniqueGetIndexByName,
02842 SO3MaterialPassGetNameByIndex,
02843 SO3MaterialPassGetIndexByName,
02844 SO3MaterialTextureUnitGetNameByIndex,
02845 SO3MaterialTextureUnitGetIndexByName,
02846 SO3MaterialSetReceiveShadows,
02847 SO3MaterialSetTexture,
02848 SO3MaterialGetTexture,
02849 SO3TextureCreate,
02850 SO3TextureDestroy,
02851 SO3TextureGetName,
02852 SO3TextureManagerGetMemoryUsage,
02853 SO3TextureBlit,
02854 SO3TextureBlitAlpha,
02855 SO3MaterialSetTextureUScroll,
02856 SO3MaterialGetTextureUScroll,
02857 SO3MaterialSetTextureVScroll,
02858 SO3MaterialGetTextureVScroll,
02859 SO3MaterialSetTextureUScale,
02860 SO3MaterialGetTextureUScale,
02861 SO3MaterialSetTextureVScale,
02862 SO3MaterialGetTextureVScale,
02863 SO3MaterialSetTextureRotate,
02864 SO3MaterialGetTextureRotate,
02865 SO3MaterialSetTextureRotateAnimation,
02866 SO3MaterialSetTextureScrollAnimation
02867 };
02868
02869
02873 int MATERIALnarg[NBMATERIALPKG]=
02874 {
02875 3,
02876 1,
02877 1,
02878 2,
02879 4,
02880 2,
02881 4,
02882 1,
02883 2,
02884 4,
02885 2,
02886 4,
02887 2,
02888 4,
02889 3,
02890 3,
02891 3,
02892 3,
02893 3,
02894 2,
02895 1,
02896 2,
02897 3,
02898 2,
02899 2,
02900 3,
02901 3,
02902 4,
02903 4,
02904 2,
02905 5,
02906 4,
02907 6,
02908 1,
02909 1,
02910 1,
02911 2,
02912 2,
02913 5,
02914 4,
02915 5,
02916 4,
02917 5,
02918 4,
02919 5,
02920 4,
02921 5,
02922 4,
02923 5,
02924 6
02925 };
02926
02927
02931 char* MATERIALType[NBMATERIALPKG]=
02932 {
02933 "fun [SO3_SCENE S S] SO3_MATERIAL",
02934 "fun [SO3_MATERIAL] I",
02935 "fun [SO3_MATERIAL] S",
02936 "fun [SO3_MATERIAL I] I",
02937 "fun [SO3_MATERIAL I I I] I",
02938 "fun [SO3_MATERIAL I] I",
02939 "fun [SO3_MATERIAL I I I] I",
02940 "fun [SO3_MATERIAL] I",
02941 "fun [SO3_MATERIAL I] I",
02942 "fun [SO3_MATERIAL I I I] I",
02943 "fun [SO3_MATERIAL I] I",
02944 "fun [SO3_MATERIAL I I I] I",
02945 "fun [SO3_MATERIAL F] I",
02946 "fun [SO3_MATERIAL F I I] I",
02947 "fun [SO3_MATERIAL I I] I",
02948 "fun [SO3_MATERIAL I I] I",
02949 "fun [SO3_MATERIAL I I] I",
02950 "fun [SO3_MATERIAL I I] F",
02951 "fun [SO3_MATERIAL I I] I",
02952 "fun [SO3_MATERIAL I] I",
02953 "fun [SO3_MATERIAL] I",
02954 "fun [SO3_MATERIAL I] I",
02955 "fun [SO3_MATERIAL I I] I",
02956 "fun [SO3_MATERIAL I] S",
02957 "fun [SO3_MATERIAL S] I",
02958 "fun [SO3_MATERIAL I I] S",
02959 "fun [SO3_MATERIAL I S] I",
02960 "fun [SO3_MATERIAL I I I] S",
02961 "fun [SO3_MATERIAL I I S] I",
02962 "fun [SO3_MATERIAL I] I",
02963 "fun [SO3_MATERIAL SO3_TEXTURE I I I] I",
02964 "fun [SO3_MATERIAL I I I] SO3_TEXTURE",
02965 "fun [SO3_SCENE S P S I I] SO3_TEXTURE",
02966 "fun [SO3_TEXTURE] I",
02967 "fun [SO3_TEXTURE] S",
02968 "fun [SO3_SCENE] I",
02969 "fun [SO3_TEXTURE ObjBitmap] I",
02970 "fun [SO3_TEXTURE AlphaBitmap] I",
02971 "fun [SO3_MATERIAL I I I F] I",
02972 "fun [SO3_MATERIAL I I I] F",
02973 "fun [SO3_MATERIAL I I I F] I",
02974 "fun [SO3_MATERIAL I I I] F",
02975 "fun [SO3_MATERIAL I I I F] I",
02976 "fun [SO3_MATERIAL I I I] F",
02977 "fun [SO3_MATERIAL I I I F] I",
02978 "fun [SO3_MATERIAL I I I] F",
02979 "fun [SO3_MATERIAL I I I F] I",
02980 "fun [SO3_MATERIAL I I I] F",
02981 "fun [SO3_MATERIAL I I I F] I",
02982 "fun [SO3_MATERIAL I I I F F] I"
02983 };
02984
02985
02991 int SCOLloadMaterial(mmachine m,cbmachine w)
02992 {
02993 return PKhardpak(m, "Material", NBMATERIALPKG, MATERIALname, MATERIALFunc, MATERIALnarg, MATERIALType);
02994 }
02995
02996
03001 int SCOLfreeMaterial()
03002 {
03003 return 0;
03004 }
03005