;Babylon.sbi - Shadows EnableExplicit IncludeFile "babylon/babylon.sbi" Global Camera, Light0, Light1, Plane, Sphere, MatPlane, TexPlane, MatSphere, TexSphere, ShadowGenerator Declare LoadGame() Declare RenderGame() UseModule BJS InitEngine(@LoadGame()) Procedure LoadGame() If CreateScene() ;Camera & Light Camera = CreateCamera("camera", 0, 5, 7, #BJS_ArcRotate) Light0 = CreateLight("light", 5, 10, 0, 1, #BJS_Point) Light1 = CreateLight("light", 0, 200, 0, 0.5, #BJS_Hemispheric) ;Object Plane = CreateGround("plane", 10, 10) Sphere = CreateSphere("sphere", 2) MoveMesh(Sphere, 0, 2, 0) ;Texture TexPlane = LoadTexture("Data/textures/grass.jpg") TexSphere = LoadTexture("Data/textures/tree.png") ;Material MatPlane = CreateMaterial("MatPlane") SetMaterialTexture(MatPlane, #BJS_Diffuse, TexPlane) ScaleMaterial(MatPlane, 5, 5) MatSphere = CreateMaterial("MatPlane") SetMaterialTexture(MatSphere, #BJS_Diffuse, TexSphere, #True) ;Apply material SetMeshMaterial(Plane, MatPlane) SetMeshMaterial(Sphere, MatSphere) ;Shadows (Create Shadow Generator) ShadowGenerator = InitShadow(Light0, 1024) ShadowEmitter(ShadowGenerator, Sphere) RenderShadows(Plane) RenderLoop(@RenderGame()) EndIf EndProcedure Procedure RenderGame() RotateMesh(Sphere, 0, 1, 0, #PB_Relative) RenderWorld() EndProcedure