##### Ninja Library - Light Function

# njSetLightRange

Sets the limit distance for light that was set by the njCreateLight() function

### FORMAT

`

  void njSetLightRange( *ptr, nrang, frang )
  NJS_LIGHT *ptr
  Float nrang
  Float frang

`

### PARAMETER

  `*ptr` | Pointer to light source
  `nrang` | Front distance limit
  `frang` | Back distance limit

### RETURN

  None

### DESCRIPTION

  Sets light source distance limit required for setting spotlight and distance calculation of `njCreateLight()` function. Although brightness increases nearer the point light source, its intensity is limited to that capable of being displayed by the monitor. Therefore, for the NINJA light model, when closer than the specified distance to the light source, the maximum luminance is maintained in the light source calculation. This value is set as the front distance limit. Additionally, as the distance from the light source increases, luminance decreases gradually. However, it is not important to calculate the entire distance. The distance at which the calculation begins decreasing (i.e., where the light begins fading) is set as the back distance limit. Although the default value of nrang is set as 1.f, nrang, it is set considering the size of the model or distance between models.

### EXAMPLE

      #include <Shinobi.h>
      	:
      NJS_LIGHT light;
      sbInitSystem( NJD_RESOLUTION_VGA, NJD_FRAMEBUFFER_MODE_RGB565, 1);
      njCreateLight(&light, NJD_SPEC_POINT);
      	:
      /* Front distance limit of the point light source with specula is set to 20.f
         and the back distance limit to 80.f */
      njSetLightRange(&light, 20.f, 80.f);

### NOTE

  Light source needs to be designated in `njCreateLight()` function.

### REFERENCE

  `njCreateLight()
  njSetLightAngle()
  `

njSetLightRange

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999