natiny_camera_set_clip

C
void natiny_camera_set_clip(NatinyCamera cam, float near_z, float far_z);

Sets the near and far planes of a camera, in world units. Nothing closer than near_z or further than far_z is drawn, and the depth buffer spreads its precision between them.

Parameters

Name Type Description
cam NatinyCamera Camera handle
near_z float Distance to the near plane; must be above 0
far_z float Distance to the far plane; must be beyond near_z

Example

C
natiny_camera_set_clip(cam, 0.2f, 2000.0f);

Notes

  • Defaults are 0.1f and 100.0f.
  • near_z is clamped to at least 0.0001f; far_z is clamped to at least near_z * 1.001f.
  • A large far_z / near_z ratio reduces depth-buffer precision.