Page 3 of 3
Re: Babylon.js : Problem with the latest release
Posted: Sat Aug 25, 2018 7:29 am
by HPW
Hello falsam and Peter,
falsam wrote:
Unfortunately no
So I give it a try and copied Peters Header with the cdn3.2 loadr to every demo of Bjs-master.
In engine.sbi I outcomment this 4 lines:
Code: Select all
Procedure InitEngine(Callback, CanvasGadget = #PB_Ignore)
; !require([bjs$v_bjsenginepath + "/babylon.custom.js"],
; ! function(t) {
! 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
Each demo compiles but a few did not Show as expected. (water,terrain etc.)
I guess incompatibiitys between last used custom-build and 3.2
So I do a find and replace on all bfs-examples sb to
Code: Select all
;! "replace": "</title>\n\n<script src='/sbbjs/babylon.custom.js'></script>"
Now the Demos work again like last original release.
Regards
Re: Babylon.js : Problem with the latest release
Posted: Sun Feb 16, 2020 4:49 pm
by Andy
Works with v4
Re: Babylon.js : Problem with the latest release
Posted: Sun Feb 16, 2020 4:55 pm
by Andy
It was working until i actually saved the code in the IDE.
If i run the code below in a new tab in the IDE without saving, it works. I'm still learning the basics. Anyone know whats going on here?
Code: Select all
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)
! require(["babylonjs", "https://cdn.babylonjs.com/babylon.js"],
! function(BJS) {
! 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
Re: Babylon.js : Problem with the latest release
Posted: Sun Feb 16, 2020 6:19 pm
by Paul
Andy wrote:It was working until i actually saved the code in the IDE.
If i run the code below in a new tab in the IDE without saving, it works. I'm still learning the basics. Anyone know whats going on here?
Works fine here using Chrome and SB2.30 running from both IDE and exported to Web Server
Re: Babylon.js : Problem with the latest release
Posted: Sun Feb 16, 2020 6:29 pm
by Peter
Paul wrote:Works fine here using Chrome and SB2.30 running from both IDE and exported to Web Server
same here.
Re: Babylon.js : Problem with the latest release
Posted: Sun Feb 16, 2020 6:32 pm
by Andy
I closed the IDE and reopened it. All working ok now. Sorry
Re: Babylon.js : Problem with the latest release
Posted: Fri Feb 21, 2020 8:03 am
by Dirk Geppert
Good to know, that SpiderBasic 2.30 runs fine now with BabylonJS 4
I recently played around with glTF and GLB files and found out, that BabylonJS directly supports them.
->
https://sandbox.babylonjs.com
Would it be possible with SpiderBasic/BabylonJS to load and display a GLB file?
Re: Babylon.js : Problem with the latest release
Posted: Mon Feb 24, 2020 3:19 pm
by Dirk Geppert
That does the job for now..
Code: Select all
<html>
<head>
<title>Babylon.js Viewer - Display a 3D model</title>
<script src="https://preview.babylonjs.com/viewer/babylon.viewer.js"></script>
</head>
<body>
<babylon model="https://models.babylonjs.com/boombox.glb" templates.main.params.fill-screen="true"></babylon>
</body>
</html>
Re: Babylon.js : Problem with the latest release
Posted: Tue Feb 09, 2021 5:04 pm
by skinkairewalker
Andy wrote:It was working until i actually saved the code in the IDE.
If i run the code below in a new tab in the IDE without saving, it works. I'm still learning the basics. Anyone know whats going on here?
Code: Select all
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)
! require(["babylonjs", "https://cdn.babylonjs.com/babylon.js"],
! function(BJS) {
! 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
i get this errors :
https://prnt.sc/yv73va
Re: Babylon.js : Problem with the latest release
Posted: Thu May 27, 2021 5:08 pm
by the.weavster
I think you guys may be interested in
this, I tried it with Babylon also and it seems to work (I get BABYLON in the global namespace).