Page 1 of 1

Concerning to some commands in PB!

Posted: Fri May 18, 2018 11:08 pm
by RealUser60
I've just typed in the code that is listed in the PB Book, & did a program check, & during the check I did noticed a certain command that not include within PB, I also include the code to clarify this problem,

Code: Select all

;A Gentle Beginning into 3D

Enumeration
  #Mesh
  #Tex
  #Mat
  #Entity_Invader
  #Light
  #Camera_One
EndEnumeration

;Set the Width, Height, & Bit Depth of the Screen
;Abbreviated variables are used here due to page width constraints :(
Global ScrW.l = 1024
Global ScrH.l = 768
Global ScrD.l = 32
;Other Global variables
Global Quit.b = #False

;Simple error checking procedure
Procedure HandleError(Result.l, Text.s)
  If Result = 0
    MessageRequester("Error", Text, #PB_MessageRequester_Ok)
    End
  EndIf
EndProcedure

;Initialize Environment
HandleError(InitEngine3D(), "InitEngine3D() command failed.")
HandleError(InitSprite(), "InitSprite() command failed.")
HandleError(OpenScreen(ScrH, ScrH, ScrD, ""), "Could not open screen.")
HandleError(InitKeyboard(), "InitKeyboard() command failed.")
SetFrameRate(60)

Add3DArchive("Data\", #PB_3DArchive_FileSystem)

HandleError(LoadMesh(#Mesh, "Invader.mesh"), "Can't load mesh")
HandleError(LoadTexture(#Tex, "Invader.png"), "Can't load texture.")
HandleError(CreateMaterial(#Mat, TextureID(#Tex)), "Can't create material")
CreateEntity(#Entity_Invader, MeshID(#Mesh), MaterialID(#Mat))

CreateLight(#Light, RGB(255,255,255),0,5,0)

CreateCamera(#Camera_One,0,0,100,100)
CameraLocate(#Camera_One,0,1,2.5)
RotateCamera(#Camera_One,-15,0,0)

;Main Loop
Repeat
  
  y.l = 2
  RotateEntity(#Entity_Invader,0,y,0)
  RenderWorld()
  FlipBuffers()
  
  ExamineKeyboard()
  If KeyboardReleased(#PB_Key_Escape)
    Quit = #True
  EndIf
  
Until Quit = #True
End

Here's the comment,
[15:54:11] [COMPILER] Line 45: CameraLocate() is not a function, array, list, map or macro.

Is there a way to correct this problem? Please help ok?

Re: Concerning to some commands in PB!

Posted: Fri May 18, 2018 11:29 pm
by forumuser
Probably CameraLookAt() was meant?

Re: Concerning to some commands in PB!

Posted: Fri May 18, 2018 11:41 pm
by wombats

Re: Concerning to some commands in PB!

Posted: Fri Aug 14, 2020 2:59 pm
by J. Baker
Having the same issue. Some of the 3D commands have changed and they're are not listed in the PureBasic history. CameraLookAt() doesn't work like CameraLocate(). Some material functions don't seem to exist either. Will keep looking.

Re: Concerning to some commands in PB!

Posted: Fri Aug 14, 2020 3:14 pm
by J. Baker
MoveCamera() seems to do what CameraLocate() did. :D