of the results.
Watch the white lines as the camera moves around the field. I also tried to use a test image of some lines and it does the same thing.
What is the problem? How can I fix this? I even tried setting the camera range way out.
Code: Select all
#MOVEMENT_SPEED = 0.15
#Camera = 1
Global MouseXRotation.f,MouseYRotation.f,KeyX.f,KeyZ.f
InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0, 0, 0, 1920, 1080, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 1920, 1080, 0, 0, #PB_Screen_WaitSynchronization)
Add3DArchive("C:\Users\Brian\Documents\PUREBASIC PROJECTS\3D Programs\3Dfield\Media", #PB_3DArchive_FileSystem)
;Parse3DScripts()
CreateLight(0,RGB(255, 255, 255), 0, 50, -500, #PB_Light_Point)
LightLookAt(0, 0, 0, 0)
;AmbientColor(RGBA(255, 255, 255, 255))
; load textures
;LoadTexture(0, "test.png")
LoadTexture(0, "fieldCutEditedStraightLinesOnly.png") ; pitch (playing field)
LoadTexture(1, "OuterBorderBottomSide.png") ; bottom border
LoadTexture(2, "OutBorderTopSide.png") ; top border
LoadTexture(3, "OutBorderRightEnd.png") ; right border
LoadTexture(4, "OuterBorderLeftSide.png") ; left border
LoadTexture(5, "GoalPosts.png") ; goal post used for left and right
LoadTexture(6, "Nets.png") ; goal net used for left and right
; create materials
FieldMat = CreateMaterial(0, TextureID(0)) ; pitch (playing field)
FieldBottomBorderMat = CreateMaterial(1, TextureID(1)) ; bottom border
FieldTopBorderMat = CreateMaterial(2,TextureID(2)) ; top border
FieldRightBorderMat = CreateMaterial(3,TextureID(3)) ; right border
FieldLeftBorderMat = CreateMaterial(4, TextureID(4)) ; left border
GoalPostsMat = CreateMaterial(5, TextureID(5)) ; goal posts frame
NetsMat = CreateMaterial(6, TextureID(6)) ; goal net
NetsMatRight = CreateMaterial(7, TextureID(6)) ; goal net right
; load meshes
LoadMesh(0, "Pitch.mesh") ; pitch (playing field)
LoadMesh(1, "BottomBorder.mesh") ; bottom border
LoadMesh(2, "TopBorder.mesh") ; top border
LoadMesh(3, "RightBorder.mesh") ; right border
LoadMesh(4, "LeftBorder.mesh") ; left border
LoadMesh(5, "GoalPostsLeft.mesh") ; goal post frame used for both left and right side
LoadMesh(6, "GoalPostsRight.mesh") ; goal post frame right side
LoadMesh(7, "Net3.mesh") ; goal net used for both left and right side
; Result = SubMeshCount(0)
; Debug Result
CreateEntity(0, MeshID(0), FieldMat) ; pitch
CreateEntity(1, MeshID(1), FieldBottomBorderMat) ; bottom border
CreateEntity(2, MeshID(2), FieldTopBorderMat) ; top border
CreateEntity(3, MeshID(3), FieldRightBorderMat) ; right border
CreateEntity(4, MeshID(4), FieldLeftBorderMat) ; left border
CreateEntity(5, MeshID(5), GoalPostsMat) ; left goal posts frame
CreateEntity(6, MeshID(6), GoalPostsMat) ; right goal posts frame
CreateEntity(7, MeshID(7), NetsMat) ; left net
CreateEntity(8, MeshID(7), NetsMat) ; right net created from mesh 7
SetMeshMaterial(7, NetsMat)
SetMeshMaterial(8, NetsMat)
RotateEntity(7, 0, 90, 0, #PB_Absolute)
RotateEntity(8, 0, -90, 0, #PB_Absolute)
MoveEntity(5, -50.50, 0, 0, #PB_World) ; left goal posts frame
MoveEntity(7, -50.49, 0, 0, #PB_World) ; left net
MoveEntity(8, 50.67, 0, 0, #PB_World) ; net right goal
;MoveEntity(1, 0, -0.001, 0, #PB_World)
; For x = 0 To 8
; ScaleEntity(x, 5, 5, 5, #PB_Absolute)
; Next x
; create camera
CreateCamera(#Camera, 0, 0, 100, 100)
MoveCamera(#Camera, 0, 30, 90, #PB_Absolute | #PB_Local) ; absolute + local positive Z coordinate moves camera backwards
CameraRange(#Camera, 0, 1000000)
CameraLookAt(#Camera, 0, 0, 0)
Repeat
Repeat : event=WindowEvent() : If event = #PB_Event_CloseWindow : End : EndIf :Until Not event
If ExamineMouse()
MouseYRotation = -MouseDeltaX() / 10
MouseXRotation = -MouseDeltaY() / 10
EndIf
RotateCamera(#Camera, MouseXRotation, MouseYRotation, 0, #PB_Relative)
;Update Key Presses and position the Camera accordingly
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left) : KeyX = -#MOVEMENT_SPEED : EndIf
If KeyboardPushed(#PB_Key_Right) : KeyX = #MOVEMENT_SPEED : EndIf
If KeyboardPushed(#PB_Key_Up) : KeyZ = -#MOVEMENT_SPEED : EndIf
If KeyboardPushed(#PB_Key_Down) : KeyZ = #MOVEMENT_SPEED : EndIf
If KeyboardPushed(#PB_Key_Escape) : ReleaseMouse(#True) : EndIf
MoveCamera(#Camera, KeyX, 0, KeyZ)
KeyX = 0
KeyZ = 0
EndIf
RenderWorld()
FlipBuffers()
Delay(1)
ForEver