![]() |
GLam Collection version 0.4 - | ACCUEIL - CLASSES - HIERARCHIE - MEMBRES - EXEMPLES |
Caractéristiques de réflexion d'un matériau. Plus de détails...
#include <glammaterial.h>
Fonctions membres publiques | |
GLamMaterial (const char *name) | |
GLamMaterial (const char *filename, const char *name) | |
const char * | name () const |
float * | ambient () |
float * | diffuse () |
float * | specular () |
float * | emission () |
float | ambient (int i) const |
float | diffuse (int i) const |
float | specular (int i) const |
float | emission (int i) const |
float | shininess () const |
float | alpha () const |
void | setAmbient (float r, float g, float b, float a=1.0) |
void | setDiffuse (float r, float g, float b, float a=1.0) |
void | setSpecular (float r, float g, float b, float a=1.0) |
void | setEmission (float r, float g, float b, float a=1.0) |
void | setShininess (float shininess) |
void | setAlpha (float alpha) |
float * | mat10 () |
Caractéristiques de réflexion d'un matériau.
La classe GLamMaterial encapsule les propriétés de réflexion d'un matériau :
Les composantes RVBA (Rouge-Vert-Bleu-Alpha) sont dans l'intervalle 0..1, la brillance dans l'intervalle 0..128. La composante Alpha caractérise la transparence du matériau, elle est manipulable séparément.
Chaque objet créé peut se voir attribuer un nom sous forme de chaine de caractères.
ambient
: Réflexion ambiante, RVBA = ( 0.2, 0.2, 0.2, 1.0 ) par défaut. L'argument i doit être compris entre 0 et 3 (respectivement R,V,B ou A).
diffuse
: Réflexion diffuse, RVBA = ( 0.8, 0.8, 0.8, 1.0 ) par défaut. L'argument i doit être compris entre 0 et 3 (respectivement R,V,B ou A).
specular
: Réflexion spéculaire, RVBA = ( 0.0, 0.0, 0.0, 1.0 ) par défaut. L'argument i doit être compris entre 0 et 3 (respectivement R,V,B ou A).
emission
: Facteurs d'émission, RVBA = ( 0.0, 0.0, 0.0, 1.0 ) par défaut. L'argument i doit être compris entre 0 et 3 (respectivement R,V,B ou A).
shininess
: Brillance (0 par défaut).
alpha
: Transparence (1.0 par défaut).
GLamMaterial::GLamMaterial | ( | const char * | name | ) |
Constructeur.
GLamMaterial::GLamMaterial | ( | const char * | filename, | |
const char * | name | |||
) |
Constructeur par lecture d'un fichier de données.
Une entrée dans le fichier doit contenir 11 champs séparés par des espaces :
Le premier champ doit toujours occuper le premier caractère d'une ligne.
Exemple de fichier de données :
# name Ra Ga Ba Rd Gd Bd Rs Gs Bs shininess
Emerald 0.0215 0.1745 0.0215 0.07568 0.61424 0.07568 0.633 0.727811 0.633 76.8
Jade 0.135 0.2225 0.1575 0.54 0.89 0.63 0.316228 0.316228 0.316228 12.8
Obsidian 0.05375 0.05 0.06625 0.18275 0.17 0.22525 0.332741 0.328634 0.346435 38.4
Pearl 0.25 0.20725 0.20725 1.0 0.829 0.829 0.296648 0.296648 0.296648 11.264
Ruby 0.1745 0.01175 0.01175 0.61424 0.04136 0.04136 0.727811 0.626959 0.626959 76.8
Turquoise 0.1 0.18725 0.1745 0.396 0.74151 0.69102 0.297254 0.30829 0.306678 12.8
Brass 0.329412 0.223529 0.027451 0.780392 0.568627 0.113725 0.992157 0.941176 0.807843 27.8974
Bronze 0.2125 0.1275 0.054 0.714 0.4284 0.18144 0.393548 0.271906 0.166721 25.6
Chrome 0.25 0.25 0.25 0.4 0.4 0.4 0.774597 0.774597 0.774597 76.8
Copper 0.19125 0.0735 0.0225 0.7038 0.27048 0.0828 0.256777 0.137622 0.086014 12.8
Gold 0.24725 0.1995 0.0745 0.75164 0.60648 0.22648 0.628281 0.555802 0.366065 51.2
Silver 0.19225 0.19225 0.19225 0.50754 0.50754 0.50754 0.508273 0.508273 0.508273 51.2
Pewter 0.105882 0.058824 0.113725 0.427451 0.470588 0.541176 0.333333 0.333333 0.521569 9.84615
BlackPlastic 0.0 0.0 0.0 0.01 0.01 0.01 0.50 0.50 0.50 32.0
CyanPlastic 0.0 0.1 0.06 0.0 0.50980392 0.50980392 0.50196078 0.50196078 0.50196078 32.0
GreenPlastic 0.0 0.0 0.0 0.1 0.35 0.1 0.45 0.55 0.45 32.0
RedPlastic 0.0 0.0 0.0 0.5 0.0 0.0 0.7 0.6 0.6 32.0
WhitePlastic 0.0 0.0 0.0 0.55 0.55 0.55 0.70 0.70 0.70 32.0
YellowPlastic 0.0 0.0 0.0 0.5 0.5 0.0 0.60 0.60 0.50 32.0
BlackRubber 0.02 0.02 0.02 0.01 0.01 0.01 0.4 0.4 0.4 10.0
CyanRubber 0.0 0.05 0.05 0.4 0.5 0.5 0.04 0.7 0.7 10.0
GreenRubber 0.0 0.05 0.0 0.4 0.5 0.4 0.04 0.7 0.04 10.0
RedRubber 0.05 0.0 0.0 0.5 0.4 0.4 0.7 0.04 0.04 10.0
WhiteRubber 0.05 0.05 0.05 0.5 0.5 0.5 0.7 0.7 0.7 10.0
YellowRubber 0.05 0.05 0.0 0.5 0.5 0.4 0.7 0.7 0.04 10.0
float GLamMaterial::alpha | ( | ) | const [inline] |
Propriété alpha.
float GLamMaterial::ambient | ( | int | i | ) | const [inline] |
Propriété ambient.
float* GLamMaterial::ambient | ( | ) | [inline] |
Propriété ambient.
float GLamMaterial::diffuse | ( | int | i | ) | const [inline] |
Propriété diffuse.
float* GLamMaterial::diffuse | ( | ) | [inline] |
Propriété diffuse.
float GLamMaterial::emission | ( | int | i | ) | const [inline] |
Propriété emission.
float* GLamMaterial::emission | ( | ) | [inline] |
Propriété emission.
float * GLamMaterial::mat10 | ( | ) |
Retourne un tableau de 10 valeurs correspondant aux proportions RVB des réflexions ambiante, diffuse et spéculaire suivies du coefficient de brillance.
const char* GLamMaterial::name | ( | ) | const [inline] |
retourne le nom du matériau défini lors de la construction.
void GLamMaterial::setAlpha | ( | float | alpha | ) | [inline] |
Propriété alpha.
void GLamMaterial::setAmbient | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a = 1.0 | |||
) | [inline] |
Propriété ambient.
void GLamMaterial::setDiffuse | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a = 1.0 | |||
) | [inline] |
Propriété diffuse.
void GLamMaterial::setEmission | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a = 1.0 | |||
) | [inline] |
Propriété emission.
void GLamMaterial::setShininess | ( | float | shininess | ) | [inline] |
Propriété shininess.
void GLamMaterial::setSpecular | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a = 1.0 | |||
) | [inline] |
Propriété specular.
float GLamMaterial::shininess | ( | ) | const [inline] |
Propriété shininess.
float GLamMaterial::specular | ( | int | i | ) | const [inline] |
Propriété specular.
float* GLamMaterial::specular | ( | ) | [inline] |
Propriété specular.