-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path18-VR Camera.sb
More file actions
66 lines (47 loc) · 1.51 KB
/
18-VR Camera.sb
File metadata and controls
66 lines (47 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
;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
; IDE Options = SpiderBasic 2.20 (Windows - x86)
; CursorPosition = 39
; Folding = -
; WebAppName = VR Camera
; HtmlFilename = vrcamera.html
; JavaScriptFilename = vrcamera.js
; JavaScriptPath = sb
; CopyJavaScriptLibrary
; iOSAppOrientation = 0
; AndroidAppOrientation = 0
; EnableXP
; CompileSourceDirectory