1. Introduction and my solution to using Morfit 3D with Euphoria
- Posted by Mark Brown <mabrown at SENET.COM.AU> Dec 31, 1999
- 554 views
- Last edited Jan 01, 2000
------=_NextPart_000_0014_01BF53C6.46C04920 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello everyone My name is Mark Brown and I have been using Euphoria for a couple of = months now. I have been fascinated by the discussion about the Morfit 3D = engine so I went to the Morfit site and downloaded both the Visual C++ = and Visual Basic versions of the SDK. On seeing the demos I just had to = attempt to use it under Euphoria. I have succeeded in getting the = "Rotate Camera" example from the SDK ported to and running under = Euphoria (loads a world, rotates world around all 3 axis etc... ) using = the following method :- 1. I modified the Visual Basic (NOT the C++) include file MorfitVB.bas = which is supplied with the VB SDK as follows :- a. commented out the line Attribute VB_Name =3D "Module1" b. changed the VB constant definitions from (for example) =20 Public Constant OK =3D 0 to Global Constant OK =3D 0 c. added the following euphoria code after the constant definitions = but before declaring the functions -- ******** constant C_DWORD =3D C_ULONG constant C_ =3D 0 -- just a dummy to stop errors for now atom m3d_dll m3d_dll =3D open_dll("morfit.dll") if m3d_dll =3D 0 then -- couldn't open the dll puts(1,"Couldn't open the Morfit DLL") end if d. changed the function declarations from (for example) :- Public Declare Function = Morfit_engine_set_default_rendering_window_title Lib "Morfit"=20 (ByVal text As String) to Global Constant =3D Morfit_engine_set_default_rendering_window_title =3D = define_c_proc =20 = =20 2. In the "Rotate Camera" euphoria code, called the Morfit 3D functions = like this :- include machine.e include MorfitEU.e atom DefWinTitle =20 DefWinTitle =3D allocate_string("My Very Own Morfit Output = Window. Made With Euphoria !!!!") c_proc (Morfit_engine_maximize_default_rendering_window,{}) c_proc (Morfit_engine_set_default_rendering_window_title, = {DefWinTitle}) Return_Val =3D c_func = ry_path,USER_DEFINED_BEHAVIOR}) if Return_Val !=3D OK then puts(1,"World load failed") if getc(0) then end if abort(0) end if c_proc (Morfit_engine_set_picture_quality,{10000000}) etc....etc......... So far the new MorfitEU.e include only works for a subset of the Morfit = 3D DLL but ALL of the functions are done. I just need to set up the = parameter inputs to the functions (a couple of days I think) and the = whole Morfit engine should be available for use under eu Hope some of you can find some use for this! PS. Has anyone contacted Morfit about us doing a conversion to Euphoria? = If not I'd like to let them know what I've done and ask for permission = to post the complete version of MorfitEU.e=20 ------=_NextPart_000_0014_01BF53C6.46C04920 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type> <META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Hello everyone</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> My name is Mark = Brown and I=20 have been using Euphoria for a couple of months now. I have been = fascinated by=20 the discussion about the Morfit 3D engine so I went to the Morfit site = and=20 downloaded both the Visual C++ and Visual Basic versions of the SDK. On = seeing=20 the demos I just had to attempt to use it under Euphoria. I have = succeeded in=20 getting the "Rotate Camera" example from the SDK ported to and = running=20 under Euphoria (loads a world, rotates world around all 3 axis etc... ) = using=20 the following method :-</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>1. I modified the Visual Basic (NOT = the C++)=20 include file MorfitVB.bas which is supplied with the VB SDK as follows=20 :-</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> <FONT = color=3D#000000>a.=20 commented out the line Attribute VB_Name =3D=20 "Module1"</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT> b.=20 changed the VB constant definitions from (for example)</FONT></DIV> <DIV><FONT color=3D#000000=20 p; =20 </FONT></DIV> <DIV><FONT color=3D#000000=20 p; =20 Public Constant OK =3D 0</FONT></DIV> <DIV><FONT color=3D#000000 = to</FONT></DIV> <DIV><FONT color=3D#000000=20 p; =20 Global Constant OK =3D 0</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> <FONT = color=3D#000000>c. added=20 the following euphoria code after the constant definitions but before = declaring=20 the functions</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000=20 p; --=20 nbsp;=20 constant C_DWORD =3D=20 bsp;=20 constant C_ =3D 0 -- just a dummy to stop errors for=20 atom=20 bsp;=20 m3d_dll =3D open_dll("morfit.dll")</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000=20 p; if=20 m3d_dll =3D 0=20 ; --=20 couldn't open the=20 =20 puts(1,"Couldn't open the Morfit=20 ; =20 end if</FONT></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000 size=3D2> d. changed the = function=20 declarations from (for example) :-</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000=20 p; =20 Public Declare Function Morfit_engine_set_default_rendering_window_title = Lib=20 "Morfit" </FONT></DIV> <DIV><FONT color=3D#000000=20 (ByVal text As String)</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 = to</FONT></DIV> <DIV><FONT color=3D#000000=20 p; =20 <FONT color=3D#000000>Global Constant =3D</FONT></FONT></DIV> <DIV><FONT color=3D#000000=20 Morfit_engine_set_default_rendering_window_title =3D </FONT><FONT = color=3D#000000=20 size=3D2>define_c_proc </FONT></DIV> <DIV><FONT color=3D#000000=20 ; =20 (m3d_dll</FONT><FONT color=3D#000000=20 _CHAR})</FONT></DIV> <DIV><FONT color=3D#000000=20 p; =20 </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>2. In the "Rotate Camera" = euphoria=20 code, called the Morfit 3D functions like this :-</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 = include machine.e<BR> include=20 MorfitEU.e</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 = size=3D2> atom=20 <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 = DefWinTitle =3D allocate_string("My Very Own Morfit Output Window. = Made With=20 Euphoria !!!!")<BR></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT=20 color=3D#000000> c_proc=20 ; =20 c_proc (Morfit_engine_set_default_rendering_window_title,=20 {DefWinTitle})<BR></FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT=20 color=3D#000000> Return_Val = =3D=20 c_func =20 <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000> if=20 Return_Val !=3D OK then<BR> =20 puts(1,"World load=20 failed")<BR> if getc(0)=20 then<BR> end=20 if<BR> = abort(0)<BR> =20 end if</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000> c_proc=20 <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000> =20 etc....etc.........</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><FONT color=3D#000000>So far the new = MorfitEU.e=20 include only works for a subset of the Morfit 3D DLL but ALL of the = functions=20 are done. I just need to set up the parameter inputs to the functions (a = couple=20 of days I think) and the whole Morfit engine should be available for use = under=20 eu</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><FONT color=3D#000000>Hope some of = you can find=20 some use for this!</FONT></FONT></DIV> <DIV><FONT color=3D#000000 size=3D2><FONT = color=3D#000000></FONT></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>PS. Has anyone contacted Morfit = about us doing a=20 conversion to Euphoria? If not I'd like to let them know what I've done = and ask=20 for permission to post the complete version of MorfitEU.e=20 ------=_NextPart_000_0014_01BF53C6.46C04920--
2. Re: Introduction and my solution to using Morfit 3D with Euphoria
- Posted by Mark Brown <mabrown at SENET.COM.AU> Jan 22, 2000
- 427 views
Hi Rod. Well done getting Morfit to work with Euphoria. I myself have teamed up with Todd Riggins to complete a Morfit for Euphoria API. The include (which is complete) is now based on the C++ include from Morfit. I used the VB include in the first place because my C ability is awful !! (though my mail may have made it sound like you shouldn't use the C++ include - oops). Todd has done some excellent work on the API which will allow users to call Morfit in a Euphoria friendly way. I am following Todd's lead. (Todd, if you are out there, utilities and maths api functions nearly complete) Your include converter is a much neater way than the cut and paste method I used and will allow users to update to more recent includes themselves. A word of caution about using the VB include(s). There are more than one! In fact, there seem to be special versions of the include for all the examples in the VB SDK and they don't all include the same functions. (though I have now found at least one function in the VB include which is not in the C++ one) We have contacted Jonathon Moore at Morfit by email and he is very helpful and is pleased to see us using Morfit. If you decide to upload your converter (I think you should), you may need to include Morfit's license with your work. Ask Jonathon. If you would like to exchange work etc contact Todd or myself. Happy coding. Mark.