Using Javascript from SpiderBasic
falsam
 
Posts: 269
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Babylon.js

by falsam Wed Jul 19, 2017 6:55 pm

Thanks for this test.

All exporters : https://doc.babylonjs.com/exporters

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
falsam
 
Posts: 269
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Babylon.js

by falsam Tue Jan 23, 2018 5:43 pm

Version 1.0.2 is available. Some new features and updates of most features and constants.

:arrow: 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 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
falsam
 
Posts: 269
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Babylon.js

by falsam Tue Jan 23, 2018 11:13 pm

The purpose of this code is to obtain the reflection of a cube texture also called CubeMap.

Image

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

:arrow: Demo : http://falsam.com/sbbjs/reflection.html
Utiliser la souris pour faire tourner la sphere.

:idea: 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 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
Dirk Geppert
 
Posts: 88
Joined: Fri Sep 22, 2017 7:02 am

Re: Babylon.js

by Dirk Geppert Wed Jan 24, 2018 8:29 am

thx falsam! It's amazing and incredibly fast! :shock:
HPW
 
Posts: 34
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js

by HPW Fri Jan 26, 2018 7:11 pm

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

Re: Babylon.js

by falsam Fri Jan 26, 2018 9:57 pm

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.

:idea: 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)

Lights
#BJS_Point
#BJS_Directional
#BJS_Spot
#BJS_Hemispheric
Code: Select all
Light   = CreateLight("room light", 0, 10, 0, 1, #BJS_Hemispheric)

Mesh Body
#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)

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
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)

GUI Color
#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 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

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

Re: Babylon.js

by HPW Sat Jan 27, 2018 7:26 am

Oops, my fault. I unpacked it over my install and did not look at the file-dates.
Thanks for the info.

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

Re: Babylon.js

by HPW Sat Jan 27, 2018 1:49 pm

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

Re: Babylon.js

by falsam Sun Jan 28, 2018 11:23 am

@HPW : Hello. I'm sorry, it's my fault! :oops:

-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 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

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

Re: Babylon.js

by HPW Sun Jan 28, 2018 9:56 pm

Hello falsam,

Thanks for your great work and ongoing Support. Works now. :-)

Regards
Return to Javascript

Who is online

Users browsing this forum: No registered users and 2 guests