natiny_surface_get_depth
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
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.
- Only slot 0's depth buffer takes part in a pass; a surface bound to another slot contributes colour alone.
- Invalid surfaces and surfaces created without depth return
0.