-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path29-Merge Meshes.sb
More file actions
50 lines (37 loc) · 1.14 KB
/
29-Merge Meshes.sb
File metadata and controls
50 lines (37 loc) · 1.14 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
EnableExplicit
IncludeFile "babylon/babylon.sbi"
Global Scene, Camera
Declare LoadGame()
Declare RenderGame()
UseModule BJS
InitEngine(@LoadGame())
Procedure LoadGame()
Protected Dim Meshes(1), Material, Object, NewObject
Scene = CreateScene()
If Scene
Camera = CreateCamera("camera", 0, 0, 10, #BJS_ArcRotate)
CameraLookAt(Camera, 0, 0, 0)
CreateLight("Ambience", 0, 200, 0)
;Material
Material = CreateMaterial("red color")
SetMaterialColor(Material, #BJS_Diffuse, RGB(255, 0, 0))
Meshes(0) = CreateBox("box", 0.5, 1, 0.5)
Meshes(1) = CreateSphere("sphere", 0.7)
MoveMesh(Meshes(1), 0, 0.8, 0)
Object = MergeMeshes(Meshes())
SetMeshMaterial(Object, Material)
NewObject = CloneMesh(Object)
MoveMesh(NewObject, 2, 0, 0)
RenderLoop(@RenderGame())
EndIf
EndProcedure
Procedure RenderGame()
RenderWorld()
EndProcedure
; IDE Options = SpiderBasic 2.20 (Windows - x86)
; CursorPosition = 20
; Folding = -
; iOSAppOrientation = 0
; AndroidAppOrientation = 0
; EnableXP
; CompileSourceDirectory