Project

General

Profile

SO3Engine
SCOLViewport.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
42
43// Renderer includes
44#ifdef SO3_BUILD_DEFERRED
46#endif
47
51#include "SO3Renderer/SO3Root.h"
53
54// Scene Graph includes
58
59// Utils includes
61
62#ifdef __APPLE__
63extern int(*CallMainThread)(void*, mmachine m);
64#endif
65
80/*#ifdef __APPLE__
81int SO3ViewportCreateSync(mmachine m)
82#else*/
83int SO3ViewportCreate(mmachine m)
84//#endif
85{
86#ifdef SO3_DEBUG
87 MMechostr(MSKDEBUG, "SO3ViewportCreate\n");
88#endif
89
90 int priority = MTOI(MMpull(m));
91 int h = MMpull(m);
92 int w = MMpull(m);
93 int y = MMpull(m);
94 int x = MMpull(m);
95 int cam = MMpull(m);
96 int BO = MMpull(m);
97 int channel = MMget(m, 0);
98
99 if (channel == NIL)
100 {
101 MMechostr(MSKDEBUG, "SO3ViewportCreate : Channel is NIL\n ");
102 MMset(m, 0, NIL);
103 return 0;
104 }
105
106 if ((cam == NIL) || (h == NIL) || (w == NIL) || (x == NIL) || (y == NIL) || (BO == NIL))
107 {
108 MMechostr(MSKDEBUG, "SO3ViewportCreate : Invalid parameters \n ");
109 MMset(m, 0, NIL);
110 return 0;
111 }
112
113 SCamera* camera = MMgetPointer<SCamera*>(m, MTOP(cam));
114 if (camera == NULL)
115 {
116 MMset(m, 0, NIL);
117 return 0;
118 }
119
120 if (BO == NIL)
121 {
122 MMset(m, 0, NIL);
123 return 0;
124 }
125
126 SWindow* buffer = MMgetPointer<SWindow*>(m, MTOP(BO));
127
128 if (buffer == 0)
129 {
130 MMset(m, 0, NIL);
131 return 0;
132 }
133
134 // Creating the SO3Object.
135 SViewPort* viewport = 0;
136 try
137 {
138 viewport = buffer->CreateViewport(camera, priority, MTOF(x), MTOF(y), MTOF(w), MTOF(h));
139 }
140 catch (Ogre::Exception& e)
141 {
142 MMechostr(MSKDEBUG, "Cannot create viewport : %s\n", e.what());
143 MMset(m, 0, NIL);
144 return 0;
145 }
146
147 // Allocating memory for the Scol Object.
148 if ((MMpushPointer(m, viewport) != 0))
149 {
150 MMset(m, 0, NIL);
151 return MERRMEM;
152 }
153
154 // Creating the Scol Object.
155 return OBJcreate(m, SO3VPTYPE, SCOL_PTR viewport, SO3BUFFER, SCOL_PTR buffer);
156}
157
158/*#ifdef __APPLE__
159int SO3ViewportCreate(mmachine m)
160{
161 return CallMainThread((void*)SO3ViewportCreateSync, m);
162}
163#endif*/
164
173int SO3ViewportDestroy(mmachine m)
174{
175#ifdef SO3_DEBUG
176 MMechostr(MSKDEBUG, "SO3ViewportDestroy\n");
177#endif
178
179 int vp = MMget(m, 0);
180 if (vp == NIL)
181 {
182 MMechostr(MSKDEBUG, "vp is NULL \n");
183 MMset(m, 0, NIL);
184 return 0;
185 }
186
187 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
188 if (viewport == NULL)
189 {
190 MMechostr(MSKDEBUG, "vp is NULL \n");
191 MMset(m, 0, NIL);
192 return 0;
193 }
194
195 OBJdelTM(m, SO3VPTYPE, vp);
196 MMset(m, 0, ITOM(1));
197 return 0;
198}
199
200
211int SO3ViewportResize(mmachine m)
212{
213#ifdef SO3_DEBUG
214 MMechostr(MSKDEBUG, "SO3ViewportResize\n");
215#endif
216
217 int w, h;
218 h = MTOI(MMpull(m));
219 w = MTOI(MMpull(m));
220 int vp = MMget(m, 0);
221
222 if ((vp == NIL) || (w <= 0) || (h <= 0))
223 {
224 MMechostr(MSKDEBUG, "viewport is NULL \n");
225 MMset(m, 0, NIL);
226 return 0;
227 }
228
229 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
230 if (viewport == NULL)
231 {
232 MMechostr(MSKDEBUG, "vp is NULL \n");
233 MMset(m, 0, NIL);
234 return 0;
235 }
236
237 //$BB
238 viewport->ResizeToWindow(static_cast <float>(w), static_cast <float>(h));
239
240 MMset(m, 0, ITOM(1));
241 return 0;
242}
243
253{
254#ifdef SO3_DEBUG
255 MMechostr(MSKDEBUG, "SO3ViewportGetTriangleCount\n");
256#endif
257
258 int vp = MMget(m, 0);
259 if (vp == NIL)
260 {
261 MMechostr(MSKDEBUG, "vp is NULL \n");
262 MMset(m, 0, NIL);
263 return 0;
264 }
265
266 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
267 if (viewport == NULL)
268 {
269 MMechostr(MSKDEBUG, "vp is NULL \n");
270 MMset(m, 0, NIL);
271 return 0;
272 }
273
274 MMset(m, 0, ITOM(viewport->GetNumRenderedFaces()));
275 return 0;
276}
277
287{
288#ifdef SO3_DEBUG
289 MMechostr(MSKDEBUG, "SO3ViewportGetBatchCount\n");
290#endif
291
292 int vp = MMget(m, 0);
293 if (vp == NIL)
294 {
295 MMechostr(MSKDEBUG, "vp is NULL \n");
296 MMset(m, 0, NIL);
297 return 0;
298 }
299
300 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
301 if (viewport == NULL)
302 {
303 MMechostr(MSKDEBUG, "vp is NULL \n");
304 MMset(m, 0, NIL);
305 return 0;
306 }
307
308 MMset(m, 0, ITOM(viewport->GetNumRenderedBatches()));
309 return 0;
310}
311
321{
322#ifdef SO3_DEBUG
323 MMechostr(MSKDEBUG, "SO3ViewportGetPriority\n");
324#endif
325
326 int vp = MMget(m, 0);
327 if (vp == NIL)
328 {
329 MMechostr(MSKDEBUG, "vp is NULL \n");
330 MMset(m, 0, NIL);
331 return 0;
332 }
333
334 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
335 if (viewport == NULL)
336 {
337 MMechostr(MSKDEBUG, "vp is NULL \n");
338 MMset(m, 0, NIL);
339 return 0;
340 }
341
342 MMset(m, 0, ITOM(viewport->GetPriority()));
343 return 0;
344}
345
346
356{
357#ifdef SO3_DEBUG
358 MMechostr(MSKDEBUG, "SO3ViewportGetShadowEnabled\n");
359#endif
360
361 int vp = MMget(m, 0);
362 if (vp == NIL)
363 {
364 MMechostr(MSKDEBUG, "vp is NULL \n");
365 MMset(m, 0, NIL);
366 return 0;
367 }
368
369 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
370 if (viewport == NULL)
371 {
372 MMechostr(MSKDEBUG, "vp is NULL \n");
373 MMset(m, 0, NIL);
374 return 0;
375 }
376
377 int priority = 0;
378 if (viewport->GetShadowsEnabled())
379 priority = 1;
380
381 MMset(m, 0, ITOM(priority));
382 return 0;
383}
384
385
399{
400#ifdef SO3_DEBUG
401 MMechostr(MSKDEBUG, "SO3ViewportSetPositionSize\n");
402#endif
403
404 int h = MMpull(m);
405 int w = MMpull(m);
406 int y = MMpull(m);
407 int x = MMpull(m);
408 int vp = MMget(m, 0);
409
410 if ((vp == NIL) || (x == NIL) || (y == NIL) || (w == NIL) || (h == NIL))
411 {
412 MMechostr(MSKDEBUG, "vp is NULL \n");
413 MMset(m, 0, NIL);
414 return 0;
415 }
416
417 Ogre::Real aspectRatio = 0.0f;
418 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
419 if (viewport == NULL)
420 {
421 MMechostr(MSKDEBUG, "vp is NULL \n");
422 MMset(m, 0, NIL);
423 return 0;
424 }
425
426 viewport->SetPositionAndSize(MTOF(x), MTOF(y), MTOF(w), MTOF(h));
427 MMset(m, 0, ITOM(1));
428 return 0;
429}
430
431
442{
443#ifdef SO3_DEBUG
444 MMechostr(MSKDEBUG, "SO3ViewportSetShadowEnabled\n");
445#endif
446
447 int booleen = MTOI(MMpull(m));
448 int vp = MMget(m, 0);
449 if (vp == NIL)
450 return 0;
451
452 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
453 if (viewport == NULL)
454 {
455 MMechostr(MSKDEBUG, "vp is NULL \n");
456 MMset(m, 0, NIL);
457 return 0;
458 }
459
460 if (booleen == SO3_FALSE)
461 viewport->SetShadowsEnabled(false);
462 else
463 viewport->SetShadowsEnabled(true);
464
465 MMset(m, 0, ITOM(1));
466 return 0;
467}
468
469
480{
481#ifdef SO3_DEBUG
482 MMechostr(MSKDEBUG, "SO3ViewportSetDeferredEnabled\n");
483#endif
484
485 int booleen = MTOI(MMpull(m));
486 int vp = MMget(m, 0);
487 if (vp == NIL)
488 return 0;
489
490 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
491 if (viewport == NULL)
492 {
493 MMechostr(MSKDEBUG, "vp is NULL \n");
494 MMset(m, 0, NIL);
495 return 0;
496 }
497
498#ifdef SO3_BUILD_DEFERRED
499 if (booleen == SO3_TRUE)
500 viewport->SetDeferredEnable(true);
501 else
502 viewport->SetDeferredEnable(false);
503#else
504 MMechostr(MSKDEBUG, "Deferred mode is not available.\n");
505#endif
506
507 MMset(m, 0, ITOM(1));
508 return 0;
509}
510
520{
521#ifdef SO3_DEBUG
522 MMechostr(MSKDEBUG, "SO3ViewportGetDeferredEnabled\n");
523#endif
524
525 int vp = MMget(m, 0);
526 if (vp == NIL)
527 {
528 MMechostr(MSKDEBUG, "vp is NULL \n");
529 MMset(m, 0, NIL);
530 return 0;
531 }
532
533 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
534 if (viewport == NULL)
535 {
536 MMechostr(MSKDEBUG, "vp is NULL \n");
537 MMset(m, 0, NIL);
538 return 0;
539 }
540
541 int value = 0;
542
543#ifdef SO3_BUILD_DEFERRED
544 if (viewport->GetDeferredEnable())
545 value = 1;
546#else
547 MMechostr(MSKDEBUG, "Deferred mode is not available.\n");
548#endif
549
550 MMset(m, 0, ITOM(value));
551 return 0;
552}
553
564{
565#ifdef SO3_DEBUG
566 MMechostr(MSKDEBUG, "SO3ViewportSetHDREnabled\n");
567#endif
568
569 int booleen = MTOI(MMpull(m));
570 int vp = MMget(m, 0);
571 if (vp == NIL)
572 {
573 MMset(m, 0, NIL);
574 return 0;
575 }
576
577 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
578 if (viewport == NULL)
579 {
580 MMechostr(MSKDEBUG, "vp is NULL \n");
581 MMset(m, 0, NIL);
582 return 0;
583 }
584
585 if (booleen == SO3_TRUE)
586 viewport->SetHDREnable(true);
587 else
588 viewport->SetHDREnable(false);
589
590 MMset(m, 0, ITOM(1));
591 return 0;
592}
593
603{
604#ifdef SO3_DEBUG
605 MMechostr(MSKDEBUG, "SO3ViewportGetHDREnabled\n");
606#endif
607
608 int vp = MMget(m, 0);
609 if (vp == NIL)
610 {
611 MMechostr(MSKDEBUG, "vp is NULL \n");
612 MMset(m, 0, NIL);
613 return 0;
614 }
615
616 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
617 if (viewport == NULL)
618 {
619 MMechostr(MSKDEBUG, "vp is NULL \n");
620 MMset(m, 0, NIL);
621 return 0;
622 }
623
624 int value = 0;
625 if (viewport->GetHDREnable())
626 value = 1;
627
628 MMset(m, 0, ITOM(value));
629 return 0;
630}
631
642{
643#ifdef SO3_DEBUG
644 MMechostr(MSKDEBUG, "SO3ViewportSetHDRBlurAmount\n");
645#endif
646
647 float val = MTOF(MMpull(m));
648 int vp = MMget(m, 0);
649 if (vp == NIL)
650 {
651 MMset(m, 0, NIL);
652 return 0;
653 }
654
655 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
656 if (viewport == NULL)
657 {
658 MMechostr(MSKDEBUG, "vp is NULL \n");
659 MMset(m, 0, NIL);
660 return 0;
661 }
662
663 if (val < 0.0f)
664 val = 0.0f;
665
666 if (val > 1.0f)
667 val = 1.0f;
668
669 viewport->SetHDRBlurAmount(val);
670
671 MMset(m, 0, ITOM(1));
672 return 0;
673}
674
685{
686#ifdef SO3_DEBUG
687 MMechostr(MSKDEBUG, "SO3ViewportSetHDREffectAmount\n");
688#endif
689
690 float val = MTOF(MMpull(m));
691 int vp = MMget(m, 0);
692 if (vp == NIL)
693 {
694 MMset(m, 0, NIL);
695 return 0;
696 }
697
698 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
699 if (viewport == NULL)
700 {
701 MMechostr(MSKDEBUG, "vp is NULL \n");
702 MMset(m, 0, NIL);
703 return 0;
704 }
705
706 if (val < 0.0f)
707 val = 0.0f;
708
709 if (val > 1.0f)
710 val = 1.0f;
711
712 viewport->SetHDREffectAmount(val);
713
714 MMset(m, 0, ITOM(1));
715 return 0;
716}
717
728{
729#ifdef SO3_DEBUG
730 MMechostr(MSKDEBUG, "SO3ViewportSetHDRGamma\n");
731#endif
732
733 float val = MTOF(MMpull(m));
734 int vp = MMget(m, 0);
735 if (vp == NIL)
736 {
737 MMset(m, 0, NIL);
738 return 0;
739 }
740
741 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
742 if (viewport == NULL)
743 {
744 MMechostr(MSKDEBUG, "vp is NULL \n");
745 MMset(m, 0, NIL);
746 return 0;
747 }
748
749 if (val < 0.0f)
750 val = 0.0f;
751
752 viewport->SetHDRGamma(val);
753
754 MMset(m, 0, ITOM(1));
755 return 0;
756}
757
769{
770#ifdef SO3_DEBUG
771 MMechostr(MSKDEBUG, "SO3ViewportSetSSAOEnabled\n");
772#endif
773
774 int booleen = MTOI(MMpull(m));
775 int vp = MMget(m, 0);
776 if (vp == NIL)
777 {
778 MMset(m, 0, NIL);
779 return 0;
780 }
781
782 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
783 if (viewport == NULL)
784 {
785 MMechostr(MSKDEBUG, "vp is NULL \n");
786 MMset(m, 0, NIL);
787 return 0;
788 }
789
790 if (booleen == SO3_TRUE)
791 viewport->SetSSAOEnable(true);
792 else
793 viewport->SetSSAOEnable(false);
794
795 MMset(m, 0, ITOM(1));
796 return 0;
797}
798
808{
809#ifdef SO3_DEBUG
810 MMechostr(MSKDEBUG, "SO3ViewportGetSSAOEnabled\n");
811#endif
812
813 int vp = MMget(m, 0);
814 if (vp == NIL)
815 {
816 MMechostr(MSKDEBUG, "vp is NULL \n");
817 MMset(m, 0, NIL);
818 return 0;
819 }
820
821 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
822 if (viewport == NULL)
823 {
824 MMechostr(MSKDEBUG, "vp is NULL \n");
825 MMset(m, 0, NIL);
826 return 0;
827 }
828
829 int value = 0;
830 if (viewport->GetSSAOEnable())
831 value = 1;
832
833 MMset(m, 0, ITOM(value));
834 return 0;
835}
836
846{
847#ifdef SO3_DEBUG
848 MMechostr(MSKDEBUG, "SO3ViewportGetDeferredAntiAliasingMode\n");
849#endif
850
851 int vp = MMget(m, 0);
852 if (vp == NIL)
853 {
854 MMechostr(MSKDEBUG, "vp is NULL \n");
855 MMset(m, 0, NIL);
856 return 0;
857 }
858
859 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
860 if (viewport == NULL)
861 {
862 MMechostr(MSKDEBUG, "vp is NULL \n");
863 MMset(m, 0, NIL);
864 return 0;
865 }
866
867 int value = 0;
868#ifdef SO3_BUILD_DEFERRED
869 value = viewport->GetDeferredAntiAliasingMode();
870#else
871 MMechostr(MSKDEBUG, "Deferred mode is not available.\n");
872#endif
873 MMset(m, 0, ITOM(value));
874 return 0;
875}
876
887{
888#ifdef SO3_DEBUG
889 MMechostr(MSKDEBUG, "SO3ViewportSetDeferredAntiAliasingMode\n");
890#endif
891
892 int mode = MMpull(m);
893 int vp = MMget(m, 0);
894 if (vp == NIL)
895 {
896 MMset(m, 0, NIL);
897 return 0;
898 }
899
900 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
901 if (viewport == NULL)
902 {
903 MMechostr(MSKDEBUG, "vp is NULL \n");
904 MMset(m, 0, NIL);
905 return 0;
906 }
907
908#ifdef SO3_BUILD_DEFERRED
909 int imode = (mode == NIL) ? SDeferredShading::SO3_DEFERRED_AA_NONE : MTOI(mode);
910 if ((imode < SDeferredShading::SO3_DEFERRED_AA_NONE) || (imode > SDeferredShading::SO3_DEFERRED_AA_COUNT))
911 {
912 MMset(m, 0, NIL);
913 return 0;
914 }
915
916 viewport->SetDeferredAntiAliasingMode(static_cast<SDeferredShading::DeferredShadingAntiAliasingMode>(imode));
917#else
918 MMechostr(MSKDEBUG, "Deferred mode is not available.\n");
919#endif
920
921 MMset(m, 0, ITOM(1));
922 return 0;
923}
924
934{
935#ifdef SO3_DEBUG
936 MMechostr(MSKDEBUG, "SO3ViewportGetDeferredDebugMode\n");
937#endif
938
939 int vp = MMget(m, 0);
940 if (vp == NIL)
941 {
942 MMechostr(MSKDEBUG, "vp is NULL \n");
943 MMset(m, 0, NIL);
944 return 0;
945 }
946
947 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
948 if (viewport == NULL)
949 {
950 MMechostr(MSKDEBUG, "vp is NULL \n");
951 MMset(m, 0, NIL);
952 return 0;
953 }
954
955 int value = 0;
956
957#ifdef SO3_BUILD_DEFERRED
958 value = viewport->GetDeferredDebugMode();
959#else
960 MMechostr(MSKDEBUG, "Deferred mode is not available.\n");
961#endif
962
963 MMset(m, 0, ITOM(value));
964 return 0;
965}
966
977{
978#ifdef SO3_DEBUG
979 MMechostr(MSKDEBUG, "SO3ViewportSetDeferredDebugMode\n");
980#endif
981
982 int mode = MMpull(m);
983 int vp = MMget(m, 0);
984 if (vp == NIL)
985 {
986 MMset(m, 0, NIL);
987 return 0;
988 }
989
990 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
991 if (viewport == NULL)
992 {
993 MMechostr(MSKDEBUG, "vp is NULL \n");
994 MMset(m, 0, NIL);
995 return 0;
996 }
997
998#ifdef SO3_BUILD_DEFERRED
999 int imode = (mode == NIL) ? 0 : MTOI(mode);
1000 if ((imode < 0) || (imode >= SDeferredShading::SO3_DEFERRED_COUNT))
1001 {
1002 MMset(m, 0, NIL);
1003 return 0;
1004 }
1005
1006 viewport->SetDeferredDebugMode(imode);
1007#else
1008 MMechostr(MSKDEBUG, "Deferred mode is not available.\n");
1009#endif
1010
1011 MMset(m, 0, ITOM(1));
1012 return 0;
1013}
1014
1028{
1029#ifdef SO3_DEBUG
1030 MMechostr(MSKDEBUG, "SO3ViewportGetPositionSize\n");
1031#endif
1032
1033 int vp = MMget(m, 0);
1034 if (vp == NIL)
1035 {
1036 MMset(m, 0, NIL);
1037 return 0;
1038 }
1039
1040 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1041 if (viewport == NULL)
1042 {
1043 MMechostr(MSKDEBUG, "vp is NULL \n");
1044 MMset(m, 0, NIL);
1045 return 0;
1046 }
1047
1048 int tuple = MMmalloc(m, 4, TYPETAB);
1049 if (tuple == NIL)
1050 {
1051 MMset(m, 0, NIL);
1052 return MERRMEM;
1053 }
1054
1055 MMstore(m, tuple, 0, FTOM(viewport->GetLeft()));
1056 MMstore(m, tuple, 1, FTOM(viewport->GetTop()));
1057 MMstore(m, tuple, 2, FTOM(viewport->GetWidth()));
1058 MMstore(m, tuple, 3, FTOM(viewport->GetHeight()));
1059 MMset(m, 0, PTOM(tuple));
1060 return 0;
1061}
1062
1063
1077{
1078#ifdef SO3_DEBUG
1079 MMechostr(MSKDEBUG, "SO3ViewportGetPixelPositionSize\n");
1080#endif
1081
1082 int vp = MMget(m, 0);
1083 if (vp == NIL)
1084 {
1085 MMset(m, 0, NIL);
1086 return 0;
1087 }
1088
1089 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1090 if (viewport == NULL)
1091 {
1092 MMechostr(MSKDEBUG, "vp is NULL \n");
1093 MMset(m, 0, NIL);
1094 return 0;
1095 }
1096
1097 int tuple = MMmalloc(m, 4, TYPETAB);
1098 if (tuple == NIL)
1099 {
1100 MMset(m, 0, NIL);
1101 return MERRMEM;
1102 }
1103
1104 MMstore(m, tuple, 0, ITOM(viewport->GetLeftPixels()));
1105 MMstore(m, tuple, 1, ITOM(viewport->GetTopPixels()));
1106 MMstore(m, tuple, 2, ITOM(viewport->GetWidthPixels()));
1107 MMstore(m, tuple, 3, ITOM(viewport->GetHeightPixels()));
1108 MMset(m, 0, PTOM(tuple));
1109 return 0;
1110}
1111
1112
1123{
1124#ifdef SO3_DEBUG
1125 MMechostr(MSKDEBUG, "SO3ViewportGetCamera\n");
1126#endif
1127
1128 int vp = MMget(m, 0);
1129 if (vp == NIL)
1130 {
1131 MMset(m, 0, NIL);
1132 return 0;
1133 }
1134
1135 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1136 if (viewport == NULL)
1137 {
1138 MMechostr(MSKDEBUG, "vp is NULL \n");
1139 MMset(m, 0, NIL);
1140 return 0;
1141 }
1142
1143 SNode* curNode = viewport->GetCamera();
1144 if (curNode == NULL)
1145 {
1146 MMset(m, 0, NIL);
1147 return 0;
1148 }
1149
1150 int so3obj = OBJfindTH(m, SO3OBJTYPE, SCOL_PTR(curNode));
1151 if (so3obj != NIL)
1152 {
1153 so3obj = MMfetch(m, so3obj, OFFOBJMAG);
1154 MMset(m, 0, so3obj);
1155 }
1156 else
1157 {
1158 MMset(m, 0, NIL);
1159 }
1160
1161 return 0;
1162}
1163
1164
1175{
1176#ifdef SO3_DEBUG
1177 MMechostr(MSKDEBUG, "SO3ViewportSetBackgroundColor\n");
1178#endif
1179
1180 int background = MMpull(m);
1181 int vp = MMget(m, 0);
1182 if ((vp == NIL) || (background == NIL))
1183 {
1184 MMset(m, 0, NIL);
1185 return 0;
1186 }
1187
1188 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1189 if (viewport == NULL)
1190 {
1191 MMechostr(MSKDEBUG, "vp is NULL \n");
1192 MMset(m, 0, NIL);
1193 return 0;
1194 }
1195
1196 viewport->SetBackgroundColour(MTOI(background));
1197 MMset(m, 0, ITOM(1));
1198 return 0;
1199}
1200
1201
1211{
1212#ifdef SO3_DEBUG
1213 MMechostr(MSKDEBUG, "SO3ViewportGetBackgroundColor\n");
1214#endif
1215
1216 int vp = MMget(m, 0);
1217 if (vp == NIL)
1218 {
1219 MMset(m, 0, NIL);
1220 return 0;
1221 }
1222
1223 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1224 if (viewport == NULL)
1225 {
1226 MMechostr(MSKDEBUG, "Viewport is NULL \n");
1227 MMset(m, 0, NIL);
1228 return 0;
1229 }
1230
1231 int val = viewport->GetBackgroundColor();
1232 MMset(m, 0, ITOM(val));
1233 return 0;
1234}
1235
1236
1247{
1248#ifdef SO3_DEBUG
1249 MMechostr(MSKDEBUG, "SO3ViewportSetClearDepth\n");
1250#endif
1251
1252 int value = MTOI(MMpull(m));
1253 int vp = MMget(m, 0);
1254 if (vp == NIL)
1255 {
1256 MMset(m, 0, NIL);
1257 return 0;
1258 }
1259
1260 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1261 if (viewport == NULL)
1262 {
1263 MMechostr(MSKDEBUG, "Viewport is NULL \n");
1264 MMset(m, 0, NIL);
1265 return 0;
1266 }
1267
1268 bool state = false;
1269 if (value == 1)
1270 state = true;
1271
1272 viewport->SetClearDepth(state);
1273 MMset(m, 0, ITOM(1));
1274 return 0;
1275}
1276
1277
1287{
1288#ifdef SO3_DEBUG
1289 MMechostr(MSKDEBUG, "SO3ViewportGetClearDepth\n");
1290#endif
1291
1292 bool rvalue = false;
1293 int vp = MMget(m, 0);
1294
1295 if (vp == NIL)
1296 {
1297 MMset(m, 0, NIL);
1298 return 0;
1299 }
1300
1301 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1302 if (viewport == NULL)
1303 {
1304 MMechostr(MSKDEBUG, "Viewport is NULL \n");
1305 MMset(m, 0, NIL);
1306 return 0;
1307 }
1308
1309 rvalue = viewport->GetClearDepth();
1310 MMset(m, 0, ITOM(rvalue ? 1 : 0));
1311 return 0;
1312}
1313
1314
1325{
1326#ifdef SO3_DEBUG
1327 MMechostr(MSKDEBUG, "SO3ViewportSetClearColor\n");
1328#endif
1329
1330 int value = MTOI(MMpull(m));
1331 int vp = MMget(m, 0);
1332 if (vp == NIL)
1333 {
1334 MMset(m, 0, NIL);
1335 return 0;
1336 }
1337
1338 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1339 if (viewport == NULL)
1340 {
1341 MMechostr(MSKDEBUG, "Viewport is NULL \n");
1342 MMset(m, 0, NIL);
1343 return 0;
1344 }
1345
1346 bool state = false;
1347 if (value == 1)
1348 state = true;
1349
1350 viewport->SetClearColor(state);
1351 MMset(m, 0, ITOM(1));
1352 return 0;
1353}
1354
1355
1365{
1366#ifdef SO3_DEBUG
1367 MMechostr(MSKDEBUG, "SO3ViewportGetClearColor\n");
1368#endif
1369
1370 bool rvalue = false;
1371 int vp = MMget(m, 0);
1372 if (vp == NIL)
1373 {
1374 MMset(m, 0, NIL);
1375 return 0;
1376 }
1377
1378 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1379 if (viewport == NULL)
1380 {
1381 MMechostr(MSKDEBUG, "Viewport is NULL \n");
1382 MMset(m, 0, NIL);
1383 return 0;
1384 }
1385
1386 rvalue = viewport->GetClearColor();
1387 MMset(m, 0, ITOM(rvalue ? 1 : 0));
1388 return 0;
1389}
1390
1391
1403{
1404#ifdef SO3_DEBUG
1405 MMechostr(MSKDEBUG, "SO3ViewportAddCompositor\n");
1406#endif
1407
1408 int sc = MMpull(m);
1409 int cn = MMpull(m);
1410 int vp = MMget(m, 0);
1411 if ((vp == NIL) || (cn == NIL))
1412 {
1413 MMset(m, 0, NIL);
1414 return 0;
1415 }
1416
1417 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1418 if (viewport == NULL)
1419 {
1420 MMechostr(MSKDEBUG, "vp is NULL \n");
1421 MMset(m, 0, NIL);
1422 return 0;
1423 }
1424
1425 std::string compositorName(MMstartstr(m, MTOP(cn)));
1426 std::string schemeName((sc == NIL) ? "" : MMstartstr(m, MTOP(sc)));
1427
1428 SCompositor* newCompositor = viewport->CreateCompositor(compositorName, schemeName);
1429
1430 MMset(m, 0, ITOM(1));
1431 return 0;
1432}
1433
1434
1445{
1446#ifdef SO3_DEBUG
1447 MMechostr(MSKDEBUG, "SO3ViewportSetMaterialScheme\n");
1448#endif
1449
1450 int sh = MMpull(m);
1451 int vp = MMget(m, 0);
1452
1453 if ((vp == NIL) || (sh == NIL))
1454 {
1455 MMset(m, 0, NIL);
1456 return 0;
1457 }
1458
1459 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1460 if (viewport == NULL)
1461 {
1462 MMechostr(MSKDEBUG, "Viewport is NULL \n");
1463 MMset(m, 0, NIL);
1464 return 0;
1465 }
1466
1467 std::string schemeName(MMstartstr(m, MTOP(sh)));
1468 viewport->SetMaterialScheme(schemeName);
1469
1470 MMset(m, 0, ITOM(1));
1471 return 0;
1472}
1473
1474
1484{
1485#ifdef SO3_DEBUG
1486 MMechostr(MSKDEBUG, "SO3ViewportGetMaterialScheme\n");
1487#endif
1488
1489 int vp = MMpull(m);
1490 if (vp == NIL)
1491 {
1492 MMpush(m, NIL);
1493 return 0;
1494 }
1495
1496 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1497 if (viewport == NULL)
1498 {
1499 MMechostr(MSKDEBUG, "vp is NULL \n");
1500 MMpush(m, NIL);
1501 return 0;
1502 }
1503
1504 string shName = viewport->GetMaterialScheme();
1505 if (shName.empty())
1506 shName = "DefaultScheme";
1507
1508 return Mpushstrbloc(m, (char*)(shName.c_str()));
1509}
1510
1511
1521{
1522#ifdef SO3_DEBUG
1523 MMechostr(MSKDEBUG, "SO3ViewportListEnabledCompositors\n");
1524#endif
1525
1526 int vp = MMpull(m);
1527 if (vp == NIL)
1528 {
1529 MMechostr(MSKDEBUG, "vp is NULL \n");
1530 MMpush(m, NIL);
1531 return 0;
1532 }
1533
1534 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1535 if (viewport == NULL)
1536 {
1537 MMechostr(MSKDEBUG, "vp is NULL \n");
1538 MMpush(m, NIL);
1539 return 0;
1540 }
1541
1542 int nb = 0;
1543 int k;
1544
1545 SCompositorMap::const_iterator iCompositorList = viewport->GetCompositorList().begin();
1546 while (iCompositorList != viewport->GetCompositorList().end())
1547 {
1548 if (iCompositorList->second->GetEnable())
1549 {
1550 nb++;
1551 if (k = Mpushstrbloc(m, (char*)iCompositorList->second->GetName().c_str()))
1552 return k;
1553 }
1554 iCompositorList++;
1555 }
1556
1557 if (MMpush(m, NIL))
1558 return MERRMEM;
1559
1560 for (int i = 0; i < nb; i++)
1561 {
1562 if (MMpush(m, 2 * 2))
1563 return MERRMEM;
1564 if (k = MBdeftab(m))
1565 return k;
1566 }
1567 return 0;
1568}
1569
1570
1581{
1582#ifdef SO3_DEBUG
1583 MMechostr(MSKDEBUG, "SO3ViewportRemoveCompositor\n");
1584#endif
1585
1586 int cn = MMpull(m);
1587 int vp = MMget(m, 0);
1588 if ((vp == NIL) || (cn == NIL))
1589 {
1590 MMset(m, 0, NIL);
1591 return 0;
1592 }
1593
1594 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1595 if (viewport == NULL)
1596 {
1597 MMechostr(MSKDEBUG, "vp is NULL \n");
1598 MMset(m, 0, NIL);
1599 return 0;
1600 }
1601
1602 std::string compositorName(MMstartstr(m, MTOP(cn)));
1603 SCompositor* compositorInstance = viewport->GetCompositor(compositorName);
1604 if (compositorInstance)
1605 try
1606 {
1607 viewport->DeleteCompositor(compositorInstance);
1608 }
1609 catch (Ogre::Exception &e)
1610 {
1611 MMechostr(MSKDEBUG, "SO3ViewportRemoveCompositor : exception > %s", e.what());
1612 }
1613
1614 MMset(m, 0, ITOM(1));
1615 return 0;
1616}
1617
1618
1630{
1631#ifdef SO3_DEBUG
1632 MMechostr(MSKDEBUG, "SO3CompositorSetEnable\n");
1633#endif
1634
1635 int b = MMpull(m);
1636 int cn = MMpull(m);
1637 int vp = MMget(m, 0);
1638
1639 if ((b == NIL) || (vp == NIL) || (cn == NIL))
1640 {
1641 MMset(m, 0, NIL);
1642 return 0;
1643 }
1644
1645 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1646 if (viewport == NULL)
1647 {
1648 MMechostr(MSKDEBUG, "vp is NULL \n");
1649 MMset(m, 0, NIL);
1650 return 0;
1651 }
1652
1653 std::string compositorName(MMstartstr(m, MTOP(cn)));
1654 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1655 if (MTOI(b) == 0)
1656 tmpCompositor->SetEnable(false);
1657 else
1658 tmpCompositor->SetEnable(true);
1659
1660 MMset(m, 0, ITOM(1));
1661 return 0;
1662}
1663
1664
1675{
1676#ifdef SO3_DEBUG
1677 MMechostr(MSKDEBUG, "SO3CompositorGetEnable\n");
1678#endif
1679
1680 int cn = MMpull(m);
1681 int vp = MMget(m, 0);
1682
1683 if ((vp == NIL) || (cn == NIL))
1684 {
1685 MMset(m, 0, NIL);
1686 return 0;
1687 }
1688
1689 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
1690 if (viewport == NULL)
1691 {
1692 MMechostr(MSKDEBUG, "vp is NULL \n");
1693 MMset(m, 0, NIL);
1694 return 0;
1695 }
1696
1697 std::string compositorName(MMstartstr(m, MTOP(cn)));
1698 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1699
1700 int state = 0;
1701 if (tmpCompositor != 0)
1702 if (tmpCompositor->GetEnable())
1703 state = 1;
1704
1705 MMset(m, 0, ITOM(state));
1706 return 0;
1707}
1708
1709
1720{
1721#ifdef SO3_DEBUG
1722 MMechostr(MSKDEBUG, "SO3CompositorGetNumTechniques\n");
1723#endif
1724
1725 int scolCompoName = MMpull(m);
1726 int scolViewport = MMget(m, 0);
1727 if ((scolViewport == NIL) || (scolCompoName == NIL))
1728 {
1729 MMset(m, 0, NIL);
1730 return 0;
1731 }
1732
1733 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(scolViewport));
1734 if (viewport == NULL)
1735 {
1736 MMechostr(MSKDEBUG, "vp is NULL \n");
1737 MMset(m, 0, NIL);
1738 return 0;
1739 }
1740
1741 std::string compositorName(MMstartstr(m, MTOP(scolCompoName)));
1742 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1743 if (tmpCompositor)
1744 MMset(m, 0, ITOM(tmpCompositor->GetNumCompositorTechniques()));
1745 else
1746 MMset(m, 0, NIL);
1747 return 0;
1748}
1749
1750
1762{
1763#ifdef SO3_DEBUG
1764 MMechostr(MSKDEBUG, "SO3CompositorGetNumTargets\n");
1765#endif
1766
1767 int scolTechnique = MMpull(m);
1768 int scolCompoName = MMpull(m);
1769 int scolViewport = MMget(m, 0);
1770 if ((scolViewport == NIL) || (scolCompoName == NIL) || (scolTechnique == NIL))
1771 {
1772 MMset(m, 0, NIL);
1773 return 0;
1774 }
1775
1776 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(scolViewport));
1777 if (viewport == NULL)
1778 {
1779 MMechostr(MSKDEBUG, "vp is NULL \n");
1780 MMset(m, 0, NIL);
1781 return 0;
1782 }
1783
1784 std::string compositorName(MMstartstr(m, MTOP(scolCompoName)));
1785 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1786 if (tmpCompositor)
1787 {
1788 SCompositorTechnique* tmpTechnique = tmpCompositor->GetCompositorTechnique(MTOI(scolTechnique));
1789 if (tmpTechnique)
1790 MMset(m, 0, ITOM(tmpTechnique->GetNumCompositorTargets()));
1791 else
1792 MMset(m, 0, NIL);
1793 }
1794 else
1795 MMset(m, 0, NIL);
1796 return 0;
1797}
1798
1799
1812{
1813#ifdef SO3_DEBUG
1814 MMechostr(MSKDEBUG, "SO3CompositorGetNumPasses\n");
1815#endif
1816
1817 int scolTarget = MMpull(m);
1818 int scolTechnique = MMpull(m);
1819 int scolCompoName = MMpull(m);
1820 int scolViewport = MMget(m, 0);
1821 if ((scolViewport == NIL) || (scolCompoName == NIL) || (scolTechnique == NIL) || (scolTarget == NIL))
1822 {
1823 MMset(m, 0, NIL);
1824 return 0;
1825 }
1826
1827 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(scolViewport));
1828 if (viewport == NULL)
1829 {
1830 MMechostr(MSKDEBUG, "vp is NULL \n");
1831 MMset(m, 0, NIL);
1832 return 0;
1833 }
1834
1835 std::string compositorName(MMstartstr(m, MTOP(scolCompoName)));
1836 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1837 if (tmpCompositor)
1838 {
1839 SCompositorTechnique* tmpTechnique = tmpCompositor->GetCompositorTechnique(MTOI(scolTechnique));
1840 if (tmpTechnique)
1841 {
1842 SCompositorTarget* tmpTarget = tmpTechnique->GetCompositorTarget(MTOI(scolTarget));
1843 if (tmpTarget)
1844 MMset(m, 0, ITOM(tmpTarget->GetNumCompositorPasses()));
1845 else
1846 MMset(m, 0, NIL);
1847 }
1848 else
1849 MMset(m, 0, NIL);
1850 }
1851 else
1852 MMset(m, 0, NIL);
1853 return 0;
1854}
1855
1856
1875{
1876#ifdef SO3_DEBUG
1877 MMechostr(MSKDEBUG, "SO3CompositorGetPassType\n");
1878#endif
1879
1880 int scolPass = MMpull(m);
1881 int scolTarget = MMpull(m);
1882 int scolTechnique = MMpull(m);
1883 int scolCompoName = MMpull(m);
1884 int scolViewport = MMget(m, 0);
1885 if ((scolViewport == NIL) || (scolCompoName == NIL) || (scolTechnique == NIL) || (scolTarget == NIL) || (scolPass == NIL))
1886 {
1887 MMset(m, 0, NIL);
1888 return 0;
1889 }
1890
1891 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(scolViewport));
1892 if (viewport == NULL)
1893 {
1894 MMechostr(MSKDEBUG, "vp is NULL \n");
1895 MMset(m, 0, NIL);
1896 return 0;
1897 }
1898
1899 std::string compositorName(MMstartstr(m, MTOP(scolCompoName)));
1900 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1901 if (tmpCompositor)
1902 {
1903 SCompositorTechnique* tmpTechnique = tmpCompositor->GetCompositorTechnique(MTOI(scolTechnique));
1904 if (tmpTechnique)
1905 {
1906 SCompositorTarget* tmpTarget = tmpTechnique->GetCompositorTarget(MTOI(scolTarget));
1907 if (tmpTarget)
1908 {
1909 SCompositorPass* tmpPass = tmpTarget->GetCompositorPass(MTOI(scolPass));
1910 if (tmpPass)
1911 MMset(m, 0, ITOM(static_cast<int>(tmpPass->GetType())));
1912 else
1913 MMset(m, 0, NIL);
1914 }
1915 else
1916 MMset(m, 0, NIL);
1917 }
1918 else
1919 MMset(m, 0, NIL);
1920 }
1921 else
1922 MMset(m, 0, NIL);
1923 return 0;
1924}
1925
1926
1940{
1941#ifdef SO3_DEBUG
1942 MMechostr(MSKDEBUG, "SO3CompositorGetMaterial\n");
1943#endif
1944
1945 int scolPass = MMpull(m);
1946 int scolTarget = MMpull(m);
1947 int scolTechnique = MMpull(m);
1948 int scolCompoName = MMpull(m);
1949 int scolViewport = MMget(m, 0);
1950 if ((scolViewport == NIL) || (scolCompoName == NIL) || (scolTechnique == NIL) || (scolTarget == NIL) || (scolPass == NIL))
1951 {
1952 MMset(m, 0, NIL);
1953 return 0;
1954 }
1955
1956 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(scolViewport));
1957 if (viewport == NULL)
1958 {
1959 MMechostr(MSKDEBUG, "vp is NULL \n");
1960 MMset(m, 0, NIL);
1961 return 0;
1962 }
1963
1964 std::string compositorName(MMstartstr(m, MTOP(scolCompoName)));
1965 SCompositor* tmpCompositor = viewport->GetCompositor(compositorName);
1966 if (tmpCompositor)
1967 {
1968 SCompositorTechnique* tmpTechnique = tmpCompositor->GetCompositorTechnique(MTOI(scolTechnique));
1969 if (tmpTechnique)
1970 {
1971 SCompositorTarget* tmpTarget = tmpTechnique->GetCompositorTarget(MTOI(scolTarget));
1972 if (tmpTarget)
1973 {
1974 SCompositorPass* tmpPass = tmpTarget->GetCompositorPass(MTOI(scolPass));
1975 if (tmpPass)
1976 {
1977 SMaterial* material = tmpPass->GetMaterial();
1978 int mat = OBJfindTH(m, SO3MATERIAL, SCOL_PTR(material));
1979 if (mat != NIL)
1980 {
1981 mat = MMfetch(m, mat, OFFOBJMAG);
1982 MMset(m, 0, mat);
1983 }
1984 else
1985 MMset(m, 0, NIL);
1986 }
1987 else
1988 MMset(m, 0, NIL);
1989 }
1990 else
1991 MMset(m, 0, NIL);
1992 }
1993 else
1994 MMset(m, 0, NIL);
1995 }
1996 else
1997 MMset(m, 0, NIL);
1998 return 0;
1999}
2000
2001
2012{
2013#ifdef SO3_DEBUG
2014 MMechostr(MSKDEBUG, "SO3ViewportSetSkyEnable\n");
2015#endif
2016
2017 int b = MMpull(m);
2018 int vp = MMget(m, 0);
2019
2020 if (vp == NIL)
2021 {
2022 MMset(m, 0, NIL);
2023 return 0;
2024 }
2025
2026 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2027 if (viewport == NULL)
2028 {
2029 MMechostr(MSKDEBUG, "vp is NULL \n");
2030 MMset(m, 0, NIL);
2031 return 0;
2032 }
2033
2034 bool state = false;
2035 if ((b != NIL) && (MTOI(b) == 1))
2036 state = true;
2037
2038 viewport->SetSkyEnable(state);
2039
2040 MMset(m, 0, ITOM(1));
2041 return 0;
2042}
2043
2044
2054{
2055#ifdef SO3_DEBUG
2056 MMechostr(MSKDEBUG, "SO3ViewportGetSkyEnable\n");
2057#endif
2058
2059 int vp = MMget(m, 0);
2060
2061 if (vp == NIL)
2062 {
2063 MMset(m, 0, NIL);
2064 return 0;
2065 }
2066
2067 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2068 if (viewport == NULL)
2069 {
2070 MMechostr(MSKDEBUG, "vp is NULL \n");
2071 MMset(m, 0, NIL);
2072 return 0;
2073 }
2074
2075 int state = 0;
2076 if (viewport->GetSkyEnable())
2077 state = 1;
2078
2079 MMset(m, 0, ITOM(state));
2080 return 0;
2081}
2082
2083
2094{
2095#ifdef SO3_DEBUG
2096 MMechostr(MSKDEBUG, "SO3ViewportSetOverlayEnable\n");
2097#endif
2098
2099 int b = MMpull(m);
2100 int vp = MMget(m, 0);
2101
2102 if (vp == NIL)
2103 {
2104 MMset(m, 0, NIL);
2105 return 0;
2106 }
2107
2108 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2109 if (viewport == NULL)
2110 {
2111 MMechostr(MSKDEBUG, "vp is NULL \n");
2112 MMset(m, 0, NIL);
2113 return 0;
2114 }
2115
2116 bool state = false;
2117 if ((b != NIL) && (MTOI(b) == 1))
2118 state = true;
2119
2120 viewport->SetOverlayEnable(state);
2121
2122 MMset(m, 0, ITOM(1));
2123 return 0;
2124}
2125
2126
2136{
2137#ifdef SO3_DEBUG
2138 MMechostr(MSKDEBUG, "SO3ViewportGetOverlayEnable\n");
2139#endif
2140
2141 int vp = MMget(m, 0);
2142
2143 if (vp == NIL)
2144 {
2145 MMset(m, 0, NIL);
2146 return 0;
2147 }
2148
2149 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2150 if (viewport == NULL)
2151 {
2152 MMechostr(MSKDEBUG, "vp is NULL \n");
2153 MMset(m, 0, NIL);
2154 return 0;
2155 }
2156
2157 int state = 0;
2158 if (viewport->GetOverlayEnable())
2159 state = 1;
2160
2161 MMset(m, 0, ITOM(state));
2162 return 0;
2163}
2164
2175{
2176#ifdef SO3_DEBUG
2177 MMechostr(MSKDEBUG, "SO3ViewportSetVisibilityMask\n");
2178#endif
2179
2180 int b = MMpull(m);
2181 int vp = MMget(m, 0);
2182 if (vp == NIL)
2183 {
2184 MMset(m, 0, NIL);
2185 return 0;
2186 }
2187
2188 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2189 if (viewport == NULL)
2190 {
2191 MMechostr(MSKDEBUG, "vp is NULL \n");
2192 MMset(m, 0, NIL);
2193 return 0;
2194 }
2195
2196 int mask = SO3_VISIBILITY_MASK_DEFAULT;
2197 if ((b != NIL))
2198 mask = MTOI(b);
2199
2200 viewport->SetVisibilityMask(mask);
2201 MMset(m, 0, ITOM(1));
2202 return 0;
2203}
2204
2205
2215{
2216#ifdef SO3_DEBUG
2217 MMechostr(MSKDEBUG, "SO3ViewportGetOverlayEnable\n");
2218#endif
2219
2220 int vp = MMget(m, 0);
2221 if (vp == NIL)
2222 {
2223 MMset(m, 0, NIL);
2224 return 0;
2225 }
2226
2227 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2228 if (viewport == NULL)
2229 {
2230 MMechostr(MSKDEBUG, "vp is NULL \n");
2231 MMset(m, 0, NIL);
2232 return 0;
2233 }
2234
2235 int state = viewport->GetVisibilityMask();
2236 MMset(m, 0, ITOM(state));
2237 return 0;
2238}
2239
2240
2252{
2253#ifdef SO3_DEBUG
2254 MMechostr(MSKDEBUG, "SO3ViewportSetVisibilityMaskIndexEnable\n");
2255#endif
2256
2257 int enable = MMpull(m);
2258 int flagIndex = MMpull(m);
2259 int vp = MMget(m, 0);
2260 if ((vp == NIL) || (flagIndex == NIL))
2261 {
2262 MMset(m, 0, NIL);
2263 return 0;
2264 }
2265
2266 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2267 if (viewport == NULL)
2268 {
2269 MMechostr(MSKDEBUG, "vp is NULL \n");
2270 MMset(m, 0, NIL);
2271 return 0;
2272 }
2273
2274 viewport->SetVisibilityMaskIndexEnable(MTOI(flagIndex), (MTOI(enable) == 1) ? true : false);
2275 MMset(m, 0, ITOM(1));
2276 return 0;
2277}
2278
2279
2290{
2291#ifdef SO3_DEBUG
2292 MMechostr(MSKDEBUG, "SO3ViewportGetVisibilityMaskIndexEnable\n");
2293#endif
2294
2295 int flagIndex = MMpull(m);
2296 int vp = MMget(m, 0);
2297 if ((vp == NIL) || (flagIndex == NIL))
2298 {
2299 MMset(m, 0, NIL);
2300 return 0;
2301 }
2302
2303 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2304 if (viewport == NULL)
2305 {
2306 MMechostr(MSKDEBUG, "vp is NULL \n");
2307 MMset(m, 0, NIL);
2308 return 0;
2309 }
2310
2311 if (viewport->GetVisibilityMaskIndexEnable(flagIndex))
2312 MMset(m, 0, ITOM(1));
2313 else
2314 MMset(m, 0, ITOM(0));
2315 return 0;
2316}
2317
2318
2332{
2333#ifdef SO3_DEBUG
2334 MMechostr(MSKDEBUG, "SO3ViewportGetPixelPositionFromWorldPos\n");
2335#endif
2336
2337 int vec = MMpull(m);
2338 int vp = MMget(m, 0);
2339 if ((vp == NIL) || (vec == NIL))
2340 {
2341 MMset(m, 0, NIL);
2342 return 0;
2343 }
2344
2345 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2346 if (viewport == NULL)
2347 {
2348 MMechostr(MSKDEBUG, "vp is NULL \n");
2349 MMset(m, 0, NIL);
2350 return 0;
2351 }
2352
2353 int x = MMfetch(m, MTOP(vec), 0);
2354 int y = MMfetch(m, MTOP(vec), 1);
2355 int z = MMfetch(m, MTOP(vec), 2);
2356
2357 if ((x == NIL) || (y == NIL) || (z == NIL))
2358 {
2359 MMset(m, 0, NIL);
2360 return 0;
2361 }
2362
2363 Ogre::Vector3 wPos = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
2364 Ogre::Vector2 screenPos(0.0f, 0.0f);
2365
2366 // out of the camera
2367 if (!viewport->GetScreenPosFromWorldPos(wPos, screenPos))
2368 {
2369 MMset(m, 0, NIL);
2370 return 0;
2371 }
2372
2373 int tuple = MMmalloc(m, 2, TYPETAB);
2374 if (tuple == NIL)
2375 {
2376 MMset(m, 0, NIL);
2377 return MERRMEM;
2378 }
2379
2380 MMstore(m, tuple, 0, ITOM((int)screenPos.x));
2381 MMstore(m, tuple, 1, ITOM((int)screenPos.y));
2382 MMset(m, 0, PTOM(tuple));
2383 return 0;
2384}
2385
2386
2399{
2400#ifdef SO3_DEBUG
2401 MMechostr(MSKDEBUG, "SO3ViewportGetWorldPosFromPixelPosition\n");
2402#endif
2403
2404 int dist = MMpull(m);
2405 int y = MMpull(m);
2406 int x = MMpull(m);
2407 int vp = MMget(m, 0);
2408 if ((vp == NIL) || (x == NIL) || (y == NIL))
2409 {
2410 MMset(m, 0, NIL);
2411 return 0;
2412 }
2413
2414 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2415 if (viewport == NULL)
2416 {
2417 MMechostr(MSKDEBUG, "vp is NULL \n");
2418 MMset(m, 0, NIL);
2419 return 0;
2420 }
2421
2422 x = MTOI(x);
2423 y = MTOI(y);
2424
2425 float fdist = 0.0;
2426 if (dist != NIL)
2427 fdist = MTOF(dist);
2428
2429 Ogre::Vector3 wPos;
2430 Ogre::Vector3 wDir;
2431 try
2432 {
2433 wPos = viewport->RayCastCamera(x, y, fdist, wDir);
2434 }
2435 catch (Ogre::Exception &e)
2436 {
2437 MMechostr(MSKRUNTIME, "SO3ViewportGetWorldPosFromPixelPosition : %s\n", e.what());
2438 MMset(m, 0, NIL);
2439 return 0;
2440 }
2441
2442 int tpos = MMmalloc(m, 3, TYPETAB);
2443 if (tpos == NIL)
2444 {
2445 MMset(m, 0, NIL);
2446 return MERRMEM;
2447 }
2448
2449 MMstore(m, tpos, 0, FTOM(wPos.x));
2450 MMstore(m, tpos, 1, FTOM(wPos.y));
2451 MMstore(m, tpos, 2, FTOM(wPos.z));
2452 MMpush(m, PTOM(tpos));
2453
2454 int tdir = MMmalloc(m, 3, TYPETAB);
2455 if (tdir == NIL)
2456 {
2457 MMpull(m);
2458 MMset(m, 0, NIL);
2459 return MERRMEM;
2460 }
2461
2462 MMstore(m, tdir, 0, FTOM(wDir.x));
2463 MMstore(m, tdir, 1, FTOM(wDir.y));
2464 MMstore(m, tdir, 2, FTOM(wDir.z));
2465 MMpush(m, PTOM(tdir));
2466
2467 // FINAL TUPPLE
2468 int result = MMmalloc(m, 2, TYPETAB);
2469 if (result == NIL)
2470 {
2471 MMpull(m);
2472 MMpull(m);
2473 MMset(m, 0, NIL);
2474 return MERRMEM;
2475 }
2476
2477 MMstore(m, result, 1, MMpull(m));
2478 MMstore(m, result, 0, MMpull(m));
2479 MMset(m, 0, PTOM(result));
2480
2481 return 0;
2482}
2483
2500{
2501#ifdef SO3_DEBUG
2502 MMechostr(MSKDEBUG, "SO3ViewportSetSSAOTechnique\n");
2503#endif
2504 int mode = MMpull(m);
2505 int vp = MMget(m, 0);
2506 if ((vp == NIL) || (mode == NIL))
2507 {
2508 MMechostr(MSKDEBUG, "Invalid parameters!\n");
2509 MMset(m, 0, NIL);
2510 return 0;
2511 }
2512
2513 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2514 if (viewport == 0)
2515 {
2516 MMechostr(MSKDEBUG, "vp is NULL \n");
2517 MMset(m, 0, NIL);
2518 return 0;
2519 }
2520
2521 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2522 if (ssaoHandler != 0)
2523 {
2524 try
2525 {
2526 ssaoHandler->SetTechnique(static_cast<SSsaoHandler::SsaoTechnique>(MTOI(mode)));
2527 MMset(m, 0, ITOM(1));
2528 return 0;
2529 }
2530 catch (const SException&)
2531 {
2532 MMechostr(MSKDEBUG, "Invalid SSAO technique!\n");
2533 MMset(m, 0, NIL);
2534 return 0;
2535 }
2536 }
2537 else
2538 {
2539 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2540 MMset(m, 0, NIL);
2541 return 0;
2542 }
2543}
2544
2545
2560{
2561#ifdef SO3_DEBUG
2562 MMechostr(MSKDEBUG, "SO3ViewportGetSSAOTechnique\n");
2563#endif
2564 int vp = MMget(m, 0);
2565 if (vp == NIL)
2566 {
2567 MMechostr(MSKDEBUG, "vp is NULL \n");
2568 MMset(m, 0, NIL);
2569 return 0;
2570 }
2571
2572 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2573 if (viewport == 0)
2574 {
2575 MMechostr(MSKDEBUG, "vp is NULL \n");
2576 MMset(m, 0, NIL);
2577 return 0;
2578 }
2579
2580 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2581 if (ssaoHandler != 0)
2582 {
2583 MMset(m, 0, ITOM(ssaoHandler->GetTechnique()));
2584 return 0;
2585 }
2586 else
2587 {
2588 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2589 MMset(m, 0, NIL);
2590 return 0;
2591 }
2592}
2593
2594
2612{
2613#ifdef SO3_DEBUG
2614 MMechostr(MSKDEBUG, "SO3ViewportSetSSAOTechniqueParameters\n");
2615#endif
2616 int p = MMpull(m);
2617 int t = MMpull(m);
2618 int vp = MMget(m, 0);
2619 if ((vp == NIL) || (t == NIL))
2620 {
2621 MMechostr(MSKDEBUG, "Invalid parameters!\n");
2622 MMset(m, 0, NIL);
2623 return 0;
2624 }
2625
2626 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2627 if (viewport == 0)
2628 {
2629 MMechostr(MSKDEBUG, "vp is NULL \n");
2630 MMset(m, 0, NIL);
2631 return 0;
2632 }
2633
2634 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2635 if (ssaoHandler != 0)
2636 {
2637 try
2638 {
2639 // Storage variable
2640 SSsaoHandler::SsaoTechniqueParameters parameters;
2641
2642 // Load points
2643 // Iterate through the recursive tuple
2644 int paramTuple;
2645 p = MTOP(p);
2646 while (p != NIL)
2647 {
2648 // Get a name/value pair
2649 paramTuple = MTOP(MMfetch(m, p, 0));
2650 SSsaoHandler::SsaoTechniqueParameter param("", SSsaoHandler::SsaoTechniqueParameterRange(0.0f, 0.0f), MTOF(MMfetch(m, paramTuple, 1)));
2651 parameters.insert(SSsaoHandler::SsaoTechniqueParameters::value_type(MMstartstr(m, MTOP(MMfetch(m, paramTuple, 0))), param));
2652 p = MTOP(MMfetch(m, p, 1));
2653 }
2654
2655 // Done!
2656 MMset(m, 0, ITOM(1));
2657 return 0;
2658 }
2659 catch (const SException&)
2660 {
2661 MMechostr(MSKDEBUG, "Error while getting SSAO parameters!\n");
2662 MMset(m, 0, NIL);
2663 return 0;
2664 }
2665 }
2666 else
2667 {
2668 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2669 MMset(m, 0, NIL);
2670 return 0;
2671 }
2672}
2673
2674
2690{
2691#ifdef SO3_DEBUG
2692 MMechostr(MSKDEBUG, "SO3ViewportGetSSAOTechniqueParameters\n");
2693#endif
2694 int t = MMpull(m);
2695 int vp = MMpull(m);
2696 if ((vp == NIL) || (t == NIL))
2697 {
2698 MMechostr(MSKDEBUG, "Invalid parameters!\n");
2699 MMpush(m, NIL);
2700 return 0;
2701 }
2702
2703 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2704 if (viewport == 0)
2705 {
2706 MMechostr(MSKDEBUG, "vp is NULL \n");
2707 MMpush(m, NIL);
2708 return 0;
2709 }
2710
2711 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2712 if (ssaoHandler != 0)
2713 {
2714 try
2715 {
2716 // Get parameters
2717 SSsaoHandler::SsaoTechniqueParameters parameters = ssaoHandler->GetTechniqueParameters(static_cast<SSsaoHandler::SsaoTechnique>(MTOI(t)));
2718
2719 // Iterate through parameters of this SSAO technique
2720 int k = 0;
2721 SSsaoHandler::SsaoTechniqueParameters::iterator iParameters = parameters.begin();
2722 while (iParameters != parameters.end())
2723 {
2724 // Push parameter name
2725 Mpushstrbloc(m, (char*)iParameters->first.c_str());
2726
2727 // Store parameter's infos in a tuple
2728 if (k = Mpushstrbloc(m, (char*)iParameters->second.displayName.c_str()))
2729 return k;
2730 if (k = MMpush(m, FTOM(iParameters->second.range.first)))
2731 return k;
2732 if (k = MMpush(m, FTOM(iParameters->second.range.second)))
2733 return k;
2734 if (k = MMpush(m, FTOM(iParameters->second.value)))
2735 return k;
2736
2737 // Create the first tuple
2738 if (MMpush(m, ITOM(4)))
2739 return MERRMEM;
2740 if (k = MBdeftab(m))
2741 return k;
2742
2743 // Create the complete tuple
2744 if (MMpush(m, ITOM(2)))
2745 return MERRMEM;
2746 if (k = MBdeftab(m))
2747 return k;
2748
2749 // Next parameter
2750 iParameters++;
2751 }
2752
2753 // Finalize future final tuple
2754 if (MMpush(m, NIL))
2755 return MERRMEM;
2756
2757 // Build the final tuple
2758 iParameters = parameters.begin();
2759 while (iParameters != parameters.end())
2760 {
2761 if (MMpush(m, ITOM(2)))
2762 return MERRMEM;
2763 if (k = MBdeftab(m))
2764 return k;
2765
2766 iParameters++;
2767 }
2768
2769 // Done!
2770 return 0;
2771 }
2772 catch (const SException&)
2773 {
2774 MMechostr(MSKDEBUG, "Error while getting SSAO parameters!\n");
2775 MMpush(m, NIL);
2776 return 0;
2777 }
2778 }
2779 else
2780 {
2781 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2782 MMpush(m, NIL);
2783 return 0;
2784 }
2785}
2786
2787
2800{
2801#ifdef SO3_DEBUG
2802 MMechostr(MSKDEBUG, "SO3ViewportSetSSAOTechniqueParameterValue\n");
2803#endif
2804 int v = MMpull(m);
2805 int p = MMpull(m);
2806 int t = MMpull(m);
2807 int vp = MMget(m, 0);
2808 if ((vp == NIL) || (t == NIL) || (p == NIL))
2809 {
2810 MMechostr(MSKDEBUG, "Invalid parameters!\n");
2811 MMset(m, 0, NIL);
2812 return 0;
2813 }
2814
2815 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2816 if (viewport == 0)
2817 {
2818 MMechostr(MSKDEBUG, "vp is NULL \n");
2819 MMset(m, 0, NIL);
2820 return 0;
2821 }
2822
2823 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2824 if (ssaoHandler != 0)
2825 {
2826 try
2827 {
2828 ssaoHandler->SetTechniqueParameterValue(static_cast<SSsaoHandler::SsaoTechnique>(MTOI(t)), MMstartstr(m, MTOP(p)), MTOF(v));
2829 MMset(m, 0, ITOM(1));
2830 return 0;
2831 }
2832 catch (const SException&)
2833 {
2834 MMechostr(MSKDEBUG, "Error while setting SSAO parameter!\n");
2835 MMset(m, 0, NIL);
2836 return 0;
2837 }
2838 }
2839 else
2840 {
2841 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2842 MMset(m, 0, NIL);
2843 return 0;
2844 }
2845}
2846
2847
2859{
2860#ifdef SO3_DEBUG
2861 MMechostr(MSKDEBUG, "SO3ViewportGetSSAOTechniqueParameterValue\n");
2862#endif
2863 int p = MMpull(m);
2864 int t = MMpull(m);
2865 int vp = MMget(m, 0);
2866 if ((vp == NIL) || (t == NIL) || (p == NIL))
2867 {
2868 MMechostr(MSKDEBUG, "Invalid parameters!\n");
2869 MMset(m, 0, NIL);
2870 return 0;
2871 }
2872
2873 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2874 if (viewport == 0)
2875 {
2876 MMechostr(MSKDEBUG, "vp is NULL \n");
2877 MMset(m, 0, NIL);
2878 return 0;
2879 }
2880
2881 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2882 if (ssaoHandler != 0)
2883 {
2884 try
2885 {
2886 MMset(m, 0, FTOM(ssaoHandler->GetTechniqueParameterValue(static_cast<SSsaoHandler::SsaoTechnique>(MTOI(t)), MMstartstr(m, MTOP(p)))));
2887 return 0;
2888 }
2889 catch (const SException&)
2890 {
2891 MMechostr(MSKDEBUG, "Error while getting SSAO parameter!\n");
2892 MMset(m, 0, NIL);
2893 return 0;
2894 }
2895 }
2896 else
2897 {
2898 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2899 MMset(m, 0, NIL);
2900 return 0;
2901 }
2902}
2903
2904
2920{
2921#ifdef SO3_DEBUG
2922 MMechostr(MSKDEBUG, "SO3ViewportSetSSAOFilter\n");
2923#endif
2924 int mode = MMpull(m);
2925 int vp = MMget(m, 0);
2926 if (vp == NIL)
2927 {
2928 MMechostr(MSKDEBUG, "vp is NULL \n\n");
2929 MMset(m, 0, NIL);
2930 return 0;
2931 }
2932
2933 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2934 if (viewport == 0)
2935 {
2936 MMechostr(MSKDEBUG, "vp is NULL \n");
2937 MMset(m, 0, NIL);
2938 return 0;
2939 }
2940
2941 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
2942 if (ssaoHandler != 0)
2943 {
2944 try
2945 {
2946 int imode = (mode == NIL) ? SSsaoHandler::SO3_SSAO_FILTER_NONE : MTOI(mode);
2947 ssaoHandler->SetFilter(static_cast<SSsaoHandler::SsaoFilter>(imode));
2948 MMset(m, 0, ITOM(1));
2949 return 0;
2950 }
2951 catch (const SException&)
2952 {
2953 MMechostr(MSKDEBUG, "Invalid SSAO filter!\n");
2954 MMset(m, 0, NIL);
2955 return 0;
2956 }
2957 }
2958 else
2959 {
2960 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
2961 MMset(m, 0, NIL);
2962 return 0;
2963 }
2964}
2965
2966
2981{
2982#ifdef SO3_DEBUG
2983 MMechostr(MSKDEBUG, "SO3ViewportGetSSAOFilter\n");
2984#endif
2985 int vp = MMget(m, 0);
2986 if (vp == NIL)
2987 {
2988 MMechostr(MSKDEBUG, "vp is NULL \n");
2989 MMset(m, 0, NIL);
2990 return 0;
2991 }
2992
2993 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
2994 if (viewport == 0)
2995 {
2996 MMechostr(MSKDEBUG, "vp is NULL \n");
2997 MMset(m, 0, NIL);
2998 return 0;
2999 }
3000
3001 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
3002 if (ssaoHandler != 0)
3003 {
3004 MMset(m, 0, ITOM(ssaoHandler->GetFilter()));
3005 return 0;
3006 }
3007 else
3008 {
3009 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
3010 MMset(m, 0, NIL);
3011 return 0;
3012 }
3013}
3014
3015
3033{
3034#ifdef SO3_DEBUG
3035 MMechostr(MSKDEBUG, "SO3ViewportSetSSAODebugMode\n");
3036#endif
3037 int mode = MMpull(m);
3038 int vp = MMget(m, 0);
3039 if (vp == NIL)
3040 {
3041 MMechostr(MSKDEBUG, "SO3_VIEWPORT is NIL\n");
3042 MMset(m, 0, NIL);
3043 return 0;
3044 }
3045
3046 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
3047 if (viewport == 0)
3048 {
3049 MMechostr(MSKDEBUG, "vp is NULL\n");
3050 MMset(m, 0, NIL);
3051 return 0;
3052 }
3053
3054 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
3055 if (ssaoHandler != 0)
3056 {
3057 try
3058 {
3059 int imode = (mode == NIL) ? SSsaoHandler::SO3_SSAO_DEBUG_MODE_NONE : MTOI(mode);
3060 ssaoHandler->SetDebugMode(static_cast<SSsaoHandler::SsaoDebugMode>(imode));
3061 MMset(m, 0, ITOM(1));
3062 return 0;
3063 }
3064 catch (const SException&)
3065 {
3066 MMechostr(MSKDEBUG, "Invalid SSAO debug mode!\n");
3067 MMset(m, 0, NIL);
3068 return 0;
3069 }
3070 }
3071 else
3072 {
3073 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
3074 MMset(m, 0, NIL);
3075 return 0;
3076 }
3077}
3078
3079
3096{
3097#ifdef SO3_DEBUG
3098 MMechostr(MSKDEBUG, "SO3ViewportGetSSAODebugMode\n");
3099#endif
3100 int vp = MMget(m, 0);
3101 if (vp == NIL)
3102 {
3103 MMechostr(MSKDEBUG, "vp is NULL \n");
3104 MMset(m, 0, NIL);
3105 return 0;
3106 }
3107
3108 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
3109 if (viewport == 0)
3110 {
3111 MMechostr(MSKDEBUG, "vp is NULL \n");
3112 MMset(m, 0, NIL);
3113 return 0;
3114 }
3115
3116 SSsaoHandler* ssaoHandler = viewport->GetSSAOhandler();
3117 if (ssaoHandler != 0)
3118 {
3119 MMset(m, 0, ITOM(ssaoHandler->GetDebugMode()));
3120 return 0;
3121 }
3122 else
3123 {
3124 MMechostr(MSKDEBUG, "SSAO not activated on viewport!\n");
3125 MMset(m, 0, NIL);
3126 return 0;
3127 }
3128}
3129
3130
3147{
3148#ifdef SO3_DEBUG
3149 MMechostr(MSKDEBUG, "SO3ViewportWriteContent\n");
3150#endif
3151
3152 int itrans = MMpull(m);
3153 int ioverlay = MMpull(m);
3154 int iheight = MMpull(m);
3155 int iwidth = MMpull(m);
3156 int ipath = MMpull(m);
3157
3158 int vp = MMget(m, 0);
3159 if (vp == NIL)
3160 {
3161 MMechostr(MSKRUNTIME, "SO3ViewportWriteContent : viewport is NIL \n");
3162 MMset(m, 0, NIL);
3163 return 0;
3164 }
3165
3166 if (ipath == NIL)
3167 {
3168 MMechostr(MSKRUNTIME, "SO3ViewportWriteContent : file path is NIL \n");
3169 MMset(m, 0, NIL);
3170 return 0;
3171 }
3172
3173 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
3174 if (viewport == 0)
3175 {
3176 MMechostr(MSKDEBUG, "vp is NULL \n");
3177 MMset(m, 0, NIL);
3178 return 0;
3179 }
3180
3181 std::string path(MMstartstr(m, MTOP(ipath)));
3182
3183 bool withOverlays = false;
3184 if ((ioverlay != NIL) && (MTOI(ioverlay) >= 1))
3185 withOverlays = true;
3186
3187 bool transparentBackground = false;
3188 if ((itrans != NIL) && (MTOI(itrans) >= 1))
3189 transparentBackground = true;
3190
3191 try
3192 {
3193 SScreenshotManager scmanager(viewport, MTOI(iwidth), MTOI(iheight), withOverlays, transparentBackground);
3194 scmanager.MakeScreenshot(path);
3195 }
3196 catch (Ogre::Exception &e)
3197 {
3198 MMechostr(MSKRUNTIME, "SO3ViewportWriteContent failed :%s", e.what());
3199 MMset(m, 0, NIL);
3200 return 0;
3201 }
3202
3203 MMset(m, 0, ITOM(1));
3204 return 0;
3205}
3206
3207
3208NativeDefinition natSO3Viewport[] = {
3209 { "SO3_SSAO_TECHNIQUE_NONE", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_TECHNIQUE_NONE) },
3210 { "SO3_SSAO_TECHNIQUE_CRYTEK", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_TECHNIQUE_CRYTEK) },
3211 { "SO3_SSAO_TECHNIQUE_HEMISPHERIC", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_TECHNIQUE_HEMISPHERIC) },
3212 { "SO3_SSAO_TECHNIQUE_CREASE_SHADING", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_TECHNIQUE_CREASE_SHADING) },
3213 { "SO3_SSAO_FILTER_NONE", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_FILTER_NONE) },
3214 { "SO3_SSAO_FILTER_BOX", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_FILTER_BOX) },
3215 { "SO3_SSAO_FILTER_BOX_SMART", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_FILTER_BOX_SMART) },
3216 { "SO3_SSAO_DEBUG_MODE_NONE", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_DEBUG_MODE_NONE) },
3217 { "SO3_SSAO_DEBUG_MODE_DEPTH", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_DEBUG_MODE_DEPTH) },
3218 { "SO3_SSAO_DEBUG_MODE_NORMAL", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_DEBUG_MODE_NORMAL) },
3219 { "SO3_SSAO_DEBUG_MODE_POSITION", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_DEBUG_MODE_POSITION) },
3220 { "SO3_SSAO_DEBUG_MODE_SSAO_ONLY", TYPVAR, "I", SCOL_TYPTYPE(SSsaoHandler::SO3_SSAO_DEBUG_MODE_SSAO_ONLY) },
3221 { "SO3_COMPOSITOR_PASS_CLEAR", TYPVAR, "I", SCOL_TYPTYPE(SO3::SO3_COMPOSITOR_PASS_CLEAR) },
3222 { "SO3_COMPOSITOR_PASS_STENCIL", TYPVAR, "I", SCOL_TYPTYPE(SO3::SO3_COMPOSITOR_PASS_STENCIL) },
3223 { "SO3_COMPOSITOR_PASS_RENDERSCENE", TYPVAR, "I", SCOL_TYPTYPE(SO3::SO3_COMPOSITOR_PASS_RENDERSCENE) },
3224 { "SO3_COMPOSITOR_PASS_RENDERQUAD", TYPVAR, "I", SCOL_TYPTYPE(SO3::SO3_COMPOSITOR_PASS_RENDERQUAD) },
3225 { "SO3_COMPOSITOR_PASS_RENDER_CUSTOM", TYPVAR, "I", SCOL_TYPTYPE(SO3::SO3_COMPOSITOR_PASS_RENDER_CUSTOM) },
3226 { "SO3ViewportCreate", 8, "fun [Chn SO3_BUFFER SO3_OBJECT F F F F I] SO3_VIEWPORT", SO3ViewportCreate },
3227 { "SO3ViewportDestroy", 1, "fun [SO3_VIEWPORT] I", SO3ViewportDestroy },
3228 { "SO3ViewportResize", 3, "fun [SO3_VIEWPORT I I] I", SO3ViewportResize },
3229 { "SO3ViewportGetPriority", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetPriority },
3230 { "SO3ViewportGetShadowEnabled", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetShadowEnabled },
3231 { "SO3ViewportSetPositionSize", 5, "fun [SO3_VIEWPORT F F F F] I", SO3ViewportSetPositionSize },
3232 { "SO3ViewportSetShadowEnabled", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetShadowEnabled },
3233 { "SO3ViewportSetDeferredEnabled", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetDeferredEnabled },
3234 { "SO3ViewportGetDeferredEnabled", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetDeferredEnabled },
3235 { "SO3ViewportSetHDREnabled", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetHDREnabled },
3236 { "SO3ViewportGetHDREnabled", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetHDREnabled },
3237 { "SO3ViewportSetHDRBlurAmount", 2, "fun [SO3_VIEWPORT F] I", SO3ViewportSetHDRBlurAmount },
3238 { "SO3ViewportSetHDREffectAmount", 2, "fun [SO3_VIEWPORT F] I", SO3ViewportSetHDREffectAmount },
3239 { "SO3ViewportSetHDRGamma", 2, "fun [SO3_VIEWPORT F] I", SO3ViewportSetHDRGamma },
3240 { "SO3ViewportSetSSAOEnabled", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetSSAOEnabled },
3241 { "SO3ViewportGetSSAOEnabled", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetSSAOEnabled },
3242 { "SO3ViewportSetSSAOTechnique", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetSSAOTechnique },
3243 { "SO3ViewportGetSSAOTechnique", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetSSAOTechnique },
3244 { "SO3ViewportSetSSAOTechniqueParameters", 3, "fun [SO3_VIEWPORT I [[S F] r1]] I", SO3ViewportSetSSAOTechniqueParameters },
3245 { "SO3ViewportGetSSAOTechniqueParameters", 2, "fun [SO3_VIEWPORT I] [[S [S F F F]] r1]", SO3ViewportGetSSAOTechniqueParameters },
3246 { "SO3ViewportSetSSAOTechniqueParameterValue", 4, "fun [SO3_VIEWPORT I S F] I", SO3ViewportSetSSAOTechniqueParameterValue },
3247 { "SO3ViewportGetSSAOTechniqueParameterValue", 3, "fun [SO3_VIEWPORT I S] F", SO3ViewportGetSSAOTechniqueParameterValue },
3248 { "SO3ViewportSetSSAOFilter", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetSSAOFilter },
3249 { "SO3ViewportGetSSAOFilter", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetSSAOFilter },
3250 { "SO3ViewportSetSSAODebugMode", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetSSAODebugMode },
3251 { "SO3ViewportGetSSAODebugMode", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetSSAODebugMode },
3252 { "SO3ViewportGetDeferredAntiAliasingMode", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetDeferredAntiAliasingMode },
3253 { "SO3ViewportSetDeferredAntiAliasingMode", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetDeferredAntiAliasingMode },
3254 { "SO3ViewportGetDeferredDebugMode", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetDeferredDebugMode },
3255 { "SO3ViewportSetDeferredDebugMode", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetDeferredDebugMode },
3256 { "SO3ViewportGetPositionSize", 1, "fun [SO3_VIEWPORT] [F F F F]", SO3ViewportGetPositionSize },
3257 { "SO3ViewportGetPixelPositionSize", 1, "fun [SO3_VIEWPORT] [I I I I]", SO3ViewportGetPixelPositionSize },
3258 { "SO3ViewportGetCamera", 1, "fun [SO3_VIEWPORT] SO3_OBJECT", SO3ViewportGetCamera },
3259 { "SO3ViewportSetBackgroundColor", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetBackgroundColor },
3260 { "SO3ViewportGetBackgroundColor", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetBackgroundColor },
3261 { "SO3ViewportAddCompositor", 3, "fun [SO3_VIEWPORT S S] I", SO3ViewportAddCompositor },
3262 { "SO3ViewportSetMaterialScheme", 2, "fun [SO3_VIEWPORT S] I", SO3ViewportSetMaterialScheme },
3263 { "SO3ViewportGetMaterialScheme", 1, "fun [SO3_VIEWPORT] S", SO3ViewportGetMaterialScheme },
3264 { "SO3ViewportListEnabledCompositors", 1, "fun [SO3_VIEWPORT] [S r1]", SO3ViewportListEnabledCompositors },
3265 { "SO3ViewportRemoveCompositor", 2, "fun [SO3_VIEWPORT S] I", SO3ViewportRemoveCompositor },
3266 { "SO3CompositorSetEnable", 3, "fun [SO3_VIEWPORT S I] I", SO3CompositorSetEnable },
3267 { "SO3CompositorGetEnable", 2, "fun [SO3_VIEWPORT S] I", SO3CompositorGetEnable },
3268 { "SO3CompositorGetNumTechniques", 2, "fun [SO3_VIEWPORT S] I", SO3CompositorGetNumTechniques },
3269 { "SO3CompositorGetNumTargets", 3, "fun [SO3_VIEWPORT S I] I", SO3CompositorGetNumTargets },
3270 { "SO3CompositorGetNumPasses", 4, "fun [SO3_VIEWPORT S I I] I", SO3CompositorGetNumPasses },
3271 { "SO3CompositorGetPassType", 5, "fun [SO3_VIEWPORT S I I I] I", SO3CompositorGetPassType },
3272 { "SO3CompositorGetMaterial", 5, "fun [SO3_VIEWPORT S I I I] I", SO3CompositorGetMaterial },
3273 { "SO3ViewportSetClearDepth", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetClearDepth },
3274 { "SO3ViewportGetClearDepth", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetClearDepth },
3275 { "SO3ViewportSetClearColor", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetClearColor },
3276 { "SO3ViewportGetClearColor", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetClearColor },
3277 { "SO3ViewportSetSkyEnable", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetSkyEnable },
3278 { "SO3ViewportGetSkyEnable", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetSkyEnable },
3279 { "SO3ViewportSetOverlayEnable", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetOverlayEnable },
3280 { "SO3ViewportGetOverlayEnable", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetOverlayEnable },
3281 { "SO3ViewportSetVisibilityMask", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportSetVisibilityMask },
3282 { "SO3ViewportGetVisibilityMask", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetVisibilityMask },
3283 { "SO3ViewportSetVisibilityMaskIndexEnable", 3, "fun [SO3_VIEWPORT I I] I", SO3ViewportSetVisibilityMaskIndexEnable },
3284 { "SO3ViewportGetVisibilityMaskIndexEnable", 2, "fun [SO3_VIEWPORT I] I", SO3ViewportGetVisibilityMaskIndexEnable },
3285 { "SO3ViewportGetPixelPositionFromWorldPos", 2, "fun [SO3_VIEWPORT [F F F]] [I I]", SO3ViewportGetPixelPositionFromWorldPos },
3286 { "SO3ViewportGetWorldPosFromPixelPosition", 4, "fun [SO3_VIEWPORT I I F] [[F F F] [F F F]]", SO3ViewportGetWorldPosFromPixelPosition },
3287 { "SO3ViewportGetTriangleCount", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetTriangleCount },
3288 { "SO3ViewportGetBatchCount", 1, "fun [SO3_VIEWPORT] I", SO3ViewportGetBatchCount },
3289 { "SO3ViewportWriteContent", 6, "fun [SO3_VIEWPORT W I I I I] I", SO3ViewportWriteContent }
3290};
3291
3292
3298int SCOLloadViewport(mmachine m, cbmachine w)
3299{
3300 return PKhardpak2(m, "SO3Viewport.pkg", sizeof(natSO3Viewport) / sizeof(natSO3Viewport[0]), natSO3Viewport);
3301}
3302
3303
3309{
3310 return 0;
3311}
int(* CallMainThread)(void *, mmachine m)
main include
Definition SO3SCOL.cpp:84
int SCOLfreeViewport()
free the SO3Engine Viewport function
int SCOLloadViewport(mmachine m, cbmachine w)
Load the SO3Engine Viewport function.
NativeDefinition natSO3Viewport[]
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
Definition SO3SCOL.cpp:5150
SCOL_EXPORT void SCOL_PTR_TYPE param
Definition SO3SCOL.cpp:5089
int SO3MATERIAL
Definition SO3SCOL.cpp:97
int SO3OBJTYPE
Definition SO3SCOL.cpp:90
int SO3VPTYPE
Definition SO3SCOL.cpp:94
int SO3BUFFER
Definition SO3SCOL.cpp:89
Manage highres screenshots .
int SO3ViewportWriteContent(mmachine m)
SO3ViewportWriteContent : function to write the content of a SO3_VIEWPORT into a file the size can be...
int SO3CompositorGetNumTechniques(mmachine m)
SO3CompositorGetNumTechniques :
int SO3ViewportSetShadowEnabled(mmachine m)
SO3ViewportSetShadowEnabled : set shadows enable state on a given viewport.
int SO3ViewportSetHDRGamma(mmachine m)
SO3ViewportSetHDRGamma : set the HDR gamma correction on a given viewport.
int SO3CompositorGetMaterial(mmachine m)
SO3CompositorGetMaterial :
int SO3ViewportGetTriangleCount(mmachine m)
SO3ViewportGetTriangleCount : get the number of triangles rendered in last viewport update.
int SO3ViewportSetVisibilityMask(mmachine m)
SO3ViewportSetVisibilityMask : Set the viewport visibility mask for exclude some objects from the ren...
int SO3ViewportGetDeferredAntiAliasingMode(mmachine m)
SO3ViewportGetDeferredAntiAliasingMode : get deffered Anti aliasing method used on a given viewport.
int SO3CompositorGetEnable(mmachine m)
SO3CompositorGetEnable : Get Compositor state on a given viewport.
int SO3ViewportGetSSAOTechniqueParameterValue(mmachine m)
SO3ViewportGetSSAOTechniqueParameterValue : Retrieves a parameter's value for the given SSAO techniqu...
int SO3ViewportGetClearDepth(mmachine m)
SO3ViewportGetClearDepth : Get if the viewport clear the depth buffer or not.
int SO3ViewportGetPositionSize(mmachine m)
SO3ViewportGetPositionSize : Get Position and Size of on a given viewport, relative to the window.
int SO3ViewportGetSSAODebugMode(mmachine m)
SO3ViewportGetSSAODebugMode : Retrieves the current SSAO debug visualization mode in use.
int SO3ViewportSetOverlayEnable(mmachine m)
SO3ViewportSetOverlayEnable : Set the overlay visibility state on a given viewport.
int SO3ViewportGetPixelPositionFromWorldPos(mmachine m)
SO3ViewportGetPixelPositionFromWorldPos : Get the pixel position of a 3D world position return NIL if...
int SO3ViewportDestroy(mmachine m)
SO3ViewportDestroy : destroy a SO3_VIEWPORT object.
int SO3CompositorSetEnable(mmachine m)
SO3CompositorSetEnable : Set Compositor state on a given viewport.
int SO3CompositorGetNumPasses(mmachine m)
SO3CompositorGetNumPasses :
int SO3ViewportSetHDRBlurAmount(mmachine m)
SO3ViewportSetHDRBlurAmount : set the HDR blur amount on a given viewport.
int SO3ViewportSetDeferredAntiAliasingMode(mmachine m)
SO3ViewportSetDeferredAntiAliasingMode : set deffered anti aliasing method on a given viewport.
int SO3ViewportAddCompositor(mmachine m)
SO3ViewportAddCompositor : Add a compositor on a given viewport.
int SO3ViewportSetPositionSize(mmachine m)
SO3ViewportSetPositionSize : set Position and size on a given viewport.
int SO3ViewportSetSSAODebugMode(mmachine m)
SO3ViewportSetSSAODebugMode : Sets the SSAO debug vizualization to use.
int SO3CompositorGetNumTargets(mmachine m)
SO3CompositorGetNumTargets :
int SO3ViewportGetMaterialScheme(mmachine m)
SO3ViewportGetMaterialScheme : Get the material scheme which the viewport should use.
int SO3ViewportSetClearColor(mmachine m)
SO3ViewportSetClearColor : defines if the viewport clear the color buffer or not.
int SO3CompositorGetPassType(mmachine m)
SO3CompositorGetPassType :
int SO3ViewportCreate(mmachine m)
SO3ViewportCreate : create a new SO3_VIEWPORT object.
int SO3ViewportGetVisibilityMaskIndexEnable(mmachine m)
SO3ViewportGetVisibilityMaskIndexEnable : BLABLA.
int SO3ViewportSetClearDepth(mmachine m)
SO3ViewportSetClearDepth : defines if the viewport clear the depth buffer or not.
int SO3ViewportGetDeferredDebugMode(mmachine m)
SO3ViewportGetDeferredDebugMode : get deffered debug visualization on a given viewport.
int SO3ViewportSetSSAOTechnique(mmachine m)
SO3ViewportSetSSAOTechnique : Sets the SSAO technique to use.
int SO3ViewportSetBackgroundColor(mmachine m)
SO3ViewportSetBackgroundColor : defines background color on a given viewport.
int SO3ViewportSetSSAOTechniqueParameters(mmachine m)
SO3ViewportSetSSAOTechniqueParameters : Sets all parameter for the given SSAO technique....
int SO3ViewportSetHDREffectAmount(mmachine m)
SO3ViewportSetHDREffectAmount : set the HDR shaft effect amount on a given viewport.
int SO3ViewportGetSSAOFilter(mmachine m)
SO3ViewportGetSSAOFilter : Retrieves the current SSAO filter in use.
int SO3ViewportGetSSAOTechnique(mmachine m)
SO3ViewportGetSSAOTechnique : Retrieves the current SSAO technique in use.
int SO3ViewportSetSSAOEnabled(mmachine m)
SO3ViewportSetSSAOEnabled : set SSAO enable state on a given viewport SSAO is an automated ambient oc...
int SO3ViewportGetDeferredEnabled(mmachine m)
SO3ViewportGetDeferredEnabled : get the deferred state of a given viewport.
int SO3ViewportSetMaterialScheme(mmachine m)
SO3ViewportSetMaterialScheme : Set a material scheme on a given viewport.
int SO3ViewportGetOverlayEnable(mmachine m)
SO3ViewportGetOverlayEnable : Get the overlay visibility state on a given viewport.
int SO3ViewportGetShadowEnabled(mmachine m)
SO3ViewportGetShadowEnabled : get the shadow state of a given viewport.
int SO3ViewportResize(mmachine m)
SO3ViewportResize : resize a given viewport.
int SO3ViewportSetSkyEnable(mmachine m)
SO3ViewportSetSkyEnable : Set the skies visibility state on a given viewport.
int SO3ViewportSetSSAOTechniqueParameterValue(mmachine m)
SO3ViewportSetSSAOTechniqueParameterValue : Retrieves a parameter's value for the given SSAO techniqu...
int SO3ViewportListEnabledCompositors(mmachine m)
SO3ViewportListEnabledCompositors : List compositors name on a given viewport.
int SO3ViewportSetHDREnabled(mmachine m)
SO3ViewportSetHDREnabled : set HDR enable state on a given viewport.
int SO3ViewportGetCamera(mmachine m)
SO3ViewportGetCamera : Get the camera attached to a given viewport.
int SO3ViewportSetDeferredEnabled(mmachine m)
SO3ViewportSetDeferredEnabled : set deffered render enable state on a given viewport.
int SO3ViewportSetDeferredDebugMode(mmachine m)
SO3ViewportSetDeferredDebugMode : set deffered debug visualization on a given viewport.
int SO3ViewportGetSSAOTechniqueParameters(mmachine m)
SO3ViewportGetSSAOTechniqueParameters : Retrieves every parameter for the given SSAO technique.
int SO3ViewportGetSSAOEnabled(mmachine m)
SO3ViewportGetSSAOEnabled : get the SSAO state of a given viewport.
int SO3ViewportGetSkyEnable(mmachine m)
SO3ViewportGetSkyEnable : Get the skies visibility state on a given viewport.
int SO3ViewportGetBatchCount(mmachine m)
SO3ViewportGetBatchCount : get the number of batch rendered in last viewport update.
int SO3ViewportGetPixelPositionSize(mmachine m)
SO3ViewportGetPixelPositionSize : Get Position and Size in pixels of on a given viewport.
int SO3ViewportGetBackgroundColor(mmachine m)
SO3ViewportGetBackgroundColor : Get the background color on a given viewport.
int SO3ViewportRemoveCompositor(mmachine m)
SO3ViewportRemoveCompositor : Remove a compositor from a given viewport.
int SO3ViewportSetVisibilityMaskIndexEnable(mmachine m)
SO3ViewportSetVisibilityMaskIndexEnable : BLABLA.
int SO3ViewportGetHDREnabled(mmachine m)
SO3ViewportGetHDREnabled : get the HDR state of a given viewport.
int SO3ViewportGetWorldPosFromPixelPosition(mmachine m)
SO3ViewportGetWorldPosFromPixelPosition : Get the world position of a 2D pixel position.
int SO3ViewportGetVisibilityMask(mmachine m)
SO3ViewportGetVisibilityMask : Get the current viewport visibility flag.
int SO3ViewportGetClearColor(mmachine m)
SO3ViewportGetClearColor : Get if the viewport clear the color buffer or not.
int SO3ViewportSetSSAOFilter(mmachine m)
SO3ViewportSetSSAOFilter : Sets the SSAO filter to use.
int SO3ViewportGetPriority(mmachine m)
SO3ViewportGetPriority : get the priority (z order) of a given viewport.
@ SO3_COMPOSITOR_PASS_STENCIL
@ SO3_COMPOSITOR_PASS_CLEAR
@ SO3_COMPOSITOR_PASS_RENDERQUAD
@ SO3_COMPOSITOR_PASS_RENDERSCENE
@ SO3_COMPOSITOR_PASS_RENDER_CUSTOM