this is to show that clockwise and anticlockwise have an effect on the shadow. in ogre it should be anticlockwise. ... how to look at the 3D scene http://purebasic.com/documentation/engine3d/index.html
look at this:
the default shadow is Modulative, now we can use 'W' key to toggle wire frame or solid frame
now uncomment line 45 : WorldShadows(#PB_Shadow_Additive ) and we can't use the 'W" key any more. even we can show the wire frame if we added MaterialShadingMode(#tex, #PB_Material_Wireframe ) before the Repeat loop
also i have noticed that we should add NormalizeMesh(..) before FinishMesh(#True) and not after it.

Code: Select all
Declare CreateMatrix()
#CameraSpeed = 0.3
Define.f KeyX, KeyY, MouseX, MouseY
Enumeration
#mesh
#entity
#tex
#light
#camera
#material
EndEnumeration
InitEngine3D(#PB_Engine3D_DebugLog)
InitSprite()
InitKeyboard()
InitMouse()
ExamineDesktops()
DesktopW = DesktopWidth(0)
DesktopH = DesktopHeight(0)
OpenWindow(0, 0, 0, DesktopW, DesktopH, "press 'W' wire/solid Frame ....'Space': stop rotation .....mouse+arrow keys for the camera ")
OpenWindowedScreen(WindowID(0), 0, 0, DesktopW, DesktopH, 0, 0, 0)
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
KeyboardMode(#PB_Keyboard_AllowSystemKeys)
CreateMaterial(#material, LoadTexture(#material, "MRAMOR6X6.jpg"))
CreatePlane(500, 30, 30, 5, 5, 2, 2)
CreateEntity(500, MeshID(500), MaterialID(#material), 0,-16,0)
CreateLight(0,RGB(245,245,205),19,13,0)
;Create Camera
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,12,-35,#PB_Absolute)
CameraLookAt(0, 0, -13, 0)
AmbientColor(RGB(100,100,100))
CreateMaterial(#tex, LoadTexture(#tex, "Geebee2.bmp"))
MaterialCullingMode(#tex, #PB_Material_NoCulling)
;MaterialShadingMode(#tex, #PB_Material_Wireframe )
WorldShadows(#PB_Shadow_Modulative , -1, RGB(100, 100, 100))
;WorldShadows(#PB_Shadow_Additive )
;-Mesh
CreateMatrix()
wireFrame = 1 : rot=1
Repeat
Repeat
Until WindowEvent()=0
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.2
MouseY = -MouseDeltaY() * #CameraSpeed * 0.2
EndIf
ShowCursor_(0)
; Use arrow keys and mouse to rotate camera and fly in/out
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
If KeyboardReleased(#PB_Key_W)
If wireFrame
MaterialShadingMode(#tex, #PB_Material_Wireframe)
wireFrame ! 1
Else
MaterialShadingMode(#tex, #PB_Material_Solid)
wireFrame ! 1
EndIf
EndIf
If KeyboardReleased(#PB_Key_Space) ;press key to toggle the rotation of the object
rot ! 1
EndIf
RotateEntity(#entity, 0, rot, 0,#PB_Relative)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent() = #PB_Event_CloseWindow
;main drawing routine
Procedure DrawMatrix()
MeshVertexPosition(-5, 0, 6)
MeshVertexNormal(0,1,0)
MeshVertexTextureCoordinate(0, 0)
MeshVertexPosition(5, 0, 6)
MeshVertexNormal(0,1,0)
MeshVertexTextureCoordinate(1, 0)
MeshVertexPosition(5, 0, -6)
MeshVertexNormal(0,1,0)
MeshVertexTextureCoordinate(1, 1)
MeshVertexPosition(2, 0, -6)
MeshVertexNormal(0,1,0)
MeshVertexTextureCoordinate(1, 1)
MeshVertexPosition(-8, 0, -6)
MeshVertexNormal(0,1,0)
MeshVertexTextureCoordinate(0, 1)
MeshVertexPosition(-8, 0, 6)
MeshVertexNormal(0,1,0)
MeshVertexTextureCoordinate(0, 0)
MeshFace(0, 1, 2)
MeshFace(3, 4, 5)
;MeshFace(2, 1, 0)
;MeshFace(5, 4, 3)
EndProcedure
Procedure CreateMatrix()
CreateMesh(0, #PB_Mesh_TriangleList, #PB_Mesh_Dynamic)
DrawMatrix()
NormalizeMesh(0) ; works
FinishMesh(#True)
;NormalizeMesh(0) ; does not work
SetMeshMaterial(0, MaterialID(#tex))
CreateEntity(#entity, MeshID(0), MaterialID(#tex),0,-10,0)
EndProcedure

