Babylon.js
Re: Babylon.js
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Babylon.js
Version 1.0.2 is available. Some new features and updates of most features and constants.
Download : https://github.com/falsam/BJS (57 Mo Source + Examples + Data)
New features
■ Miscellaneous
ShowAxis(size)
CreateSceneShoot(Camera, Width, Height, Precision.f=1)
SceneDebug()
LoadCubeTexture(FileName.s)
LoadVideoTexture(Names.s, FileName.s)
■ GUI with a dynamic texture
CreateDynamicTexture(Mesh = #False) - Create dynamic texture. A dynamic texture can be applied to a mesh
AddControl3D(Parent, Child) - Adds control to dynamic texture.
HideControl3D(Object, Value = #True)
Rectangle3D(Name.s, x.i, y.i, Width.i = -1, Height.i = -1, Radius = 8, Thickness = 1)
Text3D(Name.s, x.i, y.i, Width.i, Height.i, Text.s, Align = #BJS_Center)
Button3D(Name.s, x.i, y.i, Width.i, Height.i, Text.s, Callback, CornerRadius = 8)
Image3D(Name.s, x.i, y.i, Width.i, Height.i, FileName.s, OnClick = #False)
Slider3D(Name.s, x.i, y.i, Width.i, Height.i, MiniMum.i, Maximum.i, OnChange, BarOffset = 8)
Input3D(Name.s, x.i, y.i, Width.i, Height.i, Text.s, OnLostFocus=#False, OnTextChange=#False, OnGetFocus=#False)
PickerColor3D(Name.s, x.i, y.i, Width.i, Height.i, CallBack)
GetText3D(Object)
SetText3D(Object, Text.s)
SetColor3D(Object, ColorType, Color)
SetTextFont3D(Object, FontFamily.s, FontSize)
SetOpacity3D(Object, Alpha.f)
SetZindex3D(Object, zIndex.i)
GetState3D(Object)
SetState3D(Object, Value)
Text3DLinkToMesh(Mesh, ObjectText, OffSetY.f)
-Examples
http://falsam.com/sbbjs/gui.html (Code)
http://falsam.com/sbbjs/sceneshoot.html
■ Assets Manager
Useful for downloading a complex scene.
UseAssetsManager(ProgressCallback = #False)
AssetsManagerColor(Color)
AssetsManagerAdd(Name.s, FileName.s, CallBackSucces, CallBackError)
AssetsManagerPrompt(Text.s)
AssetsManagerLoad()
-Example
http://falsam.com/sbbjs/assetsmanager.html (Code)
Download : https://github.com/falsam/BJS (57 Mo Source + Examples + Data)
New features
■ Miscellaneous
ShowAxis(size)
CreateSceneShoot(Camera, Width, Height, Precision.f=1)
SceneDebug()
LoadCubeTexture(FileName.s)
LoadVideoTexture(Names.s, FileName.s)
■ GUI with a dynamic texture
CreateDynamicTexture(Mesh = #False) - Create dynamic texture. A dynamic texture can be applied to a mesh
AddControl3D(Parent, Child) - Adds control to dynamic texture.
HideControl3D(Object, Value = #True)
Rectangle3D(Name.s, x.i, y.i, Width.i = -1, Height.i = -1, Radius = 8, Thickness = 1)
Text3D(Name.s, x.i, y.i, Width.i, Height.i, Text.s, Align = #BJS_Center)
Button3D(Name.s, x.i, y.i, Width.i, Height.i, Text.s, Callback, CornerRadius = 8)
Image3D(Name.s, x.i, y.i, Width.i, Height.i, FileName.s, OnClick = #False)
Slider3D(Name.s, x.i, y.i, Width.i, Height.i, MiniMum.i, Maximum.i, OnChange, BarOffset = 8)
Input3D(Name.s, x.i, y.i, Width.i, Height.i, Text.s, OnLostFocus=#False, OnTextChange=#False, OnGetFocus=#False)
PickerColor3D(Name.s, x.i, y.i, Width.i, Height.i, CallBack)
GetText3D(Object)
SetText3D(Object, Text.s)
SetColor3D(Object, ColorType, Color)
SetTextFont3D(Object, FontFamily.s, FontSize)
SetOpacity3D(Object, Alpha.f)
SetZindex3D(Object, zIndex.i)
GetState3D(Object)
SetState3D(Object, Value)
Text3DLinkToMesh(Mesh, ObjectText, OffSetY.f)
-Examples
http://falsam.com/sbbjs/gui.html (Code)
http://falsam.com/sbbjs/sceneshoot.html
■ Assets Manager
Useful for downloading a complex scene.
UseAssetsManager(ProgressCallback = #False)
AssetsManagerColor(Color)
AssetsManagerAdd(Name.s, FileName.s, CallBackSucces, CallBackError)
AssetsManagerPrompt(Text.s)
AssetsManagerLoad()
-Example
http://falsam.com/sbbjs/assetsmanager.html (Code)
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Babylon.js
The purpose of this code is to obtain the reflection of a cube texture also called CubeMap.
Demo : http://falsam.com/sbbjs/reflection.html
Utiliser la souris pour faire tourner la sphere.
A Cubemap texture is a collection of six separate square textures that are placed on the sides of an imaginary cube. Most of the time, they are used to display reflections on objects (Meshes), similar to how a Skybox displays distant scenes in the background.
In this example, the LoadCubeTexture() function loads six textures beginning with TropicalSunnyDay from the data/textures/sky/ folder.
Code: Select all
EnableExplicit
IncludeFile "babylon/babylon.sbi"
Global Scene, Camera, Mesh, Material
Declare LoadGame()
Declare RenderGame()
UseModule BJS
InitEngine(@LoadGame())
Procedure LoadGame()
Scene = CreateScene()
If Scene
CreateCamera("camera", 0, 0, 10, #BJS_ArcRotate)
SkyBox("sky", "data/textures/sky/TropicalSunnyDay")
CreateLight("point", 0, 200, 2)
Mesh = CreateSphere("sphere cube", 4)
Material = CreateMaterial("")
SetMaterialColor(Material, #BJS_Diffuse, RGB(0, 0, 0))
SetMaterialTexture(Material, #BJS_Reflection, LoadCubeTexture("data/textures/sky/TropicalSunnyDay"))
SetMeshMaterial(Mesh, Material)
RenderLoop(@RenderGame())
EndIf
EndProcedure
Procedure RenderGame()
RenderWorld()
EndProcedure
Utiliser la souris pour faire tourner la sphere.
A Cubemap texture is a collection of six separate square textures that are placed on the sides of an imaginary cube. Most of the time, they are used to display reflections on objects (Meshes), similar to how a Skybox displays distant scenes in the background.
In this example, the LoadCubeTexture() function loads six textures beginning with TropicalSunnyDay from the data/textures/sky/ folder.
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
-
- Posts: 284
- Joined: Fri Sep 22, 2017 7:02 am
Re: Babylon.js
thx falsam! It's amazing and incredibly fast!
Re: Babylon.js
Hello falsam,
Trying out latest Version I get this error in 06-Importscene.sb and 06-Loadmesh.sb
[20:06:50] [COMPILER] Line 29: Constant not found: #ArcRotate.
04-Moveto.sb
[20:14:40] [COMPILER] Line 20: Constant not found: #Hemispheric.
Regards
Hans-Peter
Trying out latest Version I get this error in 06-Importscene.sb and 06-Loadmesh.sb
[20:06:50] [COMPILER] Line 29: Constant not found: #ArcRotate.
04-Moveto.sb
[20:14:40] [COMPILER] Line 20: Constant not found: #Hemispheric.
Regards
Hans-Peter
Re: Babylon.js
Hello HPW and thank you for your feedback.
Examples 06-Importscene.sb and 06-Loadmesh.sb no longer exist in the last distribution of Babylon.sbi
Use the features of AssetsManager to import meshs or scenes. See example 28-Assets Manager.sb.
All constants of babylon. sbi start with #BJS_
■ Cameras
#BJS_Free
#BJS_Universal
#BJS_ArcRotate
#BJS_Follow
#BJS_VR = 4
#BJS_360 = 5
■ Lights
#BJS_Point
#BJS_Directional
#BJS_Spot
#BJS_Hemispheric
■ Mesh Body
#BJS_PlaneBody
#BJS_BoxBody
#BJS_SphereBody
#BJS_CylinderBody
■ Material Color & Texture
#BJS_Specula
#BJS_Diffuse
#BJS_Ambient
#BJS_Emissive
#BJS_Bump
#BJS_GroundColor
#BJS_Opacity
#BJS_Reflection
#BJS_Refraction
#BJS_SpecularPower
#BJS_Alpha
■ GUI Color
#BJS_BackColor
#BJS_FrontColor
#BJS_BorderColor
■ GUI align
#BJS_Left
#BJS_Center
#BJS_Right
Examples 06-Importscene.sb and 06-Loadmesh.sb no longer exist in the last distribution of Babylon.sbi
Use the features of AssetsManager to import meshs or scenes. See example 28-Assets Manager.sb.
All constants of babylon. sbi start with #BJS_
■ Cameras
#BJS_Free
#BJS_Universal
#BJS_ArcRotate
#BJS_Follow
#BJS_VR = 4
#BJS_360 = 5
Code: Select all
Camera = CreateCamera("camera", 0, 5, 7, #BJS_ArcRotate)
#BJS_Point
#BJS_Directional
#BJS_Spot
#BJS_Hemispheric
Code: Select all
Light = CreateLight("room light", 0, 10, 0, 1, #BJS_Hemispheric)
#BJS_PlaneBody
#BJS_BoxBody
#BJS_SphereBody
#BJS_CylinderBody
Code: Select all
Sphere = CreateSphere("sphere", 2)
MoveMesh(Sphere, 0, 5, 0)
CreateMeshBody(Sphere, #BJS_SphereBody, 1, 0.9, 0)
#BJS_Specula
#BJS_Diffuse
#BJS_Ambient
#BJS_Emissive
#BJS_Bump
#BJS_GroundColor
#BJS_Opacity
#BJS_Reflection
#BJS_Refraction
#BJS_SpecularPower
#BJS_Alpha
Code: Select all
;Create a sphere
Sphere = CreateSphere("sphere", 2)
;Load texture
TexSphere = LoadTexture("Data/textures/tree.png")
;Create material and apply texture
MatSphere = CreateMaterial("MatSphere")
SetMaterialTexture(MatSphere, #BJS_Diffuse, TexSphere, #True) ;#True because the texture has an alpha layer
;Apply material
SetMeshMaterial(Sphere, MatSphere)
#BJS_BackColor
#BJS_FrontColor
#BJS_BorderColor
■ GUI align
#BJS_Left
#BJS_Center
#BJS_Right
Code: Select all
;GUI : Scene ScreenShoot
GUI = CreateDynamicTexture()
Shoot = Button3D("shoot", 20, 20, 150, 24, "ScreenShoot", @ScreenShoot())
SetColor3D(Shoot, #BJS_BackColor, RGBA(222, 184, 135, 140))
AddControl3D(GUI, Shoot)
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Babylon.js
Oops, my fault. I unpacked it over my install and did not look at the file-dates.
Thanks for the info.
Regards,
Thanks for the info.
Regards,
Re: Babylon.js
Hello,
>>Use the features of AssetsManager to import meshs or scenes. See example 28-Assets Manager.sb.
How is it used. When I start it I get a rotating loader spash with playing Music.
But it stays there when "Loading 1/4 skull" appears.
Tried it on different Browsers.
Regards
>>Use the features of AssetsManager to import meshs or scenes. See example 28-Assets Manager.sb.
How is it used. When I start it I get a rotating loader spash with playing Music.
But it stays there when "Loading 1/4 skull" appears.
Tried it on different Browsers.
Regards
Re: Babylon.js
@HPW : Hello. I'm sorry, it's my fault!
-Delete the folder boletus_obj
-Replace with this one http://falsam.com/Download/boletus.zip
The Githtub archive is updated. Thank for your feedback.
-Delete the folder boletus_obj
-Replace with this one http://falsam.com/Download/boletus.zip
The Githtub archive is updated. Thank for your feedback.
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Babylon.js
Hello falsam,
Thanks for your great work and ongoing Support. Works now.
Regards
Thanks for your great work and ongoing Support. Works now.
Regards