GetCaptureDepth
ZdepthValue = GetCaptureDepth()
 
Parameters: NONE
Returns:

    ZdepthValue = The Z depth to use for the following captured gfx commands
 

     GetCaptureDepth gets the current Z depth that any following captured graphics commands will be assigned.




FACTS:


      * See CaptureDepth to change current capture depth.



Mini Tutorial:


      This example first creates a camera in part 1. Then in the second part it redirects all graphics output to PlayBASIC's scene buffer. Using the CaptureDepth to control the order of the drawn items



  
  
; ============================
;     Part 1 - Create a Camera
; ============================
  
; create a camera 1.
  CreateCamera 1
  
; Activate the camera Auto Cls
  CameraCls 1,on
  
; Set the Cameras Auto CLS colour
  CameraClsColour 1,RGB(0,55,0)
  
  
; ============================
;     Part 2 - Capture some graphics to the Scene buffer
; ============================
  
; Tell PB to now capture all the following GFX
; commands to the scene buffer rather than draw them
;  immediately
  CaptureToScene
  
; Clear the SceneBuffer
  ClsScene
  
; Tell PB to assign the following captured graphics command
; a scene  DEPTH of 1
  CaptureDepth 1
  
  
; Draw a BLUE circle the Scene
  CircleC 50,50,40,1,RGB(0,0,255)
  
  
; Tell PB to assign the following captured graphics command
; a scene  DEPTH of 20
  CaptureDepth 20
  
; Draw a RED circle the Scene     buffer
  CircleC 70,50,40,1,RGB(255,0,0)
  
  
; Draw the camera and whatever it can see
  DrawCamera 1
  
; Get the Current Capture Depth
  Print GetCaptureDepth()
  
  
  
; Show the user the screen.
  Sync
  
; wait for a key press, before ending
  WaitKey
  
  
  



      If you test this example, you should notice something interesting occurring. While it simply draws two overlapping Blue & RED circles through a camera. If you look carefully, You'll may have noticed that even while the code renders the BLUE circle first, then the RED circle. The RED circle is actually drawn behind the BLUE circle.

      This occurs because prior to rendering each circle to the scene buffer, the code sets the Capturing Z depth of the following items we about to draw with the CaptureDepth command. If you look closely, the Blue circle is being captured at a depth of 1, while the Red circle is being capture a depth of 20.

      So what the camera does, is first order the items in the scene buffer from highest Z depth to lowest, then renders them in this order (highest to lowest). So items with a higher z depth, will be drawn behind items with a lower Z depth, regardless of what order we capture these drawing requests to the scene buffer in.


 
Related Info: CameraBasics | CaptureDepth | CaptureToScene | CaptureVis | ClsScene | GetCaptureVis :
 


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