Outils pour utilisateurs

Outils du site


playground:material

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révisionLes deux révisions suivantes
playground:material [2017/04/30 20:36] falsamplayground:material [2017/05/09 02:20] falsam
Ligne 1: Ligne 1:
 +**02-Material.sb**
 +
 +[[http://falsam.com/sbbjs/material.html|Voir]]
 +
 +<file purebasic 02-Material.sb>
 +;Babylon.sbi - Material
 +
 +EnableExplicit
 +
 +IncludeFile "babylon/babylon.sbi"
 +
 +Global Camera, Light, Plane, Sphere, MatPlane, MatSphere
 +
 +Declare LoadGame()
 +Declare RenderGame()
 +
 +UseModule BJS
 +
 +InitEngine(@LoadGame())
 +
 +Procedure LoadGame()    
 +  If CreateScene()
 +    
 +    ;Camera & Light
 +    Camera  = CreateCamera("camera", 0, 5, 7, #ArcRotate)
 +    Light   = CreateLight("light", 0, 10, 0, 1, #Hemispheric)
 +        
 +    ;Object
 +    Plane   = CreateGround("plane", 10, 10)
 +    
 +    Sphere  = CreateSphere("sphere", 2)
 +    MoveMesh(Sphere, 0, 2, 0) 
 +    
 +    ;Material
 +    MatPlane = CreateMaterial("MatPlane", "data/textures/grass.jpg")
 +    ScaleMaterial(MatPlane, 5, 5)
 +    
 +    MatSphere = CreateMaterial("MatPlane", "data/textures/tree.png")
 +    
 +    ;Apply material
 +    SetMaterial(Plane, MatPlane)
 +    SetMaterial(Sphere, MatSphere)
 +   
 +    RenderLoop(@RenderGame())
 +  EndIf
 +EndProcedure
 +
 +Procedure RenderGame()
 +  RotateMesh(Sphere, 0, 0.01, 0, #PB_Relative)
 +  RenderWorld() 
 +EndProcedure</file>
 +
  
playground/material.txt · Dernière modification : 2023/03/15 15:49 de 127.0.0.1