CameraGrabWorld
CameraGrabWorld CameraIndex, WorldIndex
 
Parameters:

    CameraIndex = The camera index you wish to use screen the world data with
    WorldIndex = The world buffer index that you wish to grab from
Returns: NONE
 

      CameraGrabWorld transfers the previously captured graphics elements from a world, to the scene buffer. It's important to note, that this process only transfers those elements from world that are in view (in front) of the camera, in it's current position. So we use this to grab the visible regions of the world when moving through a larger world.



FACTS:


      * CameraGrabWorld will only transfer those items in the world that are in front of the camera.



Mini Tutorial:


      This example first creates a world, then fills this world buffer full of static stars (dots). During the main loop, it grabs a camera full of this data from the world buffer and places it in the scenebuffer. Then calls the camera to render it. This allows us to mix data from different worlds, through different cameras, and maintain the scenes depth.


  
; Create WOrld
  CreateWorld 1
  
; Tell PB to Capture ALL folloing GFX commands
; to this world buffer
  CaptureToWorld 1
  
; Plot 1000 Stars into this world buffer
  Stars=1000
  W=GetScreenWidth()
  H=GetScreenHeight()
  
  For lp =0 To Stars
     X=Rnd(w)
     y=Rnd(h)
     c=RndRGB()
     DotC x,y,c
     DotC x+w,y,c
  Next
  
; Create camera
  CreateCamera 5
  
  
; Start of DO/LOOP
  Do
     
   ; Enable Capturing to Scene Buffer
     CaptureToScene
     
   ; Clear the scene buffer
     ClsScene
     
   ; Transfer what data camera 5 and see
   ; from the World buffer To the scene buffer
     CameraGrabWorld 5,1
     
   ; Draw Camera #5
     DrawCamera 5
     
   ; Move the camera
     x#=x#+1
     PositionCameraX 5,X#
     If x#=>Then x#=x#-w
     
   ; Display the screen
     Sync
     
   ; Loop back to the DO
  Loop
  




This example would output.

  
  no Text Output
  

 
Related Info: CameraBasics | CameraGrabWorldAt | NewCamera :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com