Page 2 of 3

Re: Babylon.js : Problem with the latest release

Posted: Fri Aug 10, 2018 6:26 am
by HPW
Hello falsam,

Good News! Your test-code works for me.

Will you change your Demos to the new call-syntax?

For understanding: Does spiderbasic supprts 'require' itself? I does not find it in the docs.
Does requre supports an Event when the engine-loading is finished (for large extensions like Babylon.js)

Regards

Re: Babylon.js : Problem with the latest release

Posted: Fri Aug 10, 2018 9:42 am
by poshu
Anything starting with ! is inline javascript in SpiderBasic, so require is a js command, not a SB command.

Re: Babylon.js : Problem with the latest release

Posted: Fri Aug 10, 2018 6:48 pm
by HPW
Hello,
Thanks for the info.
....so require is a js command
But where does it come from. One of the used JavaScript Frameworks/extensions? Where can I find a doku about it?

Regards

Re: Babylon.js : Problem with the latest release

Posted: Fri Aug 10, 2018 7:22 pm
by Peter
HPW wrote:But where does it come from. One of the used JavaScript Frameworks/extensions? Where can I find a doku about it?
SpiderBasic is based on Dojo / Dojit (don't know which version), which has its own require implementation.

Greetings ... Peter

Re: Babylon.js : Problem with the latest release

Posted: Sat Aug 11, 2018 12:07 am
by falsam
HPW wrote:Good News! Your test-code works for me.
That's what I thought! Look at your browser console :!:
HPW wrote:Will you change your Demos to the new call-syntax?
Unfortunately no

Re: Babylon.js : Problem with the latest release

Posted: Sat Aug 11, 2018 6:37 am
by HPW
Hlelo falsam,
Unfortunately no
But will you further work/support on it ?

Regards

Re: Babylon.js : Problem with the latest release

Posted: Sat Aug 11, 2018 6:39 am
by HPW
Hello Peter,
SpiderBasic is based on Dojo / Dojit (don't know which version), which has its own require implementation.
Thanks for the info. I will look there for the doku.

Regards

Re: Babylon.js : Problem with the latest release

Posted: Thu Aug 23, 2018 9:50 pm
by Peter
same version, but no more need for $&#ยง$ require :D

Code: Select all

;!  <HtmlPreprocessor>
;!    [
;!      {
;!        "search": "</title>",
;!        "replace": "</title>\n\n<script src='https://cdnjs.cloudflare.com/ajax/libs/babylonjs/3.2.0/babylon.js'></script>"
;!      }
;!    ]
;!  </HtmlPreprocessor>

Enumeration
  #mf
  #mfRender
EndEnumeration

Global BJSEngine, BJSCanvas, Scene

Declare InitEngine(Callback, CanvasGadget = #PB_Ignore)
Declare Start()
Declare InitGame()
Declare CreateScene()

Procedure InitEngine(Callback, CanvasGadget = #PB_Ignore)    
  
  ! if (BABYLON.Engine.isSupported()) {
      
      If CanvasGadget = #PB_Ignore    
        !$('<canvas>').attr('id', 'renderCanvas')
        ! .css({ width : '100%', height : '100%' })
        ! .appendTo('body');
      Else
        !var selector = $(spider_GadgetID(v_canvasgadget))[0].gadget
        !selector.id = "renderCanvas"
        !selector.style.width = '100%'
        !selector.style.height = '100%'
      EndIf
  
  !   v_bjscanvas = document.getElementById('renderCanvas');
  !   v_bjsengine = new BABYLON.Engine(v_bjscanvas, true, { preserveDrawingBuffer: true, stencil: true }); 
  !   window.addEventListener('resize', function(){v_bjsengine.resize(); });  
  !   v_callback()
  ! } else {return false} 
  
EndProcedure  

Start()

Procedure Start()
  OpenWindow(#mf, 0, 0, 800, 600, "Test", #PB_Window_ScreenCentered)
  CanvasGadget(#mfRender, 0, 0, 800, 600, #PB_Canvas_Transparent)
  InitEngine(@InitGame(), #mfRender)
EndProcedure

Procedure InitGame()
  Scene = CreateScene()
  !v_bjsengine.runRenderLoop(f_renderscene)
EndProcedure

Procedure CreateScene()
  !var scene = new BABYLON.Scene(v_bjsengine);
  
  !var camera = new BABYLON.ArcRotateCamera("Camera", 3 * Math.PI / 4, Math.PI / 4, 4, BABYLON.Vector3.Zero(), scene);
  !camera.attachControl(v_bjscanvas, true);
  
  !var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0), scene); 
  
  !var box = BABYLON.MeshBuilder.CreateBox("box", {}, scene);
  !return scene 
EndProcedure

Procedure RenderScene()
    !v_scene.render();
EndProcedure
(yes, i want to promote my tool ;-))

Greetings ... Peter

Re: Babylon.js : Problem with the latest release

Posted: Fri Aug 24, 2018 2:24 pm
by HPW
Hello Peter,

I do not get it. Do I Need a tool from you to get it work?
This snippet only open an empty page.
And falsam was right, with his snippet the consoe show Errors.
Still interested how to load big js-frameworks correctly into sb.

Regards

Re: Babylon.js : Problem with the latest release

Posted: Fri Aug 24, 2018 2:39 pm
by Peter
HPW wrote:Do I Need a tool from you to get it work?
yes. This one: viewtopic.php?f=9&t=1543

Greetings ... Peter