![]() | ![]() | ![]() | Gwyddion Widgets Library Reference Manual | ![]() |
---|
gwyglmaterialgwyglmaterial — OpenGL materials |
#define GWY_GL_MATERIAL_NONE #define GWY_GL_MATERIAL_EMERALD #define GWY_GL_MATERIAL_JADE #define GWY_GL_MATERIAL_PEARL #define GWY_GL_MATERIAL_TURQUOISE #define GWY_GL_MATERIAL_BRASS #define GWY_GL_MATERIAL_BRONZE #define GWY_GL_MATERIAL_COPPER #define GWY_GL_MATERIAL_GOLD #define GWY_GL_MATERIAL_SILVER GwyGLMaterial; GwyGLMaterialClass; void (*GwyGLMaterialFunc) (const gchar *name, GwyGLMaterial *glmaterial, gpointer user_data); GObject* gwy_gl_material_new (const gchar *name); gchar* gwy_gl_material_get_name (GwyGLMaterial *gl_material); gboolean gwy_gl_material_set_name (GwyGLMaterial *gl_material, const gchar *name); GwyGLMaterial* gwy_gl_material_get_by_name (const gchar *name); gboolean gwy_gl_material_exists (const gchar *name); void gwy_gl_material_foreach (GwyGLMaterialFunc callback, gpointer user_data); void gwy_gl_material_setup_presets (void); guchar* gwy_gl_material_sample (GwyGLMaterial *glmaterial, gint size, guchar *oldsample);
#define GWY_GL_MATERIAL_NONE "None"
Black material independent on light settings.
This is the default material.
#define GWY_GL_MATERIAL_EMERALD "Emerald"
Emerald like mateial. Mainly light green.
typedef struct _GwyGLMaterial GwyGLMaterial;
The GwyGLMaterial struct contains informations about the material properties of OpenGL objects. For details see OpenGL documentation, specifically the light settings and glMaterialfv and glMaterialf functions.
name: name of OpenGL material ambient: vector of the reflectivity of color components (RGBA) of ambient light. All values should be in interval 0-1. diffuse: vector of the reflectivity of color components (RGBA) of diffuse light specular: vector of the reflectivity of color components (RGBA) of specular light shininess: intrisic shininess of the material. Values should be in inteval 0-1. This value is multiplied by factor 128 before passing to the glMaterialf function.
typedef struct { GObjectClass parent_class; GHashTable *materials; } GwyGLMaterialClass;
void (*GwyGLMaterialFunc) (const gchar *name, GwyGLMaterial *glmaterial, gpointer user_data);
Callback function type for gwy_gl_material_foreach().
name : | Open GL Material definition name. |
glmaterial : | Open GL Material definition. |
user_data : | A user-specified pointer. |
GObject* gwy_gl_material_new (const gchar *name);
Returns a Open GL material called name.
Open GL Materials of the same name are singletons, thus if a Open GL material definitions called name already exists, it is returned instead (with reference count incremented).
name can be NULL, a new unique name is invented then.
A newly created Open GL material is non-reflecting non-transparent. The graphical object is black independently of the light settings.
name : | Open GL Material name. |
Returns : | The new Open GL material definition as a GObject. |
gchar* gwy_gl_material_get_name (GwyGLMaterial *gl_material);
Returns the name of Open GL material glmaterial.
gl_material : | A GwyGLMaterial. |
Returns : | The name. It should be considered constant and not modifier or freed. |
gboolean gwy_gl_material_set_name (GwyGLMaterial *gl_material, const gchar *name);
Sets the name of a Open GL material.
This function fails when a Open GL material definition of given name already exists.
gl_material : | A GwyGLMaterial. |
name : | A new name of the Open GL material |
Returns : | Whether the rename was successfull. |
GwyGLMaterial* gwy_gl_material_get_by_name (const gchar *name);
Returns an Open GL material given by name. The function does not incement reference count of material.
name : | A new name of the Open GL material |
Returns : | Open GL material ginven by name or NULL if material does not exists. |
gboolean gwy_gl_material_exists (const gchar *name);
Tests whether a Open GL material definition of given name exists.
name : | A Open GL material name. |
Returns : | TRUE if such a Open GL material definition exists, FALSE otherwise. |
void gwy_gl_material_foreach (GwyGLMaterialFunc callback, gpointer user_data);
Runs callback for each existing Open GL material definition.
callback : | A callback. |
user_data : | User data passed to the callback. |
void gwy_gl_material_setup_presets (void);
Set up built-in Open GL material definitions. To be used in Gwyddion initialization and eventually replaced by loading Open GL material definitions from external files.
guchar* gwy_gl_material_sample (GwyGLMaterial *glmaterial, gint size, guchar *oldsample);
Fills the GdkPixbuf-like field of RRGGBBAA integer values representing the material.
If oldsample is not NULL, it's resized to 4*size bytes, otherwise it's newly allocated.
glmaterial : | Open GL Material definition. |
size : | Required sample size. |
oldsample : | Pointer to array to be filled. |
Returns : | The sampled material. The sample is somewhat arbitrary, as lighting has more than one degree of freedom, but shows the material from unlit to some `fully lit' state. |
<< Gwy3DWindow | General Widgets >> |