Self-shadowing in PureBasuic
Posted: Wed Aug 13, 2014 7:06 pm
What about self-shadowing in PureBasuic?
How is it possible?
How is it possible?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
Define.f KeyX, KeyY, MouseX, MouseY, SpriteX, SpriteY
If InitEngine3D()
ExamineDesktops()
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/models", #PB_3DArchive_FileSystem)
Add3DArchive(".", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
DeskWidth=DesktopWidth(0)
DeskHeight=DesktopHeight(0)
OpenWindow(0, 0, 0, DeskWidth, DeskHeight, "shadow ", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, DeskWidth, DeskHeight, 0, 0, 0)
LoadMesh(0, "robot.mesh")
CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
CreateEntity(1, MeshID(0), MaterialID(0), 10, 0, 0)
StartEntityAnimation(1, "Walk")
WorldShadows(#PB_Shadow_Modulative)
;- Ground
;
CreateMaterial(5, LoadTexture(5, "MRAMOR6X6.jpg"))
MaterialCullingMode(5, #PB_Material_NoCulling )
CreatePlane(2, 1500, 1500, 40, 40, 15, 15)
CreateEntity(2,MeshID(2),MaterialID(5))
SetMaterialColor(5, #PB_Material_SelfIlluminationColor, $FFFFFF)
MaterialCullingMode(5, #PB_Material_NoCulling )
;Sky
SkyDome("clouds.jpg", 80)
;- Camera
;
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 300, 100, 100, #PB_Absolute)
RotateCamera(0,0,65,0)
CameraBackColor(0, $FF)
;- Light
;
CreateLight(0, RGB(255, 255, 255), 20, 100, 20)
AmbientColor(RGB(80, 80, 80))
MaterialCullingMode(0, #PB_Material_NoCulling )
Repeat
Repeat
Until WindowEvent() = 0
If ExamineMouse()
MouseX = -MouseDeltaX()/10
MouseY = -MouseDeltaY()/10
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -10
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 10
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -10
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 10
Else
KeyY = 0
EndIf
EndIf
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End
Code: Select all
While WindowEvent():Wend
That's normal when using a skydome as they don't cover the bottom of the world. You're just seeing the camera background color.applePi wrote: what is that red big plane under the ground ??