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

FreeBSD Manual Pages

  
 
  

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

NAME
     SG_Image -- Agar-SG polygonal 2D image object

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

DESCRIPTION
     The  SG_Image  node  maps	an input image onto a polygonal mesh.  If trans-
     parency information is available, SG_Image generates a complex polygon con-
     tour for the image.

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

INITIALIZATION
     SG_Image * SG_ImageNew(SG_Node *parent, const char *name)

     SG_Image * SG_ImageFromSurface(SG_Node *parent, const char  *name,  AG_Sur-
     face *s)

     SG_Image  *  SG_ImageFromSurfaceNODUP(SG_Node  *parent,  const  char *name,
     AG_Surface *s)

     SG_Image  *  SG_ImageFromAnim(SG_Node  *parent,  const  char  *name,  const
     AG_Anim *anim)

     SG_Image * SG_ImageFromAnimNODUP(SG_Node *parent, const char *name, AG_Anim
     *anim)

     void SG_ImageSetSurface(SG_Image *bb, const AG_Surface *s, M_Real scale)

     void SG_ImageSetSurfaceNODUP(SG_Image *bb, AG_Surface *s)

     int SG_ImageSetAnim(SG_Image *bb, AG_Anim *anim)

     int SG_ImageSetAnimNODUP(SG_Image *bb, AG_Anim *anim)

     void SG_ImageAnimPlay(SG_Image *bb)

     void SG_ImageAnimStop(SG_Image *bb)

     void SG_ImageSetShape(SG_Image *bb, enum sg_image_shape shape)

     void SG_ImageSetShapeAuto(SG_Image *bb)

     void SG_ImageSetProj(SG_Image *bb, int enable)

     void SG_ImageSetTolContour(SG_Image *bb, float tol)

     void SG_ImageSetSize(SG_Image *bb, M_Real w, M_Real h)

     void SG_ImageSetColor(SG_Image *bb, const AG_Color *c)

     The  SG_ImageNew()  function  creates a new image node at the origin of the
     parent node.  The SG_ImageFromSurface() and SG_ImageFromAnim() variants set
     an initial surface or animation.

     The SG_ImageSetSurface() function loads the specified surface.  Image  pix-
     els are related to SG(3) node coordinates by the scaling factor scale.

     The   SG_ImageSetAnim()   function   loads  the  specified  animation  (see
     AG_Anim(3)).  Playback can be initiated or stopped with  SG_ImageAnimPlay()
     and SG_ImageAnimStop().

     SG_ImageSetShape()  selects the contour shape for the image object.  Possi-
     ble values for shape include:

     SG_IMAGE_RECT	Render as solid rectangle.

     SG_IMAGE_POLYGON	Render as a complex polygon calculated from the contours
			of the image.  The contour of the polygon is reduced  to
			a manageable set of vertices using Douglas-Peucker poly-
			gon simplification.

     The   SG_ImageSetShapeAuto()   function   scans   the   image  and  selects
     SG_IMAGE_POLYGON if a usable shape exists over  a	transparent  background,
     otherwise the SG_IMAGE_RECT shape is selected.

     SG_ImageSetProj()	configures the image projection mode.  If an argument of
     1 is given, the image object will be rendered as to always face the camera.
     Otherwise, the object is rendered as a textured plane in its original  ori-
     entation (the default).

     SG_ImageSetTolContour()  sets the tolerance for Douglas-Peucker simplifica-
     tion (default is 10.0).

     SG_ImageSetSize() sets the relative size of the image  (default  is  1.0  x
     1.0).

     SG_ImageSetColor()  sets  the  background	color (RGBA) of the image object
     (default is transparent black).

FLAGS
     The following public SG_Image flags are defined:

     SG_IMAGE_BILLBOARD   Enable billboard projection (image will be rendered as
			  facing the camera).

     SG_IMAGE_WIREFRAME   Overlay the wireframe structure  ontop  of  the  image
			  surface.   This  can be useful when adjusting the con-
			  tour tolerance.

STRUCTURE DATA
     For the SG_Image object:

     Uint flags 	Option flags (see "FLAGS" section).

     M_Color color	Background color.

     AG_Surface *su	Current source surface (read-only; use

     M_Real w		Width (default is 1.0).

     M_Real h		Height (default is 1.0).

     float tolContour	Tolerance for polygon simplification (default is 10.0).

SEE ALSO
     AG_Surface(3),  M_Color(3),  M_Real(3),  M_Vector(3),  SG(3),  SG_Intro(3),
     SG_Node(3), SG_Plane(3)

HISTORY
     The SG_Image node class first appeared in Agar 1.6.0.

Agar 1.7			December 21, 2022		     SG_IMAGE(3)

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

home | help