Agar Logo

Agar 1.7 Manual

(Printable Version)
SG_Texture(3)

SYNOPSIS

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

DESCRIPTION

The SG_Texture object describes texture information which may be attached to SG_Object(3) nodes in a SG(3) scene. Materials have the following properties:
  • Texture image (one surface, or multiple blended surfaces).
  • Emissive, ambient, diffuse and specular color components.
  • Shininess (specular exponent).
  • Ties to fragment shader programs (see SG_Program(3)).

INHERITANCE HIERARCHY

AG_Object(3)-> SG_Texture.

INTERFACE


SG_Texture * SG_TextureNew (SG_Node *parent, const char *name)

SG_TextureSurface * SG_TextureAddSurface (SG_Texture *tex, const AG_Surface *s)

SG_TextureSurface * SG_TextureAddSurfaceNODUP (SG_Texture *tex, AG_Surface *s)

void SG_TextureDelSurface (SG_Texture *tex, SG_TextureSurface *ts)

SG_TextureProgram * SG_TextureAddProgram (SG_Texture *tex, SG_Program *prog)

void SG_TextureDelProgram (SG_Texture *tex, SG_TextureProgram *tp)

int SG_TextureCompile (SG_Texture *tex)


The SG_TextureNew() function allocates, initializes, and attaches a SG_Texture object.

The SG_TextureAddSurface() function inserts a copy of the given AG_Surface(3). The SG_TextureAddSurfaceNODUP() variant inserts a pointer to a surface which must remain valid as long as the SG_Texture exists. SG_TextureDelSurface() deletes the specified surface.

SG_TextureAddProgram() inserts the specified fragment program (see SG_Program(3)), which will be used when rendering the texture. SG_TextureDelProgram() removes the specified fragment program.

The SG_TextureCompile() function blends the input surfaces and generates the final texture surface.

STRUCTURE DATA

For the SG_Texture object:
M_Color emissive Light emitted by surface (Ke)
M_Color ambient Ambient reflectance (Ka)
M_Color diffuse Diffuse reflectance (Kd)
M_Color specular Specular reflectance (Ks)
M_Real shininess Specular exponent
AG_Surface *surfaces Input surface(s)
Uint nSurfaces Input surface count

SEE ALSO


HISTORY

The SG_Texture object first appeared in Agar 1.6.0.

Csoft.net ElectronTubeStore