natiny_surface_get_depth

C
NatinyTexture natiny_surface_get_depth(NatinySurface surf);

The surface's depth buffer, as a texture handle - for a shader that wants to know how far away each pixel was, rather than only what colour it ended up.

Returns 0 for a surface created without depth.

Parameters

Name Type Description
surf NatinySurface Surface handle

Returns

Type Description
NatinyTexture Texture handle, or 0 when the surface has no depth buffer

Example

C
NatinyTexture depth = natiny_surface_get_depth(scene);

Notes

  • The returned texture is owned by the surface and uses a sampleable 32-bit float depth format. It is sampled without filtering.