Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SG_LIGHT(3)		    Library Functions Manual		   SG_LIGHT(3)

NAME
       SG_Light	-- Agar-SG light source	node

SYNOPSIS
       #include	<agar/core.h>
       #include	<agar/sg.h>

DESCRIPTION
       The  SG_Light node defines a light source in a SG(3) scene-graph.  Each
       light source is associated with a  priority  number,  which  determines
       which lights are	used in	the rendering.	The number of lights supported
       for rendering is	dependent on the renderer implementation.

INHERITANCE HIERARCHY
       AG_Object(3) -> SG_Node(3) -> SG_Light.

INITIALIZATION
       SG_Light	* SG_LightNew(SG_Node *parent, const char *name)

       void SG_LightAmbient(SG_Light *lt, M_Color c)

       void SG_LightDiffuse(SG_Light *lt, M_Color c)

       void SG_LightSpecular(SG_Light *lt, M_Color c)

       void   SG_LightSpot(SG_Light   *lt,  M_Real  cutoff,  M_Real  exponent,
       M_Vector3 dir)

       The SG_LightNew()  function  allocates,	initializes,  and  attaches  a
       SG_Light	object.

       The	functions     SG_LightAmbient(),     SG_LightDiffuse()	   and
       SG_LightSpecular() configure the	colors associated  with	 the  ambient,
       diffuse and specular components of the light source.

       SG_LightSpot()  sets  the  spot parameters of the light source.	cutoff
       specifies the cutoff angle in degrees, exponent specifies the light in-
       tensity (the higher the exponent, the more focused the light source;  a
       value  of  0  provides  uniform distribution), and dir is the direction
       vector.	If the cutoff angle is < 180 degrees, the light	source is  di-
       rectional,  otherwise it	is treated as a	point source and the direction
       vector is ignored.

INTERNAL WIDGET	API
       void SG_LightSetup(SG_Light *lt,	SG_View	*sv)

       The SG_LightSetup() function sets up  the  renderer  states  associated
       with  a	light,	prior  to rendering.  This function is usually invoked
       from the	draw() operation of an SG_View(3) (or derived)	widget,	 prior
       to rendering a scene.

STRUCTURE DATA
       For the SG_Light	object:

       int pri		      Priority	of light source	when number of sources
			      is limited (0 = highest priority).

       M_Color ambient	      Ambient color component of source.

       M_Color diffuse	      Diffuse color component of source.

       M_Color specular	      Specular color component of source.

       M_Real spot_cutoff     Spotlight	 cutoff	 angle	(or  180   for	 point
			      source).

       M_Real spot_exponent   Spotlight	intensity distribution.

       M_Vector3 spot_dir     Spotlight	direction.

       M_Real Kc	      Constant light attenuation factor.

       M_Real Kl	      Linear light attenuation factor.

       M_Real Kq	      Quadratic	light attenuation factor.

SEE ALSO
       M_Real(3), M_Vector(3), SG(3), SG_Intro(3), SG_Node(3), SG_View(3)

HISTORY
       The SG_Light node class first appeared in Agar 1.6.0.

Agar 1.7		       December	21, 2022		   SG_LIGHT(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=SG_Light&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help