GwyGLMaterial

GwyGLMaterial — OpenGL material representation

Synopsis




#define             GWY_GL_MATERIAL_DEFAULT
#define             GWY_GL_MATERIAL_NONE
                    GwyGLMaterial;
                    GwyGLMaterialClass;
const GwyRGBA*      gwy_gl_material_get_ambient         (GwyGLMaterial *gl_material);
void                gwy_gl_material_set_ambient         (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *ambient);
const GwyRGBA*      gwy_gl_material_get_diffuse         (GwyGLMaterial *gl_material);
void                gwy_gl_material_set_diffuse         (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *diffuse);
const GwyRGBA*      gwy_gl_material_get_specular        (GwyGLMaterial *gl_material);
void                gwy_gl_material_set_specular        (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *specular);
const GwyRGBA*      gwy_gl_material_get_emission        (GwyGLMaterial *gl_material);
void                gwy_gl_material_set_emission        (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *emission);
gdouble             gwy_gl_material_get_shininess       (GwyGLMaterial *gl_material);
void                gwy_gl_material_set_shininess       (GwyGLMaterial *gl_material,
                                                         gdouble shininess);
void                gwy_gl_material_sample_to_pixbuf    (GwyGLMaterial *gl_material,
                                                         GdkPixbuf *pixbuf);
void                gwy_gl_material_reset               (GwyGLMaterial *gl_material);
GwyInventory*       gwy_gl_materials                    (void);
GwyGLMaterial*      gwy_gl_materials_get_gl_material    (const gchar *name);

Object Hierarchy


  GObject
   +----GwyResource
         +----GwyGLMaterial

Description

GwyGLMaterial represents an OpenGL material. Its properties directly map to corresponding OpenGL material characteristics, all are in the range [0,1].

Gradient objects can be obtained from gwy_gl_materials_get_gl_material(). New GL materials can be created with gwy_inventory_new_item() on the GwyInventory returned by gwy_gl_materials().

Details

GWY_GL_MATERIAL_DEFAULT

#define GWY_GL_MATERIAL_DEFAULT "OpenGL-Default"

The name of the default OpenGL material.

It is guaranteed to always exist.

Note this is not the same as user's default material which corresponds to the default item in gwy_gl_materials() inventory and it change over time.


GWY_GL_MATERIAL_NONE

#define GWY_GL_MATERIAL_NONE    "None"

The name of special void material with all characteristics zero.

It is guaranteed to exist, but you should rarely actually need it.


GwyGLMaterial

typedef struct _GwyGLMaterial GwyGLMaterial;

The GwyGLMaterial struct contains private data only and should be accessed using the functions below.


GwyGLMaterialClass

typedef struct _GwyGLMaterialClass GwyGLMaterialClass;

GwyGLMaterialClass does not contain any public members.


gwy_gl_material_get_ambient ()

const GwyRGBA*      gwy_gl_material_get_ambient         (GwyGLMaterial *gl_material);

Gets the ambient reflectance of a GL material.

gl_material : A GL material.
Returns : Ambient reflectance (owned by GL material, must not be modified nor freed).

gwy_gl_material_set_ambient ()

void                gwy_gl_material_set_ambient         (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *ambient);

Sets the ambient reflectance of a GL material.

gl_material : A GL material.
ambient : Ambient reflectance.

gwy_gl_material_get_diffuse ()

const GwyRGBA*      gwy_gl_material_get_diffuse         (GwyGLMaterial *gl_material);

Gets the diffuse reflectance of a GL material.

gl_material : A GL material.
Returns : Diffuse reflectance (owned by GL material, must not be modified nor freed).

gwy_gl_material_set_diffuse ()

void                gwy_gl_material_set_diffuse         (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *diffuse);

Sets the diffuse reflectance of a GL material.

gl_material : A GL material.
diffuse : Diffuse reflectance.

gwy_gl_material_get_specular ()

const GwyRGBA*      gwy_gl_material_get_specular        (GwyGLMaterial *gl_material);

Gets the specular reflectance of a GL material.

gl_material : A GL material.
Returns : Specular reflectance (owned by GL material, must not be modified nor freed).

gwy_gl_material_set_specular ()

void                gwy_gl_material_set_specular        (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *specular);

Sets the specular reflectance of a GL material.

gl_material : A GL material.
specular : Specular reflectance.

gwy_gl_material_get_emission ()

const GwyRGBA*      gwy_gl_material_get_emission        (GwyGLMaterial *gl_material);

Gets the emission component of a GL material.

gl_material : A GL material.
Returns : Emission component (owned by GL material, must not be modified nor freed).

gwy_gl_material_set_emission ()

void                gwy_gl_material_set_emission        (GwyGLMaterial *gl_material,
                                                         const GwyRGBA *emission);

Sets the emission component of a GL material.

gl_material : A GL material.
emission : Emission component.

gwy_gl_material_get_shininess ()

gdouble             gwy_gl_material_get_shininess       (GwyGLMaterial *gl_material);

Gets the shininess value of a GL material.

gl_material : A GL material.
Returns : The shininess value (in range 0..1, not 0..128).

gwy_gl_material_set_shininess ()

void                gwy_gl_material_set_shininess       (GwyGLMaterial *gl_material,
                                                         gdouble shininess);

Sets the shininess value of a GL material.

gl_material : A GL material.
shininess : Shinniness value (in range 0..1, not 0..128).

gwy_gl_material_sample_to_pixbuf ()

void                gwy_gl_material_sample_to_pixbuf    (GwyGLMaterial *gl_material,
                                                         GdkPixbuf *pixbuf);

Samples GL material to a provided pixbuf.

gl_material : A GL material to sample.
pixbuf : A pixbuf to sample gl_material to (in horizontal direction).

gwy_gl_material_reset ()

void                gwy_gl_material_reset               (GwyGLMaterial *gl_material);

Resets a GL material to default values.

gl_material : A GL material.

gwy_gl_materials ()

GwyInventory*       gwy_gl_materials                    (void);

Gets inventory with all the GL materials.

Returns : GL material inventory.

gwy_gl_materials_get_gl_material ()

GwyGLMaterial*      gwy_gl_materials_get_gl_material    (const gchar *name);

Convenience function to get a GL material from gwy_gl_materials() by name.

name : GL material name. May be NULL to get the default GL material.
Returns : GL material identified by name or the default GL material if name does not exist.

See Also

Gwy3DView -- 3D data display widget, GwyRGBA -- representation of color components, GwyInventory -- the container holding all GL materials