Outils pour utilisateurs

Outils du site


playground:meshclone

Cloner un mesh

Cloner un mesh.sb
EnableExplicit
 
IncludeFile "babylon/babylon.sbi"
 
Global Scene, Box0, Box1, Texture, Material
 
Declare LoadGame()
Declare RenderGame()
 
UseModule BJS
InitEngine(@LoadGame())
 
Procedure LoadGame()    
  Scene = CreateScene()
  If Scene
 
    CreateCamera("camera", 0, 2, 10, #BJS_ArcRotate)
 
    CreateLight("Ambience", 0, 200, 0)
 
    ;Material
    Texture = LoadTexture("data/textures/crate.png")
    Material  = CreateMaterial("crate")
    SetMaterialTexture(Material, #BJS_Diffuse, Texture)
 
    ;Create model 
    Box0 = CreateBox("box0", 1, 1, 1)
    SetMeshMaterial(Box0, Material)
    MoveMesh(Box0, -1, 0, 0)
 
    ;Clone the model
    Box1 = CloneMesh(Box0)
    MoveMesh(Box1, 1, 0, 0)
 
    RenderLoop(@RenderGame())
  EndIf
EndProcedure
 
Procedure RenderGame()
  RenderWorld() 
EndProcedure
playground/meshclone.txt · Dernière modification: 2018/01/28 18:55 par falsam