/** Package for the Scol settings This is a part of the 'Scol voyager' ================================= License : This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt Author : Bastien Bourineau */ // OGRE3D Setup interface structure struct OG3DSETUPstr = [ OGSETUP_WIN : ObjWin, OGSETUP_INFO : ObjText, OGSETUP_LABEL : ObjText, OGSETUP_LABEL2 : ObjText, OGSETUP_LABELCARDINFO1 : ObjText, OGSETUP_LABELCARDINFO2 : ObjText, OGSETUP_LABELCARDINFO3 : ObjText, OGSETUP_LABELHARD : ObjText, OGSETUP_LABELSO3VERSION : ObjText, OGSETUP_LABELOGREVERSION : ObjText, OGSETUP_LABELSHADER3 : ObjText, OGSETUP_RENDERLABEL : ObjText, OGSETUP_RENDERCOMBO : ObjBox, OGSETUP_ALIASLABEL : ObjText, OGSETUP_ALIASCOMBO : ObjBox, OGSETUP_VSYNCCHECK : ObjCheck, OGSETUP_QUADBUFFERCHECK : ObjCheck, OGSETUP_LOGO : ObjBitmap, OGSETUP_VIEW3D : V3Dview // 3D preview ] mkOG3DSETUPstr;; typeof SETUP_OG3D = OG3DSETUPstr;; /* ********************************************************************************************* / Setup Ogre 3D Interface / ********************************************************************************************* */ fun cbSetupOg3dPreRender(viewstr, p)= let p -> [sessionstr logo] in SO3ObjectRotateYaw logo 0.001 0; 0;; fun cbInitOg3dView(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let V3DaddLight sessionstr "voyager_default_light" nil SO3_DIRECTIONAL_LIGHT (make_rgba 250 250 250 0) (make_rgba 255 255 255 0) 150.0 0.5 0.0 0.0 -> light in ( V3DaddViewport viewstr 0.0 0.0 1.0 1.0 0x0; V3DchangeCameraViewport sessionstr nil (V3DgetDefaultCamera sessionstr); V3DsetObjectPos light [0.0 0.0 0.0]; SO3ObjectRotateYaw light 2.3 0; SO3ObjectRotatePitch light (-.0.5) 0; V3DsetObjectPos sessionstr.V3D_shellNavigate [0.0 0.80 0.0]; V3DsetObjectPos (V3DgetDefaultCamera sessionstr) [0.0 0.0 6.0]; V3DsetCamera (V3DgetDefaultCamera sessionstr) nil 1.0 0.01 100000.0; V3DenableView viewstr 1; V3DenableKeyboard viewstr 1; V3DenableMouse viewstr 1; V3DenableNavigate sessionstr 1; V3DshowSceneGrid sessionstr 1; SO3SceneLoadResource (V3DgetSession sessionstr) "VoyagerDefaultResources" _checkpack "locked/voyager/3d/logo.material" SO3_RESOURCE_MATERIAL; SO3SceneLoadResource (V3DgetSession sessionstr) "VoyagerDefaultResources" _checkpack "locked/voyager/3d/logo.mesh" SO3_RESOURCE_MESH; let SO3SceneLoadEntity (V3DgetSession sessionstr) "VoyagerDefaultResources" "voyager_test_logo" _checkpack "locked/voyager/3d/logo.mesh" -> logo in ( SO3ObjectSetScale logo [0.01 0.01 0.01]; V3DsetCbPreRender viewstr mkfun2 @cbSetupOg3dPreRender [sessionstr logo]; ); ); 0;; fun getRendererByName(name)= if (!strcmp name "DirectX") || (!strcmp name "DirectX9") || (!strcmp name "DirectX11") then SO3_DIRECTX_RENDERER else if (!strcmp name "Vulkan") then SO3_VULKAN_RENDERER else if (!strcmp name "Metal") then SO3_METAL_RENDERER else if (!strcmp name "Tiny") then SO3_TINY_RENDERER else SO3_OPENGL_RENDERER;; fun cbSetupOg3dRender(cmb, p, pos, name)= chgusm "SO3Renderer" nil let strbuild ("SO3Renderer"::name::nil)::nil -> s in substr s 0 (strlen s)-1; _RSTcombo SETUP_OG3D.OGSETUP_ALIASCOMBO; let getRendererByName name -> irendermode in let SO3GetMultisamplingMode irendermode -> lp in let sizelist lp -> size in let 0 -> i in ( // Populate AA combobox while i < size do ( let nth_list lp i -> ap in _ADDcombo SETUP_OG3D.OGSETUP_ALIASCOMBO 100 ap; set i = i + 1; ); // Show / Hide quad buffer checkbox let if irendermode == SO3_OPENGL_RENDERER then WINDOW_UNHIDDEN else WINDOW_HIDDEN -> showcheckbox in _SHOWcheck SETUP_OG3D.OGSETUP_QUADBUFFERCHECK showcheckbox; ); _SELcombo SETUP_OG3D.OGSETUP_ALIASCOMBO 0; V3DdsView SETUP_OG3D.OGSETUP_VIEW3D; SO3ResetEngine; let (iSetupChildW - 20) -> iw in let (iSetupChildH - 320) -> ih in set SETUP_OG3D.OGSETUP_VIEW3D = V3DcrView _channel SETUP_OG3D.OGSETUP_WIN 10 205 iw ih @cbInitOg3dView nil 1; V3DsetScreenInfos SETUP_OG3D.OGSETUP_VIEW3D 5 5 140 90 16 0xffffff; V3DenableScreenInfos SETUP_OG3D.OGSETUP_VIEW3D 1; _DLGMessageBox _channel SETUP_OG3D.OGSETUP_WIN loc "ALERT" loc "CONF3DRESTARTANTIALIAS" 0; 0;; fun cbSetupOg3dQuadBuffer(chk, p, state)= chgusm "QuadBuffer" nil let strbuild ("QuadBuffer"::(itoa state)::nil)::nil -> s in substr s 0 (strlen s)-1; _DLGMessageBox _channel SETUP_OG3D.OGSETUP_WIN loc "ALERT" loc "CONF3DRESTARTQUADBUFFER" 0; 0;; fun cbSetupOg3dMultisampling(cmb, p, pos, name)= chgusm "3DFSAA" nil let strbuild ("3DFSAA"::name::nil)::nil -> s in substr s 0 (strlen s)-1; V3DdsView SETUP_OG3D.OGSETUP_VIEW3D; let (iSetupChildW - 20) -> iw in let (iSetupChildH - 320) -> ih in set SETUP_OG3D.OGSETUP_VIEW3D = V3DcrView _channel SETUP_OG3D.OGSETUP_WIN 10 205 iw ih @cbInitOg3dView nil 1; V3DsetScreenInfos SETUP_OG3D.OGSETUP_VIEW3D 5 5 140 90 16 0xffffff; V3DenableScreenInfos SETUP_OG3D.OGSETUP_VIEW3D 1; 0;; fun cbSetupOg3dVsync(chk, p, state)= chgusm "VSYNC" nil let strbuild ("VSYNC"::(itoa state)::nil)::nil -> s in substr s 0 (strlen s)-1; 0;; fun cbSetupOg3dPaint(objwin, p)= _BLTbitmap SETUP_OG3D.OGSETUP_WIN SETUP_OG3D.OGSETUP_LOGO (iSetupChildW - 130) 10; 0;; // TODO engine version fun cbSetupCrOg3D(strSetup)= set SETUP_OG3D = mkOG3DSETUPstr [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]; set SETUP_OG3D.OGSETUP_WIN = _CRwindow _channel strSetup.SETUP_WIN 210 10 iSetupChildW iSetupChildH WN_CHILDINSIDE|WN_NOCAPTION ""; // 3D view first to get the card infos let (iSetupChildW - 20) -> iw in let (iSetupChildH - 320) -> ih in set SETUP_OG3D.OGSETUP_VIEW3D = V3DcrView _channel SETUP_OG3D.OGSETUP_WIN 10 205 iw ih @cbInitOg3dView nil 1; let SO3GetGeneralInfo -> [vendeurCPU nameCPU nbProcesseurs RAM OS GraphicCard Driver versionDirectX] in let SO3GetAPIVersion -> [so3v ogrev] in ( set SETUP_OG3D.OGSETUP_INFO = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 10 (iSetupChildW - 150) 50 ET_ALIGN_LEFT loc "CONFOG3DMESS"; set SETUP_OG3D.OGSETUP_LOGO = _LDjpeg _channel _checkpack "locked/voyager/img/ogre-logo.jpg"; set SETUP_OG3D.OGSETUP_LABEL = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 70 (iSetupChildW - 20) 20 ET_ALIGN_LEFT|ET_BORDER loc "CONF3DLABEL1"; set SETUP_OG3D.OGSETUP_LABELCARDINFO1 = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 95 (iSetupChildW - 20) 15 ET_ALIGN_LEFT strcatn (loc "CONFOG3DCARD")::" "::GraphicCard::nil; set SETUP_OG3D.OGSETUP_LABELCARDINFO2 = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 110 (iSetupChildW - 20) 15 ET_ALIGN_LEFT strcatn (loc "CONFOG3DDRIVER")::" "::Driver::nil; set SETUP_OG3D.OGSETUP_LABELSO3VERSION = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 140 (iSetupChildW - 20) 15 ET_ALIGN_LEFT strcatn (loc "CONFOG3DSO3VER")::" "::so3v::nil; set SETUP_OG3D.OGSETUP_LABELOGREVERSION = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 155 (iSetupChildW - 20) 15 ET_ALIGN_LEFT strcatn (loc "CONFOG3DOGREVER")::" "::ogrev::nil; set SETUP_OG3D.OGSETUP_LABEL2 = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 180 (iSetupChildW - 20) 20 ET_ALIGN_LEFT|ET_BORDER loc "CONF3DLABEL2"; set SETUP_OG3D.OGSETUP_RENDERLABEL = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 (iSetupChildH - 105) 120 20 ET_ALIGN_LEFT loc "CONFOG3DRENDER"; set SETUP_OG3D.OGSETUP_RENDERCOMBO = _CBcombo _CRcombo _channel SETUP_OG3D.OGSETUP_WIN 135 (iSetupChildH - 105) 100 120 CB_NOEDIT "" @cbSetupOg3dRender nil; set SETUP_OG3D.OGSETUP_ALIASLABEL = _CRtext _channel SETUP_OG3D.OGSETUP_WIN 10 (iSetupChildH - 80) 120 20 ET_ALIGN_LEFT loc "CONFOG3DANTIALIAS"; set SETUP_OG3D.OGSETUP_ALIASCOMBO = _CBcombo _CRcombo _channel SETUP_OG3D.OGSETUP_WIN 135 (iSetupChildH - 80) 100 120 CB_NOEDIT "" @cbSetupOg3dMultisampling nil; set SETUP_OG3D.OGSETUP_VSYNCCHECK = _CBcheck _CRcheck _channel SETUP_OG3D.OGSETUP_WIN 10 (iSetupChildH - 55) (iSetupChildW - 20) 20 CH_TABFOCUS loc "CONFOG3DVSYNC" @cbSetupOg3dVsync nil; set SETUP_OG3D.OGSETUP_QUADBUFFERCHECK = _CBcheck _CRcheck _channel SETUP_OG3D.OGSETUP_WIN 10 (iSetupChildH - 30) (iSetupChildW - 20) 20 CH_TABFOCUS loc "CONFOG3DQUADBUFFER" @cbSetupOg3dQuadBuffer nil; let (let (getInfo (strextr _loadusmini nil) "SO3Renderer")->n in if n==nil then "DirectX" else n) -> renderermode in ( _ADDcombo SETUP_OG3D.OGSETUP_RENDERCOMBO 100 "DirectX"; //_ADDcombo SETUP_OG3D.OGSETUP_RENDERCOMBO 100 "DirectX11"; _ADDcombo SETUP_OG3D.OGSETUP_RENDERCOMBO 100 "OpenGL"; _ADDcombo SETUP_OG3D.OGSETUP_RENDERCOMBO 100 "Vulkan"; //_ADDcombo SETUP_OG3D.OGSETUP_RENDERCOMBO 100 "Tiny"; //_ADDcombo SETUP_OG3D.OGSETUP_RENDERCOMBO 100 "Metal"; let getRendererByName renderermode -> irendermode in let SO3GetMultisamplingMode irendermode -> lp in let sizelist lp -> size in let 0 -> i in ( // Populate AA combobox while i < size do ( let nth_list lp i -> ap in _ADDcombo SETUP_OG3D.OGSETUP_ALIASCOMBO 100 ap; set i = i + 1; ); // Show / Hide quad buffer checkbox let if irendermode == SO3_OPENGL_RENDERER then WINDOW_UNHIDDEN else WINDOW_HIDDEN -> showcheckbox in _SHOWcheck SETUP_OG3D.OGSETUP_QUADBUFFERCHECK showcheckbox; ); _SSELcombo SETUP_OG3D.OGSETUP_ALIASCOMBO (let (getInfo (strextr _loadusmini nil) "3DFSAA")->n in if n==nil then "None" else n); _SSELcombo SETUP_OG3D.OGSETUP_RENDERCOMBO if ((!strcmp renderermode "DirectX9") || (!strcmp renderermode "DirectX11")) then "DirectX" else renderermode; let (getInfo (strextr _loadusmini nil) "SO3Renderer") -> n in if n != nil then nil else chgusm "SO3Renderer" nil let strbuild ("SO3Renderer"::"OpenGL"::nil)::nil -> s in substr s 0 (strlen s)-1; let _GETcombo SETUP_OG3D.OGSETUP_ALIASCOMBO -> [_ sel] in if sel != nil then nil else ( _SELcombo SETUP_OG3D.OGSETUP_ALIASCOMBO 0; let _GETcombo SETUP_OG3D.OGSETUP_ALIASCOMBO -> [_ sel] in chgusm "3DFSAA" nil let strbuild ("3DFSAA"::sel::nil)::nil -> s in substr s 0 (strlen s)-1; ); ); V3DsetScreenInfos SETUP_OG3D.OGSETUP_VIEW3D 5 5 140 90 16 0xffffff; V3DenableScreenInfos SETUP_OG3D.OGSETUP_VIEW3D 1; _CBwinPaint SETUP_OG3D.OGSETUP_WIN @cbSetupOg3dPaint nil; // Check / Uncheck quad buffer checkbox after creating the render window _SETcheck SETUP_OG3D.OGSETUP_QUADBUFFERCHECK SO3GetQuadBufferEnable; _SETcheck SETUP_OG3D.OGSETUP_VSYNCCHECK atoi (getInfo (strextr _loadusmini nil) "VSYNC"); ); 0;; fun dsSetupOg3D()= V3DdsView SETUP_OG3D.OGSETUP_VIEW3D; set SETUP_OG3D.OGSETUP_VIEW3D = nil; _DSwindow SETUP_OG3D.OGSETUP_WIN; set SETUP_OG3D = nil; 0;; fun loadSetupOg3D(strSetup)= addSetupMenu loc "CONFOGRE3D" (mkfun1 @cbSetupCrOg3D strSetup) @dsSetupOg3D; 0;;