-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path27-SceneShoot.sb
More file actions
79 lines (62 loc) · 1.9 KB
/
27-SceneShoot.sb
File metadata and controls
79 lines (62 loc) · 1.9 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
67
68
69
70
71
72
73
74
75
76
77
78
79
;Babylon.sbi - SceneShoot
EnableExplicit
IncludeFile "babylon/babylon.sbi"
Global Scene, Camera, Light, Box1, Box2, Plane, Background
Global GUI, Shoot, ShootToken
Global ShadowGenerator
Declare LoadGame()
Declare ScreenShoot()
Declare RenderGame()
UseModule BJS
InitEngine(@LoadGame())
Procedure LoadGame()
Scene = CreateScene()
If Scene
;Camera & lighting environment
ClearScene(RGB(128, 128, 128))
CreateLight("global", 0, 200, 0, 0.4)
Light = CreateLight("global", 0, 200, 0, 0.4, #BJS_Point)
Camera = CreateCamera("camera", 0, 10, 30, #BJS_ArcRotate)
;Ground & Box
Plane = CreatePlane("ground", 20, 20)
RotateMesh(Plane, 90, 0, 0)
Box1 = CreateBox("box1", 3, 3, 3)
MoveMesh(Box1, 0, 3, 0)
Box2 = CreateBox("box2", 3, 3, 3)
MoveMesh(Box2, 1, 6, -1)
;Shadows
ShadowGenerator = InitShadow(Light, 1024)
ShadowEmitter(ShadowGenerator, Box1)
ShadowEmitter(ShadowGenerator, Box2)
RenderShadows(Plane)
;GUI : Scene ScreenShoot
GUI = CreateDynamicTexture()
Shoot = Button3D("shoot", 20, 20, 150, 24, "ScreenShoot", @ScreenShoot())
AddControl3D(GUI, Shoot)
RenderLoop(@RenderGame())
EndIf
EndProcedure
Procedure ScreenShoot()
HideControl3D(Shoot)
ShootToken = #True
EndProcedure
Procedure RenderGame()
RenderWorld()
If ShootToken
ShootToken = #False
CreateSceneShoot(Camera, SceneWidth(), SceneHeight(), 1)
HideControl3D(Shoot, #False)
EndIf
EndProcedure
; IDE Options = SpiderBasic 2.20 (Windows - x86)
; CursorPosition = 42
; FirstLine = 3
; Folding = -
; WebAppName = ScreenShoot
; HtmlFilename = screenshoot.html
; JavaScriptFilename = screenshoot.js
; JavaScriptPath = sb
; iOSAppOrientation = 0
; AndroidAppOrientation = 0
; EnableXP
; CompileSourceDirectory