Outils pour utilisateurs

Outils du site


playground:importscene

06-ImportScene.sb

Voir

06-importscene.sb
;Babylon.js for SpiderBasic : Import Scene 
 
EnableExplicit
 
IncludeFile "babylon/babylon.sbi"
 
Global Scene, Camera, Light, Ground, GrassMat
 
Declare LoadGame()
Declare RenderGame()
 
UseModule BJS
 
InitEngine(@LoadGame())
 
Procedure OnLoad(Name.s, Mesh)
  If Name = "Dude"
 
    ScaleMesh(Mesh, 0.1, 0.1, 0.1, #PB_Absolute)
    MoveMesh(Mesh, 0, 0.2, 0)
    RenderLoop(@RenderGame()) 
  EndIf
EndProcedure
 
Procedure LoadGame()    
  Scene = CreateScene()
 
  If Scene
    Camera = CreateCamera("Camera", 10, 6, 20, #ArcRotate)
    Light  = CreateLight("Light", 20, 100, 100, 0.8, #Hemispheric)
 
    Ground = CreateGround("Ground", 30, 30)
    GrassMat = CreateMaterial("Green", "data/textures/grass.jpg")
    ScaleMaterial(GrassMat, 5, 5)    
    SetMaterial(Ground, Grassmat) 
    ImportScene("Dude", "data/Dude/", "dude.babylon", @OnLoad())  
  EndIf
EndProcedure
 
Procedure RenderGame()
  RenderWorld() 
EndProcedure
playground/importscene.txt · Dernière modification : 2023/03/15 15:49 de 127.0.0.1