SO3Engine
SCOLMaterial.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25
34#include "SCOLPack/SO3SCOL.h"
35
36// Material includes
39#include "SO3Material/SO3Pass.h"
42
43// Renderer includes
44#include "SO3Renderer/SO3Root.h"
45
46// Scene Graph includes
48
49// Utils includes
51
52// Utils includes
54
55#include <boost/filesystem/operations.hpp>
56
67int SO3MaterialCreate(mmachine m)
68{
69#ifdef SO3_DEBUG
70 MMechostr(MSKDEBUG, "SO3MaterialCreate\n");
71#endif
72
73 int group = MMpull(m);
74 int name = MMpull(m);
75 int s = MMget(m, 0);
76
77 if ((s == NIL) || (name == NIL))
78 {
79 MMset(m, 0, NIL);
80 return 0;
81 }
82
83 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
84 if (scene == 0)
85 {
86 MMset(m, 0, NIL);
87 return 0;
88 }
89
90 std::string groupResource(Ogre::RGN_DEFAULT);
91 if (group != NIL)
92 groupResource = MMstartstr(m, MTOP(group));
93
94 if (groupResource.substr(0, 4) != "SO3/")
95 groupResource = scene->GetName() + groupResource;
96
97 std::string matName(MMstartstr(m, MTOP(name)));
98
99 SMaterial* material = 0;
100 try
101 {
102 material = scene->CreateMaterial(groupResource, matName);
103 if (material == 0)
104 {
105 Ogre::LogManager::getSingleton().logMessage("Can't Create Material! ", Ogre::LML_CRITICAL, true);
106 MMset(m, 0, NIL);
107 return 0;
108 }
109 }
110 catch (SException&)
111 {
112 Ogre::LogManager::getSingleton().logMessage("Can't Create Material! ", Ogre::LML_CRITICAL, true);
113 MMset(m, 0, NIL);
114 return 0;
115 }
116
117 // remove last param before create
118 MMpull(m);
119 int pmat = createMaterial(m, material, scene);
120
121 return 0;
122}
123
132int SO3MaterialDestroy(mmachine m)
133{
134#ifdef SO3_DEBUG
135 MMechostr(MSKDEBUG, "SO3MaterialDestroy\n");
136#endif
137
138 int mt = MMget(m, 0);
139 if (mt == NIL)
140 {
141 MMset(m, 0, NIL);
142 return 0;
143 }
144
145 OBJdelTM(m, SO3MATERIAL, mt);
146
147 return 0;
148}
149
158int SO3MaterialGetName(mmachine m)
159{
160#ifdef SO3_DEBUG
161 MMechostr(MSKDEBUG, "SO3MaterialGetName\n");
162#endif
163
164 int mt = MMpull(m);
165 if (mt == NIL)
166 {
167 return MMpush(m, NIL);
168 }
169
170 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mt));
171 if (material == 0)
172 {
173 return MMpush(m, NIL);
174 }
175
176 return Mpushstrbloc(m, (char*)material->GetName().c_str());
177}
178
189{
190#ifdef SO3_DEBUG
191 MMechostr(MSKDEBUG, "SO3MaterialSetAmbient\n");
192#endif
193
194 int color = MMpull(m);
195 int mat = MMget(m, 0);
196 if (mat == NIL)
197 {
198 MMset(m, 0, NIL);
199 return 0;
200 }
201
202 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
203 if (material == 0)
204 {
205 MMset(m, 0, NIL);
206 return 0;
207 }
208
209 if (color == NIL)
210 color = 0;
211 else
212 color = MTOI(color);
213
214 material->SetAmbientColor(color);
215
216 MMset(m, 0, ITOM(1));
217 return 0;
218}
219
232{
233#ifdef SO3_DEBUG
234 MMechostr(MSKDEBUG, "SO3MaterialSetAmbientByTechAndPass\n");
235#endif
236
237 int color = MMpull(m);
238 int pass = MMpull(m);
239 int tec = MMpull(m);
240 int mat = MMget(m, 0);
241
242 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
243 {
244 MMset(m, 0, NIL);
245 return 0;
246 }
247
248 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
249 if (material == 0)
250 {
251 MMset(m, 0, NIL);
252 return 0;
253 }
254
255 //$BB avoid crash with bad values
256 if (tec != NIL && tec >= 0)
257 tec = (unsigned int)MTOI(tec);
258 else
259 tec = 0;
260
261 if (pass != NIL && pass >= 0)
262 pass = (unsigned int)MTOI(pass);
263 else
264 pass = 0;
265
266 if (color == NIL)
267 color = 0;
268 else
269 color = MTOI(color);
270
271 try
272 {
273 STechnique* matTechnique = material->GetTechnique(tec);
274 if (matTechnique)
275 {
276 SPass* matPass = matTechnique->GetPass(pass);
277 if (matPass)
278 {
279 matPass->SetAmbientColor(color);
280 MMset(m, 0, ITOM(1));
281 return 0;
282 }
283 }
284 }
285 catch (Ogre::Exception)
286 {
287 MMechostr(MSKDEBUG, "SO3MaterialSetAmbientByTechAndPass technique or pass error\n");
288 MMset(m, 0, NIL);
289 }
290
291 MMset(m, 0, NIL);
292 return 0;
293}
294
305{
306#ifdef SO3_DEBUG
307 MMechostr(MSKDEBUG, "SO3MaterialSetDiffuse\n");
308#endif
309
310 int color = MMpull(m);
311 int mat = MMget(m, 0);
312 if (mat == NIL)
313 {
314 MMset(m, 0, NIL);
315 return 0;
316 }
317
318 SMaterial * material = MMgetPointer<SMaterial*>(m, MTOP(mat));
319 if (material == 0)
320 {
321 MMechostr(MSKDEBUG, "material==NULL\n");
322 MMset(m, 0, NIL);
323 return 0;
324 }
325
326 if (color == NIL)
327 color = 0;
328 else
329 color = MTOI(color);
330
331 material->SetDiffuseColor(color);
332 MMset(m, 0, ITOM(1));
333 return 0;
334}
335
348{
349#ifdef SO3_DEBUG
350 MMechostr(MSKDEBUG, "SO3MaterialSetDiffuseByTechAndPass\n");
351#endif
352
353 int color = MMpull(m);
354 int pass = MMpull(m);
355 int tec = MMpull(m);
356 int mat = MMget(m, 0);
357
358 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
359 {
360 MMset(m, 0, NIL);
361 return 0;
362 }
363
364 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
365 if (material == 0)
366 {
367 MMset(m, 0, NIL);
368 return 0;
369 }
370
371 //$BB avoid crash with bad values
372 if (tec != NIL && tec >= 0)
373 tec = (unsigned int)MTOI(tec);
374 else
375 tec = 0;
376
377 if (pass != NIL && pass >= 0)
378 pass = (unsigned int)MTOI(pass);
379 else
380 pass = 0;
381
382 if (color == NIL)
383 color = 0;
384 else
385 color = MTOI(color);
386
387 try
388 {
389 STechnique* matTechnique = material->GetTechnique(tec);
390 if (matTechnique)
391 {
392 SPass* matPass = matTechnique->GetPass(pass);
393 if (matPass)
394 {
395 matPass->SetDiffuseColor(color);
396 MMset(m, 0, ITOM(1));
397 return 0;
398 }
399 }
400 }
401 catch (Ogre::Exception)
402 {
403 MMechostr(MSKDEBUG, "SO3MaterialSetDiffuseByTechAndPass technique or pass error\n");
404 }
405 MMset(m, 0, NIL);
406 return 0;
407}
408
418{
419#ifdef SO3_DEBUG
420 MMechostr(MSKDEBUG, "SO3MaterialGetReceiveShadows\n");
421#endif
422
423 int mat = MMget(m, 0);
424 if (mat == NIL)
425 {
426 MMset(m, 0, NIL);
427 return 0;
428 }
429
430 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
431 if (material == 0)
432 {
433 MMechostr(MSKDEBUG, "material==NULL\n");
434 MMset(m, 0, NIL);
435 return 0;
436 }
437
438 int result = 0;
439 if (material->GetReceiveShadows())
440 result = 1;
441 MMset(m, 0, ITOM(result));
442
443 return 0;
444}
445
456{
457#ifdef SO3_DEBUG
458 MMechostr(MSKDEBUG, "SO3MaterialSetSelfIllumination\n");
459#endif
460
461 int color = MMpull(m);
462 int mat = MMget(m, 0);
463 if (mat == NIL)
464 {
465 MMset(m, 0, NIL);
466 return 0;
467 }
468
469 SMaterial * material = MMgetPointer<SMaterial*>(m, MTOP(mat));
470 if (material == 0)
471 {
472 MMechostr(MSKDEBUG, "material==NULL\n");
473 MMset(m, 0, NIL);
474 return 0;
475 }
476
477 if (color == NIL)
478 color = 0;
479 else
480 color = MTOI(color);
481
482 material->SetSelfIlluminationColor(color);
483
484 MMset(m, 0, ITOM(1));
485 return 0;
486
487}
488
501{
502#ifdef SO3_DEBUG
503 MMechostr(MSKDEBUG, "SO3MaterialSetSelfIlluminationByTechAndPass\n");
504#endif
505
506 int color = MMpull(m);
507 int pass = MMpull(m);
508 int tec = MMpull(m);
509 int mat = MMget(m, 0);
510 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
511 {
512 MMset(m, 0, NIL);
513 return 0;
514 }
515
516 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
517 if (material == 0)
518 {
519 MMset(m, 0, NIL);
520 return 0;
521 }
522
523 //$BB avoid crash with bad values
524 if (tec != NIL && tec >= 0)
525 tec = (unsigned int)MTOI(tec);
526 else
527 tec = 0;
528
529 if (pass != NIL && pass >= 0)
530 pass = (unsigned int)MTOI(pass);
531 else
532 pass = 0;
533
534 if (color == NIL)
535 color = 0;
536 else
537 color = MTOI(color);
538
539 try
540 {
541 STechnique* matTechnique = material->GetTechnique(tec);
542 if (matTechnique)
543 {
544 SPass* matPass = matTechnique->GetPass(pass);
545 if (matPass)
546 {
547 matPass->SetSelfIlluminationColor(color);
548 MMset(m, 0, ITOM(1));
549 return 0;
550 }
551 }
552 }
553 catch (Ogre::Exception)
554 {
555 MMechostr(MSKDEBUG, "SO3MaterialSetSelfIlluminationByTechAndPass technique or pass error\n");
556 }
557 MMset(m, 0, NIL);
558 return 0;
559}
560
571{
572#ifdef SO3_DEBUG
573 MMechostr(MSKDEBUG, "SO3MaterialSetSpecular\n");
574#endif
575
576 int color = MMpull(m);
577 int mat = MMget(m, 0);
578 if (mat == NIL)
579 {
580 MMset(m, 0, NIL);
581 return 0;
582 }
583
584 SMaterial * material = MMgetPointer<SMaterial*>(m, MTOP(mat));
585 if (material == 0)
586 {
587 MMechostr(MSKDEBUG, "material==NULL\n");
588 MMset(m, 0, NIL);
589 return 0;
590 }
591
592 if (color == NIL)
593 color = 0;
594 else
595 color = MTOI(color);
596
597 material->SetSpecularColor(color);
598
599 MMset(m, 0, ITOM(1));
600 return 0;
601}
602
615{
616#ifdef SO3_DEBUG
617 MMechostr(MSKDEBUG, "SO3MaterialSetSpecularByTechAndPass\n");
618#endif
619
620 int color = MMpull(m);
621 int pass = MMpull(m);
622 int tec = MMpull(m);
623 int mat = MMget(m, 0);
624
625 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
626 {
627 MMset(m, 0, NIL);
628 return 0;
629 }
630
631 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
632 if (material == 0)
633 {
634 MMset(m, 0, NIL);
635 return 0;
636 }
637
638 //$BB avoid crash with bad values
639 if (tec != NIL && tec >= 0)
640 tec = (unsigned int)MTOI(tec);
641 else
642 tec = 0;
643
644 if (pass != NIL && pass >= 0)
645 pass = (unsigned int)MTOI(pass);
646 else
647 pass = 0;
648
649 if (color == NIL)
650 color = 0;
651 else
652 color = MTOI(color);
653
654 try
655 {
656 STechnique* matTechnique = material->GetTechnique(tec);
657 if (matTechnique)
658 {
659 SPass* matPass = matTechnique->GetPass(pass);
660 if (matPass)
661 {
662 matPass->SetSpecularColor(color);
663 MMset(m, 0, ITOM(1));
664 return 0;
665 }
666 }
667 }
668 catch (Ogre::Exception)
669 {
670 MMechostr(MSKDEBUG, "SO3MaterialSetSpecularByTechAndPass technique or pass error\n");
671 }
672 MMset(m, 0, NIL);
673 return 0;
674}
675
686{
687#ifdef SO3_DEBUG
688 MMechostr(MSKDEBUG, "SO3MaterialSetShininess\n");
689#endif
690
691 int shin = MMpull(m);
692 int mat = MMget(m, 0);
693 if ((shin == NIL) || (mat == NIL))
694 {
695 MMset(m, 0, NIL);
696 return 0;
697 }
698
699 SMaterial * material = MMgetPointer<SMaterial*>(m, MTOP(mat));
700 if (material == 0)
701 {
702 MMechostr(MSKDEBUG, "material==NULL\n");
703 MMset(m, 0, NIL);
704 return 0;
705 }
706
707 material->SetShininess(MTOF(shin));
708
709 MMset(m, 0, ITOM(1));
710 return 0;
711}
712
725{
726#ifdef SO3_DEBUG
727 MMechostr(MSKDEBUG, "SO3MaterialSetShininessByTechAndPass\n");
728#endif
729
730 int shin = MMpull(m);
731 int pass = MMpull(m);
732 int tec = MMpull(m);
733 int mat = MMget(m, 0);
734 if ((shin == NIL) || (mat == NIL) || (tec == NIL) || (pass == NIL))
735 {
736 MMset(m, 0, NIL);
737 return 0;
738 }
739
740 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
741 if (material == 0)
742 {
743 MMset(m, 0, NIL);
744 return 0;
745 }
746
747 //$BB avoid crash with bad values
748 if (tec != NIL && tec >= 0)
749 tec = (unsigned int)MTOI(tec);
750 else
751 tec = 0;
752
753 if (pass != NIL && pass >= 0)
754 pass = (unsigned int)MTOI(pass);
755 else
756 pass = 0;
757
758 try
759 {
760 STechnique* matTechnique = material->GetTechnique(tec);
761 if (matTechnique)
762 {
763 SPass* matPass = matTechnique->GetPass(pass);
764 if (matPass)
765 {
766 matPass->SetShininess(MTOF(shin));
767 MMset(m, 0, ITOM(1));
768 return 0;
769 }
770 }
771 }
772 catch (Ogre::Exception)
773 {
774 MMechostr(MSKDEBUG, "SO3MaterialSetShininessByTechAndPass technique or pass error\n");
775 }
776 MMset(m, 0, NIL);
777 return 0;
778}
779
791{
792#ifdef SO3_DEBUG
793 MMechostr(MSKDEBUG, "SO3MaterialGetDiffuseByTechAndPass\n");
794#endif
795
796 int pass = MMpull(m);
797 int tec = MMpull(m);
798 int mat = MMget(m, 0);
799
800 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
801 {
802 MMset(m, 0, NIL);
803 return 0;
804 }
805
806 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
807 if (material == 0)
808 {
809 MMechostr(MSKDEBUG, "material==NULL\n");
810 MMset(m, 0, NIL);
811 return 0;
812 }
813
814 //$BB avoid crash with bad values
815 if (tec != NIL && tec >= 0)
816 tec = (unsigned int)MTOI(tec);
817 else
818 tec = 0;
819
820 if (pass != NIL && pass >= 0)
821 pass = (unsigned int)MTOI(pass);
822 else
823 pass = 0;
824
825 try
826 {
827 STechnique* matTechnique = material->GetTechnique(tec);
828 if (matTechnique)
829 {
830 SPass* matPass = matTechnique->GetPass(pass);
831 if (matPass)
832 {
833 MMset(m, 0, ITOM(matPass->GetDiffuseColor()));
834 return 0;
835 }
836 }
837 }
838 catch (Ogre::Exception)
839 {
840 MMechostr(MSKDEBUG, "SO3MaterialGetDiffuseByTechAndPass technique or pass error\n");
841 }
842 MMset(m, 0, NIL);
843 return 0;
844}
845
857{
858#ifdef SO3_DEBUG
859 MMechostr(MSKDEBUG, "SO3MaterialGetAmbientByTechAndPass\n");
860#endif
861
862 int pass = MMpull(m);
863 int tec = MMpull(m);
864 int mat = MMget(m, 0);
865
866 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
867 {
868 MMset(m, 0, NIL);
869 return 0;
870 }
871
872 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
873 if (material == 0)
874 {
875 MMechostr(MSKDEBUG, "material==NULL\n");
876 MMset(m, 0, NIL);
877 return 0;
878 }
879
880 //$BB avoid crash with bad values
881 if (tec != NIL && tec >= 0)
882 tec = (unsigned int)MTOI(tec);
883 else
884 tec = 0;
885
886 if (pass != NIL && pass >= 0)
887 pass = (unsigned int)MTOI(pass);
888 else
889 pass = 0;
890
891 try
892 {
893 STechnique* matTechnique = material->GetTechnique(tec);
894 if (matTechnique)
895 {
896 SPass* matPass = matTechnique->GetPass(pass);
897 if (matPass)
898 {
899 MMset(m, 0, ITOM(matPass->GetAmbientColor()));
900 return 0;
901 }
902 }
903 }
904 catch (Ogre::Exception)
905 {
906 MMechostr(MSKDEBUG, "SO3MaterialGetAmbientByTechAndPass technique or pass error\n");
907 }
908 MMset(m, 0, NIL);
909 return 0;
910}
911
923{
924#ifdef SO3_DEBUG
925 MMechostr(MSKDEBUG, "SO3MaterialGetSpecularByTechAndPass\n");
926#endif
927
928 int pass = MMpull(m);
929 int tec = MMpull(m);
930 int mat = MMget(m, 0);
931
932 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
933 {
934 MMset(m, 0, NIL);
935 return 0;
936 }
937
938 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
939 if (material == 0)
940 {
941 MMechostr(MSKDEBUG, "material==NULL\n");
942 MMset(m, 0, NIL);
943 return 0;
944 }
945
946 //$BB avoid crash with bad values
947 if (tec != NIL && tec >= 0)
948 tec = (unsigned int)MTOI(tec);
949 else
950 tec = 0;
951
952 if (pass != NIL && pass >= 0)
953 pass = (unsigned int)MTOI(pass);
954 else
955 pass = 0;
956
957 try
958 {
959 STechnique* matTechnique = material->GetTechnique(tec);
960 if (matTechnique)
961 {
962 SPass* matPass = matTechnique->GetPass(pass);
963 if (matPass)
964 {
965 MMset(m, 0, ITOM(matPass->GetSpecularColor()));
966 return 0;
967 }
968 }
969 }
970 catch (Ogre::Exception)
971 {
972 MMechostr(MSKDEBUG, "SO3MaterialGetSpecularByTechAndPass technique or pass error\n");
973 }
974 MMset(m, 0, NIL);
975 return 0;
976}
977
989{
990#ifdef SO3_DEBUG
991 MMechostr(MSKDEBUG, "SO3MaterialGetShininessByTechAndPass\n");
992#endif
993
994 int pass = MMpull(m);
995 int tec = MMpull(m);
996 int mat = MMget(m, 0);
997 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
998 {
999 MMset(m, 0, NIL);
1000 return 0;
1001 }
1002
1003 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1004 if (material == 0)
1005 {
1006 MMechostr(MSKDEBUG, "material==NULL\n");
1007 MMset(m, 0, NIL);
1008 return 0;
1009 }
1010
1011 //$BB avoid crash with bad values
1012 if (tec != NIL && tec >= 0)
1013 tec = (unsigned int)MTOI(tec);
1014 else
1015 tec = 0;
1016
1017 if (pass != NIL && pass >= 0)
1018 pass = (unsigned int)MTOI(pass);
1019 else
1020 pass = 0;
1021
1022 try
1023 {
1024 STechnique* matTechnique = material->GetTechnique(tec);
1025 if (matTechnique)
1026 {
1027 SPass* matPass = matTechnique->GetPass(pass);
1028 if (matPass)
1029 {
1030 MMset(m, 0, FTOM(matPass->GetShininess()));
1031 return 0;
1032 }
1033 }
1034 }
1035 catch (Ogre::Exception)
1036 {
1037 MMechostr(MSKDEBUG, "SO3MaterialGetShininessByTechAndPass technique or pass error\n");
1038 }
1039 MMset(m, 0, NIL);
1040 return 0;
1041}
1042
1054{
1055#ifdef SO3_DEBUG
1056 MMechostr(MSKDEBUG, "SO3MaterialGetSelfIlluminationByTechAndPass\n");
1057#endif
1058
1059 int pass = MMpull(m);
1060 int tec = MMpull(m);
1061 int mat = MMget(m, 0);
1062
1063 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
1064 {
1065 MMset(m, 0, NIL);
1066 return 0;
1067 }
1068
1069 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1070 if (material == 0)
1071 {
1072 MMechostr(MSKDEBUG, "material==NULL\n");
1073 MMset(m, 0, NIL);
1074 return 0;
1075 }
1076
1077 //$BB avoid crash with bad values
1078 if (tec != NIL && tec >= 0)
1079 tec = (unsigned int)MTOI(tec);
1080 else
1081 tec = 0;
1082
1083 if (pass != NIL && pass >= 0)
1084 pass = (unsigned int)MTOI(pass);
1085 else
1086 pass = 0;
1087
1088 try
1089 {
1090 STechnique* matTechnique = material->GetTechnique(tec);
1091 if (matTechnique)
1092 {
1093 SPass* matPass = matTechnique->GetPass(pass);
1094 if (matPass)
1095 {
1096 MMset(m, 0, ITOM(matPass->GetSelfIlluminationColor()));
1097 return 0;
1098 }
1099 }
1100 }
1101 catch (Ogre::Exception)
1102 {
1103 MMechostr(MSKDEBUG, "SO3MaterialGetSelfIlluminationByTechAndPass technique or pass error\n");
1104 }
1105 MMset(m, 0, NIL);
1106 return 0;
1107}
1108
1119{
1120#ifdef SO3_DEBUG
1121 MMechostr(MSKDEBUG, "SO3MaterialIsLighting\n");
1122#endif
1123
1124 int state = MMpull(m);
1125 int mat = MMget(m, 0);
1126 if ((mat == NIL) || (state == NIL))
1127 {
1128 MMset(m, 0, NIL);
1129 return 0;
1130 }
1131
1132 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1133 if (material == 0)
1134 {
1135 MMechostr(MSKDEBUG, "material==NULL\n");
1136 MMset(m, 0, NIL);
1137 return 0;
1138 }
1139
1140 state = MTOI(state);
1141 if (state == SO3_TRUE)
1142 material->SetLightingEnabled(true);
1143 else
1144 material->SetLightingEnabled(false);
1145
1146 MMset(m, 0, ITOM(1));
1147 return 0;
1148}
1149
1159{
1160#ifdef SO3_DEBUG
1161 MMechostr(MSKDEBUG, "SO3MaterialNumberOfTechniques\n");
1162#endif
1163
1164 int mat = MMget(m, 0);
1165 if (mat == NIL)
1166 {
1167 MMset(m, 0, NIL);
1168 return 0;
1169 }
1170
1171 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1172 if (material == 0)
1173 {
1174 MMechostr(MSKDEBUG, "material==NULL\n");
1175 MMset(m, 0, NIL);
1176 return 0;
1177 }
1178
1179 int val = 0;
1180 //remove SO3 generated techniques
1181 int nb = material->GetNumTechniques();
1182 for (int i = 0; i < nb; i++)
1183 {
1184 if (material->GetTechnique(i))
1185 val++;
1186 }
1187
1188 MMset(m, 0, ITOM(val));
1189 return 0;
1190}
1191
1202{
1203#ifdef SO3_DEBUG
1204 MMechostr(MSKDEBUG, "SO3MaterialNumberOfPassesByTechnique\n");
1205#endif
1206
1207 int tec = MMpull(m);
1208 int mat = MMget(m, 0);
1209 if ((mat == NIL) || (tec == NIL))
1210 {
1211 MMset(m, 0, NIL);
1212 return 0;
1213 }
1214
1215 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1216 if (material == 0)
1217 {
1218 MMechostr(MSKDEBUG, "material==NULL\n");
1219 MMset(m, 0, NIL);
1220 return 0;
1221 }
1222
1223 //$BB avoid crash with bad values
1224 if (tec != NIL && tec >= 0)
1225 tec = (unsigned int)MTOI(tec);
1226 else
1227 tec = 0;
1228
1229 try
1230 {
1231 STechnique* matTechnique = material->GetTechnique(tec);
1232 if (matTechnique)
1233 {
1234 int val = 0;
1235 //remove SO3 generated techniques
1236 int nb = matTechnique->GetNumPasses();
1237 for (int i = 0; i < nb; i++)
1238 {
1239 if (matTechnique->GetPass(i))
1240 val++;
1241 }
1242
1243 MMset(m, 0, ITOM(val));
1244 return 0;
1245 }
1246 }
1247 catch (Ogre::Exception)
1248 {
1249 MMechostr(MSKDEBUG, "SO3MaterialNumberOfPassesByTechnique technique or pass error\n");
1250 }
1251
1252 MMset(m, 0, ITOM(0));
1253 return 0;
1254}
1255
1267{
1268#ifdef SO3_DEBUG
1269 MMechostr(MSKDEBUG, "SO3MaterialNumberOfTexturesByTechniqueAndPass\n");
1270#endif
1271
1272 int pass = MMpull(m);
1273 int tec = MMpull(m);
1274 int mat = MMget(m, 0);
1275 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
1276 {
1277 MMset(m, 0, NIL);
1278 return 0;
1279 }
1280
1281 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1282 if (material == 0)
1283 {
1284 MMechostr(MSKDEBUG, "SO3MaterialNumberOfTexturesByTechniqueAndPass material==NULL\n");
1285 MMset(m, 0, NIL);
1286 return 0;
1287 }
1288
1289 //$BB avoid crash with bad values
1290 if (tec != NIL && tec >= 0)
1291 tec = (unsigned int)MTOI(tec);
1292 else
1293 tec = 0;
1294
1295 if (pass != NIL && pass >= 0)
1296 pass = (unsigned int)MTOI(pass);
1297 else
1298 pass = 0;
1299
1300 try
1301 {
1302 STechnique* matTechnique = material->GetTechnique(tec);
1303 if (matTechnique)
1304 {
1305 SPass* matPass = matTechnique->GetPass(pass);
1306 if (matPass)
1307 {
1308 MMset(m, 0, ITOM(matPass->GetNumTextureUnitStates()));
1309 return 0;
1310 }
1311 }
1312 }
1313 catch (Ogre::Exception)
1314 {
1315 MMechostr(MSKDEBUG, "SO3MaterialNumberOfTexturesByTechniqueAndPass technique or pass error\n");
1316 }
1317
1318 MMset(m, 0, ITOM(0));
1319 return 0;
1320}
1321
1332{
1333#ifdef SO3_DEBUG
1334 MMechostr(MSKDEBUG, "SO3MaterialTechniqueGetNameByIndex\n");
1335#endif
1336
1337 int tec = MMpull(m);
1338 int mat = MMpull(m);
1339 if ((mat == NIL) || (tec == NIL))
1340 {
1341 MMpush(m, NIL);
1342 return 0;
1343 }
1344
1345 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1346 if (material == 0)
1347 {
1348 MMechostr(MSKDEBUG, "material==NULL\n");
1349 MMpush(m, NIL);
1350 return 0;
1351 }
1352
1353 //$BB avoid crash with bad values
1354 if (tec != NIL && tec >= 0)
1355 tec = (unsigned int)MTOI(tec);
1356 else
1357 tec = 0;
1358
1359 try
1360 {
1361 STechnique* matTechnique = material->GetTechnique(tec);
1362 if (matTechnique)
1363 {
1364 Mpushstrbloc(m, (char*)(matTechnique->GetName().c_str()));
1365 return 0;
1366 }
1367 }
1368 catch (Ogre::Exception)
1369 {
1370 MMechostr(MSKDEBUG, "SO3MaterialTechniqueGetNameByIndex technique or pass error\n");
1371 }
1372
1373 MMpush(m, NIL);
1374 return 0;
1375}
1376
1387{
1388#ifdef SO3_DEBUG
1389 MMechostr(MSKDEBUG, "SO3MaterialTechniqueGetIndexByName\n");
1390#endif
1391
1392 int nam = MMpull(m);
1393 int mat = MMget(m, 0);
1394 if ((mat == NIL) || (nam == NIL))
1395 {
1396 MMset(m, 0, NIL);
1397 return 0;
1398 }
1399
1400 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1401 if (material == 0)
1402 {
1403 MMechostr(MSKDEBUG, "material==NULL\n");
1404 MMset(m, 0, NIL);
1405 return 0;
1406 }
1407
1408 if (!material->getOgreMaterialPointer())
1409 {
1410 MMechostr(MSKDEBUG, "Ogre Material is NULL\n");
1411 MMset(m, 0, NIL);
1412 return 0;
1413 }
1414
1415 std::string name = MMstartstr(m, MTOP(nam));
1416 int index = material->GetTechniqueIndexByName(name);
1417
1418 MMset(m, 0, ITOM(index));
1419 return 0;
1420}
1421
1433{
1434#ifdef SO3_DEBUG
1435 MMechostr(MSKDEBUG, "SO3MaterialPassGetNameByIndex\n");
1436#endif
1437
1438 int pass = MMpull(m);
1439 int tec = MMpull(m);
1440 int mat = MMpull(m);
1441 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
1442 {
1443 MMpush(m, NIL);
1444 return 0;
1445 }
1446
1447 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1448 if (material == 0)
1449 {
1450 MMechostr(MSKDEBUG, "material==NULL\n");
1451 MMpush(m, NIL);
1452 return 0;
1453 }
1454
1455 //$BB avoid crash with bad values
1456 if (tec != NIL && tec >= 0)
1457 tec = (unsigned int)MTOI(tec);
1458 else
1459 tec = 0;
1460
1461 if (pass != NIL && pass >= 0)
1462 pass = (unsigned int)MTOI(pass);
1463 else
1464 pass = 0;
1465
1466 try
1467 {
1468 STechnique* matTechnique = material->GetTechnique(tec);
1469 if (matTechnique)
1470 {
1471 SPass* matPass = matTechnique->GetPass(pass);
1472 if (matPass)
1473 {
1474 Mpushstrbloc(m, (char*)(matPass->GetName().c_str()));
1475 return 0;
1476 }
1477 }
1478 }
1479 catch (Ogre::Exception)
1480 {
1481 MMechostr(MSKDEBUG, "SO3MaterialPassGetNameByIndex technique or pass error\n");
1482 }
1483
1484 MMpush(m, NIL);
1485 return 0;
1486}
1487
1499{
1500#ifdef SO3_DEBUG
1501 MMechostr(MSKDEBUG, "SO3MaterialPassGetIndexByName\n");
1502#endif
1503
1504 int nam = MMpull(m);
1505 int tec = MMpull(m);
1506 int mat = MMget(m, 0);
1507 if ((mat == NIL) || (nam == NIL) || (tec == NIL))
1508 {
1509 MMset(m, 0, NIL);
1510 return 0;
1511 }
1512
1513 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1514 if (material == 0)
1515 {
1516 MMechostr(MSKDEBUG, "material==NULL\n");
1517 MMset(m, 0, NIL);
1518 return 0;
1519 }
1520
1521 if (!material->getOgreMaterialPointer())
1522 {
1523 MMechostr(MSKDEBUG, "Ogre Material is NULL\n");
1524 MMset(m, 0, NIL);
1525 return 0;
1526 }
1527
1528 //$BB avoid crash with bad values
1529 if (tec != NIL && tec >= 0)
1530 tec = (unsigned int)MTOI(tec);
1531 else
1532 tec = 0;
1533
1534 std::string name = MMstartstr(m, MTOP(nam));
1535
1536 try
1537 {
1538 STechnique* matTechnique = material->GetTechnique(tec);
1539 if (matTechnique)
1540 {
1541 int index = matTechnique->GetPassIndexByName(name);
1542 MMset(m, 0, ITOM(index));
1543 return 0;
1544 }
1545 }
1546 catch (Ogre::Exception)
1547 {
1548 MMechostr(MSKDEBUG, "SO3MaterialPassGetIndexByName technique error\n");
1549 }
1550
1551 MMset(m, 0, NIL);
1552 return 0;
1553}
1554
1567{
1568#ifdef SO3_DEBUG
1569 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetNameByIndex\n");
1570#endif
1571
1572 int index = MMpull(m);
1573 int pass = MMpull(m);
1574 int tec = MMpull(m);
1575 int mat = MMpull(m);
1576 if ((mat == NIL) || (tec == NIL) || (pass == NIL) || (index == NIL))
1577 {
1578 MMpush(m, NIL);
1579 return 0;
1580 }
1581
1582 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1583 if (material == 0)
1584 {
1585 MMechostr(MSKDEBUG, "material==NULL\n");
1586 MMpush(m, NIL);
1587 return 0;
1588 }
1589
1590 //$BB avoid crash with bad values
1591 if (tec != NIL && tec >= 0)
1592 tec = (unsigned int)MTOI(tec);
1593 else
1594 tec = 0;
1595
1596 if (pass != NIL && pass >= 0)
1597 pass = (unsigned int)MTOI(pass);
1598 else
1599 pass = 0;
1600
1601 if (index != NIL && index >= 0)
1602 index = (unsigned int)MTOI(index);
1603 else
1604 index = 0;
1605
1606 try
1607 {
1608 STechnique* matTechnique = material->GetTechnique(tec);
1609 if (matTechnique)
1610 {
1611 SPass* matPass = matTechnique->GetPass(pass);
1612 if (matPass)
1613 {
1614 std::string txName = matPass->GetTextureUnitName(index);
1615 Mpushstrbloc(m, (char*)(txName.c_str()));
1616 return 0;
1617 }
1618 }
1619 }
1620 catch (Ogre::Exception)
1621 {
1622 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetNameByIndex technique or pass error\n");
1623 }
1624
1625 MMpush(m, NIL);
1626 return 0;
1627}
1628
1641{
1642#ifdef SO3_DEBUG
1643 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetIndexByName\n");
1644#endif
1645
1646 int nam = MMpull(m);
1647 int pass = MMpull(m);
1648 int tec = MMpull(m);
1649 int mat = MMget(m, 0);
1650 if ((mat == NIL) || (tec == NIL) || (pass == NIL) || (nam == NIL))
1651 {
1652 MMset(m, 0, NIL);
1653 return 0;
1654 }
1655
1656 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1657 if (material == 0)
1658 {
1659 MMechostr(MSKDEBUG, "material==NULL\n");
1660 MMset(m, 0, NIL);
1661 return 0;
1662 }
1663
1664 if (!material->getOgreMaterialPointer())
1665 {
1666 MMechostr(MSKDEBUG, "Ogre Material is NULL\n");
1667 MMset(m, 0, NIL);
1668 return 0;
1669 }
1670
1671 //$BB avoid crash with bad values
1672 if (tec != NIL && tec >= 0)
1673 tec = (unsigned int)MTOI(tec);
1674 else
1675 tec = 0;
1676
1677 if (pass != NIL && pass >= 0)
1678 pass = (unsigned int)MTOI(pass);
1679 else
1680 pass = 0;
1681
1682 std::string name = MMstartstr(m, MTOP(nam));
1683 try
1684 {
1685 STechnique* matTechnique = material->GetTechnique(tec);
1686 if (matTechnique)
1687 {
1688 SPass* matPass = matTechnique->GetPass(pass);
1689 if (matPass)
1690 {
1691 int index = matPass->GetTextureUnitIndexByName(name);
1692 MMset(m, 0, ITOM(index));
1693 return 0;
1694 }
1695 }
1696 }
1697 catch (Ogre::Exception)
1698 {
1699 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetIndexByName technique or pass error\n");
1700 }
1701
1702 MMset(m, 0, NIL);
1703 return 0;
1704}
1705
1716{
1717#ifdef SO3_DEBUG
1718 MMechostr(MSKDEBUG, "SO3MaterialSetReceiveShadows\n");
1719#endif
1720
1721 int state = MMpull(m);
1722 int mat = MMget(m, 0);
1723 if ((mat == NIL) || (state == NIL))
1724 {
1725 MMset(m, 0, NIL);
1726 return 0;
1727 }
1728
1729 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1730 if (material == 0)
1731 {
1732 MMechostr(MSKDEBUG, "material==NULL\n");
1733 MMset(m, 0, NIL);
1734 return 0;
1735 }
1736
1737 state = MTOI(state);
1738
1739 if (state == SO3_TRUE)
1740 material->SetReceiveShadows(true);
1741 else
1742 material->SetReceiveShadows(false);
1743
1744 MMset(m, 0, ITOM(1));
1745 return 0;
1746}
1747
1761{
1762#ifdef SO3_DEBUG
1763 MMechostr(MSKDEBUG, "SO3MaterialSetTexture\n");
1764#endif
1765
1766 int index = MMpull(m);
1767 int pass = MMpull(m);
1768 int tec = MMpull(m);
1769 int mtx = MMpull(m);
1770 int mat = MMget(m, 0);
1771 if ((mat == NIL) || (tec == NIL) || (pass == NIL))
1772 {
1773 MMset(m, 0, NIL);
1774 return 0;
1775 }
1776
1777 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1778 if (material == 0)
1779 {
1780 MMechostr(MSKDEBUG, "material==NULL\n");
1781 MMset(m, 0, NIL);
1782 return 0;
1783 }
1784
1785 STexture* texture = 0;
1786 if (mtx != NIL)
1787 {
1788 texture = MMgetPointer<STexture*>(m, MTOP(mtx));
1789 if (texture == 0)
1790 {
1791 MMechostr(MSKDEBUG, "texture==NULL\n");
1792 MMset(m, 0, NIL);
1793 return 0;
1794 }
1795 }
1796
1797 //$BB avoid crash with bad values
1798 if (tec != NIL && tec >= 0)
1799 tec = (unsigned int)MTOI(tec);
1800 else
1801 tec = 0;
1802
1803 if (pass != NIL && pass >= 0)
1804 pass = (unsigned int)MTOI(pass);
1805 else
1806 pass = 0;
1807
1808 if (index != NIL && index >= 0)
1809 index = (unsigned int)MTOI(index);
1810 else
1811 index = 0;
1812
1813 try
1814 {
1815 STechnique* matTechnique = material->GetTechnique(tec);
1816 if (matTechnique)
1817 {
1818 SPass* matPass = matTechnique->GetPass(pass);
1819 if (matPass)
1820 {
1821 matPass->SetTexture(index, texture);
1822 MMset(m, 0, ITOM(1));
1823 return 0;
1824 }
1825 }
1826 }
1827 catch (Ogre::Exception)
1828 {
1829 MMechostr(MSKDEBUG, "SO3MaterialSetTexture technique or pass error\n");
1830 }
1831
1832 MMset(m, 0, NIL);
1833 return 0;
1834}
1835
1848{
1849#ifdef SO3_DEBUG
1850 MMechostr(MSKDEBUG, "SO3MaterialGetTexture\n");
1851#endif
1852
1853 int index = MMpull(m);
1854 int pass = MMpull(m);
1855 int tec = MMpull(m);
1856 int mat = MMget(m, 0);
1857 if ((mat == NIL) || (tec == NIL) || (pass == NIL) || (index == NIL))
1858 {
1859 MMset(m, 0, NIL);
1860 return 0;
1861 }
1862
1863 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1864 if (material == 0)
1865 {
1866 MMechostr(MSKDEBUG, "material==NULL\n");
1867 MMset(m, 0, NIL);
1868 return 0;
1869 }
1870
1871 //remove last param
1872 MMpull(m);
1873
1874 //$BB avoid crash with bad values
1875 if (tec != NIL && MTOI(tec) >= 0)
1876 tec = (unsigned int)MTOI(tec);
1877 else
1878 tec = 0;
1879
1880 if (pass != NIL && MTOI(pass) >= 0)
1881 pass = (unsigned int)MTOI(pass);
1882 else
1883 pass = 0;
1884
1885 if (index != NIL && MTOI(index) >= 0)
1886 index = (unsigned int)MTOI(index);
1887 else
1888 index = 0;
1889
1890 SScene* scene = material->GetScene();
1891
1892 try
1893 {
1894 STexture* texture = 0;
1895 STechnique* matTechnique = material->GetTechnique(tec);
1896 if (matTechnique)
1897 {
1898 SPass* matPass = matTechnique->GetPass(pass);
1899 if (matPass)
1900 texture = matPass->GetTexture(index);
1901 }
1902
1903 if (texture != 0)
1904 {
1905 int tx = OBJfindTH(m, SO3TEXTURE, SCOL_PTR(texture));
1906 if (tx != NIL)
1907 {
1908 tx = MMfetch(m, tx, OFFOBJMAG);
1909 MMpush(m, tx);
1910 return 0;
1911 }
1912 else
1913 {
1914 // Create a scol instance of the texture
1915 return createTexture(m, texture, scene);
1916 }
1917 }
1918 }
1919 catch (Ogre::Exception)
1920 {
1921 MMechostr(MSKDEBUG, "SO3MaterialGetTexture technique or pass error\n");
1922 }
1923
1924 MMpush(m, NIL);
1925 return 0;
1926}
1927
1941{
1942#ifdef SO3_DEBUG
1943 MMechostr(MSKDEBUG, "SO3MaterialSetTextureByType\n");
1944#endif
1945
1946 int itype = MMpull(m);
1947 int pass = MMpull(m);
1948 int tec = MMpull(m);
1949 int mtx = MMpull(m);
1950 int mat = MMget(m, 0);
1951 if ((mat == NIL) || (tec == NIL) || (pass == NIL) || (itype == NIL))
1952 {
1953 MMset(m, 0, NIL);
1954 return 0;
1955 }
1956
1957 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
1958 if (material == 0)
1959 {
1960 MMechostr(MSKDEBUG, "material==NULL\n");
1961 MMset(m, 0, NIL);
1962 return 0;
1963 }
1964
1965 STexture* texture = 0;
1966 if (mtx != NIL)
1967 {
1968 texture = MMgetPointer<STexture*>(m, MTOP(mtx));
1969 if (texture == 0)
1970 {
1971 MMechostr(MSKDEBUG, "texture==NULL\n");
1972 MMset(m, 0, NIL);
1973 return 0;
1974 }
1975 }
1976
1977 //$BB avoid crash with bad values
1978 if (tec != NIL && tec >= 0)
1979 tec = (unsigned int)MTOI(tec);
1980 else
1981 tec = 0;
1982
1983 if (pass != NIL && pass >= 0)
1984 pass = (unsigned int)MTOI(pass);
1985 else
1986 pass = 0;
1987
1988 SShaderGenerator::ShaderMapType type = (SShaderGenerator::ShaderMapType)MTOI(itype);
1989 try
1990 {
1991 STechnique* matTechnique = material->GetTechnique(tec);
1992 if (matTechnique)
1993 {
1994 SPass* matPass = matTechnique->GetPass(pass);
1995 if (matPass)
1996 {
1997 matPass->SetTextureByType(texture, type);
1998 MMset(m, 0, ITOM(1));
1999 return 0;
2000 }
2001 }
2002 }
2003 catch (Ogre::Exception)
2004 {
2005 MMechostr(MSKDEBUG, "SO3MaterialSetTextureByType technique or pass error\n");
2006 }
2007
2008 MMset(m, 0, NIL);
2009 return 0;
2010}
2011
2024{
2025#ifdef SO3_DEBUG
2026 MMechostr(MSKDEBUG, "SO3MaterialRemoveTexture\n");
2027#endif
2028
2029 int index = MMpull(m);
2030 int pass = MMpull(m);
2031 int tec = MMpull(m);
2032 int mat = MMget(m, 0);
2033 if ((mat == NIL) || (tec == NIL) || (pass == NIL) || (index == NIL))
2034 {
2035 MMset(m, 0, NIL);
2036 return 0;
2037 }
2038
2039 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2040 if (material == 0)
2041 {
2042 MMechostr(MSKDEBUG, "material==NULL\n");
2043 MMset(m, 0, NIL);
2044 return 0;
2045 }
2046
2047 //remove last param
2048 MMpull(m);
2049
2050 //$BB avoid crash with bad values
2051 if (tec != NIL && MTOI(tec) >= 0)
2052 tec = (unsigned int)MTOI(tec);
2053 else
2054 tec = 0;
2055
2056 if (pass != NIL && MTOI(pass) >= 0)
2057 pass = (unsigned int)MTOI(pass);
2058 else
2059 pass = 0;
2060
2061 if (index != NIL && MTOI(index) >= 0)
2062 index = (unsigned int)MTOI(index);
2063 else
2064 index = 0;
2065
2066 try
2067 {
2068 STechnique* matTechnique = material->GetTechnique(tec);
2069 if (matTechnique)
2070 {
2071 SPass* matPass = matTechnique->GetPass(pass);
2072 if (matPass)
2073 {
2074 matPass->RemoveTexture(index);
2075 MMpush(m, ITOM(1));
2076 return 0;
2077 }
2078 }
2079 }
2080 catch (Ogre::Exception)
2081 {
2082 MMechostr(MSKDEBUG, "SO3MaterialRemoveTexture technique or pass error\n");
2083 }
2084
2085 MMpush(m, NIL);
2086 return 0;
2087}
2088
2101{
2102#ifdef SO3_DEBUG
2103 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetIndexByType\n");
2104#endif
2105
2106 int itype = MMpull(m);
2107 int pass = MMpull(m);
2108 int tec = MMpull(m);
2109 int mat = MMget(m, 0);
2110 if ((mat == NIL) || (tec == NIL) || (pass == NIL) || (itype == NIL))
2111 {
2112 MMset(m, 0, NIL);
2113 return 0;
2114 }
2115
2116 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2117 if (material == 0)
2118 {
2119 MMechostr(MSKDEBUG, "material==NULL\n");
2120 MMset(m, 0, NIL);
2121 return 0;
2122 }
2123
2124 //remove last param
2125 MMpull(m);
2126
2127 //$BB avoid crash with bad values
2128 if (tec != NIL && MTOI(tec) >= 0)
2129 tec = (unsigned int)MTOI(tec);
2130 else
2131 tec = 0;
2132
2133 if (pass != NIL && MTOI(pass) >= 0)
2134 pass = (unsigned int)MTOI(pass);
2135 else
2136 pass = 0;
2137
2138 SShaderGenerator::ShaderMapType type = (SShaderGenerator::ShaderMapType)MTOI(itype);
2139 SScene* scene = material->GetScene();
2140
2141 try
2142 {
2143 STechnique* matTechnique = material->GetTechnique(tec);
2144 if (matTechnique)
2145 {
2146 SPass* matPass = matTechnique->GetPass(pass);
2147 if (matPass)
2148 {
2149 int tindex = matPass->GetTextureUnitByType(type);
2150 if (tindex >= 0)
2151 {
2152 MMpush(m, ITOM(tindex));
2153 return 0;
2154 }
2155 }
2156 }
2157 }
2158 catch (Ogre::Exception)
2159 {
2160 MMechostr(MSKDEBUG, "SO3MaterialTextureUnitGetIndexByType technique or pass error\n");
2161 }
2162
2163 MMpush(m, NIL);
2164 return 0;
2165}
2166
2177int SO3GetSceneTexture(mmachine m)
2178{
2179#ifdef SO3_DEBUG
2180 MMechostr(MSKDEBUG, "SO3GetSceneTexture\n");
2181#endif
2182
2183 int name = MMpull(m);
2184 int group = MMpull(m);
2185
2186 int s = MMget(m, 0);
2187 if ((s == NIL) || (name == NIL))
2188 {
2189 MMset(m, 0, NIL);
2190 return 0;
2191 }
2192
2193 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
2194 if (scene == 0)
2195 {
2196 MMset(m, 0, NIL);
2197 return 0;
2198 }
2199
2200 std::string tmpTextureName = MMstartstr(m, MTOP(name));
2201
2202 std::string groupResource(Ogre::RGN_DEFAULT);
2203 if (group != NIL)
2204 groupResource = MMstartstr(m, MTOP(group));
2205
2206 if (groupResource.substr(0, 4) != "SO3/")
2207 groupResource = scene->GetName() + groupResource;
2208
2209 //remove last param
2210 MMpull(m);
2211
2212 STexture* texture = scene->GetTexture(groupResource, tmpTextureName);
2213 if (texture != 0)
2214 {
2215 int tx = OBJfindTH(m, SO3TEXTURE, SCOL_PTR(texture));
2216 if (tx != NIL)
2217 {
2218 tx = MMfetch(m, tx, OFFOBJMAG);
2219 MMpush(m, tx);
2220 return 0;
2221 }
2222 else
2223 {
2224 // Create a scol instance of the texture
2225 return createTexture(m, texture, scene);
2226 }
2227 }
2228
2229 MMpush(m, NIL);
2230 return 0;
2231}
2232
2246int SO3TextureCreate(mmachine m)
2247{
2248#ifdef SO3_DEBUG
2249 MMechostr(MSKDEBUG, "SO3TextureCreate\n");
2250#endif
2251
2252 int h = MTOI(MMpull(m));
2253 int w = MTOI(MMpull(m));
2254 int group = MMpull(m);
2255 int file = MMpull(m);
2256 int name = MMpull(m);
2257 int s = MMget(m, 0);
2258 if ((s == NIL) || (name == NIL))
2259 {
2260 MMset(m, 0, NIL);
2261 return 0;
2262 }
2263
2264 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
2265 if (scene == 0)
2266 {
2267 MMset(m, 0, NIL);
2268 return 0;
2269 }
2270
2271 std::string tmpTextureName = MMstartstr(m, MTOP(name));
2272
2273 std::string groupResource(Ogre::RGN_DEFAULT);
2274 if (group != NIL)
2275 groupResource = MMstartstr(m, MTOP(group));
2276
2277 if (groupResource.substr(0, 4) != "SO3/")
2278 groupResource = scene->GetName() + groupResource;
2279
2280 //remove last param
2281 MMpull(m);
2282
2283 boost::filesystem::path filePath;
2284 if (file != NIL)
2285 {
2286 filePath = MMstartstr(m, MTOP(file));
2287
2288 Mpushstrbloc(m, filePath.generic_string().c_str());
2289 if ((MMpush(m, Msearchinsyspak(m, "_PtoScol"))) < 0)
2290 {
2291 MMechostr(0, "\nSO3TextureCreate : error interpreting _PtoScol");
2292 MMpull(m);
2293 }
2294
2295 //execute scol cmd
2296 Minterpreter(m);
2297
2298 int ipscol = MMpull(m);
2299 if (ipscol == NIL)
2300 {
2301 //add the file resource path
2302 try
2303 {
2304 if (!Ogre::ResourceGroupManager::getSingleton().resourceExists(groupResource, filePath.generic_string()))
2305 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(filePath.generic_string(), "ScolFileSystem", groupResource);
2306 }
2307 catch (const SO3::SException& e)
2308 {
2309 MMechostr(MSKDEBUG, "An exception has occurred: %s\n", e.GetFullDescription().c_str());
2310 }
2311 }
2312 else // file in scol partition
2313 {
2314 filePath = MMstartstr(m, MTOP(ipscol));
2315 }
2316 }
2317
2318 STexture* texture = 0;
2319
2320 if (filePath.empty() && ((w <= 0) || (h <= 0)))
2321 {
2322 MMpush(m, NIL);
2323 MMechostr(MSKRUNTIME, "SO3TextureCreate : Texture creation failed ! bad texture size\n");
2324 return 0;
2325 }
2326
2327 try
2328 {
2329 texture = scene->CreateTexture(groupResource, tmpTextureName, filePath.generic_string(), w, h);
2330 if (texture == 0 || !texture->getOgreTexturePointer())
2331 {
2332 scene->DeleteTexture(texture);
2333 MMpush(m, NIL);
2334 MMechostr(MSKRUNTIME, "SO3TextureCreate : Texture creation failed ! > %s", tmpTextureName.c_str());
2335 return 0;
2336 }
2337 }
2338 catch (SException&)
2339 {
2340 MMpush(m, NIL);
2341 MMechostr(MSKRUNTIME, "SO3TextureCreate : Texture creation failed ! > %s", tmpTextureName.c_str());
2342 return 0;
2343 }
2344
2345 return createTexture(m, texture, scene);
2346}
2347
2356int SO3TextureDestroy(mmachine m)
2357{
2358#ifdef SO3_DEBUG
2359 MMechostr(MSKDEBUG, "SO3TextureDestroy\n");
2360#endif
2361
2362 int tx = MMget(m, 0);
2363 if (tx == NIL)
2364 {
2365 MMset(m, 0, NIL);
2366 return 0;
2367 }
2368
2369 OBJdelTM(m, SO3TEXTURE, tx);
2370 return 0;
2371}
2372
2381int SO3TextureGetName(mmachine m)
2382{
2383#ifdef SO3_DEBUG
2384 MMechostr(MSKDEBUG, "SO3TextureGetName\n");
2385#endif
2386
2387 int tx = MMpull(m);
2388 if (tx == NIL)
2389 {
2390 MMpush(m, NIL);
2391 return 0;
2392 }
2393
2394 STexture* texture = MMgetPointer<STexture*>(m, MTOP(tx));
2395 if (texture == NULL)
2396 {
2397 MMpush(m, NIL);
2398 return 0;
2399 }
2400
2401 return Mpushstrbloc(m, (char*)texture->GetName().c_str());
2402}
2403
2413{
2414#ifdef SO3_DEBUG
2415 MMechostr(MSKDEBUG, "SO3TextureManagerGetMemoryUsage\n");
2416#endif
2417
2418 int s = MMget(m, 0);
2419 if ((s == NIL))
2420 {
2421 MMset(m, 0, NIL);
2422 return 0;
2423 }
2424
2425 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
2426 if (scene == 0)
2427 {
2428 MMset(m, 0, NIL);
2429 return 0;
2430 }
2431
2432 size_t count = scene->O3TextureManager->getMemoryUsage();
2433 MMset(m, 0, ITOM(count));
2434 return 0;
2435}
2436
2446int SO3TextureBlit(mmachine m)
2447{
2448#ifdef SO3_DEBUG
2449 MMechostr(MSKDEBUG, "SO3TextureBlit\n");
2450#endif
2451
2452 int bitm = MMpull(m);
2453 int tx = MMget(m, 0);
2454 if (tx == NIL)
2455 {
2456 MMechostr(MSKDEBUG, "tex==NIL\n");
2457 MMset(m, 0, NIL);
2458 return 0;
2459 }
2460 if (bitm == NIL)
2461 {
2462 MMechostr(MSKDEBUG, "objBmp==NIL\n");
2463 MMset(m, 0, NIL);
2464 return 0;
2465 }
2466
2467 STexture* texture = MMgetPointer<STexture*>(m, MTOP(tx));
2468 if (texture == 0)
2469 {
2470 MMechostr(MSKDEBUG, "texture==NULL\n");
2471 MMset(m, 0, NIL);
2472 return 0;
2473 }
2474
2475 // Récupère l'ObjBitmap et ses données
2476 PtrObjVoid OB;
2477 PtrObjBitmap B;
2478
2479 OB = (PtrObjVoid)MMstart(m, MTOP(bitm));
2480 if (OB->Type != OBJ_TYPE_BITMAP << 1 || OB->Buffer == 0)
2481 {
2482 MMset(m, 0, NIL);
2483 return 0;
2484 }
2485 B = (PtrObjBitmap)MMstart(m, MTOP(OB->Buffer));
2486
2487 if (B->bits == 0)
2488 {
2489 MMset(m, 0, NIL);
2490 return 0;
2491 }
2492
2493 texture->BlitTexture(B);
2494
2495 MMset(m, 0, ITOM(1));
2496 return 0;
2497}
2498
2508int SO3TextureBlitAlpha(mmachine m)
2509{
2510#ifdef SO3_DEBUG
2511 MMechostr(MSKDEBUG, "SO3TextureBlitAlpha\n");
2512#endif
2513
2514 int alphaBitmap = MMpull(m);
2515 int tx = MMget(m, 0);
2516
2517 if ((tx == NIL))
2518 {
2519 MMechostr(MSKDEBUG, "tex==NIL\n");
2520 MMset(m, 0, NIL);
2521 return 0;
2522 }
2523 if ((alphaBitmap == NIL))
2524 {
2525 MMechostr(MSKDEBUG, "alphaBitmap==NIL\n");
2526 MMset(m, 0, NIL);
2527 return 0;
2528 }
2529
2530 STexture* texture = MMgetPointer<STexture*>(m, MTOP(tx));
2531 if (texture == 0)
2532 {
2533 MMechostr(MSKDEBUG, "texture==NULL\n");
2534 MMset(m, 0, NIL);
2535 return 0;
2536 }
2537
2538 // Récupère l'ObjBitmap et ses données
2539 int colorLayer = MMfetch(m, MTOP(alphaBitmap), 0);
2540 int alphaLayer = MMfetch(m, MTOP(alphaBitmap), 1);
2541
2542 PtrObjVoid OBcolor;
2543 PtrObjBitmap Bcolor;
2544 OBcolor = (PtrObjVoid)MMstart(m, MTOP(colorLayer));
2545 if (OBcolor->Type != OBJ_TYPE_BITMAP << 1 || OBcolor->Buffer == 0)
2546 {
2547 MMset(m, 0, NIL);
2548 return 0;
2549 }
2550 Bcolor = (PtrObjBitmap)MMstart(m, MTOP(OBcolor->Buffer));
2551
2552 if (Bcolor->bits == 0)
2553 {
2554 MMset(m, 0, NIL);
2555 return 0;
2556 }
2557
2558 PtrObjVoid OBalpha;
2559 PtrObjBitmap Balpha;
2560 OBalpha = (PtrObjVoid)MMstart(m, MTOP(alphaLayer));
2561 if (OBalpha->Type != OBJ_TYPE_BITMAP << 1 || OBalpha->Buffer == 0)
2562 {
2563 MMset(m, 0, NIL);
2564 return 0;
2565 }
2566 Balpha = (PtrObjBitmap)MMstart(m, MTOP(OBalpha->Buffer));
2567
2568 if (Balpha->bits == 0)
2569 {
2570 MMset(m, 0, NIL);
2571 return 0;
2572 }
2573
2574 texture->BlitAlphaTexture(Bcolor, Balpha);
2575
2576 MMset(m, 0, ITOM(1));
2577 return 0;
2578}
2579
2593{
2594#ifdef SO3_DEBUG
2595 MMechostr(MSKDEBUG, "SO3MaterialSetTextureUScroll\n");
2596#endif
2597
2598 int scrollValue = MMpull(m);
2599 int textureUnit = MMpull(m);
2600 int pass = MMpull(m);
2601 int technique = MMpull(m);
2602 int mat = MMget(m, 0);
2603
2604 // Checking parameters.
2605 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (scrollValue == NIL))
2606 {
2607 MMset(m, 0, NIL);
2608 return 0;
2609 }
2610
2611 // Get the targeted SMaterial pointer
2612 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2613 if (material == 0)
2614 {
2615 MMset(m, 0, NIL);
2616 return 0;
2617 }
2618
2619 // Get other parameters
2620 technique = MTOI(technique);
2621 pass = MTOI(pass);
2622 textureUnit = MTOI(textureUnit);
2623 float value = MTOF(scrollValue);
2624
2625 try
2626 {
2627 STechnique* matTechnique = material->GetTechnique(technique);
2628 if (matTechnique)
2629 {
2630 SPass* matPass = matTechnique->GetPass(pass);
2631 if (matPass)
2632 {
2633 matPass->SetTextureUScroll(textureUnit, value);
2634 MMset(m, 0, ITOM(1));
2635 return 0;
2636 }
2637 }
2638 }
2639 catch (Ogre::Exception& e)
2640 {
2641 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
2642 }
2643 MMset(m, 0, NIL);
2644 return 0;
2645}
2646
2660{
2661#ifdef SO3_DEBUG
2662 MMechostr(MSKDEBUG, "SO3MaterialGetTextureUScroll\n");
2663#endif
2664
2665 int textureUnit = MMpull(m);
2666 int pass = MMpull(m);
2667 int technique = MMpull(m);
2668 int mat = MMget(m, 0);
2669
2670 // Checking parameters.
2671 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
2672 {
2673 MMset(m, 0, NIL);
2674 return 0;
2675 }
2676
2677 // Get the targeted SMaterial pointer
2678 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2679 if (material == 0)
2680 {
2681 MMset(m, 0, NIL);
2682 return 0;
2683 }
2684
2685 // Get other parameters
2686 technique = MTOI(technique);
2687 pass = MTOI(pass);
2688 textureUnit = MTOI(textureUnit);
2689
2690 try
2691 {
2692 STechnique* matTechnique = material->GetTechnique(technique);
2693 if (matTechnique)
2694 {
2695 SPass* matPass = matTechnique->GetPass(pass);
2696 if (matPass)
2697 {
2698 float value = matPass->GetTextureUScroll(textureUnit);
2699 MMset(m, 0, FTOM(value));
2700 return 0;
2701 }
2702 }
2703 }
2704 catch (Ogre::Exception& e)
2705 {
2706 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
2707 }
2708 MMset(m, 0, NIL);
2709 return 0;
2710}
2711
2725{
2726#ifdef SO3_DEBUG
2727 MMechostr(MSKDEBUG, "SO3MaterialSetTextureVScroll\n");
2728#endif
2729
2730 int scrollValue = MMpull(m);
2731 int textureUnit = MMpull(m);
2732 int pass = MMpull(m);
2733 int technique = MMpull(m);
2734 int mat = MMget(m, 0);
2735
2736 // Checking parameters.
2737 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (scrollValue == NIL))
2738 {
2739 MMset(m, 0, NIL);
2740 return 0;
2741 }
2742
2743 // Get the targeted SMaterial pointer
2744 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2745 if (material == 0)
2746 {
2747 MMset(m, 0, NIL);
2748 return 0;
2749 }
2750
2751 // Get other parameters
2752 technique = MTOI(technique);
2753 pass = MTOI(pass);
2754 textureUnit = MTOI(textureUnit);
2755 float value = MTOF(scrollValue);
2756
2757 try
2758 {
2759 STechnique* matTechnique = material->GetTechnique(technique);
2760 if (matTechnique)
2761 {
2762 SPass* matPass = matTechnique->GetPass(pass);
2763 if (matPass)
2764 {
2765 matPass->SetTextureVScroll(textureUnit, value);
2766 MMset(m, 0, ITOM(1));
2767 return 0;
2768 }
2769 }
2770 }
2771 catch (Ogre::Exception& e)
2772 {
2773 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
2774 }
2775 MMset(m, 0, NIL);
2776 return 0;
2777}
2778
2792{
2793#ifdef SO3_DEBUG
2794 MMechostr(MSKDEBUG, "SO3MaterialGetTextureVScroll\n");
2795#endif
2796
2797 int textureUnit = MMpull(m);
2798 int pass = MMpull(m);
2799 int technique = MMpull(m);
2800 int mat = MMget(m, 0);
2801
2802 // Checking parameters.
2803 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
2804 {
2805 MMset(m, 0, NIL);
2806 return 0;
2807 }
2808
2809 // Get the targeted SMaterial pointer
2810 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2811 if (material == 0)
2812 {
2813 MMset(m, 0, NIL);
2814 return 0;
2815 }
2816
2817 // Get other parameters
2818 technique = MTOI(technique);
2819 pass = MTOI(pass);
2820 textureUnit = MTOI(textureUnit);
2821
2822 try
2823 {
2824 STechnique* matTechnique = material->GetTechnique(technique);
2825 if (matTechnique)
2826 {
2827 SPass* matPass = matTechnique->GetPass(pass);
2828 if (matPass)
2829 {
2830 float value = matPass->GetTextureVScroll(textureUnit);
2831 MMset(m, 0, FTOM(value));
2832 return 0;
2833 }
2834 }
2835 }
2836 catch (Ogre::Exception& e)
2837 {
2838 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
2839 }
2840 MMset(m, 0, NIL);
2841 return 0;
2842}
2843
2857{
2858#ifdef SO3_DEBUG
2859 MMechostr(MSKDEBUG, "SO3MaterialSetTextureUScale\n");
2860#endif
2861
2862 int scaleValue = MMpull(m);
2863 int textureUnit = MMpull(m);
2864 int pass = MMpull(m);
2865 int technique = MMpull(m);
2866 int mat = MMget(m, 0);
2867
2868 // Checking parameters.
2869 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (scaleValue == NIL))
2870 {
2871 MMset(m, 0, NIL);
2872 return 0;
2873 }
2874
2875 // Get the targeted SMaterial pointer
2876 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2877 if (material == 0)
2878 {
2879 MMset(m, 0, NIL);
2880 return 0;
2881 }
2882
2883 // Get other parameters
2884 technique = MTOI(technique);
2885 pass = MTOI(pass);
2886 textureUnit = MTOI(textureUnit);
2887 float value = MTOF(scaleValue);
2888
2889 try
2890 {
2891 STechnique* matTechnique = material->GetTechnique(technique);
2892 if (matTechnique)
2893 {
2894 SPass* matPass = matTechnique->GetPass(pass);
2895 if (matPass)
2896 {
2897 matPass->SetTextureUScale(textureUnit, value);
2898 MMset(m, 0, ITOM(1));
2899 return 0;
2900 }
2901 }
2902 }
2903 catch (Ogre::Exception& e)
2904 {
2905 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
2906 }
2907 MMset(m, 0, NIL);
2908 return 0;
2909}
2910
2924{
2925#ifdef SO3_DEBUG
2926 MMechostr(MSKDEBUG, "SO3MaterialGetTextureUScale\n");
2927#endif
2928
2929 int textureUnit = MMpull(m);
2930 int pass = MMpull(m);
2931 int technique = MMpull(m);
2932 int mat = MMget(m, 0);
2933
2934 // Checking parameters.
2935 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
2936 {
2937 MMset(m, 0, NIL);
2938 return 0;
2939 }
2940
2941 // Get the targeted SMaterial pointer
2942 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
2943 if (material == 0)
2944 {
2945 MMset(m, 0, NIL);
2946 return 0;
2947 }
2948
2949 // Get other parameters
2950 technique = MTOI(technique);
2951 pass = MTOI(pass);
2952 textureUnit = MTOI(textureUnit);
2953
2954 try
2955 {
2956 STechnique* matTechnique = material->GetTechnique(technique);
2957 if (matTechnique)
2958 {
2959 SPass* matPass = matTechnique->GetPass(pass);
2960 if (matPass)
2961 {
2962 float value = matPass->GetTextureUScale(textureUnit);
2963 MMset(m, 0, FTOM(value));
2964 return 0;
2965 }
2966 }
2967 }
2968 catch (Ogre::Exception& e)
2969 {
2970 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
2971 }
2972 MMset(m, 0, NIL);
2973 return 0;
2974}
2975
2989{
2990#ifdef SO3_DEBUG
2991 MMechostr(MSKDEBUG, "SO3MaterialSetTextureVScale\n");
2992#endif
2993
2994 int scaleValue = MMpull(m);
2995 int textureUnit = MMpull(m);
2996 int pass = MMpull(m);
2997 int technique = MMpull(m);
2998 int mat = MMget(m, 0);
2999
3000 // Checking parameters.
3001 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (scaleValue == NIL))
3002 {
3003 MMset(m, 0, NIL);
3004 return 0;
3005 }
3006
3007 // Get the targeted SMaterial pointer
3008 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3009 if (material == 0)
3010 {
3011 MMset(m, 0, NIL);
3012 return 0;
3013 }
3014
3015 // Get other parameters
3016 technique = MTOI(technique);
3017 pass = MTOI(pass);
3018 textureUnit = MTOI(textureUnit);
3019 float value = MTOF(scaleValue);
3020
3021 try
3022 {
3023 STechnique* matTechnique = material->GetTechnique(technique);
3024 if (matTechnique)
3025 {
3026 SPass* matPass = matTechnique->GetPass(pass);
3027 if (matPass)
3028 {
3029 matPass->SetTextureVScale(textureUnit, value);
3030 MMset(m, 0, ITOM(1));
3031 return 0;
3032 }
3033 }
3034 }
3035 catch (Ogre::Exception& e)
3036 {
3037 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3038 }
3039 MMset(m, 0, NIL);
3040 return 0;
3041}
3042
3056{
3057#ifdef SO3_DEBUG
3058 MMechostr(MSKDEBUG, "SO3MaterialGetTextureVScale\n");
3059#endif
3060
3061 int textureUnit = MMpull(m);
3062 int pass = MMpull(m);
3063 int technique = MMpull(m);
3064 int mat = MMget(m, 0);
3065
3066 // Checking parameters.
3067 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
3068 {
3069 MMset(m, 0, NIL);
3070 return 0;
3071 }
3072
3073 // Get the targeted SMaterial pointer
3074 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3075 if (material == 0)
3076 {
3077 MMset(m, 0, NIL);
3078 return 0;
3079 }
3080
3081 // Get other parameters
3082 technique = MTOI(technique);
3083 pass = MTOI(pass);
3084 textureUnit = MTOI(textureUnit);
3085
3086 try
3087 {
3088 STechnique* matTechnique = material->GetTechnique(technique);
3089 if (matTechnique)
3090 {
3091 SPass* matPass = matTechnique->GetPass(pass);
3092 if (matPass)
3093 {
3094 float value = matPass->GetTextureVScale(textureUnit);
3095 MMset(m, 0, FTOM(value));
3096 return 0;
3097 }
3098 }
3099 }
3100 catch (Ogre::Exception& e)
3101 {
3102 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3103 }
3104 MMset(m, 0, NIL);
3105 return 0;
3106}
3107
3121{
3122#ifdef SO3_DEBUG
3123 MMechostr(MSKDEBUG, "SO3MaterialSetTextureRotate\n");
3124#endif
3125
3126 int rotationAngle = MMpull(m);
3127 int textureUnit = MMpull(m);
3128 int pass = MMpull(m);
3129 int technique = MMpull(m);
3130 int mat = MMget(m, 0);
3131
3132 // Checking parameters.
3133 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (rotationAngle == NIL))
3134 {
3135 MMset(m, 0, NIL);
3136 return 0;
3137 }
3138
3139 // Get the targeted SMaterial pointer
3140 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3141 if (material == 0)
3142 {
3143 MMset(m, 0, NIL);
3144 return 0;
3145 }
3146
3147 // Get other parameters
3148 technique = MTOI(technique);
3149 pass = MTOI(pass);
3150 textureUnit = MTOI(textureUnit);
3151 float angle = MTOF(rotationAngle);
3152
3153 try
3154 {
3155 STechnique* matTechnique = material->GetTechnique(technique);
3156 if (matTechnique)
3157 {
3158 SPass* matPass = matTechnique->GetPass(pass);
3159 if (matPass)
3160 {
3161 matPass->SetTextureRotate(textureUnit, angle);
3162 MMset(m, 0, ITOM(1));
3163 return 0;
3164 }
3165 }
3166 }
3167 catch (Ogre::Exception& e)
3168 {
3169 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3170 }
3171 MMset(m, 0, NIL);
3172 return 0;
3173}
3174
3187{
3188#ifdef SO3_DEBUG
3189 MMechostr(MSKDEBUG, "SO3MaterialGetTextureRotate\n");
3190#endif
3191
3192 int textureUnit = MMpull(m);
3193 int pass = MMpull(m);
3194 int technique = MMpull(m);
3195 int mat = MMget(m, 0);
3196
3197 // Checking parameters.
3198 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
3199 {
3200 MMset(m, 0, NIL);
3201 return 0;
3202 }
3203
3204 // Get the targeted SMaterial pointer
3205 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3206 if (material == 0)
3207 {
3208 MMset(m, 0, NIL);
3209 return 0;
3210 }
3211
3212 // Get other parameters
3213 technique = MTOI(technique);
3214 pass = MTOI(pass);
3215 textureUnit = MTOI(textureUnit);
3216
3217 try
3218 {
3219 STechnique* matTechnique = material->GetTechnique(technique);
3220 if (matTechnique)
3221 {
3222 SPass* matPass = matTechnique->GetPass(pass);
3223 if (matPass)
3224 {
3225 float value = matPass->GetTextureRotate(textureUnit);
3226 MMset(m, 0, FTOM(value));
3227 return 0;
3228 }
3229 }
3230 }
3231 catch (Ogre::Exception& e)
3232 {
3233 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3234 }
3235 MMset(m, 0, NIL);
3236 return 0;
3237}
3238
3252{
3253#ifdef SO3_DEBUG
3254 MMechostr(MSKDEBUG, "SO3MaterialSetTextureBlendFactor\n");
3255#endif
3256
3257 int ifactor = MMpull(m);
3258 int textureUnit = MMpull(m);
3259 int pass = MMpull(m);
3260 int technique = MMpull(m);
3261 int mat = MMget(m, 0);
3262
3263 // Checking parameters.
3264 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
3265 {
3266 MMset(m, 0, NIL);
3267 return 0;
3268 }
3269
3270 // Get the targeted SMaterial pointer
3271 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3272 if (material == 0)
3273 {
3274 MMset(m, 0, NIL);
3275 return 0;
3276 }
3277
3278 // Get other parameters
3279 technique = MTOI(technique);
3280 pass = MTOI(pass);
3281 textureUnit = MTOI(textureUnit);
3282
3283 float factor = 1.0f;
3284 if (ifactor != NIL)
3285 factor = std::min(MTOF(ifactor), 1.0f);
3286
3287 try
3288 {
3289 STechnique* matTechnique = material->GetTechnique(technique);
3290 if (matTechnique)
3291 {
3292 SPass* matPass = matTechnique->GetPass(pass);
3293 if (matPass)
3294 {
3295 matPass->SetTextureUnitColorBlendModeFactor(textureUnit, factor);
3296 MMset(m, 0, ITOM(1));
3297 return 0;
3298 }
3299 }
3300 }
3301 catch (Ogre::Exception& e)
3302 {
3303 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3304 }
3305 MMset(m, 0, NIL);
3306 return 0;
3307}
3308
3321{
3322#ifdef SO3_DEBUG
3323 MMechostr(MSKDEBUG, "SO3MaterialGetTextureBlendFactor\n");
3324#endif
3325
3326 int textureUnit = MMpull(m);
3327 int pass = MMpull(m);
3328 int technique = MMpull(m);
3329 int mat = MMget(m, 0);
3330
3331 // Checking parameters.
3332 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL))
3333 {
3334 MMset(m, 0, NIL);
3335 return 0;
3336 }
3337
3338 // Get the targeted SMaterial pointer
3339 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3340 if (material == 0)
3341 {
3342 MMset(m, 0, NIL);
3343 return 0;
3344 }
3345
3346 // Get other parameters
3347 technique = MTOI(technique);
3348 pass = MTOI(pass);
3349 textureUnit = MTOI(textureUnit);
3350
3351 try
3352 {
3353 STechnique* matTechnique = material->GetTechnique(technique);
3354 if (matTechnique)
3355 {
3356 SPass* matPass = matTechnique->GetPass(pass);
3357 if (matPass)
3358 {
3359 MMset(m, 0, FTOM(matPass->GetTextureUnitColorBlendModeFactor(textureUnit)));
3360 return 0;
3361 }
3362 }
3363 }
3364 catch (Ogre::Exception& e)
3365 {
3366 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3367 }
3368
3369 MMset(m, 0, NIL);
3370 return 0;
3371}
3372
3386{
3387#ifdef SO3_DEBUG
3388 MMechostr(MSKDEBUG, "SO3MaterialSetTextureRotateAnimation\n");
3389#endif
3390
3391 int rotationSpeed = MMpull(m);
3392 int textureUnit = MMpull(m);
3393 int pass = MMpull(m);
3394 int technique = MMpull(m);
3395 int mat = MMget(m, 0);
3396
3397 // Checking parameters.
3398 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (rotationSpeed == NIL))
3399 {
3400 MMset(m, 0, NIL);
3401 return 0;
3402 }
3403
3404 // Get the targeted SMaterial pointer
3405 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3406 if (material == 0)
3407 {
3408 MMset(m, 0, NIL);
3409 return 0;
3410 }
3411
3412 // Get other parameters
3413 technique = MTOI(technique);
3414 pass = MTOI(pass);
3415 textureUnit = MTOI(textureUnit);
3416 float speed = MTOF(rotationSpeed);
3417
3418 try
3419 {
3420 STechnique* matTechnique = material->GetTechnique(technique);
3421 if (matTechnique)
3422 {
3423 SPass* matPass = matTechnique->GetPass(pass);
3424 if (matPass)
3425 {
3426 matPass->SetTextureRotateAnimation(textureUnit, speed);
3427 MMset(m, 0, ITOM(1));
3428 return 0;
3429 }
3430 }
3431 }
3432 catch (Ogre::Exception& e)
3433 {
3434 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3435 }
3436 MMset(m, 0, NIL);
3437 return 0;
3438}
3439
3454{
3455#ifdef SO3_DEBUG
3456 MMechostr(MSKDEBUG, "SO3MaterialSetTextureScrollAnimation\n");
3457#endif
3458
3459 int speedVertical = MMpull(m);
3460 int speedHorizontal = MMpull(m);
3461 int textureUnit = MMpull(m);
3462 int pass = MMpull(m);
3463 int technique = MMpull(m);
3464 int mat = MMget(m, 0);
3465
3466 // Checking parameters.
3467 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (textureUnit == NIL) || (speedHorizontal == NIL) || (speedVertical == NIL))
3468 {
3469 MMset(m, 0, NIL);
3470 return 0;
3471 }
3472
3473 // Get the targeted SMaterial pointer
3474 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3475 if (material == 0)
3476 {
3477 MMset(m, 0, NIL);
3478 return 0;
3479 }
3480
3481 // Get other parameters
3482 technique = MTOI(technique);
3483 pass = MTOI(pass);
3484 textureUnit = MTOI(textureUnit);
3485 float valueH = MTOF(speedHorizontal);
3486 float valueV = MTOF(speedVertical);
3487
3488 try
3489 {
3490 STechnique* matTechnique = material->GetTechnique(technique);
3491 if (matTechnique)
3492 {
3493 SPass* matPass = matTechnique->GetPass(pass);
3494 if (matPass)
3495 {
3496 matPass->SetTextureScrollAnimation(textureUnit, valueH, valueV);
3497 MMset(m, 0, ITOM(1));
3498 return 0;
3499 }
3500 }
3501 }
3502 catch (Ogre::Exception& e)
3503 {
3504 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3505 }
3506 MMset(m, 0, NIL);
3507 return 0;
3508}
3509
3521{
3522#ifdef SO3_DEBUG
3523 MMechostr(MSKDEBUG, "SO3MaterialGetPassVertexProgramParameters\n");
3524#endif
3525
3526 int pass = MMpull(m);
3527 int technique = MMpull(m);
3528 int mat = MMpull(m);
3529
3530 // Checking parameters.
3531 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
3532 {
3533 MMpush(m, NIL);
3534 return 0;
3535 }
3536
3537 // Get the targeted SMaterial pointer
3538 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3539 if (material == 0)
3540 {
3541 MMpush(m, NIL);
3542 return 0;
3543 }
3544
3545 // Get other parameters
3546 technique = MTOI(technique);
3547 pass = MTOI(pass);
3548
3549 try
3550 {
3551 STechnique* matTechnique = material->GetTechnique(technique);
3552 if (matTechnique)
3553 {
3554 SPass* matPass = matTechnique->GetPass(pass);
3555 if (matPass)
3556 {
3557 int k;
3558
3559 const Ogre::GpuConstantDefinitionMap& programParameters = matPass->GetVertexProgramParameters().map;
3560 Ogre::GpuConstantDefinitionMap::const_iterator iProgramParameters = programParameters.begin();
3561 while (iProgramParameters != programParameters.end())
3562 {
3563 if (k = Mpushstrbloc(m, (char*)(iProgramParameters->first).c_str()))
3564 return k;
3565
3566 if (k = MMpush(m, ITOM(static_cast<int>(iProgramParameters->second.constType))))
3567 return k;
3568
3569 if (MMpush(m, ITOM(2)))
3570 return MERRMEM;
3571 if (k = MBdeftab(m))
3572 return k;
3573
3574 iProgramParameters++;
3575 }
3576
3577 if (MMpush(m, NIL))
3578 return MERRMEM;
3579
3580 iProgramParameters = programParameters.begin();
3581 while (iProgramParameters != programParameters.end())
3582 {
3583 if (MMpush(m, ITOM(2)))
3584 return MERRMEM;
3585 if (k = MBdeftab(m))
3586 return k;
3587
3588 iProgramParameters++;
3589 }
3590 return 0;
3591 }
3592 }
3593 }
3594 catch (Ogre::Exception& e)
3595 {
3596 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3597 }
3598 MMpush(m, NIL);
3599 return 0;
3600}
3601
3607{
3608#ifdef SO3_DEBUG
3609 MMechostr(MSKDEBUG, "SO3MaterialSetPassVertexProgramAutoParameter\n");
3610#endif
3611
3612 int scolParamOption = MMpull(m);
3613 int scolParamType = MMpull(m);
3614 int scolParamName = MMpull(m);
3615 int pass = MMpull(m);
3616 int technique = MMpull(m);
3617 int mat = MMget(m, 0);
3618
3619 // Checking parameters.
3620 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolParamName == NIL) || (scolParamType == NIL))
3621 {
3622 MMset(m, 0, NIL);
3623 return 0;
3624 }
3625
3626 // Get the targeted SMaterial pointer
3627 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3628 if (material == 0)
3629 {
3630 MMset(m, 0, NIL);
3631 return 0;
3632 }
3633
3634 // Get other parameters
3635 technique = MTOI(technique);
3636 pass = MTOI(pass);
3637
3638 try
3639 {
3640 STechnique* matTechnique = material->GetTechnique(technique);
3641 if (matTechnique)
3642 {
3643 SPass* matPass = matTechnique->GetPass(pass);
3644 if (matPass)
3645 {
3646 int paramOption = 0;
3647 if (scolParamOption != NIL)
3648 paramOption = MTOI(scolParamOption);
3649
3650 std::string paramName = MMstartstr(m, MTOP(scolParamName));
3651 Ogre::GpuProgramParameters::AutoConstantType paramType = static_cast<Ogre::GpuProgramParameters::AutoConstantType>(MTOI(scolParamType));
3652 matPass->SetVertexProgramAutoParameter(paramName, paramType, paramOption);
3653 }
3654 }
3655 }
3656 catch (Ogre::Exception& e)
3657 {
3658 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3659 }
3660 MMset(m, 0, NIL);
3661 return 0;
3662}
3663
3669{
3670#ifdef SO3_DEBUG
3671 MMechostr(MSKDEBUG, "SO3MaterialSetPassVertexProgramParameter\n");
3672#endif
3673
3674 int scolParamValue = MMpull(m);
3675 int scolParamName = MMpull(m);
3676 int pass = MMpull(m);
3677 int technique = MMpull(m);
3678 int mat = MMget(m, 0);
3679
3680 // Checking parameters.
3681 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolParamName == NIL) || (scolParamValue == NIL))
3682 {
3683 MMset(m, 0, NIL);
3684 return 0;
3685 }
3686
3687 // Get the targeted SMaterial pointer
3688 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3689 if (material == 0)
3690 {
3691 MMset(m, 0, NIL);
3692 return 0;
3693 }
3694
3695 // Get other parameters
3696 technique = MTOI(technique);
3697 pass = MTOI(pass);
3698
3699 try
3700 {
3701 STechnique* matTechnique = material->GetTechnique(technique);
3702 if (matTechnique)
3703 {
3704 SPass* matPass = matTechnique->GetPass(pass);
3705 if (matPass)
3706 {
3707 std::string paramName = MMstartstr(m, MTOP(scolParamName));
3708 std::string paramValue = MMstartstr(m, MTOP(scolParamValue));
3709 matPass->SetVertexProgramParameter(paramName, paramValue);
3710 }
3711 }
3712 }
3713 catch (Ogre::Exception& e)
3714 {
3715 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3716 }
3717 MMset(m, 0, NIL);
3718 return 0;
3719}
3720
3732{
3733#ifdef SO3_DEBUG
3734 MMechostr(MSKDEBUG, "SO3MaterialGetPassFragmentProgramParameters\n");
3735#endif
3736
3737 int pass = MMpull(m);
3738 int technique = MMpull(m);
3739 int mat = MMpull(m);
3740
3741 // Checking parameters.
3742 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
3743 {
3744 MMpush(m, NIL);
3745 return 0;
3746 }
3747
3748 // Get the targeted SMaterial pointer
3749 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3750 if (material == 0)
3751 {
3752 MMpush(m, NIL);
3753 return 0;
3754 }
3755
3756 // Get other parameters
3757 technique = MTOI(technique);
3758 pass = MTOI(pass);
3759
3760 try
3761 {
3762 STechnique* matTechnique = material->GetTechnique(technique);
3763 if (matTechnique)
3764 {
3765 SPass* matPass = matTechnique->GetPass(pass);
3766 if (matPass)
3767 {
3768 int k;
3769
3770 const Ogre::GpuConstantDefinitionMap& programParameters = matPass->GetFragmentProgramParameters().map;
3771 Ogre::GpuConstantDefinitionMap::const_iterator iProgramParameters = programParameters.begin();
3772 while (iProgramParameters != programParameters.end())
3773 {
3774 if (k = Mpushstrbloc(m, (char*)(iProgramParameters->first).c_str()))
3775 return k;
3776
3777 if (k = MMpush(m, ITOM(static_cast<int>(iProgramParameters->second.constType))))
3778 return k;
3779
3780 if (MMpush(m, ITOM(2)))
3781 return MERRMEM;
3782 if (k = MBdeftab(m))
3783 return k;
3784
3785 iProgramParameters++;
3786 }
3787
3788 if (MMpush(m, NIL))
3789 return MERRMEM;
3790
3791 iProgramParameters = programParameters.begin();
3792 while (iProgramParameters != programParameters.end())
3793 {
3794 if (MMpush(m, ITOM(2)))
3795 return MERRMEM;
3796 if (k = MBdeftab(m))
3797 return k;
3798
3799 iProgramParameters++;
3800 }
3801 return 0;
3802 }
3803 }
3804 }
3805 catch (Ogre::Exception& e)
3806 {
3807 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3808 }
3809 MMpush(m, NIL);
3810 return 0;
3811}
3812
3818{
3819#ifdef SO3_DEBUG
3820 MMechostr(MSKDEBUG, "SO3MaterialSetPassFragmentProgramAutoParameter\n");
3821#endif
3822
3823 int scolParamOption = MMpull(m);
3824 int scolParamType = MMpull(m);
3825 int scolParamName = MMpull(m);
3826 int pass = MMpull(m);
3827 int technique = MMpull(m);
3828 int mat = MMget(m, 0);
3829
3830 // Checking parameters.
3831 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolParamName == NIL) || (scolParamType == NIL))
3832 {
3833 MMset(m, 0, NIL);
3834 return 0;
3835 }
3836
3837 // Get the targeted SMaterial pointer
3838 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3839 if (material == 0)
3840 {
3841 MMset(m, 0, NIL);
3842 return 0;
3843 }
3844
3845 // Get other parameters
3846 technique = MTOI(technique);
3847 pass = MTOI(pass);
3848
3849 try
3850 {
3851 STechnique* matTechnique = material->GetTechnique(technique);
3852 if (matTechnique)
3853 {
3854 SPass* matPass = matTechnique->GetPass(pass);
3855 if (matPass)
3856 {
3857 int paramOption = 0;
3858 if (scolParamOption != NIL)
3859 paramOption = MTOI(scolParamOption);
3860
3861 std::string paramName = MMstartstr(m, MTOP(scolParamName));
3862 Ogre::GpuProgramParameters::AutoConstantType paramType = static_cast<Ogre::GpuProgramParameters::AutoConstantType>(MTOI(scolParamType));
3863 matPass->SetFragmentProgramAutoParameter(paramName, paramType, paramOption);
3864 }
3865 }
3866 }
3867 catch (Ogre::Exception& e)
3868 {
3869 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3870 }
3871 MMset(m, 0, NIL);
3872 return 0;
3873}
3874
3880{
3881#ifdef SO3_DEBUG
3882 MMechostr(MSKDEBUG, "SO3MaterialSetPassFragmentProgramParameter\n");
3883#endif
3884
3885 int scolParamValue = MMpull(m);
3886 int scolParamName = MMpull(m);
3887 int pass = MMpull(m);
3888 int technique = MMpull(m);
3889 int mat = MMget(m, 0);
3890
3891 // Checking parameters.
3892 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolParamName == NIL) || (scolParamValue == NIL))
3893 {
3894 MMset(m, 0, NIL);
3895 return 0;
3896 }
3897
3898 // Get the targeted SMaterial pointer
3899 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3900 if (material == 0)
3901 {
3902 MMset(m, 0, NIL);
3903 return 0;
3904 }
3905
3906 // Get other parameters
3907 technique = MTOI(technique);
3908 pass = MTOI(pass);
3909
3910 try
3911 {
3912 STechnique* matTechnique = material->GetTechnique(technique);
3913 if (matTechnique)
3914 {
3915 SPass* matPass = matTechnique->GetPass(pass);
3916 if (matPass)
3917 {
3918 std::string paramName = MMstartstr(m, MTOP(scolParamName));
3919 std::string paramValue = MMstartstr(m, MTOP(scolParamValue));
3920 matPass->SetFragmentProgramParameter(paramName, paramValue);
3921 }
3922 }
3923 }
3924 catch (Ogre::Exception& e)
3925 {
3926 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
3927 }
3928 MMset(m, 0, NIL);
3929 return 0;
3930}
3931
3946{
3947#ifdef SO3_DEBUG
3948 MMechostr(MSKDEBUG, "SO3MaterialSetPassAlphaRejection\n");
3949#endif
3950
3951 int scolRejectCoverage = MMpull(m);
3952 int scolRejectValue = MMpull(m);
3953 int scolRejectFunction = MMpull(m);
3954 int pass = MMpull(m);
3955 int technique = MMpull(m);
3956 int mat = MMget(m, 0);
3957
3958 // Checking parameters.
3959 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
3960 {
3961 MMset(m, 0, NIL);
3962 return 0;
3963 }
3964
3965 // Get the targeted SMaterial pointer
3966 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
3967 if (material == 0)
3968 {
3969 MMset(m, 0, NIL);
3970 return 0;
3971 }
3972
3973 // Get other parameters
3974 technique = MTOI(technique);
3975 pass = MTOI(pass);
3976
3977 try
3978 {
3979 STechnique* matTechnique = material->GetTechnique(technique);
3980 if (matTechnique)
3981 {
3982 SPass* matPass = matTechnique->GetPass(pass);
3983 if (matPass)
3984 {
3985 // Keep old settings when a parameter is setted to nil.
3986 bool rejectCoverage;
3987 if (scolRejectCoverage == NIL)
3988 rejectCoverage = matPass->GetAlphaToCoverage();
3989 else
3990 (MTOI(scolRejectCoverage) == 1) ? rejectCoverage = true : rejectCoverage = false;
3991
3992 unsigned char rejectValue = 0x0;
3993 if (scolRejectValue == NIL)
3994 rejectValue = matPass->GetAlphaRejectionValue();
3995 else
3996 rejectValue = static_cast<unsigned char>(MTOI(scolRejectValue));
3997
3998 SPass::CompareFunction rejectFunction;
3999 if (scolRejectFunction == NIL)
4000 rejectFunction = matPass->GetAlphaRejectionFunction();
4001 else
4002 rejectFunction = static_cast<SPass::CompareFunction>(MTOI(scolRejectFunction));
4003
4004 matPass->SetAlphaRejection(rejectFunction, rejectValue, rejectCoverage);
4005 MMset(m, 0, ITOM(1));
4006 }
4007 else
4008 MMset(m, 0, NIL);
4009 }
4010 else
4011 MMset(m, 0, NIL);
4012 }
4013 catch (Ogre::Exception& e)
4014 {
4015 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4016 MMset(m, 0, NIL);
4017 }
4018 return 0;
4019}
4020
4032{
4033#ifdef SO3_DEBUG
4034 MMechostr(MSKDEBUG, "SO3MaterialGetPassAlphaRejectionFunction\n");
4035#endif
4036
4037 int pass = MMpull(m);
4038 int technique = MMpull(m);
4039 int mat = MMget(m, 0);
4040
4041 // Checking parameters.
4042 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4043 {
4044 MMset(m, 0, NIL);
4045 return 0;
4046 }
4047
4048 // Get the targeted SMaterial pointer
4049 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4050 if (material == 0)
4051 {
4052 MMset(m, 0, NIL);
4053 return 0;
4054 }
4055
4056 // Get other parameters
4057 technique = MTOI(technique);
4058 pass = MTOI(pass);
4059
4060 try
4061 {
4062 STechnique* matTechnique = material->GetTechnique(technique);
4063 if (matTechnique)
4064 {
4065 SPass* matPass = matTechnique->GetPass(pass);
4066 if (matPass)
4067 MMset(m, 0, ITOM(static_cast<int>(matPass->GetAlphaRejectionFunction())));
4068 else
4069 MMset(m, 0, NIL);
4070 }
4071 else
4072 MMset(m, 0, NIL);
4073 }
4074 catch (Ogre::Exception& e)
4075 {
4076 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4077 MMset(m, 0, NIL);
4078 }
4079 return 0;
4080}
4081
4093{
4094#ifdef SO3_DEBUG
4095 MMechostr(MSKDEBUG, "SO3MaterialGetPassAlphaRejectionValue\n");
4096#endif
4097
4098 int pass = MMpull(m);
4099 int technique = MMpull(m);
4100 int mat = MMget(m, 0);
4101
4102 // Checking parameters.
4103 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4104 {
4105 MMset(m, 0, NIL);
4106 return 0;
4107 }
4108
4109 // Get the targeted SMaterial pointer
4110 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4111 if (material == 0)
4112 {
4113 MMset(m, 0, NIL);
4114 return 0;
4115 }
4116
4117 // Get other parameters
4118 technique = MTOI(technique);
4119 pass = MTOI(pass);
4120
4121 try
4122 {
4123 STechnique* matTechnique = material->GetTechnique(technique);
4124 if (matTechnique)
4125 {
4126 SPass* matPass = matTechnique->GetPass(pass);
4127 if (matPass)
4128 MMset(m, 0, ITOM(static_cast<int>(matPass->GetAlphaRejectionValue())));
4129 else
4130 MMset(m, 0, NIL);
4131 }
4132 else
4133 MMset(m, 0, NIL);
4134 }
4135 catch (Ogre::Exception& e)
4136 {
4137 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4138 MMset(m, 0, NIL);
4139 }
4140 return 0;
4141}
4142
4154{
4155#ifdef SO3_DEBUG
4156 MMechostr(MSKDEBUG, "SO3MaterialGetPassAlphaToCoverage\n");
4157#endif
4158
4159 int pass = MMpull(m);
4160 int technique = MMpull(m);
4161 int mat = MMget(m, 0);
4162
4163 // Checking parameters.
4164 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4165 {
4166 MMset(m, 0, NIL);
4167 return 0;
4168 }
4169
4170 // Get the targeted SMaterial pointer
4171 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4172 if (material == 0)
4173 {
4174 MMset(m, 0, NIL);
4175 return 0;
4176 }
4177
4178 // Get other parameters
4179 technique = MTOI(technique);
4180 pass = MTOI(pass);
4181
4182 try
4183 {
4184 STechnique* matTechnique = material->GetTechnique(technique);
4185 if (matTechnique)
4186 {
4187 SPass* matPass = matTechnique->GetPass(pass);
4188 if (matPass)
4189 MMset(m, 0, ITOM(static_cast<int>(matPass->GetAlphaToCoverage() ? 1 : 0)));
4190 else
4191 MMset(m, 0, NIL);
4192 }
4193 else
4194 MMset(m, 0, NIL);
4195 }
4196 catch (Ogre::Exception& e)
4197 {
4198 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4199 MMset(m, 0, NIL);
4200 }
4201 return 0;
4202}
4203
4215{
4216#ifdef SO3_DEBUG
4217 MMechostr(MSKDEBUG, "SO3MaterialGetPassDepthCheckEnabled\n");
4218#endif
4219
4220 int pass = MMpull(m);
4221 int technique = MMpull(m);
4222 int mat = MMget(m, 0);
4223
4224 // Checking parameters.
4225 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4226 {
4227 MMset(m, 0, NIL);
4228 return 0;
4229 }
4230
4231 // Get the targeted SMaterial pointer
4232 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4233 if (material == 0)
4234 {
4235 MMset(m, 0, NIL);
4236 return 0;
4237 }
4238
4239 // Get other parameters
4240 technique = MTOI(technique);
4241 pass = MTOI(pass);
4242
4243 try
4244 {
4245 STechnique* matTechnique = material->GetTechnique(technique);
4246 if (matTechnique)
4247 {
4248 SPass* matPass = matTechnique->GetPass(pass);
4249 if (matPass)
4250 MMset(m, 0, ITOM(static_cast<int>(matPass->GetDepthCheckEnabled() ? 1 : 0)));
4251 else
4252 MMset(m, 0, NIL);
4253 }
4254 else
4255 MMset(m, 0, NIL);
4256 }
4257 catch (Ogre::Exception& e)
4258 {
4259 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4260 MMset(m, 0, NIL);
4261 }
4262 return 0;
4263}
4264
4277{
4278#ifdef SO3_DEBUG
4279 MMechostr(MSKDEBUG, "SO3MaterialSetPassDepthCheckEnabled\n");
4280#endif
4281
4282 int scolDepthCheck = MMpull(m);
4283 int pass = MMpull(m);
4284 int technique = MMpull(m);
4285 int mat = MMget(m, 0);
4286
4287 // Checking parameters.
4288 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolDepthCheck == NIL))
4289 {
4290 MMset(m, 0, NIL);
4291 return 0;
4292 }
4293
4294 // Get the targeted SMaterial pointer
4295 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4296 if (material == 0)
4297 {
4298 MMset(m, 0, NIL);
4299 return 0;
4300 }
4301
4302 // Get other parameters
4303 technique = MTOI(technique);
4304 pass = MTOI(pass);
4305
4306 try
4307 {
4308 STechnique* matTechnique = material->GetTechnique(technique);
4309 if (matTechnique)
4310 {
4311 SPass* matPass = matTechnique->GetPass(pass);
4312 if (matPass)
4313 {
4314 matPass->SetDepthCheckEnabled((MTOI(scolDepthCheck) == 1) ? true : false);
4315 MMset(m, 0, ITOM(1));
4316 }
4317 else
4318 MMset(m, 0, NIL);
4319 }
4320 else
4321 MMset(m, 0, NIL);
4322 }
4323 catch (Ogre::Exception& e)
4324 {
4325 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4326 MMset(m, 0, NIL);
4327 }
4328 return 0;
4329}
4330
4342{
4343#ifdef SO3_DEBUG
4344 MMechostr(MSKDEBUG, "SO3MaterialGetPassDepthWriteEnabled\n");
4345#endif
4346
4347 int pass = MMpull(m);
4348 int technique = MMpull(m);
4349 int mat = MMget(m, 0);
4350
4351 // Checking parameters.
4352 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4353 {
4354 MMset(m, 0, NIL);
4355 return 0;
4356 }
4357
4358 // Get the targeted SMaterial pointer
4359 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4360 if (material == 0)
4361 {
4362 MMset(m, 0, NIL);
4363 return 0;
4364 }
4365
4366 // Get other parameters
4367 technique = MTOI(technique);
4368 pass = MTOI(pass);
4369
4370 try
4371 {
4372 STechnique* matTechnique = material->GetTechnique(technique);
4373 if (matTechnique)
4374 {
4375 SPass* matPass = matTechnique->GetPass(pass);
4376 if (matPass)
4377 MMset(m, 0, ITOM(static_cast<int>(matPass->GetDepthWriteEnabled() ? 1 : 0)));
4378 else
4379 MMset(m, 0, NIL);
4380 }
4381 else
4382 MMset(m, 0, NIL);
4383 }
4384 catch (Ogre::Exception& e)
4385 {
4386 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4387 MMset(m, 0, NIL);
4388 }
4389 return 0;
4390}
4391
4404{
4405#ifdef SO3_DEBUG
4406 MMechostr(MSKDEBUG, "SO3MaterialSetPassDepthWriteEnabled\n");
4407#endif
4408
4409 int scolDepthWrite = MMpull(m);
4410 int pass = MMpull(m);
4411 int technique = MMpull(m);
4412 int mat = MMget(m, 0);
4413
4414 // Checking parameters.
4415 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolDepthWrite == NIL))
4416 {
4417 MMset(m, 0, NIL);
4418 return 0;
4419 }
4420
4421 // Get the targeted SMaterial pointer
4422 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4423 if (material == 0)
4424 {
4425 MMset(m, 0, NIL);
4426 return 0;
4427 }
4428
4429 // Get other parameters
4430 technique = MTOI(technique);
4431 pass = MTOI(pass);
4432
4433 try
4434 {
4435 STechnique* matTechnique = material->GetTechnique(technique);
4436 if (matTechnique)
4437 {
4438 SPass* matPass = matTechnique->GetPass(pass);
4439 if (matPass)
4440 {
4441 matPass->SetDepthWriteEnabled((MTOI(scolDepthWrite) == 1) ? true : false);
4442 MMset(m, 0, ITOM(1));
4443 }
4444 else
4445 MMset(m, 0, NIL);
4446 }
4447 else
4448 MMset(m, 0, NIL);
4449 }
4450 catch (Ogre::Exception& e)
4451 {
4452 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4453 MMset(m, 0, NIL);
4454 }
4455 return 0;
4456}
4457
4469{
4470#ifdef SO3_DEBUG
4471 MMechostr(MSKDEBUG, "SO3MaterialGetPassDepthFunction\n");
4472#endif
4473
4474 int pass = MMpull(m);
4475 int technique = MMpull(m);
4476 int mat = MMget(m, 0);
4477
4478 // Checking parameters.
4479 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4480 {
4481 MMset(m, 0, NIL);
4482 return 0;
4483 }
4484
4485 // Get the targeted SMaterial pointer
4486 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4487 if (material == 0)
4488 {
4489 MMset(m, 0, NIL);
4490 return 0;
4491 }
4492
4493 // Get other parameters
4494 technique = MTOI(technique);
4495 pass = MTOI(pass);
4496
4497 try
4498 {
4499 STechnique* matTechnique = material->GetTechnique(technique);
4500 if (matTechnique)
4501 {
4502 SPass* matPass = matTechnique->GetPass(pass);
4503 if (matPass)
4504 MMset(m, 0, ITOM(static_cast<int>(matPass->GetDepthFunction())));
4505 else
4506 MMset(m, 0, NIL);
4507 }
4508 else
4509 MMset(m, 0, NIL);
4510 }
4511 catch (Ogre::Exception& e)
4512 {
4513 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4514 MMset(m, 0, NIL);
4515 }
4516 return 0;
4517}
4518
4531{
4532#ifdef SO3_DEBUG
4533 MMechostr(MSKDEBUG, "SO3MaterialSetPassDepthFunction\n");
4534#endif
4535
4536 int scolDepthFunction = MMpull(m);
4537 int pass = MMpull(m);
4538 int technique = MMpull(m);
4539 int mat = MMget(m, 0);
4540
4541 // Checking parameters.
4542 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (scolDepthFunction == NIL))
4543 {
4544 MMset(m, 0, NIL);
4545 return 0;
4546 }
4547
4548 // Get the targeted SMaterial pointer
4549 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4550 if (material == 0)
4551 {
4552 MMset(m, 0, NIL);
4553 return 0;
4554 }
4555
4556 // Get other parameters
4557 technique = MTOI(technique);
4558 pass = MTOI(pass);
4559
4560 try
4561 {
4562 STechnique* matTechnique = material->GetTechnique(technique);
4563 if (matTechnique)
4564 {
4565 SPass* matPass = matTechnique->GetPass(pass);
4566 if (matPass)
4567 {
4568 matPass->SetDepthFunction(static_cast<SPass::CompareFunction>(MTOI(scolDepthFunction)));
4569 MMset(m, 0, ITOM(1));
4570 }
4571 else
4572 MMset(m, 0, NIL);
4573 }
4574 else
4575 MMset(m, 0, NIL);
4576 }
4577 catch (Ogre::Exception& e)
4578 {
4579 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4580 MMset(m, 0, NIL);
4581 }
4582 return 0;
4583}
4584
4596{
4597#ifdef SO3_DEBUG
4598 MMechostr(MSKDEBUG, "SO3MaterialGetPassColourWriteEnabled\n");
4599#endif
4600
4601 int pass = MMpull(m);
4602 int technique = MMpull(m);
4603 int mat = MMget(m, 0);
4604
4605 // Checking parameters.
4606 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4607 {
4608 MMset(m, 0, NIL);
4609 return 0;
4610 }
4611
4612 // Get the targeted SMaterial pointer
4613 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4614 if (material == 0)
4615 {
4616 MMset(m, 0, NIL);
4617 return 0;
4618 }
4619
4620 // Get other parameters
4621 technique = MTOI(technique);
4622 pass = MTOI(pass);
4623
4624 try
4625 {
4626 STechnique* matTechnique = material->GetTechnique(technique);
4627 if (matTechnique)
4628 {
4629 SPass* matPass = matTechnique->GetPass(pass);
4630 if (matPass)
4631 MMset(m, 0, ITOM(static_cast<int>(matPass->GetColourWriteEnabled() ? 1 : 0)));
4632 else
4633 MMset(m, 0, NIL);
4634 }
4635 else
4636 MMset(m, 0, NIL);
4637 }
4638 catch (Ogre::Exception& e)
4639 {
4640 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4641 MMset(m, 0, NIL);
4642 }
4643 return 0;
4644}
4645
4658{
4659#ifdef SO3_DEBUG
4660 MMechostr(MSKDEBUG, "SO3MaterialSetPassColourWriteEnabled\n");
4661#endif
4662
4663 int cwrite = MMpull(m);
4664 int pass = MMpull(m);
4665 int technique = MMpull(m);
4666 int mat = MMget(m, 0);
4667
4668 // Checking parameters.
4669 if ((mat == NIL) || (technique == NIL) || (pass == NIL) || (cwrite == NIL))
4670 {
4671 MMset(m, 0, NIL);
4672 return 0;
4673 }
4674
4675 // Get the targeted SMaterial pointer
4676 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4677 if (material == 0)
4678 {
4679 MMset(m, 0, NIL);
4680 return 0;
4681 }
4682
4683 // Get other parameters
4684 technique = MTOI(technique);
4685 pass = MTOI(pass);
4686
4687 try
4688 {
4689 STechnique* matTechnique = material->GetTechnique(technique);
4690 if (matTechnique)
4691 {
4692 SPass* matPass = matTechnique->GetPass(pass);
4693 if (matPass)
4694 {
4695 matPass->SetColourWriteEnabled((MTOI(cwrite) != 0) ? true : false);
4696 MMset(m, 0, ITOM(1));
4697 }
4698 else
4699 MMset(m, 0, NIL);
4700 }
4701 else
4702 MMset(m, 0, NIL);
4703 }
4704 catch (Ogre::Exception& e)
4705 {
4706 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4707 MMset(m, 0, NIL);
4708 }
4709 return 0;
4710}
4711
4723{
4724#ifdef SO3_DEBUG
4725 MMechostr(MSKDEBUG, "SO3MaterialGetPassSourceBlendFactor\n");
4726#endif
4727
4728 int pass = MMpull(m);
4729 int technique = MMpull(m);
4730 int mat = MMget(m, 0);
4731
4732 // Checking parameters.
4733 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4734 {
4735 MMset(m, 0, NIL);
4736 return 0;
4737 }
4738
4739 // Get the targeted SMaterial pointer
4740 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4741 if (material == 0)
4742 {
4743 MMset(m, 0, NIL);
4744 return 0;
4745 }
4746
4747 // Get other parameters
4748 technique = MTOI(technique);
4749 pass = MTOI(pass);
4750
4751 try
4752 {
4753 STechnique* matTechnique = material->GetTechnique(technique);
4754 if (matTechnique)
4755 {
4756 SPass* matPass = matTechnique->GetPass(pass);
4757 if (matPass)
4758 MMset(m, 0, ITOM(static_cast<int>(matPass->GetSourceBlendFactor())));
4759 else
4760 MMset(m, 0, NIL);
4761 }
4762 else
4763 MMset(m, 0, NIL);
4764 }
4765 catch (Ogre::Exception& e)
4766 {
4767 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4768 MMset(m, 0, NIL);
4769 }
4770 return 0;
4771}
4772
4784{
4785#ifdef SO3_DEBUG
4786 MMechostr(MSKDEBUG, "SO3MaterialGetPassDestBlendFactor\n");
4787#endif
4788
4789 int pass = MMpull(m);
4790 int technique = MMpull(m);
4791 int mat = MMget(m, 0);
4792
4793 // Checking parameters.
4794 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4795 {
4796 MMset(m, 0, NIL);
4797 return 0;
4798 }
4799
4800 // Get the targeted SMaterial pointer
4801 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4802 if (material == 0)
4803 {
4804 MMset(m, 0, NIL);
4805 return 0;
4806 }
4807
4808 // Get other parameters
4809 technique = MTOI(technique);
4810 pass = MTOI(pass);
4811
4812 try
4813 {
4814 STechnique* matTechnique = material->GetTechnique(technique);
4815 if (matTechnique)
4816 {
4817 SPass* matPass = matTechnique->GetPass(pass);
4818 if (matPass)
4819 MMset(m, 0, ITOM(static_cast<int>(matPass->GetDestBlendFactor())));
4820 else
4821 MMset(m, 0, NIL);
4822 }
4823 else
4824 MMset(m, 0, NIL);
4825 }
4826 catch (Ogre::Exception& e)
4827 {
4828 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4829 MMset(m, 0, NIL);
4830 }
4831 return 0;
4832}
4833
4845{
4846#ifdef SO3_DEBUG
4847 MMechostr(MSKDEBUG, "SO3MaterialGetPassSourceBlendFactorAlpha\n");
4848#endif
4849
4850 int pass = MMpull(m);
4851 int technique = MMpull(m);
4852 int mat = MMget(m, 0);
4853
4854 // Checking parameters.
4855 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4856 {
4857 MMset(m, 0, NIL);
4858 return 0;
4859 }
4860
4861 // Get the targeted SMaterial pointer
4862 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4863 if (material == 0)
4864 {
4865 MMset(m, 0, NIL);
4866 return 0;
4867 }
4868
4869 // Get other parameters
4870 technique = MTOI(technique);
4871 pass = MTOI(pass);
4872
4873 try
4874 {
4875 STechnique* matTechnique = material->GetTechnique(technique);
4876 if (matTechnique)
4877 {
4878 SPass* matPass = matTechnique->GetPass(pass);
4879 if (matPass)
4880 MMset(m, 0, ITOM(static_cast<int>(matPass->GetSourceBlendFactorAlpha())));
4881 else
4882 MMset(m, 0, NIL);
4883 }
4884 else
4885 MMset(m, 0, NIL);
4886 }
4887 catch (Ogre::Exception& e)
4888 {
4889 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4890 MMset(m, 0, NIL);
4891 }
4892 return 0;
4893}
4894
4906{
4907#ifdef SO3_DEBUG
4908 MMechostr(MSKDEBUG, "SO3MaterialGetPassDestBlendFactorAlpha\n");
4909#endif
4910
4911 int pass = MMpull(m);
4912 int technique = MMpull(m);
4913 int mat = MMget(m, 0);
4914
4915 // Checking parameters.
4916 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4917 {
4918 MMset(m, 0, NIL);
4919 return 0;
4920 }
4921
4922 // Get the targeted SMaterial pointer
4923 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4924 if (material == 0)
4925 {
4926 MMset(m, 0, NIL);
4927 return 0;
4928 }
4929
4930 // Get other parameters
4931 technique = MTOI(technique);
4932 pass = MTOI(pass);
4933
4934 try
4935 {
4936 STechnique* matTechnique = material->GetTechnique(technique);
4937 if (matTechnique)
4938 {
4939 SPass* matPass = matTechnique->GetPass(pass);
4940 if (matPass)
4941 MMset(m, 0, ITOM(static_cast<int>(matPass->GetDestBlendFactorAlpha())));
4942 else
4943 MMset(m, 0, NIL);
4944 }
4945 else
4946 MMset(m, 0, NIL);
4947 }
4948 catch (Ogre::Exception& e)
4949 {
4950 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
4951 MMset(m, 0, NIL);
4952 }
4953 return 0;
4954}
4955
4971{
4972#ifdef SO3_DEBUG
4973 MMechostr(MSKDEBUG, "SO3MaterialSetPassSceneBlending\n");
4974#endif
4975
4976 int scolDestFactorAlpha = MMpull(m);
4977 int scolSourceFactorAlpha = MMpull(m);
4978 int scolDestFactor = MMpull(m);
4979 int scolSourceFactor = MMpull(m);
4980 int pass = MMpull(m);
4981 int technique = MMpull(m);
4982 int mat = MMget(m, 0);
4983
4984 // Checking parameters.
4985 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
4986 {
4987 MMset(m, 0, NIL);
4988 return 0;
4989 }
4990
4991 // Get the targeted SMaterial pointer
4992 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
4993 if (material == 0)
4994 {
4995 MMset(m, 0, NIL);
4996 return 0;
4997 }
4998
4999 // Get other parameters
5000 technique = MTOI(technique);
5001 pass = MTOI(pass);
5002
5003 try
5004 {
5005 STechnique* matTechnique = material->GetTechnique(technique);
5006 if (matTechnique)
5007 {
5008 SPass* matPass = matTechnique->GetPass(pass);
5009 if (matPass)
5010 {
5011 // Ignore parameters setted to nil
5012 SPass::SceneBlendFactor sourceFactor;
5013 if (scolSourceFactor == NIL)
5014 sourceFactor = matPass->GetSourceBlendFactor();
5015 else
5016 sourceFactor = static_cast<SPass::SceneBlendFactor>(static_cast<int>(MTOI(scolSourceFactor)));
5017
5018 SPass::SceneBlendFactor destFactor;
5019 if (scolDestFactor == NIL)
5020 destFactor = matPass->GetDestBlendFactor();
5021 else
5022 destFactor = static_cast<SPass::SceneBlendFactor>(static_cast<int>(MTOI(scolDestFactor)));
5023
5024 if (scolSourceFactorAlpha == NIL && scolDestFactorAlpha == NIL)
5025 {
5026 matPass->SetSceneBlending(sourceFactor, destFactor);
5027 }
5028 else
5029 {
5030 SPass::SceneBlendFactor sourceFactorAlpha;
5031 if (scolSourceFactorAlpha == NIL)
5032 sourceFactorAlpha = matPass->GetSourceBlendFactorAlpha();
5033 else
5034 sourceFactorAlpha = static_cast<SPass::SceneBlendFactor>(static_cast<int>(MTOI(scolSourceFactorAlpha)));
5035
5036 SPass::SceneBlendFactor destFactorAlpha;
5037 if (scolDestFactorAlpha == NIL)
5038 destFactorAlpha = matPass->GetDestBlendFactorAlpha();
5039 else
5040 destFactorAlpha = static_cast<SPass::SceneBlendFactor>(static_cast<int>(MTOI(scolDestFactorAlpha)));
5041
5042 matPass->SetSceneBlending(sourceFactor, destFactor, sourceFactorAlpha, destFactorAlpha);
5043 }
5044
5045 MMset(m, 0, ITOM(1));
5046 }
5047 else
5048 MMset(m, 0, NIL);
5049 }
5050 else
5051 MMset(m, 0, NIL);
5052 }
5053 catch (Ogre::Exception& e)
5054 {
5055 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5056 MMset(m, 0, NIL);
5057 }
5058 return 0;
5059}
5060
5072{
5073#ifdef SO3_DEBUG
5074 MMechostr(MSKDEBUG, "SO3MaterialGetPassSceneBlendingOperation\n");
5075#endif
5076
5077 int pass = MMpull(m);
5078 int technique = MMpull(m);
5079 int mat = MMget(m, 0);
5080
5081 // Checking parameters.
5082 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5083 {
5084 MMset(m, 0, NIL);
5085 return 0;
5086 }
5087
5088 // Get the targeted SMaterial pointer
5089 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5090 if (material == 0)
5091 {
5092 MMset(m, 0, NIL);
5093 return 0;
5094 }
5095
5096 // Get other parameters
5097 technique = MTOI(technique);
5098 pass = MTOI(pass);
5099
5100 try
5101 {
5102 STechnique* matTechnique = material->GetTechnique(technique);
5103 if (matTechnique)
5104 {
5105 SPass* matPass = matTechnique->GetPass(pass);
5106 if (matPass)
5107 MMset(m, 0, ITOM(static_cast<int>(matPass->GetSceneBlendingOperation())));
5108 else
5109 MMset(m, 0, NIL);
5110 }
5111 else
5112 MMset(m, 0, NIL);
5113 }
5114 catch (Ogre::Exception& e)
5115 {
5116 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5117 MMset(m, 0, NIL);
5118 }
5119 return 0;
5120}
5121
5133{
5134#ifdef SO3_DEBUG
5135 MMechostr(MSKDEBUG, "SO3MaterialGetPassSceneBlendingOperationAlpha\n");
5136#endif
5137
5138 int pass = MMpull(m);
5139 int technique = MMpull(m);
5140 int mat = MMget(m, 0);
5141
5142 // Checking parameters.
5143 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5144 {
5145 MMset(m, 0, NIL);
5146 return 0;
5147 }
5148
5149 // Get the targeted SMaterial pointer
5150 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5151 if (material == 0)
5152 {
5153 MMset(m, 0, NIL);
5154 return 0;
5155 }
5156
5157 // Get other parameters
5158 technique = MTOI(technique);
5159 pass = MTOI(pass);
5160
5161 try
5162 {
5163 STechnique* matTechnique = material->GetTechnique(technique);
5164 if (matTechnique)
5165 {
5166 SPass* matPass = matTechnique->GetPass(pass);
5167 if (matPass)
5168 MMset(m, 0, ITOM(static_cast<int>(matPass->GetSceneBlendingOperationAlpha())));
5169 else
5170 MMset(m, 0, NIL);
5171 }
5172 else
5173 MMset(m, 0, NIL);
5174 }
5175 catch (Ogre::Exception& e)
5176 {
5177 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5178 MMset(m, 0, NIL);
5179 }
5180 return 0;
5181}
5182
5196{
5197#ifdef SO3_DEBUG
5198 MMechostr(MSKDEBUG, "SO3MaterialSetPassSceneBlendingOperation\n");
5199#endif
5200
5201 int scolOperation = MMpull(m);
5202 int scolOperationAlpha = MMpull(m);
5203 int pass = MMpull(m);
5204 int technique = MMpull(m);
5205 int mat = MMget(m, 0);
5206
5207 // Checking parameters.
5208 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5209 {
5210 MMset(m, 0, NIL);
5211 return 0;
5212 }
5213
5214 // Get the targeted SMaterial pointer
5215 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5216 if (material == 0)
5217 {
5218 MMset(m, 0, NIL);
5219 return 0;
5220 }
5221
5222 // Get other parameters
5223 technique = MTOI(technique);
5224 pass = MTOI(pass);
5225
5226 try
5227 {
5228 STechnique* matTechnique = material->GetTechnique(technique);
5229 if (matTechnique)
5230 {
5231 SPass* matPass = matTechnique->GetPass(pass);
5232 if (matPass)
5233 {
5234 // Ignore parameters setted to nil
5235 SPass::SceneBlendOperation operation;
5236 if (scolOperation == NIL)
5237 operation = matPass->GetSceneBlendingOperation();
5238 else
5239 operation = static_cast<SPass::SceneBlendOperation>(static_cast<int>(MTOI(scolOperation)));
5240
5241 SPass::SceneBlendOperation operationAlpha;
5242 if (scolOperationAlpha == NIL)
5243 operationAlpha = matPass->GetSceneBlendingOperationAlpha();
5244 else
5245 operationAlpha = static_cast<SPass::SceneBlendOperation>(static_cast<int>(MTOI(scolOperationAlpha)));
5246
5247 matPass->SetSceneBlendingOperation(operation, operationAlpha);
5248 MMset(m, 0, ITOM(1));
5249 }
5250 else
5251 MMset(m, 0, NIL);
5252 }
5253 else
5254 MMset(m, 0, NIL);
5255 }
5256 catch (Ogre::Exception& e)
5257 {
5258 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5259 MMset(m, 0, NIL);
5260 }
5261 return 0;
5262}
5263
5276{
5277#ifdef SO3_DEBUG
5278 MMechostr(MSKDEBUG, "SO3MaterialSetPassCullingEnable\n");
5279#endif
5280
5281 int bcull = MMpull(m);
5282 int pass = MMpull(m);
5283 int technique = MMpull(m);
5284 int mat = MMget(m, 0);
5285
5286 // Checking parameters.
5287 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5288 {
5289 MMset(m, 0, NIL);
5290 return 0;
5291 }
5292
5293 // Get the targeted SMaterial pointer
5294 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5295 if (material == 0)
5296 {
5297 MMset(m, 0, NIL);
5298 return 0;
5299 }
5300
5301 // Get other parameters
5302 technique = MTOI(technique);
5303 pass = MTOI(pass);
5304
5305 try
5306 {
5307 STechnique* matTechnique = material->GetTechnique(technique);
5308 if (matTechnique)
5309 {
5310 SPass* matPass = matTechnique->GetPass(pass);
5311 if (matPass)
5312 {
5313 matPass->SetCullingMode(((MTOI(bcull) > 0) ? true : false));
5314 MMset(m, 0, ITOM(1));
5315 }
5316 else
5317 MMset(m, 0, NIL);
5318 }
5319 else
5320 MMset(m, 0, NIL);
5321 }
5322 catch (Ogre::Exception& e)
5323 {
5324 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5325 MMset(m, 0, NIL);
5326 }
5327 return 0;
5328}
5329
5341{
5342#ifdef SO3_DEBUG
5343 MMechostr(MSKDEBUG, "SO3MaterialGetPassCullingEnable\n");
5344#endif
5345
5346 int pass = MMpull(m);
5347 int technique = MMpull(m);
5348 int mat = MMget(m, 0);
5349
5350 // Checking parameters.
5351 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5352 {
5353 MMset(m, 0, NIL);
5354 return 0;
5355 }
5356
5357 // Get the targeted SMaterial pointer
5358 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5359 if (material == 0)
5360 {
5361 MMset(m, 0, NIL);
5362 return 0;
5363 }
5364
5365 // Get other parameters
5366 technique = MTOI(technique);
5367 pass = MTOI(pass);
5368
5369 try
5370 {
5371 STechnique* matTechnique = material->GetTechnique(technique);
5372 if (matTechnique)
5373 {
5374 SPass* matPass = matTechnique->GetPass(pass);
5375 if (matPass)
5376 MMset(m, 0, ITOM(matPass->GetCullingMode() ? 1 : 0));
5377 else
5378 MMset(m, 0, NIL);
5379 }
5380 else
5381 MMset(m, 0, NIL);
5382 }
5383 catch (Ogre::Exception& e)
5384 {
5385 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5386 MMset(m, 0, NIL);
5387 }
5388 return 0;
5389}
5390
5391
5404{
5405#ifdef SO3_DEBUG
5406 MMechostr(MSKDEBUG, "SO3MaterialSetPassUseVertexColor\n");
5407#endif
5408
5409 int bstate = MMpull(m);
5410 int pass = MMpull(m);
5411 int technique = MMpull(m);
5412 int mat = MMget(m, 0);
5413
5414 // Checking parameters.
5415 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5416 {
5417 MMset(m, 0, NIL);
5418 return 0;
5419 }
5420
5421 // Get the targeted SMaterial pointer
5422 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5423 if (material == 0)
5424 {
5425 MMset(m, 0, NIL);
5426 return 0;
5427 }
5428
5429 // Get other parameters
5430 technique = MTOI(technique);
5431 pass = MTOI(pass);
5432
5433 try
5434 {
5435 STechnique* matTechnique = material->GetTechnique(technique);
5436 if (matTechnique)
5437 {
5438 SPass* matPass = matTechnique->GetPass(pass);
5439 if (matPass)
5440 {
5441 matPass->SetUseVertexColor(((MTOI(bstate) > 0) ? true : false));
5442 MMset(m, 0, ITOM(1));
5443 }
5444 else
5445 MMset(m, 0, NIL);
5446 }
5447 else
5448 MMset(m, 0, NIL);
5449 }
5450 catch (Ogre::Exception& e)
5451 {
5452 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5453 MMset(m, 0, NIL);
5454 }
5455 return 0;
5456}
5457
5469{
5470#ifdef SO3_DEBUG
5471 MMechostr(MSKDEBUG, "SO3MaterialGetPassUseVertexColor\n");
5472#endif
5473
5474 int pass = MMpull(m);
5475 int technique = MMpull(m);
5476 int mat = MMget(m, 0);
5477
5478 // Checking parameters.
5479 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5480 {
5481 MMset(m, 0, NIL);
5482 return 0;
5483 }
5484
5485 // Get the targeted SMaterial pointer
5486 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5487 if (material == 0)
5488 {
5489 MMset(m, 0, NIL);
5490 return 0;
5491 }
5492
5493 // Get other parameters
5494 technique = MTOI(technique);
5495 pass = MTOI(pass);
5496
5497 try
5498 {
5499 STechnique* matTechnique = material->GetTechnique(technique);
5500 if (matTechnique)
5501 {
5502 SPass* matPass = matTechnique->GetPass(pass);
5503 if (matPass)
5504 MMset(m, 0, ITOM(matPass->GetUseVertexColor() ? 1 : 0));
5505 else
5506 MMset(m, 0, NIL);
5507 }
5508 else
5509 MMset(m, 0, NIL);
5510 }
5511 catch (Ogre::Exception& e)
5512 {
5513 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5514 MMset(m, 0, NIL);
5515 }
5516 return 0;
5517}
5518
5528{
5529#ifdef SO3_DEBUG
5530 MMechostr(MSKDEBUG, "SO3MaterialAddTechnique\n");
5531#endif
5532
5533 int mat = MMget(m, 0);
5534
5535 // Checking parameters.
5536 if (mat == NIL)
5537 {
5538 MMset(m, 0, NIL);
5539 return 0;
5540 }
5541
5542 // Get the targeted SMaterial pointer
5543 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5544 if (material == 0)
5545 {
5546 MMset(m, 0, NIL);
5547 return 0;
5548 }
5549
5550 try
5551 {
5552 material->AddTechnique();
5553 MMset(m, 0, ITOM(1));
5554 }
5555 catch (Ogre::Exception& e)
5556 {
5557 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5558 MMset(m, 0, NIL);
5559 }
5560 return 0;
5561}
5562
5573{
5574#ifdef SO3_DEBUG
5575 MMechostr(MSKDEBUG, "SO3MaterialRemoveTechnique\n");
5576#endif
5577
5578 int tech = MMpull(m);
5579 int mat = MMget(m, 0);
5580
5581 // Checking parameters.
5582 if (mat == NIL || tech == NIL)
5583 {
5584 MMset(m, 0, NIL);
5585 return 0;
5586 }
5587
5588 // Get the targeted SMaterial pointer
5589 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5590 if (material == 0)
5591 {
5592 MMset(m, 0, NIL);
5593 return 0;
5594 }
5595
5596 try
5597 {
5598 material->RemoveTechnique(MTOI(tech));
5599 MMset(m, 0, ITOM(1));
5600 }
5601 catch (Ogre::Exception& e)
5602 {
5603 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5604 MMset(m, 0, NIL);
5605 }
5606 return 0;
5607}
5608
5620{
5621#ifdef SO3_DEBUG
5622 MMechostr(MSKDEBUG, "SO3MaterialSetTechniqueSchemeName\n");
5623#endif
5624
5625 int schem = MMpull(m);
5626 int tech = MMpull(m);
5627 int mat = MMget(m, 0);
5628
5629 // Checking parameters.
5630 if (mat == NIL || tech == NIL)
5631 {
5632 MMset(m, 0, NIL);
5633 return 0;
5634 }
5635
5636 std::string scheme = "";
5637 if (schem != NIL)
5638 scheme = MMstartstr(m, MTOP(schem));
5639
5640 // Get the targeted SMaterial pointer
5641 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5642 if (material == 0)
5643 {
5644 MMset(m, 0, NIL);
5645 return 0;
5646 }
5647
5648 try
5649 {
5650 STechnique* matTechnique = material->GetTechnique(MTOI(tech));
5651 if (matTechnique)
5652 matTechnique->SetSchemeName(scheme);
5653
5654 MMset(m, 0, ITOM(1));
5655 }
5656 catch (Ogre::Exception& e)
5657 {
5658 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5659 MMset(m, 0, NIL);
5660 }
5661 return 0;
5662}
5663
5673int SO3MaterialAddPass(mmachine m)
5674{
5675#ifdef SO3_DEBUG
5676 MMechostr(MSKDEBUG, "SO3MaterialAddPass\n");
5677#endif
5678
5679 int tech = MMpull(m);
5680 int mat = MMget(m, 0);
5681
5682 // Checking parameters.
5683 if (mat == NIL || tech == NIL)
5684 {
5685 MMset(m, 0, NIL);
5686 return 0;
5687 }
5688
5689 // Get the targeted SMaterial pointer
5690 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5691 if (material == 0)
5692 {
5693 MMset(m, 0, NIL);
5694 return 0;
5695 }
5696
5697 try
5698 {
5699 STechnique* matTechnique = material->GetTechnique(MTOI(tech));
5700 if (matTechnique)
5701 matTechnique->AddPass();
5702 MMset(m, 0, ITOM(1));
5703 }
5704 catch (Ogre::Exception& e)
5705 {
5706 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5707 MMset(m, 0, NIL);
5708 }
5709 return 0;
5710}
5711
5723{
5724#ifdef SO3_DEBUG
5725 MMechostr(MSKDEBUG, "SO3MaterialRemovePass\n");
5726#endif
5727
5728 int pass = MMpull(m);
5729 int tech = MMpull(m);
5730 int mat = MMget(m, 0);
5731
5732 // Checking parameters.
5733 if (mat == NIL || tech == NIL || pass == NIL)
5734 {
5735 MMset(m, 0, NIL);
5736 return 0;
5737 }
5738
5739 // Get the targeted SMaterial pointer
5740 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5741 if (material == 0)
5742 {
5743 MMset(m, 0, NIL);
5744 return 0;
5745 }
5746
5747 try
5748 {
5749 STechnique* matTechnique = material->GetTechnique(MTOI(tech));
5750 if (matTechnique)
5751 matTechnique->RemovePass(MTOI(pass));
5752 MMset(m, 0, ITOM(1));
5753 }
5754 catch (Ogre::Exception& e)
5755 {
5756 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5757 MMset(m, 0, NIL);
5758 }
5759 return 0;
5760}
5761
5774{
5775#ifdef SO3_DEBUG
5776 MMechostr(MSKDEBUG, "SO3MaterialSetPassPolygonMode\n");
5777#endif
5778
5779 int imode = MMpull(m);
5780 int pass = MMpull(m);
5781 int technique = MMpull(m);
5782 int mat = MMget(m, 0);
5783
5784 // Checking parameters.
5785 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5786 {
5787 MMset(m, 0, NIL);
5788 return 0;
5789 }
5790
5791 // Get the targeted SMaterial pointer
5792 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5793 if (material == 0)
5794 {
5795 MMset(m, 0, NIL);
5796 return 0;
5797 }
5798
5799 // Get other parameters
5800 technique = MTOI(technique);
5801 pass = MTOI(pass);
5802
5803 SPass::PolygonMode pmode = SPass::SO3_POLYGONMODE_SOLID;
5804 if (imode != NIL)
5805 pmode = (SPass::PolygonMode)(MTOI(imode));
5806
5807 try
5808 {
5809 STechnique* matTechnique = material->GetTechnique(technique);
5810 if (matTechnique)
5811 {
5812 SPass* matPass = matTechnique->GetPass(pass);
5813 if (matPass)
5814 {
5815 matPass->SetPolygonMode(pmode);
5816 MMset(m, 0, ITOM(1));
5817 }
5818 else
5819 MMset(m, 0, NIL);
5820 }
5821 else
5822 MMset(m, 0, NIL);
5823 }
5824 catch (Ogre::Exception& e)
5825 {
5826 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5827 MMset(m, 0, NIL);
5828 }
5829 return 0;
5830}
5831
5843{
5844#ifdef SO3_DEBUG
5845 MMechostr(MSKDEBUG, "SO3MaterialGetPassPolygonMode\n");
5846#endif
5847
5848 int pass = MMpull(m);
5849 int technique = MMpull(m);
5850 int mat = MMget(m, 0);
5851
5852 // Checking parameters.
5853 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5854 {
5855 MMset(m, 0, NIL);
5856 return 0;
5857 }
5858
5859 // Get the targeted SMaterial pointer
5860 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5861 if (material == 0)
5862 {
5863 MMset(m, 0, NIL);
5864 return 0;
5865 }
5866
5867 // Get other parameters
5868 technique = MTOI(technique);
5869 pass = MTOI(pass);
5870
5871 try
5872 {
5873 STechnique* matTechnique = material->GetTechnique(technique);
5874 if (matTechnique)
5875 {
5876 SPass* matPass = matTechnique->GetPass(pass);
5877 if (matPass)
5878 {
5879 MMset(m, 0, ITOM(matPass->GetPolygonMode()));
5880 }
5881 else
5882 MMset(m, 0, NIL);
5883 }
5884 else
5885 MMset(m, 0, NIL);
5886 }
5887 catch (Ogre::Exception& e)
5888 {
5889 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5890 MMset(m, 0, NIL);
5891 }
5892 return 0;
5893}
5894
5907{
5908#ifdef SO3_DEBUG
5909 MMechostr(MSKDEBUG, "SO3MaterialSetPassPointSize\n");
5910#endif
5911
5912 int isize = MMpull(m);
5913 int pass = MMpull(m);
5914 int technique = MMpull(m);
5915 int mat = MMget(m, 0);
5916
5917 // Checking parameters.
5918 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5919 {
5920 MMset(m, 0, NIL);
5921 return 0;
5922 }
5923
5924 // Get the targeted SMaterial pointer
5925 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5926 if (material == 0)
5927 {
5928 MMset(m, 0, NIL);
5929 return 0;
5930 }
5931
5932 // Get other parameters
5933 technique = MTOI(technique);
5934 pass = MTOI(pass);
5935
5936 float fsize = 1.0F;
5937 if (isize != NIL)
5938 fsize = MTOF(isize);
5939
5940 try
5941 {
5942 STechnique* matTechnique = material->GetTechnique(technique);
5943 if (matTechnique)
5944 {
5945 SPass* matPass = matTechnique->GetPass(pass);
5946 if (matPass)
5947 {
5948 matPass->SetPointSize(fsize);
5949 MMset(m, 0, ITOM(1));
5950 }
5951 else
5952 MMset(m, 0, NIL);
5953 }
5954 else
5955 MMset(m, 0, NIL);
5956 }
5957 catch (Ogre::Exception& e)
5958 {
5959 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
5960 MMset(m, 0, NIL);
5961 }
5962 return 0;
5963}
5964
5976{
5977#ifdef SO3_DEBUG
5978 MMechostr(MSKDEBUG, "SO3MaterialGetPassPointSize\n");
5979#endif
5980
5981 int pass = MMpull(m);
5982 int technique = MMpull(m);
5983 int mat = MMget(m, 0);
5984
5985 // Checking parameters.
5986 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
5987 {
5988 MMset(m, 0, NIL);
5989 return 0;
5990 }
5991
5992 // Get the targeted SMaterial pointer
5993 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
5994 if (material == 0)
5995 {
5996 MMset(m, 0, NIL);
5997 return 0;
5998 }
5999
6000 // Get other parameters
6001 technique = MTOI(technique);
6002 pass = MTOI(pass);
6003
6004 try
6005 {
6006 STechnique* matTechnique = material->GetTechnique(technique);
6007 if (matTechnique)
6008 {
6009 SPass* matPass = matTechnique->GetPass(pass);
6010 if (matPass)
6011 {
6012 MMset(m, 0, FTOM(matPass->GetPointSize()));
6013 }
6014 else
6015 MMset(m, 0, NIL);
6016 }
6017 else
6018 MMset(m, 0, NIL);
6019 }
6020 catch (Ogre::Exception& e)
6021 {
6022 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
6023 MMset(m, 0, NIL);
6024 }
6025 return 0;
6026}
6027
6028
6041{
6042#ifdef SO3_DEBUG
6043 MMechostr(MSKDEBUG, "SO3MaterialSetPassLighting\n");
6044#endif
6045
6046 int istate = MMpull(m);
6047 int pass = MMpull(m);
6048 int technique = MMpull(m);
6049 int mat = MMget(m, 0);
6050
6051 // Checking parameters.
6052 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
6053 {
6054 MMset(m, 0, NIL);
6055 return 0;
6056 }
6057
6058 // Get the targeted SMaterial pointer
6059 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
6060 if (material == 0)
6061 {
6062 MMset(m, 0, NIL);
6063 return 0;
6064 }
6065
6066 // Get other parameters
6067 technique = MTOI(technique);
6068 pass = MTOI(pass);
6069
6070 bool state = false;
6071 if ((istate != NIL) && (MTOI(istate) > 0))
6072 state = true;
6073
6074 try
6075 {
6076 STechnique* matTechnique = material->GetTechnique(technique);
6077 if (matTechnique)
6078 {
6079 SPass* matPass = matTechnique->GetPass(pass);
6080 if (matPass)
6081 {
6082 matPass->SetLightingEnabled(state);
6083 MMset(m, 0, ITOM(1));
6084 }
6085 else
6086 MMset(m, 0, NIL);
6087 }
6088 else
6089 MMset(m, 0, NIL);
6090 }
6091 catch (Ogre::Exception& e)
6092 {
6093 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
6094 MMset(m, 0, NIL);
6095 }
6096 return 0;
6097}
6098
6110{
6111#ifdef SO3_DEBUG
6112 MMechostr(MSKDEBUG, "SO3MaterialGetPassLighting\n");
6113#endif
6114
6115 int pass = MMpull(m);
6116 int technique = MMpull(m);
6117 int mat = MMget(m, 0);
6118
6119 // Checking parameters.
6120 if ((mat == NIL) || (technique == NIL) || (pass == NIL))
6121 {
6122 MMset(m, 0, NIL);
6123 return 0;
6124 }
6125
6126 // Get the targeted SMaterial pointer
6127 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
6128 if (material == 0)
6129 {
6130 MMset(m, 0, NIL);
6131 return 0;
6132 }
6133
6134 // Get other parameters
6135 technique = MTOI(technique);
6136 pass = MTOI(pass);
6137
6138 try
6139 {
6140 STechnique* matTechnique = material->GetTechnique(technique);
6141 if (matTechnique)
6142 {
6143 SPass* matPass = matTechnique->GetPass(pass);
6144 if (matPass)
6145 {
6146 MMset(m, 0, ITOM(matPass->GetLightingEnabled() ? 1 : 0));
6147 }
6148 else
6149 MMset(m, 0, NIL);
6150 }
6151 else
6152 MMset(m, 0, NIL);
6153 }
6154 catch (Ogre::Exception& e)
6155 {
6156 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
6157 MMset(m, 0, NIL);
6158 }
6159 return 0;
6160}
6161
6162
6173{
6174#ifdef SO3_DEBUG
6175 MMechostr(MSKDEBUG, "SO3MaterialSetIgnoreSlicePlane\n");
6176#endif
6177
6178 int istate = MMpull(m);
6179 int mat = MMget(m, 0);
6180
6181 // Checking parameters.
6182 if (mat == NIL)
6183 {
6184 MMset(m, 0, NIL);
6185 return 0;
6186 }
6187
6188 // Get the targeted SMaterial pointer
6189 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
6190 if (material == 0)
6191 {
6192 MMset(m, 0, NIL);
6193 return 0;
6194 }
6195
6196 bool state = false;
6197 if ((istate != NIL) && (MTOI(istate) > 0))
6198 state = true;
6199
6200 try
6201 {
6202 material->SetIgnoreSlicePlane(state);
6203 MMset(m, 0, ITOM(1));
6204 }
6205 catch (Ogre::Exception& e)
6206 {
6207 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
6208 MMset(m, 0, NIL);
6209 }
6210 return 0;
6211}
6212
6222int SO3MaterialExport(mmachine m)
6223{
6224#ifdef SO3_DEBUG
6225 MMechostr(MSKDEBUG, "SO3MaterialExport\n");
6226#endif
6227
6228 int ipath = MMpull(m);
6229 int mat = MMget(m, 0);
6230
6231 // Checking parameters.
6232 if (mat == NIL)
6233 {
6234 MMset(m, 0, NIL);
6235 return 0;
6236 }
6237
6238 // Get the targeted SMaterial pointer
6239 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
6240 if (material == 0)
6241 {
6242 MMset(m, 0, NIL);
6243 return 0;
6244 }
6245
6246 //use boost file path to be sure we have the same path format as ogre
6247 boost::filesystem::path spath;
6248 if (ipath != NIL)
6249 spath = MMstartstr(m, MTOP(ipath));
6250
6251 try
6252 {
6253 material->WriteMaterialFile(spath.generic_string());
6254 MMset(m, 0, ITOM(1));
6255 }
6256 catch (Ogre::Exception& e)
6257 {
6258 MMechostr(MSKRUNTIME, "An exception has occurred: %s\n", e.what());
6259 MMset(m, 0, NIL);
6260 }
6261 return 0;
6262}
6263
6264
6274{
6275#ifdef SO3_DEBUG
6276 MMechostr(MSKDEBUG, "SO3MaterialGetScriptPath\n");
6277#endif
6278
6279 int mat = MMget(m, 0);
6280
6281 // Checking parameters.
6282 if (mat == NIL)
6283 {
6284 MMset(m, 0, NIL);
6285 return 0;
6286 }
6287
6288 // Get the targeted SMaterial pointer
6289 SMaterial* material = MMgetPointer<SMaterial*>(m, MTOP(mat));
6290 if (material == 0)
6291 {
6292 MMset(m, 0, NIL);
6293 return 0;
6294 }
6295
6296 std::string path = material->getOgreMaterialPointer()->getOrigin();
6297 if (path.empty())
6298 {
6299 MMset(m, 0, NIL);
6300 return 0;
6301 }
6302
6303 MMpull(m);
6304 Mpushstrbloc(m, (char*)path.c_str());
6305
6306 return 0;
6307}
6308
6318{
6319#ifdef SO3_DEBUG
6320 MMechostr(MSKDEBUG, "SO3MaterialCountInScript\n");
6321#endif
6322
6323 int ipath = MMget(m, 0);
6324
6325 // Checking parameters.
6326 if (ipath == NIL)
6327 {
6328 MMset(m, 0, NIL);
6329 return 0;
6330 }
6331
6332 //use boost file path to be sure we have the same path format as ogre
6333 boost::filesystem::path spath;
6334 if (ipath != NIL)
6335 spath = MMstartstr(m, MTOP(ipath));
6336
6337 if (spath.empty())
6338 {
6339 MMset(m, 0, NIL);
6340 return 0;
6341 }
6342
6343 int numMats = SMaterial::CountMaterialsInScript(spath.generic_string());
6344
6345 MMset(m, 0, ITOM(numMats));
6346
6347 return 0;
6348}
6349
6359{
6360#ifdef SO3_DEBUG
6361 MMechostr(MSKDEBUG, "SO3MaterialRewriteScript\n");
6362#endif
6363
6364 int ipath = MMget(m, 0);
6365
6366 // Checking parameters.
6367 if (ipath == NIL)
6368 {
6369 MMset(m, 0, NIL);
6370 return 0;
6371 }
6372
6373 //use boost file path to be sure we have the same path format as ogre
6374 boost::filesystem::path spath;
6375 if (ipath != NIL)
6376 spath = MMstartstr(m, MTOP(ipath));
6377
6378 if (spath.empty())
6379 {
6380 MMset(m, 0, NIL);
6381 return 0;
6382 }
6383
6384 SMaterial::UpdateMaterialScript(spath.generic_string());
6385
6386 MMset(m, 0, ITOM(1));
6387
6388 return 0;
6389}
6390
6391
6392NativeDefinition natSO3Mat[] = {
6393 { "SO3_MAP_AMBIENT", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_AMBIENT) },
6394 { "SO3_MAP_DIFFUSE", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_DIFFUSE) },
6395 { "SO3_MAP_SPECULAR", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_SPECULAR) },
6396 { "SO3_MAP_EMISSIVE", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_EMISSIVE) },
6397 { "SO3_MAP_NORMAL", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_NORMAL) },
6398 { "SO3_MAP_REFLECTION", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_REFLECTION) },
6399 { "SO3_MAP_REFMASK", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_REFMASK) },
6400 { "SO3_MAP_ROUGHNESS", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_ROUGHNESS) },
6401 { "SO3_MAP_OPACITY", TYPVAR, "I", SCOL_TYPTYPE(SShaderGenerator::MAP_OPACITY) },
6402 { "SO3_POLYGONMODE_POINTS", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_POLYGONMODE_POINTS) },
6403 { "SO3_POLYGONMODE_WIREFRAME", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_POLYGONMODE_WIREFRAME) },
6404 { "SO3_POLYGONMODE_SOLID", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_POLYGONMODE_SOLID) },
6405 { "SO3_COMPARE_FUNCTION_ALWAYS_FAIL", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_ALWAYS_FAIL) },
6406 { "SO3_COMPARE_FUNCTION_ALWAYS_PASS", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_ALWAYS_PASS) },
6407 { "SO3_COMPARE_FUNCTION_LESS", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_LESS) },
6408 { "SO3_COMPARE_FUNCTION_LESS_EQUAL", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_LESS_EQUAL) },
6409 { "SO3_COMPARE_FUNCTION_EQUAL", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_EQUAL) },
6410 { "SO3_COMPARE_FUNCTION_NOT_EQUAL", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_NOT_EQUAL) },
6411 { "SO3_COMPARE_FUNCTION_GREATER_EQUAL", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_GREATER_EQUAL) },
6412 { "SO3_COMPARE_FUNCTION_GREATER", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_COMPARE_FUNCTION_GREATER) },
6413 { "SO3_SCENE_BLEND_OPERATION_ADD", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_OPERATION_ADD) },
6414 { "SO3_SCENE_BLEND_OPERATION_SUBTRACT", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_OPERATION_SUBTRACT) },
6415 { "SO3_SCENE_BLEND_OPERATION_REVERSE_SUBTRACT", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_OPERATION_REVERSE_SUBTRACT) },
6416 { "SO3_SCENE_BLEND_OPERATION_MIN", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_OPERATION_MIN) },
6417 { "SO3_SCENE_BLEND_OPERATION_MAX", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_OPERATION_MAX) },
6418 { "SO3_SCENE_BLEND_FACTOR_ONE", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_ONE) },
6419 { "SO3_SCENE_BLEND_FACTOR_ZERO", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_ZERO) },
6420 { "SO3_SCENE_BLEND_FACTOR_DEST_COLOUR", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_DEST_COLOUR) },
6421 { "SO3_SCENE_BLEND_FACTOR_SOURCE_COLOUR", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_SOURCE_COLOUR) },
6422 { "SO3_SCENE_BLEND_FACTOR_ONE_MINUS_DEST_COLOUR", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_ONE_MINUS_DEST_COLOUR) },
6423 { "SO3_SCENE_BLEND_FACTOR_ONE_MINUS_SOURCE_COLOUR", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_ONE_MINUS_SOURCE_COLOUR) },
6424 { "SO3_SCENE_BLEND_FACTOR_DEST_ALPHA", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_DEST_ALPHA) },
6425 { "SO3_SCENE_BLEND_FACTOR_SOURCE_ALPHA", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_SOURCE_ALPHA) },
6426 { "SO3_SCENE_BLEND_FACTOR_ONE_MINUS_DEST_ALPHA", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_ONE_MINUS_DEST_ALPHA) },
6427 { "SO3_SCENE_BLEND_FACTOR_ONE_MINUS_SOURCE_ALPHA", TYPVAR, "I", SCOL_TYPTYPE(SPass::SO3_SCENE_BLEND_FACTOR_ONE_MINUS_SOURCE_ALPHA) },
6428 { "SO3MaterialCreate", 3, "fun [SO3_SCENE S S] SO3_MATERIAL", SO3MaterialCreate },
6429 { "SO3MaterialDestroy", 1, "fun [SO3_MATERIAL] I", SO3MaterialDestroy },
6430 { "SO3MaterialGetName", 1, "fun [SO3_MATERIAL] S", SO3MaterialGetName },
6431 { "SO3MaterialSetAmbient", 2, "fun [SO3_MATERIAL I] I", SO3MaterialSetAmbient },
6432 { "SO3MaterialSetAmbientByTechAndPass", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetAmbientByTechAndPass },
6433 { "SO3MaterialSetDiffuse", 2, "fun [SO3_MATERIAL I] I", SO3MaterialSetDiffuse },
6434 { "SO3MaterialSetDiffuseByTechAndPass", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetDiffuseByTechAndPass },
6435 { "SO3MaterialGetReceiveShadows", 1, "fun [SO3_MATERIAL] I", SO3MaterialGetReceiveShadows },
6436 { "SO3MaterialSetSelfIllumination", 2, "fun [SO3_MATERIAL I] I", SO3MaterialSetSelfIllumination },
6437 { "SO3MaterialSetSelfIlluminationByTechAndPass", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetSelfIlluminationByTechAndPass },
6438 { "SO3MaterialSetSpecular", 2, "fun [SO3_MATERIAL I] I", SO3MaterialSetSpecular },
6439 { "SO3MaterialSetSpecularByTechAndPass", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetSpecularByTechAndPass },
6440 { "SO3MaterialSetShininess", 2, "fun [SO3_MATERIAL F] I", SO3MaterialSetShininess },
6441 { "SO3MaterialSetShininessByTechAndPass", 4, "fun [SO3_MATERIAL I I F] I", SO3MaterialSetShininessByTechAndPass },
6442 { "SO3MaterialGetDiffuseByTechAndPass", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetDiffuseByTechAndPass },
6443 { "SO3MaterialGetAmbientByTechAndPass", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetAmbientByTechAndPass },
6444 { "SO3MaterialGetSpecularByTechAndPass", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetSpecularByTechAndPass },
6445 { "SO3MaterialGetShininessByTechAndPass", 3, "fun [SO3_MATERIAL I I] F", SO3MaterialGetShininessByTechAndPass },
6446 { "SO3MaterialGetSelfIlluminationByTechAndPass", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetSelfIlluminationByTechAndPass },
6447 { "SO3MaterialIsLighting", 2, "fun [SO3_MATERIAL I] I", SO3MaterialIsLighting },
6448 { "SO3MaterialNumberOfTechniques", 1, "fun [SO3_MATERIAL] I", SO3MaterialNumberOfTechniques },
6449 { "SO3MaterialNumberOfPassesByTechnique", 2, "fun [SO3_MATERIAL I] I", SO3MaterialNumberOfPassesByTechnique },
6450 { "SO3MaterialNumberOfTexturesByTechniqueAndPass", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialNumberOfTexturesByTechniqueAndPass },
6451 { "SO3MaterialTechniqueGetNameByIndex", 2, "fun [SO3_MATERIAL I] S", SO3MaterialTechniqueGetNameByIndex },
6452 { "SO3MaterialTechniqueGetIndexByName", 2, "fun [SO3_MATERIAL S] I", SO3MaterialTechniqueGetIndexByName },
6453 { "SO3MaterialPassGetNameByIndex", 3, "fun [SO3_MATERIAL I I] S", SO3MaterialPassGetNameByIndex },
6454 { "SO3MaterialPassGetIndexByName", 3, "fun [SO3_MATERIAL I S] I", SO3MaterialPassGetIndexByName },
6455 { "SO3MaterialTextureUnitGetNameByIndex", 4, "fun [SO3_MATERIAL I I I] S", SO3MaterialTextureUnitGetNameByIndex },
6456 { "SO3MaterialTextureUnitGetIndexByName", 4, "fun [SO3_MATERIAL I I S] I", SO3MaterialTextureUnitGetIndexByName },
6457 { "SO3MaterialSetReceiveShadows", 2, "fun [SO3_MATERIAL I] I", SO3MaterialSetReceiveShadows },
6458 { "SO3MaterialSetTexture", 5, "fun [SO3_MATERIAL SO3_TEXTURE I I I] I", SO3MaterialSetTexture },
6459 { "SO3MaterialGetTexture", 4, "fun [SO3_MATERIAL I I I] SO3_TEXTURE", SO3MaterialGetTexture },
6460 { "SO3MaterialSetTextureByType", 5, "fun [SO3_MATERIAL SO3_TEXTURE I I I] I", SO3MaterialSetTextureByType },
6461 { "SO3MaterialRemoveTexture", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialRemoveTexture },
6462 { "SO3MaterialTextureUnitGetIndexByType", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialTextureUnitGetIndexByType },
6463 { "SO3GetSceneTexture", 3, "fun [SO3_SCENE S S] SO3_TEXTURE", SO3GetSceneTexture },
6464 { "SO3TextureCreate", 6, "fun [SO3_SCENE S P S I I] SO3_TEXTURE", SO3TextureCreate },
6465 { "SO3TextureDestroy", 1, "fun [SO3_TEXTURE] I", SO3TextureDestroy },
6466 { "SO3TextureGetName", 1, "fun [SO3_TEXTURE] S", SO3TextureGetName },
6467 { "SO3TextureManagerGetMemoryUsage", 1, "fun [SO3_SCENE] I", SO3TextureManagerGetMemoryUsage },
6468 { "SO3TextureBlit", 2, "fun [SO3_TEXTURE ObjBitmap] I", SO3TextureBlit },
6469 { "SO3TextureBlitAlpha", 2, "fun [SO3_TEXTURE AlphaBitmap] I", SO3TextureBlitAlpha },
6470 { "SO3MaterialSetTextureUScroll", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureUScroll },
6471 { "SO3MaterialGetTextureUScroll", 4, "fun [SO3_MATERIAL I I I] F", SO3MaterialGetTextureUScroll },
6472 { "SO3MaterialSetTextureVScroll", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureVScroll },
6473 { "SO3MaterialGetTextureVScroll", 4, "fun [SO3_MATERIAL I I I] F", SO3MaterialGetTextureVScroll },
6474 { "SO3MaterialSetTextureUScale", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureUScale },
6475 { "SO3MaterialGetTextureUScale", 4, "fun [SO3_MATERIAL I I I] F", SO3MaterialGetTextureUScale },
6476 { "SO3MaterialSetTextureVScale", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureVScale },
6477 { "SO3MaterialGetTextureVScale", 4, "fun [SO3_MATERIAL I I I] F", SO3MaterialGetTextureVScale },
6478 { "SO3MaterialSetTextureRotate", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureRotate },
6479 { "SO3MaterialGetTextureRotate", 4, "fun [SO3_MATERIAL I I I] F", SO3MaterialGetTextureRotate },
6480 { "SO3MaterialSetTextureBlendFactor", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureBlendFactor },
6481 { "SO3MaterialGetTextureBlendFactor", 4, "fun [SO3_MATERIAL I I I] F", SO3MaterialGetTextureBlendFactor },
6482 { "SO3MaterialSetTextureRotateAnimation", 5, "fun [SO3_MATERIAL I I I F] I", SO3MaterialSetTextureRotateAnimation },
6483 { "SO3MaterialSetTextureScrollAnimation", 6, "fun [SO3_MATERIAL I I I F F] I", SO3MaterialSetTextureScrollAnimation },
6484 { "SO3MaterialGetPassVertexProgramParameters", 3, "fun [SO3_MATERIAL I I] [[S I] r1]", SO3MaterialGetPassVertexProgramParameters },
6485 { "SO3MaterialSetPassVertexProgramAutoParameter", 6, "fun [SO3_MATERIAL I I S I I] I", SO3MaterialSetPassVertexProgramAutoParameter },
6486 { "SO3MaterialSetPassVertexProgramParameter", 5, "fun [SO3_MATERIAL I I S S] I", SO3MaterialSetPassVertexProgramParameter },
6487 { "SO3MaterialGetPassFragmentProgramParameters", 3, "fun [SO3_MATERIAL I I] [[S I] r1]", SO3MaterialGetPassFragmentProgramParameters },
6488 { "SO3MaterialSetPassFragmentProgramAutoParameter", 6, "fun [SO3_MATERIAL I I S I I] I", SO3MaterialSetPassFragmentProgramAutoParameter },
6489 { "SO3MaterialSetPassFragmentProgramParameter", 5, "fun [SO3_MATERIAL I I S S] I", SO3MaterialSetPassFragmentProgramParameter },
6490 { "SO3MaterialSetPassAlphaRejection", 6, "fun [SO3_MATERIAL I I I I I] I", SO3MaterialSetPassAlphaRejection },
6491 { "SO3MaterialGetPassAlphaRejectionFunction", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassAlphaRejectionFunction },
6492 { "SO3MaterialGetPassAlphaRejectionValue", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassAlphaRejectionValue },
6493 { "SO3MaterialGetPassAlphaToCoverage", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassAlphaToCoverage },
6494 { "SO3MaterialGetPassDepthCheckEnabled", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassDepthCheckEnabled },
6495 { "SO3MaterialSetPassDepthCheckEnabled", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassDepthCheckEnabled },
6496 { "SO3MaterialGetPassDepthWriteEnabled", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassDepthWriteEnabled },
6497 { "SO3MaterialSetPassDepthWriteEnabled", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassDepthWriteEnabled },
6498 { "SO3MaterialGetPassDepthFunction", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassDepthFunction },
6499 { "SO3MaterialSetPassDepthFunction", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassDepthFunction },
6500 { "SO3MaterialGetPassColourWriteEnabled", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassColourWriteEnabled },
6501 { "SO3MaterialSetPassColourWriteEnabled", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassColourWriteEnabled },
6502 { "SO3MaterialGetPassSourceBlendFactor", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassSourceBlendFactor },
6503 { "SO3MaterialGetPassDestBlendFactor", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassDestBlendFactor },
6504 { "SO3MaterialGetPassSourceBlendFactorAlpha", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassSourceBlendFactorAlpha },
6505 { "SO3MaterialGetPassDestBlendFactorAlpha", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassDestBlendFactorAlpha },
6506 { "SO3MaterialSetPassSceneBlending", 7, "fun [SO3_MATERIAL I I I I I I] I", SO3MaterialSetPassSceneBlending },
6507 { "SO3MaterialGetPassSceneBlendingOperation", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassSceneBlendingOperation },
6508 { "SO3MaterialGetPassSceneBlendingOperationAlpha", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassSceneBlendingOperationAlpha },
6509 { "SO3MaterialSetPassSceneBlendingOperation", 5, "fun [SO3_MATERIAL I I I I] I", SO3MaterialSetPassSceneBlendingOperation },
6510 { "SO3MaterialSetPassCullingEnable", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassCullingEnable },
6511 { "SO3MaterialGetPassCullingEnable", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassCullingEnable },
6512 { "SO3MaterialSetPassUseVertexColor", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassUseVertexColor },
6513 { "SO3MaterialGetPassUseVertexColor", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassUseVertexColor },
6514 { "SO3MaterialAddTechnique", 1, "fun [SO3_MATERIAL] I", SO3MaterialAddTechnique },
6515 { "SO3MaterialRemoveTechnique", 2, "fun [SO3_MATERIAL I] I", SO3MaterialRemoveTechnique },
6516 { "SO3MaterialSetTechniqueSchemeName", 3, "fun [SO3_MATERIAL I S] I", SO3MaterialSetTechniqueSchemeName },
6517 { "SO3MaterialAddPass", 2, "fun [SO3_MATERIAL I] I", SO3MaterialAddPass },
6518 { "SO3MaterialRemovePass", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialRemovePass },
6519 { "SO3MaterialSetPassPolygonMode", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassPolygonMode },
6520 { "SO3MaterialGetPassPolygonMode", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassPolygonMode },
6521 { "SO3MaterialSetPassPointSize", 4, "fun [SO3_MATERIAL I I F] I", SO3MaterialSetPassPointSize },
6522 { "SO3MaterialGetPassPointSize", 3, "fun [SO3_MATERIAL I I] F", SO3MaterialGetPassPointSize },
6523 { "SO3MaterialSetPassLighting", 4, "fun [SO3_MATERIAL I I I] I", SO3MaterialSetPassLighting },
6524 { "SO3MaterialGetPassLighting", 3, "fun [SO3_MATERIAL I I] I", SO3MaterialGetPassLighting },
6525 { "SO3MaterialExport", 2, "fun [SO3_MATERIAL P] I", SO3MaterialExport },
6526 { "SO3MaterialGetScriptPath", 1, "fun [SO3_MATERIAL] P", SO3MaterialGetScriptPath },
6527 { "SO3MaterialSetIgnoreSlicePlane", 2, "fun [SO3_MATERIAL I] I", SO3MaterialSetIgnoreSlicePlane },
6528 { "SO3MaterialCountInScript", 1, "fun [P] I", SO3MaterialCountInScript },
6529 { "SO3MaterialRewriteScript", 1, "fun [P] I", SO3MaterialRewriteScript }
6530};
6531
6532
6538int SCOLloadMaterial(mmachine m, cbmachine w)
6539{
6540 return PKhardpak2(m, "SO3Mat.pkg", sizeof(natSO3Mat) / sizeof(natSO3Mat[0]), natSO3Mat);
6541}
6542
6543
6549{
6550 return 0;
6551}
6552
int SCOLloadMaterial(mmachine m, cbmachine w)
Load the SO3Engine Viewport function.
int SO3MaterialSetPassFragmentProgramParameter(mmachine m)
int SCOLfreeMaterial()
free the SO3Engine Viewport function
NativeDefinition natSO3Mat[]
int SO3MaterialSetPassVertexProgramParameter(mmachine m)
int SO3MaterialSetPassVertexProgramAutoParameter(mmachine m)
int SO3MaterialSetPassFragmentProgramAutoParameter(mmachine m)
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
Definition SO3SCOL.cpp:5150
int createTexture(mmachine m, STexture *curTexture, SScene *curScene)
int SO3MATERIAL
Definition SO3SCOL.cpp:97
int createMaterial(mmachine m, SMaterial *curMaterial, SScene *curScene)
int SO3TEXTURE
Definition SO3SCOL.cpp:98
Base class for SO3 custom exception.
virtual const std::string & GetFullDescription() const
int SO3MaterialSetAmbient(mmachine m)
SO3MaterialSetAmbient : defines ambient color of a material.
int SO3MaterialSetTextureVScroll(mmachine m)
SO3MaterialSetTextureVScroll : Sets the translation offset of the texture, ie scrolls the texture,...
int SO3MaterialSetTechniqueSchemeName(mmachine m)
SO3MaterialSetTechniqueSchemeName : Set a technique scheme name on a material.
int SO3MaterialSetTextureScrollAnimation(mmachine m)
SO3MaterialSetTextureScrollAnimation : Set a scroll animation on the texture.
int SO3TextureDestroy(mmachine m)
SO3TextureDestroy : Destroy a texture unit.
int SO3MaterialSetDiffuse(mmachine m)
SO3MaterialSetDiffuse : defines diffuse color of a material.
int SO3GetSceneTexture(mmachine m)
SO3GetSceneTexture : Get a texture from a scene.
int SO3MaterialSetAmbientByTechAndPass(mmachine m)
SO3MaterialSetAmbientByTechAndPass : defines ambient color by technique and pass of a material.
int SO3MaterialTextureUnitGetNameByIndex(mmachine m)
SO3MaterialTextureUnitGetNameByIndex : return the name of a texture unit.
int SO3MaterialSetPassLighting(mmachine m)
SO3MaterialSetPassLighting : Sets pass lighting state.
int SO3MaterialGetPassVertexProgramParameters(mmachine m)
SO3MaterialGetPassVertexProgramParameters : Retrieve all the vertex program parameters than can be se...
int SO3MaterialSetSelfIllumination(mmachine m)
SO3MaterialSetSelfIllumination : defines self illuminaton color of a material.
int SO3MaterialTextureUnitGetIndexByType(mmachine m)
SO3MaterialTextureUnitGetIndexByType : Get a texture from a material by it's type.
int SO3MaterialSetPassDepthWriteEnabled(mmachine m)
SO3MaterialSetPassDepthWriteEnabled : Set if the pass must write a validated fragment depth informati...
int SO3MaterialSetShininessByTechAndPass(mmachine m)
SO3MaterialSetShininessByTechAndPass : defines shininess value by technique and pass of a material.
int SO3MaterialTechniqueGetIndexByName(mmachine m)
SO3MaterialTechniqueGetIndexByName : return the index of a technique by name.
int SO3TextureBlit(mmachine m)
SO3TextureBlit : Blit a ObjBitmap on a texture.
int SO3TextureCreate(mmachine m)
SO3TextureCreate : Create a texture unit.
int SO3MaterialGetPassLighting(mmachine m)
SO3MaterialGetPassLighting : Get pass lighting state.
int SO3MaterialCreate(mmachine m)
main include
int SO3MaterialSetTextureRotateAnimation(mmachine m)
SO3MaterialSetTextureRotateAnimation : Set a rotate animation on the texture.
int SO3TextureBlitAlpha(mmachine m)
SO3TextureBlitAlpha : Blit a AlphaBitmap on a texture.
int SO3MaterialNumberOfTechniques(mmachine m)
SO3MaterialNumberOfTechniques : Get the number of techniques.
int SO3MaterialAddTechnique(mmachine m)
SO3MaterialAddTechnique : Add a technique on a material.
int SO3MaterialDestroy(mmachine m)
SO3MaterialDestroy : Destroy a material.
int SO3MaterialGetPassDestBlendFactor(mmachine m)
SO3MaterialGetPassDestBlendFactor : Retrieve pass destination blend factor.
int SO3MaterialNumberOfTexturesByTechniqueAndPass(mmachine m)
SO3MaterialNumberOfTexturesByTechniqueAndPass : Get the number of textures by technique and pass.
int SO3MaterialPassGetNameByIndex(mmachine m)
SO3MaterialPassGetNameByIndex : return the name of a pass.
int SO3MaterialSetPassDepthCheckEnabled(mmachine m)
SO3MaterialSetPassDepthCheckEnabled : Set if the pass must check depth to validate fragments.
int SO3MaterialGetPassAlphaRejectionFunction(mmachine m)
SO3MaterialGetPassAlphaRejectionFunction : Retrieve the alpha rejection function.
int SO3MaterialGetPassUseVertexColor(mmachine m)
SO3MaterialGetPassUseVertexColor : Gets pass vertex color state.
int SO3MaterialGetName(mmachine m)
SO3MaterialGetName : Return the material name.
int SO3MaterialGetPassDepthCheckEnabled(mmachine m)
SO3MaterialGetPassDepthCheckEnabled : Retrieve if the pass use depth checking to validate fragments.
int SO3MaterialSetPassUseVertexColor(mmachine m)
SO3MaterialSetPassUseVertexColor : Sets pass vertex color state.
int SO3MaterialTechniqueGetNameByIndex(mmachine m)
SO3MaterialTechniqueGetNameByIndex : return the name of a technique.
int SO3MaterialGetTextureRotate(mmachine m)
SO3MaterialGetTextureRotate : Gets the rotation of the texture.
int SO3MaterialRemovePass(mmachine m)
SO3MaterialRemovePass : Remove a pass on a material technique.
int SO3MaterialGetPassDestBlendFactorAlpha(mmachine m)
SO3MaterialGetPassDestBlendFactorAlpha : Retrieve pass destination blend factor for alpha.
int SO3MaterialGetPassFragmentProgramParameters(mmachine m)
SO3MaterialGetPassFragmentProgramParameters : Retrieve all the fragment program parameters than can b...
int SO3MaterialGetPassAlphaRejectionValue(mmachine m)
SO3MaterialGetPassAlphaRejectionValue : Retrieve the alpha rejection value.
int SO3MaterialGetTextureVScroll(mmachine m)
SO3MaterialGetTextureVScroll : Gets the translation offset of the texture, ie scrolls the texture,...
int SO3MaterialSetTextureUScale(mmachine m)
SO3MaterialSetTextureUScale : Sets the scale value of the texture, for the U value.
int SO3MaterialGetSpecularByTechAndPass(mmachine m)
SO3MaterialGetSpecularByTechAndPass : Get the specular color by Technique and Pass.
int SO3MaterialGetTextureBlendFactor(mmachine m)
SO3MaterialGetTextureBlendFactor : Gets the texture blend factor.
int SO3MaterialGetShininessByTechAndPass(mmachine m)
SO3MaterialGetShininessByTechAndPass : Get the Shininess value by Technique and Pass.
int SO3MaterialSetDiffuseByTechAndPass(mmachine m)
SO3MaterialSetDiffuseByTechAndPass : defines diffuse color by technique and pass of a material.
int SO3MaterialGetReceiveShadows(mmachine m)
SO3MaterialGetReceiveShadows : Get the receive shadow state for material.
int SO3MaterialSetPassColourWriteEnabled(mmachine m)
SO3MaterialSetPassColourWriteEnabled : Set if the pass must write the colour.
int SO3MaterialSetTextureVScale(mmachine m)
SO3MaterialSetTextureVScale : Sets the scale of the texture, for the V value.
int SO3MaterialGetPassPolygonMode(mmachine m)
SO3MaterialGetPassPolygonMode : Get pass polygon mode.
int SO3MaterialSetPassSceneBlending(mmachine m)
SO3MaterialSetPassSceneBlending : Sets pass scene blending.
int SO3MaterialTextureUnitGetIndexByName(mmachine m)
SO3MaterialTextureUnitGetIndexByName : return the index of a Texture unit by name.
int SO3MaterialCountInScript(mmachine m)
SO3MaterialCountInScript : Gets the number of materials in a material script.
int SO3MaterialRewriteScript(mmachine m)
SO3MaterialRewriteScript : Rewrite a material script (usefull to remove deleted materials)
int SO3MaterialGetPassSourceBlendFactor(mmachine m)
SO3MaterialGetPassSourceBlendFactor : Retrieve pass source blend factor.
int SO3MaterialGetSelfIlluminationByTechAndPass(mmachine m)
SO3MaterialGetSelfIlluminationByTechAndPass : Get the self illumination color by Technique and Pass.
int SO3MaterialGetPassColourWriteEnabled(mmachine m)
SO3MaterialGetPassColourWriteEnabled : Retrieve if the pass use colour write when a fragment is valid...
int SO3MaterialIsLighting(mmachine m)
SO3MaterialIsLighting : defines light state for a material.
int SO3MaterialSetPassPointSize(mmachine m)
SO3MaterialSetPassPointSize : Sets pass point size.
int SO3MaterialGetPassSceneBlendingOperation(mmachine m)
SO3MaterialGetPassSceneBlendingOperation : Retrieve pass scene blending operation.
int SO3MaterialGetTexture(mmachine m)
SO3MaterialGetTexture : Get a texture from a material.
int SO3MaterialPassGetIndexByName(mmachine m)
SO3MaterialPassGetIndexByName : return the index of a pass by name.
int SO3MaterialGetPassSourceBlendFactorAlpha(mmachine m)
SO3MaterialGetPassSourceBlendFactorAlpha : Retrieve pass source blend factor for alpha.
int SO3MaterialSetIgnoreSlicePlane(mmachine m)
SO3MaterialSetIgnoreSlicePlane : Set the material ignore slice plane state.
int SO3MaterialGetPassDepthFunction(mmachine m)
SO3MaterialGetPassDepthFunction : Retrieve the function used to compare a fragment depth to depth buf...
int SO3MaterialSetSpecular(mmachine m)
SO3MaterialSetSpecular : defines specular color of a material.
int SO3MaterialGetPassAlphaToCoverage(mmachine m)
SO3MaterialGetPassAlphaToCoverage : Retrieve if the pass use alpha to coverage method.
int SO3MaterialSetReceiveShadows(mmachine m)
SO3MaterialSetReceiveShadows : defines receive shadow state for a given material.
int SO3TextureManagerGetMemoryUsage(mmachine m)
SO3TextureManagerGetMemoryUsage : Return the memory usage of all textures in the scene.
int SO3MaterialGetTextureVScale(mmachine m)
SO3MaterialGetTextureVScale : Gets the scale of the texture, for the V value.
int SO3TextureGetName(mmachine m)
SO3TextureGetName : Return the name of a texture.
int SO3MaterialSetSpecularByTechAndPass(mmachine m)
SO3MaterialSetSpecularByTechAndPass : defines specular color by technique and pass of a material.
int SO3MaterialSetSelfIlluminationByTechAndPass(mmachine m)
SO3MaterialSetSelfIlluminationByTechAndPass : defines self illumination color by technique and pass o...
int SO3MaterialRemoveTexture(mmachine m)
SO3MaterialRemoveTexture : Remove a texture from a material.
int SO3MaterialGetTextureUScale(mmachine m)
SO3MaterialGetTextureUScale : Gets the scale of the texture, for the U value.
int SO3MaterialGetPassCullingEnable(mmachine m)
SO3MaterialGetPassCullingEnable : Gets pass culling state.
int SO3MaterialSetShininess(mmachine m)
SO3MaterialSetShininess : defines shininess value of a material.
int SO3MaterialSetPassCullingEnable(mmachine m)
SO3MaterialSetPassCullingEnable : Sets pass culling state.
int SO3MaterialSetTextureUScroll(mmachine m)
SO3MaterialSetTextureUScroll : Sets the translation offset of the texture, ie scrolls the texture,...
int SO3MaterialGetAmbientByTechAndPass(mmachine m)
SO3MaterialGetAmbientByTechAndPass : Get the ambient color by Technique and Pass.
int SO3MaterialGetScriptPath(mmachine m)
SO3MaterialGetScriptPath : Gets the material script path.
int SO3MaterialSetTextureRotate(mmachine m)
SO3MaterialSetTextureRotate : Rotate the texture.
int SO3MaterialSetTextureBlendFactor(mmachine m)
SO3MaterialSetTextureBlendFactor : Set the texture blend factor (used for reflection map)
int SO3MaterialExport(mmachine m)
SO3MaterialExport : Write a material script to a file.
int SO3MaterialGetDiffuseByTechAndPass(mmachine m)
SO3MaterialGetDiffuseByTechAndPass : Get the diffuse color by Technique and Pass.
int SO3MaterialSetPassSceneBlendingOperation(mmachine m)
SO3MaterialSetPassSceneBlendingOperation : Sets pass scene blending operation.
int SO3MaterialSetPassPolygonMode(mmachine m)
SO3MaterialSetPassPolygonMode : Sets pass polygon mode.
int SO3MaterialGetPassDepthWriteEnabled(mmachine m)
SO3MaterialGetPassDepthWriteEnabled : Retrieve if the pass use depth write when a fragment is validat...
int SO3MaterialSetTexture(mmachine m)
SO3MaterialSetTexture : Set a texture on a material.
int SO3MaterialGetPassSceneBlendingOperationAlpha(mmachine m)
SO3MaterialGetPassSceneBlendingOperationAlpha : Retrieve pass scene blending operation for alpha.
int SO3MaterialSetTextureByType(mmachine m)
SO3MaterialSetTextureByType : Set a texture on a material by type.
int SO3MaterialSetPassDepthFunction(mmachine m)
SO3MaterialSetPassDepthFunction : Sets the compare function to use to compare a fragment depth with d...
int SO3MaterialAddPass(mmachine m)
SO3MaterialAddPass : Add a pass on a material technique.
int SO3MaterialGetPassPointSize(mmachine m)
SO3MaterialGetPassPointSize : Get pass point size.
int SO3MaterialGetTextureUScroll(mmachine m)
SO3MaterialGetTextureUScroll : Gets the translation offset of the texture, ie scrolls the texture,...
int SO3MaterialNumberOfPassesByTechnique(mmachine m)
SO3MaterialNumberOfPassesByTechnique : Get the number of passes by technique.
int SO3MaterialRemoveTechnique(mmachine m)
SO3MaterialRemoveTechnique : Remove a technique on a material.
int SO3MaterialSetPassAlphaRejection(mmachine m)
SO3MaterialSetPassAlphaRejection : Sets alpha rejection parameters.