Returns projected depth value (from last b3dCameraProject call, 0=near 1=far).
Takes camera (camera entity handle).
Returns depth in range [0,1] (Double), or 0.0 if invalid camera or camera->camera==nullptr.
3D Graphics
Parameters & Returns
Parameters
cameraInt
Returns
Double
Quick Summary
Returns projected depth value (from last b3dCameraProject call, 0=near 1=far).
Takes camera (camera entity handle).
Returns depth in range [0,1] (Double), or 0.0 if invalid camera or camera->camera==nullptr.
Technical Exegesis...
Returns projected depth value (from last b3dCameraProject call, 0=near 1=far). Takes camera (camera entity handle). Returns depth in range [0,1] (Double), or 0.0 if invalid camera or camera->camera==nullptr. Reads camera->projectedZ value stored by b3dCameraProject. Depth corresponds to Z-buffer value (0=near plane, 1=far plane).
This function retrieves depth result.
Returns projected depth value (from last b3dCameraProject call, 0=near 1=far). Takes camera (camera entity handle). Returns depth in range [0,1] (Double), or 0.0 if invalid camera or camera->camera==nullptr. Reads camera->projectedZ value stored by b3dCameraProject. Depth corresponds to Z-buffer value (0=near plane, 1=far plane).
This function retrieves depth result. Projection sequence: (1) Call b3dCameraProject(camera, worldX, worldY, worldZ) to transform 3D position, (2) Call b3dProjectedZ(camera) to get depth (and b3dProjectedX/Y for screen coordinates). Depth range: 0.0 = at near clip plane (closest), 1.0 = at far clip plane (furthest), values < 0 or > 1 indicate outside depth range (behind camera or beyond far plane). Use cases: (1) Depth sorting (sort 2D elements by depth for proper layering, draw distant first), (2) Occlusion (hide labels behind geometry by comparing depth), (3) Distance effects (fade labels based on depth), (4) Visibility culling (skip rendering if depth < 0 or depth > 1, object outside frustum), (5) Fog simulation (apply fog to 2D elements based on depth). Common pattern: b3dCameraProject(cam, entX, entY, entZ), depth=b3dProjectedZ(cam), if depth > 0 and depth < 1 then draw (object in view frustum). Typical usage: check depth range before drawing name tags (avoid drawing objects behind camera), sort multiple labels by depth for correct occlusion. Behind camera detection: if depth < 0, object is behind camera (not visible, don't draw), critical for name tags (prevents drawing objects behind player). Beyond far plane: if depth > 1, object is beyond far clip plane (may be clipped, typically still drawn but may be culled). Depth sorting: entities with higher depth are further away (draw first), entities with lower depth are closer (draw last, occlude distant), sort ascending depth for painter's algorithm. Performance: O(1) lookup (simple struct field access, no computation). Validation: returns 0.0 if camera invalid or camera->camera==nullptr (must call b3dCameraProject first to allocate and populate Camera3D). Related: b3dCameraProject performs projection (stores projectedX/Y/Z), b3dProjectedX/Y retrieve screen coordinates, b3dCameraRange sets near/far clip planes.