Babylon.js : Problem with the latest release

Using Javascript from SpiderBasic
HPW
Posts: 35
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

Post 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
poshu
Posts: 96
Joined: Mon Feb 24, 2014 11:46 pm

Re: Babylon.js : Problem with the latest release

Post by poshu »

Anything starting with ! is inline javascript in SpiderBasic, so require is a js command, not a SB command.
HPW
Posts: 35
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

Post 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
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Babylon.js : Problem with the latest release

Post 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
falsam
Posts: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Re: Babylon.js : Problem with the latest release

Post 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

➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
http://falsam.com

Sorry for my poor english
HPW
Posts: 35
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

Post by HPW »

Hlelo falsam,
Unfortunately no
But will you further work/support on it ?

Regards
HPW
Posts: 35
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

Post 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
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Babylon.js : Problem with the latest release

Post 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
HPW
Posts: 35
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

Post 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
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Babylon.js : Problem with the latest release

Post 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
Post Reply