Outils pour utilisateurs

Outils du site


playground:vrcamera

18-VR Camera.sb

Voir Avec un mobile ou un casque virtuel.

18-VR Camera.sb
;Babylon.sbi - VR Camera (Experimental)
 
EnableExplicit
 
IncludeFile "babylon/babylon.sbi"
 
Global Scene, Camera, Light, RedMat, RedBox, BlueMat, BlueBox
 
Declare LoadGame()
Declare RenderGame()
 
UseModule BJS
 
InitEngine(@LoadGame())
 
Procedure LoadGame()    
  Scene = CreateScene()
 
  If Scene
 
    ;This creates and positions a device orientation camera  (0, 0, 0)
    Camera = CreateCamera("VR Cam", 0, 0, 0, #BJS_VR)
 
    ;This targets the camera to scene origin
    CameraLookAt(Camera, 0, 0, 0)
 
    ;Light
    Light = CreateLight("light", 0, 1, 0, 1)
 
    ;Red Box
    RedMat = CreateMaterial("Red Color")
    SetMaterialColor(RedMat, #BJS_Diffuse, RGB(255, 0, 0))
 
    RedBox = CreateBox("box", 5, 5, 5)
    SetMeshMaterial(RedBox, RedMat)
 
    MoveMesh(RedBox, 0, 0, 10)
 
    ;Create Blue Box
    BlueMat = CreateMaterial("blue color")
    SetMaterialColor(BlueMat, #BJS_Diffuse, RGB(0, 0, 255))
 
    BlueBox = CreateBox("blue box", 5, 5, 5)
    SetMeshMaterial(BlueBox, BlueMat)
 
    MoveMesh(BlueBox, 0, 0, -10)
 
    RenderLoop(@RenderGame())
  EndIf
EndProcedure
 
Procedure RenderGame()
  RenderWorld() 
EndProcedure
playground/vrcamera.txt · Dernière modification: 2018/01/11 02:05 par falsam